const Block_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$f,
  assign: assign$1,
  create_slot: create_slot$3,
  detach: detach$f,
  element: element$c,
  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$f,
  insert: insert$f,
  safe_not_equal: safe_not_equal$g,
  set_dynamic_element_data,
  set_style: set_style$3,
  toggle_class: toggle_class$7,
  transition_in: transition_in$7,
  transition_out: transition_out$7,
  update_slot_base: update_slot_base$3
} = window.__gradio__svelte__internal;
function create_dynamic_element(y) {
  let s, e, l;
  const p = (
    /*#slots*/
    y[18].default
  ), _ = create_slot$3(
    p,
    y,
    /*$$scope*/
    y[17],
    null
  );
  let x = [
    { "data-testid": (
      /*test_id*/
      y[7]
    ) },
    { id: (
      /*elem_id*/
      y[2]
    ) },
    {
      class: e = "block " + /*elem_classes*/
      y[3].join(" ") + " svelte-1t38q2d"
    }
  ], o = {};
  for (let g = 0; g < x.length; g += 1)
    o = assign$1(o, x[g]);
  return {
    c() {
      s = element$c(
        /*tag*/
        y[14]
      ), _ && _.c(), set_dynamic_element_data(
        /*tag*/
        y[14]
      )(s, o), toggle_class$7(
        s,
        "hidden",
        /*visible*/
        y[10] === !1
      ), toggle_class$7(
        s,
        "padded",
        /*padding*/
        y[6]
      ), toggle_class$7(
        s,
        "border_focus",
        /*border_mode*/
        y[5] === "focus"
      ), toggle_class$7(s, "hide-container", !/*explicit_call*/
      y[8] && !/*container*/
      y[9]), set_style$3(
        s,
        "height",
        /*get_dimension*/
        y[15](
          /*height*/
          y[0]
        )
      ), set_style$3(s, "width", typeof /*width*/
      y[1] == "number" ? `calc(min(${/*width*/
      y[1]}px, 100%))` : (
        /*get_dimension*/
        y[15](
          /*width*/
          y[1]
        )
      )), set_style$3(
        s,
        "border-style",
        /*variant*/
        y[4]
      ), set_style$3(
        s,
        "overflow",
        /*allow_overflow*/
        y[11] ? "visible" : "hidden"
      ), set_style$3(
        s,
        "flex-grow",
        /*scale*/
        y[12]
      ), set_style$3(s, "min-width", `calc(min(${/*min_width*/
      y[13]}px, 100%))`), set_style$3(s, "border-width", "var(--block-border-width)");
    },
    m(g, E) {
      insert$f(g, s, E), _ && _.m(s, null), l = !0;
    },
    p(g, E) {
      _ && _.p && (!l || E & /*$$scope*/
      131072) && update_slot_base$3(
        _,
        p,
        g,
        /*$$scope*/
        g[17],
        l ? get_slot_changes$3(
          p,
          /*$$scope*/
          g[17],
          E,
          null
        ) : get_all_dirty_from_scope$3(
          /*$$scope*/
          g[17]
        ),
        null
      ), set_dynamic_element_data(
        /*tag*/
        g[14]
      )(s, o = get_spread_update$1(x, [
        (!l || E & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          g[7]
        ) },
        (!l || E & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          g[2]
        ) },
        (!l || E & /*elem_classes*/
        8 && e !== (e = "block " + /*elem_classes*/
        g[3].join(" ") + " svelte-1t38q2d")) && { class: e }
      ])), toggle_class$7(
        s,
        "hidden",
        /*visible*/
        g[10] === !1
      ), toggle_class$7(
        s,
        "padded",
        /*padding*/
        g[6]
      ), toggle_class$7(
        s,
        "border_focus",
        /*border_mode*/
        g[5] === "focus"
      ), toggle_class$7(s, "hide-container", !/*explicit_call*/
      g[8] && !/*container*/
      g[9]), E & /*height*/
      1 && set_style$3(
        s,
        "height",
        /*get_dimension*/
        g[15](
          /*height*/
          g[0]
        )
      ), E & /*width*/
      2 && set_style$3(s, "width", typeof /*width*/
      g[1] == "number" ? `calc(min(${/*width*/
      g[1]}px, 100%))` : (
        /*get_dimension*/
        g[15](
          /*width*/
          g[1]
        )
      )), E & /*variant*/
      16 && set_style$3(
        s,
        "border-style",
        /*variant*/
        g[4]
      ), E & /*allow_overflow*/
      2048 && set_style$3(
        s,
        "overflow",
        /*allow_overflow*/
        g[11] ? "visible" : "hidden"
      ), E & /*scale*/
      4096 && set_style$3(
        s,
        "flex-grow",
        /*scale*/
        g[12]
      ), E & /*min_width*/
      8192 && set_style$3(s, "min-width", `calc(min(${/*min_width*/
      g[13]}px, 100%))`);
    },
    i(g) {
      l || (transition_in$7(_, g), l = !0);
    },
    o(g) {
      transition_out$7(_, g), l = !1;
    },
    d(g) {
      g && detach$f(s), _ && _.d(g);
    }
  };
}
function create_fragment$f(y) {
  let s, e = (
    /*tag*/
    y[14] && create_dynamic_element(y)
  );
  return {
    c() {
      e && e.c();
    },
    m(l, p) {
      e && e.m(l, p), s = !0;
    },
    p(l, [p]) {
      /*tag*/
      l[14] && e.p(l, p);
    },
    i(l) {
      s || (transition_in$7(e, l), s = !0);
    },
    o(l) {
      transition_out$7(e, l), s = !1;
    },
    d(l) {
      e && e.d(l);
    }
  };
}
function instance$d(y, s, e) {
  let { $$slots: l = {}, $$scope: p } = s, { height: _ = void 0 } = s, { width: x = void 0 } = s, { elem_id: o = "" } = s, { elem_classes: g = [] } = s, { variant: E = "solid" } = s, { border_mode: u = "base" } = s, { padding: A = !0 } = s, { type: L = "normal" } = s, { test_id: C = void 0 } = s, { explicit_call: D = !1 } = s, { container: r = !0 } = s, { visible: n = !0 } = s, { allow_overflow: b = !0 } = s, { scale: f = null } = s, { min_width: c = 0 } = s, t = L === "fieldset" ? "fieldset" : "div";
  const a = (h) => {
    if (h !== void 0) {
      if (typeof h == "number")
        return h + "px";
      if (typeof h == "string")
        return h;
    }
  };
  return y.$$set = (h) => {
    "height" in h && e(0, _ = h.height), "width" in h && e(1, x = h.width), "elem_id" in h && e(2, o = h.elem_id), "elem_classes" in h && e(3, g = h.elem_classes), "variant" in h && e(4, E = h.variant), "border_mode" in h && e(5, u = h.border_mode), "padding" in h && e(6, A = h.padding), "type" in h && e(16, L = h.type), "test_id" in h && e(7, C = h.test_id), "explicit_call" in h && e(8, D = h.explicit_call), "container" in h && e(9, r = h.container), "visible" in h && e(10, n = h.visible), "allow_overflow" in h && e(11, b = h.allow_overflow), "scale" in h && e(12, f = h.scale), "min_width" in h && e(13, c = h.min_width), "$$scope" in h && e(17, p = h.$$scope);
  }, [
    _,
    x,
    o,
    g,
    E,
    u,
    A,
    C,
    D,
    r,
    n,
    b,
    f,
    c,
    t,
    a,
    L,
    p,
    l
  ];
}
class Block extends SvelteComponent$f {
  constructor(s) {
    super(), init$f(this, s, instance$d, create_fragment$f, safe_not_equal$g, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 16,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const Info_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$e,
  attr: attr$d,
  create_slot: create_slot$2,
  detach: detach$e,
  element: element$b,
  get_all_dirty_from_scope: get_all_dirty_from_scope$2,
  get_slot_changes: get_slot_changes$2,
  init: init$e,
  insert: insert$e,
  safe_not_equal: safe_not_equal$f,
  transition_in: transition_in$6,
  transition_out: transition_out$6,
  update_slot_base: update_slot_base$2
} = window.__gradio__svelte__internal;
function create_fragment$e(y) {
  let s, e;
  const l = (
    /*#slots*/
    y[1].default
  ), p = create_slot$2(
    l,
    y,
    /*$$scope*/
    y[0],
    null
  );
  return {
    c() {
      s = element$b("div"), p && p.c(), attr$d(s, "class", "svelte-1hnfib2");
    },
    m(_, x) {
      insert$e(_, s, x), p && p.m(s, null), e = !0;
    },
    p(_, [x]) {
      p && p.p && (!e || x & /*$$scope*/
      1) && update_slot_base$2(
        p,
        l,
        _,
        /*$$scope*/
        _[0],
        e ? get_slot_changes$2(
          l,
          /*$$scope*/
          _[0],
          x,
          null
        ) : get_all_dirty_from_scope$2(
          /*$$scope*/
          _[0]
        ),
        null
      );
    },
    i(_) {
      e || (transition_in$6(p, _), e = !0);
    },
    o(_) {
      transition_out$6(p, _), e = !1;
    },
    d(_) {
      _ && detach$e(s), p && p.d(_);
    }
  };
}
function instance$c(y, s, e) {
  let { $$slots: l = {}, $$scope: p } = s;
  return y.$$set = (_) => {
    "$$scope" in _ && e(0, p = _.$$scope);
  }, [p, l];
}
class Info extends SvelteComponent$e {
  constructor(s) {
    super(), init$e(this, s, instance$c, create_fragment$e, safe_not_equal$f, {});
  }
}
const BlockTitle_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$d,
  attr: attr$c,
  check_outros: check_outros$5,
  create_component: create_component$5,
  create_slot: create_slot$1,
  destroy_component: destroy_component$5,
  detach: detach$d,
  element: element$a,
  empty: empty$4,
  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$d,
  insert: insert$d,
  mount_component: mount_component$5,
  safe_not_equal: safe_not_equal$e,
  set_data: set_data$6,
  space: space$9,
  text: text$8,
  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$7(y) {
  let s, e;
  return s = new Info({
    props: {
      $$slots: { default: [create_default_slot$2] },
      $$scope: { ctx: y }
    }
  }), {
    c() {
      create_component$5(s.$$.fragment);
    },
    m(l, p) {
      mount_component$5(s, l, p), e = !0;
    },
    p(l, p) {
      const _ = {};
      p & /*$$scope, info*/
      10 && (_.$$scope = { dirty: p, ctx: l }), s.$set(_);
    },
    i(l) {
      e || (transition_in$5(s.$$.fragment, l), e = !0);
    },
    o(l) {
      transition_out$5(s.$$.fragment, l), e = !1;
    },
    d(l) {
      destroy_component$5(s, l);
    }
  };
}
function create_default_slot$2(y) {
  let s;
  return {
    c() {
      s = text$8(
        /*info*/
        y[1]
      );
    },
    m(e, l) {
      insert$d(e, s, l);
    },
    p(e, l) {
      l & /*info*/
      2 && set_data$6(
        s,
        /*info*/
        e[1]
      );
    },
    d(e) {
      e && detach$d(s);
    }
  };
}
function create_fragment$d(y) {
  let s, e, l, p;
  const _ = (
    /*#slots*/
    y[2].default
  ), x = create_slot$1(
    _,
    y,
    /*$$scope*/
    y[3],
    null
  );
  let o = (
    /*info*/
    y[1] && create_if_block$7(y)
  );
  return {
    c() {
      s = element$a("span"), x && x.c(), e = space$9(), o && o.c(), l = empty$4(), attr$c(s, "data-testid", "block-info"), attr$c(s, "class", "svelte-22c38v"), toggle_class$6(s, "sr-only", !/*show_label*/
      y[0]), toggle_class$6(s, "hide", !/*show_label*/
      y[0]), toggle_class$6(
        s,
        "has-info",
        /*info*/
        y[1] != null
      );
    },
    m(g, E) {
      insert$d(g, s, E), x && x.m(s, null), insert$d(g, e, E), o && o.m(g, E), insert$d(g, l, E), p = !0;
    },
    p(g, [E]) {
      x && x.p && (!p || E & /*$$scope*/
      8) && update_slot_base$1(
        x,
        _,
        g,
        /*$$scope*/
        g[3],
        p ? get_slot_changes$1(
          _,
          /*$$scope*/
          g[3],
          E,
          null
        ) : get_all_dirty_from_scope$1(
          /*$$scope*/
          g[3]
        ),
        null
      ), (!p || E & /*show_label*/
      1) && toggle_class$6(s, "sr-only", !/*show_label*/
      g[0]), (!p || E & /*show_label*/
      1) && toggle_class$6(s, "hide", !/*show_label*/
      g[0]), (!p || E & /*info*/
      2) && toggle_class$6(
        s,
        "has-info",
        /*info*/
        g[1] != null
      ), /*info*/
      g[1] ? o ? (o.p(g, E), E & /*info*/
      2 && transition_in$5(o, 1)) : (o = create_if_block$7(g), o.c(), transition_in$5(o, 1), o.m(l.parentNode, l)) : o && (group_outros$5(), transition_out$5(o, 1, 1, () => {
        o = null;
      }), check_outros$5());
    },
    i(g) {
      p || (transition_in$5(x, g), transition_in$5(o), p = !0);
    },
    o(g) {
      transition_out$5(x, g), transition_out$5(o), p = !1;
    },
    d(g) {
      g && (detach$d(s), detach$d(e), detach$d(l)), x && x.d(g), o && o.d(g);
    }
  };
}
function instance$b(y, s, e) {
  let { $$slots: l = {}, $$scope: p } = s, { show_label: _ = !0 } = s, { info: x = void 0 } = s;
  return y.$$set = (o) => {
    "show_label" in o && e(0, _ = o.show_label), "info" in o && e(1, x = o.info), "$$scope" in o && e(3, p = o.$$scope);
  }, [_, x, l, p];
}
class BlockTitle extends SvelteComponent$d {
  constructor(s) {
    super(), init$d(this, s, instance$b, create_fragment$d, safe_not_equal$e, { show_label: 0, info: 1 });
  }
}
const BlockLabel_svelte_svelte_type_style_lang = "", IconButton_svelte_svelte_type_style_lang = "", Empty_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$c,
  append: append$a,
  attr: attr$b,
  detach: detach$c,
  init: init$c,
  insert: insert$c,
  noop: noop$c,
  safe_not_equal: safe_not_equal$d,
  svg_element: svg_element$3
} = window.__gradio__svelte__internal;
function create_fragment$c(y) {
  let s, e;
  return {
    c() {
      s = svg_element$3("svg"), e = svg_element$3("polyline"), attr$b(e, "points", "20 6 9 17 4 12"), attr$b(s, "xmlns", "http://www.w3.org/2000/svg"), attr$b(s, "viewBox", "2 0 20 20"), attr$b(s, "fill", "none"), attr$b(s, "stroke", "currentColor"), attr$b(s, "stroke-width", "3"), attr$b(s, "stroke-linecap", "round"), attr$b(s, "stroke-linejoin", "round");
    },
    m(l, p) {
      insert$c(l, s, p), append$a(s, e);
    },
    p: noop$c,
    i: noop$c,
    o: noop$c,
    d(l) {
      l && detach$c(s);
    }
  };
}
class Check extends SvelteComponent$c {
  constructor(s) {
    super(), init$c(this, s, null, create_fragment$c, safe_not_equal$d, {});
  }
}
const {
  SvelteComponent: SvelteComponent$b,
  append: append$9,
  attr: attr$a,
  detach: detach$b,
  init: init$b,
  insert: insert$b,
  noop: noop$b,
  safe_not_equal: safe_not_equal$c,
  svg_element: svg_element$2
} = window.__gradio__svelte__internal;
function create_fragment$b(y) {
  let s, e, l;
  return {
    c() {
      s = svg_element$2("svg"), e = svg_element$2("path"), l = svg_element$2("path"), attr$a(e, "fill", "currentColor"), attr$a(e, "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(l, "fill", "currentColor"), attr$a(l, "d", "M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"), attr$a(s, "xmlns", "http://www.w3.org/2000/svg"), attr$a(s, "viewBox", "0 0 33 33"), attr$a(s, "color", "currentColor");
    },
    m(p, _) {
      insert$b(p, s, _), append$9(s, e), append$9(s, l);
    },
    p: noop$b,
    i: noop$b,
    o: noop$b,
    d(p) {
      p && detach$b(s);
    }
  };
}
class Copy extends SvelteComponent$b {
  constructor(s) {
    super(), init$b(this, s, null, create_fragment$b, safe_not_equal$c, {});
  }
}
const DropdownArrow_svelte_svelte_type_style_lang = "", 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(
  (y, { color: s, primary: e, secondary: l }) => ({
    ...y,
    [s]: {
      primary: tw_colors[s][e],
      secondary: tw_colors[s][l]
    }
  }),
  {}
);
const UploadText_svelte_svelte_type_style_lang = "", Toolbar_svelte_svelte_type_style_lang = "", SelectSource_svelte_svelte_type_style_lang = "", Button_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$a,
  append: append$8,
  attr: attr$9,
  detach: detach$a,
  element: element$9,
  init: init$a,
  insert: insert$a,
  listen: listen$4,
  noop: noop$a,
  run_all: run_all$4,
  safe_not_equal: safe_not_equal$b,
  space: space$8
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$5 } = window.__gradio__svelte__internal;
function create_if_block$6(y) {
  let s, e, l;
  return {
    c() {
      s = element$9("button"), s.innerHTML = '<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>', attr$9(s, "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(p, _) {
      insert$a(p, s, _), e || (l = listen$4(
        s,
        "click",
        /*click_handler_3*/
        y[7]
      ), e = !0);
    },
    p: noop$a,
    d(p) {
      p && detach$a(s), e = !1, l();
    }
  };
}
function create_fragment$a(y) {
  let s, e, l, p, _, x, o, g, E, u, A = (
    /*displayCovMod*/
    y[0] && create_if_block$6(y)
  );
  return {
    c() {
      s = element$9("div"), e = element$9("div"), l = element$9("button"), l.innerHTML = '<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>', p = space$8(), _ = element$9("button"), _.innerHTML = '<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>', x = space$8(), o = element$9("button"), o.innerHTML = '<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>', g = space$8(), A && A.c(), attr$9(l, "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(_, "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(o, "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(e, "class", "flex justify-center mt-2 svelte-8wrmgx"), attr$9(s, "class", "svelte-8wrmgx");
    },
    m(L, C) {
      insert$a(L, s, C), append$8(s, e), append$8(e, l), append$8(e, p), append$8(e, _), append$8(e, x), append$8(e, o), append$8(e, g), A && A.m(e, null), E || (u = [
        listen$4(
          l,
          "click",
          /*click_handler*/
          y[4]
        ),
        listen$4(
          _,
          "click",
          /*click_handler_1*/
          y[5]
        ),
        listen$4(
          o,
          "click",
          /*click_handler_2*/
          y[6]
        )
      ], E = !0);
    },
    p(L, [C]) {
      /*displayCovMod*/
      L[0] ? A ? A.p(L, C) : (A = create_if_block$6(L), A.c(), A.m(e, null)) : A && (A.d(1), A = null);
    },
    i: noop$a,
    o: noop$a,
    d(L) {
      L && detach$a(s), A && A.d(), E = !1, run_all$4(u);
    }
  };
}
function instance$a(y, s, e) {
  const l = createEventDispatcher$5();
  let { vals: p = [] } = s;
  function _(L) {
    l("addNewChain", { type: L });
  }
  function x() {
    l("addCovalentModification");
  }
  let o = !1;
  const g = () => {
    _("protein");
  }, E = () => {
    _("DNA");
  }, u = () => {
    _("ligand");
  }, A = () => {
    x();
  };
  return y.$$set = (L) => {
    "vals" in L && e(3, p = L.vals);
  }, y.$$.update = () => {
    y.$$.dirty & /*vals*/
    8 && e(0, o = p.filter((L) => L.class === "protein" && L.sequence.length > 0).length > 0 && p.filter((L) => L.class === "ligand" && L.sdf != "").length > 0);
  }, [
    o,
    _,
    x,
    p,
    g,
    E,
    u,
    A
  ];
}
class Button extends SvelteComponent$a {
  constructor(s) {
    super(), init$a(this, s, instance$a, create_fragment$a, safe_not_equal$b, { vals: 3 });
  }
}
const SearchInput_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$9,
  append: append$7,
  attr: attr$8,
  detach: detach$9,
  element: element$8,
  init: init$9,
  insert: insert$9,
  listen: listen$3,
  noop: noop$9,
  prevent_default,
  run_all: run_all$3,
  safe_not_equal: safe_not_equal$a,
  space: space$7,
  text: text$7
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal;
function create_fragment$9(y) {
  let s, e, l, p, _, x = (
    /*databases*/
    y[1][
      /*currentSel*/
      y[3]
    ] + ""
  ), o, g, E, u, A, L, C, D, r, n;
  return {
    c() {
      s = element$8("form"), e = element$8("div"), l = element$8("label"), l.textContent = "Search", p = space$7(), _ = element$8("button"), o = text$7(x), g = space$7(), E = element$8("div"), E.innerHTML = '<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>', u = space$7(), A = element$8("div"), L = element$8("input"), C = space$7(), D = element$8("button"), D.innerHTML = '<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>', attr$8(l, "for", "search-dropdown"), attr$8(l, "class", "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white svelte-8wrmgx"), attr$8(_, "id", "dropdown-button"), attr$8(_, "data-dropdown-toggle", "dropdown"), attr$8(_, "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(_, "type", "button"), attr$8(E, "id", "dropdown"), attr$8(E, "class", "z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 svelte-8wrmgx"), attr$8(L, "type", "search"), attr$8(L, "id", "search-dropdown"), attr$8(L, "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(
        L,
        "placeholder",
        /*placeholder*/
        y[2][
          /*currentSel*/
          y[3]
        ]
      ), attr$8(D, "type", "submit"), attr$8(D, "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(A, "class", "relative w-full svelte-8wrmgx"), attr$8(e, "class", "flex svelte-8wrmgx"), attr$8(s, "class", "max-w-lg mx-auto mb-2 my-2 svelte-8wrmgx");
    },
    m(b, f) {
      insert$9(b, s, f), append$7(s, e), append$7(e, l), append$7(e, p), append$7(e, _), append$7(_, o), append$7(e, g), append$7(e, E), append$7(e, u), append$7(e, A), append$7(A, L), append$7(A, C), append$7(A, D), r || (n = [
        listen$3(
          L,
          "input",
          /*input_handler*/
          y[7]
        ),
        listen$3(D, "click", prevent_default(
          /*triggerFetch*/
          y[4]
        ))
      ], r = !0);
    },
    p: noop$9,
    i: noop$9,
    o: noop$9,
    d(b) {
      b && detach$9(s), r = !1, run_all$3(n);
    }
  };
}
function instance$9(y, s, e) {
  const l = createEventDispatcher$4();
  let { database: p = "rcsb-bioass" } = s, { index: _ = 0 } = s, x = {
    "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"
  }, g = p, E = "";
  function u() {
    l("triggerFetch", {
      text: E,
      database: g,
      index: _
    });
  }
  const A = (L) => e(0, E = L.target.value);
  return y.$$set = (L) => {
    "database" in L && e(5, p = L.database), "index" in L && e(6, _ = L.index);
  }, [
    E,
    x,
    o,
    g,
    u,
    p,
    _,
    A
  ];
}
class SearchInput extends SvelteComponent$9 {
  constructor(s) {
    super(), init$9(this, s, instance$9, create_fragment$9, safe_not_equal$a, { database: 5, index: 6 });
  }
}
const Sequence_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$8,
  append: append$6,
  attr: attr$7,
  destroy_each: destroy_each$2,
  detach: detach$8,
  element: element$7,
  ensure_array_like: ensure_array_like$2,
  init: init$8,
  insert: insert$8,
  noop: noop$8,
  safe_not_equal: safe_not_equal$9,
  set_style: set_style$2,
  space: space$6,
  text: text$6
} = window.__gradio__svelte__internal;
function get_each_context$2(y, s, e) {
  const l = y.slice();
  return l[3] = s[e], l[5] = e, l;
}
function get_each_context_1$2(y, s, e) {
  const l = y.slice();
  return l[6] = s[e], l[8] = e, l;
}
function create_each_block_1$2(y) {
  let s, e, l = (
    /*letter*/
    y[6] + ""
  ), p;
  return {
    c() {
      s = element$7("span"), e = element$7("div"), p = text$6(l), attr$7(e, "class", "inline-block p-0.5 svelte-hhspdt"), attr$7(e, "title", "residue " + /*chunk_ids*/
      y[1][
        /*i*/
        y[5]
      ][
        /*j*/
        y[8]
      ]), attr$7(s, "class", "p-0.1 text-center w-full inline hover:font-bold cursor-pointer item-selectable ds-selectable svelte-hhspdt"), set_style$2(s, "font-family", "monospace");
    },
    m(_, x) {
      insert$8(_, s, x), append$6(s, e), append$6(e, p);
    },
    p: noop$8,
    d(_) {
      _ && detach$8(s);
    }
  };
}
function create_each_block$2(y) {
  let s, e, l = ensure_array_like$2(
    /*chunk*/
    y[3]
  ), p = [];
  for (let _ = 0; _ < l.length; _ += 1)
    p[_] = create_each_block_1$2(get_each_context_1$2(y, l, _));
  return {
    c() {
      s = element$7("div");
      for (let _ = 0; _ < p.length; _ += 1)
        p[_].c();
      e = space$6(), attr$7(s, "class", "sequence__chunk svelte-hhspdt");
    },
    m(_, x) {
      insert$8(_, s, x);
      for (let o = 0; o < p.length; o += 1)
        p[o] && p[o].m(s, null);
      append$6(s, e);
    },
    p(_, x) {
      if (x & /*chunk_ids, chunked_seq*/
      3) {
        l = ensure_array_like$2(
          /*chunk*/
          _[3]
        );
        let o;
        for (o = 0; o < l.length; o += 1) {
          const g = get_each_context_1$2(_, l, o);
          p[o] ? p[o].p(g, x) : (p[o] = create_each_block_1$2(g), p[o].c(), p[o].m(s, e));
        }
        for (; o < p.length; o += 1)
          p[o].d(1);
        p.length = l.length;
      }
    },
    d(_) {
      _ && detach$8(s), destroy_each$2(p, _);
    }
  };
}
function create_fragment$8(y) {
  let s, e = ensure_array_like$2(
    /*chunked_seq*/
    y[0]
  ), l = [];
  for (let p = 0; p < e.length; p += 1)
    l[p] = create_each_block$2(get_each_context$2(y, e, p));
  return {
    c() {
      s = element$7("div");
      for (let p = 0; p < l.length; p += 1)
        l[p].c();
      attr$7(s, "class", "sequence_container text-xs svelte-hhspdt");
    },
    m(p, _) {
      insert$8(p, s, _);
      for (let x = 0; x < l.length; x += 1)
        l[x] && l[x].m(s, null);
    },
    p(p, [_]) {
      if (_ & /*chunked_seq, chunk_ids*/
      3) {
        e = ensure_array_like$2(
          /*chunked_seq*/
          p[0]
        );
        let x;
        for (x = 0; x < e.length; x += 1) {
          const o = get_each_context$2(p, e, x);
          l[x] ? l[x].p(o, _) : (l[x] = create_each_block$2(o), l[x].c(), l[x].m(s, null));
        }
        for (; x < l.length; x += 1)
          l[x].d(1);
        l.length = e.length;
      }
    },
    i: noop$8,
    o: noop$8,
    d(p) {
      p && detach$8(s), destroy_each$2(l, p);
    }
  };
}
function instance$8(y, s, e) {
  let { seq: l = "" } = s, p = l.match(/.{1,10}/g), _ = p.map((x, o) => x.split("").map((g, E) => o * 10 + E + 1));
  return y.$$set = (x) => {
    "seq" in x && e(2, l = x.seq);
  }, [p, _, l];
}
class Sequence extends SvelteComponent$8 {
  constructor(s) {
    super(), init$8(this, s, instance$8, create_fragment$8, safe_not_equal$9, { seq: 2 });
  }
}
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(y) {
  return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
}
var _3Dmol = { exports: {} };
/*!
 * 3dmol v2.1.0
 * JavaScript/TypeScript molecular visualization library
 * Author: David Koes and contributors
 */
(function(module, exports) {
  (function(s, e) {
    module.exports = e();
  })(commonjsGlobal, () => (
    /******/
    (() => {
      var __webpack_modules__ = {
        /***/
        "./node_modules/iobuffer/lib-esm/IOBuffer.js": (
          /*!***************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/IOBuffer.js ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              IOBuffer: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var l = e(
              /*! ./text */
              "./node_modules/iobuffer/lib-esm/text.browser.js"
            );
            const p = 1024 * 8, _ = (() => {
              const g = new Uint8Array(4), E = new Uint32Array(g.buffer);
              return !((E[0] = 1) & g[0]);
            })(), x = {
              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(E = p, u = {}) {
                let A = !1;
                typeof E == "number" ? E = new ArrayBuffer(E) : (A = !0, this.lastWrittenByte = E.byteLength);
                const L = u.offset ? u.offset >>> 0 : 0, C = E.byteLength - L;
                let D = L;
                (ArrayBuffer.isView(E) || E instanceof o) && (E.byteLength !== E.buffer.byteLength && (D = E.byteOffset + L), E = E.buffer), A ? this.lastWrittenByte = C : this.lastWrittenByte = 0, this.buffer = E, this.length = C, this.byteLength = C, this.byteOffset = D, this.offset = 0, this.littleEndian = !0, this._data = new DataView(this.buffer, D, C), 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(E = 1) {
                return this.offset + E <= 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(E = 1) {
                return this.offset += E, this;
              }
              /**
               * Move the pointer n bytes backward.
               * @param n - Number of bytes to move back.
               */
              back(E = 1) {
                return this.offset -= E, this;
              }
              /**
               * Move the pointer to the given offset.
               * @param offset
               */
              seek(E) {
                return this.offset = E, 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 E = this._marks.pop();
                if (E === void 0)
                  throw new Error("Mark stack empty");
                return this.seek(E), 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(E = 1) {
                if (!this.available(E)) {
                  const A = (this.offset + E) * 2, L = new Uint8Array(A);
                  L.set(new Uint8Array(this.buffer)), this.buffer = L.buffer, this.length = this.byteLength = A, 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(E = 1) {
                return this.readArray(E, "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(E, u) {
                const A = x[u].BYTES_PER_ELEMENT * E, L = this.byteOffset + this.offset, C = this.buffer.slice(L, L + A);
                if (this.littleEndian === _ && u !== "uint8" && u !== "int8") {
                  const r = new Uint8Array(this.buffer.slice(L, L + A));
                  r.reverse();
                  const n = new x[u](r.buffer);
                  return this.offset += A, n.reverse(), n;
                }
                const D = new x[u](C);
                return this.offset += A, D;
              }
              /**
               * Read a 16-bit signed integer and move pointer forward by 2 bytes.
               */
              readInt16() {
                const E = this._data.getInt16(this.offset, this.littleEndian);
                return this.offset += 2, E;
              }
              /**
               * Read a 16-bit unsigned integer and move pointer forward by 2 bytes.
               */
              readUint16() {
                const E = this._data.getUint16(this.offset, this.littleEndian);
                return this.offset += 2, E;
              }
              /**
               * Read a 32-bit signed integer and move pointer forward by 4 bytes.
               */
              readInt32() {
                const E = this._data.getInt32(this.offset, this.littleEndian);
                return this.offset += 4, E;
              }
              /**
               * Read a 32-bit unsigned integer and move pointer forward by 4 bytes.
               */
              readUint32() {
                const E = this._data.getUint32(this.offset, this.littleEndian);
                return this.offset += 4, E;
              }
              /**
               * Read a 32-bit floating number and move pointer forward by 4 bytes.
               */
              readFloat32() {
                const E = this._data.getFloat32(this.offset, this.littleEndian);
                return this.offset += 4, E;
              }
              /**
               * Read a 64-bit floating number and move pointer forward by 8 bytes.
               */
              readFloat64() {
                const E = this._data.getFloat64(this.offset, this.littleEndian);
                return this.offset += 8, E;
              }
              /**
               * Read a 64-bit signed integer number and move pointer forward by 8 bytes.
               */
              readBigInt64() {
                const E = this._data.getBigInt64(this.offset, this.littleEndian);
                return this.offset += 8, E;
              }
              /**
               * Read a 64-bit unsigned integer number and move pointer forward by 8 bytes.
               */
              readBigUint64() {
                const E = this._data.getBigUint64(this.offset, this.littleEndian);
                return this.offset += 8, E;
              }
              /**
               * 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(E = 1) {
                let u = "";
                for (let A = 0; A < E; A++)
                  u += this.readChar();
                return u;
              }
              /**
               * Read the next `n` bytes, return a UTF-8 decoded string and move pointer
               * forward by `n` bytes.
               */
              readUtf8(E = 1) {
                return (0, l.decode)(this.readBytes(E));
              }
              /**
               * 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(E = 1, u = "utf-8") {
                return (0, l.decode)(this.readBytes(E), u);
              }
              /**
               * Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer
               * forward by 1 byte.
               */
              writeBoolean(E) {
                return this.writeUint8(E ? 255 : 0), this;
              }
              /**
               * Write `value` as an 8-bit signed integer and move pointer forward by 1 byte.
               */
              writeInt8(E) {
                return this.ensureAvailable(1), this._data.setInt8(this.offset++, E), this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as an 8-bit unsigned integer and move pointer forward by 1
               * byte.
               */
              writeUint8(E) {
                return this.ensureAvailable(1), this._data.setUint8(this.offset++, E), this._updateLastWrittenByte(), this;
              }
              /**
               * An alias for {@link IOBuffer#writeUint8}.
               */
              writeByte(E) {
                return this.writeUint8(E);
              }
              /**
               * Write all elements of `bytes` as uint8 values and move pointer forward by
               * `bytes.length` bytes.
               */
              writeBytes(E) {
                this.ensureAvailable(E.length);
                for (let u = 0; u < E.length; u++)
                  this._data.setUint8(this.offset++, E[u]);
                return this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 16-bit signed integer and move pointer forward by 2
               * bytes.
               */
              writeInt16(E) {
                return this.ensureAvailable(2), this._data.setInt16(this.offset, E, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 16-bit unsigned integer and move pointer forward by 2
               * bytes.
               */
              writeUint16(E) {
                return this.ensureAvailable(2), this._data.setUint16(this.offset, E, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit signed integer and move pointer forward by 4
               * bytes.
               */
              writeInt32(E) {
                return this.ensureAvailable(4), this._data.setInt32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit unsigned integer and move pointer forward by 4
               * bytes.
               */
              writeUint32(E) {
                return this.ensureAvailable(4), this._data.setUint32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 32-bit floating number and move pointer forward by 4
               * bytes.
               */
              writeFloat32(E) {
                return this.ensureAvailable(4), this._data.setFloat32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit floating number and move pointer forward by 8
               * bytes.
               */
              writeFloat64(E) {
                return this.ensureAvailable(8), this._data.setFloat64(this.offset, E, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit signed bigint and move pointer forward by 8
               * bytes.
               */
              writeBigInt64(E) {
                return this.ensureAvailable(8), this._data.setBigInt64(this.offset, E, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
              }
              /**
               * Write `value` as a 64-bit unsigned bigint and move pointer forward by 8
               * bytes.
               */
              writeBigUint64(E) {
                return this.ensureAvailable(8), this._data.setBigUint64(this.offset, E, 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(E) {
                return this.writeUint8(E.charCodeAt(0));
              }
              /**
               * Write the charCodes of all `str`'s characters as 8-bit unsigned integers
               * and move pointer forward by `str.length` bytes.
               */
              writeChars(E) {
                for (let u = 0; u < E.length; u++)
                  this.writeUint8(E.charCodeAt(u));
                return this;
              }
              /**
               * UTF-8 encode and write `str` to the current pointer offset and move pointer
               * forward according to the encoded length.
               */
              writeUtf8(E) {
                return this.writeBytes((0, l.encode)(E));
              }
              /**
               * 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(y) {
              if (y.TextEncoder && y.TextDecoder)
                return !1;
              function s(l = "utf-8") {
                if (l !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${l}') is invalid.`);
              }
              Object.defineProperty(s.prototype, "encoding", {
                value: "utf-8"
              }), s.prototype.encode = function(l, p = { stream: !1 }) {
                if (p.stream)
                  throw new Error("Failed to encode: the 'stream' option is unsupported.");
                let _ = 0;
                const x = l.length;
                let o = 0, g = Math.max(32, x + (x >> 1) + 7), E = new Uint8Array(g >> 3 << 3);
                for (; _ < x; ) {
                  let u = l.charCodeAt(_++);
                  if (u >= 55296 && u <= 56319) {
                    if (_ < x) {
                      const A = l.charCodeAt(_);
                      (A & 64512) === 56320 && (++_, u = ((u & 1023) << 10) + (A & 1023) + 65536);
                    }
                    if (u >= 55296 && u <= 56319)
                      continue;
                  }
                  if (o + 4 > E.length) {
                    g += 8, g *= 1 + _ / l.length * 2, g = g >> 3 << 3;
                    const A = new Uint8Array(g);
                    A.set(E), E = A;
                  }
                  if (u & 4294967168)
                    if (!(u & 4294965248))
                      E[o++] = u >> 6 & 31 | 192;
                    else if (!(u & 4294901760))
                      E[o++] = u >> 12 & 15 | 224, E[o++] = u >> 6 & 63 | 128;
                    else if (!(u & 4292870144))
                      E[o++] = u >> 18 & 7 | 240, E[o++] = u >> 12 & 63 | 128, E[o++] = u >> 6 & 63 | 128;
                    else
                      continue;
                  else {
                    E[o++] = u;
                    continue;
                  }
                  E[o++] = u & 63 | 128;
                }
                return E.slice(0, o);
              };
              function e(l = "utf-8", p = { fatal: !1 }) {
                if (l !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${l}') is invalid.`);
                if (p.fatal)
                  throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");
              }
              Object.defineProperty(e.prototype, "encoding", {
                value: "utf-8"
              }), Object.defineProperty(e.prototype, "fatal", { value: !1 }), Object.defineProperty(e.prototype, "ignoreBOM", {
                value: !1
              }), e.prototype.decode = function(l, p = { stream: !1 }) {
                if (p.stream)
                  throw new Error("Failed to decode: the 'stream' option is unsupported.");
                const _ = new Uint8Array(l);
                let x = 0;
                const o = _.length, g = [];
                for (; x < o; ) {
                  const E = _[x++];
                  if (E === 0)
                    break;
                  if (!(E & 128))
                    g.push(E);
                  else if ((E & 224) === 192) {
                    const u = _[x++] & 63;
                    g.push((E & 31) << 6 | u);
                  } else if ((E & 240) === 224) {
                    const u = _[x++] & 63, A = _[x++] & 63;
                    g.push((E & 31) << 12 | u << 6 | A);
                  } else if ((E & 248) === 240) {
                    const u = _[x++] & 63, A = _[x++] & 63, L = _[x++] & 63;
                    let C = (E & 7) << 18 | u << 12 | A << 6 | L;
                    C > 65535 && (C -= 65536, g.push(C >>> 10 & 1023 | 55296), C = 56320 | C & 1023), g.push(C);
                  }
                }
                return String.fromCharCode.apply(null, g);
              }, y.TextEncoder = s, y.TextDecoder = e;
            })(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 ***!
            \*******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              decode: () => (
                /* binding */
                l
              ),
              /* harmony export */
              encode: () => (
                /* binding */
                _
              )
              /* harmony export */
            }), e(
              /*! ./text-encoding-polyfill */
              "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js"
            );
            function l(x, o = "utf8") {
              return new TextDecoder(o).decode(x);
            }
            const p = new TextEncoder();
            function _(x) {
              return p.encode(x);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/data.js": (
          /*!***********************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/data.js ***!
            \***********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              nonRecord: () => (
                /* binding */
                p
              ),
              /* harmony export */
              record: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            );
            function p(x, o) {
              const g = (0, l.str2num)(o.type), E = o.size / (0, l.num2bytes)(g), u = new Array(E);
              for (let A = 0; A < E; A++)
                u[A] = (0, l.readType)(x, g, 1);
              return u;
            }
            function _(x, o, g) {
              const E = (0, l.str2num)(o.type), u = o.size ? o.size / (0, l.num2bytes)(E) : 1, A = g.length, L = new Array(A), C = g.recordStep;
              if (C)
                for (let D = 0; D < A; D++) {
                  const r = x.offset;
                  L[D] = (0, l.readType)(x, E, u), x.seek(r + C);
                }
              else
                throw new Error("recordDimension.recordStep is undefined");
              return L;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/header.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/header.js ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              header: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var l = e(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            ), p = e(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            const _ = 0, x = 10, o = 11, g = 12, E = 0;
            function u(D, r) {
              const n = { version: r }, b = {
                length: D.readUint32()
              }, f = A(D);
              Array.isArray(f) || (b.id = f.recordId, b.name = f.recordName, n.dimensions = f.dimensions), n.globalAttributes = L(D);
              const c = C(D, b == null ? void 0 : b.id, r);
              return Array.isArray(c) || (n.variables = c.variables, b.recordStep = c.recordStep), n.recordDimension = b, n;
            }
            function A(D) {
              const r = {};
              let n, b;
              const f = D.readUint32();
              let c;
              if (f === _)
                return (0, p.notNetcdf)(D.readUint32() !== _, "wrong empty tag for list of dimensions"), [];
              {
                (0, p.notNetcdf)(f !== x, "wrong tag for list of dimensions");
                const t = D.readUint32();
                c = new Array(t);
                for (let a = 0; a < t; a++) {
                  const h = (0, p.readName)(D), M = D.readUint32();
                  M === E && (n = a, b = h), c[a] = {
                    name: h,
                    size: M
                  };
                }
              }
              return n !== void 0 && (r.recordId = n), b !== void 0 && (r.recordName = b), r.dimensions = c, r;
            }
            function L(D) {
              const r = D.readUint32();
              let n;
              if (r === _)
                return (0, p.notNetcdf)(D.readUint32() !== _, "wrong empty tag for list of attributes"), [];
              {
                (0, p.notNetcdf)(r !== g, "wrong tag for list of attributes");
                const b = D.readUint32();
                n = new Array(b);
                for (let f = 0; f < b; f++) {
                  const c = (0, p.readName)(D), t = D.readUint32();
                  (0, p.notNetcdf)(t < 1 || t > 6, `non valid type ${t}`);
                  const a = D.readUint32(), h = (0, l.readType)(D, t, a);
                  (0, p.padding)(D), n[f] = {
                    name: c,
                    type: (0, l.num2str)(t),
                    value: h
                  };
                }
              }
              return n;
            }
            function C(D, r, n) {
              const b = D.readUint32();
              let f = 0, c;
              if (b === _)
                return (0, p.notNetcdf)(D.readUint32() !== _, "wrong empty tag for list of variables"), [];
              {
                (0, p.notNetcdf)(b !== o, "wrong tag for list of variables");
                const t = D.readUint32();
                c = new Array(t);
                for (let a = 0; a < t; a++) {
                  const h = (0, p.readName)(D), M = D.readUint32(), w = new Array(M);
                  for (let B = 0; B < M; B++)
                    w[B] = D.readUint32();
                  const S = L(D), T = D.readUint32();
                  (0, p.notNetcdf)(T < 1 && T > 6, `non valid type ${T}`);
                  const R = D.readUint32();
                  let $ = D.readUint32();
                  n === 2 && ((0, p.notNetcdf)($ > 0, "offsets larger than 4GB not supported"), $ = D.readUint32());
                  let P = !1;
                  typeof r < "u" && w[0] === r && (f += R, P = !0), c[a] = {
                    name: h,
                    dimensions: w,
                    attributes: S,
                    type: (0, l.num2str)(T),
                    size: R,
                    offset: $,
                    record: P
                  };
                }
              }
              return {
                variables: c,
                recordStep: f
              };
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/index.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/index.js ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              NetCDFReader: () => (
                /* reexport safe */
                l.NetCDFReader
              )
              /* harmony export */
            });
            var l = e(
              /*! ./parser */
              "./node_modules/netcdfjs/lib-esm/parser.js"
            );
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/parser.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/parser.js ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              NetCDFReader: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! iobuffer */
              "./node_modules/iobuffer/lib-esm/IOBuffer.js"
            ), p = e(
              /*! ./data */
              "./node_modules/netcdfjs/lib-esm/data.js"
            ), _ = e(
              /*! ./header */
              "./node_modules/netcdfjs/lib-esm/header.js"
            ), x = e(
              /*! ./toString */
              "./node_modules/netcdfjs/lib-esm/toString.js"
            ), o = e(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            class g {
              constructor(u) {
                this.toString = x.toString;
                const A = new l.IOBuffer(u);
                A.setBigEndian(), (0, o.notNetcdf)(A.readChars(3) !== "CDF", "should start with CDF");
                const L = A.readByte();
                (0, o.notNetcdf)(L > 2, "unknown version"), this.header = (0, _.header)(A, L), this.buffer = A;
              }
              /**
               * @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(u) {
                const A = this.globalAttributes.find((L) => L.name === u);
                return A ? A.value : null;
              }
              /**
               * Returns the value of a variable as a string
               * @param - variableName
               * @return - Value of the variable as a string or null
               */
              getDataVariableAsString(u) {
                const A = this.getDataVariable(u);
                return A ? A.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(u) {
                let A;
                if (typeof u == "string" ? A = this.header.variables.find((L) => L.name === u) : A = u, A === void 0)
                  throw new Error("Not a valid NetCDF v3.x file: variable not found");
                return this.buffer.seek(A.offset), A.record ? (0, p.record)(this.buffer, A, this.header.recordDimension) : (0, p.nonRecord)(this.buffer, A);
              }
              /**
               * Check if a dataVariable exists
               * @param variableName - Name of the variable to find
               * @return boolean
               */
              dataVariableExists(u) {
                return this.header.variables.find((L) => L.name === u) !== void 0;
              }
              /**
               * Check if an attribute exists
               * @param attributeName - Name of the attribute to find
               * @return boolean
               */
              attributeExists(u) {
                return this.globalAttributes.find((L) => L.name === u) !== void 0;
              }
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/toString.js": (
          /*!***************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/toString.js ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              toString: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l() {
              const p = [];
              p.push("DIMENSIONS");
              for (const x of this.dimensions)
                p.push(`  ${x.name.padEnd(30)} = size: ${x.size}`);
              p.push(""), p.push("GLOBAL ATTRIBUTES");
              for (const x of this.globalAttributes)
                p.push(`  ${x.name.padEnd(30)} = ${x.value}`);
              const _ = JSON.parse(JSON.stringify(this.variables));
              p.push(""), p.push("VARIABLES:");
              for (const x of _) {
                x.value = this.getDataVariable(x);
                let o = JSON.stringify(x.value);
                o.length > 50 && (o = o.substring(0, 50)), isNaN(x.value.length) || (o += ` (length: ${x.value.length})`), p.push(`  ${x.name.padEnd(30)} = ${o}`);
              }
              return p.join(`
`);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/types.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/types.js ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              num2bytes: () => (
                /* binding */
                _
              ),
              /* harmony export */
              num2str: () => (
                /* binding */
                p
              ),
              /* harmony export */
              readType: () => (
                /* binding */
                g
              ),
              /* harmony export */
              str2num: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            const l = {
              BYTE: 1,
              CHAR: 2,
              SHORT: 3,
              INT: 4,
              FLOAT: 5,
              DOUBLE: 6
            };
            function p(u) {
              switch (Number(u)) {
                case l.BYTE:
                  return "byte";
                case l.CHAR:
                  return "char";
                case l.SHORT:
                  return "short";
                case l.INT:
                  return "int";
                case l.FLOAT:
                  return "float";
                case l.DOUBLE:
                  return "double";
                default:
                  return "undefined";
              }
            }
            function _(u) {
              switch (Number(u)) {
                case l.BYTE:
                  return 1;
                case l.CHAR:
                  return 1;
                case l.SHORT:
                  return 2;
                case l.INT:
                  return 4;
                case l.FLOAT:
                  return 4;
                case l.DOUBLE:
                  return 8;
                default:
                  return -1;
              }
            }
            function x(u) {
              switch (String(u)) {
                case "byte":
                  return l.BYTE;
                case "char":
                  return l.CHAR;
                case "short":
                  return l.SHORT;
                case "int":
                  return l.INT;
                case "float":
                  return l.FLOAT;
                case "double":
                  return l.DOUBLE;
                default:
                  return -1;
              }
            }
            function o(u, A) {
              if (u !== 1) {
                const L = new Array(u);
                for (let C = 0; C < u; C++)
                  L[C] = A();
                return L;
              } else
                return A();
            }
            function g(u, A, L) {
              switch (A) {
                case l.BYTE:
                  return Array.from(u.readBytes(L));
                case l.CHAR:
                  return E(u.readChars(L));
                case l.SHORT:
                  return o(L, u.readInt16.bind(u));
                case l.INT:
                  return o(L, u.readInt32.bind(u));
                case l.FLOAT:
                  return o(L, u.readFloat32.bind(u));
                case l.DOUBLE:
                  return o(L, u.readFloat64.bind(u));
                default:
                  throw new Error(`non valid type ${A}`);
              }
            }
            function E(u) {
              return u.charCodeAt(u.length - 1) === 0 ? u.substring(0, u.length - 1) : u;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/utils.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/utils.js ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              notNetcdf: () => (
                /* binding */
                l
              ),
              /* harmony export */
              padding: () => (
                /* binding */
                p
              ),
              /* harmony export */
              readName: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            function l(x, o) {
              if (x)
                throw new TypeError(`Not a valid NetCDF v3.x file: ${o}`);
            }
            function p(x) {
              x.offset % 4 !== 0 && x.skip(4 - x.offset % 4);
            }
            function _(x) {
              const o = x.readUint32(), g = x.readChars(o);
              return p(x), g;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/basic.frag": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/basic.frag ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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 ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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/instanced/instanced.frag": (
          /*!********************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/instanced.frag ***!
            \********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `uniform mat4 viewMatrix;
uniform float opacity;

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

varying vec3 vLightFront;
varying vec3 vColor;
//DEFINEFRAGCOLOR

void main() {

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

    #ifndef WIREFRAME
    gl_FragColor.xyz *= vLightFront;
    #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 ***!
            \********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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 ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `uniform mat4 viewMatrix;
uniform float opacity;

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

varying vec3 vLightFront;
varying vec3 vColor;
//DEFINEFRAGCOLOR

void main() {

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

    #ifndef WIREFRAME
    gl_FragColor.xyz *= vLightFront;
    #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 ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `
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 ***!
            \****************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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

    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/lambertdouble/lambertdouble.vert": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert ***!
            \****************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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 ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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

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


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

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform float outlineWidth;
uniform float outlinePushback;

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;
    gl_Position = projectionMatrix * mvPosition;
    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 ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `uniform sampler2D colormap;
varying highp vec2 vTexCoords;
uniform vec2 dimensions;
//DEFINEFRAGCOLOR
void main (void) {
   gl_FragColor = texture2D(colormap, vTexCoords);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/screen.vert": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/screen.vert ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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 ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `uniform sampler2D colormap;
varying highp vec2 vTexCoords;
uniform vec2 dimensions;

// 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, sampler2D tex)
{
    vec4 color;
    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;
    vec3 rgbM  = texture2D(tex, fragCoord  * inverseVP).xyz;
    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,  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, 1.0);
    else
        color = vec4(rgbB, 1.0);
    return color;
}
//DEFINEFRAGCOLOR
void main (void) {
   gl_FragColor = applyFXAA(vTexCoords, colormap);
}
        `;
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/screenaa.vert": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/screenaa.vert ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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 ***!
            \******************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `
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;

//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;
    gl_FragColor = vec4(vLight*vColor, 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 ***!
            \******************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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 ***!
            \********************************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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 ***!
            \********************************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
uniform float outlineWidth;
uniform float outlinePushback;

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,0.0); adjust.z = 0.0; adjust.w = 0.0;
    mapping = norm.xy;
    rval = abs(norm.x);
    gl_Position = projPosition+adjust;
}

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

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 ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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/stickimposter/stickimposter.partial.frag": (
          /*!************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag ***!
            \************************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `    float dotProduct = dot( norm, vLight );
    vec3 light = vec3( max( dotProduct, 0.0 ) );
    gl_FragColor = vec4(light*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 ***!
            \****************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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/stickimposteroutline/stickimposteroutline.vert": (
          /*!******************************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert ***!
            \******************************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `

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;


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
    to.xyz += normalize(to.xyz)*outlinePushback;
    pt.xyz += normalize(pt.xyz)*outlinePushback;

    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;
    }
    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 ***!
            \**********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `
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 ***!
            \**********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag": (
          /*!**************************************************************************!*\
            !*** ./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag ***!
            \**************************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              default: () => l
              /* harmony export */
            });
            const l = `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;

//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/GLDraw.ts": (
          /*!***********************!*\
            !*** ./src/GLDraw.ts ***!
            \***********************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CAP: () => (
                /* binding */
                p
              ),
              /* harmony export */
              GLDraw: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), p;
            (function(x) {
              x[x.NONE = 0] = "NONE", x[x.FLAT = 1] = "FLAT", x[x.ROUND = 2] = "ROUND";
            })(p || (p = {}));
            var _;
            (function(x) {
              function o(r, n, b) {
                var f = Math.hypot(r, n), c, t, a, h, M;
                f < 1e-4 ? (t = 0, a = 1) : (t = -r / f, a = n / f), n = -t * r + a * n, c = Math.hypot(n, b), c < 1e-4 ? (h = 0, M = 1) : (h = b / c, M = n / c);
                var w = new Float32Array(9);
                return w[0] = a, w[1] = t, w[2] = 0, w[3] = -t * M, w[4] = a * M, w[5] = h, w[6] = t * h, w[7] = -a * h, w[8] = M, w;
              }
              class g {
                constructor() {
                  this.cache = {};
                  let n = [], b = 4, f = Math.pow(2, b), c = 2, t = Math.pow(2, c), a = f / t, h;
                  for (n[0] = new l.Vector3(-1, 0, 0), n[a] = new l.Vector3(0, 0, 1), n[a * 2] = new l.Vector3(1, 0, 0), n[a * 3] = new l.Vector3(0, 0, -1), c = 3; c <= b; c++) {
                    for (t = Math.pow(2, c - 1), a = f / t, h = 0; h < t - 1; h++)
                      n[a / 2 + h * a] = n[h * a].clone().add(n[(h + 1) * a]).normalize();
                    h = t - 1, n[a / 2 + h * a] = n[h * a].clone().add(n[0]).normalize();
                  }
                  this.basisVectors = n;
                }
                getVerticesForRadius(n, b, f) {
                  if (typeof this.cache < "u" && this.cache[n] !== void 0 && this.cache[n][b + f] !== void 0)
                    return this.cache[n][b + f];
                  for (var c = this.basisVectors.length, t = [], a = [], h, M = 0; M < c; M++)
                    t.push(this.basisVectors[M].clone().multiplyScalar(n)), t.push(this.basisVectors[M].clone().multiplyScalar(n)), h = this.basisVectors[M].clone().normalize(), a.push(h), a.push(h);
                  var w = [], S = 10, T = c, R = 0, $ = Math.PI * 2, P = 0, B = Math.PI, F, U, z = !1, W = !1;
                  for (U = 0; U <= S; U++) {
                    z = U === 0 || U === S, W = U === S / 2;
                    var V = [], N = [];
                    for (F = 0; F <= T; F++) {
                      if (W) {
                        var k = F < T ? 2 * F : 0;
                        N.push(k + 1), V.push(k);
                        continue;
                      }
                      var G = F / T, Q = U / S;
                      if (!z || F === 0)
                        if (F < T) {
                          var ie = new l.Vector3();
                          ie.x = -n * Math.cos(R + G * $) * Math.sin(P + Q * B), b == 1 ? ie.y = 0 : ie.y = n * Math.cos(P + Q * B), ie.z = n * Math.sin(R + G * $) * Math.sin(P + Q * B), Math.abs(ie.x) < 1e-5 && (ie.x = 0), Math.abs(ie.y) < 1e-5 && (ie.y = 0), Math.abs(ie.z) < 1e-5 && (ie.z = 0), b == p.FLAT ? (h = new l.Vector3(0, Math.cos(P + Q * B), 0), h.normalize()) : (h = new l.Vector3(ie.x, ie.y, ie.z), h.normalize()), t.push(ie), a.push(h), V.push(t.length - 1);
                        } else
                          V.push(t.length - T);
                      else
                        z && V.push(t.length - 1);
                    }
                    W && w.push(N), w.push(V);
                  }
                  var ge = {
                    vertices: t,
                    normals: a,
                    verticesRows: w,
                    w: T,
                    h: S
                  };
                  return n in this.cache || (this.cache[n] = {}), this.cache[n][b + f] = ge, ge;
                }
              }
              var E = new g();
              function u(r, n, b, f, c, t = 0, a = 0) {
                if (!n || !b)
                  return;
                let h = function(Ee) {
                  if (typeof Ee == "string") {
                    let He = Ee;
                    return He.toLowerCase() == "flat" ? p.FLAT : He.toLowerCase() == "round" ? p.ROUND : p.NONE;
                  } else
                    return Ee;
                };
                t = h(t), a = h(a);
                var M = a || t;
                c = c || { r: 0, g: 0, b: 0 };
                var w = o(b.x - n.x, b.y - n.y, b.z - n.z), S = E.getVerticesForRadius(f, a, "to"), T = S.w, R = S.h, $ = M ? R * T + 2 : 2 * T, P = r.updateGeoGroup($), B = S.vertices, F = S.normals, U = S.verticesRows, z = U[R / 2], W = U[R / 2 + 1], V = P.vertices, N, k, G, Q, ie, ge, le = P.vertexArray, oe = P.normalArray, he = P.colorArray, se = P.faceArray;
                for (G = 0; G < T; ++G) {
                  var xe = 2 * G;
                  Q = w[0] * B[xe].x + w[3] * B[xe].y + w[6] * B[xe].z, ie = w[1] * B[xe].x + w[4] * B[xe].y + w[7] * B[xe].z, ge = w[5] * B[xe].y + w[8] * B[xe].z, N = 3 * (V + xe), k = P.faceidx, le[N] = Q + n.x, le[N + 1] = ie + n.y, le[N + 2] = ge + n.z, le[N + 3] = Q + b.x, le[N + 4] = ie + b.y, le[N + 5] = ge + b.z, oe[N] = Q, oe[N + 3] = Q, oe[N + 1] = ie, oe[N + 4] = ie, oe[N + 2] = ge, oe[N + 5] = ge, he[N] = c.r, he[N + 3] = c.r, he[N + 1] = c.g, he[N + 4] = c.g, he[N + 2] = c.b, he[N + 5] = c.b, se[k] = W[G] + V, se[k + 1] = W[G + 1] + V, se[k + 2] = z[G] + V, se[k + 3] = z[G] + V, se[k + 4] = W[G + 1] + V, se[k + 5] = z[G + 1] + V, P.faceidx += 6;
                }
                if (M) {
                  var ye = a ? 0 : R / 2, Pe = t ? R + 1 : R / 2 + 1, de, pe, re, Se, ke, $e, ze, Re, Fe, Ie, We, Ue, Be, Ne, H, K, q, fe, _e, Me, Ae, Z, ue, we, Te, ae, De, Y, Oe, Ve, I, me;
                  for (ie = ye; ie < Pe; ie++)
                    if (ie !== R / 2) {
                      var ve = ie <= R / 2 ? b : n, X = E.getVerticesForRadius(f, a, "to"), ne = E.getVerticesForRadius(f, t, "from");
                      for (ve === b ? (B = X.vertices, F = X.normals, U = X.verticesRows) : ve == n && (B = ne.vertices, F = ne.normals, U = ne.verticesRows), Q = 0; Q < T; Q++)
                        k = P.faceidx, de = U[ie][Q + 1], Oe = (de + V) * 3, pe = U[ie][Q], Ve = (pe + V) * 3, re = U[ie + 1][Q], I = (re + V) * 3, Se = U[ie + 1][Q + 1], me = (Se + V) * 3, ke = w[0] * B[de].x + w[3] * B[de].y + w[6] * B[de].z, $e = w[0] * B[pe].x + w[3] * B[pe].y + w[6] * B[pe].z, ze = w[0] * B[re].x + w[3] * B[re].y + w[6] * B[re].z, Re = w[0] * B[Se].x + w[3] * B[Se].y + w[6] * B[Se].z, Fe = w[1] * B[de].x + w[4] * B[de].y + w[7] * B[de].z, Ie = w[1] * B[pe].x + w[4] * B[pe].y + w[7] * B[pe].z, We = w[1] * B[re].x + w[4] * B[re].y + w[7] * B[re].z, Ue = w[1] * B[Se].x + w[4] * B[Se].y + w[7] * B[Se].z, Be = w[5] * B[de].y + w[8] * B[de].z, Ne = w[5] * B[pe].y + w[8] * B[pe].z, H = w[5] * B[re].y + w[8] * B[re].z, K = w[5] * B[Se].y + w[8] * B[Se].z, le[Oe] = ke + ve.x, le[Ve] = $e + ve.x, le[I] = ze + ve.x, le[me] = Re + ve.x, le[Oe + 1] = Fe + ve.y, le[Ve + 1] = Ie + ve.y, le[I + 1] = We + ve.y, le[me + 1] = Ue + ve.y, le[Oe + 2] = Be + ve.z, le[Ve + 2] = Ne + ve.z, le[I + 2] = H + ve.z, le[me + 2] = K + ve.z, he[Oe] = c.r, he[Ve] = c.r, he[I] = c.r, he[me] = c.r, he[Oe + 1] = c.g, he[Ve + 1] = c.g, he[I + 1] = c.g, he[me + 1] = c.g, he[Oe + 2] = c.b, he[Ve + 2] = c.b, he[I + 2] = c.b, he[me + 2] = c.b, q = w[0] * F[de].x + w[3] * F[de].y + w[6] * F[de].z, fe = w[0] * F[pe].x + w[3] * F[pe].y + w[6] * F[pe].z, _e = w[0] * F[re].x + w[3] * F[re].y + w[6] * F[re].z, Me = w[0] * F[Se].x + w[3] * F[Se].y + w[6] * F[Se].z, Ae = w[1] * F[de].x + w[4] * F[de].y + w[7] * F[de].z, Z = w[1] * F[pe].x + w[4] * F[pe].y + w[7] * F[pe].z, ue = w[1] * F[re].x + w[4] * F[re].y + w[7] * F[re].z, we = w[1] * F[Se].x + w[4] * F[Se].y + w[7] * F[Se].z, Te = w[5] * F[de].y + w[8] * F[de].z, ae = w[5] * F[pe].y + w[8] * F[pe].z, De = w[5] * F[re].y + w[8] * F[re].z, Y = w[5] * F[Se].y + w[8] * F[Se].z, ie === 0 ? (oe[Oe] = q, oe[I] = _e, oe[me] = Me, oe[Oe + 1] = Ae, oe[I + 1] = ue, oe[me + 1] = we, oe[Oe + 2] = Te, oe[I + 2] = De, oe[me + 2] = Y, se[k] = de + V, se[k + 1] = re + V, se[k + 2] = Se + V, P.faceidx += 3) : ie === Pe - 1 ? (oe[Oe] = q, oe[Ve] = fe, oe[I] = _e, oe[Oe + 1] = Ae, oe[Ve + 1] = Z, oe[I + 1] = ue, oe[Oe + 2] = Te, oe[Ve + 2] = ae, oe[I + 2] = De, se[k] = de + V, se[k + 1] = pe + V, se[k + 2] = re + V, P.faceidx += 3) : (oe[Oe] = q, oe[Ve] = fe, oe[me] = Me, oe[Oe + 1] = Ae, oe[Ve + 1] = Z, oe[me + 1] = we, oe[Oe + 2] = Te, oe[Ve + 2] = ae, oe[me + 2] = Y, oe[Ve] = fe, oe[I] = _e, oe[me] = Me, oe[Ve + 1] = Z, oe[I + 1] = ue, oe[me + 1] = we, oe[Ve + 2] = ae, oe[I + 2] = De, oe[me + 2] = Y, se[k] = de + V, se[k + 1] = pe + V, se[k + 2] = Se + V, se[k + 3] = pe + V, se[k + 4] = re + V, se[k + 5] = Se + V, P.faceidx += 6);
                    }
                }
                P.vertices += $;
              }
              x.drawCylinder = u;
              function A(r, n, b, f, c) {
                if (!n || !b)
                  return;
                c = c || { r: 0, g: 0, b: 0 };
                let t = new l.Vector3(b.x - n.x, b.y - n.y, b.z - n.z);
                var a = o(t.x, t.y, t.z);
                t = t.normalize();
                var h = E.basisVectors.length, M = E.basisVectors, w = h + 2, S = r.updateGeoGroup(w), T = S.vertices, R, $, P, B, F, U, z = S.vertexArray, W = S.normalArray, V = S.colorArray, N = S.faceArray;
                for (R = T * 3, z[R] = n.x, z[R + 1] = n.y, z[R + 2] = n.z, W[R] = -t.x, W[R + 1] = -t.y, W[R + 2] = -t.z, V[R] = c.r, V[R + 1] = c.g, V[R + 2] = c.b, z[R + 3] = b.x, z[R + 4] = b.y, z[R + 5] = b.z, W[R + 3] = t.x, W[R + 4] = t.y, W[R + 5] = t.z, V[R + 3] = c.r, V[R + 4] = c.g, V[R + 5] = c.b, R += 6, P = 0; P < h; ++P) {
                  var k = M[P].clone();
                  k.multiplyScalar(f), B = a[0] * k.x + a[3] * k.y + a[6] * k.z, F = a[1] * k.x + a[4] * k.y + a[7] * k.z, U = a[5] * k.y + a[8] * k.z, z[R] = B + n.x, z[R + 1] = F + n.y, z[R + 2] = U + n.z, W[R] = B, W[R + 1] = F, W[R + 2] = U, V[R] = c.r, V[R + 1] = c.g, V[R + 2] = c.b, R += 3;
                }
                for (S.vertices += h + 2, $ = S.faceidx, P = 0; P < h; P++) {
                  var G = T + 2 + P, Q = T + 2 + (P + 1) % h;
                  N[$] = G, N[$ + 1] = Q, N[$ + 2] = T, $ += 3, N[$] = G, N[$ + 1] = Q, N[$ + 2] = T + 1, $ += 3;
                }
                S.faceidx += 6 * h;
              }
              x.drawCone = A;
              class L {
                constructor() {
                  this.cache = /* @__PURE__ */ new Map();
                }
                getVerticesForRadius(n, b) {
                  b = b || 2, this.cache.has(b) || this.cache.set(b, /* @__PURE__ */ new Map());
                  let f = this.cache.get(b);
                  if (f.has(n))
                    return f.get(n);
                  var c = {
                    vertices: [],
                    verticesRows: [],
                    normals: []
                  }, t = 16 * b, a = 10 * b;
                  n < 1 && (t = 10 * b, a = 8 * b);
                  var h = 0, M = Math.PI * 2, w = 0, S = Math.PI, T, R;
                  for (R = 0; R <= a; R++) {
                    let P = [];
                    for (T = 0; T <= t; T++) {
                      let B = T / t, F = R / a, U = -n * Math.cos(h + B * M) * Math.sin(w + F * S), z = n * Math.cos(w + F * S), W = n * Math.sin(h + B * M) * Math.sin(w + F * S);
                      var $ = new l.Vector3(U, z, W);
                      $.normalize(), c.vertices.push({ x: U, y: z, z: W }), c.normals.push($), P.push(c.vertices.length - 1);
                    }
                    c.verticesRows.push(P);
                  }
                  return f.set(n, c), c;
                }
              }
              var C = new L();
              function D(r, n, b, f, c) {
                var t = C.getVerticesForRadius(b, c), a = t.vertices, h = t.normals, M = r.updateGeoGroup(a.length), w = M.vertices, S = M.vertexArray, T = M.colorArray, R = M.faceArray, $ = M.lineArray, P = M.normalArray;
                for (let U = 0, z = a.length; U < z; ++U) {
                  let W = 3 * (w + U), V = a[U];
                  S[W] = V.x + n.x, S[W + 1] = V.y + n.y, S[W + 2] = V.z + n.z, T[W] = f.r, T[W + 1] = f.g, T[W + 2] = f.b;
                }
                M.vertices += a.length;
                let B = t.verticesRows, F = B.length - 1;
                for (let U = 0; U < F; U++) {
                  let z = B[U].length - 1;
                  for (let W = 0; W < z; W++) {
                    let V = M.faceidx, N = M.lineidx, k = B[U][W + 1] + w, G = k * 3, Q = B[U][W] + w, ie = Q * 3, ge = B[U + 1][W] + w, le = ge * 3, oe = B[U + 1][W + 1] + w, he = oe * 3, se = h[k - w], xe = h[Q - w], ye = h[ge - w], Pe = h[oe - w];
                    Math.abs(a[k - w].y) === b ? (P[G] = se.x, P[le] = ye.x, P[he] = Pe.x, P[G + 1] = se.y, P[le + 1] = ye.y, P[he + 1] = Pe.y, P[G + 2] = se.z, P[le + 2] = ye.z, P[he + 2] = Pe.z, R[V] = k, R[V + 1] = ge, R[V + 2] = oe, $[N] = k, $[N + 1] = ge, $[N + 2] = k, $[N + 3] = oe, $[N + 4] = ge, $[N + 5] = oe, M.faceidx += 3, M.lineidx += 6) : Math.abs(a[ge - w].y) === b ? (P[G] = se.x, P[ie] = xe.x, P[le] = ye.x, P[G + 1] = se.y, P[ie + 1] = xe.y, P[le + 1] = ye.y, P[G + 2] = se.z, P[ie + 2] = xe.z, P[le + 2] = ye.z, R[V] = k, R[V + 1] = Q, R[V + 2] = ge, $[N] = k, $[N + 1] = Q, $[N + 2] = k, $[N + 3] = ge, $[N + 4] = Q, $[N + 5] = ge, M.faceidx += 3, M.lineidx += 6) : (P[G] = se.x, P[ie] = xe.x, P[he] = Pe.x, P[G + 1] = se.y, P[ie + 1] = xe.y, P[he + 1] = Pe.y, P[G + 2] = se.z, P[ie + 2] = xe.z, P[he + 2] = Pe.z, P[ie] = xe.x, P[le] = ye.x, P[he] = Pe.x, P[ie + 1] = xe.y, P[le + 1] = ye.y, P[he + 1] = Pe.y, P[ie + 2] = xe.z, P[le + 2] = ye.z, P[he + 2] = Pe.z, R[V] = k, R[V + 1] = Q, R[V + 2] = oe, R[V + 3] = Q, R[V + 4] = ge, R[V + 5] = oe, $[N] = k, $[N + 1] = Q, $[N + 2] = k, $[N + 3] = oe, $[N + 4] = Q, $[N + 5] = ge, $[N + 6] = ge, $[N + 7] = oe, M.faceidx += 6, M.lineidx += 8);
                  }
                }
              }
              x.drawSphere = D;
            })(_ || (_ = {}));
          }
        ),
        /***/
        "./src/GLModel.ts": (
          /*!************************!*\
            !*** ./src/GLModel.ts ***!
            \************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              GLModel: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), _ = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), x = e(
              /*! ./colors */
              "./src/colors.ts"
            ), o = e(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), g = e(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), E = e(
              /*! ./utilities */
              "./src/utilities.ts"
            ), u = e(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), A = e(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), L = e(
              /*! netcdfjs */
              "./node_modules/netcdfjs/lib-esm/index.js"
            ), C = e(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            ), D = e(
              /*! ./parsers/utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function r(b) {
              let f;
              return typeof b == "string" ? f = new TextEncoder().encode(b) : f = new Uint8Array(b), (0, C.inflate)(f, {
                to: "string"
              });
            }
            class n {
              // class functions
              // return true if a and b represent the same style
              static sameObj(f, c) {
                return f && c ? JSON.stringify(f) == JSON.stringify(c) : f == c;
              }
              constructor(f, c) {
                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 _.Matrix4(), this.dontDuplicateAtoms = !0, this.defaultColor = x.elementColors.defaultColor, this.defaultStickRadius = 0.25, this.options = c || {}, this.ElementColors = this.options.defaultcolors ? this.options.defaultcolors : x.elementColors.defaultColors, this.defaultSphereRadius = this.options.defaultSphereRadius ? this.options.defaultSphereRadius : 1.5, this.defaultCartoonQuality = this.options.cartoonQuality ? this.options.cartoonQuality : 10, this.id = f;
              }
              // return proper radius for atom given style
              /**
               *
               * @param {AtomSpec} atom
               * @param {atomstyle} style
               * @return {number}
               *
               */
              getRadiusFromStyle(f, c) {
                var t = this.defaultSphereRadius;
                if (typeof c.radius < "u")
                  t = c.radius;
                else if (n.vdwRadii[f.elem])
                  t = n.vdwRadii[f.elem];
                else if (f.elem.length > 1) {
                  let a = f.elem;
                  a = a[0].toUpperCase() + a[1].toLowerCase(), n.vdwRadii[a] && (t = n.vdwRadii[a]);
                }
                return typeof c.scale < "u" && (t *= c.scale), t;
              }
              // cross drawing
              /**
               *
               * @param {AtomSpec} atom
               * @param {Record<number, Geometry>} geos
               */
              drawAtomCross(f, c) {
                if (f.style.cross) {
                  var t = f.style.cross;
                  if (!t.hidden) {
                    var a = t.linewidth || n.defaultlineWidth;
                    c[a] || (c[a] = new l.Geometry());
                    var h = c[a].updateGeoGroup(6), M = this.getRadiusFromStyle(f, t), w = [
                      [M, 0, 0],
                      [-M, 0, 0],
                      [0, M, 0],
                      [0, -M, 0],
                      [0, 0, M],
                      [0, 0, -M]
                    ], S = f.clickable || f.hoverable;
                    S && f.intersectionShape === void 0 && (f.intersectionShape = { sphere: [], cylinder: [], line: [] });
                    for (var T = (0, E.getColorFromStyle)(f, t), R = h.vertexArray, $ = h.colorArray, P = 0; P < 6; P++) {
                      var B = h.vertices * 3;
                      if (h.vertices++, R[B] = f.x + w[P][0], R[B + 1] = f.y + w[P][1], R[B + 2] = f.z + w[P][2], $[B] = T.r, $[B + 1] = T.g, $[B + 2] = T.b, S) {
                        var F = new _.Vector3(w[P][0], w[P][1], w[P][2]);
                        F.multiplyScalar(0.1), F.set(F.x + f.x, F.y + f.y, F.z + f.z), f.intersectionShape.line.push(F);
                      }
                    }
                  }
                }
              }
              getGoodCross(f, c, t, a) {
                for (var h = null, M = -1, w = 0, S = f.bonds.length; w < S; w++)
                  if (f.bonds[w] != c.index) {
                    let R = f.bonds[w], $ = this.atoms[R], B = new _.Vector3($.x, $.y, $.z).clone();
                    B.sub(t);
                    let F = B.clone();
                    F.cross(a);
                    var T = F.lengthSq();
                    if (T > M && (M = T, h = F, M > 0.1))
                      return h;
                  }
                return h;
              }
              //from atom, return a normalized vector v that is orthogonal and along which
              //it is appropraite to draw multiple bonds
              getSideBondV(f, c, t) {
                var a, h, M, w, S, T = new _.Vector3(f.x, f.y, f.z), R = new _.Vector3(c.x, c.y, c.z), $ = R.clone(), P = null;
                if ($.sub(T), f.bonds.length === 1)
                  c.bonds.length === 1 ? (P = $.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1) : (a = (t + 1) % c.bonds.length, h = c.bonds[a], M = this.atoms[h], M.index == f.index && (a = (a + 1) % c.bonds.length, h = c.bonds[a], M = this.atoms[h]), w = new _.Vector3(M.x, M.y, M.z), S = w.clone(), S.sub(T), P = S.clone(), P.cross($));
                else if (P = this.getGoodCross(f, c, T, $), P.lengthSq() < 0.01) {
                  var B = this.getGoodCross(c, f, T, $);
                  B != null && (P = B);
                }
                return P.lengthSq() < 0.01 && (P = $.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1), P.cross($), P.normalize(), P;
              }
              addLine(f, c, t, a, h, M) {
                f[t] = a.x, f[t + 1] = a.y, f[t + 2] = a.z, c[t] = M.r, c[t + 1] = M.g, c[t + 2] = M.b, f[t + 3] = h.x, f[t + 4] = h.y, f[t + 5] = h.z, c[t + 3] = M.r, c[t + 4] = M.g, c[t + 5] = M.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(f, c, t) {
                if (f.style.line) {
                  var a = f.style.line;
                  if (!a.hidden) {
                    var h, M, w, S, T = a.linewidth || n.defaultlineWidth;
                    t[T] || (t[T] = new l.Geometry());
                    for (var R = t[T].updateGeoGroup(6 * f.bonds.length), $ = R.vertexArray, P = R.colorArray, B = 0; B < f.bonds.length; B++) {
                      var F = f.bonds[B], U = c[F];
                      if (U.style.line && !(f.index >= U.index)) {
                        var z = new _.Vector3(f.x, f.y, f.z), W = new _.Vector3(U.x, U.y, U.z), V = z.clone().add(W).multiplyScalar(0.5), N = !1, k = f.clickable || f.hoverable, G = U.clickable || U.hoverable;
                        (k || G) && (k && (f.intersectionShape === void 0 && (f.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), f.intersectionShape.line.push(z), f.intersectionShape.line.push(V)), G && (U.intersectionShape === void 0 && (U.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), U.intersectionShape.line.push(V), U.intersectionShape.line.push(W)));
                        var Q = (0, E.getColorFromStyle)(f, f.style.line), ie = (0, E.getColorFromStyle)(U, U.style.line);
                        if (f.bondStyles && f.bondStyles[B]) {
                          var ge = f.bondStyles[B];
                          if (!ge.iswire)
                            continue;
                          ge.singleBond && (N = !0), typeof ge.color1 < "u" && (Q = x.CC.color(ge.color1)), typeof ge.color2 < "u" && (ie = x.CC.color(ge.color2));
                        }
                        var le = R.vertices * 3, oe, he;
                        if (f.bondOrder[B] > 1 && f.bondOrder[B] < 4 && !N) {
                          var se = this.getSideBondV(f, U, B), xe = W.clone();
                          xe.sub(z), f.bondOrder[B] == 2 ? (se.multiplyScalar(0.1), h = z.clone(), h.add(se), M = z.clone(), M.sub(se), w = h.clone(), w.add(xe), S = M.clone(), S.add(xe), Q == ie ? (R.vertices += 4, this.addLine($, P, le, h, w, Q), this.addLine($, P, le + 6, M, S, Q)) : (R.vertices += 8, xe.multiplyScalar(0.5), oe = h.clone(), oe.add(xe), he = M.clone(), he.add(xe), this.addLine($, P, le, h, oe, Q), this.addLine($, P, le + 6, oe, w, ie), this.addLine($, P, le + 12, M, he, Q), this.addLine($, P, le + 18, he, S, ie))) : f.bondOrder[B] == 3 && (se.multiplyScalar(0.1), h = z.clone(), h.add(se), M = z.clone(), M.sub(se), w = h.clone(), w.add(xe), S = M.clone(), S.add(xe), Q == ie ? (R.vertices += 6, this.addLine($, P, le, z, W, Q), this.addLine($, P, le + 6, h, w, Q), this.addLine($, P, le + 12, M, S, Q)) : (R.vertices += 12, xe.multiplyScalar(0.5), oe = h.clone(), oe.add(xe), he = M.clone(), he.add(xe), this.addLine($, P, le, z, V, Q), this.addLine($, P, le + 6, V, W, ie), this.addLine($, P, le + 12, h, oe, Q), this.addLine($, P, le + 18, oe, w, ie), this.addLine($, P, le + 24, M, he, Q), this.addLine($, P, le + 30, he, S, ie)));
                        } else
                          Q == ie ? (R.vertices += 2, this.addLine($, P, le, z, W, Q)) : (R.vertices += 4, this.addLine($, P, le, z, V, Q), this.addLine($, P, le + 6, V, W, ie));
                      }
                    }
                  }
                }
              }
              //sphere drawing
              //See also: drawCylinder
              /**
               *
               * @param {AtomSpec} atom
               * @param {Geometry} geo
               */
              drawAtomSphere(f, c) {
                if (f.style.sphere) {
                  var t = f.style.sphere;
                  if (!t.hidden) {
                    var a = (0, E.getColorFromStyle)(f, t), h = this.getRadiusFromStyle(f, t);
                    if ((f.clickable === !0 || f.hoverable) && f.intersectionShape !== void 0) {
                      var M = new _.Vector3(f.x, f.y, f.z);
                      f.intersectionShape.sphere.push(new p.Sphere(M, h));
                    }
                    o.GLDraw.drawSphere(c, f, h, a);
                  }
                }
              }
              /** Register atom shaped click handlers */
              drawAtomClickSphere(f) {
                if (f.style.clicksphere) {
                  var c = f.style.clicksphere;
                  if (!c.hidden) {
                    var t = this.getRadiusFromStyle(f, c);
                    if ((f.clickable === !0 || f.hoverable) && f.intersectionShape !== void 0) {
                      var a = new _.Vector3(f.x, f.y, f.z);
                      f.intersectionShape.sphere.push(new p.Sphere(a, t));
                    }
                  }
                }
              }
              drawAtomInstanced(f, c) {
                if (f.style.sphere) {
                  var t = f.style.sphere;
                  if (!t.hidden) {
                    var a = this.getRadiusFromStyle(f, t), h = (0, E.getColorFromStyle)(f, t), M = c.updateGeoGroup(1), w = M.vertices, S = w * 3, T = M.vertexArray, R = M.colorArray, $ = M.radiusArray;
                    if (T[S] = f.x, T[S + 1] = f.y, T[S + 2] = f.z, R[S] = h.r, R[S + 1] = h.g, R[S + 2] = h.b, $[w] = a, (f.clickable === !0 || f.hoverable) && f.intersectionShape !== void 0) {
                      var P = new _.Vector3(f.x, f.y, f.z);
                      f.intersectionShape.sphere.push(new p.Sphere(P, a));
                    }
                    M.vertices += 1;
                  }
                }
              }
              drawSphereImposter(f, c, t, a) {
                var h = f.updateGeoGroup(4), M, w = h.vertices, S = w * 3, T = h.vertexArray, R = h.colorArray;
                for (M = 0; M < 4; M++)
                  T[S + 3 * M] = c.x, T[S + 3 * M + 1] = c.y, T[S + 3 * M + 2] = c.z;
                var $ = h.normalArray;
                for (M = 0; M < 4; M++)
                  R[S + 3 * M] = a.r, R[S + 3 * M + 1] = a.g, R[S + 3 * M + 2] = a.b;
                $[S + 0] = -t, $[S + 1] = t, $[S + 2] = 0, $[S + 3] = -t, $[S + 4] = -t, $[S + 5] = 0, $[S + 6] = t, $[S + 7] = -t, $[S + 8] = 0, $[S + 9] = t, $[S + 10] = t, $[S + 11] = 0, h.vertices += 4;
                var P = h.faceArray, B = h.faceidx;
                P[B + 0] = w, P[B + 1] = w + 1, P[B + 2] = w + 2, P[B + 3] = w + 2, P[B + 4] = w + 3, P[B + 5] = w, h.faceidx += 6;
              }
              //dkoes -  code for sphere imposters
              drawAtomImposter(f, c) {
                if (f.style.sphere) {
                  var t = f.style.sphere;
                  if (!t.hidden) {
                    var a = this.getRadiusFromStyle(f, t), h = (0, E.getColorFromStyle)(f, t);
                    if ((f.clickable === !0 || f.hoverable) && f.intersectionShape !== void 0) {
                      var M = new _.Vector3(f.x, f.y, f.z);
                      f.intersectionShape.sphere.push(new p.Sphere(M, a));
                    }
                    this.drawSphereImposter(c, f, a, h);
                  }
                }
              }
              calculateDashes(f, c, t, a, h) {
                var M = Math.sqrt(Math.pow(f.x - c.x, 2) + Math.pow(f.y - c.y, 2) + Math.pow(f.z - c.z, 2));
                t = Math.max(t, 0), h = Math.max(h, 0) + 2 * t, a = Math.max(a, 1e-3), a + h > M && (a = M, h = 0);
                var w = Math.floor((M - a) / (a + h)) + 1, S = w * a;
                h = (M - S) / w;
                for (var T, R = new _.Vector3(f.x, f.y, f.z), $ = new _.Vector3((c.x - f.x) / (M / h), (c.y - f.y) / (M / h), (c.z - f.z) / (M / h)), P = new _.Vector3((c.x - f.x) / (M / a), (c.y - f.y) / (M / a), (c.z - f.z) / (M / a)), B = [], F = 0; F < w; F++)
                  T = new _.Vector3(R.x + P.x, R.y + P.y, R.z + P.z), B.push({ from: R, to: T }), R = new _.Vector3(T.x + $.x, T.y + $.y, T.z + $.z);
                return B;
              }
              static drawStickImposter(f, c, t, a, h, M = 0, w = 0) {
                for (var S = f.updateGeoGroup(4), T = S.vertices, R = T * 3, $ = S.vertexArray, P = S.colorArray, B = S.radiusArray, F = S.normalArray, U = h.r, z = h.g, W = h.b, V = function(ie) {
                  var ge = -ie;
                  return ge == 0 && (ge = -1e-4), ge;
                }, N = R, k = 0; k < 4; k++)
                  $[N] = c.x, F[N] = t.x, P[N] = U, N++, $[N] = c.y, F[N] = t.y, P[N] = z, N++, $[N] = c.z, F[N] = t.z, k < 2 ? P[N] = W : P[N] = V(W), N++;
                S.vertices += 4, B[T] = -a, B[T + 1] = a, B[T + 2] = -a, B[T + 3] = a;
                var G = S.faceArray, Q = S.faceidx;
                G[Q + 0] = T, G[Q + 1] = T + 1, G[Q + 2] = T + 2, G[Q + 3] = T + 2, G[Q + 4] = T + 3, G[Q + 5] = T, S.faceidx += 6;
              }
              // draws cylinders and small spheres (at bond radius)
              drawBondSticks(f, c, t) {
                var a, h;
                if (f.style.stick) {
                  var M = f.style.stick;
                  if (!M.hidden) {
                    var w = M.radius || this.defaultStickRadius, S = M.doubleBondScaling || 0.4, T = M.tripleBondScaling || 0.25, R = ((a = M.dashedBondConfig) === null || a === void 0 ? void 0 : a.dashLength) || 0.1, $ = ((h = M.dashedBondConfig) === null || h === void 0 ? void 0 : h.gapLength) || 0.25, P = w, B = M.singleBonds || !1, F = M.dashedBonds || !1, U = 0, z = 0, W, V, N, k, G, Q, ie, ge, le, oe, he, se = (0, E.getColorFromStyle)(f, M), xe, ye, Pe;
                    !f.capDrawn && f.bonds.length < 4 && (U = 2);
                    var de = (Te) => {
                      var ae = t.imposter ? n.drawStickImposter : o.GLDraw.drawCylinder;
                      return !F && Te >= 1 ? ae : (De, Y, Oe, Ve, I, me = 0, ve = 0, X = 0.1, ne = 0.25) => {
                        var Ee = this.calculateDashes(Y, Oe, Ve, X, ne);
                        Ee.forEach((He) => {
                          ae(De, He.from, He.to, Ve, I, me, ve);
                        });
                      };
                    };
                    for (N = 0; N < f.bonds.length; N++) {
                      var pe = de(f.bondOrder[N]), re = f.bonds[N], Se = c[re];
                      if (xe = ye = Pe = null, f.index < Se.index) {
                        var ke = Se.style;
                        if (!ke.stick || ke.stick.hidden)
                          continue;
                        var $e = (0, E.getColorFromStyle)(Se, ke.stick);
                        if (P = w, k = B, f.bondStyles && f.bondStyles[N]) {
                          if (G = f.bondStyles[N], G.iswire)
                            continue;
                          G.radius && (P = G.radius), G.singleBond && (k = !0), typeof G.color1 < "u" && (se = x.CC.color(G.color1)), typeof G.color2 < "u" && ($e = x.CC.color(G.color2));
                        }
                        var ze = new _.Vector3(f.x, f.y, f.z), Re = new _.Vector3(Se.x, Se.y, Se.z);
                        if (f.bondOrder[N] <= 1 || k || f.bondOrder[N] > 3) {
                          if (f.bondOrder[N] < 1 && (P *= f.bondOrder[N]), !Se.capDrawn && Se.bonds.length < 4 && (z = 2), se != $e ? (xe = new _.Vector3().addVectors(ze, Re).multiplyScalar(0.5), pe(t, ze, xe, P, se, U, 0, R, $), pe(t, xe, Re, P, $e, 0, z, R, $)) : pe(t, ze, Re, P, se, U, z, R, $), W = f.clickable || f.hoverable, V = Se.clickable || Se.hoverable, W || V) {
                            if (xe || (xe = new _.Vector3().addVectors(ze, Re).multiplyScalar(0.5)), W) {
                              var Fe = new p.Cylinder(ze, xe, P), Ie = new p.Sphere(ze, P);
                              f.intersectionShape.cylinder.push(Fe), f.intersectionShape.sphere.push(Ie);
                            }
                            if (V) {
                              var We = new p.Cylinder(Re, xe, P), Ue = new p.Sphere(Re, P);
                              Se.intersectionShape.cylinder.push(We), Se.intersectionShape.sphere.push(Ue);
                            }
                          }
                        } else if (f.bondOrder[N] > 1) {
                          var Be = 0, Ne = 0;
                          P != w && (Be = 2, Ne = 2);
                          var H = Re.clone(), K = null;
                          H.sub(ze);
                          var q, fe, _e, Me, Ae;
                          K = this.getSideBondV(f, Se, N), f.bondOrder[N] == 2 ? (q = P * S, K.multiplyScalar(q * 1.5), fe = ze.clone(), fe.add(K), _e = ze.clone(), _e.sub(K), Me = fe.clone(), Me.add(H), Ae = _e.clone(), Ae.add(H), se != $e ? (xe = new _.Vector3().addVectors(fe, Me).multiplyScalar(0.5), ye = new _.Vector3().addVectors(_e, Ae).multiplyScalar(0.5), pe(t, fe, xe, q, se, Be, 0), pe(t, xe, Me, q, $e, 0, Ne), pe(t, _e, ye, q, se, Be, 0), pe(t, ye, Ae, q, $e, 0, Ne)) : (pe(t, fe, Me, q, se, Be, Ne), pe(t, _e, Ae, q, se, Be, Ne)), W = f.clickable || f.hoverable, V = Se.clickable || Se.hoverable, (W || V) && (xe || (xe = new _.Vector3().addVectors(fe, Me).multiplyScalar(0.5)), ye || (ye = new _.Vector3().addVectors(_e, Ae).multiplyScalar(0.5)), W && (Q = new p.Cylinder(fe, xe, q), ie = new p.Cylinder(_e, ye, q), f.intersectionShape.cylinder.push(Q), f.intersectionShape.cylinder.push(ie)), V && (le = new p.Cylinder(Me, xe, q), oe = new p.Cylinder(Ae, ye, q), Se.intersectionShape.cylinder.push(le), Se.intersectionShape.cylinder.push(oe)))) : f.bondOrder[N] == 3 && (q = P * T, K.cross(H), K.normalize(), K.multiplyScalar(q * 3), fe = ze.clone(), fe.add(K), _e = ze.clone(), _e.sub(K), Me = fe.clone(), Me.add(H), Ae = _e.clone(), Ae.add(H), se != $e ? (xe = new _.Vector3().addVectors(fe, Me).multiplyScalar(0.5), ye = new _.Vector3().addVectors(_e, Ae).multiplyScalar(0.5), Pe = new _.Vector3().addVectors(ze, Re).multiplyScalar(0.5), pe(t, fe, xe, q, se, Be, 0), pe(t, xe, Me, q, $e, 0, Ne), pe(t, ze, Pe, q, se, U, 0), pe(t, Pe, Re, q, $e, 0, z), pe(t, _e, ye, q, se, Be, 0), pe(t, ye, Ae, q, $e, 0, Ne)) : (pe(t, fe, Me, q, se, Be, Ne), pe(t, ze, Re, q, se, U, z), pe(t, _e, Ae, q, se, Be, Ne)), W = f.clickable || f.hoverable, V = Se.clickable || Se.hoverable, (W || V) && (xe || (xe = new _.Vector3().addVectors(fe, Me).multiplyScalar(0.5)), ye || (ye = new _.Vector3().addVectors(_e, Ae).multiplyScalar(0.5)), Pe || (Pe = new _.Vector3().addVectors(ze, Re).multiplyScalar(0.5)), W && (Q = new p.Cylinder(fe.clone(), xe.clone(), q), ie = new p.Cylinder(_e.clone(), ye.clone(), q), ge = new p.Cylinder(ze.clone(), Pe.clone(), q), f.intersectionShape.cylinder.push(Q), f.intersectionShape.cylinder.push(ie), f.intersectionShape.cylinder.push(ge)), V && (le = new p.Cylinder(Me.clone(), xe.clone(), q), oe = new p.Cylinder(Ae.clone(), ye.clone(), q), he = new p.Cylinder(Re.clone(), Pe.clone(), q), Se.intersectionShape.cylinder.push(le), Se.intersectionShape.cylinder.push(oe), Se.intersectionShape.cylinder.push(he))));
                        }
                      }
                    }
                    var Z = !1, ue = 0, we = !1;
                    for (N = 0; N < f.bonds.length; N++)
                      k = B, f.bondStyles && f.bondStyles[N] && (G = f.bondStyles[N], G.singleBond && (k = !0), G.radius && G.radius != w && (we = !0)), (k || f.bondOrder[N] == 1) && ue++;
                    we ? ue > 0 && (Z = !0) : ue == 0 && (f.bonds.length > 0 || M.showNonBonded) && (Z = !0), Z && (P = w, t.imposter ? this.drawSphereImposter(t.sphereGeometry, f, P, se) : o.GLDraw.drawSphere(t, f, P, se));
                  }
                }
              }
              // 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(f, c) {
                c = c || {};
                var t = new l.Object3D(), a = [], h = {}, M = {}, w = this.drawAtomSphere, S = null, T = null;
                c.supportsImposters ? (w = this.drawAtomImposter, S = new l.Geometry(!0), S.imposter = !0, T = new l.Geometry(!0, !0), T.imposter = !0, T.sphereGeometry = new l.Geometry(!0), T.sphereGeometry.imposter = !0, T.drawnCaps = {}) : c.supportsAIA ? (w = this.drawAtomInstanced, S = new l.Geometry(!1, !0, !0), S.instanced = !0, T = new l.Geometry(!0)) : (S = new l.Geometry(!0), T = new l.Geometry(!0));
                var R, $, P, B, F = {}, U = [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY];
                for (R = 0, P = f.length; R < P; R++) {
                  var z = f[R];
                  if (z && z.style) {
                    (z.clickable || z.hoverable) && z.intersectionShape === void 0 && (z.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), B = { line: void 0, cross: void 0, stick: void 0, sphere: void 0 };
                    for ($ in B)
                      z.style[$] ? z.style[$].opacity ? B[$] = parseFloat(z.style[$].opacity) : B[$] = 1 : B[$] = void 0, F[$] ? B[$] != null && F[$] != B[$] && (console.log("Warning: " + $ + " opacity is ambiguous"), F[$] = 1) : F[$] = B[$];
                    w.call(this, z, S), this.drawAtomClickSphere(z), this.drawAtomCross(z, M), this.drawBondLines(z, f, h), this.drawBondSticks(z, f, T), typeof z.style.cartoon < "u" && !z.style.cartoon.hidden && (z.style.cartoon.color === "spectrum" && typeof z.resi == "number" && !z.hetflag && (z.resi < U[0] && (U[0] = z.resi), z.resi > U[1] && (U[1] = z.resi)), a.push(z));
                  }
                }
                if (a.length > 0 && (0, g.drawCartoon)(t, a, U, this.defaultCartoonQuality), S && S.vertices > 0) {
                  S.initTypedArrays();
                  var W = null, V = null;
                  S.imposter ? W = new l.SphereImposterMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }) : S.instanced ? (V = new l.Geometry(!0), o.GLDraw.drawSphere(V, { x: 0, y: 0, z: 0 }, 1, new x.Color(0.5, 0.5, 0.5)), V.initTypedArrays(), W = new l.InstancedMaterial({
                    sphereMaterial: new l.MeshLambertMaterial({
                      ambient: 0,
                      vertexColors: !0,
                      reflectivity: 0
                    }),
                    sphere: V
                  })) : W = new l.MeshLambertMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }), F.sphere < 1 && F.sphere >= 0 && (W.transparent = !0, W.opacity = F.sphere), V = new l.Mesh(S, W), t.add(V);
                }
                if (T.vertices > 0) {
                  var N = null, k = null, G = T.sphereGeometry;
                  (!G || typeof G.vertices > "u" || G.vertices == 0) && (G = null), T.initTypedArrays(), G && G.initTypedArrays();
                  var Q = { ambient: 0, vertexColors: !0, reflectivity: 0 };
                  T.imposter ? (N = new l.StickImposterMaterial(Q), k = new l.SphereImposterMaterial(Q)) : (N = new l.MeshLambertMaterial(Q), k = new l.MeshLambertMaterial(Q), N.wireframe && (T.setUpWireframe(), G && G.setUpWireframe())), F.stick < 1 && F.stick >= 0 && (N.transparent = !0, N.opacity = F.stick, k.transparent = !0, k.opacity = F.stick);
                  var ie = new l.Mesh(T, N);
                  if (t.add(ie), G) {
                    var ge = new l.Mesh(G, k);
                    t.add(ge);
                  }
                }
                var le;
                for (R in h)
                  if (h.hasOwnProperty(R)) {
                    le = R;
                    var oe = new l.LineBasicMaterial({
                      linewidth: le,
                      vertexColors: !0
                    });
                    F.line < 1 && F.line >= 0 && (oe.transparent = !0, oe.opacity = F.line), h[R].initTypedArrays();
                    var he = new l.Line(h[R], oe, l.LineStyle.LinePieces);
                    t.add(he);
                  }
                for (R in M)
                  if (M.hasOwnProperty(R)) {
                    le = R;
                    var se = new l.LineBasicMaterial({
                      linewidth: le,
                      vertexColors: !0
                    });
                    F.cross < 1 && F.cross >= 0 && (se.transparent = !0, se.opacity = F.cross), M[R].initTypedArrays();
                    var xe = new l.Line(M[R], se, l.LineStyle.LinePieces);
                    t.add(xe);
                  }
                if (this.dontDuplicateAtoms && this.modelData.symmetries && this.modelData.symmetries.length > 0) {
                  var ye = new l.Object3D(), Pe;
                  for (Pe = 0; Pe < this.modelData.symmetries.length; Pe++) {
                    var de = new l.Object3D();
                    de = t.clone(), de.matrix.copy(this.modelData.symmetries[Pe]), de.matrixAutoUpdate = !1, ye.add(de);
                  }
                  return ye;
                }
                return t;
              }
              /**
               * 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(f) {
                this.atoms = f.atoms, this.frames = f.frames, this.molObj = null;
              }
              /**
               * Returns crystallographic information if present.
               *
               *
               */
              getCrystData() {
                if (this.modelData.cryst) {
                  if (!this.modelData.cryst.matrix) {
                    const f = this.modelData.cryst;
                    this.modelData.cryst.matrix = (0, _.conversionMatrix3)(f.a, f.b, f.c, f.alpha, f.beta, f.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(f, c, t, a, h, M) {
                f = f || 1, c = c || 1, t = t || 1, a = a || 90, h = h || 90, M = M || 90;
                const w = (0, _.conversionMatrix3)(f, c, t, a, h, M);
                this.modelData.cryst = {
                  a: f,
                  b: c,
                  c: t,
                  alpha: a,
                  beta: h,
                  gamma: M,
                  matrix: w
                };
              }
              /**
               * 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(f) {
                f = f || new _.Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), this.modelData.cryst = {
                  matrix: f
                };
              }
              /**
               * 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(f) {
                typeof f > "u" ? this.modelData.symmetries = [this.idMatrix] : this.modelData.symmetries = f;
              }
              /**
               * 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(f, c, t, a) {
                var h = c - f;
                return h < -t ? c + a : h > t ? c - a : c;
              }
              //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 f = this.box[0], c = this.box[1], t = this.box[2], a = f * 0.9, h = c * 0.9, M = t * 0.9, w = 0; w < this.atomdfs.length; w++)
                    for (var S = this.atomdfs[w], T = 1; T < S.length; T++) {
                      var R = this.atoms[S[T][0]], $ = this.atoms[S[T][1]];
                      R.x = this.adjustCoord($.x, R.x, a, f), R.y = this.adjustCoord($.y, R.y, h, c), R.z = this.adjustCoord($.z, R.z, M, t);
                    }
              }
              /**
               * 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(f, c) {
                var t = this.getNumFrames();
                let a = this;
                return new Promise(function(h, M) {
                  if (t == 0 && h(), (f < 0 || f >= t) && (f = t - 1), a.frames.url != null) {
                    var w = a.frames.url;
                    (0, E.getbin)(w + "/traj/frame/" + f + "/" + a.frames.path, void 0, "POST", void 0).then(function(S) {
                      for (var T = new Float32Array(S, 44), R = 0, $ = 0; $ < a.atoms.length; $++)
                        a.atoms[$].x = T[R++], a.atoms[$].y = T[R++], a.atoms[$].z = T[R++];
                      a.box && a.atomdfs && a.adjustCoordinatesToBox(), h();
                    }).catch(M);
                  } else
                    a.atoms = a.frames[f], h();
                  a.molObj = null, a.modelDatas && f < a.modelDatas.length && (a.modelData = a.modelDatas[f], a.unitCellObjects && c && (c.removeUnitCell(a), c.addUnitCell(a)));
                });
              }
              /**
               * Add atoms as frames of model
               *
               * @param {AtomSpec[]} atoms - atoms to be added
               */
              addFrame(f) {
                this.frames.push(f);
              }
              /**
              	     * 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(f = 10, c = 1, t = !1, a, h) {
                var M = 0, w = f;
                t && (M = -f, w = f), this.frames !== void 0 && this.frames.origIndex !== void 0 ? this.setFrame(this.frames.origIndex) : this.setFrame(0), M < w && (this.frames = []), t && (this.frames.origIndex = f);
                for (var S = M; S < w; S++) {
                  var T = [], R = this.frames.length;
                  if (S == 0 && !h) {
                    this.frames.push(this.atoms);
                    continue;
                  }
                  for (var $ = 0; $ < this.atoms.length; $++) {
                    var P = (0, E.getAtomProperty)(this.atoms[$], "dx"), B = (0, E.getAtomProperty)(this.atoms[$], "dy"), F = (0, E.getAtomProperty)(this.atoms[$], "dz"), U = new _.Vector3(P, B, F), z = new _.Vector3(this.atoms[$].x, this.atoms[$].y, this.atoms[$].z), W = S * c / f;
                    U.multiplyScalar(W), z.add(U);
                    var V = {};
                    for (var N in this.atoms[$])
                      V[N] = this.atoms[$][N];
                    if (V.x = z.x, V.y = z.y, V.z = z.z, T.push(V), a && h) {
                      var k = (0, E.extend)({}, h), G = new _.Vector3(P, B, F);
                      if (G.multiplyScalar(c), G.add(z), k.start = z, k.end = G, k.frame = R, !k.color) {
                        var Q = V.style.sphere;
                        Q || (Q = V.style.stick), Q || (Q = V.style.line), k.color = (0, E.getColorFromStyle)(V, Q);
                      }
                      a.addArrow(k);
                    }
                  }
                  this.frames.push(T);
                }
              }
              // set default style and colors for atoms
              setAtomDefaults(f) {
                for (let c = 0; c < f.length; c++) {
                  let t = f[c];
                  t && (t.style = t.style || (0, E.deepCopy)(n.defaultAtomStyle), t.color = t.color || this.ElementColors[t.elem] || this.defaultColor, t.model = this.id, (t.clickable || t.hoverable) && (t.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(f, c, t = {}) {
                var a = n.parseMolData(f, c, t);
                this.dontDuplicateAtoms = !t.duplicateAssemblyAtoms;
                var h = a.modelData;
                if (h && (Array.isArray(h) ? (this.modelData = h[0], t.frames && (this.modelDatas = h)) : this.modelData = h), a.box ? this.box = a.box : this.box = null, this.frames.length == 0) {
                  for (let w = 0; w < a.length; w++)
                    a[w].length != 0 && this.frames.push(a[w]);
                  this.frames[0] && (this.atoms = this.frames[0]);
                } else if (t.frames)
                  for (let w = 0; w < a.length; w++)
                    this.frames.push(a[w]);
                else
                  for (var M = 0; M < a.length; M++)
                    this.addAtoms(a[M]);
                for (let w = 0; w < this.frames.length; w++)
                  this.setAtomDefaults(this.frames[w]);
                t.vibrate && t.vibrate.frames && t.vibrate.amplitude && this.vibrate(t.vibrate.frames, t.vibrate.amplitude), t.style && this.setStyle({}, t.style);
              }
              setDontDuplicateAtoms(f) {
                this.dontDuplicateAtoms = f;
              }
              setModelData(f) {
                this.modelData = f;
              }
              //return true if atom value matches property val
              propertyMatches(f, c) {
                if (f == c)
                  return !0;
                if (typeof c == "string" && typeof f == "number") {
                  var t = c.match(/(-?\d+)\s*-\s*(-?\d+)/);
                  if (t) {
                    var a = parseInt(t[1]), h = parseInt(t[2]);
                    if (t && f >= a && f <= h)
                      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(f, c) {
                if (typeof f != "object" || f == null || f.__cache_created)
                  return f;
                const t = {};
                for (const a in f) {
                  const h = f[a];
                  if (Array.isArray(h)) {
                    t[a] = [];
                    for (let M = 0; M < h.length; M++)
                      t[a].push(n.deepCopyAndCache(h[M], c));
                  } else
                    typeof h == "object" && a != "properties" && a != "model" ? t[a] = n.deepCopyAndCache(h, c) : t[a] = h;
                  if (a == "and" || a == "or") {
                    const M = [];
                    for (const w of t[a]) {
                      const S = /* @__PURE__ */ new Set();
                      for (const T of c.selectedAtoms(w))
                        S.add(T.index);
                      M.push(S);
                    }
                    if (a == "and") {
                      const w = function(T, R) {
                        const $ = /* @__PURE__ */ new Set();
                        for (const P of R)
                          T.has(P) && $.add(P);
                        return $;
                      };
                      let S = new Set(M[0]);
                      for (const T of M.splice(1))
                        S = w(S, T);
                      t[a].__cached_results = S;
                    } else if (a == "or") {
                      const w = /* @__PURE__ */ new Set();
                      for (const S of M)
                        for (const T of S)
                          w.add(T);
                      t[a].__cached_results = w;
                    }
                  }
                }
                return t.__cache_created = !0, t;
              }
              /** 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(f, c) {
                if (typeof c > "u")
                  return !0;
                var t = !!c.invert, a = !0;
                for (var h in c)
                  if (h == "and" || h == "or" || h == "not") {
                    if (h == "not") {
                      if (this.atomIsSelected(f, c[h])) {
                        a = !1;
                        break;
                      }
                    } else if (c[h].__cached_results === void 0 && (c = n.deepCopyAndCache(c, this)), a = c[h].__cached_results.has(f.index), !a)
                      break;
                  } else if (h === "predicate") {
                    if (!c.predicate(f)) {
                      a = !1;
                      break;
                    }
                  } else if (h == "properties" && f[h]) {
                    for (var M in c.properties)
                      if (!M.startsWith("__cache")) {
                        if (typeof f.properties[M] > "u") {
                          a = !1;
                          break;
                        }
                        if (f.properties[M] != c.properties[M]) {
                          a = !1;
                          break;
                        }
                      }
                  } else if (c.hasOwnProperty(h) && !n.ignoredKeys.has(h) && !h.startsWith("__cache")) {
                    if (typeof f[h] > "u") {
                      a = !1;
                      break;
                    }
                    var w = !1;
                    if (h === "bonds") {
                      var S = c[h];
                      if (S != f.bonds.length) {
                        a = !1;
                        break;
                      }
                    } else if (Array.isArray(c[h])) {
                      var T = c[h], R = f[h];
                      for (let $ = 0; $ < T.length; $++)
                        if (this.propertyMatches(R, T[$])) {
                          w = !0;
                          break;
                        }
                      if (!w) {
                        a = !1;
                        break;
                      }
                    } else {
                      let $ = c[h];
                      if (!this.propertyMatches(f[h], $)) {
                        a = !1;
                        break;
                      }
                    }
                  }
                return t ? !a : a;
              }
              static squaredDistance(f, c) {
                var t = c.x - f.x, a = c.y - f.y, h = c.z - f.z;
                return t * t + a * a + h * h;
              }
              /** 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(f, c) {
                if (c <= 0)
                  return f;
                for (var t = (0, E.getExtent)(f, void 0), a = [[], [], []], h = 0; h < 3; h++)
                  a[0][h] = t[0][h] - c, a[1][h] = t[1][h] + c, a[2][h] = t[2][h];
                var M = [];
                for (let R = 0; R < this.atoms.length; R++) {
                  var w = this.atoms[R].x, S = this.atoms[R].y, T = this.atoms[R].z;
                  w >= a[0][0] && w <= a[1][0] && S >= a[0][1] && S <= a[1][1] && T >= a[0][2] && T <= a[1][2] && (w >= t[0][0] && w <= t[1][0] && S >= t[0][1] && S <= t[1][1] && T >= t[0][2] && T <= t[1][2] || M.push(this.atoms[R]));
                }
                return M;
              }
              static getFloat(f) {
                return typeof f == "number" ? f : parseFloat(f);
              }
              /** 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(f, c) {
                var t = [];
                f = n.deepCopyAndCache(f || {}, this), c || (c = this.atoms);
                for (var a = c.length, h = 0; h < a; h++) {
                  var M = c[h];
                  M && this.atomIsSelected(M, f) && t.push(M);
                }
                if (f.hasOwnProperty("expand")) {
                  const V = n.getFloat(f.expand);
                  let N = this.expandAtomList(t, V), k = t.length;
                  const G = V * V;
                  for (let Q = 0; Q < N.length; Q++)
                    for (let ie = 0; ie < k; ie++) {
                      var w = n.squaredDistance(N[Q], t[ie]);
                      w < G && w > 0 && t.push(N[Q]);
                    }
                }
                if (f.hasOwnProperty("within") && f.within.hasOwnProperty("sel") && f.within.hasOwnProperty("distance")) {
                  var S = this.selectedAtoms(f.within.sel, this.atoms), T = {};
                  const V = n.getFloat(f.within.distance), N = V * V;
                  for (let k = 0; k < S.length; k++)
                    for (let G = 0; G < t.length; G++) {
                      let Q = n.squaredDistance(S[k], t[G]);
                      Q < N && Q > 0 && (T[G] = 1);
                    }
                  var R = [];
                  if (f.within.invert)
                    for (let k = 0; k < t.length; k++)
                      T[k] || R.push(t[k]);
                  else
                    for (let k in T)
                      R.push(t[k]);
                  t = R;
                }
                if (f.hasOwnProperty("byres")) {
                  var $ = {}, P = [], B = [];
                  for (let V = 0; V < t.length; V++) {
                    let N = t[V];
                    var F = N.chain, U = N.resi;
                    if ($[F] === void 0 && ($[F] = {}), N.hasOwnProperty("resi") && $[F][U] === void 0) {
                      for ($[F][U] = !0, B.push(N); B.length > 0; )
                        if (N = B.pop(), F = N.chain, U = N.resi, P[N.index] === void 0) {
                          P[N.index] = !0;
                          for (var z = 0; z < N.bonds.length; z++) {
                            var W = this.atoms[N.bonds[z]];
                            P[W.index] === void 0 && W.hasOwnProperty("resi") && W.chain == F && W.resi == U && (B.push(W), t.push(W));
                          }
                        }
                    }
                  }
                }
                return t;
              }
              /** 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(f) {
                this.molObj = null;
                var c = this.atoms.length, t = [], a;
                for (a = 0; a < f.length; a++)
                  typeof f[a].index > "u" && (f[a].index = a), typeof f[a].serial > "u" && (f[a].serial = a), t[f[a].index] = c + a;
                for (a = 0; a < f.length; a++) {
                  var h = f[a], M = t[h.index], w = (0, E.extend)({}, h);
                  w.index = M, w.bonds = [], w.bondOrder = [], w.model = this.id, w.style = w.style || (0, E.deepCopy)(n.defaultAtomStyle), typeof w.color > "u" && (w.color = this.ElementColors[w.elem] || this.defaultColor);
                  for (var S = h.bonds ? h.bonds.length : 0, T = 0; T < S; T++) {
                    var R = t[h.bonds[T]];
                    typeof R < "u" && (w.bonds.push(R), w.bondOrder.push(h.bondOrder ? h.bondOrder[T] : 1));
                  }
                  this.atoms.push(w);
                }
              }
              /** 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, D.assignBonds)(this.atoms, { assignBonds: !0 });
              }
              /** Remove specified atoms from model
               *
               * @param {AtomSpec[]} badatoms - list of atoms
               */
              removeAtoms(f) {
                this.molObj = null;
                var c = [], t;
                for (t = 0; t < f.length; t++)
                  c[f[t].index] = !0;
                var a = [];
                for (t = 0; t < this.atoms.length; t++) {
                  var h = this.atoms[t];
                  c[h.index] || a.push(h);
                }
                this.atoms = [], this.addAtoms(a);
              }
              /** 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(f, c, t) {
                typeof c > "u" && typeof t > "u" && (c = f, f = {}), f = f, typeof c == "string" && (c = (0, E.specStringToObject)(c));
                var a = !1, h = this, M = function(S) {
                  var T = h.selectedAtoms(f, S);
                  for (let R = 0; R < S.length; R++)
                    S[R] && (S[R].capDrawn = !1);
                  for (let R = 0; R < T.length; R++) {
                    a = !0, (T[R].clickable || T[R].hoverable) && (T[R].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), t || (T[R].style = {});
                    for (let $ in c)
                      c.hasOwnProperty($) && (T[R].style[$] = T[R].style[$] || {}, Object.assign(T[R].style[$], c[$]));
                  }
                };
                if (f.frame !== void 0 && f.frame < this.frames.length) {
                  let S = f.frame;
                  S < 0 && (S = this.frames.length + S), M(this.frames[S]);
                } else {
                  M(this.atoms);
                  for (var w = 0; w < this.frames.length; w++)
                    this.frames[w] !== this.atoms && M(this.frames[w]);
                }
                a && (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(f, c, t) {
                if (c = !!c, t = (0, E.makeFunction)(t), t === null) {
                  console.log("Callback is not a function");
                  return;
                }
                var a = this.selectedAtoms(f, this.atoms), h = a.length;
                for (let M = 0; M < h; M++)
                  a[M].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, a[M].clickable = c, t && (a[M].callback = t);
                h > 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(f, c, t, a) {
                if (c = !!c, t = (0, E.makeFunction)(t), a = (0, E.makeFunction)(a), t === null) {
                  console.log("Hover_callback is not a function");
                  return;
                }
                if (a === null) {
                  console.log("Unhover_callback is not a function");
                  return;
                }
                var h = this.selectedAtoms(f, this.atoms), M = h.length;
                for (let w = 0; w < M; w++)
                  h[w].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, h[w].hoverable = c, t && (h[w].hover_callback = t), a && (h[w].unhover_callback = a);
                M > 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(f, c) {
                c = !!c;
                var t, a = this.selectedAtoms(f, this.atoms), h = a.length;
                for (t = 0; t < h; t++)
                  a[t].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, a[t].contextMenuEnabled = c;
                h > 0 && (this.molObj = null);
              }
              /** given a mapping from element to color, set atom colors
               *
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(f, c) {
                if (!(this.molObj !== null && n.sameObj(c, this.lastColors))) {
                  this.lastColors = c;
                  var t = this.selectedAtoms(f, t);
                  t.length > 0 && (this.molObj = null);
                  for (var a = 0; a < t.length; a++) {
                    var h = t[a];
                    typeof c[h.elem] < "u" && (h.color = c[h.elem]);
                  }
                }
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               */
              setColorByProperty(f, c, t, a) {
                var h, M, w = this.selectedAtoms(f, w);
                for (this.lastColors = null, w.length > 0 && (this.molObj = null), typeof t == "string" && typeof u.Gradient.builtinGradients[t] < "u" && (t = new u.Gradient.builtinGradients[t]()), t = t, a || (a = t.range()), a || (a = (0, E.getPropertyRange)(w, c)), h = 0; h < w.length; h++) {
                  M = w[h];
                  var S = (0, E.getAtomProperty)(M, c);
                  S != null && (M.color = t.valueToHex(parseFloat(M.properties[c]), a));
                }
              }
              /**
              	     * @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(f, c) {
                var t = this.selectedAtoms(f, t);
                if (typeof c == "function") {
                  this.lastColors = null, t.length > 0 && (this.molObj = null);
                  for (let a = 0; a < t.length; a++) {
                    let h = t[a];
                    h.color = c(h);
                  }
                }
              }
              /** 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(f = !1) {
                var c = { a: [], b: [] };
                f && (c.s = []);
                for (let a = 0; a < this.atoms.length; a++) {
                  let h = {}, M = this.atoms[a];
                  if (h.x = M.x, h.y = M.y, h.z = M.z, M.elem != "C" && (h.l = M.elem), f) {
                    for (var t = 0; t < c.s.length && JSON.stringify(M.style) !== JSON.stringify(c.s[t]); )
                      t++;
                    t === c.s.length && c.s.push(M.style), t !== 0 && (h.s = t);
                  }
                  c.a.push(h);
                  for (let w = 0; w < M.bonds.length; w++) {
                    let S = a, T = M.bonds[w];
                    if (S >= T)
                      continue;
                    let R = {
                      b: S,
                      e: T
                    }, $ = M.bondOrder[w];
                    $ != 1 && (R.o = $), c.b.push(R);
                  }
                }
                return c;
              }
              /** 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(f, c) {
                (this.molObj === null || c.regen) && (this.molObj = this.createMolObj(this.atoms, c), this.renderedMolObj && (f.remove(this.renderedMolObj), this.renderedMolObj = null), this.renderedMolObj = this.molObj.clone(), this.hidden && (this.renderedMolObj.setVisible(!1), this.molObj.setVisible(!1)), f.add(this.renderedMolObj));
              }
              /** return a VRML string representation of the model.  Does not include VRML header information
               * @return VRML
               */
              exportVRML() {
                var f = this.createMolObj(this.atoms, { supportsImposters: !1, supportsAIA: !1 });
                return f.vrml();
              }
              /** Remove any renderable mol object from scene
               *
               * @param {Object3D} group
               */
              removegl(f) {
                this.renderedMolObj && (this.renderedMolObj.geometry !== void 0 && this.renderedMolObj.geometry.dispose(), this.renderedMolObj.material !== void 0 && this.renderedMolObj.material.dispose(), f.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(f, c, t, a) {
                for (var h = this.selectedAtoms(c, h), M = (0, E.deepCopy)(a), w = 0; w < h.length; w++) {
                  var S = h[w], T = null;
                  typeof S[f] < "u" ? T = String(S[f]) : typeof S.properties[f] < "u" && (T = String(S.properties[f])), T != null && (M.position = S, t.addLabel(T, M));
                }
              }
              /** 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(f, c, t, a = !1) {
                var h = [], M = function(S, T) {
                  for (var R = S.selectedAtoms(f, R), $ = {}, P = 0; P < R.length; P++) {
                    var B = R[P], F = B.chain, U = B.resn, z = B.resi, W = U + "" + z;
                    $[F] || ($[F] = {}), $[F][W] || ($[F][W] = []), $[F][W].push(B);
                  }
                  var V = (0, E.deepCopy)(t);
                  for (let k in $)
                    if ($.hasOwnProperty(k)) {
                      var N = $[k];
                      for (let G in N)
                        if (N.hasOwnProperty(G)) {
                          let Q = N[G], ie = new _.Vector3(0, 0, 0);
                          for (let le = 0; le < Q.length; le++) {
                            let oe = Q[le];
                            ie.x += oe.x, ie.y += oe.y, ie.z += oe.z;
                          }
                          ie.divideScalar(Q.length), V.position = ie, V.frame = T;
                          let ge = c.addLabel(G, V, void 0, !0);
                          h.push(ge);
                        }
                    }
                };
                if (a) {
                  var w = this.getNumFrames();
                  let S = this.atoms;
                  for (let T = 0; T < w; T++)
                    this.frames[T] && (this.atoms = this.frames[T], M(this, T));
                  this.atoms = S;
                } else
                  M(this);
                return h;
              }
              //recurse over the current atoms to establish a depth first order
              setupDFS() {
                this.atomdfs = [];
                var f = this, c = new Int8Array(this.atoms.length);
                c.fill(0);
                for (var t = function(w, S, T) {
                  T.push([w, S]);
                  var R = f.atoms[w];
                  c[w] = 1;
                  for (var $ = 0; $ < R.bonds.length; $++) {
                    var P = R.bonds[$];
                    f.atoms[P] && !c[P] && t(P, w, T);
                  }
                }, a = 0; a < this.atoms.length; a++) {
                  var h = this.atoms[a];
                  if (h && !c[a]) {
                    var M = [];
                    t(a, -1, M), this.atomdfs.push(M);
                  }
                }
              }
              /**
              * 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(f, c) {
                this.frames = [];
                var t = this;
                return this.box && this.setupDFS(), f.startsWith("http") || (f = "http://" + f), (0, E.get)(f + "/traj/numframes/" + c, function(a) {
                  if (!isNaN(parseInt(a)))
                    return t.frames.push(t.atoms), t.frames.numFrames = a, t.frames.url = f, t.frames.path = c, t.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(f, c) {
                if (c = c || "", !f)
                  return [];
                if (/\.gz$/.test(c)) {
                  c = c.replace(/\.gz$/, "");
                  try {
                    f = r(f);
                  } catch ($) {
                    console.log($);
                  }
                }
                var t = { mdcrd: "", inpcrd: "", pdb: "", netcdf: "", array: "" };
                if (t.hasOwnProperty(c)) {
                  this.frames = [];
                  for (var a = this.atoms.length, h = n.parseCrd(f, c), M = 0; M < h.length; ) {
                    for (var w = [], S = 0; S < a; S++) {
                      var T = {};
                      for (var R in this.atoms[S])
                        T[R] = this.atoms[S][R];
                      w[S] = T, w[S].x = h[M++], w[S].y = h[M++], w[S].z = h[M++];
                    }
                    this.frames.push(w);
                  }
                  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(f) {
              }
              static parseCrd(f, c) {
                var t = [], a = 0;
                if (c == "pdb")
                  for (var h = f.indexOf(`
ATOM`); h != -1; ) {
                    for (; f.slice(h, h + 5) == `
ATOM` || f.slice(h, h + 7) == `
HETATM`; )
                      t[a++] = parseFloat(f.slice(h + 31, h + 39)), t[a++] = parseFloat(f.slice(h + 39, h + 47)), t[a++] = parseFloat(f.slice(h + 47, h + 55)), h = f.indexOf(`
`, h + 54), f.slice(h, h + 4) == `
TER` && (h = f.indexOf(`
`, h + 5));
                    h = f.indexOf(`
ATOM`, h);
                  }
                else if (c == "netcdf") {
                  var M = new L.NetCDFReader(f);
                  t = [].concat.apply([], M.getDataVariable("coordinates"));
                } else {
                  if (c == "array" || Array.isArray(f))
                    return f.flat(2);
                  {
                    let w = f.indexOf(`
`);
                    c == "inpcrd" && (w = f.indexOf(`
`, w + 1)), f = f.slice(w + 1), t = f.match(/\S+/g).map(parseFloat);
                  }
                }
                return t;
              }
              static parseMolData(f, c = "", t) {
                if (!f)
                  return [];
                if (/\.gz$/.test(c)) {
                  c = c.replace(/\.gz$/, "");
                  try {
                    f = r(f);
                  } catch (M) {
                    console.log(M);
                  }
                }
                typeof A.Parsers[c] > "u" && (c = c.split(".").pop(), typeof A.Parsers[c] > "u" && (console.log("Unknown format: " + c), f instanceof Uint8Array ? c = "mmtf" : f.match(/^@<TRIPOS>MOLECULE/gm) ? c = "mol2" : f.match(/^data_/gm) && f.match(/^loop_/gm) ? c = "cif" : f.match(/^HETATM/gm) || f.match(/^ATOM/gm) ? c = "pdb" : f.match(/ITEM: TIMESTEP/gm) ? c = "lammpstrj" : f.match(/^.*\n.*\n.\s*(\d+)\s+(\d+)/gm) ? c = "sdf" : f.match(/^%VERSION\s+VERSION_STAMP/gm) ? c = "prmtop" : c = "xyz", console.log("Best guess: " + c)));
                var a = A.Parsers[c], h = a(f, t);
                return h;
              }
            }
            n.defaultAtomStyle = {
              line: {}
            }, n.defaultlineWidth = 1, n.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
            }, n.ignoredKeys = /* @__PURE__ */ new Set(["props", "invert", "model", "frame", "byres", "expand", "within", "and", "or", "not"]);
          }
        ),
        /***/
        "./src/GLShape.ts": (
          /*!************************!*\
            !*** ./src/GLShape.ts ***!
            \************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              GLShape: () => (
                /* binding */
                L
              ),
              /* harmony export */
              splitMesh: () => (
                /* binding */
                C
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), _ = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), x = e(
              /*! ./colors */
              "./src/colors.ts"
            ), o = e(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), g = e(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), E = e(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), u = e(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), A = e(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            class L {
              static finalizeGeo(r) {
                var n = r.updateGeoGroup(0);
                n.vertices > 0 && n.truncateArrayBuffers(!0, !0);
              }
              /*
               *
               * @param {Geometry}
               *            geo
               * @param {Color | colorlike} color
               */
              static updateColor(r, n) {
                n = n || x.CC.color(n), r.colorsNeedUpdate = !0;
                var b, f, c;
                n.constructor !== Array && (b = n.r, f = n.g, c = n.b);
                for (let t in r.geometryGroups) {
                  let a = r.geometryGroups[t], h = a.colorArray;
                  for (let M = 0, w = a.vertices; M < w; ++M) {
                    if (n.constructor === Array) {
                      let S = n[M];
                      b = S.r, f = S.g, c = S.b;
                    }
                    h[M * 3] = b, h[M * 3 + 1] = f, h[M * 3 + 2] = c;
                  }
                }
              }
              /*
               * @param {GLShape}
               *            shape
               * @param {geometryGroup}
               *            geoGroup
               * @param {ArrowSpec}
               *            spec
               */
              static drawArrow(r, n, b) {
                var f = b.start, c = b.end, t = b.radius, a = b.radiusRatio, h = b.mid, M = b.midpos;
                if (!(f && c))
                  return;
                var w = n.updateGeoGroup(51), S = new _.Vector3(c.x, c.y, c.z).sub(f);
                if (M) {
                  let ae = S.length();
                  M > 0 ? h = M / ae : h = (ae + M) / ae;
                }
                S.multiplyScalar(h);
                var T = new _.Vector3(f.x, f.y, f.z).add(S), R = S.clone().negate();
                let $ = new _.Vector3(f.x, f.y, f.z);
                r.intersectionShape.cylinder.push(new p.Cylinder($, T.clone(), t)), r.intersectionShape.sphere.push(new p.Sphere($, t));
                var P = [];
                P[0] = S.clone(), Math.abs(P[0].x) > 1e-4 ? P[0].y += 1 : P[0].x += 1, P[0].cross(S), P[0].normalize(), P[4] = P[0].clone(), P[4].crossVectors(P[0], S), P[4].normalize(), P[8] = P[0].clone().negate(), P[12] = P[4].clone().negate(), P[2] = P[0].clone().add(P[4]).normalize(), P[6] = P[4].clone().add(P[8]).normalize(), P[10] = P[8].clone().add(P[12]).normalize(), P[14] = P[12].clone().add(P[0]).normalize(), P[1] = P[0].clone().add(P[2]).normalize(), P[3] = P[2].clone().add(P[4]).normalize(), P[5] = P[4].clone().add(P[6]).normalize(), P[7] = P[6].clone().add(P[8]).normalize(), P[9] = P[8].clone().add(P[10]).normalize(), P[11] = P[10].clone().add(P[12]).normalize(), P[13] = P[12].clone().add(P[14]).normalize(), P[15] = P[14].clone().add(P[0]).normalize();
                var B = w.vertices, F = w.vertexArray, U = w.faceArray, z = w.normalArray, W = w.lineArray, V, N, k;
                for (N = 0, k = P.length; N < k; ++N) {
                  V = 3 * (B + 3 * N);
                  var G = P[N].clone().multiplyScalar(t).add(f), Q = P[N].clone().multiplyScalar(t).add(T), ie = P[N].clone().multiplyScalar(t * a).add(T);
                  if (F[V] = G.x, F[V + 1] = G.y, F[V + 2] = G.z, F[V + 3] = Q.x, F[V + 4] = Q.y, F[V + 5] = Q.z, F[V + 6] = ie.x, F[V + 7] = ie.y, F[V + 8] = ie.z, N > 0) {
                    var ge = F[V - 3], le = F[V - 2], oe = F[V - 1], he = new _.Vector3(ge, le, oe), se = new _.Vector3(c.x, c.y, c.z), xe = T.clone(), ye = new _.Vector3(ie.x, ie.y, ie.z);
                    r.intersectionShape.triangle.push(new p.Triangle(ye, se, he)), r.intersectionShape.triangle.push(new p.Triangle(he.clone(), xe, ye.clone()));
                  }
                }
                w.vertices += 48, V = w.vertices * 3, F[V] = f.x, F[V + 1] = f.y, F[V + 2] = f.z, F[V + 3] = T.x, F[V + 4] = T.y, F[V + 5] = T.z, F[V + 6] = c.x, F[V + 7] = c.y, F[V + 8] = c.z, w.vertices += 3;
                var Pe, de, pe, re, Se, ke, $e, ze, Re, Fe, Ie, We, Ue, Be, Ne, H, K, q, fe, _e = w.vertices - 3, Me = w.vertices - 2, Ae = w.vertices - 1, Z = _e * 3, ue = Me * 3, we = Ae * 3;
                for (N = 0, k = P.length - 1; N < k; ++N) {
                  var Te = B + 3 * N;
                  V = Te * 3, de = w.faceidx, pe = w.lineidx, re = Te, Fe = re * 3, Se = Te + 1, Ie = Se * 3, ke = Te + 2, We = ke * 3, $e = Te + 4, Ue = $e * 3, ze = Te + 5, Be = ze * 3, Re = Te + 3, Ne = Re * 3, H = K = P[N], q = fe = P[N + 1], z[Fe] = H.x, z[Ie] = K.x, z[Ne] = fe.x, z[Fe + 1] = H.y, z[Ie + 1] = K.y, z[Ne + 1] = fe.y, z[Fe + 2] = H.z, z[Ie + 2] = K.z, z[Ne + 2] = fe.z, z[Ie] = K.x, z[Ue] = q.x, z[Ne] = fe.x, z[Ie + 1] = K.y, z[Ue + 1] = q.y, z[Ne + 1] = fe.y, z[Ie + 2] = K.z, z[Ue + 2] = q.z, z[Ne + 2] = fe.z, z[We] = K.x, z[Be] = q.x, z[We + 1] = K.y, z[Be + 1] = q.y, z[We + 2] = K.z, z[Be + 2] = q.z, U[de] = re, U[de + 1] = Se, U[de + 2] = Re, U[de + 3] = Se, U[de + 4] = $e, U[de + 5] = Re, U[de + 6] = re, U[de + 7] = Re, U[de + 8] = _e, U[de + 9] = ke, U[de + 10] = Me, U[de + 11] = ze, U[de + 12] = ke, U[de + 13] = Ae, U[de + 14] = ze, W[pe] = re, W[pe + 1] = Se, W[pe + 2] = re, W[pe + 3] = Re, W[pe + 4] = $e, W[pe + 5] = Re, W[pe + 6] = re, W[pe + 7] = Re, W[pe + 8] = ke, W[pe + 9] = Se, W[pe + 10] = ke, W[pe + 11] = ze, W[pe + 12] = $e, W[pe + 13] = ze, W[pe + 14] = ke, W[pe + 15] = Ae, W[pe + 16] = ke, W[pe + 17] = ze, W[pe + 18] = Ae, W[pe + 19] = ze, w.faceidx += 15, w.lineidx += 20;
                }
                Pe = [
                  B + 45,
                  B + 46,
                  B + 1,
                  B,
                  B + 47,
                  B + 2
                ], de = w.faceidx, pe = w.lineidx, re = Pe[0], Fe = re * 3, Se = Pe[1], Ie = Se * 3, ke = Pe[4], We = ke * 3, $e = Pe[2], Ue = $e * 3, ze = Pe[5], Be = ze * 3, Re = Pe[3], Ne = Re * 3, H = K = P[15], q = fe = P[0], z[Fe] = H.x, z[Ie] = K.x, z[Ne] = fe.x, z[Fe + 1] = H.y, z[Ie + 1] = K.y, z[Ne + 1] = fe.y, z[Fe + 2] = H.z, z[Ie + 2] = K.z, z[Ne + 2] = fe.z, z[Ie] = K.x, z[Ue] = q.x, z[Ne] = fe.x, z[Ie + 1] = K.y, z[Ue + 1] = q.y, z[Ne + 1] = fe.y, z[Ie + 2] = K.z, z[Ue + 2] = q.z, z[Ne + 2] = fe.z, z[We] = K.x, z[Be] = q.x, z[We + 1] = K.y, z[Be + 1] = q.y, z[We + 2] = K.z, z[Be + 2] = q.z, S.normalize(), R.normalize(), z[Z] = R.x, z[ue] = z[we] = S.x, z[Z + 1] = R.y, z[ue + 1] = z[we + 1] = S.y, z[Z + 2] = R.z, z[ue + 2] = z[we + 2] = S.z, U[de] = re, U[de + 1] = Se, U[de + 2] = Re, U[de + 3] = Se, U[de + 4] = $e, U[de + 5] = Re, U[de + 6] = re, U[de + 7] = Re, U[de + 8] = _e, U[de + 9] = ke, U[de + 10] = Me, U[de + 11] = ze, U[de + 12] = ke, U[de + 13] = Ae, U[de + 14] = ze, W[pe] = re, W[pe + 1] = Se, W[pe + 2] = re, W[pe + 3] = Re, W[pe + 4] = $e, W[pe + 5] = Re, W[pe + 6] = re, W[pe + 7] = Re, W[pe + 8] = ke, W[pe + 9] = Se, W[pe + 10] = ke, W[pe + 11] = ze, W[pe + 12] = $e, W[pe + 13] = ze, W[pe + 14] = ke, W[pe + 15] = Ae, W[pe + 16] = ke, W[pe + 17] = ze, W[pe + 18] = Ae, W[pe + 19] = ze, 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(r, n, b, f) {
                r.center.set(0, 0, 0);
                let c = 1 / 0, t = 1 / 0, a = 1 / 0, h = -1 / 0, M = -1 / 0, w = -1 / 0;
                r.box && (c = r.box.min.x, h = r.box.max.x, t = r.box.min.y, M = r.box.max.y, a = r.box.min.z, w = r.box.max.z);
                for (let $ = 0, P = f; $ < P; $++) {
                  var S = b[$ * 3], T = b[$ * 3 + 1], R = b[$ * 3 + 2];
                  S < c && (c = S), T < t && (t = T), R < a && (a = R), S > h && (h = S), T > M && (M = T), R > w && (w = R);
                }
                r.center.set((h + c) / 2, (M + t) / 2, (w + a) / 2), r.radius = r.center.distanceTo({ x: h, y: M, z: w }), r.box = { min: { x: c, y: t, z: a }, max: { x: h, y: M, z: w } };
              }
              //helper function for adding an appropriately sized mesh
              static addCustomGeo(r, n, b, f, c) {
                var t = n.addGeoGroup(), a = b.vertexArr, h = b.normalArr, M = b.faceArr;
                t.vertices = a.length, t.faceidx = M.length;
                var w, S, T, R, $, P, B, F, U, z = t.vertexArray, W = t.colorArray;
                for (f.constructor !== Array && (F = f.r, U = f.g, R = f.b), P = 0, B = t.vertices; P < B; ++P)
                  w = P * 3, S = a[P], z[w] = S.x, z[w + 1] = S.y, z[w + 2] = S.z, f.constructor === Array && ($ = f[P], F = $.r, U = $.g, R = $.b), W[w] = F, W[w + 1] = U, W[w + 2] = R;
                if (c)
                  for (P = 0, B = t.faceidx / 3; P < B; ++P) {
                    w = P * 3, T = M[w], R = M[w + 1], $ = M[w + 2];
                    var V = new _.Vector3(), N = new _.Vector3(), k = new _.Vector3();
                    r.intersectionShape.triangle.push(new p.Triangle(V.copy(a[T]), N.copy(a[R]), k.copy(a[$])));
                  }
                if (c) {
                  var G = new _.Vector3(0, 0, 0), Q = 0;
                  for (let le = 0; le < n.geometryGroups.length; le++)
                    G.add(n.geometryGroups[le].getCentroid()), Q++;
                  G.divideScalar(Q), L.updateBoundingFromPoints(r.boundingSphere, { centroid: G }, z, t.vertices);
                }
                if (t.faceArray = new Uint16Array(M), t.truncateArrayBuffers(!0, !0), h.length < t.vertices)
                  t.setNormals();
                else {
                  var ie = t.normalArray = new Float32Array(t.vertices * 3), ge;
                  for (P = 0, B = t.vertices; P < B; ++P)
                    w = P * 3, ge = h[P], ie[w] = ge.x, ie[w + 1] = ge.y, ie[w + 2] = ge.z;
                }
                t.setLineIndices(), t.lineidx = t.lineArray.length;
              }
              /*
               *
               * @param {$3Dmol.GLShape}
               *            shape
               * @param {ShapeSpec}
               *            stylespec
               * @returns {undefined}
               */
              static updateFromStyle(r, n) {
                typeof n.color < "u" ? (r.color = n.color || new x.Color(), n.color instanceof x.Color || (r.color = x.CC.color(n.color))) : r.color = x.CC.color(0), r.wireframe = !!n.wireframe, r.opacity = n.alpha ? (0, _.clamp)(n.alpha, 0, 1) : 1, typeof n.opacity < "u" && (r.opacity = (0, _.clamp)(n.opacity, 0, 1)), r.side = n.side !== void 0 ? n.side : l.DoubleSide, r.linewidth = typeof n.linewidth > "u" ? 1 : n.linewidth, r.clickable = !!n.clickable, r.callback = (0, A.makeFunction)(n.callback), r.hoverable = !!n.hoverable, r.hover_callback = (0, A.makeFunction)(n.hover_callback), r.unhover_callback = (0, A.makeFunction)(n.unhover_callback), r.hidden = n.hidden, r.frame = n.frame;
              }
              /**
               * Custom renderable shape
               *
               * @constructor
               *
               * @param {ShapeSpec} stylespec
               */
              constructor(r) {
                this.color = 16777215, this.hidden = !1, this.wireframe = !1, this.opacity = 1, this.linewidth = 1, this.clickable = !1, this.hoverable = !1, this.side = l.DoubleSide, this.stylespec = r || {}, this.boundingSphere = new p.Sphere(), this.intersectionShape = {
                  sphere: [],
                  cylinder: [],
                  line: [],
                  triangle: []
                }, L.updateFromStyle(this, this.stylespec), this.components = [], this.shapeObj = null, this.renderedShapeObj = null, this.geo = new l.Geometry(!0), this.linegeo = new l.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(r) {
                for (var n in r)
                  this.stylespec[n] = r[n];
                if (L.updateFromStyle(this, this.stylespec), r.voldata && r.volscheme) {
                  (0, A.adjustVolumeStyle)(r);
                  const b = r.volscheme, f = r.voldata, c = x.CC, t = b.range() || [-1, 1];
                  this.geo.setColors(function(a, h, M) {
                    let w = f.getVal(a, h, M);
                    return c.color(b.valueToHex(w, t));
                  }), delete this.color;
                }
              }
              /**
               * Creates a custom shape from supplied vertex and face arrays
               * @param {CustomShapeSpec} customSpec
               */
              addCustom(r) {
                r.vertexArr = r.vertexArr || [], r.faceArr = r.faceArr || [], r.normalArr = r.normalArr || [], L.drawCustom(this, this.geo, r);
              }
              /**
               * 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(r) {
                r.center || (r.center = new _.Vector3(0, 0, 0)), r.radius = r.radius ? (0, _.clamp)(r.radius, 0, 1 / 0) : 1.5, r.color = x.CC.color(r.color), this.intersectionShape.sphere.push(new p.Sphere(r.center, r.radius)), E.GLDraw.drawSphere(this.geo, r.center, r.radius, r.color, r.quality), this.components.push({
                  centroid: new _.Vector3(r.center.x, r.center.y, r.center.z)
                });
                var n = this.geo.updateGeoGroup(0);
                L.updateBoundingFromPoints(this.boundingSphere, this.components, n.vertexArray, n.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(r) {
                var n = r.dimensions || { w: 1, h: 1, d: 1 }, b;
                typeof n.w == "number" ? b = { x: n.w, y: 0, z: 0 } : b = n.w;
                var f;
                typeof n.h == "number" ? f = { x: 0, y: n.h, z: 0 } : f = n.h;
                var c;
                typeof n.d == "number" ? c = { x: 0, y: 0, z: n.d } : c = n.d;
                var t = r.corner;
                t == null && (r.center !== void 0 ? t = {
                  x: r.center.x - 0.5 * (b.x + f.x + c.x),
                  y: r.center.y - 0.5 * (b.y + f.y + c.y),
                  z: r.center.z - 0.5 * (b.z + f.z + c.z)
                } : t = { x: 0, y: 0, z: 0 });
                var a = [
                  { x: t.x, y: t.y, z: t.z },
                  { x: t.x + b.x, y: t.y + b.y, z: t.z + b.z },
                  { x: t.x + f.x, y: t.y + f.y, z: t.z + f.z },
                  { x: t.x + b.x + f.x, y: t.y + b.y + f.y, z: t.z + b.z + f.z },
                  { x: t.x + c.x, y: t.y + c.y, z: t.z + c.z },
                  { x: t.x + b.x + c.x, y: t.y + b.y + c.y, z: t.z + b.z + c.z },
                  { x: t.x + f.x + c.x, y: t.y + f.y + c.y, z: t.z + f.z + c.z },
                  { x: t.x + b.x + f.x + c.x, y: t.y + b.y + f.y + c.y, z: t.z + b.z + f.z + c.z }
                ], h = [], M = [];
                h.splice(h.length, 0, a[0], a[1], a[2], a[3]), M.splice(M.length, 0, 0, 2, 1, 1, 2, 3);
                var w = 4;
                h.splice(h.length, 0, a[2], a[3], a[6], a[7]), M.splice(M.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, h.splice(h.length, 0, a[4], a[5], a[0], a[1]), M.splice(M.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, h.splice(h.length, 0, a[6], a[7], a[4], a[5]), M.splice(M.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, h.splice(h.length, 0, a[3], a[1], a[7], a[5]), M.splice(M.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4, h.splice(h.length, 0, a[2], a[6], a[0], a[4]), M.splice(M.length, 0, w + 0, w + 2, w + 1, w + 1, w + 2, w + 3), w += 4;
                var S = (0, A.extend)({}, r);
                S.vertexArr = h, S.faceArr = M, S.normalArr = [], L.drawCustom(this, this.geo, S);
                var T = new _.Vector3();
                this.components.push({
                  centroid: T.addVectors(a[0], a[7]).multiplyScalar(0.5)
                });
                var R = this.geo.updateGeoGroup(0);
                L.updateBoundingFromPoints(this.boundingSphere, this.components, R.vertexArray, R.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(r) {
                var n, b;
                r.start ? n = new _.Vector3(r.start.x || 0, r.start.y || 0, r.start.z || 0) : n = new _.Vector3(0, 0, 0), r.end ? (b = new _.Vector3(r.end.x, r.end.y || 0, r.end.z || 0), typeof b.x > "u" && (b.x = 3)) : b = new _.Vector3(0, 0, 0);
                var f = r.radius || 0.1, c = x.CC.color(r.color);
                this.intersectionShape.cylinder.push(new p.Cylinder(n, b, f)), E.GLDraw.drawCylinder(this.geo, n, b, f, c, r.fromCap, r.toCap);
                var t = new _.Vector3();
                this.components.push({
                  centroid: t.addVectors(n, b).multiplyScalar(0.5)
                });
                var a = this.geo.updateGeoGroup(0);
                L.updateBoundingFromPoints(this.boundingSphere, this.components, a.vertexArray, a.vertices);
              }
              /**
               * Creates a dashed cylinder shape
               * @param {CylinderSpec} cylinderSpec
               */
              addDashedCylinder(r) {
                r.dashLength = r.dashLength || 0.25, r.gapLength = r.gapLength || 0.25;
                var n;
                r.start ? n = new _.Vector3(r.start.x || 0, r.start.y || 0, r.start.z || 0) : n = new _.Vector3(0, 0, 0);
                var b;
                r.end ? (b = new _.Vector3(r.end.x, r.end.y || 0, r.end.z || 0), typeof b.x > "u" && (b.x = 3)) : b = new _.Vector3(3, 0, 0);
                for (var f = r.radius || 0.1, c = x.CC.color(r.color), t = Math.sqrt(Math.pow(n.x - b.x, 2) + Math.pow(n.y - b.y, 2) + Math.pow(n.z - b.z, 2)), a = t / (r.gapLength + r.dashLength), h = new _.Vector3(r.start.x || 0, r.start.y || 0, r.start.z || 0), M = new _.Vector3(r.end.x, r.end.y || 0, r.end.z || 0), w = new _.Vector3((b.x - n.x) / (t / r.gapLength), (b.y - n.y) / (t / r.gapLength), (b.z - n.z) / (t / r.gapLength)), S = new _.Vector3((b.x - n.x) / (t / r.dashLength), (b.y - n.y) / (t / r.dashLength), (b.z - n.z) / (t / r.dashLength)), T = 0; T < a; T++)
                  M = new _.Vector3(h.x + S.x, h.y + S.y, h.z + S.z), this.intersectionShape.cylinder.push(new p.Cylinder(h, M, f)), E.GLDraw.drawCylinder(this.geo, h, M, f, c, r.fromCap, r.toCap), h = new _.Vector3(M.x + w.x, M.y + w.y, M.z + w.z);
                var R = new _.Vector3();
                this.components.push({
                  centroid: R.addVectors(n, b).multiplyScalar(0.5)
                });
                var $ = this.geo.updateGeoGroup(0);
                L.updateBoundingFromPoints(this.boundingSphere, this.components, $.vertexArray, $.vertices);
              }
              /**
               * Creates a curved shape
               * @param {CurveSpec} curveSpec
               */
              addCurve(r) {
                r.points = r.points || [], r.smooth = r.smooth || 10, typeof r.fromCap > "u" && (r.fromCap = 2), typeof r.toCap > "u" && (r.toCap = 2);
                var n = (0, u.subdivide_spline)(r.points, r.smooth);
                if (n.length < 3) {
                  console.log("Too few points in addCurve");
                  return;
                }
                var b = r.radius || 0.1, f = x.CC.color(r.color), c = 0, t = n.length - 1, a = n[0].distanceTo(n[1]), h = Math.ceil(2 * b / a);
                if (r.toArrow) {
                  t -= h;
                  let T = {
                    start: n[t],
                    end: n[n.length - 1],
                    radius: b,
                    color: f,
                    mid: 1e-4
                  };
                  this.addArrow(T);
                }
                if (r.fromArrow) {
                  c += h;
                  let T = {
                    start: n[c],
                    end: n[0],
                    radius: b,
                    color: f,
                    mid: 1e-4
                  };
                  this.addArrow(T);
                }
                for (var M = Math.ceil(n.length / 2), w = { radius: b, color: f, fromCap: 2, toCap: 2 }, S = c; S < t; S++)
                  w.start = n[S], w.end = n[S + 1], w.fromCap = 2, w.toCap = 2, S < M ? (w.fromCap = 2, w.toCap = 0) : S > M ? (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(r) {
                var n, b;
                r.start ? n = new _.Vector3(r.start.x || 0, r.start.y || 0, r.start.z || 0) : n = new _.Vector3(0, 0, 0), r.end ? (b = new _.Vector3(r.end.x, r.end.y || 0, r.end.z || 0), typeof b.x > "u" && (b.x = 3)) : b = new _.Vector3(3, 0, 0);
                var f = this.geo.updateGeoGroup(2), c = f.vertices, t = c * 3, a = f.vertexArray;
                a[t] = n.x, a[t + 1] = n.y, a[t + 2] = n.z, a[t + 3] = b.x, a[t + 4] = b.y, a[t + 5] = b.z, f.vertices += 2;
                var h = f.lineArray, M = f.lineidx;
                h[M] = c, h[M + 1] = c + 1, f.lineidx += 2;
                var w = new _.Vector3();
                this.components.push({
                  centroid: w.addVectors(n, b).multiplyScalar(0.5)
                }), f = this.geo.updateGeoGroup(0), L.updateBoundingFromPoints(this.boundingSphere, this.components, f.vertexArray, f.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(r) {
                if (r.start ? r.start = new _.Vector3(r.start.x || 0, r.start.y || 0, r.start.z || 0) : r.start = new _.Vector3(0, 0, 0), r.dir instanceof _.Vector3 && typeof r.length == "number") {
                  var n = r.dir.clone().multiplyScalar(r.length).add(r.start);
                  r.end = n;
                } else
                  r.end ? (r.end = new _.Vector3(r.end.x, r.end.y || 0, r.end.z || 0), typeof r.end.x > "u" && (r.end.x = 3)) : r.end = new _.Vector3(3, 0, 0);
                r.radius = r.radius || 0.1, r.radiusRatio = r.radiusRatio || 1.618034, r.mid = 0 < r.mid && r.mid < 1 ? r.mid : 0.618034, L.drawArrow(this, this.geo, r);
                var b = new _.Vector3();
                this.components.push({
                  centroid: b.addVectors(r.start, r.end).multiplyScalar(0.5)
                });
                var f = this.geo.updateGeoGroup(0);
                L.updateBoundingFromPoints(this.boundingSphere, this.components, f.vertexArray, f.vertices);
              }
              static distance_from(r, n) {
                return Math.sqrt(Math.pow(r.x - n.x, 2) + Math.pow(r.y - n.y, 2) + Math.pow(r.z - n.z, 2));
              }
              static inSelectedRegion(r, n, b) {
                for (var f = 0; f < n.length; f++)
                  if (L.distance_from(n[f], r) <= b)
                    return !0;
                return !1;
              }
              /**
               * Create isosurface from voluemetric 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(r, n, b) {
                var f = n.isoval !== void 0 && typeof n.isoval == "number" ? n.isoval : 0, c = !!n.voxel, t = n.smoothness === void 0 ? 1 : n.smoothness, a = r.size.x, h = r.size.y, M = r.size.z, w = new Int16Array(a * h * M), S = r.data, T, R;
                for (T = 0, R = w.length; T < R; ++T)
                  w[T] = -1;
                var $ = new Uint8Array(a * h * M);
                for (T = 0, R = S.length; T < R; ++T) {
                  var P = f >= 0 ? S[T] - f : f - S[T];
                  P > 0 && ($[T] |= L.ISDONE);
                }
                var B = [], F = [];
                o.MarchingCube.march($, B, F, {
                  fulltable: !0,
                  voxel: c,
                  unitCube: r.unit,
                  origin: r.origin,
                  matrix: r.matrix,
                  nX: a,
                  nY: h,
                  nZ: M
                }), !c && t > 0 && o.MarchingCube.laplacianSmooth(t, B, F);
                var U = [], z = [], W = [];
                if (n.selectedRegion && n.coords === void 0 && (n.coords = n.selectedRegion), n.coords !== void 0) {
                  var V = n.coords[0].x, N = n.coords[0].y, k = n.coords[0].z, G = n.coords[0].x, Q = n.coords[0].y, ie = n.coords[0].z;
                  for (let de = 0; de < n.coords.length; de++)
                    n.coords[de].x > V ? V = n.coords[de].x : n.coords[de].x < G && (G = n.coords[de].x), n.coords[de].y > N ? N = n.coords[de].y : n.coords[de].y < Q && (Q = n.coords[de].y), n.coords[de].z > k ? k = n.coords[de].z : n.coords[de].z < ie && (ie = n.coords[de].z);
                  var ge = 2;
                  n.radius !== void 0 && (ge = n.radius), n.selectedOffset !== void 0 && (ge = n.selectedOffset), n.seldist !== void 0 && (ge = n.seldist), G -= ge, V += ge, Q -= ge, N += ge, ie -= ge, k += ge;
                  for (let de = 0; de < B.length; de++)
                    B[de].x > G && B[de].x < V && B[de].y > Q && B[de].y < N && B[de].z > ie && B[de].z < k && L.inSelectedRegion(B[de], n.coords, ge) ? (U.push(z.length), z.push(B[de])) : U.push(-1);
                  for (let de = 0; de + 2 < F.length; de += 3)
                    U[F[de]] !== -1 && U[F[de + 1]] !== -1 && U[F[de + 2]] !== -1 && (W.push(F[de] - (F[de] - U[F[de]])), W.push(F[de + 1] - (F[de + 1] - U[F[de + 1]])), W.push(F[de + 2] - (F[de + 2] - U[F[de + 2]])));
                  B = z, F = W;
                }
                L.drawCustom(this, this.geo, {
                  vertexArr: B,
                  faceArr: F,
                  normalArr: [],
                  clickable: n.clickable,
                  hoverable: n.hoverable
                }), this.updateStyle(n);
                var le = new _.Vector3(r.origin.x, r.origin.y, r.origin.z), oe = new _.Vector3(r.size.x * r.unit.x, r.size.y * r.unit.y, r.size.z * r.unit.z), he = new _.Vector3(0, 0, 0), se = le.clone(), xe = le.clone().add(oe);
                for (let de = 0; de < B.length; de++)
                  he.add(B[de]), se.max(B[de]), xe.min(B[de]);
                he.divideScalar(B.length);
                var ye = he.distanceTo(xe), Pe = he.distanceTo(se);
                this.boundingSphere.center = he, this.boundingSphere.radius = Math.max(ye, Pe), typeof b == "function" && b();
              }
              /**
               * @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(r, n, b) {
                r = new g.VolumeData(r, n), this.addIsosurface(r, b);
              }
              //for internal use, truncate buffers to save memory
              finalize() {
                return L.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.geo;
              }
              /*
               * Initialize webgl objects for rendering
               * @param {$3Dmol.Object3D} group
               *
               */
              globj(r) {
                if (this.renderedShapeObj && (r.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  L.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.wireframe && this.geo.setUpWireframe(), typeof this.color < "u" && L.updateColor(this.geo, this.color), this.shapeObj = new l.Object3D();
                  var n = null;
                  this.side == l.DoubleSide ? n = new l.MeshDoubleLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: l.Coloring.VertexColors
                  }) : n = new l.MeshLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: l.Coloring.VertexColors
                  });
                  var b = new l.Mesh(this.geo, n);
                  this.shapeObj.add(b);
                  var f = new l.LineBasicMaterial({
                    linewidth: this.linewidth,
                    color: this.color
                  }), c = new l.Line(this.linegeo, f, l.LineStyle.LinePieces);
                  this.shapeObj.add(c), this.renderedShapeObj = this.shapeObj.clone(), r.add(this.renderedShapeObj);
                }
              }
              removegl(r) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), r.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;
              }
            }
            L.ISDONE = 2, L.drawCustom = function(D, r, n) {
              var b = n, f = b.vertexArr, c = b.faceArr;
              (f.length === 0 || c.length === 0) && console.warn("Error adding custom shape component: No vertices and/or face indices supplied!");
              var t = n.color;
              typeof t > "u" && (t = D.color), t = x.CC.color(t);
              for (var a = C(b), h = 0, M = a.length; h < M; h++)
                L.addCustomGeo(D, r, a[h], a[h].colorArr ? a[h].colorArr : t, n.clickable);
            };
            function C(D) {
              var r = 64e3;
              if (D.vertexArr.length < r)
                return [D];
              var n = [{ vertexArr: [], normalArr: [], faceArr: [] }];
              D.colorArr && (n.colorArr = []);
              var b = [], f = [], c = 0, t = D.faceArr;
              for (let h = 0, M = t.length; h < M; h += 3) {
                let w = n[c];
                for (let S = 0; S < 3; S++) {
                  var a = t[h + S];
                  b[a] !== c && (b[a] = c, f[a] = w.vertexArr.length, w.vertexArr.push(D.vertexArr[a]), D.normalArr && D.normalArr[a] && w.normalArr.push(D.normalArr[a]), D.colorArr && D.colorArr[a] && w.colorArr.push(D.colorArr[a])), w.faceArr.push(f[a]);
                }
                w.vertexArr.length >= r && (n.push({ vertexArr: [], normalArr: [], faceArr: [] }), D.colorArr && (n.colorArr = []), c++);
              }
              return n;
            }
          }
        ),
        /***/
        "./src/GLViewer.ts": (
          /*!*************************!*\
            !*** ./src/GLViewer.ts ***!
            \*************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              GLViewer: () => (
                /* binding */
                r
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* binding */
                f
              ),
              /* harmony export */
              createViewer: () => (
                /* binding */
                n
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* binding */
                b
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), _ = e(
              /*! ./colors */
              "./src/colors.ts"
            ), x = e(
              /*! ./utilities */
              "./src/utilities.ts"
            ), o = e(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), g = e(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), E = e(
              /*! ./Label */
              "./src/Label.ts"
            ), u = e(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), A = e(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), L = e(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), C = e(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), D = e(
              /*! upng-js */
              "./node_modules/upng-js/UPNG.js"
            );
            class r {
              //reimplement jquery getwidth/height
              getRect() {
                let t = this.container, a = t.getBoundingClientRect();
                if (a.width == 0 && a.height == 0 && t.style.display === "none") {
                  let h = t.style.position, M = t.style.visibility;
                  t.style.display = "block", t.style.visibility = "hidden", t.style.position = "absolute", a = t.getBoundingClientRect(), t.style.display = "none", t.style.visibility = M, t.style.position = h;
                }
                return a;
              }
              getWidth() {
                return this.getRect().width;
              }
              getHeight() {
                return this.getRect().height;
              }
              setupRenderer() {
                this.renderer = new l.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
                  containerWidth: this.WIDTH || 1,
                  containerHeight: this.HEIGHT || 1
                }), 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 l.Scene(), this.scene.fog = new l.Fog(this.bgColor, 100, 200), this.modelGroup = new l.Object3D(), this.rotationGroup = new l.Object3D(), this.rotationGroup.useQuaternion = !0, this.rotationGroup.quaternion = new p.Quaternion(0, 0, 0, 1), this.rotationGroup.add(this.modelGroup), this.scene.add(this.rotationGroup);
                var t = new l.Light(16777215);
                t.position = new p.Vector3(0.2, 0.2, 1).normalize(), t.intensity = 1, this.scene.add(t);
              }
              initContainer(t) {
                this.container = t, 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.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 t = 0;
                for (let h in this.surfaces)
                  if (this.surfaces.hasOwnProperty(h)) {
                    var a = parseInt(h);
                    isNaN(a) || a > t && (t = a);
                  }
                return t + 1;
              }
              setSlabAndFog() {
                let t = this.camera.position.z - this.rotationGroup.position.z;
                t < 1 && (t = 1), this.camera.near = t + this.slabNear, this.camera.near < 1 && (this.camera.near = 1), this.camera.far = t + this.slabFar, this.camera.near + 1 > this.camera.far && (this.camera.far = this.camera.near + 1), this.camera.fov = this.fov, this.camera.right = t * 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(t) {
                if (this.renderer.setViewport(), !!this.scene && (this.setSlabAndFog(), this.renderer.render(this.scene, this.camera), this.viewChangeCallback && this.viewChangeCallback(this._viewer.getView()), !t && this.linkedViewers.length > 0))
                  for (var a = this._viewer.getView(), h = 0; h < this.linkedViewers.length; h++) {
                    var M = this.linkedViewers[h];
                    M.setView(a, !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.contextMenuEnabledAtoms.splice(0, this.contextMenuEnabledAtoms.length);
                for (let t = 0, a = this.models.length; t < a; t++) {
                  let h = this.models[t];
                  if (h) {
                    let M = h.selectedAtoms({
                      clickable: !0
                    }), w = h.selectedAtoms({
                      hoverable: !0
                    }), S = h.selectedAtoms({ contextMenuEnabled: !0 });
                    for (let T = 0; T < w.length; T++)
                      this.hoverables.push(w[T]);
                    for (let T = 0; T < M.length; T++)
                      this.clickables.push(M[T]);
                    for (let T = 0; T < S.length; T++)
                      this.contextMenuEnabledAtoms.push(S[T]);
                  }
                }
                for (let t = 0, a = this.shapes.length; t < a; t++) {
                  let h = this.shapes[t];
                  h && h.clickable && this.clickables.push(h), h && h.hoverable && this.hoverables.push(h);
                }
              }
              // Checks for selection intersects on mousedown
              handleClickSelection(t, a, h) {
                let M = this.targetedObjects(t, a, this.clickables);
                if (M.length) {
                  var w = M[0].clickable;
                  w.callback !== void 0 && (typeof w.callback != "function" && (w.callback = (0, x.makeFunction)(w.callback)), typeof w.callback == "function" && w.callback(w, this._viewer, h, this.container, M));
                }
              }
              //return offset of container
              canvasOffset() {
                let t = this.glDOM, a = t.getBoundingClientRect(), h = t.ownerDocument, M = h.documentElement, w = h.defaultView;
                return {
                  top: a.top + w.pageYOffset - M.clientTop,
                  left: a.left + w.pageXOffset - M.clientLeft
                };
              }
              //set current_hover to sel (which can be null), calling appropraite callbacks
              setHover(t, a, h) {
                this.current_hover != t && (this.current_hover && (typeof this.current_hover.unhover_callback != "function" && (this.current_hover.unhover_callback = (0, x.makeFunction)(this.current_hover.unhover_callback)), this.current_hover.unhover_callback(this.current_hover, this._viewer, a, this.container, h)), this.current_hover = t, t && t.hover_callback !== void 0 && (typeof t.hover_callback != "function" && (t.hover_callback = (0, x.makeFunction)(t.hover_callback)), typeof t.hover_callback == "function" && t.hover_callback(t, this._viewer, a, this.container, h)));
              }
              //checks for selection intersects on hover
              handleHoverSelection(t, a, h) {
                if (this.hoverables.length == 0)
                  return;
                let M = this.targetedObjects(t, a, this.hoverables);
                if (M.length) {
                  var w = M[0].clickable;
                  this.setHover(w, h, M), this.current_hover = w;
                } 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(t, a) {
                let h = this.targetedObjects(t, a, this.hoverables);
                (h.length == 0 || h[0] === void 0) && this.setHover(null), h[0] !== void 0 && h[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(t, { allowTolerance: a = t.targetTouches, tolerance: h = 5 } = {}) {
                const M = this.getX(t), w = this.getY(t);
                if (a) {
                  const S = Math.abs(M - this.mouseStartX), T = Math.abs(w - this.mouseStartY);
                  return S <= h && T <= h;
                } else
                  return M === this.mouseStartX && w === this.mouseStartY;
              }
              calcTouchDistance(t) {
                var a = t.targetTouches[0].pageX - t.targetTouches[1].pageX, h = t.targetTouches[0].pageY - t.targetTouches[1].pageY;
                return Math.hypot(a, h);
              }
              //check targetTouches as well
              getX(t) {
                var a = t.pageX;
                return a == null && (a = t.pageX), t.targetTouches && t.targetTouches[0] ? a = t.targetTouches[0].pageX : t.changedTouches && t.changedTouches[0] && (a = t.changedTouches[0].pageX), a;
              }
              getY(t) {
                var a = t.pageY;
                return a == null && (a = t.pageY), t.targetTouches && t.targetTouches[0] ? a = t.targetTouches[0].pageY : t.changedTouches && t.changedTouches[0] && (a = t.changedTouches[0].pageY), a;
              }
              //for grid viewers, return true if point is in this viewer
              isInViewer(t, a) {
                if (this.viewers != null) {
                  var h = this.WIDTH / this.cols, M = this.HEIGHT / this.rows, w = this.canvasOffset(), S = t - w.left, T = a - w.top, R = this.rows - Math.floor(T / M) - 1, $ = Math.floor(S / h);
                  if (R != this.row || $ != 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(t) {
                if (this.config.lowerZoomLimit && this.config.lowerZoomLimit > 0) {
                  let a = this.CAMERA_Z - this.config.lowerZoomLimit;
                  t > a && (t = a);
                }
                if (this.config.upperZoomLimit && this.config.upperZoomLimit > 0) {
                  let a = this.CAMERA_Z - this.config.upperZoomLimit;
                  t < a && (t = a);
                }
                return t > this.CAMERA_Z - 1 && (t = this.CAMERA_Z - 1), t;
              }
              //interpolate between two normalized quaternions (t between 0 and 1)
              //https://en.wikipedia.org/wiki/Slerp
              static slerp(t, a, h) {
                if (h == 1)
                  return a.clone();
                if (h == 0)
                  return t.clone();
                let M = t.x * a.x + t.y * a.y + t.z * a.z + t.w * a.w;
                if (M > 0.9995) {
                  let B = new p.Quaternion(t.x + h * (a.x - t.x), t.y + h * (a.y - t.y), t.z + h * (a.z - t.z), t.w + h * (a.w - t.w));
                  return B.normalize(), B;
                }
                M < 0 && (a = a.clone().multiplyScalar(-1), M = -M), M > 1 ? M = 1 : M < -1 && (M = -1);
                var w = Math.acos(M), S = w * h, T = a.clone();
                T.sub(t.clone().multiplyScalar(M)), T.normalize();
                var R = Math.cos(S), $ = Math.sin(S), P = new p.Quaternion(t.x * R + T.x * $, t.y * R + T.y * $, t.z * R + T.z * $, t.w * R + T.w * $);
                return P.normalize(), P;
              }
              /* @param {Object} element HTML element within which to create viewer
               * @param {ViewerSpec} config Object containing optional configuration for the viewer
               */
              constructor(t, a = {}) {
                this.nomouse = !1, this.glDOM = null, this.models = [], this.surfaces = {}, this.shapes = [], this.labels = [], this.clickables = [], this.hoverables = [], this.contextMenuEnabledAtoms = [], this.current_hover = null, this.hoverDuration = 500, 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 p.Quaternion(0, 0, 0, 1), this.dq = new p.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 = a, this.callback = this.config.callback, this.defaultcolors = this.config.defaultcolors, this.defaultcolors || (this.defaultcolors = _.elementColors.defaultColors), this.nomouse = this.config.nomouse, this.bgColor = 0, this.config.backgroundColor = this.config.backgroundColor || "#ffffff", typeof this.config.backgroundColor < "u" && (this.bgColor = _.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 = parseFloat(this.config.camerax)), this._viewer = this, this.container = t, 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 l.Camera(this.fov, this.ASPECT, this.NEAR, this.FAR, this.config.orthographic), this.camera.position = new p.Vector3(this.camerax, 0, this.CAMERA_Z), this.lookingAt = new p.Vector3(), this.camera.lookAt(this.lookingAt), this.raycaster = new l.Raycaster(new p.Vector3(0, 0, 0), new p.Vector3(0, 0, 0)), this.projector = new l.Projector(), this.initializeScene(), this.renderer.setClearColorHex(this.bgColor, this.config.backgroundAlpha), this.scene.fog.color = _.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));
                try {
                  typeof this.callback == "function" && this.callback(this);
                } catch (h) {
                  console.log("error with glviewer callback: " + h);
                }
              }
              /**
              * 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(t, a, h) {
                var M = {
                  x: t,
                  y: a,
                  z: -1
                };
                return Array.isArray(h) || (h = this.selectedAtoms(h)), h.length == 0 ? [] : (this.raycaster.setFromCamera(M, this.camera), this.raycaster.intersectObjects(this.modelGroup, h));
              }
              /** 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(t) {
                let a = !1;
                Array.isArray(t) || (t = [t], a = !0);
                let h = this.renderer.getXRatio(), M = this.renderer.getYRatio(), w = this.col, S = this.row, T = w * (this.WIDTH / h), R = (M - S - 1) * (this.HEIGHT / M), $ = [], P = this.canvasOffset();
                return t.forEach((B) => {
                  let F = new p.Vector3(B.x, B.y, B.z);
                  F.applyMatrix4(this.modelGroup.matrixWorld), this.projector.projectVector(F, this.camera);
                  let U = this.WIDTH / h * (F.x + 1) / 2 + P.left + T, z = -(this.HEIGHT / M) * (F.y - 1) / 2 + P.top + R;
                  $.push({ x: U, y: z });
                }), a && ($ = $[0]), $;
              }
              /**
               * 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(t, a, h) {
                var M = t / this.WIDTH, w = a / this.HEIGHT, S = h === void 0 ? this.rotationGroup.position.z : h, T = this.rotationGroup.quaternion, R = new p.Vector3(0, 0, S);
                return this.projector.projectVector(R, this.camera), R.x += M * 2, R.y -= w * 2, this.projector.unprojectVector(R, this.camera), R.z = 0, R.applyQuaternion(T), R;
              }
              /**
               * 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(t, a) {
                let h = this.canvasOffset(), M = new p.Vector3(a.x, a.y, a.z);
                M.applyMatrix4(this.modelGroup.matrixWorld);
                let w = M.clone();
                this.projector.projectVector(M, this.camera);
                let S = new p.Vector3((t.x - h.left) * 2 / this.WIDTH - 1, (t.y - h.top) * 2 / -this.HEIGHT + 1, M.z);
                return this.projector.unprojectVector(S, this.camera), S.distanceTo(w);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setViewChangeCallback(t) {
                (typeof t == "function" || t == null) && (this.viewChangeCallback = t);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setStateChangeCallback(t) {
                (typeof t == "function" || t == null) && (this.stateChangeCallback = t);
              }
              /**
               * Return configuration of viewer
               */
              getConfig() {
                return this.config;
              }
              /**
               * Set the configuration object.  Note that some setting may only
               * have an effect at viewer creation time.
               */
              setConfig(t) {
                this.config = t;
              }
              /**
               * Return object representing internal state of
               * the viewer appropriate for passing to setInternalState
               *
              */
              getInternalState() {
                var t = { models: [], surfaces: [], shapes: [], labels: [] };
                for (let a = 0; a < this.models.length; a++)
                  this.models[a] && (t.models[a] = this.models[a].getInternalState());
                return t;
              }
              /**
               * Overwrite internal state of the viewer with passed  object
               * which should come from getInternalState.
               *
              */
              setInternalState(t) {
                this.clear();
                var a = t.models;
                for (let h = 0; h < a.length; h++)
                  a[h] && (this.models[h] = new g.GLModel(h), this.models[h].setInternalState(a[h]));
                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(t, a) {
                typeof t < "u" && (this.config.lowerZoomLimit = t), a && (this.config.upperZoomLimit = a), 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(t) {
                t.fov !== void 0 && (this.fov = t.fov, this.camera.fov = this.fov), t.z !== void 0 && (this.CAMERA_Z = t.z, this.camera.z = this.CAMERA_Z), t.orthographic !== void 0 && (this.camera.ortho = t.orthographic);
              }
              _handleMouseDown(t) {
                if (t.preventDefault(), !this.scene)
                  return;
                var a = this.getX(t), h = this.getY(t);
                if (a === void 0)
                  return;
                this.isDragging = !0, this.mouseButton = t.which, this.mouseStartX = a, this.mouseStartY = h, this.touchHold = !0, this.touchDistanceStart = 0, t.targetTouches && t.targetTouches.length == 2 && (this.touchDistanceStart = this.calcTouchDistance(t)), 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 M = this;
                setTimeout(function() {
                  t.targetTouches && M.touchHold == !0 && (M.glDOM = M.renderer.domElement, M.glDOM.dispatchEvent(new Event("contextmenu")));
                }, 1e3);
              }
              _handleMouseUp(t) {
                if (this.touchHold = !1, this.isDragging && this.scene) {
                  var a = this.getX(t), h = this.getY(t);
                  if (this.closeEnoughForClick(t) && this.isInViewer(a, h)) {
                    let M = this.mouseXY(a, h);
                    this.handleClickSelection(M.x, M.y, t);
                  }
                }
                this.isDragging = !1;
              }
              _handleMouseScroll(t) {
                if (t.preventDefault(), !!this.scene) {
                  var a = this.getX(t), h = this.getY(t);
                  if (a !== void 0 && !(!this.control_all && !this.isInViewer(a, h))) {
                    var M = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, w = 1;
                    if (t.ctrlKey && (w = -1), t.detail)
                      this.rotationGroup.position.z += w * M * t.detail / 10;
                    else if (t.wheelDelta) {
                      let S = t.wheelDelta * 600 / (t.wheelDelta + 600);
                      this.rotationGroup.position.z -= w * M * S / 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(t) {
                let a = this;
                return t = t || 1, new Promise(function(h) {
                  let M = 0, w = a.viewChangeCallback, S = [], T = [], R = Date.now();
                  a.viewChangeCallback = function() {
                    T.push(Date.now() - R), R = Date.now(), S.push(new Promise(($) => {
                      a.getCanvas().toBlob(function(P) {
                        P.arrayBuffer().then($);
                      }, "image/png");
                    })), M += 1, M == t && (a.viewChangeCallback = w, Promise.all(S).then(($) => {
                      let P = [];
                      for (let V = 0; V < $.length; V++) {
                        let N = (0, D.decode)($[V]);
                        P.push((0, D.toRGBA8)(N)[0]);
                      }
                      let B = a.getCanvas().width, F = a.getCanvas().height, U = (0, D.encode)(P, B, F, 0, T), z = new Blob([U], { type: "image/png" }), W = new FileReader();
                      W.onload = function(V) {
                        h(V.target.result);
                      }, W.readAsDataURL(z);
                    }));
                  };
                });
              }
              /**
               * 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(t) {
                this.hoverDuration = t;
              }
              mouseXY(t, a) {
                let h = this.canvasOffset(), M = this.renderer.getXRatio(), w = this.renderer.getYRatio(), S = this.col, T = this.row, R = S * (this.WIDTH / M), $ = (w - T - 1) * (this.HEIGHT / w), P = (t - h.left - R) / (this.WIDTH / M) * 2 - 1, B = -((a - h.top - $) / (this.HEIGHT / w)) * 2 + 1;
                return { x: P, y: B };
              }
              _handleMouseMove(t) {
                clearTimeout(this.hoverTimeout), t.preventDefault();
                let a = this.getX(t), h = this.getY(t);
                if (a === void 0)
                  return;
                let M = this.renderer.getXRatio(), w = this.renderer.getYRatio(), S = this.mouseXY(a, h), T = this;
                this.current_hover !== null && this.handleHoverContinue(S.x, S.y);
                var R = 0;
                if (!(!this.control_all && !this.isInViewer(a, h)) && this.scene && (this.hoverables.length > 0 && (this.hoverTimeout = setTimeout(function() {
                  T.handleHoverSelection(S.x, S.y, t);
                }, this.hoverDuration)), !!this.isDragging)) {
                  var $ = (a - this.mouseStartX) / this.WIDTH, P = (h - this.mouseStartY) / this.HEIGHT;
                  if (this.touchDistanceStart != 0 && t.targetTouches && t.targetTouches.length == 2) {
                    var B = this.calcTouchDistance(t);
                    R = 2, P = (B - this.touchDistanceStart) * 2 / (this.WIDTH + this.HEIGHT);
                  } else
                    t.targetTouches && t.targetTouches.length == 3 && (R = 1);
                  $ *= M, P *= w;
                  var F = Math.hypot($, P), U;
                  if (R == 3 || this.mouseButton == 3 && t.ctrlKey)
                    this.slabNear = this.cslabNear + $ * 100, this.slabFar = this.cslabFar - P * 100;
                  else if (R == 2 || this.mouseButton == 3 || t.shiftKey)
                    U = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, U < 80 && (U = 80), this.rotationGroup.position.z = this.cz + P * U, this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z);
                  else if (R == 1 || this.mouseButton == 2 || t.ctrlKey) {
                    var z = this.screenOffsetToModel(M * (a - this.mouseStartX), w * (h - this.mouseStartY));
                    this.modelGroup.position.addVectors(this.currentModelPos, z);
                  } else if ((R === 0 || this.mouseButton == 1) && F !== 0) {
                    var W = Math.sin(F * Math.PI) / F;
                    this.dq.x = Math.cos(F * Math.PI), this.dq.y = 0, this.dq.z = W * $, this.dq.w = -W * P, this.rotationGroup.quaternion.set(1, 0, 0, 0), this.rotationGroup.quaternion.multiply(this.dq), this.rotationGroup.quaternion.multiply(this.cq);
                  }
                  this.show();
                }
              }
              _handleContextMenu(t) {
                t.preventDefault();
                var a = this.getX(t), h = this.getY(t);
                if (!(a != this.mouseStartX || h != this.mouseStartY)) {
                  var S = this.mouseStartX, T = this.mouseStartY, w = this.canvasOffset();
                  let R = this.mouseXY(S, T), $ = R.x, P = R.y, B = this.targetedObjects($, P, this.contextMenuEnabledAtoms);
                  var M = null;
                  B.length && (M = B[0].clickable);
                  var w = this.canvasOffset(), S = this.mouseStartX - w.left, T = this.mouseStartY - w.top;
                  this.userContextMenuHandler && this.userContextMenuHandler(M, S, T, B);
                }
              }
              /**
              	     * 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(t) {
                let a = (0, x.getElement)(t) || this.container;
                return this.initContainer(a), 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(0x000000);
              
              
              	     *
              	     */
              setBackgroundColor(t, a) {
                (typeof a > "u" || a < 0 || a > 1) && (a = 1);
                var h = _.CC.color(t);
                return this.scene.fog.color = h, this.bgColor = h.getHex(), this.renderer.setClearColorHex(h.getHex(), a), 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(t) {
                this.camera.ortho = t === "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(t) {
                if (t.style === "outline") {
                  var a = {};
                  t.color && (a.color = _.CC.color(t.color)), t.width && (a.width = t.width), this.renderer.enableOutline(a);
                } else
                  this.renderer.disableOutline();
                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(t) {
                return this.WIDTH = t || 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(t) {
                return this.HEIGHT = t || this.HEIGHT, this.updateSize(), this;
              }
              /**
               * Resize viewer according to containing HTML element's dimensions
               *
               */
              resize() {
                this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight();
                let t = !1;
                if (this.renderer.isLost() && this.WIDTH > 0 && this.HEIGHT > 0) {
                  let a = !1, h = this.container.querySelector("canvas");
                  h && h != this.renderer.getCanvas() ? this.config.canvas = h : (h.remove(), this.config && this.config.canvas != null && (delete this.config.canvas, a = !0)), this.setupRenderer(), this.initContainer(this.container), t = !0, a && (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(), t) {
                  let a = this.renderer.supportedExtensions();
                  if (a.regen = !0, this.viewers)
                    for (let h = 0, M = this.viewers.length; h < M; h++)
                      for (let w = 0, S = this.viewers[h].length; w < S; w++)
                        this.viewers[h][w].render(null, a);
                  this._viewer.render(null, a);
                } 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(t) {
                return t === void 0 ? this.models.length == 0 ? null : this.models[this.models.length - 1] : t instanceof g.GLModel ? t : t in this.models ? this.models[t] : 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(t, a = 1) {
                if (clearInterval(this.spinInterval), typeof t > "u" && (t = "y"), typeof t == "boolean")
                  if (t)
                    t = "y";
                  else
                    return;
                Array.isArray(t) && (t = { x: t[0], y: t[1], z: t[2] });
                var h = this;
                this.spinInterval = setInterval(function() {
                  !h.getCanvas().isConnected && h.renderer.isLost() && clearInterval(h.spinInterval), h.rotate(1 * a, t);
                }, 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(t, a, h, M, w, S) {
                var T = 20, R = Math.ceil(t / T);
                R < 1 && (R = 1), this.incAnim();
                var $ = {
                  mpos: this.modelGroup.position.clone(),
                  rz: this.rotationGroup.position.z,
                  rot: this.rotationGroup.quaternion.clone(),
                  cam: this.lookingAt.clone()
                };
                if (a) {
                  let F = new Array(R);
                  for (let V = 0; V < R; V++) {
                    let N = (V + 1) / R, k = { mpos: $.mpos, rz: $.rz, rot: $.rot };
                    k.mpos = h.clone().sub($.mpos).multiplyScalar(N).add($.mpos), k.rz = $.rz + N * (M - $.rz), k.rot = r.slerp($.rot, w, N), k.cam = S.clone().sub($.cam).multiplyScalar(N).add($.cam), F[V] = k;
                  }
                  let U = 0, z = this, W = function() {
                    var V = F[U];
                    U += 1, z.modelGroup.position = V.mpos, z.rotationGroup.position.z = V.rz, z.rotationGroup.quaternion = V.rot, z.camera.lookAt(V.cam), U < F.length ? setTimeout(W, T) : z.decAnim(), z.show();
                  };
                  setTimeout(W, T);
                } else {
                  var P = {};
                  let F = 1 / R;
                  if (h && (P.mpos = h.clone().sub($.mpos).multiplyScalar(F)), typeof M < "u" && M != null && (P.rz = F * (M - $.rz)), w) {
                    var B = r.slerp($.rot, w, F);
                    P.rot = $.rot.clone().inverse().multiply(B);
                  }
                  S && (P.cam = S.clone().sub($.cam).multiplyScalar(F));
                  let U = 0, z = this, W = function() {
                    U += 1, P.mpos && z.modelGroup.position.add(P.mpos), P.rz && (z.rotationGroup.position.z += P.rz), P.rot && z.rotationGroup.quaternion.multiply(P.rot), P.cam && (z.lookingAt.add(P.cam), z.camera.lookAt(z.lookingAt)), U < R ? setTimeout(W, T) : z.decAnim(), z.show();
                  };
                  setTimeout(W, T);
                }
              }
              /**
              	     * 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(t, a = "y", h = 0, M = !1) {
                if (a == "x" ? a = { x: 1, y: 0, z: 0 } : a == "y" ? a = { x: 0, y: 1, z: 0 } : a == "z" && (a = { x: 0, y: 0, z: 1 }), a == "vx" ? a = { vx: 1, vy: 0, vz: 0 } : a == "vy" ? a = { vx: 0, vy: 1, vz: 0 } : a == "vz" && (a = { vx: 0, vy: 0, vz: 1 }), typeof a.vx < "u") {
                  var w = new p.Vector3(a.vx, a.vy, a.vz);
                  w.applyQuaternion(this.rotationGroup.quaternion), a = { x: w.x, y: w.y, z: w.z };
                }
                var S = function(P) {
                  var B = Math.sin(P / 2), F = Math.cos(P / 2), U = 0, z = 0, W = 0;
                  return U = a.x * B, z = a.y * B, W = a.z * B, new p.Quaternion(U, z, W, F).normalize();
                }, T = Math.PI * t / 180, R = S(T);
                if (h) {
                  var $ = new p.Quaternion().copy(this.rotationGroup.quaternion).multiply(R);
                  this.animateMotion(h, M, this.modelGroup.position, this.rotationGroup.position.z, $, this.lookingAt);
                } else
                  this.rotationGroup.quaternion.multiply(R), this.show();
                return this;
              }
              surfacesFinished() {
                for (var t in this.surfaces)
                  if (!this.surfaces[t][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 t = this.modelGroup.position, a = this.rotationGroup.quaternion;
                return [
                  t.x,
                  t.y,
                  t.z,
                  this.rotationGroup.position.z,
                  a.x,
                  a.y,
                  a.z,
                  a.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(t, a) {
                return t === void 0 || !(t instanceof Array || t.length !== 8) ? this : !this.modelGroup || !this.rotationGroup ? this : (this.modelGroup.position.x = t[0], this.modelGroup.position.y = t[1], this.modelGroup.position.z = t[2], this.rotationGroup.position.z = t[3], this.rotationGroup.quaternion.x = t[4], this.rotationGroup.quaternion.y = t[5], this.rotationGroup.quaternion.z = t[6], this.rotationGroup.quaternion.w = t[7], typeof t[8] < "u" && (this.rotationGroup.position.x = t[8], this.rotationGroup.position.y = t[9]), this.show(a), this);
              }
              // apply styles, models, etc in viewer
              /**
               * Render current state of viewer, after
               * adding/removing models, applying styles, etc.
               *
               */
              render(t, a) {
                this.renderer.setViewport(), this.updateClickables();
                var h = this.getView();
                this.stateChangeCallback && this.stateChangeCallback(this.getInternalState());
                var M, w;
                for (a || (a = this.renderer.supportedExtensions()), M = 0; M < this.models.length; M++)
                  this.models[M] && this.models[M].globj(this.modelGroup, a);
                for (M = 0; M < this.shapes.length; M++)
                  this.shapes[M] && (typeof this.shapes[M].frame > "u" || this.viewer_frame < 0 || this.shapes[M].frame < 0 || this.shapes[M].frame == this.viewer_frame ? this.shapes[M].globj(this.modelGroup, a) : this.shapes[M].removegl(this.modelGroup));
                for (M = 0; M < this.labels.length; M++)
                  a.regen && (this.labels[M].dispose(), this.modelGroup.remove(this.labels[M].sprite), this.labels[M].setContext(), this.modelGroup.add(this.labels[M].sprite)), this.labels[M] && typeof this.labels[M].frame < "u" && this.labels[M].frame >= 0 && (this.modelGroup.remove(this.labels[M].sprite), (this.viewer_frame < 0 || this.labels[M].frame == this.viewer_frame) && this.modelGroup.add(this.labels[M].sprite));
                for (M in this.surfaces)
                  if (this.surfaces.hasOwnProperty(M)) {
                    var S = this.surfaces[M];
                    for (w = 0; w < S.length; w++)
                      if (S.hasOwnProperty(w)) {
                        var T = S[w].geo;
                        if (!S[w].finished || a.regen) {
                          T.verticesNeedUpdate = !0, T.elementsNeedUpdate = !0, T.normalsNeedUpdate = !0, T.colorsNeedUpdate = !0, T.buffersNeedUpdate = !0, T.boundingSphere = null, S[w].mat.needsUpdate = !0, S[w].done && (S[w].finished = !0), S[w].lastGL && this.modelGroup.remove(S[w].lastGL);
                          var R = null;
                          if (S[w].mat instanceof l.LineBasicMaterial ? R = new l.Line(T, S[w].mat) : R = new l.Mesh(T, S[w].mat), S[w].mat.transparent && S[w].mat.opacity == 0 ? R.visible = !1 : R.visible = !0, S[w].symmetries.length > 1 || S[w].symmetries.length == 1 && !S[w].symmetries[w].isIdentity()) {
                            var $, P = new l.Object3D();
                            for ($ = 0; $ < S[w].symmetries.length; $++) {
                              var B = R.clone();
                              B.matrix = S[w].symmetries[$], B.matrixAutoUpdate = !1, P.add(B);
                            }
                            S[w].lastGL = P, this.modelGroup.add(P);
                          } else
                            S[w].lastGL = R, this.modelGroup.add(R);
                        }
                      }
                  }
                return this.setView(h), typeof t == "function" && t(this), this;
              }
              /* @param {AtomSelectionSpec|any} sel
               * @return list of models specified by sel
               */
              getModelList(t) {
                let a = [];
                if (typeof t > "u" || typeof t.model > "u")
                  for (let M = 0; M < this.models.length; M++)
                    this.models[M] && a.push(this.models[M]);
                else {
                  let M = t.model;
                  Array.isArray(M) || (M = [M]);
                  for (let w = 0; w < M.length; w++)
                    if (typeof M[w] == "number") {
                      var h = M[w];
                      h < 0 && (h += this.models.length), a.push(this.models[h]);
                    } else
                      a.push(M[w]);
                }
                return a;
              }
              /**
               *
               * @param {AtomSelectionSpec}
               *            sel
               * @return {AtomSpec[]}
               */
              getAtomsFromSel(t) {
                var a = [];
                typeof t > "u" && (t = {});
                var h = this.getModelList(t);
                for (let M = 0; M < h.length; M++)
                  a = a.concat(h[M].selectedAtoms(t));
                return a;
              }
              /**
               *
               * @param {AtomSpec}
               *            atom
               * @param {AtomSelectionSpec}
               *            sel
               * @return {boolean}
               */
              atomIsSelected(t, a) {
                typeof a > "u" && (a = {});
                for (var h = this.getModelList(a), M = 0; M < h.length; M++)
                  if (h[M].atomIsSelected(t, a))
                    return !0;
                return !1;
              }
              /** return list of atoms selected by sel
               *
               * @param {AtomSelectionSpec} sel
               * @return {AtomSpec[]}
               */
              selectedAtoms(t) {
                return this.getAtomsFromSel(t);
              }
              /**
              * Returns valid values for the specified attribute in the given selection
              * @param {string} attribute
              * @param {AtomSelectionSpec} sel
              * @return {Array.<Object>}
              *
              */
              getUniqueValues(t, a) {
                typeof a > "u" && (a = {});
                var h = this.getAtomsFromSel(a), M = {};
                for (var w in h)
                  if (h[w].hasOwnProperty(t)) {
                    var S = h[w][t];
                    M[S] = !0;
                  }
                return Object.keys(M);
              }
              /**
               * 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(t) {
                for (var a = this.getAtomsFromSel(t), h = "", M = 0, w = a.length; M < w; ++M)
                  h += a[M].pdbline + `
`;
                return h;
              }
              /**
              	     * 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(t = 2, a = 0, h = !1) {
                var M = (this.CAMERA_Z - this.rotationGroup.position.z) / t, w = this.CAMERA_Z - M;
                return a > 0 ? this.animateMotion(a, h, this.modelGroup.position, this.adjustZoomToLimits(w), this.rotationGroup.quaternion, this.lookingAt) : (this.rotationGroup.position.z = this.adjustZoomToLimits(w), 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(t, a, h = 0, M = !1) {
                var w = t / this.WIDTH, S = a / this.HEIGHT, T = new p.Vector3(0, 0, -this.CAMERA_Z);
                this.projector.projectVector(T, this.camera), T.x -= w, T.y -= S, this.projector.unprojectVector(T, this.camera), T.z = 0;
                var R = this.lookingAt.clone().add(T);
                return h > 0 ? this.animateMotion(h, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, R) : (this.lookingAt = R, 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(t, a, h = 0, M = !1) {
                var w = this.screenOffsetToModel(t, a), S = this.modelGroup.position.clone().add(w);
                return h > 0 ? this.animateMotion(h, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = S, 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(t) {
                t = t || {};
                var a = this.getAtomsFromSel(t), h = (0, x.getExtent)(a), M = h[1][0] - h[0][0], w = h[1][1] - h[0][1], S = h[1][2] - h[0][2], T = Math.hypot(M, w, S);
                return T < 5 && (T = 5), this.slabNear = -T / 1.9, this.slabFar = T / 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(t = {}, a = 0, h = !1) {
                var M, w, S = this.getAtomsFromSel(t), T = (0, x.getExtent)(S);
                (0, x.isEmptyObject)(t) ? (this.shapes.forEach((N) => {
                  if (N && N.boundingSphere && N.boundingSphere.center) {
                    var k = N.boundingSphere.center, G = N.boundingSphere.radius;
                    G > 0 ? (S.push(new p.Vector3(k.x + G, k.y, k.z)), S.push(new p.Vector3(k.x - G, k.y, k.z)), S.push(new p.Vector3(k.x, k.y + G, k.z)), S.push(new p.Vector3(k.x, k.y - G, k.z)), S.push(new p.Vector3(k.x, k.y, k.z + G)), S.push(new p.Vector3(k.x, k.y, k.z - G))) : S.push(k);
                  }
                }), T = (0, x.getExtent)(S), M = S, w = T) : (M = this.getAtomsFromSel({}), w = (0, x.getExtent)(M));
                var R = new p.Vector3(T[2][0], T[2][1], T[2][2]), $ = w[1][0] - w[0][0], P = w[1][1] - w[0][1], B = w[1][2] - w[0][2], F = Math.hypot($, P, B);
                F < 5 && (F = 5), this.slabNear = -F / 1.9, this.slabFar = F / 2, $ = T[1][0] - T[0][0], P = T[1][1] - T[0][1], B = T[1][2] - T[0][2], F = Math.hypot($, P, B), F < 5 && (F = 5);
                for (var U = 25, z = 0; z < S.length; z++)
                  if (S[z]) {
                    var W = R.distanceToSquared(S[z]);
                    W > U && (U = W);
                  }
                F = Math.sqrt(U) * 2;
                var V = R.clone().multiplyScalar(-1);
                return a > 0 ? this.animateMotion(a, h, 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");
              	              $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();
              	              });
              	              viewer.zoomTo();
              	            });
              	     */
              zoomTo(t = {}, a = 0, h = !1) {
                let M = this.getAtomsFromSel(t), w = (0, x.getExtent)(M), S = w;
                if ((0, x.isEmptyObject)(t)) {
                  let k = M && M.length;
                  if (this.shapes.forEach((G) => {
                    if (G && G.boundingSphere) {
                      if (G.boundingSphere.box) {
                        let ge = G.boundingSphere.box;
                        M.push(new p.Vector3(ge.min.x, ge.min.y, ge.min.z)), M.push(new p.Vector3(ge.max.x, ge.max.y, ge.max.z));
                      } else if (G.boundingSphere.center) {
                        var Q = G.boundingSphere.center, ie = G.boundingSphere.radius;
                        ie > 0 ? (M.push(new p.Vector3(Q.x + ie, Q.y, Q.z)), M.push(new p.Vector3(Q.x - ie, Q.y, Q.z)), M.push(new p.Vector3(Q.x, Q.y + ie, Q.z)), M.push(new p.Vector3(Q.x, Q.y - ie, Q.z)), M.push(new p.Vector3(Q.x, Q.y, Q.z + ie)), M.push(new p.Vector3(Q.x, Q.y, Q.z - ie))) : M.push(Q);
                      }
                    }
                  }), S = (0, x.getExtent)(M), !k)
                    for (let G = 0; G < 3; G++)
                      w[2][G] = (S[0][G] + S[1][G]) / 2;
                } else {
                  let k = this.getAtomsFromSel({});
                  S = (0, x.getExtent)(k);
                }
                var T = new p.Vector3(w[2][0], w[2][1], w[2][2]), R = S[1][0] - S[0][0], $ = S[1][1] - S[0][1], P = S[1][2] - S[0][2], B = Math.hypot(R, $, P);
                B < 5 && (B = 5), this.slabNear = -B / 1.9, this.slabFar = B / 2, Object.keys(t).length === 0 && (this.slabNear = Math.min(-B * 2, -50), this.slabFar = Math.max(B * 2, 50));
                var F = this.config.minimumZoomToDistance || 5;
                R = w[1][0] - w[0][0], $ = w[1][1] - w[0][1], P = w[1][2] - w[0][2], B = Math.hypot(R, $, P), B < F && (B = F);
                for (var U = F * F, z = 0; z < M.length; z++)
                  if (M[z]) {
                    var W = T.distanceToSquared(M[z]);
                    W > U && (U = W);
                  }
                B = Math.sqrt(U) * 2;
                var V = T.clone().multiplyScalar(-1), N = -(B * 0.5 / Math.tan(Math.PI / 180 * this.camera.fov / 2) - this.CAMERA_Z);
                return N = this.adjustZoomToLimits(N), a > 0 ? this.animateMotion(a, h, V, N, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = V, this.rotationGroup.position.z = N, 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(t, a) {
                this.slabNear = t, this.slabFar = a;
              }
              /**
               * 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(t, a = {}, h, M = !1) {
                if (h) {
                  var w = (0, x.getExtent)(this.getAtomsFromSel(h));
                  a.position = { x: w[2][0], y: w[2][1], z: w[2][2] };
                }
                var S = new E.Label(t, a);
                return S.setContext(), this.modelGroup.add(S.sprite), this.labels.push(S), M || this.show(), S;
              }
              /** 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(t, a, h = !1) {
                let M = this.labels.length;
                return this.applyToModels("addResLabels", t, this, a, h), this.show(), this.labels.slice(M);
              }
              /** 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(t, a, h) {
                return this.applyToModels("addPropertyLabels", t, a, this, h), 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(t) {
                for (var a = 0; a < this.labels.length; a++)
                  if (this.labels[a] == t) {
                    this.labels.splice(a, 1), t.dispose(), this.modelGroup.remove(t.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 t = 0; t < this.labels.length; t++)
                  this.labels[t] && this.labels[t].sprite && this.modelGroup.remove(this.labels[t].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(t, a) {
                return this.modelGroup.remove(t.sprite), t.dispose(), t.stylespec = a, t.setContext(), this.modelGroup.add(t.sprite), this.show(), t;
              }
              // Change label text
              /**
               * Modify existing label's text
               *
               * @param {Label}  label - $3Dmol label
               * @param {String}
               *            text - Label text
               * @return {Label}
               */
              setLabelText(t, a) {
                return this.modelGroup.remove(t.sprite), t.dispose(), t.text = a, t.setContext(), this.modelGroup.add(t.sprite), this.show(), t;
              }
              /**
               * Add shape object to viewer
               * @see {GLShape}
               *
               * @param {ShapeSpec} shapeSpec - style specification for label
               * @return {GLShape}
               */
              addShape(t) {
                t = t || {};
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, this.shapes.push(a), a;
              }
              /**
               * Remove shape object from viewer
               *
               * @param {GLShape} shape - Reference to shape object to remove
               */
              removeShape(t) {
                if (!t)
                  return this;
                for (t.removegl(this.modelGroup), delete this.shapes[t.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 t = 0; t < this.shapes.length; t++) {
                  var a = this.shapes[t];
                  a && a.removegl(this.modelGroup);
                }
                return this.shapes.splice(0, this.shapes.length), this;
              }
              //gets the center of the selection
              getSelectionCenter(t) {
                if (t.hasOwnProperty("x") && t.hasOwnProperty("y") && t.hasOwnProperty("z"))
                  return t;
                var a = this.getAtomsFromSel(t);
                if (a.length == 0)
                  return { x: 0, y: 0, z: 0 };
                var h = (0, x.getExtent)(a);
                return { x: h[0][0] + (h[1][0] - h[0][0]) / 2, y: h[0][1] + (h[1][1] - h[0][1]) / 2, z: h[0][2] + (h[1][2] - h[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(t) {
                t = t || {}, t.center = this.getSelectionCenter(t.center);
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, a.addSphere(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t = {}) {
                t.corner != null && (t.corner = this.getSelectionCenter(t.corner)), t.center != null && (t.center = this.getSelectionCenter(t.center));
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, a.addBox(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t = {}) {
                t.start = this.getSelectionCenter(t.start), t.end = this.getSelectionCenter(t.end);
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, a.addArrow(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t = {}) {
                t.start = this.getSelectionCenter(t.start), t.end = this.getSelectionCenter(t.end);
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, t.dashed ? a.addDashedCylinder(t) : a.addCylinder(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t = {}) {
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, a.addCurve(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t = {}) {
                t.start = this.getSelectionCenter(t.start), t.end = this.getSelectionCenter(t.end), t.wireframe = !0;
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, t.dashed ? a = this.addLineDashed(t, a) : a.addLine(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t, a) {
                t = this.getModel(t), a = a || { alabel: "a", blabel: "b", clabel: "c" }, a.box = a.box || {}, a.astyle = a.astyle || { color: "red", radius: 0.1, midpos: -1 }, a.bstyle = a.bstyle || { color: "green", radius: 0.1, midpos: -1 }, a.cstyle = a.cstyle || { color: "blue", radius: 0.1, midpos: -1 }, a.alabelstyle = a.alabelstyle || { fontColor: "red", showBackground: !1, alignment: "center", inFront: !1 }, a.blabelstyle = a.blabelstyle || { fontColor: "green", showBackground: !1, alignment: "center", inFront: !1 }, a.clabelstyle = a.clabelstyle || { fontColor: "blue", showBackground: !1, alignment: "center", inFront: !1 }, t.unitCellObjects && this.removeUnitCell(t), t.unitCellObjects = { shapes: [], labels: [] };
                var h = t.getCrystData(), M = null;
                if (h) {
                  if (h.matrix)
                    M = h.matrix;
                  else {
                    var w = h.a, S = h.b, T = h.c, R = h.alpha, $ = h.beta, P = h.gamma;
                    R = R * Math.PI / 180, $ = $ * Math.PI / 180, P = P * Math.PI / 180;
                    var B, F, U;
                    B = Math.cos($), F = (Math.cos(R) - Math.cos($) * Math.cos(P)) / Math.sin(P), U = Math.sqrt(Math.max(0, 1 - B * B - F * F)), M = new p.Matrix3(w, S * Math.cos(P), T * B, 0, S * Math.sin(P), T * F, 0, 0, T * U);
                  }
                  var z = [
                    new p.Vector3(0, 0, 0),
                    new p.Vector3(1, 0, 0),
                    new p.Vector3(0, 1, 0),
                    new p.Vector3(0, 0, 1),
                    new p.Vector3(1, 1, 0),
                    new p.Vector3(0, 1, 1),
                    new p.Vector3(1, 0, 1),
                    new p.Vector3(1, 1, 1)
                  ];
                  if (h.matrix4)
                    for (let V = 0; V < z.length; V++)
                      h.size && z[V].multiplyVectors(z[V], h.size), z[V] = z[V].applyMatrix4(h.matrix4);
                  else
                    for (let V = 0; V < z.length; V++)
                      z[V] = z[V].applyMatrix3(M);
                  if (a.box && !a.box.hidden) {
                    a.box.wireframe = !0;
                    var W = new u.GLShape(a.box);
                    W.shapePosition = this.shapes.length, W.addLine({ start: z[0], end: z[1] }), W.addLine({ start: z[0], end: z[2] }), W.addLine({ start: z[1], end: z[4] }), W.addLine({ start: z[2], end: z[4] }), W.addLine({ start: z[0], end: z[3] }), W.addLine({ start: z[3], end: z[5] }), W.addLine({ start: z[2], end: z[5] }), W.addLine({ start: z[1], end: z[6] }), W.addLine({ start: z[4], end: z[7] }), W.addLine({ start: z[6], end: z[7] }), W.addLine({ start: z[3], end: z[6] }), W.addLine({ start: z[5], end: z[7] }), this.shapes.push(W), t.unitCellObjects.shapes.push(W), W.finalize();
                  }
                  if (!a.astyle.hidden) {
                    a.astyle.start = z[0], a.astyle.end = z[1];
                    let V = this.addArrow(a.astyle);
                    t.unitCellObjects.shapes.push(V);
                  }
                  if (!a.bstyle.hidden) {
                    a.bstyle.start = z[0], a.bstyle.end = z[2];
                    let V = this.addArrow(a.bstyle);
                    t.unitCellObjects.shapes.push(V);
                  }
                  if (!a.cstyle.hidden) {
                    a.cstyle.start = z[0], a.cstyle.end = z[3];
                    let V = this.addArrow(a.cstyle);
                    t.unitCellObjects.shapes.push(V);
                  }
                  if (a.alabel) {
                    a.alabelstyle.position = z[1];
                    let V = this.addLabel(a.alabel, a.alabelstyle);
                    t.unitCellObjects.labels.push(V);
                  }
                  if (a.blabel) {
                    a.blabelstyle.position = z[2];
                    let V = this.addLabel(a.blabel, a.blabelstyle);
                    t.unitCellObjects.labels.push(V);
                  }
                  if (a.clabel) {
                    a.clabelstyle.position = z[3];
                    let V = this.addLabel(a.clabel, a.clabelstyle);
                    t.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(t) {
                if (t = this.getModel(t), t.unitCellObjects) {
                  let a = this;
                  t.unitCellObjects.shapes.forEach(function(h) {
                    a.removeShape(h);
                  }), t.unitCellObjects.labels.forEach(function(h) {
                    a.removeLabel(h);
                  });
                }
                delete t.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(t = 3, a = t, h = a, M, w, S) {
                M = this.getModel(M);
                let T = M.getCrystData();
                if (T) {
                  const R = M.selectedAtoms({}), $ = T.matrix;
                  let P = function(F) {
                    return F % 2 == 0 ? -F / 2 : Math.ceil(F / 2);
                  };
                  t <= 1 && a <= 1 && h <= 1 && (S = !0, t = a = h = 3);
                  let B = function(F, U, z) {
                    return !1;
                  };
                  if (S) {
                    const F = new p.Matrix3().getInverse3($);
                    B = function(U, z, W) {
                      let V = new p.Vector3(U, z, W).applyMatrix3(F);
                      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 F = 0; F < t; F++)
                    for (let U = 0; U < a; U++)
                      for (let z = 0; z < h; z++) {
                        if (F == 0 && U == 0 && z == 0)
                          continue;
                        let W = new p.Vector3(P(F), P(U), P(z));
                        W.applyMatrix3($);
                        let V = [];
                        for (let N = 0; N < R.length; N++) {
                          let k = R[N].x + W.x, G = R[N].y + W.y, Q = R[N].z + W.z;
                          if (B(k, G, Q))
                            continue;
                          let ie = {};
                          for (let ge in R[N])
                            ie[ge] = R[N][ge];
                          ie.x = k, ie.y = G, ie.z = Q, V.push(ie);
                        }
                        M.addAtoms(V);
                      }
                  w && M.assignBonds();
                }
              }
              /** Add dashed line to shape */
              addLineDashed(t, a) {
                t.dashLength = t.dashLength || 0.5, t.gapLength = t.gapLength || 0.5;
                var h;
                t.start ? h = new p.Vector3(t.start.x || 0, t.start.y || 0, t.start.z || 0) : h = new p.Vector3(0, 0, 0);
                var M;
                t.end ? M = new p.Vector3(t.end.x, t.end.y || 0, t.end.z || 0) : M = new p.Vector3(0, 0, 0);
                var w = new p.Vector3(), S = new p.Vector3(), T = new p.Vector3(), R, $, P, B = h.clone(), F = 0;
                for (w.subVectors(M, h), R = w.length(), w.normalize(), S = w.clone(), T = w.clone(), S.multiplyScalar(t.dashLength), T.multiplyScalar(t.gapLength), $ = S.length(), P = T.length(); F < R; ) {
                  if (F + $ > R) {
                    t.start = h, t.end = M, a.addLine(t);
                    break;
                  }
                  B.addVectors(h, S), t.start = h, t.end = B, a.addLine(t), h = B.clone(), F += $, B.addVectors(h, T), h = B.clone(), F += P;
                }
                return a.finalize(), a;
              }
              /**
              	     * 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(t) {
                t = t || {};
                var a = new u.GLShape(t);
                return a.shapePosition = this.shapes.length, a.addCustom(t), this.shapes.push(a), a.finalize(), a;
              }
              /**
              	     * 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(t, a, h = {}) {
                var M = new A.VolumeData(t, a);
                return h.hasOwnProperty("transferfn") ? this.addVolumetricRender(M, h) : this.addIsosurface(M, h);
              }
              /**
               * 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(t, a = {}, h) {
                var M = new u.GLShape(a);
                return M.shapePosition = this.shapes.length, M.addIsosurface(t, a, h), this.shapes.push(M), M;
              }
              /**
               * Create volumetric renderer for volumetricData
               * @param {VolumeData} data - volumetric data
               * @param {VolumetricRenderSpec} spec - specification of volumetric render
               *
               * @return {GLShape}
               *
               */
              addVolumetricRender(t, a) {
                a = a || {};
                var h = new C.GLVolumetricRender(t, a);
                return h.shapePosition = this.shapes.length, this.shapes.push(h), h;
              }
              /**
               * 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(t) {
                t ? this.scene.fog = new l.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(t) {
                this.viewer_frame = t;
                let a = this;
                return new Promise(function(h) {
                  var M = a.models.map(function(w) {
                    return w.setFrame(t, a);
                  });
                  Promise.all(M).then(function() {
                    h();
                  });
                });
              }
              /**
               * 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 t = 0;
                for (let a = 0; a < this.models.length; a++)
                  this.models[a].getNumFrames() > t && (t = this.models[a].getNumFrames());
                for (let a = 0; a < this.shapes.length; a++)
                  this.shapes[a].frame && this.shapes[a].frame >= t && (t = this.shapes[a].frame + 1);
                for (let a = 0; a < this.labels.length; a++)
                  this.labels[a].frame && this.labels[a].frame >= t && (t = this.labels[a].frame + 1);
                return t;
              }
              /**
               * 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(t) {
                this.incAnim();
                var a = 100, h = "forward", M = 0;
                t = t || {}, t.interval && (a = t.interval), t.loop && (h = t.loop), t.reps && (M = t.reps);
                var w = this.getNumFrames(), S = this, T = 0;
                t.startFrame && (T = t.startFrame % w);
                var R = 1;
                t.step && (R = t.step, M /= R);
                var $ = 0, P = w * M, B = /* @__PURE__ */ new Date(), F, U, z = function(W) {
                  B = /* @__PURE__ */ new Date(), W == "forward" ? S.setFrame(T).then(function() {
                    T = (T + R) % w, F();
                  }) : W == "backward" ? S.setFrame(w - 1 - T).then(function() {
                    T = (T + R) % w, F();
                  }) : S.setFrame(T).then(function() {
                    T += R, R *= T % (w - 1) == 0 ? -1 : 1, F();
                  });
                };
                return F = function() {
                  if (S.render(), !S.getCanvas().isConnected)
                    S.stopAnimate();
                  else if (++$ == P || !S.isAnimated())
                    U.cancel(), S.animationTimers.delete(U), S.decAnim();
                  else {
                    var W = a - ((/* @__PURE__ */ new Date()).getTime() - B.getTime());
                    W = W > 0 ? W : 0, S.animationTimers.delete(U), U = new x.PausableTimer(z, W, h), S.animationTimers.add(U);
                  }
                }, U = new x.PausableTimer(z, 0, h), this.animationTimers.add(U), this;
              }
              /**
               * Stop animation of all models in viewer
               */
              stopAnimate() {
                return this.animated = 0, this.animationTimers.forEach(function(t) {
                  t.cancel();
                }), this.animationTimers = /* @__PURE__ */ new Set(), this;
              }
              /**
               * Pause animation of all models in viewer
               */
              pauseAnimate() {
                return this.animationTimers.forEach(function(t) {
                  t.pause();
                }), this;
              }
              /**
               * Resume animation of all models in viewer
               */
              resumeAnimate() {
                return this.animationTimers.forEach(function(t) {
                  t.resume();
                }), this;
              }
              /**
               * Return true if viewer is currently being animated, false otherwise
               * @return {boolean}
               */
              isAnimated() {
                return this.animated > 0;
              }
              //setup options dict
              getModelOpt(t) {
                return t && !t.defaultcolors ? (t.defaultcolors = this.defaultcolors, t.cartoonQuality = t.cartoonQuality || this.config.cartoonQuality) : typeof t > "u" && (t = { defaultcolors: this.defaultcolors, cartoonQuality: this.config.cartoonQuality }), t;
              }
              /**
              	     * 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(t, a = "", h) {
                h = this.getModelOpt(h);
                var M = new g.GLModel(this.models.length, h);
                return M.addMolData(t, a, h), this.models.push(M), M;
              }
              /**
               * 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(t, a, h) {
                h = this.getModelOpt(h), h.multimodel = !0, h.frames = !0;
                for (var M = g.GLModel.parseMolData(t, a, h), w = 0; w < M.length; w++) {
                  var S = new g.GLModel(this.models.length, h);
                  S.setAtomDefaults(M[w]), S.addFrame(M[w]), S.setFrame(0), M.modelData && S.setModelData(M.modelData[w]), S.setDontDuplicateAtoms(!h.duplicateAssemblyAtoms), this.models.push(S);
                }
                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(t, a, h) {
                h = this.getModelOpt(h), h.multimodel = !0, h.frames = !0;
                var M = new g.GLModel(this.models.length, h);
                return M.addMolData(t, a, h), this.models.push(M), M;
              }
              /**
              	     * 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(t, a, h) {
                h = this.getModelOpt(h), h.multimodel = !0, h.onemol = !0;
                var M = new g.GLModel(this.models.length, h);
                return M.addMolData(t, a, h), this.models.push(M), M;
              }
              /**
               * Delete specified model from viewer
               *
               * @param {GLModel|number} model
               */
              removeModel(t) {
                if (t = this.getModel(t), !!t) {
                  for (t.removegl(this.modelGroup), delete this.models[t.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 t = 0; t < this.models.length; t++) {
                  var a = this.models[t];
                  a && a.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(t, a) {
                var h = {};
                return a === void 0 ? h.m = this.models.map(function(M) {
                  return M.toCDObject(t);
                }) : h.m = [this.models[a].toCDObject()], JSON.stringify(h);
              }
              /** return a VRML string representation of the scene.  Include VRML header information
               * @return VRML
               */
              exportVRML() {
                var t = this.modelGroup;
                this.applyToModels("removegl", this.modelGroup), this.modelGroup = new l.Object3D(), this.render(null, { supportsImposters: !1, supportsAIA: !1, regen: !0 });
                var a = `#VRML V2.0 utf8
` + this.modelGroup.vrml() + `
`;
                return this.applyToModels("removegl", this.modelGroup), this.modelGroup = t, a;
              }
              /**
               * 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(t, a = !1) {
                for (var h = new g.GLModel(this.models.length, this.defaultcolors), M = 0; M < this.models.length; M++)
                  if (this.models[M]) {
                    var w = this.models[M].selectedAtoms(t);
                    h.addAtoms(w), a && this.models[M].removeAtoms(w);
                  }
                return this.models.push(h), h;
              }
              applyToModels(t, a, h, M, w, S, T) {
                for (var R = this.getModelList(a), $ = 0; $ < R.length; $++)
                  R[$][t](a, h, M, w, S, T);
              }
              setStyle(t, a) {
                return typeof a > "u" && (a = t, t = {}), this.applyToModels("setStyle", t, a, !1), this;
              }
              addStyle(t, a) {
                return typeof a > "u" && (a = t, t = {}), this.applyToModels("setStyle", t, a, !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(t, a, h) {
                return this.applyToModels("setClickable", t, a, h), 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(t, a, h, M) {
                return this.applyToModels("setHoverable", t, a, h, M), 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(t, a) {
                return this.applyToModels("enableContextMenu", t, a), 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(t, a, h, M) {
                return this.applyToModels("vibrate", t, a, h, this, M), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               * @param {object} range
               */
              setColorByProperty(t, a, h, M) {
                return this.applyToModels("setColorByProperty", t, a, h, M), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(t, a) {
                return this.applyToModels("setColorByElement", t, a), this;
              }
              /**
               *
               * @param {AtomSpec[]} atomlist
               * @param {Array}
               *            extent
               * @return {Array}
               */
              static getAtomsWithin(t, a) {
                var h = [];
                for (let w = 0; w < t.length; w++) {
                  var M = t[w];
                  typeof M > "u" || M.x < a[0][0] || M.x > a[1][0] || M.y < a[0][1] || M.y > a[1][1] || M.z < a[0][2] || M.z > a[1][2] || h.push(M);
                }
                return h;
              }
              // return volume of extent
              static volume(t) {
                var a = t[1][0] - t[0][0], h = t[1][1] - t[0][1], M = t[1][2] - t[0][2];
                return a * h * M;
              }
              // 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(t, a, h) {
                let M = [], w = {};
                for (let B = 0, F = a.length; B < F; B++)
                  w[a[B].index] = B;
                let S = function(B) {
                  let F = [];
                  for (let U = 0, z = B.length; U < z; U++)
                    B[U].index in w && F.push(w[B[U].index]);
                  return F;
                }, T = function(B) {
                  let F = [];
                  return F[0] = [B[0][0], B[0][1], B[0][2]], F[1] = [B[1][0], B[1][1], B[1][2]], F;
                }, R = function(B) {
                  if (r.volume(B) < r.maxVolume)
                    return [B];
                  var F = B[1][0] - B[0][0], U = B[1][1] - B[0][1], z = B[1][2] - B[0][2], W;
                  F > U && F > z ? W = 0 : U > F && U > z ? W = 1 : W = 2;
                  var V = T(B), N = T(B), k = (B[1][W] - B[0][W]) / 2 + B[0][W];
                  V[1][W] = k, N[0][W] = k;
                  var G = R(V), Q = R(N);
                  return G.concat(Q);
                }, $ = R(t), P = 6;
                for (let B = 0, F = $.length; B < F; B++) {
                  let U = T($[B]);
                  U[0][0] -= P, U[0][1] -= P, U[0][2] -= P, U[1][0] += P, U[1][1] += P, U[1][2] += P;
                  let z = r.getAtomsWithin(a, U), W = r.getAtomsWithin(h, $[B]);
                  M.push({
                    extent: $[B],
                    atoms: S(z),
                    toshow: S(W)
                  });
                }
                return M;
              }
              // 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(t, a, h) {
                var M = new l.Geometry(!0), w = M.updateGeoGroup(0), S = [];
                for (let ye = 0, Pe = t.length; ye < Pe; ye++) {
                  var T = t[ye];
                  T && (typeof T.surfaceColor < "u" ? S[ye] = T.surfaceColor : T.color && (S[ye] = _.CC.color(T.color)));
                }
                var R = w.vertexArray, $ = a.vertices;
                for (let ye = 0, Pe = $.length; ye < Pe; ye++) {
                  let de = w.vertices * 3;
                  R[de] = $[ye].x, R[de + 1] = $[ye].y, R[de + 2] = $[ye].z, w.vertices++;
                }
                var P = w.colorArray;
                if (h.voldata && h.volscheme) {
                  var B = h.volscheme, F = h.voldata, U = B.range() || [-1, 1];
                  for (let ye = 0, Pe = $.length; ye < Pe; ye++) {
                    let de = F.getVal($[ye].x, $[ye].y, $[ye].z), pe = _.CC.color(B.valueToHex(de, U)), re = ye * 3;
                    P[re] = pe.r, P[re + 1] = pe.g, P[re + 2] = pe.b;
                  }
                } else if (S.length > 0)
                  for (let ye = 0, Pe = $.length; ye < Pe; ye++) {
                    let de = $[ye].atomid, pe = ye * 3;
                    P[pe] = S[de].r, P[pe + 1] = S[de].g, P[pe + 2] = S[de].b;
                  }
                var z = a.faces;
                w.faceidx = z.length, M.initTypedArrays();
                var W = w.vertexArray, V = w.normalArray, N, k, G, Q;
                for (let ye = 0, Pe = z.length; ye < Pe; ye += 3) {
                  var ie = z[ye], ge = z[ye + 1], le = z[ye + 2], oe = ie * 3, he = ge * 3, se = le * 3;
                  N = new p.Vector3(W[oe], W[oe + 1], W[oe + 2]), k = new p.Vector3(W[he], W[he + 1], W[he + 2]), G = new p.Vector3(W[se], W[se + 1], W[se + 2]), G.subVectors(G, k), N.subVectors(N, k), G.cross(N), Q = G, Q.normalize(), V[oe] += Q.x, V[he] += Q.x, V[se] += Q.x, V[oe + 1] += Q.y, V[he + 1] += Q.y, V[se + 1] += Q.y, V[oe + 2] += Q.z, V[he + 2] += Q.z, V[se + 2] += Q.z;
                }
                w.faceArray = new Uint16Array(z);
                var xe = new l.Mesh(M, h);
                return xe;
              }
              // 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(t, a, h, M, w, S) {
                var T = new L.ProteinSurface();
                return T.initparm(a, t !== 1, S), T.fillvoxels(w, h), T.buildboundary(), (t == L.SurfaceType.SES || t == L.SurfaceType.MS) && (T.fastdistancemap(), T.boundingatom(!1), T.fillvoxelswaals(w, h)), T.marchingcube(t), T.getFacesAndVertices(M);
              }
              /*
               *
               * @param {SurfaceStyleSpec}
               *            style
               * @return {MeshLambertMaterial}
               */
              static getMatWithStyle(t) {
                var a = new l.MeshLambertMaterial();
                a.vertexColors = l.Coloring.VertexColors;
                for (var h in t)
                  h === "color" || h === "map" || t.hasOwnProperty(h) && (a[h] = t[h]);
                return t.opacity !== void 0 && (t.opacity === 1 ? a.transparent = !1 : a.transparent = !0), a;
              }
              /**
               * Adds an explicit mesh as a surface object.
               * @param {Mesh}
               *            mesh
               * @param {Object}
               *            style
               * @returns {number} surfid
               */
              addMesh(t) {
                var a = {
                  geo: t.geometry,
                  mat: t.material,
                  done: !0,
                  finished: !1
                  //the rendered finishes surfaces when they are done
                }, h = this.nextSurfID();
                return this.surfaces[h] = a, h;
              }
              //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(t) {
                var a = [];
                let h = t.length;
                for (let M = 0; M < h; M++)
                  a[M] = (0, x.extend)({}, t[M]);
                return a;
              }
              /**
               * 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(t, a = {}, h = {}, M, w, S) {
                let T = this.nextSurfID(), R = null, $ = this, P = L.SurfaceType.VDW;
                typeof t == "string" ? r.surfaceTypeMap[t.toUpperCase()] !== void 0 ? P = r.surfaceTypeMap[t] : console.log("Surface type : " + t + " is not recognized") : typeof t == "number" && (P = t);
                var B = null, F = null, U = r.shallowCopy(this.getAtomsFromSel(h));
                M ? B = r.shallowCopy(this.getAtomsFromSel(M)) : B = U, (0, x.adjustVolumeStyle)(a);
                var z = !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()) {
                      z = !0;
                      break;
                    }
                  }
                var N = function(oe, he, se) {
                  w ? F = r.shallowCopy($.getAtomsFromSel(w)) : F = se;
                  var xe, ye = (0, x.getExtent)(se, !0);
                  if (a.map && a.map.prop) {
                    var Pe = a.map.prop;
                    let We = (0, o.getGradient)(a.map.scheme || a.map.gradient || new o.Gradient.RWB()), Ue = We.range();
                    Ue || (Ue = (0, x.getPropertyRange)(se, Pe)), a.colorscheme = { prop: Pe, gradient: We };
                  }
                  for (let We = 0, Ue = he.length; We < Ue; We++)
                    xe = he[We], xe.surfaceColor = (0, x.getColorFromStyle)(xe, a);
                  var de = r.volume(ye), pe = $.carveUpExtent(ye, he, se);
                  if (F && F.length && F.length > 0) {
                    var re = (0, x.getExtent)(F, !0), Se = function(We, Ue) {
                      var Be = function(K, q) {
                        var fe = K.extent, _e = fe[1][0] - fe[0][0], Me = fe[1][1] - fe[0][1], Ae = fe[1][2] - fe[0][2], Z = _e - q[2][0];
                        Z *= Z;
                        var ue = Me - q[2][1];
                        ue *= ue;
                        var we = Ae - q[2][2];
                        return we *= we, Z + ue + we;
                      }, Ne = Be(We, re), H = Be(Ue, re);
                      return Ne - H;
                    };
                    pe.sort(Se);
                  }
                  var ke = [];
                  for (let We = 0, Ue = he.length; We < Ue; We++)
                    xe = he[We], ke[We] = {
                      x: xe.x,
                      y: xe.y,
                      z: xe.z,
                      serial: We,
                      elem: xe.elem
                    };
                  var $e = !!L.syncSurface;
                  if ($e) {
                    var ze = function(Ue) {
                      return new Promise(function(Be) {
                        for (var Ne = r.generateMeshSyncHelper(P, pe[Ue].extent, pe[Ue].atoms, pe[Ue].toshow, ke, de), H = (0, u.splitMesh)({ vertexArr: Ne.vertices, faceArr: Ne.faces }), K = 0, q = H.length; K < q; K++) {
                          Ne = {
                            vertices: H[K].vertexArr,
                            faces: H[K].faceArr
                          };
                          var fe = r.generateSurfaceMesh(he, Ne, R);
                          (0, x.mergeGeos)(oe.geo, fe);
                        }
                        $.render(), Be();
                      });
                    }, Re = [];
                    for (let We = 0; We < pe.length; We++)
                      Re.push(ze(We));
                    return Promise.all(Re).then(function() {
                      return oe.done = !0, Promise.resolve(T);
                    });
                  } else {
                    var Fe = [];
                    P < 0 && (P = 0);
                    for (let We = 0, Ue = r.numWorkers; We < Ue; We++) {
                      var Ie = new Worker($3Dmol.SurfaceWorker);
                      Fe.push(Ie), Ie.postMessage({
                        type: -1,
                        atoms: ke,
                        volume: de
                      });
                    }
                    return new Promise(function(We, Ue) {
                      var Be = 0, Ne = function() {
                        !Fe || !Fe.length || Fe.forEach(function(fe) {
                          fe && fe.terminate && fe.terminate();
                        });
                      }, H = function(fe) {
                        for (var _e = (0, u.splitMesh)({
                          vertexArr: fe.data.vertices,
                          faceArr: fe.data.faces
                        }), Me = 0, Ae = _e.length; Me < Ae; Me++) {
                          var Z = {
                            vertices: _e[Me].vertexArr,
                            faces: _e[Me].faceArr
                          }, ue = r.generateSurfaceMesh(he, Z, R);
                          (0, x.mergeGeos)(oe.geo, ue);
                        }
                        $.render(), Be++, Be == pe.length && (oe.done = !0, Ne(), We(T));
                      }, K = function(fe) {
                        Ne(), console.log(fe.message + " (" + fe.filename + ":" + fe.lineno + ")"), Ue(fe);
                      };
                      for (let fe = 0; fe < pe.length; fe++) {
                        var q = Fe[fe % Fe.length];
                        q.onmessage = H, q.onerror = K, q.postMessage({
                          type: P,
                          expandedExtent: pe[fe].extent,
                          extendedAtoms: pe[fe].atoms,
                          atomsToShow: pe[fe].toshow
                        });
                      }
                    });
                  }
                };
                a = a || {}, R = r.getMatWithStyle(a);
                var k = [];
                k.style = a, k.atomsel = h, k.allsel = M, k.focus = w;
                var G = null;
                if (z) {
                  var Q = {}, ie = {};
                  for (W = 0; W < this.models.length; W++)
                    Q[W] = [], ie[W] = [];
                  for (W = 0; W < B.length; W++)
                    Q[B[W].model].push(B[W]);
                  for (W = 0; W < U.length; W++)
                    ie[U[W].model].push(U[W]);
                  var ge = [];
                  for (W = 0; W < this.models.length; W++)
                    ie[W].length > 0 && (k.push({
                      geo: new l.Geometry(!0),
                      mat: R,
                      done: !1,
                      finished: !1,
                      symmetries: this.models[W].getSymmetries()
                      // also webgl initialized
                    }), ge.push(N(k[k.length - 1], Q[W], ie[W])));
                  G = Promise.all(ge);
                } else
                  k.push({
                    geo: new l.Geometry(!0),
                    mat: R,
                    done: !1,
                    finished: !1,
                    symmetries: [new p.Matrix4()]
                  }), G = N(k[k.length - 1], B, U);
                return this.surfaces[T] = k, G.surfid = T, S && typeof S == "function" ? (G.then(function(le) {
                  S(le);
                }), T) : G;
              }
              /**
               * 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(t, a) {
                if ((0, x.adjustVolumeStyle)(a), this.surfaces[t]) {
                  var h = this.surfaces[t];
                  h.style = a;
                  for (var M = 0; M < h.length; M++) {
                    var w = h[M].mat = r.getMatWithStyle(a);
                    if (h[M].mat.side = l.FrontSide, a.color) {
                      h[M].mat.color = a.color, h[M].geo.colorsNeedUpdate = !0;
                      const S = _.CC.color(a.color);
                      h[M].geo.setColors(function() {
                        return S;
                      });
                    } else if (w.voldata && w.volscheme) {
                      const S = w.volscheme, T = w.voldata, R = _.CC, $ = S.range() || [-1, 1];
                      h[M].geo.setColors(function(P, B, F) {
                        let U = T.getVal(P, B, F);
                        return R.color(S.valueToHex(U, $));
                      });
                    }
                    h[M].finished = !1;
                  }
                }
                return this;
              }
              /**
               * Return surface object
               * @param {number} surf - surface id
               */
              getSurface(t) {
                return this.surfaces[t];
              }
              /**
               * Remove surface with given ID
               * @param {number} surf - surface id
               */
              removeSurface(t) {
                for (var a = this.surfaces[t], h = 0; h < a.length; h++)
                  a[h] && a[h].lastGL && (a[h].geo !== void 0 && a[h].geo.dispose(), a[h].mat !== void 0 && a[h].mat.dispose(), this.modelGroup.remove(a[h].lastGL));
                return delete this.surfaces[t], this.show(), this;
              }
              /** Remove all surfaces.
               **/
              removeAllSurfaces() {
                for (var t in this.surfaces)
                  if (this.surfaces.hasOwnProperty(t)) {
                    for (var a = this.surfaces[t], h = 0; h < a.length; h++)
                      a[h] && a[h].lastGL && (a[h].geo !== void 0 && a[h].geo.dispose(), a[h].mat !== void 0 && a[h].mat.dispose(), this.modelGroup.remove(a[h].lastGL));
                    delete this.surfaces[t];
                  }
                return this.show(), this;
              }
              /** return Jmol moveto command to position this scene */
              jmolMoveTo() {
                var t = this.modelGroup.position, a = "center { " + -t.x + " " + -t.y + " " + -t.z + " }; ", h = this.rotationGroup.quaternion;
                return a += "moveto .5 quaternion { " + h.x + " " + h.y + " " + h.z + " " + h.w + " };", a;
              }
              /** 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(t, a) {
                a = a || {};
                var h = this.getAtomsFromSel(a);
                if (typeof t == "function")
                  for (let S = 0, T = h.length; S < T; S++) {
                    let R = h[S];
                    t(R);
                  }
                else
                  for (let S = 0, T = h.length; S < T; S++) {
                    var M = h[S];
                    for (let R = 0, $ = t.length; R < $; R++) {
                      let P = t[R];
                      if (P.props)
                        for (var w in P.props)
                          P.props.hasOwnProperty(w) && this.atomIsSelected(M, P) && (M.properties || (M.properties = {}), M.properties[w] = P.props[w]);
                    }
                  }
                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 {$3Dmol.GLViewer} otherview
               */
              linkViewer(t) {
                return this.linkedViewers.push(t), 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(t) {
                this.rotationGroup.position.z = this.CAMERA_Z - t;
              }
              /**
               * Used for setting an approx value of eyeSeparation. Created for calling by StereoViewer object
               * @return {number} camera x position
               */
              setAutoEyeSeparation(t, a) {
                var h = this.getPerceivedDistance();
                return a || (a = 5), t || this.camera.position.x > 0 ? this.camera.position.x = h * Math.tan(Math.PI / 180 * a) : this.camera.position.x = -h * Math.tan(Math.PI / 180 * a), this.camera.lookAt(new p.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(t) {
                this.config.cartoonQuality = t;
              }
            }
            r.numWorkers = 4, r.maxVolume = 64e3, r.surfaceTypeMap = {
              VDW: L.SurfaceType.VDW,
              MS: L.SurfaceType.MS,
              SAS: L.SurfaceType.SAS,
              SES: L.SurfaceType.SES
            };
            function n(c, t) {
              if (c = (0, x.getElement)(c), !!c) {
                t = t || {};
                try {
                  var a = new r(c, t);
                  return a;
                } catch (h) {
                  throw "error creating viewer: " + h;
                }
              }
            }
            function b(c, t = {}, a = {}) {
              if (c = (0, x.getElement)(c), !!c) {
                var h = [], M = document.createElement("canvas");
                a.rows = t.rows, a.cols = t.cols, a.control_all = t.control_all != null ? t.control_all : !1, c.appendChild(M);
                try {
                  for (var w = 0; w < t.rows; w++) {
                    for (var S = [], T = 0; T < t.cols; T++) {
                      a.row = w, a.col = T, a.canvas = M, a.viewers = h, a.control_all = t.control_all;
                      var R = n(c, (0, x.extend)({}, a));
                      S.push(R);
                    }
                    h.unshift(S);
                  }
                } catch ($) {
                  throw "error creating viewer grid: " + $;
                }
                return h;
              }
            }
            function f(c) {
              var t = this;
              if (c = (0, x.getElement)(c), !!c) {
                var a = b(c, { rows: 1, cols: 2, control_all: !0 });
                this.glviewer1 = a[0][0], this.glviewer2 = a[0][1], this.glviewer1.setAutoEyeSeparation(!1), this.glviewer2.setAutoEyeSeparation(!0), this.glviewer1.linkViewer(this.glviewer2), this.glviewer2.linkViewer(this.glviewer1);
                for (var h = Object.getOwnPropertyNames(this.glviewer1.__proto__).filter(function(w) {
                  return typeof t.glviewer1[w] == "function";
                }), M = 0; M < h.length; M++)
                  this[h[M]] = /* @__PURE__ */ function(w) {
                    return function() {
                      var S = this.glviewer1[w].apply(this.glviewer1, arguments), T = this.glviewer2[w].apply(this.glviewer2, arguments);
                      return [S, T];
                    };
                  }(h[M]);
                this.setCoordinates = function(w, S, T) {
                  for (var R = 0; R < w.length; R++)
                    w[R].setCoordinates(S, T);
                }, this.surfacesFinished = function() {
                  return this.glviewer1.surfacesFinished() && this.glviewer2.surfacesFinished();
                }, this.isAnimated = function() {
                  return this.glviewer1.isAnimated() || this.glviewer2.isAnimated();
                }, this.render = function(w) {
                  this.glviewer1.render(), this.glviewer2.render(), w && w(this);
                }, this.getCanvas = function() {
                  return this.glviewer1.getCanvas();
                };
              }
            }
          }
        ),
        /***/
        "./src/Gradient.ts": (
          /*!*************************!*\
            !*** ./src/Gradient.ts ***!
            \*************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CustomLinear: () => (
                /* binding */
                u
              ),
              /* harmony export */
              Gradient: () => (
                /* binding */
                L
              ),
              /* harmony export */
              GradientType: () => (
                /* binding */
                p
              ),
              /* harmony export */
              ROYGB: () => (
                /* binding */
                g
              ),
              /* harmony export */
              RWB: () => (
                /* binding */
                o
              ),
              /* harmony export */
              Sinebow: () => (
                /* binding */
                E
              ),
              /* harmony export */
              builtinGradients: () => (
                /* binding */
                A
              ),
              /* harmony export */
              getGradient: () => (
                /* binding */
                x
              ),
              /* harmony export */
              normalizeValue: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./colors */
              "./src/colors.ts"
            );
            class p {
            }
            function _(C, D, r) {
              return D >= C ? (r < C && (r = C), r > D && (r = D), { lo: C, hi: D, val: r }) : (r > C && (r = C), r < D && (r = D), r = C - r + D, { lo: D, hi: C, val: r });
            }
            function x(C) {
              if (C instanceof p)
                return C;
              if (C.gradient !== void 0 && A[C.gradient]) {
                let D = C.min === void 0 ? -1 : C.min, r = C.max === void 0 ? 1 : C.max;
                return C.mid === void 0 ? C.colors === void 0 ? new A[C.gradient](D, r) : new A[C.gradient](D, r, C.colors) : new A[C.gradient](D, r, C.mid);
              }
              return C;
            }
            class o extends p {
              constructor(D, r, n) {
                super(), this.gradient = "RWB", this.mult = 1, this.mid = n, this.min = D, this.max = r, typeof r > "u" && Array.isArray(D) && D.length >= 2 ? (this.max = D[1], this.min = D[0]) : D && r && !Array.isArray(D) && (this.min = D, this.max = r);
              }
              //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(D, r) {
                var n, b;
                if (D = this.mult * D, r ? (n = r[0], b = r[1]) : (n = this.min, b = this.max), D === void 0)
                  return 16777215;
                var f = _(n, b, D);
                n = f.lo, b = f.hi, D = f.val;
                var c = (b + n) / 2;
                r && typeof r[2] < "u" ? c = r[2] : typeof this.mid < "u" ? c = this.mid : c = (n + b) / 2;
                var t, a;
                return D < c ? (t = Math.floor(255 * Math.sqrt((D - n) / (c - n))), a = 16711680 + 256 * t + t, a) : D > c ? (t = Math.floor(255 * Math.sqrt(1 - (D - c) / (b - c))), a = 65536 * t + 256 * t + 255, a) : 16777215;
              }
            }
            class g extends p {
              constructor(D, r) {
                super(), this.gradient = "ROYGB", this.mult = 1, this.min = D, this.max = r, typeof r > "u" && Array.isArray(D) && D.length >= 2 ? (this.max = D[1], this.min = D[0]) : D && r && !Array.isArray(D) && (this.min = D, this.max = r);
              }
              //map value to hex color, range is provided
              valueToHex(D, r) {
                var n, b;
                if (D = this.mult * D, r ? (n = r[0], b = r[1]) : (n = this.min, b = this.max), typeof D > "u")
                  return 16777215;
                var f = _(n, b, D);
                n = f.lo, b = f.hi, D = f.val;
                var c = (n + b) / 2, t = (n + c) / 2, a = (c + b) / 2, h, M;
                return D < t ? (h = Math.floor(255 * Math.sqrt((D - n) / (t - n))), M = 16711680 + 256 * h + 0, M) : D < c ? (h = Math.floor(255 * Math.sqrt(1 - (D - t) / (c - t))), M = 65536 * h + 65280 + 0, M) : D < a ? (h = Math.floor(255 * Math.sqrt((D - c) / (a - c))), M = 65280 + 1 * h, M) : (h = Math.floor(255 * Math.sqrt(1 - (D - a) / (b - a))), M = 0 + 256 * h + 255, 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;
              }
            }
            class E extends p {
              constructor(D, r) {
                super(), this.gradient = "Sinebow", this.mult = 1, this.min = D, this.max = r, typeof r > "u" && Array.isArray(D) && D.length >= 2 && (this.max = D[1], this.min = D[0]), r < D && (this.mult = -1, this.min *= -1, this.max *= -1);
              }
              //map value to hex color, range is provided
              valueToHex(D, r) {
                var n, b;
                if (D = this.mult * D, r ? (n = r[0], b = r[1]) : (n = this.min, b = this.max), typeof D > "u")
                  return 16777215;
                var f = L.normalizeValue(n, b, D);
                n = f.lo, b = f.hi, D = f.val;
                var c = (D - n) / (b - n), t = 5 * c / 6 + 0.5, a = Math.sin(Math.PI * t);
                a *= a * 255;
                var h = Math.sin(Math.PI * (t + 1 / 3));
                h *= h * 255;
                var M = Math.sin(Math.PI * (t + 2 / 3));
                return M *= M * 255, 65536 * Math.floor(a) + 256 * Math.floor(M) + 1 * Math.floor(h);
              }
              //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 u extends p {
              constructor(D, r, n) {
                super(), this.gradient = "linear", this.colors = new Array();
                var b;
                if (Array.isArray(D) && D.length >= 2 ? (this.max = D[1], this.min = D[0], b = r) : (this.min = D, this.max = r, b = n), b)
                  for (let f of b)
                    this.colors.push(l.CC.color(f));
                else
                  this.colors.push(l.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(D, r) {
                var n, b;
                if (r ? (n = r[0], b = r[1]) : (n = this.min, b = this.max), D === void 0)
                  return 16777215;
                var f = _(n, b, D);
                n = f.lo, b = f.hi, D = f.val;
                let c = this.colors.length, t = (b - n) / c, a = Math.min(Math.floor((D - n) / t), c - 1), h = Math.min(a + 1, c - 1), M = (D - n - a * t) / t, w = this.colors[a], S = this.colors[h];
                return new l.Color(w.r + M * (S.r - w.r), w.g + M * (S.g - w.g), w.b + M * (S.b - w.b)).getHex();
              }
            }
            const A = {
              rwb: o,
              RWB: o,
              roygb: g,
              ROYGB: g,
              sinebow: E,
              linear: u
            };
            class L extends p {
              valueToHex(D, r) {
                return 0;
              }
              range() {
                return null;
              }
            }
            L.RWB = o, L.ROYGB = g, L.Sinebow = E, L.CustomLinear = u, L.builtinGradients = A, L.normalizeValue = _, L.getGradient = x;
          }
        ),
        /***/
        "./src/Label.ts": (
          /*!**********************!*\
            !*** ./src/Label.ts ***!
            \**********************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Label: () => (
                /* binding */
                E
              ),
              /* harmony export */
              LabelCount: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), _ = e(
              /*! ./colors */
              "./src/colors.ts"
            );
            let x = 0;
            function o(u, A, L, C, D, r, n) {
              u.beginPath(), u.moveTo(A + r, L), u.lineTo(A + C - r, L), u.quadraticCurveTo(A + C, L, A + C, L + r), u.lineTo(A + C, L + D - r), u.quadraticCurveTo(A + C, L + D, A + C - r, L + D), u.lineTo(A + r, L + D), u.quadraticCurveTo(A, L + D, A, L + D - r), u.lineTo(A, L + r), u.quadraticCurveTo(A, L, A + r, L), u.closePath(), u.fill(), n && u.stroke();
            }
            function g(u, A, L) {
              var C = L;
              return typeof u < "u" && (u instanceof _.Color ? C = u.scaled() : (C = _.CC.color(u), typeof C.scaled < "u" && (C = C.scaled()))), typeof A < "u" && (C.a = parseFloat(A)), C;
            }
            class E {
              constructor(A, L) {
                this.id = x++, this.stylespec = L || {}, this.canvas = document.createElement("canvas"), this.canvas.width = 134, this.canvas.height = 35, this.context = this.canvas.getContext("2d"), this.sprite = new l.Sprite(), this.text = A, this.frame = this.stylespec.frame;
              }
              getStyle() {
                return this.stylespec;
              }
              setContext() {
                var A = this.stylespec, L = typeof A.useScreen > "u" ? !1 : A.useScreen, C = A.showBackground;
                (C === "0" || C === "false") && (C = !1), typeof C > "u" && (C = !0);
                var D = A.font ? A.font : "sans-serif", r = parseInt(A.fontSize) ? parseInt(A.fontSize) : 18, n = g(A.fontColor, A.fontOpacity, {
                  r: 255,
                  g: 255,
                  b: 255,
                  a: 1
                }), b = A.padding ? A.padding : 4, f = A.borderThickness ? A.borderThickness : 0, c = g(A.backgroundColor, A.backgroundOpacity, {
                  r: 0,
                  g: 0,
                  b: 0,
                  a: 1
                }), t = g(A.borderColor, A.borderOpacity, c), a = A.position ? A.position : {
                  x: -10,
                  y: 1,
                  z: 1
                }, h = A.inFront !== void 0 ? A.inFront : !0;
                (h === "false" || h === "0") && (h = !1);
                var M = A.alignment || l.SpriteAlignment.topLeft;
                typeof M == "string" && M in l.SpriteAlignment && (M = l.SpriteAlignment[M]);
                var w = "";
                A.bold && (w = "bold "), this.context.font = w + r + "px  " + D;
                var S = this.context.measureText(this.text), T = S.width;
                C || (f = 0);
                var R = T + 2.5 * f + 2 * b, $ = r * 1.25 + 2 * f + 2 * b;
                if (A.backgroundImage) {
                  var P = A.backgroundImage, B = A.backgroundWidth ? A.backgroundWidth : P.width, F = A.backgroundHeight ? A.backgroundHeight : P.height;
                  B > R && (R = B), F > $ && ($ = F);
                }
                if (this.canvas.width = R, this.canvas.height = $, this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), w = "", A.bold && (w = "bold "), this.context.font = w + r + "px  " + D, this.context.fillStyle = "rgba(" + c.r + "," + c.g + "," + c.b + "," + c.a + ")", this.context.strokeStyle = "rgba(" + t.r + "," + t.g + "," + t.b + "," + t.a + ")", A.backgroundGradient) {
                  let z = this.context.createLinearGradient(0, $ / 2, R, $ / 2), W = p.Gradient.getGradient(A.backgroundGradient), V = W.range(), N = -1, k = 1;
                  V && (N = V[0], k = V[1]);
                  let G = k - N;
                  for (let Q = 0; Q < 1.01; Q += 0.1) {
                    let ie = g(W.valueToHex(N + G * Q)), ge = "rgba(" + ie.r + "," + ie.g + "," + ie.b + "," + ie.a + ")";
                    z.addColorStop(Q, ge);
                  }
                  this.context.fillStyle = z;
                }
                this.context.lineWidth = f, C && o(this.context, f, f, R - 2 * f, $ - 2 * f, 6, f > 0), A.backgroundImage && this.context.drawImage(P, 0, 0, R, $), this.context.fillStyle = "rgba(" + n.r + "," + n.g + "," + n.b + "," + n.a + ")", this.context.fillText(this.text, f + b, r + f + b, T);
                var U = new l.Texture(this.canvas);
                U.needsUpdate = !0, this.sprite.material = new l.SpriteMaterial({
                  map: U,
                  useScreenCoordinates: L,
                  alignment: M,
                  depthTest: !h,
                  screenOffset: A.screenOffset || null
                }), this.sprite.scale.set(1, 1, 1), this.sprite.position.set(a.x, a.y, a.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 ***!
            \********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MarchingCube: () => (
                /* binding */
                g
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* binding */
                o
              ),
              /* harmony export */
              PointGrid: () => (
                /* binding */
                E
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* binding */
                u
              ),
              /* harmony export */
              SurfaceType: () => (
                /* binding */
                p
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* binding */
                x
              ),
              /* harmony export */
              syncSurface: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), p;
            (function(A) {
              A[A.VDW = 1] = "VDW", A[A.MS = 2] = "MS", A[A.SAS = 3] = "SAS", A[A.SES = 4] = "SES";
            })(p || (p = {}));
            var _ = !1;
            function x(A) {
              _ = A;
            }
            (window.navigator.userAgent.indexOf("MSIE ") >= 0 || window.navigator.userAgent.indexOf("Trident/") >= 0) && (_ = !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(L, C, D, r) {
                let n = !!r.fulltable, b = r.hasOwnProperty("origin") && r.origin.hasOwnProperty("x") ? r.origin : { x: 0, y: 0, z: 0 }, f = !!r.voxel, c = r.matrix, t = r.nX || 0, a = r.nY || 0, h = r.nZ || 0, M = r.scale || 1, w = null;
                r.unitCube ? w = r.unitCube : w = { x: M, y: M, z: M };
                let S = new Int32Array(t * a * h), T, R;
                for (T = 0, R = S.length; T < R; ++T)
                  S[T] = -1;
                let $ = function(U, z, W, V, N, k) {
                  let G = { x: 0, y: 0, z: 0 }, Q = !!(V & 1 << N), ie = !!(V & 1 << k), ge = N;
                  if (!Q && ie && (ge = k), ge & 1 && W++, ge & 2 && z++, ge & 4 && U++, c) {
                    let oe = new l.Vector3(U, z, W);
                    oe = oe.applyMatrix4(c), G = { x: oe.x, y: oe.y, z: oe.z };
                  } else
                    G.x = b.x + w.x * U, G.y = b.y + w.y * z, G.z = b.z + w.z * W;
                  let le = (a * U + z) * h + W;
                  return f ? (C.push(G), C.length - 1) : (S[le] < 0 && (S[le] = C.length, C.push(G)), S[le]);
                }, P = new Int32Array(12), B = n ? this.edgeTable2 : this.edgeTable, F = n ? this.triTable2 : this.triTable;
                for (T = 0; T < t - 1; ++T)
                  for (let U = 0; U < a - 1; ++U)
                    for (let z = 0; z < h - 1; ++z) {
                      let W = 0;
                      for (let k = 0; k < 8; ++k) {
                        let G = (a * (T + ((k & 4) >> 2)) + U + ((k & 2) >> 1)) * h + z + (k & 1), Q = !!(L[G] & this.ISDONE);
                        W |= Q << k;
                      }
                      if (W === 0 || W === 255)
                        continue;
                      let V = B[W];
                      if (V === 0)
                        continue;
                      let N = F[W];
                      V & 1 && (P[0] = $(T, U, z, W, 0, 1)), V & 2 && (P[1] = $(T, U, z, W, 1, 3)), V & 4 && (P[2] = $(T, U, z, W, 3, 2)), V & 8 && (P[3] = $(T, U, z, W, 2, 0)), V & 16 && (P[4] = $(T, U, z, W, 4, 5)), V & 32 && (P[5] = $(T, U, z, W, 5, 7)), V & 64 && (P[6] = $(T, U, z, W, 7, 6)), V & 128 && (P[7] = $(T, U, z, W, 6, 4)), V & 256 && (P[8] = $(T, U, z, W, 0, 4)), V & 512 && (P[9] = $(T, U, z, W, 1, 5)), V & 1024 && (P[10] = $(T, U, z, W, 3, 7)), V & 2048 && (P[11] = $(T, U, z, W, 2, 6));
                      for (let k = 0; k < N.length; k += 3) {
                        let G = P[N[k]], Q = P[N[k + 1]], ie = P[N[k + 2]];
                        f && k >= 3 && (C.push(C[G]), G = C.length - 1, C.push(C[Q]), Q = C.length - 1, C.push(C[ie]), ie = C.length - 1), D.push(G), D.push(Q), D.push(ie);
                      }
                    }
              }
              laplacianSmooth(L, C, D) {
                let r = new Array(C.length), n, b, f, c, t;
                for (n = 0, b = C.length; n < b; n++)
                  r[n] = {
                    x: 0,
                    y: 0,
                    z: 0
                  };
                let a = new Array(20), h;
                for (n = 0; n < 20; n++)
                  a[n] = new Array(C.length);
                for (n = 0, b = C.length; n < b; n++)
                  a[0][n] = 0;
                for (n = 0, b = D.length / 3; n < b; n++) {
                  let S = n * 3, T = n * 3 + 1, R = n * 3 + 2;
                  for (h = !0, f = 0, c = a[0][D[S]]; f < c; f++)
                    if (D[T] == a[f + 1][D[S]]) {
                      h = !1;
                      break;
                    }
                  for (h && (a[0][D[S]]++, a[a[0][D[S]]][D[S]] = D[T]), h = !0, f = 0, c = a[0][D[S]]; f < c; f++)
                    if (D[R] == a[f + 1][D[S]]) {
                      h = !1;
                      break;
                    }
                  for (h && (a[0][D[S]]++, a[a[0][D[S]]][D[S]] = D[R]), h = !0, f = 0, c = a[0][D[T]]; f < c; f++)
                    if (D[S] == a[f + 1][D[T]]) {
                      h = !1;
                      break;
                    }
                  for (h && (a[0][D[T]]++, a[a[0][D[T]]][D[T]] = D[S]), h = !0, f = 0, c = a[0][D[T]]; f < c; f++)
                    if (D[R] == a[f + 1][D[T]]) {
                      h = !1;
                      break;
                    }
                  for (h && (a[0][D[T]]++, a[a[0][D[T]]][D[T]] = D[R]), h = !0, f = 0; f < a[0][D[R]]; f++)
                    if (D[S] == a[f + 1][D[R]]) {
                      h = !1;
                      break;
                    }
                  for (h && (a[0][D[R]]++, a[a[0][D[R]]][D[R]] = D[S]), h = !0, f = 0, c = a[0][D[R]]; f < c; f++)
                    if (D[T] == a[f + 1][D[R]]) {
                      h = !1;
                      break;
                    }
                  h && (a[0][D[R]]++, a[a[0][D[R]]][D[R]] = D[T]);
                }
                let M = 1, w = 0.5;
                for (t = 0; t < L; t++) {
                  for (n = 0, b = C.length; n < b; n++)
                    if (a[0][n] < 3)
                      r[n].x = C[n].x, r[n].y = C[n].y, r[n].z = C[n].z;
                    else if (a[0][n] == 3 || a[0][n] == 4) {
                      for (r[n].x = 0, r[n].y = 0, r[n].z = 0, f = 0, c = a[0][n]; f < c; f++)
                        r[n].x += C[a[f + 1][n]].x, r[n].y += C[a[f + 1][n]].y, r[n].z += C[a[f + 1][n]].z;
                      r[n].x += w * C[n].x, r[n].y += w * C[n].y, r[n].z += w * C[n].z, r[n].x /= w + a[0][n], r[n].y /= w + a[0][n], r[n].z /= w + a[0][n];
                    } else {
                      for (r[n].x = 0, r[n].y = 0, r[n].z = 0, f = 0, c = a[0][n]; f < c; f++)
                        r[n].x += C[a[f + 1][n]].x, r[n].y += C[a[f + 1][n]].y, r[n].z += C[a[f + 1][n]].z;
                      r[n].x += M * C[n].x, r[n].y += M * C[n].y, r[n].z += M * C[n].z, r[n].x /= M + a[0][n], r[n].y /= M + a[0][n], r[n].z /= M + a[0][n];
                    }
                  for (n = 0, b = C.length; n < b; n++)
                    C[n].x = r[n].x, C[n].y = r[n].y, C[n].z = r[n].z;
                }
              }
            }
            let g = new o();
            class E {
              constructor(L, C, D) {
                this.data = new Int32Array(L * C * D * 3), this.width = C, this.height = D;
              }
              // set position x,y,z to pt, which has ix,iy,and iz
              set(L, C, D, r) {
                let n = ((L * this.width + C) * this.height + D) * 3;
                this.data[n] = r.ix, this.data[n + 1] = r.iy, this.data[n + 2] = r.iz;
              }
              // return point at x,y,z
              get(L, C, D) {
                let r = ((L * this.width + C) * this.height + D) * 3;
                return {
                  ix: this.data[r],
                  iy: this.data[r + 1],
                  iz: this.data[r + 2]
                };
              }
            }
            class u {
              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])
                ], u.MarchingCube || (u.MarchingCube = new o());
              }
              getVDWIndex(L) {
                return !L.elem || typeof this.vdwRadii[L.elem] > "u" ? "X" : L.elem;
              }
              getFacesAndVertices(L) {
                let C = {};
                for (let n = 0, b = L.length; n < b; n++)
                  C[L[n]] = !0;
                let D = this.verts;
                for (let n = 0, b = D.length; n < b; n++)
                  D[n].x = D[n].x / this.scaleFactor - this.ptranx, D[n].y = D[n].y / this.scaleFactor - this.ptrany, D[n].z = D[n].z / this.scaleFactor - this.ptranz;
                let r = [];
                for (let n = 0, b = this.faces.length; n < b; n += 3) {
                  let f = this.faces[n], c = this.faces[n + 1], t = this.faces[n + 2], a = D[f].atomid, h = D[c].atomid, M = D[t].atomid, w = a;
                  h < w && (w = h), M < w && (w = M), C[w] && f !== c && c !== t && f !== t && (r.push(f), r.push(c), r.push(t));
                }
                return this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, {
                  vertices: D,
                  faces: r
                };
              }
              initparm(L, C, D) {
                D > 1e6 && (this.scaleFactor = this.defaultScaleFactor / 2);
                let r = 1 / this.scaleFactor * 5.5;
                this.pminx = L[0][0], this.pmaxx = L[1][0], this.pminy = L[0][1], this.pmaxy = L[1][1], this.pminz = L[0][2], this.pmaxz = L[1][2], C ? (this.pminx -= this.probeRadius + r, this.pminy -= this.probeRadius + r, this.pminz -= this.probeRadius + r, this.pmaxx += this.probeRadius + r, this.pmaxy += this.probeRadius + r, this.pmaxz += this.probeRadius + r) : (this.pminx -= r, this.pminy -= r, this.pminz -= r, this.pmaxx += r, this.pmaxy += r, this.pmaxz += r), 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(C), 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(L) {
                let C = {};
                for (const D in this.vdwRadii) {
                  let r = this.vdwRadii[D];
                  L ? C[D] = (r + this.probeRadius) * this.scaleFactor + 0.5 : C[D] = r * this.scaleFactor + 0.5;
                  let n = C[D] * C[D];
                  this.widxz[D] = Math.floor(C[D]) + 1, this.depty[D] = new Int32Array(this.widxz[D] * this.widxz[D]);
                  let b = 0;
                  for (let f = 0; f < this.widxz[D]; f++)
                    for (let c = 0; c < this.widxz[D]; c++) {
                      let t = f * f + c * c;
                      if (t > n)
                        this.depty[D][b] = -1;
                      else {
                        let a = Math.sqrt(n - t);
                        this.depty[D][b] = Math.floor(a);
                      }
                      b++;
                    }
                }
              }
              fillvoxels(L, C) {
                for (let D = 0, r = this.vpBits.length; D < r; D++)
                  this.vpBits[D] = 0, this.vpDistance[D] = -1, this.vpAtomID[D] = -1;
                for (let D in C) {
                  let r = L[C[D]];
                  r !== void 0 && this.fillAtom(r, L);
                }
                for (let D = 0, r = this.vpBits.length; D < r; D++)
                  this.vpBits[D] & this.INOUT && (this.vpBits[D] |= this.ISDONE);
              }
              fillAtom(L, C) {
                let D = Math.floor(0.5 + this.scaleFactor * (L.x + this.ptranx)), r = Math.floor(0.5 + this.scaleFactor * (L.y + this.ptrany)), n = Math.floor(0.5 + this.scaleFactor * (L.z + this.ptranz)), b = this.getVDWIndex(L), f = 0, c = this.pWidth * this.pHeight;
                for (let t = 0, a = this.widxz[b]; t < a; t++)
                  for (let h = 0; h < a; h++) {
                    if (this.depty[b][f] != -1) {
                      for (let M = -1; M < 2; M++)
                        for (let w = -1; w < 2; w++)
                          for (let S = -1; S < 2; S++)
                            if (M !== 0 && w !== 0 && S !== 0) {
                              let T = M * t, R = S * h;
                              for (let $ = 0; $ <= this.depty[b][f]; $++) {
                                let P = $ * w, B = D + T, F = r + P, U = n + R;
                                if (B < 0 || F < 0 || U < 0 || B >= this.pLength || F >= this.pWidth || U >= this.pHeight)
                                  continue;
                                let z = B * c + F * this.pHeight + U;
                                if (!(this.vpBits[z] & this.INOUT))
                                  this.vpBits[z] |= this.INOUT, this.vpAtomID[z] = L.serial;
                                else {
                                  let W = C[this.vpAtomID[z]];
                                  if (W.serial != L.serial) {
                                    let V = D + T - Math.floor(0.5 + this.scaleFactor * (W.x + this.ptranx)), N = r + P - Math.floor(0.5 + this.scaleFactor * (W.y + this.ptrany)), k = n + R - Math.floor(0.5 + this.scaleFactor * (W.z + this.ptranz));
                                    T * T + P * P + R * R < V * V + N * N + k * k && (this.vpAtomID[z] = L.serial);
                                  }
                                }
                              }
                            }
                    }
                    f++;
                  }
              }
              fillvoxelswaals(L, C) {
                for (let D = 0, r = this.vpBits.length; D < r; D++)
                  this.vpBits[D] &= ~this.ISDONE;
                for (let D in C) {
                  let r = L[C[D]];
                  r !== void 0 && this.fillAtomWaals(r, L);
                }
              }
              fillAtomWaals(L, C) {
                let D = 0, r = Math.floor(0.5 + this.scaleFactor * (L.x + this.ptranx)), n = Math.floor(0.5 + this.scaleFactor * (L.y + this.ptrany)), b = Math.floor(0.5 + this.scaleFactor * (L.z + this.ptranz)), f = this.getVDWIndex(L), c = this.pWidth * this.pHeight;
                for (let t = 0, a = this.widxz[f]; t < a; t++)
                  for (let h = 0; h < a; h++) {
                    if (this.depty[f][D] != -1) {
                      for (let M = -1; M < 2; M++)
                        for (let w = -1; w < 2; w++)
                          for (let S = -1; S < 2; S++)
                            if (M !== 0 && w !== 0 && S !== 0) {
                              let T = M * t, R = S * h;
                              for (let $ = 0; $ <= this.depty[f][D]; $++) {
                                let P = $ * w, B = r + T, F = n + P, U = b + R;
                                if (B < 0 || F < 0 || U < 0 || B >= this.pLength || F >= this.pWidth || U >= this.pHeight)
                                  continue;
                                let z = B * c + F * this.pHeight + U;
                                if (!(this.vpBits[z] & this.ISDONE))
                                  this.vpBits[z] |= this.ISDONE, this.vpAtomID[z] = L.serial;
                                else {
                                  let W = C[this.vpAtomID[z]];
                                  if (W.serial != L.serial) {
                                    let V = r + T - Math.floor(0.5 + this.scaleFactor * (W.x + this.ptranx)), N = n + P - Math.floor(0.5 + this.scaleFactor * (W.y + this.ptrany)), k = b + R - Math.floor(0.5 + this.scaleFactor * (W.z + this.ptranz));
                                    T * T + P * P + R * R < V * V + N * N + k * k && (this.vpAtomID[z] = L.serial);
                                  }
                                }
                              }
                            }
                    }
                    D++;
                  }
              }
              buildboundary() {
                let L = this.pWidth * this.pHeight;
                for (let C = 0; C < this.pLength; C++)
                  for (let D = 0; D < this.pHeight; D++)
                    for (let r = 0; r < this.pWidth; r++) {
                      let n = C * L + r * this.pHeight + D;
                      if (this.vpBits[n] & this.INOUT) {
                        let b = 0;
                        for (; b < 26; ) {
                          let f = C + this.nb[b][0], c = D + this.nb[b][2], t = r + this.nb[b][1];
                          if (f > -1 && f < this.pLength && t > -1 && t < this.pWidth && c > -1 && c < this.pHeight && !(this.vpBits[f * L + t * this.pHeight + c] & this.INOUT)) {
                            this.vpBits[n] |= this.ISBOUND;
                            break;
                          } else
                            b++;
                        }
                      }
                    }
              }
              fastdistancemap() {
                let L = new E(this.pLength, this.pWidth, this.pHeight), C = this.pWidth * this.pHeight, D = this.cutRadius * this.cutRadius, r = [], n = [], b;
                for (let t = 0; t < this.pLength; t++)
                  for (let a = 0; a < this.pWidth; a++)
                    for (let h = 0; h < this.pHeight; h++)
                      if (b = t * C + a * this.pHeight + h, this.vpBits[b] &= ~this.ISDONE, this.vpBits[b] & this.INOUT && this.vpBits[b] & this.ISBOUND) {
                        let M = {
                          ix: t,
                          iy: a,
                          iz: h
                        };
                        L.set(t, a, h, M), r.push(M), this.vpDistance[b] = 0, this.vpBits[b] |= this.ISDONE, this.vpBits[b] &= ~this.ISBOUND;
                      }
                do {
                  n = this.fastoneshell(r, L), r = [];
                  for (let t = 0, a = n.length; t < a; t++)
                    b = C * n[t].ix + this.pHeight * n[t].iy + n[t].iz, this.vpBits[b] &= ~this.ISBOUND, this.vpDistance[b] <= 1.0404 * D && r.push({
                      ix: n[t].ix,
                      iy: n[t].iy,
                      iz: n[t].iz
                    });
                } while (r.length !== 0);
                r = [], n = [], L = null;
                let f = this.scaleFactor - 0.5;
                f < 0 && (f = 0);
                let c = D - 0.5 / (0.1 + f);
                for (let t = 0; t < this.pLength; t++)
                  for (let a = 0; a < this.pWidth; a++)
                    for (let h = 0; h < this.pHeight; h++)
                      b = t * C + a * this.pHeight + h, this.vpBits[b] &= ~this.ISBOUND, this.vpBits[b] & this.INOUT && (!(this.vpBits[b] & this.ISDONE) || this.vpBits[b] & this.ISDONE && this.vpDistance[b] >= c) && (this.vpBits[b] |= this.ISBOUND);
              }
              fastoneshell(L, C) {
                let D, r, n, b, f, c, t, a, h, M = [];
                if (L.length === 0)
                  return M;
                let w = {
                  ix: -1,
                  iy: -1,
                  iz: -1
                }, S = this.pWidth * this.pHeight;
                for (let T = 0, R = L.length; T < R; T++) {
                  D = L[T].ix, r = L[T].iy, n = L[T].iz, a = C.get(D, r, n);
                  for (let $ = 0; $ < 6; $++)
                    w.ix = D + this.nb[$][0], w.iy = r + this.nb[$][1], w.iz = n + this.nb[$][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (h = w.ix * S + this.pHeight * w.iy + w.iz, this.vpBits[h] & this.INOUT && !(this.vpBits[h] & this.ISDONE) ? (C.set(w.ix, w.iy, n + this.nb[$][2], a), b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, this.vpDistance[h] = t, this.vpBits[h] |= this.ISDONE, this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[h] & this.INOUT && this.vpBits[h] & this.ISDONE && (b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, t < this.vpDistance[h] && (C.set(w.ix, w.iy, w.iz, a), this.vpDistance[h] = t, this.vpBits[h] & this.ISBOUND || (this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                for (let T = 0, R = L.length; T < R; T++) {
                  D = L[T].ix, r = L[T].iy, n = L[T].iz, a = C.get(D, r, n);
                  for (let $ = 6; $ < 18; $++)
                    w.ix = D + this.nb[$][0], w.iy = r + this.nb[$][1], w.iz = n + this.nb[$][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (h = w.ix * S + this.pHeight * w.iy + w.iz, this.vpBits[h] & this.INOUT && !(this.vpBits[h] & this.ISDONE) ? (C.set(w.ix, w.iy, n + this.nb[$][2], a), b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, this.vpDistance[h] = t, this.vpBits[h] |= this.ISDONE, this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[h] & this.INOUT && this.vpBits[h] & this.ISDONE && (b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, t < this.vpDistance[h] && (C.set(w.ix, w.iy, w.iz, a), this.vpDistance[h] = t, this.vpBits[h] & this.ISBOUND || (this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                for (let T = 0, R = L.length; T < R; T++) {
                  D = L[T].ix, r = L[T].iy, n = L[T].iz, a = C.get(D, r, n);
                  for (let $ = 18; $ < 26; $++)
                    w.ix = D + this.nb[$][0], w.iy = r + this.nb[$][1], w.iz = n + this.nb[$][2], w.ix < this.pLength && w.ix > -1 && w.iy < this.pWidth && w.iy > -1 && w.iz < this.pHeight && w.iz > -1 && (h = w.ix * S + this.pHeight * w.iy + w.iz, this.vpBits[h] & this.INOUT && !(this.vpBits[h] & this.ISDONE) ? (C.set(w.ix, w.iy, n + this.nb[$][2], a), b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, this.vpDistance[h] = t, this.vpBits[h] |= this.ISDONE, this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })) : this.vpBits[h] & this.INOUT && this.vpBits[h] & this.ISDONE && (b = w.ix - a.ix, f = w.iy - a.iy, c = w.iz - a.iz, t = b * b + f * f + c * c, t < this.vpDistance[h] && (C.set(w.ix, w.iy, w.iz, a), this.vpDistance[h] = t, this.vpBits[h] & this.ISBOUND || (this.vpBits[h] |= this.ISBOUND, M.push({
                      ix: w.ix,
                      iy: w.iy,
                      iz: w.iz
                    })))));
                }
                return M;
              }
              marchingcubeinit(L) {
                for (let C = 0, D = this.vpBits.length; C < D; C++)
                  L == 1 ? this.vpBits[C] &= ~this.ISBOUND : L == 4 ? (this.vpBits[C] &= ~this.ISDONE, this.vpBits[C] & this.ISBOUND && (this.vpBits[C] |= this.ISDONE), this.vpBits[C] &= ~this.ISBOUND) : L == 2 ? this.vpBits[C] & this.ISBOUND && this.vpBits[C] & this.ISDONE ? this.vpBits[C] &= ~this.ISBOUND : this.vpBits[C] & this.ISBOUND && !(this.vpBits[C] & this.ISDONE) && (this.vpBits[C] |= this.ISDONE) : L == 3 && (this.vpBits[C] &= ~this.ISBOUND);
              }
              marchingcube(L) {
                this.marchingcubeinit(L), this.verts = [], this.faces = [], u.MarchingCube.march(this.vpBits, this.verts, this.faces, {
                  smooth: 1,
                  nX: this.pLength,
                  nY: this.pWidth,
                  nZ: this.pHeight
                });
                let C = this.pWidth * this.pHeight;
                for (let D = 0, r = this.verts.length; D < r; D++)
                  this.verts[D].atomid = this.vpAtomID[this.verts[D].x * C + this.pHeight * this.verts[D].y + this.verts[D].z];
                u.MarchingCube.laplacianSmooth(1, this.verts, this.faces);
              }
            }
            u.MarchingCube = new o();
          }
        ),
        /***/
        "./src/VolumeData.ts": (
          /*!***************************!*\
            !*** ./src/VolumeData.ts ***!
            \***************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              VolumeData: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utilities */
              "./src/utilities.ts"
            ), p = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), _ = e(
              /*! ./parsers/VASP */
              "./src/parsers/VASP.ts"
            ), x = e(
              /*! ./parsers/CUBE */
              "./src/parsers/CUBE.ts"
            ), o = e(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            );
            class g {
              constructor(u, A, L) {
                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(b) {
                  var f = b / (this.size.y * this.size.z), c = b % (this.size.y * this.size.z), t = b % this.size.z;
                  return f *= this.unit.x, c *= this.unit.y, t *= this.unit.z, f += this.origin.x, c += this.origin.y, t += this.origin.z, { x: f, y: c, z: t };
                }, this.vasp = function(b) {
                  var f = b.replace(/^\s+/, "").split(/[\n\r]/), c = (0, _.VASP)(b)[0], t = c.length;
                  if (t == 0) {
                    console.log("No good formating of CHG or CHGCAR file, not atomic information provided in the file."), this.data = [];
                    return;
                  }
                  var a = 1.889725992, h = 0.036749309, M = parseFloat(f[1]), w;
                  w = f[2].replace(/^\s+/, "").split(/\s+/);
                  var S = new p.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(M * a);
                  w = f[3].replace(/^\s+/, "").split(/\s+/);
                  var T = new p.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(M * a);
                  w = f[4].replace(/^\s+/, "").split(/\s+/);
                  var R = new p.Vector3(parseFloat(w[0]), parseFloat(w[1]), parseFloat(w[2])).multiplyScalar(M * a), $ = S.x * (T.y * R.z - R.y * T.z) - T.x * (S.y * R.z - R.y * S.z) + R.x * (S.y * T.z - T.y * S.z);
                  $ = Math.abs($) / Math.pow(a, 3);
                  var P = 1 / $;
                  f.splice(0, 8 + t + 1);
                  var B = f[0].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), F = Math.abs(parseFloat(B[0])), U = Math.abs(parseFloat(B[1])), z = Math.abs(parseFloat(B[2])), W = this.origin = new p.Vector3(0, 0, 0);
                  this.size = { x: F, y: U, z }, this.unit = new p.Vector3(S.x, T.y, R.z), S = S.multiplyScalar(1 / (a * F)), T = T.multiplyScalar(1 / (a * U)), R = R.multiplyScalar(1 / (a * z)), (S.y != 0 || S.z != 0 || T.x != 0 || T.z != 0 || R.x != 0 || R.y != 0) && (this.matrix = new p.Matrix4(S.x, T.x, R.x, 0, S.y, T.y, R.y, 0, S.z, T.z, R.z, 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new p.Matrix4().makeTranslation(W.x, W.y, W.z)), this.origin = new p.Vector3(0, 0, 0), this.unit = new p.Vector3(1, 1, 1)), f.splice(0, 1);
                  var V = f.join(" ");
                  V = V.replace(/^\s+/, "");
                  var N = V.split(/[\s\r]+/);
                  N.splice(F * U * z + 1);
                  for (var k = Float32Array.from(N, parseFloat), G = 0; G < k.length; G++)
                    k[G] = k[G] * P * h;
                  this.data = k;
                }, this.dx = function(b) {
                  var f = b.split(/[\n\r]+/), c, t = /gridpositions\s+counts\s+(\d+)\s+(\d+)\s+(\d+)/, a = /^origin\s+(\S+)\s+(\S+)\s+(\S+)/, h = /^delta\s+(\S+)\s+(\S+)\s+(\S+)/, M = /data follows/, w = 0;
                  for (w = 0; w < f.length; w++) {
                    var S = f[w];
                    if (c = t.exec(S)) {
                      var T = parseInt(c[1]), R = parseInt(c[2]), $ = parseInt(c[3]);
                      this.size = { x: T, y: R, z: $ };
                    } else if (c = h.exec(S)) {
                      var P = parseFloat(c[1]);
                      if ((parseFloat(c[2]) != 0 || parseFloat(c[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), w += 1, S = f[w], c = h.exec(S), c == null) {
                        console.log("Parse error in dx delta matrix");
                        return;
                      }
                      var B = parseFloat(c[2]);
                      if ((parseFloat(c[1]) != 0 || parseFloat(c[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), w += 1, S = f[w], c = h.exec(S), c == null) {
                        console.log("Parse error in dx delta matrix");
                        return;
                      }
                      var F = parseFloat(c[3]);
                      (parseFloat(c[1]) != 0 || parseFloat(c[2]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), this.unit = new p.Vector3(P, B, F);
                    } else if (c = a.exec(S)) {
                      var U = parseFloat(c[1]), z = parseFloat(c[2]), W = parseFloat(c[3]);
                      this.origin = new p.Vector3(U, z, W);
                    } else if (c = M.exec(S))
                      break;
                  }
                  if (w += 1, !this.size || !this.origin || !this.unit || !this.size) {
                    console.log("Error parsing dx format");
                    return;
                  }
                  var V = f.splice(w).join(" "), N = V.split(/[\s\r]+/);
                  this.data = Float32Array.from(N, parseFloat);
                }, A = A.toLowerCase(), /\.gz$/.test(A)) {
                  A = A.replace(/\.gz$/, "");
                  try {
                    this[A] && this.isbinary.has(A) ? (typeof u == "string" && (u = (0, l.base64ToArray)(u)), u = (0, o.inflate)(u)) : u = new TextDecoder("utf-8").decode((0, o.inflate)(u));
                  } catch (b) {
                    console.log(b);
                  }
                }
                if (this[A] && (this.isbinary.has(A) && typeof u == "string" && (u = (0, l.base64ToArray)(u)), this[A](u)), L) {
                  if (L.negate)
                    for (let b = 0, f = this.data.length; b < f; b++)
                      this.data[b] = -this.data[b];
                  if (L.normalize) {
                    var C = 0;
                    for (let b = 0, f = this.data.length; b < f; b++)
                      C += this.data[b];
                    var D = C / this.data.length;
                    C = 0;
                    for (let b = 0, f = this.data.length; b < f; b++) {
                      var r = this.data[b] - D;
                      C += r * r;
                    }
                    var n = C / this.data.length;
                    for (let b = 0, f = this.data.length; b < f; b++)
                      this.data[b] = (this.data[b] - D) / n;
                  }
                }
              }
              /**
               * @function $3Dmol.VolumeData.getIndex
               * @param {number} x,y,z - the coordinates
               * @returns - index into flat array closest to provided coordinate; -1 if invalid
               */
              getIndex(u, A, L) {
                if (this.matrix) {
                  this.inversematrix == null && (this.inversematrix = new p.Matrix4().getInverse(this.matrix));
                  var C = new p.Vector3(u, A, L);
                  C = C.applyMatrix4(this.inversematrix), u = C.x, A = C.y, L = C.z;
                } else
                  u -= this.origin.x, A -= this.origin.y, L -= this.origin.z, u /= this.unit.x, A /= this.unit.y, L /= this.unit.z;
                return u = Math.round(u), A = Math.round(A), L = Math.round(L), u < 0 || u >= this.size.x || A < 0 || A >= this.size.y || L < 0 || L >= this.size.z ? -1 : u * this.size.y * this.size.z + A * this.size.z + L;
              }
              /**
               * @function $3Dmol.VolumeData.getVal
               * @param {number} x,y,z - the coordinates
               * @returns - value closest to provided coordinate; zero if coordinate invalid
               */
              getVal(u, A, L) {
                let C = this.getIndex(u, A, L);
                return C < 0 ? 0 : this.data[C];
              }
              // parse cube data
              cube(u) {
                var A = u.split(/\r?\n/);
                if (!(A.length < 6)) {
                  var L = (0, x.CUBE)(u, {}).modelData[0].cryst, C = A[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), D = parseFloat(C[0]), r = Math.abs(D);
                  this.origin = L.origin, this.size = L.size, this.unit = L.unit, this.matrix = L.matrix4;
                  var n = 6;
                  D < 0 && n++;
                  var b = A.splice(r + n).join(" ");
                  b = b.replace(/^\s+/, "");
                  var f = b.split(/[\s\r]+/);
                  this.data = Float32Array.from(f, parseFloat);
                }
              }
              //parse cp4 files
              ccp4(u) {
                var A = {};
                u = new Int8Array(u);
                var L = new Int32Array(u.buffer, 0, 56), C = new Float32Array(u.buffer, 0, 56), D = new DataView(u.buffer);
                if (A.MAP = String.fromCharCode(D.getUint8(208), D.getUint8(209), D.getUint8(210), D.getUint8(211)), A.MACHST = [D.getUint8(212), D.getUint8(213)], A.MACHST[0] === 17 && A.MACHST[1] === 17)
                  for (var r = u.byteLength, n = 0; n < r; n += 4)
                    D.setFloat32(n, D.getFloat32(n), !0);
                A.NX = L[0], A.NY = L[1], A.NZ = L[2], A.MODE = L[3], A.NXSTART = L[4], A.NYSTART = L[5], A.NZSTART = L[6], A.MX = L[7], A.MY = L[8], A.MZ = L[9], A.xlen = C[10], A.ylen = C[11], A.zlen = C[12], A.alpha = C[13], A.beta = C[14], A.gamma = C[15], A.MAPC = L[16], A.MAPR = L[17], A.MAPS = L[18], A.DMIN = C[19], A.DMAX = C[20], A.DMEAN = C[21], A.ISPG = L[22], A.NSYMBT = L[23], A.LSKFLG = L[24], A.originX = C[49], A.originY = C[50], A.originZ = C[51], A.ARMS = C[54];
                var b = A, f = [
                  b.xlen,
                  0,
                  0
                ], c = [
                  b.ylen * Math.cos(Math.PI / 180 * b.gamma),
                  b.ylen * Math.sin(Math.PI / 180 * b.gamma),
                  0
                ], t = [
                  b.zlen * Math.cos(Math.PI / 180 * b.beta),
                  b.zlen * (Math.cos(Math.PI / 180 * b.alpha) - Math.cos(Math.PI / 180 * b.gamma) * Math.cos(Math.PI / 180 * b.beta)) / Math.sin(Math.PI / 180 * b.gamma),
                  0
                ];
                t[2] = Math.sqrt(b.zlen * b.zlen * Math.sin(Math.PI / 180 * b.beta) * Math.sin(Math.PI / 180 * b.beta) - t[1] * t[1]);
                var a = [0, f, c, t], h = [0, b.MX, b.MY, b.MZ], M = [0, b.MAPC, b.MAPR, b.MAPS];
                this.matrix = new p.Matrix4(), this.matrix.set(a[M[1]][0] / h[M[1]], a[M[2]][0] / h[M[2]], a[M[3]][0] / h[M[3]], 0, a[M[1]][1] / h[M[1]], a[M[2]][1] / h[M[2]], a[M[3]][1] / h[M[3]], 0, a[M[1]][2] / h[M[1]], a[M[2]][2] / h[M[2]], a[M[3]][2] / h[M[3]], 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new p.Matrix4().makeTranslation(b.NXSTART + b.originX, b.NYSTART + b.originY, b.NZSTART + b.originZ)), this.origin = new p.Vector3(0, 0, 0), this.unit = new p.Vector3(1, 1, 1), this.size = { x: A.NX, y: A.NY, z: A.NZ }, this.dimensionorder = [A.MAPC, A.MAPR, A.MAPS];
                var w = new Float32Array(u.buffer, 1024 + A.NSYMBT), S = A.NX, T = A.NY, R = A.NZ;
                this.data = new Float32Array(S * T * R);
                for (let $ = 0; $ < S; $++)
                  for (let P = 0; P < T; P++)
                    for (let B = 0; B < R; B++)
                      this.data[($ * T + P) * R + B] = w[(B * T + P) * S + $];
              }
            }
          }
        ),
        /***/
        "./src/VolumetricRender.ts": (
          /*!*********************************!*\
            !*** ./src/VolumetricRender.ts ***!
            \*********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              GLVolumetricRender: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), p = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), _ = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), x = e(
              /*! ./colors */
              "./src/colors.ts"
            ), o = e(
              /*! ./GLShape */
              "./src/GLShape.ts"
            );
            class g {
              static interpolateArray(u, A) {
                function L(t, a, h) {
                  return t + (a - t) * h;
                }
                var C = [], D = (u.length - 1) / (A - 1);
                C[0] = u[0];
                for (var r = 1; r < A - 1; r++) {
                  var n = r * D, b = Math.floor(n), f = Math.ceil(n), c = n - b;
                  C[r] = L(u[b], u[f], c);
                }
                return C[A - 1] = u[u.length - 1], C;
              }
              constructor(u, A) {
                this.hidden = !1, this.boundingSphere = new l.Sphere(), this.renderedShapeObj = null, this.shapeObj = null, this.subsamples = 5, this.data = null, this.transferfunctionbuffer = [], this.min = 0, this.max = 0, A = A || {};
                var L = Object.assign([], A.transferfn);
                this.subsamples = A.subsamples || 5;
                let C = 256;
                L.forEach(function(S) {
                  S.value = parseFloat(S.value);
                }), L.sort(function(S, T) {
                  return S.value - T.value;
                }), this.min = L[0].value, L.length == 0 && L.push(L[0]), this.max = L[L.length - 1].value;
                var D, r, n, b, f, c, t, a, h, M;
                for (let S = 0; S < L.length - 1; S++)
                  if (n = x.CC.color(L[S].color), b = x.CC.color(L[S + 1].color), h = L[S].opacity, M = L[S + 1].opacity, D = Math.floor((L[S].value - this.min) * C / (this.max - this.min)), r = Math.floor((L[S + 1].value - this.min) * C / (this.max - this.min)), D != r) {
                    f = g.interpolateArray([n.r * 255, b.r * 255], r - D), c = g.interpolateArray([n.g * 255, b.g * 255], r - D), t = g.interpolateArray([n.b * 255, b.b * 255], r - D), a = g.interpolateArray([h * 255, M * 255], r - D);
                    for (let T = 0; T < f.length; T++)
                      this.transferfunctionbuffer.push(f[T]), this.transferfunctionbuffer.push(c[T]), this.transferfunctionbuffer.push(t[T]), this.transferfunctionbuffer.push(a[T]);
                  }
                if (this.transferfunctionbuffer = new Uint8ClampedArray(this.transferfunctionbuffer), u.matrix) {
                  let S = new p.Vector3(0, 0, 0), T = new p.Vector3(u.size.x, u.size.y, u.size.z), R = new p.Vector3(1, 1, 1);
                  S.applyMatrix4(u.matrix), T.applyMatrix4(u.matrix), R.applyMatrix4(u.matrix).sub(S), this.extent = [[S.x, S.y, S.z], [T.x, T.y, T.z]];
                  for (let F = 1; F < 7; F++)
                    T.x = F & 1 ? u.size.x : 0, T.y = F & 2 ? u.size.y : 0, T.z = F & 4 ? u.size.z : 0, T.applyMatrix4(u.matrix), this.extent[0][0] = Math.min(this.extent[0][0], T.x), this.extent[0][1] = Math.min(this.extent[0][1], T.y), this.extent[0][2] = Math.min(this.extent[0][2], T.z), this.extent[1][0] = Math.max(this.extent[1][0], T.x), this.extent[1][1] = Math.max(this.extent[1][1], T.y), this.extent[1][2] = Math.max(this.extent[1][2], T.z);
                  let $ = T.x - S.x, P = T.y - S.y, B = T.z - S.z;
                  this.maxdepth = Math.sqrt($ * $ + P * P + B * B), this.minunit = Math.min(Math.min(R.x, R.y), R.z), this.texmatrix = new p.Matrix4().identity().scale({ x: u.size.x, y: u.size.y, z: u.size.z }), this.texmatrix = this.texmatrix.multiplyMatrices(u.matrix, this.texmatrix), this.texmatrix = this.texmatrix.getInverse(this.texmatrix);
                } else {
                  this.texmatrix = new p.Matrix4().identity();
                  let S = u.unit.x * u.size.x, T = u.unit.y * u.size.y, R = u.unit.z * u.size.z;
                  this.texmatrix.makeTranslation(-u.origin.x / S, -u.origin.y / T, -u.origin.z / R), this.texmatrix.scale({ x: 1 / S, y: 1 / T, z: 1 / R }), this.minunit = Math.min(Math.min(u.unit.x, u.unit.y), u.unit.z), this.extent = [
                    [u.origin.x, u.origin.y, u.origin.z],
                    [u.origin.x + S, u.origin.y + T, u.origin.z + R]
                  ], this.maxdepth = Math.sqrt(S * S + T * T + R * R);
                }
                var w = new o.GLShape({});
                if (w.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 = w.finalize(), this.boundingSphere.center = new p.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, A.coords !== void 0 && A.seldist !== void 0) {
                  let S = new Uint8Array(u.data.length), T = A.seldist, R = T * T;
                  for (let $ = 0, P = A.coords.length; $ < P; $++) {
                    let B = A.coords[$], F = B.x - T, U = B.y - T, z = B.z - T, W = B.x + T, V = B.y + T, N = B.z + T;
                    if (u.getIndex(F, U, z) >= 0 || u.getIndex(W, V, N) >= 0)
                      for (let k = F; k < W; k += this.minunit)
                        for (let G = U; G < V; G += this.minunit)
                          for (let Q = z; Q < N; Q += this.minunit) {
                            let ie = u.getIndex(k, G, Q);
                            ie >= 0 && !S[ie] && (k - B.x) * (k - B.x) + (G - B.y) * (G - B.y) + (Q - B.z) * (Q - B.z) < R && (S[ie] = 1);
                          }
                  }
                  for (let $ = 0, P = u.data.length; $ < P; $++)
                    S[$] == 0 && (u.data[$] = 1 / 0);
                }
                this.data = u;
              }
              /**
               * Initialize webgl objects for rendering
               * @param {Object3D} group
               *
               */
              globj(u) {
                if (this.renderedShapeObj && (u.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  this.shapeObj = new _.Object3D();
                  var A = null, L = new _.Texture(this.data, !0), C = new _.Texture(this.transferfunctionbuffer, !1);
                  L.needsUpdate = !0, C.needsUpdate = !0, C.flipY = !1, A = new _.VolumetricMaterial({
                    transferfn: C,
                    transfermin: this.min,
                    transfermax: this.max,
                    map: L,
                    extent: this.extent,
                    maxdepth: this.maxdepth,
                    texmatrix: this.texmatrix,
                    unit: this.minunit,
                    subsamples: this.subsamples
                  });
                  var D = new _.Mesh(this.geo, A);
                  this.shapeObj.add(D), this.renderedShapeObj = this.shapeObj.clone(), u.add(this.renderedShapeObj);
                }
              }
              removegl(u) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), u.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 ***!
            \*****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Camera: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), p = e(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            );
            class _ extends l.Object3D {
              constructor(o = 50, g = 1, E = 0.1, u = 2e3, A = !1) {
                super(), this.projectionMatrix = new p.Matrix4(), this.projectionMatrixInverse = new p.Matrix4(), this.matrixWorldInverse = new p.Matrix4(), this.fov = o, this.aspect = g, this.near = E, this.far = u;
                var L = this.position.z;
                this.right = L * Math.tan(Math.PI / 180 * o), this.left = -this.right, this.top = this.right / this.aspect, this.bottom = -this.top, this.ortho = !!A, this.updateProjectionMatrix();
              }
              lookAt(o) {
                this.matrix.lookAt(this.position, o, this.up), this.rotationAutoUpdate && (this.useQuaternion === !1 && this.rotation instanceof p.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 ***!
            \**************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Fog: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../colors */
              "./src/colors.ts"
            );
            class p {
              constructor(x, o = 1, g = 1e3) {
                this.name = "", this.color = new l.Color(x), this.near = o, this.far = g;
              }
              clone() {
                return new p(this.color.getHex(), this.near, this.far);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/Renderer.ts": (
          /*!*******************************!*\
            !*** ./src/WebGL/Renderer.ts ***!
            \*******************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Renderer: () => (
                /* binding */
                C
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), p = e(
              /*! ./constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), _ = e(
              /*! ./constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), x = e(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), o = e(
              /*! ../colors */
              "./src/colors.ts"
            ), g = e(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), E = e(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), u = e(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), A = e(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), L = e(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            );
            class C {
              constructor(r) {
                this.context = null, this.devicePixelRatio = 1, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, 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._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._projScreenMatrix = new E.Matrix4(), this._vector3 = new E.Vector3(), this._worldInverse = new E.Matrix4(), this._projInverse = new E.Matrix4(), this._textureMatrix = new E.Matrix4(), this._direction = new E.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 L.SpritePlugin(), this._screenshader = null, this._vertexattribpos = null, this._screenQuadVBO = null, this._fb = null, this._targetTexture = null, this._depthTexture = null, r = r || {}, this.row = r.row, this.col = r.col, this.rows = r.rows, this.cols = r.cols, this._canvas = r.canvas !== void 0 ? r.canvas : document.createElement("canvas"), this._precision = r.precision !== void 0 ? r.precision : "highp", this._alpha = r.alpha !== void 0 ? r.alpha : !0, this._premultipliedAlpha = r.premultipliedAlpha !== void 0 ? r.premultipliedAlpha : !0, this._antialias = r.antialias !== void 0 ? r.antialias : !1, this._stencil = r.stencil !== void 0 ? r.stencil : !0, this._preserveDrawingBuffer = r.preserveDrawingBuffer !== void 0 ? r.preserveDrawingBuffer : !1, this._clearColor = r.clearColor !== void 0 ? new o.Color(r.clearColor) : new o.Color(0), this._clearAlpha = r.clearAlpha !== void 0 ? r.clearAlpha : 0, this._outlineMaterial = new g.MeshOutlineMaterial(r.outline), this._outlineSphereImposterMaterial = new g.SphereImposterOutlineMaterial(r.outline), this._outlineStickImposterMaterial = new g.StickImposterOutlineMaterial(r.outline), this._outlineEnabled = !!r.outline, this.domElement = this._canvas, this._canvas.id = r.id, 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.isContextLost();
              }
              getPrecision() {
                return this._precision;
              }
              setClearColorHex(r, n) {
                this._clearColor.setHex(r), this._clearAlpha = n, this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha);
              }
              enableOutline(r) {
                this._outlineMaterial = new g.MeshOutlineMaterial(r), this._outlineSphereImposterMaterial = new g.SphereImposterOutlineMaterial(r), this._outlineStickImposterMaterial = new g.StickImposterOutlineMaterial(r), this._outlineEnabled = !0;
              }
              disableOutline() {
                this._outlineEnabled = !1;
              }
              setViewport() {
                if (this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var r = this._canvas.width / this.cols, n = this._canvas.height / this.rows;
                  this._viewportWidth = r, this._viewportHeight = n, this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(r * this.col, n * this.row, r, n), this._gl.viewport(r * this.col, n * this.row, r, n);
                }
              }
              setSize(r, n) {
                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 b = r / this.cols, f = n / this.rows;
                  this._canvas.width = r * this.devicePixelRatio, this._canvas.height = n * this.devicePixelRatio, this._viewportWidth = b * this.devicePixelRatio, this._viewportHeight = f * this.devicePixelRatio, this._canvas.style.width = r + "px", this._canvas.style.height = n + "px", this.setViewport();
                } else
                  this._viewportWidth = this._canvas.width = r * this.devicePixelRatio, this._viewportHeight = this._canvas.height = n * this.devicePixelRatio, this._canvas.style.width = r + "px", this._canvas.style.height = n + "px", this._gl.viewport(0, 0, this._gl.drawingBufferWidth, this._gl.drawingBufferHeight);
                this.initFrameBuffer();
              }
              clear(r, n, b) {
                var f = 0;
                (r === void 0 || r) && (f |= this._gl.COLOR_BUFFER_BIT), (n === void 0 || n) && (f |= this._gl.DEPTH_BUFFER_BIT), (b === void 0 || b) && (f |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(f);
              }
              clearTarget(r, n, b) {
                this.clear(r, n, b);
              }
              setMaterialFaces(r, n) {
                var b = r.side === p.DoubleSide, f = r.side === p.BackSide;
                r.imposter || (f = n ? !f : f), this._oldDoubleSided !== b && (b ? this._gl.disable(this._gl.CULL_FACE) : this._gl.enable(this._gl.CULL_FACE), this._oldDoubleSided = b), this._oldFlipSided !== f && (f ? this._gl.frontFace(this._gl.CW) : this._gl.frontFace(this._gl.CCW), this._oldFlipSided = f), this._gl.cullFace(this._gl.BACK);
              }
              setDepthTest(r) {
                this._oldDepthTest !== r && (r ? this._gl.enable(this._gl.DEPTH_TEST) : this._gl.disable(this._gl.DEPTH_TEST), this._oldDepthTest = r);
              }
              setDepthWrite(r) {
                this._oldDepthWrite !== r && (this._gl.depthMask(r), this._oldDepthWrite = r);
              }
              setBlending(r) {
                r ? (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(r, n, b, f) {
                r.addEventListener("dispose", this.onMaterialDispose.bind(this));
                var c, t;
                if (t = r.shaderID, t) {
                  var a = A.ShaderLib[t];
                  r.vertexShader = a.vertexShader, r.fragmentShader = a.fragmentShader, r.uniforms = A.ShaderUtils.clone(a.uniforms);
                }
                c = {
                  wireframe: r.wireframe,
                  fragdepth: r.imposter,
                  volumetric: r.volumetric
                }, r.program = this.buildProgram(r.fragmentShader, r.vertexShader, r.uniforms, c);
              }
              renderBuffer(r, n, b, f, c, t) {
                if (f.visible) {
                  var a, h;
                  if (a = this.setProgram(r, n, b, f, t, this), !!a) {
                    h = a.attributes;
                    var M = !1, w = f.wireframe ? 1 : 0, S = c.id * 16777215 + a.id * 2 + w;
                    S !== this._currentGeometryGroupHash && (this._currentGeometryGroupHash = S, M = !0), M && (this.disableAttributes(), h.position >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglVertexBuffer), this.enableAttribute(h.position), this._gl.vertexAttribPointer(h.position, 3, this._gl.FLOAT, !1, 0, 0)), h.color >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglColorBuffer), this.enableAttribute(h.color), this._gl.vertexAttribPointer(h.color, 3, this._gl.FLOAT, !1, 0, 0)), h.normal >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglNormalBuffer), this.enableAttribute(h.normal), this._gl.vertexAttribPointer(h.normal, 3, this._gl.FLOAT, !1, 0, 0)), h.offset >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglOffsetBuffer), this.enableAttribute(h.offset), this._gl.vertexAttribPointer(h.offset, 3, this._gl.FLOAT, !1, 0, 0)), h.radius >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglRadiusBuffer), this.enableAttribute(h.radius), this._gl.vertexAttribPointer(h.radius, 1, this._gl.FLOAT, !1, 0, 0)));
                    var T, R;
                    if (t instanceof u.Mesh) {
                      if (f.shaderID === "instanced") {
                        var $ = f.sphere.geometryGroups[0];
                        M && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, $.vertexArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, c.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, $.normalArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, $.faceArray, this._gl.STATIC_DRAW)), T = $.faceidx, this._extInstanced.vertexAttribDivisorANGLE(h.offset, 1), this._extInstanced.vertexAttribDivisorANGLE(h.radius, 1), this._extInstanced.vertexAttribDivisorANGLE(h.color, 1), this._extInstanced.drawElementsInstancedANGLE(this._gl.TRIANGLES, T, this._gl.UNSIGNED_SHORT, 0, c.radiusArray.length), this._extInstanced.vertexAttribDivisorANGLE(h.offset, 0), this._extInstanced.vertexAttribDivisorANGLE(h.radius, 0), this._extInstanced.vertexAttribDivisorANGLE(h.color, 0);
                      } else
                        f.wireframe ? (R = c.lineidx, this.setLineWidth(f.wireframeLinewidth), M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglLineBuffer), this._gl.drawElements(this._gl.LINES, R, this._gl.UNSIGNED_SHORT, 0)) : (T = c.faceidx, M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, c.__webglFaceBuffer), this._gl.drawElements(this._gl.TRIANGLES, T, this._gl.UNSIGNED_SHORT, 0));
                      this.info.render.calls++, this.info.render.vertices += T, this.info.render.faces += T / 3;
                    } else
                      t instanceof u.Line && (R = c.vertices, this.setLineWidth(f.linewidth), this._gl.drawArrays(this._gl.LINES, 0, R), this.info.render.calls++);
                  }
                }
              }
              render(r, n, b) {
                if (!(n instanceof l.Camera)) {
                  console.error("Renderer.render: camera is not an instance of Camera.");
                  return;
                }
                var f, c, t, a, h, M = r.__lights, w = r.fog;
                this._currentMaterialId = -1, this._lightsNeedUpdate = !0, this.autoUpdateScene && r.updateMatrixWorld(), n.parent === void 0 && n.updateMatrixWorld(), n.matrixWorldInverse.getInverse(n.matrixWorld), this._projScreenMatrix.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this.autoUpdateObjects && this.initWebGLObjects(r), 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.autoClear || b) && (this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha), this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil)), h = r.__webglObjects;
                var S = !1;
                for (f = 0, c = h.length; f < c; f++)
                  t = h[f], a = t.object, t.render = !1, a.visible && (this.setupMatrices(a, n), this.unrollBufferMaterial(t), t.render = !0, t.volumetric && (S = !0));
                var T = null;
                this.setBlending(!1), this.renderObjects(r.__webglObjects, !0, "opaque", n, M, w, !1, T), this.renderSprites(r, n, !1), this.renderObjects(r.__webglObjects, !0, "blank", n, M, w, !0, T), this.renderObjects(r.__webglObjects, !1, "transparent", n, M, w, !0, T), S && this._fb && (this.reinitFrameBuffer(), this.renderObjects(r.__webglObjects, !1, "volumetric", n, M, w, !0, T)), this.renderFrameBuffertoScreen(), this.setDepthTest(!0), this.setDepthWrite(!0), this.renderSprites(r, n, !0);
              }
              //reinitialize framebuffer without the depth texture attached so we can read to it
              //do not allocate new textures
              reinitFrameBuffer() {
                this.isWebGL1() || (this._fb = this._gl.createFramebuffer(), 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));
              }
              //setup framebuffer for drawing into, assumes buffers already allocated
              setFrameBuffer() {
                if (this.isWebGL1() || !this._fb)
                  return;
                let r = this._viewportWidth, n = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, r, n), this._gl.viewport(0, 0, r, n), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, r, n, 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, r, n, 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._depthTexture, 0);
              }
              //allocate buffers for framebuffer, needs to be called with every resize
              initFrameBuffer() {
                if (this.isWebGL1())
                  return;
                let r = this._viewportWidth, n = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, r, n), this._gl.viewport(0, 0, r, n), this._targetTexture = this._gl.createTexture(), this._depthTexture = this._gl.createTexture(), this._fb = this._gl.createFramebuffer();
                var b = A.ShaderLib.screen;
                this._screenshader = this.buildProgram(b.fragmentShader, b.vertexShader, b.uniforms, {}), this._vertexattribpos = this._gl.getAttribLocation(this._screenshader, "vertexPosition");
                var f = [
                  // 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(f), this._gl.STATIC_DRAW);
              }
              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(r) {
                if (r.__webglObjects || (r.__webglObjects = [], r.__webglObjectsImmediate = [], r.__webglSprites = [], r.__webglFlares = []), r.__objectsAdded.length) {
                  for (; r.__objectsAdded.length; )
                    this.addObject(r.__objectsAdded[0], r), r.__objectsAdded.splice(0, 1);
                  this._currentGeometryGroupHash = -1;
                }
                for (; r.__objectsRemoved.length; )
                  this.removeObject(r.__objectsRemoved[0], r), r.__objectsRemoved.splice(0, 1);
                for (var n = 0, b = r.__webglObjects.length; n < b; n++)
                  this.updateObject(r.__webglObjects[n].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(r, n) {
                (r == null || n == null) && (r = this._canvas.width, n = this._canvas.height);
                var b = r / n;
                if (this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var f = r / this.cols, c = n / this.rows;
                  b = f / c;
                }
                return b;
              }
              setTexture(r, n, b) {
                if (r.needsUpdate) {
                  r.__webglInit || (r.__webglInit = !0, r.addEventListener("dispose", this.onTextureDispose.bind(this)), r.__webglTexture = this._gl.createTexture(), this.info.memory.textures++), this._gl.activeTexture(this._gl.TEXTURE0 + n);
                  var f = b ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D;
                  this._gl.bindTexture(f, r.__webglTexture), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, r.flipY), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, r.premultiplyAlpha), this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, r.unpackAlignment), this._gl.pixelStorei(this._gl.PACK_ALIGNMENT, r.unpackAlignment);
                  var c = this.paramToGL(r.format), t = this.paramToGL(r.type);
                  if (b)
                    this.setTextureParameters(this._gl.TEXTURE_3D, r), this._gl.texImage3D(this._gl.TEXTURE_3D, 0, this._gl.R32F, r.image.size.z, r.image.size.y, r.image.size.x, 0, this._gl.RED, this._gl.FLOAT, r.image.data);
                  else {
                    var a = r.image, h = a.width, M = a.height;
                    typeof h > "u" && (h = a.length, c == this._gl.RGBA && (h /= 4), M = 1), this.setTextureParameters(this._gl.TEXTURE_2D, r), this.isWebGL1() ? this._gl.texImage2D(this._gl.TEXTURE_2D, 0, c, c, t, r.image) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, c, h, M, 0, c, t, r.image);
                  }
                  r.needsUpdate = !1, r.onUpdate && r.onUpdate();
                } else
                  this._gl.activeTexture(this._gl.TEXTURE0 + n), b ? this._gl.bindTexture(this._gl.TEXTURE_3D, r.__webglTexture) : this._gl.bindTexture(this._gl.TEXTURE_2D, r.__webglTexture);
              }
              supportsVolumetric() {
                return !this.isWebGL1();
              }
              enableAttribute(r) {
                this._enabledAttributes[r] || (this._gl.enableVertexAttribArray(r), this._enabledAttributes[r] = !0);
              }
              disableAttributes() {
                for (let r in this._enabledAttributes)
                  this._enabledAttributes[r] && (this._gl.disableVertexAttribArray(r), this._enabledAttributes[r] = !1);
              }
              setPolygonOffset(r, n, b) {
                this._oldPolygonOffset !== r && (r ? this._gl.enable(this._gl.POLYGON_OFFSET_FILL) : this._gl.disable(this._gl.POLYGON_OFFSET_FILL));
              }
              setLineWidth(r) {
                r !== this._oldLineWidth && (this._gl.lineWidth(r), this._oldLineWidth = r);
              }
              deallocateGeometry(r) {
                if (r.__webglInit = void 0, r.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(r.__webglVertexBuffer), r.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(r.__webglColorBuffer), r.geometryGroups !== void 0)
                  for (var n = 0, b = r.groups; n < b; n++) {
                    var f = r.geometryGroups[n];
                    f.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(f.__webglVertexBuffer), f.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(f.__webglColorBuffer), f.__webglNormalBuffer !== void 0 && this._gl.deleteBuffer(f.__webglNormalBuffer), f.__webglFaceBuffer !== void 0 && this._gl.deleteBuffer(f.__webglFaceBuffer), f.__webglLineBuffer !== void 0 && this._gl.deleteBuffer(f.__webglLineBuffer);
                  }
              }
              deallocateMaterial(r) {
                var n = r.program;
                if (n !== void 0) {
                  r.program = void 0;
                  var b, f, c, t = !1;
                  for (b = 0, f = this._programs.length; b < f; b++)
                    if (c = this._programs[b], c.program === n) {
                      c.usedTimes--, c.usedTimes === 0 && (t = !0);
                      break;
                    }
                  if (t === !0) {
                    var a = [];
                    for (b = 0, f = this._programs.length; b < f; b++)
                      c = this._programs[b], c.program !== n && a.push(c);
                    this._programs = a, this._gl.deleteProgram(n), this.info.memory.programs--;
                  }
                }
              }
              deallocateTexture(r) {
                if (r.image && r.image.__webglTextureCube)
                  this._gl.deleteTexture(r.image.__webglTextureCube);
                else {
                  if (!r.__webglInit)
                    return;
                  r.__webglInit = !1, this._gl.deleteTexture(r.__webglTexture);
                }
              }
              onGeometryDispose(r) {
                var n = r.target;
                n.removeEventListener("dispose", this.onGeometryDispose), this.deallocateGeometry(n), this.info.memory.geometries--;
              }
              onTextureDispose(r) {
                var n = r.target;
                n.removeEventListener("dispose", this.onTextureDispose), this.deallocateTexture(n), this.info.memory.textures--;
              }
              onMaterialDispose(r) {
                var n = r.target;
                n.removeEventListener("dispose", this.onMaterialDispose), this.deallocateMaterial(n);
              }
              // Compile and return shader
              getShader(r, n) {
                var b;
                return !this.isWebGL1() && !n.startsWith("#version") && (n = n.replace(/gl_FragDepthEXT/g, "gl_FragDepth"), r == "fragment" ? n = n.replace(/varying/g, "in") : n = n.replace(/varying/g, "out"), n = n.replace(/attribute/g, "in"), n = n.replace(/texture2D/g, "texture"), n = n.replace(/\/\/DEFINEFRAGCOLOR/g, "out vec4 glFragColor;"), n = n.replace(/gl_FragColor/g, "glFragColor"), n = `#version 300 es
` + n), r === "fragment" ? b = this._gl.createShader(this._gl.FRAGMENT_SHADER) : r === "vertex" && (b = this._gl.createShader(this._gl.VERTEX_SHADER)), b == null ? null : (this._gl.shaderSource(b, n), this._gl.compileShader(b), this._gl.getShaderParameter(b, this._gl.COMPILE_STATUS) ? b : (console.error(this._gl.getShaderInfoLog(b)), console.error("could not initialize shader"), null));
              }
              // Compile appropriate shaders (if necessary) from source code and attach to
              // gl program.
              buildProgram(r, n, b, f) {
                var c, t, a, h, M = [];
                M.push(r), M.push(n);
                for (c in f)
                  M.push(c), M.push(f[c]);
                for (h = M.join(), c = 0, t = this._programs.length; c < t; c++) {
                  var w = this._programs[c];
                  if (w.code === h)
                    return w.usedTimes++, w.program;
                }
                if (this.isWebGL1() && f.volumetric)
                  throw new Error("Volumetric rendering requires webgl2 which is not supported by your hardware.");
                if (a = this._gl.createProgram(), a == null)
                  return null;
                var S = this._precision, T = "precision " + S + " float;", R = [
                  f.volumetric ? "#version 300 es" : "",
                  T
                ].join(`
`), $ = [
                  f.volumetric ? "#version 300 es" : "",
                  f.fragdepth && this.isWebGL1() ? "#extension GL_EXT_frag_depth: enable" : "",
                  f.wireframe ? "#define WIREFRAME 1" : "",
                  T
                ].join(`
`), P = this.getShader("fragment", $ + r), B = this.getShader("vertex", R + n);
                B != null && this._gl.attachShader(a, B), P != null && this._gl.attachShader(a, P), this._gl.linkProgram(a), this._gl.getProgramParameter(a, this._gl.LINK_STATUS) || console.error("Could not initialize shader"), a.uniforms = {}, a.attributes = {};
                var F, U, z;
                F = [
                  "viewMatrix",
                  "modelViewMatrix",
                  "projectionMatrix",
                  "normalMatrix"
                ];
                for (U in b)
                  F.push(U);
                for (z = 0; z < F.length; z++) {
                  var W = F[z];
                  a.uniforms[W] = this._gl.getUniformLocation(a, W);
                }
                for (F = [
                  "position",
                  "normal",
                  "color",
                  "lineDistance",
                  "offset",
                  "radius"
                ], z = 0; z < F.length; z++) {
                  var V = F[z];
                  a.attributes[V] = this._gl.getAttribLocation(a, V);
                }
                return a.id = this._programs_counter++, this._programs.push({
                  program: a,
                  code: h,
                  usedTimes: 1
                }), this.info.memory.programs = this._programs.length, a;
              }
              setProgram(r, n, b, f, c, t) {
                if (f.needsUpdate && (f.program && this.deallocateMaterial(f), this.initMaterial(f, n, b, c), f.needsUpdate = !1), f.program == null)
                  return null;
                var a = !1, h = f.program, M = h.uniforms, w = f.uniforms;
                if (h != this._currentProgram && (this._gl.useProgram(h), this._currentProgram = h, a = !0), f.id != this._currentMaterialId && (this._currentMaterialId = f.id, a = !0), r != this._currentCamera && (this._currentCamera = r, a = !0), this._gl.uniformMatrix4fv(M.projectionMatrix, !1, r.projectionMatrix.elements), this._gl.uniformMatrix4fv(M.modelViewMatrix, !1, c._modelViewMatrix.elements), this._gl.uniformMatrix3fv(M.normalMatrix, !1, c._normalMatrix.elements), a) {
                  if (w.fogColor.value = b.color, w.fogNear.value = b.near, w.fogFar.value = b.far, f.shaderID.startsWith("lambert") || f.shaderID === "instanced" || f.shaderID.endsWith("imposter"))
                    this._gl.uniformMatrix4fv(M.viewMatrix, !1, r.matrixWorldInverse.elements), this._lightsNeedUpdate && (this.setupLights(h, n), this._lightsNeedUpdate = !1), w.directionalLightColor.value = this._lights.directional.colors, w.directionalLightDirection.value = this._lights.directional.positions;
                  else if (f.shaderID.endsWith("outline"))
                    w.outlineColor.value = f.outlineColor, w.outlineWidth.value = f.outlineWidth, w.outlinePushback.value = f.outlinePushback;
                  else if (f.shaderID === "volumetric") {
                    c._modelViewMatrix.getScale(this._direction), this._worldInverse.getInverse(c._modelViewMatrix), this._projInverse.getInverse(r.projectionMatrix), this._textureMatrix.multiplyMatrices(c.material.texmatrix, this._worldInverse), this._gl.uniformMatrix4fv(M.textmat, !1, this._textureMatrix.elements), this._gl.uniformMatrix4fv(M.projinv, !1, this._projInverse.elements);
                    let S = Math.min(Math.min(this._direction.x, this._direction.y), this._direction.z);
                    w.step.value = c.material.unit * S, w.maxdepth.value = c.material.maxdepth * S, w.transfermax.value = c.material.transfermax, w.transfermin.value = c.material.transfermin, w.subsamples.value = c.material.subsamples, t.setTexture(c.material.transferfn, 4, !1), t.setTexture(c.material.map, 3, !0), this._gl.activeTexture(this._gl.TEXTURE5), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture);
                  }
                  w.opacity.value = f.opacity, this.loadMaterialUniforms(M, w);
                }
                return h;
              }
              loadMaterialUniforms(r, n) {
                var b, f, c, t;
                for (b in n)
                  r[b] && (f = n[b].type, c = n[b].value, t = r[b], f === "f" ? this._gl.uniform1f(t, c) : f === "i" ? this._gl.uniform1i(t, c) : f === "fv" ? this._gl.uniform3fv(t, c) : f === "c" ? this._gl.uniform3f(t, c.r, c.g, c.b) : f === "f4" && this._gl.uniform4f(t, c[0], c[1], c[2], c[3]));
              }
              // Objects adding
              addObject(r, n) {
                var b, f, c, t;
                if (!r.__webglInit && (r.__webglInit = !0, r._modelViewMatrix = new E.Matrix4(), r._normalMatrix = new E.Matrix3(), r.geometry !== void 0 && r.geometry.__webglInit === void 0 && (r.geometry.__webglInit = !0, r.geometry.addEventListener("dispose", this.onGeometryDispose.bind(this))), r instanceof u.Mesh || r instanceof u.Line))
                  for (c = r.geometry, b = 0, f = c.geometryGroups.length; b < f; b++)
                    t = c.geometryGroups[b], t.id = this._geometryGroupCounter++, t.__webglVertexBuffer || (r instanceof u.Mesh ? (this.createMeshBuffers(t), c.elementsNeedUpdate = !0, c.normalsNeedUpdate = !0) : r instanceof u.Line && this.createLineBuffers(t), c.verticesNeedUpdate = !0, c.colorsNeedUpdate = !0);
                if (!r.__webglActive) {
                  if (r instanceof u.Mesh || r instanceof u.Line)
                    for (c = r.geometry, b = 0, f = c.geometryGroups.length; b < f; b++)
                      t = c.geometryGroups[b], this.addBuffer(n.__webglObjects, t, r);
                  else
                    r instanceof u.Sprite && n.__webglSprites.push(r);
                  r.__webglActive = !0;
                }
              }
              updateObject(r) {
                var n = r.geometry, b;
                if (r instanceof u.Mesh || r instanceof u.Line) {
                  for (var f = 0, c = n.geometryGroups.length; f < c; f++)
                    b = n.geometryGroups[f], (n.verticesNeedUpdate || n.elementsNeedUpdate || n.colorsNeedUpdate || n.normalsNeedUpdate) && this.setBuffers(b, this._gl.STATIC_DRAW);
                  n.verticesNeedUpdate = !1, n.elementsNeedUpdate = !1, n.normalsNeedUpdate = !1, n.colorsNeedUpdate = !1, n.buffersNeedUpdate = !1;
                }
              }
              removeObject(r, n) {
                r instanceof u.Mesh || r instanceof u.Line ? this.removeInstances(n.__webglObjects, r) : r instanceof u.Sprite && this.removeInstancesDirect(n.__webglSprites, r), r.__webglActive = !1;
              }
              removeInstances(r, n) {
                for (var b = r.length - 1; b >= 0; --b)
                  r[b].object === n && r.splice(b, 1);
              }
              removeInstancesDirect(r, n) {
                for (var b = r.length - 1; b >= 0; --b)
                  r[b] === n && r.splice(b, 1);
              }
              unrollBufferMaterial(r) {
                var n = r.object, b = n.material;
                if (b.volumetric)
                  r.opaque = null, r.transparent = null, r.volumetric = b;
                else if (b.transparent) {
                  if (r.opaque = null, r.volumetric = null, r.transparent = b, !b.wireframe) {
                    var f = b.clone();
                    f.opacity = 0, r.blank = f;
                  }
                } else
                  r.opaque = b, r.transparent = null, r.volumetric = null;
              }
              setBuffers(r, n) {
                var b = r.vertexArray, f = r.colorArray;
                if (r.__webglOffsetBuffer !== void 0 ? (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, r.__webglOffsetBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, b, n)) : (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, r.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, b, n)), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, r.__webglColorBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, f, n), r.normalArray && r.__webglNormalBuffer !== void 0) {
                  var c = r.normalArray;
                  this._gl.bindBuffer(this._gl.ARRAY_BUFFER, r.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, c, n);
                }
                if (r.radiusArray && r.__webglRadiusBuffer !== void 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, r.__webglRadiusBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, r.radiusArray, n)), r.faceArray && r.__webglFaceBuffer !== void 0) {
                  var t = r.faceArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, r.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, t, n);
                }
                if (r.lineArray && r.__webglLineBuffer !== void 0) {
                  var a = r.lineArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, r.__webglLineBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, a, n);
                }
              }
              // Creates appropriate gl buffers for geometry chunk
              // TODO: do we need line buffer for mesh objects?
              // Also, can we integrate this with createLineBuffers?
              createMeshBuffers(r) {
                r.radiusArray && (r.__webglRadiusBuffer = this._gl.createBuffer()), r.useOffset && (r.__webglOffsetBuffer = this._gl.createBuffer()), r.__webglVertexBuffer = this._gl.createBuffer(), r.__webglNormalBuffer = this._gl.createBuffer(), r.__webglColorBuffer = this._gl.createBuffer(), r.__webglFaceBuffer = this._gl.createBuffer(), r.__webglLineBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              createLineBuffers(r) {
                r.__webglVertexBuffer = this._gl.createBuffer(), r.__webglColorBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              addBuffer(r, n, b) {
                r.push({
                  buffer: n,
                  object: b,
                  opaque: null,
                  transparent: null
                });
              }
              setupMatrices(r, n) {
                r._modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, r.matrixWorld), r._normalMatrix.getInverse(r._modelViewMatrix), r._normalMatrix.transpose();
              }
              // Fallback filters for non-power-of-2 textures
              filterFallback(r) {
                return this._gl.LINEAR;
              }
              setTextureParameters(r, n) {
                r == this._gl.TEXTURE_2D ? (this._gl.texParameteri(r, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(r, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(r, this._gl.TEXTURE_MAG_FILTER, this.filterFallback(n.magFilter)), this._gl.texParameteri(r, this._gl.TEXTURE_MIN_FILTER, this.filterFallback(n.minFilter))) : (this._gl.texParameteri(r, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(r, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(r, this._gl.TEXTURE_WRAP_R, this._gl.CLAMP_TO_EDGE), this._extColorBufferFloat && this._extFloatLinear ? (this._gl.texParameteri(r, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(r, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR)) : (this._gl.texParameteri(r, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(r, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST)));
              }
              // Map constants to WebGL constants
              paramToGL(r) {
                return r === _.UnsignedByteType ? this._gl.UNSIGNED_BYTE : r === _.RGBAFormat ? this._gl.RGBA : r === _.NearestFilter ? this._gl.NEAREST : 0;
              }
              setupLights(r, n) {
                var b, f, c, t = 0, a = 0, h = 0, M, w, S = this._lights, T = S.directional.colors, R = S.directional.positions, $ = 0, P = 0;
                for (b = 0, f = n.length; b < f; b++)
                  if (c = n[b], M = c.color, w = c.intensity, c instanceof x.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;
                    R[P] = this._direction.x, R[P + 1] = this._direction.y, R[P + 2] = this._direction.z, T[P] = M.r * w, T[P + 1] = M.g * w, T[P + 2] = M.b * w, P += 3, $++;
                  }
                S.ambient[0] = t, S.ambient[1] = a, S.ambient[2] = h, S.directional.length = $;
              }
              initGL() {
                try {
                  if (!(this._gl = this._canvas.getContext("webgl2", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    stencil: this._stencil,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })) && !(this._gl = this._canvas.getContext("experimental-webgl", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    stencil: this._stencil,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })) && !(this._gl = this._canvas.getContext("webgl", {
                    alpha: this._alpha,
                    premultipliedAlpha: this._premultipliedAlpha,
                    antialias: this._antialias,
                    stencil: this._stencil,
                    preserveDrawingBuffer: this._preserveDrawingBuffer
                  })))
                    throw "Error creating WebGL context.";
                  var r = this._gl.getParameter(this._gl.VERSION);
                  this._webglversion = parseInt(r[6]);
                } catch (n) {
                  console.error(n);
                }
              }
              isWebGL1() {
                return this._webglversion == 1;
              }
              setDefaultGLState() {
                this._gl.clearColor(0, 0, 0, 1), 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(r, n, b, f, c, t, a, T) {
                var M, w, S, T, R, $, P;
                n ? (R = r.length - 1, $ = -1, P = -1) : (R = 0, $ = r.length, P = 1);
                for (var B = R; B !== $; B += P)
                  if (M = r[B], M.render) {
                    if (w = M.object, S = M.buffer, T = M[b], !T)
                      continue;
                    a && this.setBlending(!0), this.setDepthTest(T.depthTest), this.setDepthWrite(T.depthWrite), this.setPolygonOffset(T.polygonOffset, T.polygonOffsetFactor, T.polygonOffsetUnits);
                    var F = w._modelViewMatrix.isReflected();
                    this.setMaterialFaces(T, F), this.renderBuffer(f, c, t, T, S, w), (this._outlineEnabled || T.outline) && (T.shaderID == "sphereimposter" ? this.renderBuffer(f, c, t, this._outlineSphereImposterMaterial, S, w) : T.shaderID == "stickimposter" ? this.renderBuffer(f, c, t, this._outlineStickImposterMaterial, S, w) : !T.wireframe && T.shaderID !== "basic" && T.opacity !== 0 && this.renderBuffer(f, c, t, this._outlineMaterial, S, w));
                  }
              }
              renderSprites(r, n, b) {
                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(r, n, this._currentWidth, this._currentHeight, b), 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 ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SpritePlugin: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./shaders/index */
              "./src/WebGL/shaders/index.ts"
            );
            class p {
              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 g = 0;
                this.sprite.vertices[g++] = -1, this.sprite.vertices[g++] = -1, this.sprite.vertices[g++] = 0, this.sprite.vertices[g++] = 0, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = -1, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = 0, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = -1, this.sprite.vertices[g++] = 1, this.sprite.vertices[g++] = 0, this.sprite.vertices[g++] = 1, g = 0, this.sprite.faces[g++] = 0, this.sprite.faces[g++] = 1, this.sprite.faces[g++] = 2, this.sprite.faces[g++] = 0, this.sprite.faces[g++] = 2, this.sprite.faces[g++] = 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(
                  l.ShaderLib.sprite,
                  this.precision || 1
                  /** added default to single precision */
                ), this.sprite.attributes = {};
                const E = {};
                this.sprite.attributes.position = this.gl.getAttribLocation(this.sprite.program, "position"), this.sprite.attributes.uv = this.gl.getAttribLocation(this.sprite.program, "uv"), E.uvOffset = this.gl.getUniformLocation(this.sprite.program, "uvOffset"), E.uvScale = this.gl.getUniformLocation(this.sprite.program, "uvScale"), E.rotation = this.gl.getUniformLocation(this.sprite.program, "rotation"), E.scale = this.gl.getUniformLocation(this.sprite.program, "scale"), E.alignment = this.gl.getUniformLocation(this.sprite.program, "alignment"), E.color = this.gl.getUniformLocation(this.sprite.program, "color"), E.map = this.gl.getUniformLocation(this.sprite.program, "map"), E.opacity = this.gl.getUniformLocation(this.sprite.program, "opacity"), E.useScreenCoordinates = this.gl.getUniformLocation(this.sprite.program, "useScreenCoordinates"), E.screenPosition = this.gl.getUniformLocation(this.sprite.program, "screenPosition"), E.modelViewMatrix = this.gl.getUniformLocation(this.sprite.program, "modelViewMatrix"), E.projectionMatrix = this.gl.getUniformLocation(this.sprite.program, "projectionMatrix"), E.fogType = this.gl.getUniformLocation(this.sprite.program, "fogType"), E.fogDensity = this.gl.getUniformLocation(this.sprite.program, "fogDensity"), E.fogNear = this.gl.getUniformLocation(this.sprite.program, "fogNear"), E.fogFar = this.gl.getUniformLocation(this.sprite.program, "fogFar"), E.fogColor = this.gl.getUniformLocation(this.sprite.program, "fogColor"), E.alphaTest = this.gl.getUniformLocation(this.sprite.program, "alphaTest"), this.sprite.uniforms = E;
              }
              render(o, g, E, u, A) {
                var L, C, D, r, n, b, f, c, t, a;
                if (!this.gl)
                  throw new Error("WebGLRenderer not initialized");
                let h = [];
                (L = o == null ? void 0 : o.__webglSprites) === null || L === void 0 || L.forEach((Q) => {
                  (A && Q.material.depthTest == !1 || !A && Q.material.depthTest) && h.push(Q);
                });
                let M = h.length;
                if (!M)
                  return;
                const w = this.sprite.attributes, S = this.sprite.uniforms;
                if (!S)
                  throw new Error("Uniforms not defined");
                var T = E * 0.5, R = u * 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(S.projectionMatrix, !1, g.projectionMatrix.elements), this.gl.activeTexture(this.gl.TEXTURE0), this.gl.uniform1i(S.map, 0);
                var $ = 0, P = 0, B = o.fog;
                B ? (this.gl.uniform3f(S.fogColor, B.color.r, B.color.g, B.color.b), this.gl.uniform1f(S.fogNear, B.near), this.gl.uniform1f(S.fogFar, B.far), this.gl.uniform1i(S.fogType, 1), $ = 1, P = 1) : (this.gl.uniform1i(S.fogType, 0), $ = 0, P = 0);
                var F;
                let U, z, W, V, N = [];
                for (F = 0; F < M; F++)
                  U = h[F], z = U.material, z && (z.depthTest == !1 && !A || !U.visible || z.opacity === 0 || (z.useScreenCoordinates ? U.z = -U.position.z : (U._modelViewMatrix.multiplyMatrices(g.matrixWorldInverse, U.matrixWorld), U.z = -U._modelViewMatrix.elements[14])));
                for (h.sort(_), F = 0; F < M; F++)
                  if (U = h[F], z = U.material, !!z && !(!U.visible || z.opacity === 0) && z.map && z.map.image && z.map.image.width) {
                    this.gl.uniform1f((S == null ? void 0 : S.alphaTest) || null, z.alphaTest);
                    var k = z.map.image.width, G = z.map.image.height;
                    N[0] = k * this.renderer.devicePixelRatio / E, N[1] = G * this.renderer.devicePixelRatio / u, z.useScreenCoordinates === !0 ? (this.gl.uniform1i(S.useScreenCoordinates, 1), this.gl.uniform3f(S.screenPosition, (U.position.x * this.renderer.devicePixelRatio - T) / T, (R - U.position.y * this.renderer.devicePixelRatio) / R, Math.max(0, Math.min(1, U.position.z)))) : (this.gl.uniform1i(S.useScreenCoordinates, 0), this.gl.uniformMatrix4fv(S.modelViewMatrix, !1, U._modelViewMatrix.elements)), o.fog && z.fog ? V = P : V = 0, $ !== V && (this.gl.uniform1i(S.fogType, V), $ = V), W = 1 / (z.scaleByViewport ? u : 1), N[0] *= W * U.scale.x, N[1] *= W * U.scale.y;
                    let Q = (C = z == null ? void 0 : z.alignment) === null || C === void 0 ? void 0 : C.x, ie = (D = z == null ? void 0 : z.alignment) === null || D === void 0 ? void 0 : D.y;
                    z.screenOffset && (Q = (Q || 0) + 2 * z.screenOffset.x / k, ie = (ie || 0) + 2 * z.screenOffset.y / G), this.gl.uniform2f(S.uvScale, ((r = z == null ? void 0 : z.uvScale) === null || r === void 0 ? void 0 : r.x) || 1, ((n = z == null ? void 0 : z.uvScale) === null || n === void 0 ? void 0 : n.y) || 1), this.gl.uniform2f(S.uvOffset, ((b = z == null ? void 0 : z.uvOffset) === null || b === void 0 ? void 0 : b.x) || 0, ((f = z == null ? void 0 : z.uvOffset) === null || f === void 0 ? void 0 : f.y) || 0), this.gl.uniform2f(S.alignment, Q || 0, ie || 0), this.gl.uniform1f(S.opacity, z.opacity), this.gl.uniform3f(S.color, ((c = z == null ? void 0 : z.color) === null || c === void 0 ? void 0 : c.r) || 0, ((t = z == null ? void 0 : z.color) === null || t === void 0 ? void 0 : t.g) || 0, ((a = z == null ? void 0 : z.color) === null || a === void 0 ? void 0 : a.b) || 0), this.gl.uniform1f(S.rotation, U.rotation), this.gl.uniform2fv(S.scale, N), this.renderer.setDepthTest(z.depthTest), this.renderer.setDepthWrite(z.depthWrite), this.renderer.setTexture(z.map, 0), this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);
                  }
                this.gl.enable(this.gl.CULL_FACE);
              }
              createProgram(o, g) {
                if (!this.gl)
                  throw new Error("WebGL Rendering context not found");
                var E = this.gl.createProgram();
                if (!E)
                  throw new Error("Error creating webgl program");
                var u = this.gl.createShader(this.gl.FRAGMENT_SHADER), A = this.gl.createShader(this.gl.VERTEX_SHADER);
                if (!u)
                  throw new Error("Unable to create fragment shader SpritePlugin.createProgram");
                if (!A)
                  throw new Error("Unable to create vertex shader SpritePlugin.createProgram");
                var L = "precision " + g + ` float;
`;
                if (this.gl.shaderSource(u, L + o.fragmentShader), this.gl.shaderSource(A, L + o.vertexShader), this.gl.compileShader(u), this.gl.compileShader(A), !this.gl.getShaderParameter(u, this.gl.COMPILE_STATUS) || !this.gl.getShaderParameter(A, this.gl.COMPILE_STATUS))
                  throw new Error(`Error compiling shader: 
      ${this.gl.getShaderInfoLog(u)} 
      ${this.gl.getShaderInfoLog(A)}`);
                return this.gl.attachShader(E, u), this.gl.attachShader(E, A), this.gl.linkProgram(E), this.gl.getProgramParameter(E, this.gl.LINK_STATUS) || console.error("Could not initialize shader"), E;
              }
            }
            function _(x, o) {
              return x.z !== o.z ? o.z - x.z : o.id - x.id;
            }
          }
        ),
        /***/
        "./src/WebGL/constants/Coloring.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/constants/Coloring.ts ***!
            \*****************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Coloring: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            var l;
            (function(p) {
              p[p.NoColors = 0] = "NoColors", p[p.FaceColors = 1] = "FaceColors", p[p.VertexColors = 2] = "VertexColors";
            })(l || (l = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Shading.ts": (
          /*!****************************************!*\
            !*** ./src/WebGL/constants/Shading.ts ***!
            \****************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Shading: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            var l;
            (function(p) {
              p[p.NoShading = 0] = "NoShading", p[p.FlatShading = 1] = "FlatShading", p[p.SmoothShading = 2] = "SmoothShading";
            })(l || (l = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Sides.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/Sides.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              BackSide: () => (
                /* binding */
                p
              ),
              /* harmony export */
              DoubleSide: () => (
                /* binding */
                _
              ),
              /* harmony export */
              FrontSide: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = 0, p = 1, _ = 2;
          }
        ),
        /***/
        "./src/WebGL/constants/SpriteAlignment.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/constants/SpriteAlignment.ts ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SpriteAlignment: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const p = {
              topLeft: new l.Vector2(1, -1),
              topCenter: new l.Vector2(0, -1),
              topRight: new l.Vector2(-1, -1),
              centerLeft: new l.Vector2(1, 0),
              center: new l.Vector2(0, 0),
              centerRight: new l.Vector2(-1, 0),
              bottomLeft: new l.Vector2(1, 1),
              bottomCenter: new l.Vector2(0, 1),
              bottomRight: new l.Vector2(-1, 1)
            };
          }
        ),
        /***/
        "./src/WebGL/constants/TextureConstants.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/constants/TextureConstants.ts ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* binding */
                l
              ),
              /* harmony export */
              FloatType: () => (
                /* binding */
                g
              ),
              /* harmony export */
              LinearFilter: () => (
                /* binding */
                p
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* binding */
                x
              ),
              /* harmony export */
              NearestFilter: () => (
                /* binding */
                _
              ),
              /* harmony export */
              R32Format: () => (
                /* binding */
                A
              ),
              /* harmony export */
              RFormat: () => (
                /* binding */
                u
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* binding */
                E
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            const l = 1001, p = 1006, _ = 1007, x = 1008, o = 1009, g = 1010, E = 1021, u = 1022, A = 1023;
          }
        ),
        /***/
        "./src/WebGL/constants/TextureOperations.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/constants/TextureOperations.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              TextureOperations: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            var l;
            (function(p) {
              p[p.MultiplyOperation = 0] = "MultiplyOperation", p[p.MixOperation = 1] = "MixOperation", p[p.AddOperation = 2] = "AddOperation";
            })(l || (l = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/index.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                p.BackSide
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                o.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                l.Coloring
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                p.DoubleSide
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                o.FloatType
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                p.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 */
                _.Shading
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                x.SpriteAlignment
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                g.TextureOperations
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                o.UnsignedByteType
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), p = e(
              /*! ./Sides */
              "./src/WebGL/constants/Sides.ts"
            ), _ = e(
              /*! ./Shading */
              "./src/WebGL/constants/Shading.ts"
            ), x = e(
              /*! ./SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), o = e(
              /*! ./TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), g = e(
              /*! ./TextureOperations */
              "./src/WebGL/constants/TextureOperations.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/core/EventDispatcher.ts": (
          /*!*******************************************!*\
            !*** ./src/WebGL/core/EventDispatcher.ts ***!
            \*******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              EventDispatcher: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            class l {
              constructor() {
                this.listeners = {};
              }
              dispatchEvent(_) {
                var x = this.listeners[_.type];
                if (x !== void 0) {
                  _.target = this;
                  for (var o = 0, g = x.length; o < g; o++)
                    x[o].call(this, _);
                }
              }
              removeEventListener(_, x) {
                if (!x)
                  this.listeners[_] = [];
                else {
                  var o = this.listeners[_].indexOf(x);
                  o !== -1 && this.listeners[_].splice(o, 1);
                }
              }
              addEventListener(_, x) {
                this.listeners[_] === void 0 && (this.listeners[_] = []), this.listeners[_].indexOf(x) === -1 && this.listeners[_].push(x);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Geometry.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Geometry.ts ***!
            \************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Geometry: () => (
                /* binding */
                E
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* binding */
                g
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var l = e(
              /*! ../materials/LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), p = e(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), _ = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), x = e(
              /*! ../../colors */
              "./src/colors.ts"
            );
            const o = 65535;
            class g {
              constructor(L = 0) {
                this.vertexArray = null, this.colorArray = null, this.normalArray = null, this.radiusArray = null, this.faceArray = null, this.lineArray = null, this.vertices = 0, this.faceidx = 0, this.lineidx = 0, this.__inittedArrays = !1, this.id = L;
              }
              setColors(L) {
                var C = this.vertexArray, D = this.colorArray;
                if (!C)
                  throw new Error("vertex array not initialized");
                if (!D)
                  throw new Error("color array not initialized");
                if (C.length != D.length) {
                  console.log("Cannot re-color geometry group due to mismatched lengths.");
                  return;
                }
                for (var r = 0; r < C.length; r += 3) {
                  var n = L(C[r], C[r + 1], C[r + 2]);
                  n instanceof x.Color || (n = x.CC.color(n)), D[r] = n.r, D[r + 1] = n.g, D[r + 2] = n.b;
                }
              }
              getNumVertices() {
                return this.vertices;
              }
              getVertices() {
                return this.vertexArray;
              }
              getCentroid() {
                if (!this.vertexArray)
                  throw new Error("vertex array not initialized");
                for (var L = new _.Vector3(), C, D, r, n, b = 0; b < this.vertices; ++b)
                  C = b * 3, D = this.vertexArray[C], r = this.vertexArray[C + 1], n = this.vertexArray[C + 2], L.x += D, L.y += r, L.z += n;
                return L.divideScalar(this.vertices), L;
              }
              //setup normals - vertex and face array must exist
              setNormals() {
                var L = this.faceArray, C = this.vertexArray, D = this.normalArray;
                if (!(!this.vertices || !this.faceidx)) {
                  if (!L)
                    throw new Error("face array not initialized");
                  if (!C)
                    throw new Error("vertex array not initialized");
                  if (!D)
                    throw new Error("normal array not initialized");
                  for (var r, n, b, f, c, t, a, h = 0; h < L.length / 3; ++h)
                    r = L[h * 3] * 3, n = L[h * 3 + 1] * 3, b = L[h * 3 + 2] * 3, f = new _.Vector3(C[r], C[r + 1], C[r + 2]), c = new _.Vector3(C[n], C[n + 1], C[n + 2]), t = new _.Vector3(C[b], C[b + 1], C[b + 2]), f.subVectors(f, c), t.subVectors(t, c), t.cross(f), a = t, a.normalize(), D[r] += a.x, D[n] += a.x, D[b] += a.x, D[r + 1] += a.y, D[n + 1] += a.y, D[b + 1] += a.y, D[r + 2] += a.z, D[n + 2] += a.z, D[b + 2] += a.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 L = this.faceArray, C = this.lineArray = new Uint16Array(this.faceidx * 2);
                  if (this.lineidx = this.faceidx * 2, !L)
                    throw new Error("face array not initialized");
                  for (var D = 0; D < this.faceidx / 3; ++D) {
                    var r = D * 3, n = r * 2, b = L[r], f = L[r + 1], c = L[r + 2];
                    C[n] = b, C[n + 1] = f, C[n + 2] = b, C[n + 3] = c, C[n + 4] = f, C[n + 5] = c;
                  }
                }
              }
              vrml(L, C) {
                var D, r, n, b, f, c, t, a, h, M, w, S, T, R, $, P, B, F, U = "";
                if (U += L + `Shape {
` + L + ` appearance Appearance {
` + L + `  material Material {
` + L + "   diffuseColor " + ((D = C == null ? void 0 : C.color) === null || D === void 0 ? void 0 : D.r) + " " + ((r = C == null ? void 0 : C.color) === null || r === void 0 ? void 0 : r.g) + " " + ((n = C == null ? void 0 : C.color) === null || n === void 0 ? void 0 : n.b) + `
`, C.wireframe && this.colorArray) {
                  let W = this.colorArray;
                  U += L + "    emissiveColor " + W[0] + " " + W[1] + " " + W[2] + `
`;
                }
                C != null && C.transparent && (U += L + "   transparency " + (1 - C.opacity) + `
`), U += L + `  }
`, U += L + ` }
`;
                var z = L;
                if (L += " ", C instanceof l.LineBasicMaterial || C.wireframe) {
                  U += L + `geometry IndexedLineSet {
` + L + ` colorPerVertex TRUE
` + L + ` coord Coordinate {
` + L + `  point [
`;
                  let W, V, N;
                  for (let k = 0; k < this.vertices; ++k) {
                    let G = k * 3;
                    W = (b = this.vertexArray) === null || b === void 0 ? void 0 : b[G], V = (f = this.vertexArray) === null || f === void 0 ? void 0 : f[G + 1], N = (c = this.vertexArray) === null || c === void 0 ? void 0 : c[G + 2], U += L + "   " + W + " " + V + " " + N + `,
`;
                  }
                  if (U += L + `  ]
`, U += L + ` }
`, this.colorArray && !C.wireframe) {
                    U += L + ` color Color {
` + L + `  color [
`;
                    for (let k = 0; k < this.vertices; ++k) {
                      let G = k * 3;
                      W = this.colorArray[G], V = this.colorArray[G + 1], N = this.colorArray[G + 2], U += L + "   " + W + " " + V + " " + N + `,
`;
                    }
                    U += L + `  ]
`, U += L + ` }
`;
                  }
                  if (U += L + ` coordIndex [
`, C.wireframe && this.faceArray)
                    for (let k = 0; k < this.faceidx; k += 3)
                      W = (t = this.faceArray) === null || t === void 0 ? void 0 : t[k], V = (a = this.faceArray) === null || a === void 0 ? void 0 : a[k + 1], N = (h = this.faceArray) === null || h === void 0 ? void 0 : h[k + 2], U += L + "  " + W + ", " + V + ", " + N + `, -1,
`;
                  else
                    for (let k = 0; k < this.vertices - 1; k += 2)
                      U += L + "  " + k + ", " + (k + 1) + `, -1,
`;
                  U += L + ` ]
`, U += L + `}
`;
                } else {
                  U += L + `geometry IndexedFaceSet {
` + L + ` colorPerVertex TRUE
` + L + ` normalPerVertex TRUE
` + L + ` solid FALSE
`, U += L + ` coord Coordinate {
` + L + `  point [
`;
                  let W, V, N;
                  for (let k = 0; k < this.vertices; ++k) {
                    let G = k * 3;
                    W = (M = this.vertexArray) === null || M === void 0 ? void 0 : M[G], V = (w = this.vertexArray) === null || w === void 0 ? void 0 : w[G + 1], N = (S = this.vertexArray) === null || S === void 0 ? void 0 : S[G + 2], U += L + "   " + W + " " + V + " " + N + `,
`;
                  }
                  U += L + `  ]
`, U += L + ` }
`, U += L + ` normal Normal {
` + L + `  vector [
`;
                  for (let k = 0; k < this.vertices; ++k) {
                    let G = k * 3;
                    W = (T = this.normalArray) === null || T === void 0 ? void 0 : T[G], V = (R = this.normalArray) === null || R === void 0 ? void 0 : R[G + 1], N = ($ = this.normalArray) === null || $ === void 0 ? void 0 : $[G + 2], U += L + "   " + W + " " + V + " " + N + `,
`;
                  }
                  if (U += L + `  ]
`, U += L + ` }
`, this.colorArray) {
                    U += L + ` color Color {
` + L + `  color [
`;
                    for (let k = 0; k < this.vertices; ++k) {
                      let G = k * 3;
                      W = this.colorArray[G], V = this.colorArray[G + 1], N = this.colorArray[G + 2], U += L + "   " + W + " " + V + " " + N + `,
`;
                    }
                    U += L + `  ]
`, U += L + ` }
`;
                  }
                  U += L + ` coordIndex [
`;
                  for (let k = 0; k < this.faceidx; k += 3)
                    W = (P = this.faceArray) === null || P === void 0 ? void 0 : P[k], V = (B = this.faceArray) === null || B === void 0 ? void 0 : B[k + 1], N = (F = this.faceArray) === null || F === void 0 ? void 0 : F[k + 2], U += L + "  " + W + ", " + V + ", " + N + `, -1,
`;
                  U += L + ` ]
`, U += L + `}
`;
                }
                return U += z + "}", U;
              }
              truncateArrayBuffers(L = !0, C = !1) {
                var D = this.vertexArray, r = this.colorArray, n = this.normalArray, b = this.faceArray, f = this.lineArray, c = this.radiusArray;
                this.vertexArray = (D == null ? void 0 : D.subarray(0, this.vertices * 3)) || null, this.colorArray = (r == null ? void 0 : r.subarray(0, this.vertices * 3)) || null, L ? (this.normalArray = (n == null ? void 0 : n.subarray(0, this.vertices * 3)) || null, this.faceArray = (b == null ? void 0 : b.subarray(0, this.faceidx)) || null, this.lineidx > 0 ? this.lineArray = (f == null ? void 0 : f.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)), c && (this.radiusArray = c.subarray(0, this.vertices)), C && (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 E extends p.EventDispatcher {
              constructor(L = !1, C = !1, D = !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 = u++, this.mesh = L, this.radii = C, this.offset = D;
              }
              //Get geometry group to accomodate addVertices new vertices - create
              // new group if necessary
              updateGeoGroup(L = 0) {
                var C, D = this.groups > 0 ? this.geometryGroups[this.groups - 1] : null;
                return (!D || D.vertices + L > (((C = D == null ? void 0 : D.vertexArray) === null || C === void 0 ? void 0 : C.length) || 0) / 3) && (D = this.addGeoGroup()), D;
              }
              //return comma separated list of IndexedFace (or Line) sets from geometry groups
              vrml(L, C) {
                for (var D = "", r = this.geometryGroups.length, n = 0; n < r; n++) {
                  var b = this.geometryGroups[n];
                  D += b.vrml(L, C) + `,
`;
                }
                return D;
              }
              addGeoGroup() {
                var L = new g(this.geometryGroups.length);
                return this.geometryGroups.push(L), this.groups = this.geometryGroups.length, L.vertexArray = new Float32Array(o * 3), L.colorArray = new Float32Array(o * 3), this.mesh && (L.normalArray = new Float32Array(o * 3), L.faceArray = new Uint16Array(o * 6), L.lineArray = new Uint16Array(o * 6)), this.radii && (L.radiusArray = new Float32Array(o)), L.useOffset = this.offset, L;
              }
              setUpNormals(...L) {
                for (var C = 0; C < this.groups; C++) {
                  var D = this.geometryGroups[C];
                  D.setNormals(...L);
                }
              }
              setColors(...L) {
                for (var C = this.geometryGroups.length, D = 0; D < C; D++) {
                  var r = this.geometryGroups[D];
                  r.setColors(...L);
                }
              }
              setUpWireframe(...L) {
                for (var C = 0; C < this.groups; C++) {
                  var D = this.geometryGroups[C];
                  D.setLineIndices(...L);
                }
              }
              //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 L = 0; L < this.groups; L++) {
                  var C = this.geometryGroups[L];
                  C.__inittedArrays !== !0 && C.truncateArrayBuffers(this.mesh, !1);
                }
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
              get vertices() {
                for (var L = 0, C = 0; C < this.groups; C++)
                  L += this.geometryGroups[C].vertices;
                return L;
              }
            }
            let u = 0;
          }
        ),
        /***/
        "./src/WebGL/core/Object3D.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Object3D.ts ***!
            \************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Light: () => (
                /* binding */
                g
              ),
              /* harmony export */
              Object3D: () => (
                /* binding */
                x
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* binding */
                _
              ),
              /* harmony export */
              Scene: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), p = e(
              /*! ../../colors */
              "./src/colors.ts"
            );
            let _ = 0;
            class x {
              constructor() {
                this.id = _++, this.name = "", this.children = [], this.position = new l.Vector3(), this.rotation = new l.Vector3(), this.matrix = new l.Matrix4(), this.matrixWorld = new l.Matrix4(), this.quaternion = new l.Quaternion(), this.eulerOrder = "XYZ", this.up = new l.Vector3(0, 1, 0), this.scale = new l.Vector3(1, 1, 1), this.matrixAutoUpdate = !0, this.matrixWorldNeedsUpdate = !0, this.rotationAutoUpdate = !0, this.useQuaternion = !1, this.visible = !0;
              }
              lookAt(u) {
                this.matrix.lookAt(u, this.position, this.up), this.rotationAutoUpdate && (this.useQuaternion === !0 ? console.error("Unimplemented math operation.") : this.rotation instanceof l.Vector3 && this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder));
              }
              //add child object
              add(u) {
                if (u === this) {
                  console.error("Can't add $3Dmol.Object3D to itself");
                  return;
                }
                u.parent = this, this.children.push(u);
                for (var A = this; A.parent !== void 0; )
                  A = A.parent;
                A !== void 0 && A instanceof o && A.__addObject(u);
              }
              remove(u) {
                var A = this.children.indexOf(u);
                if (A !== -1) {
                  u.parent = void 0, this.children.splice(A, 1);
                  for (var L = this; L.parent !== void 0; )
                    L = L.parent;
                  L !== void 0 && L instanceof o && L.__removeObject(u);
                }
              }
              //convert to vrml
              vrml(u) {
                u || (u = " ");
                var A = 2 * Math.atan2(this.quaternion.lengthxyz(), this.quaternion.w), L = 0, C = 0, D = 0;
                if (A != 0) {
                  let b = Math.sin(A / 2);
                  L = this.quaternion.x / b, C = this.quaternion.y / b, D = this.quaternion.z / b;
                }
                var r = u + `Transform {
` + u + " center " + this.position.x + " " + this.position.y + " " + this.position.z + `
` + u + " rotation " + L + " " + C + " " + D + " " + A + `
` + u + ` children [
`;
                this.geometry && (r += this.geometry.vrml(u, this.material));
                for (var n = 0; n < this.children.length; n++)
                  r += this.children[n].vrml(u + " ") + `,
`;
                return r += ` ]
`, r += "}", r;
              }
              updateMatrix() {
                this.matrix.setPosition(this.position), this.useQuaternion === !1 && this.rotation instanceof l.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(u) {
                this.matrixAutoUpdate === !0 && this.updateMatrix(), (this.matrixWorldNeedsUpdate === !0 || u === !0) && (this.parent === void 0 ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1;
                for (var A = 0; A < this.children.length; A++)
                  this.children[A].updateMatrixWorld(!0);
              }
              clone(u) {
                u === void 0 && (u = new x()), u.name = this.name, u.up.copy(this.up), u.position.copy(this.position), u.rotation instanceof l.Vector3 && this.rotation instanceof l.Vector3 ? u.rotation.copy(this.rotation) : u.rotation = this.rotation, u.eulerOrder = this.eulerOrder, u.scale.copy(this.scale), u.rotationAutoUpdate = this.rotationAutoUpdate, u.matrix.copy(this.matrix), u.matrixWorld.copy(this.matrixWorld), u.quaternion.copy(this.quaternion), u.matrixAutoUpdate = this.matrixAutoUpdate, u.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate, u.useQuaternion = this.useQuaternion, u.visible = this.visible;
                for (var A = 0; A < this.children.length; A++) {
                  var L = this.children[A];
                  u.add(L.clone());
                }
                return u;
              }
              setVisible(u) {
                this.visible = u;
                for (var A = 0; A < this.children.length; A++) {
                  var L = this.children[A];
                  L.setVisible(u);
                }
              }
            }
            class o extends x {
              constructor() {
                super(...arguments), this.fog = null, this.overrideMaterial = null, this.matrixAutoUpdate = !1, this.__objects = [], this.__lights = [], this.__objectsAdded = [], this.__objectsRemoved = [];
              }
              __addObject(u) {
                if (u instanceof g)
                  this.__lights.indexOf(u) === -1 && this.__lights.push(u), u.target && u.target.parent === void 0 && this.add(u.target);
                else if (this.__objects.indexOf(u) === -1) {
                  this.__objects.push(u), this.__objectsAdded.push(u);
                  var A = this.__objectsRemoved.indexOf(u);
                  A !== -1 && this.__objectsRemoved.splice(A, 1);
                }
                for (var L = 0; L < u.children.length; L++)
                  this.__addObject(u.children[L]);
              }
              __removeObject(u) {
                var A;
                if (u instanceof g)
                  A = this.__lights.indexOf(u), A !== -1 && this.__lights.splice(A, 1);
                else if (A = this.__objects.indexOf(u), A !== -1) {
                  this.__objects.splice(A, 1), this.__objectsRemoved.push(u);
                  var L = this.__objectsAdded.indexOf(u);
                  L !== -1 && this.__objectsAdded.splice(A, 1);
                }
                for (var C = 0; C < u.children.length; C++)
                  this.__removeObject(u.children[C]);
              }
            }
            class g extends x {
              constructor(u, A = 1) {
                super(), this.position = new l.Vector3(0, 1, 0), this.target = new x(), this.castShadow = !1, this.onlyShadow = !1, this.color = new p.Color(u), this.intensity = A;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Projector.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Projector.ts ***!
            \*************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Projector: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const p = new l.Matrix4();
            class _ {
              static unprojectVector(o, g) {
                return g.projectionMatrixInverse.getInverse(g.projectionMatrix), p.multiplyMatrices(g.matrixWorld, g.projectionMatrixInverse), o.applyProjection(p);
              }
              static projectVector(o, g) {
                return g.matrixWorldInverse.getInverse(g.matrixWorld), p.multiplyMatrices(g.projectionMatrix, g.matrixWorldInverse), o.applyProjection(p);
              }
              projectVector(o, g) {
                return _.projectVector(o, g);
              }
              unprojectVector(o, g) {
                return _.unprojectVector(o, g);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Raycaster.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Raycaster.ts ***!
            \*************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Raycaster: () => (
                /* binding */
                o
              ),
              /* harmony export */
              intersectObject: () => (
                /* binding */
                b
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), p = e(
              /*! ../shapes */
              "./src/WebGL/shapes/index.ts"
            );
            const _ = (f, c) => f.distance - c.distance, x = new l.Matrix4();
            class o {
              constructor(c, t, a, h) {
                this.precision = 1e-4, this.linePrecision = 0.2, this.ray = new l.Ray(c, t), this.ray.direction.lengthSq() > 0 && this.ray.direction.normalize(), this.near = h || 0, this.far = a || 1 / 0;
              }
              set(c, t) {
                this.ray.set(c, t);
              }
              setFromCamera(c, t) {
                t.ortho ? (this.ray.origin.set(c.x, c.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld)) : (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(c.x, c.y, c.z), t.projectionMatrixInverse.getInverse(t.projectionMatrix), x.multiplyMatrices(t.matrixWorld, t.projectionMatrixInverse), this.ray.direction.applyProjection(x), this.ray.direction.sub(this.ray.origin).normalize());
              }
              intersectObjects(c, t) {
                for (var a = [], h = 0, M = t.length; h < M; h++)
                  b(c, t[h], this, a);
                return a.sort(_), a;
              }
            }
            const g = (f) => Math.min(Math.max(f, -1), 1);
            var E = new p.Sphere(), u = new p.Cylinder(), A = new p.Triangle(), L = new l.Vector3(), C = new l.Vector3(), D = new l.Vector3(), r = new l.Vector3(), n = new l.Vector3();
            function b(f, c, t, a) {
              if (n.getPositionFromMatrix(f.matrixWorld), c.intersectionShape === void 0)
                return a;
              var h = c.intersectionShape, M = t.linePrecision;
              M *= f.matrixWorld.getMaxScaleOnAxis();
              var w = M * M;
              if (c.boundingSphere !== void 0 && c.boundingSphere instanceof p.Sphere && (E.copy(c.boundingSphere), E.applyMatrix4(f.matrixWorld), !t.ray.isIntersectionSphere(E)))
                return a;
              var S, T, R, $, P, B, F, U, z, W, V, N, k, G;
              for (S = 0, T = h.triangle.length; S < T; S++)
                if (h.triangle[S] instanceof p.Triangle) {
                  if (A.copy(h.triangle[S]), A.applyMatrix4(f.matrixWorld), R = A.getNormal(), $ = t.ray.direction.dot(R), $ >= 0 || (L.subVectors(A.a, t.ray.origin), F = R.dot(L) / $, F < 0))
                    continue;
                  C.copy(t.ray.direction).multiplyScalar(F).add(t.ray.origin), C.sub(A.a), D.copy(A.b).sub(A.a), r.copy(A.c).sub(A.a);
                  var Q = D.dot(r), ie = D.lengthSq(), ge = r.lengthSq();
                  if (N = (ie * C.dot(r) - Q * C.dot(D)) / (ie * ge - Q * Q), N < 0 || N > 1 || (V = (C.dot(D) - N * Q) / ie, V < 0 || V > 1 || V + N > 1))
                    continue;
                  a.push({ clickable: c, distance: F });
                }
              for (S = 0, T = h.cylinder.length; S < T; S++)
                if (h.cylinder[S] instanceof p.Cylinder) {
                  if (u.copy(h.cylinder[S]), u.applyMatrix4(f.matrixWorld), L.subVectors(u.c1, t.ray.origin), P = L.dot(u.direction), B = L.dot(t.ray.direction), $ = g(t.ray.direction.dot(u.direction)), z = 1 - $ * $, z === 0)
                    continue;
                  k = ($ * B - P) / z, G = (B - $ * P) / z, C.copy(u.direction).multiplyScalar(k).add(u.c1), D.copy(t.ray.direction).multiplyScalar(G).add(t.ray.origin), U = r.subVectors(C, D).lengthSq();
                  var le = u.radius * u.radius;
                  if (U <= le) {
                    if (W = ($ * P - B) * ($ * P - B) - z * (L.lengthSq() - P * P - le), W <= 0 ? N = F = Math.sqrt(U) : N = F = (B - $ * P - Math.sqrt(W)) / z, V = $ * N - P, V < 0 || V * V > u.lengthSq() || N < 0)
                      continue;
                    a.push({ clickable: c, distance: F });
                  }
                }
              for (S = 0, T = h.line.length; S < T; S += 2) {
                C.copy(h.line[S]), C.applyMatrix4(f.matrixWorld), D.copy(h.line[S + 1]), D.applyMatrix4(f.matrixWorld), r.subVectors(D, C);
                var oe = r.lengthSq();
                r.normalize(), L.subVectors(C, t.ray.origin);
                var he = L.dot(r);
                B = L.dot(t.ray.direction), $ = g(t.ray.direction.dot(r)), z = 1 - $ * $, z !== 0 && (k = ($ * B - he) / z, G = (B - $ * he) / z, C.add(r.multiplyScalar(k)), D.copy(t.ray.direction).multiplyScalar(G).add(t.ray.origin), U = r.subVectors(D, C).lengthSq(), U < w && k * k < oe && a.push({ clickable: c, distance: G }));
              }
              for (S = 0, T = h.sphere.length; S < T; S++)
                if (h.sphere[S] instanceof p.Sphere && (E.copy(h.sphere[S]), E.applyMatrix4(f.matrixWorld), t.ray.isIntersectionSphere(E))) {
                  C.subVectors(E.center, t.ray.origin);
                  var se = C.dot(t.ray.direction);
                  if (W = se * se - (C.lengthSq() - E.radius * E.radius), se < 0)
                    return a;
                  W <= 0 ? F = se : F = se - Math.sqrt(W), a.push({ clickable: c, distance: F });
                }
              return a;
            }
          }
        ),
        /***/
        "./src/WebGL/core/Texture.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/core/Texture.ts ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Texture: () => (
                /* binding */
                o
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ../constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), p = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), _ = e(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), x = e(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
            class o extends _.EventDispatcher {
              constructor(u, A) {
                super(), this.id = g++, this.name = "", this.image = u, this.mapping = new x.UVMapping(), this.wrapS = l.ClampToEdgeWrapping, this.wrapT = l.ClampToEdgeWrapping, this.anisotropy = 1, A ? (this.format = l.RFormat, this.type = l.FloatType, this.premultiplyAlpha = !1, this.flipY = !1, this.unpackAlignment = 1, this.magFilter = l.NearestFilter, this.minFilter = l.NearestFilter) : (this.format = l.RGBAFormat, this.type = l.UnsignedByteType, this.offset = new p.Vector2(0, 0), this.repeat = new p.Vector2(1, 1), this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.magFilter = l.LinearFilter, this.minFilter = l.LinearMipMapLinearFilter), this.needsUpdate = !1, this.onUpdate = null;
              }
              clone(u = new o()) {
                return u.image = this.image, u.mapping = this.mapping, u.wrapS = this.wrapS, u.wrapT = this.wrapT, u.magFilter = this.magFilter, u.minFilter = this.minFilter, u.anisotropy = this.anisotropy, u.format = this.format, u.type = this.type, u.offset.copy(this.offset), u.repeat.copy(this.repeat), u.premultiplyAlpha = this.premultiplyAlpha, u.flipY = this.flipY, u.unpackAlignment = this.unpackAlignment, u;
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let g = 0;
          }
        ),
        /***/
        "./src/WebGL/core/UVMapping.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/UVMapping.ts ***!
            \*************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              UVMapping: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            class l {
            }
          }
        ),
        /***/
        "./src/WebGL/core/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/core/index.ts ***!
            \*********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                l.EventDispatcher
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                p.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                p.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                p.GeometryIDCount
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                _.Light
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                _.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                _.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                x.Projector
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                o.Raycaster
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                _.Scene
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                g.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                g.TextureIdCount
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                E.UVMapping
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                o.intersectObject
              )
              /* harmony export */
            });
            var l = e(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), p = e(
              /*! ./Geometry */
              "./src/WebGL/core/Geometry.ts"
            ), _ = e(
              /*! ./Object3D */
              "./src/WebGL/core/Object3D.ts"
            ), x = e(
              /*! ./Projector */
              "./src/WebGL/core/Projector.ts"
            ), o = e(
              /*! ./Raycaster */
              "./src/WebGL/core/Raycaster.ts"
            ), g = e(
              /*! ./Texture */
              "./src/WebGL/core/Texture.ts"
            ), E = e(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/index.ts": (
          /*!****************************!*\
            !*** ./src/WebGL/index.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                l.BackSide
              ),
              /* harmony export */
              Camera: () => (
                /* reexport safe */
                u.Camera
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                l.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                l.Coloring
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                E.Cylinder
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                l.DoubleSide
              ),
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                p.EventDispatcher
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                l.FloatType
              ),
              /* harmony export */
              Fog: () => (
                /* reexport safe */
                A.Fog
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                l.FrontSide
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                p.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                p.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                p.GeometryIDCount
              ),
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                _.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                _.InstancedMaterial
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                p.Light
              ),
              /* harmony export */
              Line: () => (
                /* reexport safe */
                o.Line
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                _.LineBasicMaterial
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                o.LineStyle
              ),
              /* harmony export */
              LinearFilter: () => (
                /* reexport safe */
                l.LinearFilter
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* reexport safe */
                l.LinearMipMapLinearFilter
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                _.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                _.MaterialIdCount
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                x.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                x.Matrix4
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                o.Mesh
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                _.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                _.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                _.MeshOutlineMaterial
              ),
              /* harmony export */
              NearestFilter: () => (
                /* reexport safe */
                l.NearestFilter
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                p.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                p.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                p.Projector
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                x.Quaternion
              ),
              /* harmony export */
              R32Format: () => (
                /* reexport safe */
                l.R32Format
              ),
              /* harmony export */
              RFormat: () => (
                /* reexport safe */
                l.RFormat
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* reexport safe */
                l.RGBAFormat
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                x.Ray
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                p.Raycaster
              ),
              /* harmony export */
              Renderer: () => (
                /* reexport safe */
                L.Renderer
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                p.Scene
              ),
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                g.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                g.ShaderUtils
              ),
              /* harmony export */
              Shading: () => (
                /* reexport safe */
                l.Shading
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                E.Sphere
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                _.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                _.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                o.Sprite
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                l.SpriteAlignment
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                _.SpriteMaterial
              ),
              /* harmony export */
              SpritePlugin: () => (
                /* reexport safe */
                C.SpritePlugin
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                _.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                _.StickImposterOutlineMaterial
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                p.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                p.TextureIdCount
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                l.TextureOperations
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                E.Triangle
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                p.UVMapping
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                l.UnsignedByteType
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                x.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                x.Vector3
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                _.VolumetricMaterial
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                g.basic
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                x.clamp
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                g.clone
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                x.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                x.degToRad
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                g.instanced
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                p.intersectObject
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                g.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                g.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                g.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                g.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                g.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                g.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                g.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                g.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                g.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                g.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                g.volumetric
              )
              /* harmony export */
            });
            var l = e(
              /*! ./constants */
              "./src/WebGL/constants/index.ts"
            ), p = e(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), _ = e(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), x = e(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), o = e(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), g = e(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), E = e(
              /*! ./shapes */
              "./src/WebGL/shapes/index.ts"
            ), u = e(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), A = e(
              /*! ./Fog */
              "./src/WebGL/Fog.ts"
            ), L = e(
              /*! ./Renderer */
              "./src/WebGL/Renderer.ts"
            ), C = e(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/materials/ImposterMaterial.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/materials/ImposterMaterial.ts ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ImposterMaterial: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), p = e(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), _ = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), x = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class g extends o.Material {
              constructor(u) {
                super(), this.color = new _.Color(16777215), this.ambient = new _.Color(1048575), this.emissive = new _.Color(0), this.imposter = !0, this.wrapAround = !1, this.wrapRGB = new x.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 = p.Shading.SmoothShading, this.shaderID = null, this.vertexColors = l.Coloring.NoColors, this.skinning = !1, this.setValues(u);
              }
              clone(u = new g()) {
                return super.clone.call(this, u), u.color.copy(this.color), u.ambient.copy(this.ambient), u.emissive.copy(this.emissive), u.wrapAround = this.wrapAround, u.wrapRGB.copy(this.wrapRGB), u.map = this.map, u.lightMap = this.lightMap, u.specularMap = this.specularMap, u.envMap = this.envMap, u.combine = this.combine, u.reflectivity = this.reflectivity, u.refractionRatio = this.refractionRatio, u.fog = this.fog, u.shading = this.shading, u.shaderID = this.shaderID, u.vertexColors = this.vertexColors, u.skinning = this.skinning, u.morphTargets = this.morphTargets, u.morphNormals = this.morphNormals, u;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/InstancedMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/InstancedMaterial.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              InstancedMaterial: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), p = e(
              /*! ../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), _ = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), x = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class g extends o.Material {
              constructor(u) {
                super(), this.color = new _.Color(16777215), this.ambient = new _.Color(1048575), this.emissive = new _.Color(0), this.wrapAround = !1, this.wrapRGB = new x.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 = p.Shading.SmoothShading, this.shaderID = "instanced", this.vertexColors = l.Coloring.NoColors, this.skinning = !1, this.sphere = null, this.setValues(u);
              }
              clone(u = new g()) {
                return super.clone.call(this, u), u.color.copy(this.color), u.ambient.copy(this.ambient), u.emissive.copy(this.emissive), u.wrapAround = this.wrapAround, u.wrapRGB.copy(this.wrapRGB), u.map = this.map, u.lightMap = this.lightMap, u.specularMap = this.specularMap, u.envMap = this.envMap, u.combine = this.combine, u.reflectivity = this.reflectivity, u.refractionRatio = this.refractionRatio, u.fog = this.fog, u.shading = this.shading, u.shaderID = this.shaderID, u.vertexColors = this.vertexColors, u.skinning = this.skinning, u.morphTargets = this.morphTargets, u.morphNormals = this.morphNormals, u.sphere = this.sphere, u;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/LineBasicMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/LineBasicMaterial.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              LineBasicMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), p = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class _ extends p.Material {
              constructor(o) {
                super(), this.color = new l.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 _()) {
                return super.clone.call(this, o), o.color.copy(this.color), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/Material.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/materials/Material.ts ***!
            \*****************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Material: () => (
                /* binding */
                o
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), p = e(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), _ = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), x = e(
              /*! ../../colors */
              "./src/colors.ts"
            );
            class o extends p.EventDispatcher {
              constructor() {
                super(...arguments), this.id = g++, this.name = "", this.side = l.FrontSide, this.opacity = 1, this.transparent = !1, this.depthTest = !0, this.depthWrite = !0, this.stencilTest = !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;
              }
              setValues(u = {}) {
                if (u !== void 0)
                  for (var A in u) {
                    var L = u[A];
                    if (L === void 0) {
                      console.warn("$3Dmol.Material: '" + A + "' parameter is undefined.");
                      continue;
                    }
                    if (A in this) {
                      var C = this[A];
                      C instanceof x.Color && L instanceof x.Color ? C.copy(L) : C instanceof x.Color ? C.set(L) : C instanceof _.Vector3 && L instanceof _.Vector3 ? C.copy(L) : this[A] = L;
                    }
                  }
              }
              //TODO: might want to look into blending equations
              clone(u = new o()) {
                return u.name = this.name, u.side = this.side, u.opacity = this.opacity, u.transparent = this.transparent, u.depthTest = this.depthTest, u.depthWrite = this.depthWrite, u.stencilTest = this.stencilTest, u.polygonOffset = this.polygonOffset, u.polygonOffsetFactor = this.polygonOffsetFactor, u.polygonOffsetUnits = this.polygonOffsetUnits, u.alphaTest = this.alphaTest, u.overdraw = this.overdraw, u.visible = this.visible, u;
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let g = 0;
          }
        ),
        /***/
        "./src/WebGL/materials/MeshDoubleLambertMaterial.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/materials/MeshDoubleLambertMaterial.ts ***!
            \**********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), p = e(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            );
            class _ extends p.MeshLambertMaterial {
              constructor(o) {
                super(o), this.shaderID = "lambertdouble", this.side = l.DoubleSide, this.outline = !1;
              }
              clone(o = new _()) {
                return super.clone.call(this, o), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshLambertMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshLambertMaterial.ts ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MeshLambertMaterial: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), p = e(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), _ = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), x = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), o = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class g extends _.Material {
              constructor(u) {
                super(), this.color = new x.Color(16777215), this.ambient = new x.Color(1048575), this.emissive = new x.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 = p.Shading.SmoothShading, this.shaderID = "lambert", this.vertexColors = l.Coloring.NoColors, this.skinning = !1, this.setValues(u);
              }
              clone(u = new g()) {
                return super.clone.call(this, u), u.color.copy(this.color), u.ambient.copy(this.ambient), u.emissive.copy(this.emissive), u.wrapAround = this.wrapAround, u.wrapRGB.copy(this.wrapRGB), u.map = this.map, u.lightMap = this.lightMap, u.specularMap = this.specularMap, u.envMap = this.envMap, u.combine = this.combine, u.reflectivity = this.reflectivity, u.refractionRatio = this.refractionRatio, u.fog = this.fog, u.shading = this.shading, u.shaderID = this.shaderID, u.vertexColors = this.vertexColors, u.skinning = this.skinning, u.morphTargets = this.morphTargets, u.morphNormals = this.morphNormals, u;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshOutlineMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshOutlineMaterial.ts ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), p = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class _ extends p.Material {
              constructor(o) {
                super(), o = o || {}, this.fog = !0, this.shaderID = "outline", this.wireframe = !1, this.outlineColor = o.color || new l.Color(0, 0, 0), this.outlineWidth = o.width || 0.1, this.outlinePushback = o.pushback || 1;
              }
              clone(o = new _()) {
                return super.clone.call(this, o), o.fog = this.fog, o.shaderID = this.shaderID, o.wireframe = this.wireframe, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterMaterial.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterMaterial.ts ***!
            \*******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SphereImposterMaterial: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class p extends l.ImposterMaterial {
              constructor(x) {
                super(x), this.shaderID = "sphereimposter", this.setValues(x);
              }
              clone(x = new p()) {
                return super.clone.call(this, x), x;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterOutlineMaterial.ts": (
          /*!**************************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterOutlineMaterial.ts ***!
            \**************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), p = e(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class _ extends p.ImposterMaterial {
              constructor(o) {
                super(o), o = o || {}, this.shaderID = "sphereimposteroutline", this.outlineColor = o.color || new l.Color(0, 0, 0), this.outlineWidth = o.width || 0.1, this.outlinePushback = o.pushback || 1, this.setValues(o);
              }
              clone(o = new _()) {
                return super.clone.call(this, o), o.outlineColor = this.outlineColor, o.outlineWidth = this.outlineWidth, o.outlinePushback = this.outlinePushback, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SpriteMaterial.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/materials/SpriteMaterial.ts ***!
            \***********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SpriteMaterial: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ../constants/SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), p = e(
              /*! ../core/Texture */
              "./src/WebGL/core/Texture.ts"
            ), _ = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), x = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), o = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class g extends o.Material {
              constructor(u) {
                super(), this.color = new _.Color(16777215), this.map = new p.Texture(), this.useScreenCoordinates = !0, this.fog = !1, this.uvOffset = new x.Vector2(0, 0), this.uvScale = new x.Vector2(1, 1), this.depthTest = !this.useScreenCoordinates, this.sizeAttenuation = !this.useScreenCoordinates, this.screenOffset = this.screenOffset, this.scaleByViewPort = !this.sizeAttenuation, this.alignment = l.SpriteAlignment.center.clone(), this.setValues(u), u = u || {}, u.depthTest === void 0 && (this.depthTest = !this.useScreenCoordinates), u.sizeAttenuation === void 0 && (this.sizeAttenuation = !this.useScreenCoordinates), u.scaleByViewPort === void 0 && (this.scaleByViewPort = !this.sizeAttenuation);
              }
              clone(u = new g()) {
                return super.clone.call(this, u), u.color.copy(this.color), u.map = this.map, u.useScreenCoordinates = this.useScreenCoordinates, u.screenOffset = this.screenOffset, u.sizeAttenuation = this.sizeAttenuation, u.scaleByViewport = this.scaleByViewPort, u.alignment.copy(this.alignment), u.uvOffset.copy(this.uvOffset), u;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterMaterial.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/materials/StickImposterMaterial.ts ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              StickImposterMaterial: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class p extends l.ImposterMaterial {
              constructor(x) {
                super(x), this.shaderID = "stickimposter", this.setValues(x);
              }
              clone(x = new p()) {
                return super.clone.call(this, x), x;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterOutlineMaterial.ts": (
          /*!*************************************************************!*\
            !*** ./src/WebGL/materials/StickImposterOutlineMaterial.ts ***!
            \*************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), p = e(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class _ extends p.ImposterMaterial {
              constructor(o = {}) {
                super(o), this.shaderID = "stickimposteroutline", this.outlineColor = new l.Color(0, 0, 0), this.outlineWidth = 0.1, this.outlinePushback = 1, o.color && (this.outlineColor = o.color), o.width && (this.outlineWidth = o.width), o.pushback && (this.outlinePushback = o.pushback), this.setValues(o);
              }
              clone(o = new _()) {
                return super.clone.call(this, o), o.outlineColor = this.outlineColor, o.outlineWidth = this.outlineWidth, o.outlinePushback = this.outlinePushback, o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/VolumetricMaterial.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/materials/VolumetricMaterial.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              VolumetricMaterial: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), p = e(
              /*! ../../colors */
              "./src/colors.ts"
            ), _ = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class x extends _.Material {
              constructor(g) {
                super(), this.transparent = !1, this.volumetric = !0, this.color = new p.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 = l.FrontSide, this.setValues(g);
              }
              clone(g = new x()) {
                return super.clone.call(this, g), g.transparent = this.transparent, g.volumetric = this.volumetric, g.color = this.color, g.transferfn = this.transferfn, g.map = this.map, g.extent = this.extent, g.maxdepth = this.maxdepth, g.unit = this.unit, g.texmatrix = this.texmatrix, g.transfermin = this.transfermin, g.transfermax = this.transfermax, g.subsamples = this.subsamples, g.shaderID = this.shaderID, g.side = this.side, g;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/materials/index.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                l.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                p.InstancedMaterial
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                _.LineBasicMaterial
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                x.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                x.MaterialIdCount
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                o.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                g.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                E.MeshOutlineMaterial
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                u.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                A.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                L.SpriteMaterial
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                C.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                D.StickImposterOutlineMaterial
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                r.VolumetricMaterial
              )
              /* harmony export */
            });
            var l = e(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            ), p = e(
              /*! ./InstancedMaterial */
              "./src/WebGL/materials/InstancedMaterial.ts"
            ), _ = e(
              /*! ./LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), x = e(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), o = e(
              /*! ./MeshDoubleLambertMaterial */
              "./src/WebGL/materials/MeshDoubleLambertMaterial.ts"
            ), g = e(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            ), E = e(
              /*! ./MeshOutlineMaterial */
              "./src/WebGL/materials/MeshOutlineMaterial.ts"
            ), u = e(
              /*! ./SphereImposterMaterial */
              "./src/WebGL/materials/SphereImposterMaterial.ts"
            ), A = e(
              /*! ./SphereImposterOutlineMaterial */
              "./src/WebGL/materials/SphereImposterOutlineMaterial.ts"
            ), L = e(
              /*! ./SpriteMaterial */
              "./src/WebGL/materials/SpriteMaterial.ts"
            ), C = e(
              /*! ./StickImposterMaterial */
              "./src/WebGL/materials/StickImposterMaterial.ts"
            ), D = e(
              /*! ./StickImposterOutlineMaterial */
              "./src/WebGL/materials/StickImposterOutlineMaterial.ts"
            ), r = e(
              /*! ./VolumetricMaterial */
              "./src/WebGL/materials/VolumetricMaterial.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/Quaternion.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/math/Quaternion.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Quaternion: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            class l {
              constructor(_, x, o, g) {
                this.x = _ || 0, this.y = x || 0, this.z = o || 0, this.w = g !== void 0 ? g : 1;
              }
              set(_, x, o, g) {
                return this.x = _, this.y = x, this.z = o, this.w = g, this;
              }
              copy(_) {
                return this.x = _.x, this.y = _.y, this.z = _.z, this.w = _.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 _ = this.length();
                return _ === 0 ? (this.x = 0, this.y = 0, this.z = 0, this.w = 1) : (_ = 1 / _, this.x *= _, this.y *= _, this.z *= _, this.w *= _), this;
              }
              multiply(_) {
                return this.multiplyQuaternions(this, _);
              }
              multiplyScalar(_) {
                return this.x *= _, this.y *= _, this.z *= _, this.w *= _, this;
              }
              multiplyQuaternions(_, x) {
                const o = _.x, g = _.y, E = _.z, u = _.w, A = x.x, L = x.y, C = x.z, D = x.w;
                return this.x = o * D + u * A + g * C - E * L, this.y = g * D + u * L + E * A - o * C, this.z = E * D + u * C + o * L - g * A, this.w = u * D - o * A - g * L - E * C, this;
              }
              sub(_) {
                return this.x -= _.x, this.y -= _.y, this.z -= _.z, this.w -= _.w, this;
              }
              clone() {
                return new l(this.x, this.y, this.z, this.w);
              }
              setFromEuler(_) {
                const x = Math.cos(_.x / 2), o = Math.cos(_.y / 2), g = Math.cos(_.z / 2), E = Math.sin(_.x / 2), u = Math.sin(_.y / 2), A = Math.sin(_.z / 2);
                return this.x = E * o * g + x * u * A, this.y = x * u * g - E * o * A, this.z = x * o * A + E * u * g, this.w = x * o * g - E * u * A, this;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/Vector2.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/math/Vector2.ts ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Vector2: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            class l {
              constructor(_, x) {
                this.x = _ || 0, this.y = x || 0;
              }
              set(_, x) {
                return this.x = _, this.y = x, this;
              }
              subVectors(_, x) {
                return this.x = _.x - x.x, this.y = _.y - x.y, this;
              }
              copy(_) {
                return this.x = _.x, this.y = _.y, this;
              }
              clone() {
                return new l(this.x, this.y);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/math/index.ts ***!
            \*********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                g.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                g.Matrix4
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                l.Quaternion
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                g.Ray
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                p.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                g.Vector3
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                _.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                x.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                o.degToRad
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Quaternion */
              "./src/WebGL/math/Quaternion.ts"
            ), p = e(
              /*! ./Vector2 */
              "./src/WebGL/math/Vector2.ts"
            ), _ = e(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), x = e(
              /*! ./utils/conversionMatrix3 */
              "./src/WebGL/math/utils/conversionMatrix3.ts"
            ), o = e(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), g = e(
              /*! ./math */
              "./src/WebGL/math/math.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/math.ts": (
          /*!********************************!*\
            !*** ./src/WebGL/math/math.ts ***!
            \********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Matrix3: () => (
                /* binding */
                L
              ),
              /* harmony export */
              Matrix4: () => (
                /* binding */
                u
              ),
              /* harmony export */
              Ray: () => (
                /* binding */
                C
              ),
              /* harmony export */
              Vector3: () => (
                /* binding */
                A
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), p = e(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), _, x, o, g, E;
            class u {
              constructor(r = 1, n = 0, b = 0, f = 0, c = 0, t = 1, a = 0, h = 0, M = 0, w = 0, S = 1, T = 0, R = 0, $ = 0, P = 0, B = 1) {
                typeof r < "u" && typeof r != "number" ? this.elements = new Float32Array(r) : (this.elements = new Float32Array(16), this.elements[0] = r, this.elements[4] = n, this.elements[8] = b, this.elements[12] = f, this.elements[1] = c, this.elements[5] = t, this.elements[9] = a, this.elements[13] = h, this.elements[2] = M, this.elements[6] = w, this.elements[10] = S, this.elements[14] = T, this.elements[3] = R, this.elements[7] = $, this.elements[11] = P, this.elements[15] = B);
              }
              // eslint-disable-next-line no-unused-vars, class-methods-use-this
              makeScale(r, n, b) {
                throw new Error("Method not implemented.");
              }
              set(r, n, b, f, c, t, a, h, M, w, S, T, R, $, P, B) {
                const F = this.elements;
                return F[0] = r, F[4] = n, F[8] = b, F[12] = f, F[1] = c, F[5] = t, F[9] = a, F[13] = h, F[2] = M, F[6] = w, F[10] = S, F[14] = T, F[3] = R, F[7] = $, F[11] = P, F[15] = B, this;
              }
              identity() {
                return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
              }
              copy(r) {
                const n = r.elements;
                return this.set(n[0], n[4], n[8], n[12], n[1], n[5], n[9], n[13], n[2], n[6], n[10], n[14], n[3], n[7], n[11], n[15]), this;
              }
              matrix3FromTopLeft() {
                const r = this.elements;
                return new L(r[0], r[4], r[8], r[1], r[5], r[9], r[2], r[6], r[10]);
              }
              setRotationFromEuler(r, n) {
                const b = this.elements, { x: f, y: c, z: t } = r, a = Math.cos(f), h = Math.sin(f), M = Math.cos(c), w = Math.sin(c), S = Math.cos(t), T = Math.sin(t);
                if (n === void 0 || n === "XYZ") {
                  const R = a * S, $ = a * T, P = h * S, B = h * T;
                  b[0] = M * S, b[4] = -M * T, b[8] = w, b[1] = $ + P * w, b[5] = R - B * w, b[9] = -h * M, b[2] = B - R * w, b[6] = P + $ * w, b[10] = a * M;
                } else
                  console.error(`Error with matrix4 setRotationFromEuler. Order: ${n}`);
                return this;
              }
              setRotationFromQuaternion(r) {
                const n = this.elements, { x: b, y: f, z: c, w: t } = r, a = b + b, h = f + f, M = c + c, w = b * a, S = b * h, T = b * M, R = f * h, $ = f * M, P = c * M, B = t * a, F = t * h, U = t * M;
                return n[0] = 1 - (R + P), n[4] = S - U, n[8] = T + F, n[1] = S + U, n[5] = 1 - (w + P), n[9] = $ - B, n[2] = T - F, n[6] = $ + B, n[10] = 1 - (w + R), this;
              }
              multiplyMatrices(r, n) {
                const b = r.elements, f = n.elements, c = this.elements, t = b[0], a = b[4], h = b[8], M = b[12], w = b[1], S = b[5], T = b[9], R = b[13], $ = b[2], P = b[6], B = b[10], F = b[14], U = b[3], z = b[7], W = b[11], V = b[15], N = f[0], k = f[4], G = f[8], Q = f[12], ie = f[1], ge = f[5], le = f[9], oe = f[13], he = f[2], se = f[6], xe = f[10], ye = f[14], Pe = f[3], de = f[7], pe = f[11], re = f[15];
                return c[0] = t * N + a * ie + h * he + M * Pe, c[4] = t * k + a * ge + h * se + M * de, c[8] = t * G + a * le + h * xe + M * pe, c[12] = t * Q + a * oe + h * ye + M * re, c[1] = w * N + S * ie + T * he + R * Pe, c[5] = w * k + S * ge + T * se + R * de, c[9] = w * G + S * le + T * xe + R * pe, c[13] = w * Q + S * oe + T * ye + R * re, c[2] = $ * N + P * ie + B * he + F * Pe, c[6] = $ * k + P * ge + B * se + F * de, c[10] = $ * G + P * le + B * xe + F * pe, c[14] = $ * Q + P * oe + B * ye + F * re, c[3] = U * N + z * ie + W * he + V * Pe, c[7] = U * k + z * ge + W * se + V * de, c[11] = U * G + z * le + W * xe + V * pe, c[15] = U * Q + z * oe + W * ye + V * re, this;
              }
              multiplyScalar(r) {
                const n = this.elements;
                return n[0] *= r, n[4] *= r, n[8] *= r, n[12] *= r, n[1] *= r, n[5] *= r, n[9] *= r, n[13] *= r, n[2] *= r, n[6] *= r, n[10] *= r, n[14] *= r, n[3] *= r, n[7] *= r, n[11] *= r, n[15] *= r, this;
              }
              makeTranslation(r, n, b) {
                return this.set(1, 0, 0, r, 0, 1, 0, n, 0, 0, 1, b, 0, 0, 0, 1), this;
              }
              // snap values close to integers to their integer value
              // useful and identifying identity matrices
              snap(r) {
                const n = Math.pow(10, 4), b = this.elements;
                for (let f = 0; f < 16; f++) {
                  const c = Math.round(b[f]);
                  c === Math.round(b[f] * n) / n && (b[f] = c);
                }
                return this;
              }
              transpose() {
                const r = this.elements;
                let n;
                return n = r[1], r[1] = r[4], r[4] = n, n = r[2], r[2] = r[8], r[8] = n, n = r[6], r[6] = r[9], r[9] = n, n = r[3], r[3] = r[12], r[12] = n, n = r[7], r[7] = r[13], r[13] = n, n = r[11], r[11] = r[14], r[14] = n, this;
              }
              setPosition(r) {
                const n = this.elements;
                return n[12] = r.x, n[13] = r.y, n[14] = r.z, this;
              }
              translate(r) {
                const n = this.elements;
                return n[12] += r.x, n[13] += r.y, n[14] += r.z, this;
              }
              getInverse(r, n) {
                const b = this.elements, f = r.elements, c = f[0], t = f[4], a = f[8], h = f[12], M = f[1], w = f[5], S = f[9], T = f[13], R = f[2], $ = f[6], P = f[10], B = f[14], F = f[3], U = f[7], z = f[11], W = f[15];
                b[0] = S * B * U - T * P * U + T * $ * z - w * B * z - S * $ * W + w * P * W, b[4] = h * P * U - a * B * U - h * $ * z + t * B * z + a * $ * W - t * P * W, b[8] = a * T * U - h * S * U + h * w * z - t * T * z - a * w * W + t * S * W, b[12] = h * S * $ - a * T * $ - h * w * P + t * T * P + a * w * B - t * S * B, b[1] = T * P * F - S * B * F - T * R * z + M * B * z + S * R * W - M * P * W, b[5] = a * B * F - h * P * F + h * R * z - c * B * z - a * R * W + c * P * W, b[9] = h * S * F - a * T * F - h * M * z + c * T * z + a * M * W - c * S * W, b[13] = a * T * R - h * S * R + h * M * P - c * T * P - a * M * B + c * S * B, b[2] = w * B * F - T * $ * F + T * R * U - M * B * U - w * R * W + M * $ * W, b[6] = h * $ * F - t * B * F - h * R * U + c * B * U + t * R * W - c * $ * W, b[10] = t * T * F - h * w * F + h * M * U - c * T * U - t * M * W + c * w * W, b[14] = h * w * R - t * T * R - h * M * $ + c * T * $ + t * M * B - c * w * B, b[3] = S * $ * F - w * P * F - S * R * U + M * P * U + w * R * z - M * $ * z, b[7] = t * P * F - a * $ * F + a * R * U - c * P * U - t * R * z + c * $ * z, b[11] = a * w * F - t * S * F - a * M * U + c * S * U + t * M * z - c * w * z, b[15] = t * S * R - a * w * R + a * M * $ - c * S * $ - t * M * P + c * w * P;
                const V = c * b[0] + M * b[4] + R * b[8] + F * b[12];
                if (V === 0) {
                  const N = "Matrix4.getInverse(): can't invert matrix, determinant is 0";
                  if (n)
                    throw new Error(N);
                  return console.warn(N), this.identity(), this;
                }
                return this.multiplyScalar(1 / V), this;
              }
              isReflected() {
                const r = this.elements, n = r[0], b = r[4], f = r[8], c = r[1], t = r[5], a = r[9], h = r[2], M = r[6], w = r[10];
                return n * t * w + // +aei
                c * M * f + // +bfg
                h * b * a - // +cdh
                h * t * f - // -ceg
                c * b * w - // -bdi
                n * M * a < 0;
              }
              scale(r) {
                const n = this.elements, { x: b } = r, { y: f } = r, { z: c } = r;
                return n[0] *= b, n[4] *= f, n[8] *= c, n[1] *= b, n[5] *= f, n[9] *= c, n[2] *= b, n[6] *= f, n[10] *= c, n[3] *= b, n[7] *= f, n[11] *= c, this;
              }
              getMaxScaleOnAxis() {
                const r = this.elements, n = r[0] * r[0] + r[1] * r[1] + r[2] * r[2], b = r[4] * r[4] + r[5] * r[5] + r[6] * r[6], f = r[8] * r[8] + r[9] * r[9] + r[10] * r[10];
                return Math.sqrt(Math.max(n, Math.max(b, f)));
              }
              makeFrustum(r, n, b, f, c, t) {
                const a = this.elements, h = 2 * c / (n - r), M = 2 * c / (f - b), w = (n + r) / (n - r), S = (f + b) / (f - b), T = -(t + c) / (t - c), R = -2 * t * c / (t - c);
                return a[0] = h, a[4] = 0, a[8] = w, a[12] = 0, a[1] = 0, a[5] = M, a[9] = S, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = T, a[14] = R, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this;
              }
              makePerspective(r, n, b, f) {
                const c = b * Math.tan((0, l.degToRad)(r * 0.5)), t = -c, a = t * n, h = c * n;
                return this.makeFrustum(a, h, t, c, b, f);
              }
              makeOrthographic(r, n, b, f, c, t) {
                const a = this.elements, h = 1 / (n - r), M = 1 / (b - f), w = 1 / (t - c), S = (n + r) * h, T = (b + f) * M, R = (t + c) * w;
                return a[0] = 2 * h, a[4] = 0, a[8] = 0, a[12] = -S, a[1] = 0, a[5] = 2 * M, a[9] = 0, a[13] = -T, a[2] = 0, a[6] = 0, a[10] = -2 * w, a[14] = -R, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this;
              }
              isEqual(r) {
                const n = r.elements, b = this.elements;
                return b[0] === n[0] && b[4] === n[4] && b[8] === n[8] && b[12] === n[12] && b[1] === n[1] && b[5] === n[5] && b[9] === n[9] && b[13] === n[13] && b[2] === n[2] && b[6] === n[6] && b[10] === n[10] && b[14] === n[14] && b[3] === n[3] && b[7] === n[7] && b[11] === n[11] && b[15] === n[15];
              }
              clone() {
                const r = this.elements;
                return new u(r[0], r[4], r[8], r[12], r[1], r[5], r[9], r[13], r[2], r[6], r[10], r[14], r[3], r[7], r[11], r[15]);
              }
              isIdentity() {
                const r = this.elements;
                return r[0] === 1 && r[4] === 0 && r[8] === 0 && r[12] === 0 && r[1] === 0 && r[5] === 1 && r[9] === 0 && r[13] === 0 && r[2] === 0 && r[6] === 0 && r[10] === 1 && r[14] === 0 && r[3] === 0 && r[7] === 0 && r[11] === 0 && r[15] === 1;
              }
              // return true if elements are with digits of identity
              isNearlyIdentity(r) {
                return this.clone().snap(r).isIdentity();
              }
              getScale(r) {
                const n = this.elements;
                return r = r || new A(), o.set(n[0], n[1], n[2]), g.set(n[4], n[5], n[6]), E.set(n[8], n[9], n[10]), r.x = o.length(), r.y = g.length(), r.z = E.length(), r;
              }
              lookAt(r, n, b) {
                const f = this.elements;
                return E.subVectors(r, n).normalize(), E.length() === 0 && (E.z = 1), o.crossVectors(b, E).normalize(), o.length() === 0 && (E.x += 1e-4, o.crossVectors(b, E).normalize()), g.crossVectors(E, o), f[0] = o.x, f[4] = g.x, f[8] = E.x, f[1] = o.y, f[5] = g.y, f[9] = E.y, f[2] = o.z, f[6] = g.z, f[10] = E.z, this;
              }
              compose(r, n, b) {
                const f = this.elements;
                return _.identity(), _.setRotationFromQuaternion(n), x.makeScale(b.x, b.y, b.z), this.multiplyMatrices(_, x), f[12] = r.x, f[13] = r.y, f[14] = r.z, this;
              }
            }
            _ = new u(), x = new u();
            class A {
              constructor(r, n, b) {
                this.x = r || 0, this.y = n || 0, this.z = b || 0, this.atomid = void 0;
              }
              set(r, n, b) {
                return this.x = r, this.y = n, this.z = b, this;
              }
              copy(r) {
                return this.x = r.x, this.y = r.y, this.z = r.z, this;
              }
              add(r) {
                return this.x += r.x, this.y += r.y, this.z += r.z, this;
              }
              addVectors(r, n) {
                return this.x = r.x + n.x, this.y = r.y + n.y, this.z = r.z + n.z, this;
              }
              multiplyVectors(r, n) {
                return this.x = r.x * n.x, this.y = r.y * n.y, this.z = r.z * n.z, this;
              }
              sub(r) {
                return this.x -= r.x, this.y -= r.y, this.z -= r.z, this;
              }
              subVectors(r, n) {
                return this.x = r.x - n.x, this.y = r.y - n.y, this.z = r.z - n.z, this;
              }
              multiplyScalar(r) {
                return this.x *= r, this.y *= r, this.z *= r, this;
              }
              divideScalar(r) {
                return r !== 0 ? (this.x /= r, this.y /= r, this.z /= r) : (this.x = 0, this.y = 0, this.z = 0), this;
              }
              // accumulate maximum
              max(r) {
                return this.x = Math.max(this.x, r.x), this.y = Math.max(this.y, r.y), this.z = Math.max(this.z, r.z), this;
              }
              // accumulate min
              min(r) {
                return this.x = Math.min(this.x, r.x), this.y = Math.min(this.y, r.y), this.z = Math.min(this.z, r.z), this;
              }
              distanceTo(r) {
                return Math.sqrt(this.distanceToSquared(r));
              }
              distanceToSquared(r) {
                const n = this.x - r.x, b = this.y - r.y, f = this.z - r.z;
                return n * n + b * b + f * f;
              }
              applyMatrix3(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this, c = r.elements;
                return this.x = c[0] * n + c[3] * b + c[6] * f, this.y = c[1] * n + c[4] * b + c[7] * f, this.z = c[2] * n + c[5] * b + c[8] * f, this;
              }
              applyMatrix4(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this, c = r.elements;
                return this.x = c[0] * n + c[4] * b + c[8] * f + c[12], this.y = c[1] * n + c[5] * b + c[9] * f + c[13], this.z = c[2] * n + c[6] * b + c[10] * f + c[14], this;
              }
              applyProjection(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this, c = r.elements, t = c[3] * n + c[7] * b + c[11] * f + c[15];
                return this.x = (c[0] * n + c[4] * b + c[8] * f + c[12]) / t, this.y = (c[1] * n + c[5] * b + c[9] * f + c[13]) / t, this.z = (c[2] * n + c[6] * b + c[10] * f + c[14]) / t, this;
              }
              applyQuaternion(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this, c = r.x, t = r.y, a = r.z, h = r.w, M = {};
                M.x = 2 * (b * a - f * t), M.y = 2 * (f * c - n * a), M.z = 2 * (n * t - b * c);
                const w = {};
                return w.x = M.y * a - M.z * t, w.y = M.z * c - M.x * a, w.z = M.x * t - M.y * c, this.x = n + h * M.x + w.x, this.y = b + h * M.y + w.y, this.z = f + h * M.z + w.z, this;
              }
              negate() {
                return this.multiplyScalar(-1);
              }
              dot(r) {
                return this.x * r.x + this.y * r.y + this.z * r.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(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this;
                return this.x = b * r.z - f * r.y, this.y = f * r.x - n * r.z, this.z = n * r.y - b * r.x, this;
              }
              crossVectors(r, n) {
                return this.x = r.y * n.z - r.z * n.y, this.y = r.z * n.x - r.x * n.z, this.z = r.x * n.y - r.y * n.x, this;
              }
              equals(r) {
                return this.x == r.x && this.y == r.y && this.z == r.z;
              }
              getPositionFromMatrix(r) {
                return this.x = r.elements[12], this.y = r.elements[13], this.z = r.elements[14], this;
              }
              setEulerFromRotationMatrix(r, n) {
                const b = r.elements, f = b[0], c = b[4], t = b[8], a = b[5], h = b[9], M = b[6], w = b[10];
                return n === void 0 || n === "XYZ" ? (this.y = Math.asin((0, p.clamp)(t, -1, 1)), Math.abs(t) < 0.99999 ? (this.x = Math.atan2(-h, w), this.z = Math.atan2(-c, f)) : (this.x = Math.atan2(M, a), this.z = 0)) : console.error(`Error with vector's setEulerFromRotationMatrix: Unknown order: ${n}`), this;
              }
              rotateAboutVector(r, n) {
                r.normalize();
                const b = Math.cos(n), f = Math.sin(n), c = this.clone().multiplyScalar(b), t = r.clone().cross(this).multiplyScalar(f), a = r.clone().multiplyScalar(r.clone().dot(this)).multiplyScalar(1 - b), h = c.add(t).add(a);
                return this.x = h.x, this.y = h.y, this.z = h.z, this;
              }
              setFromMatrixPosition(r) {
                const n = r.elements;
                return this.x = n[12], this.y = n[13], this.z = n[14], this;
              }
              // unproject is defined after Matrix4
              transformDirection(r) {
                const { x: n } = this, { y: b } = this, { z: f } = this, c = r.elements;
                return this.x = c[0] * n + c[4] * b + c[8] * f, this.y = c[1] * n + c[5] * b + c[9] * f, this.z = c[2] * n + c[6] * b + c[10] * f, this.normalize();
              }
              clone() {
                return new A(this.x, this.y, this.z);
              }
              unproject(r) {
                const n = _;
                return n.multiplyMatrices(r.matrixWorld, n.getInverse(r.projectionMatrix)), this.applyMatrix4(n);
              }
            }
            o = new A(), g = new A(), E = new A();
            class L {
              constructor(r = 1, n = 0, b = 0, f = 0, c = 1, t = 0, a = 0, h = 0, M = 1) {
                this.elements = new Float32Array(9), this.set(r, n, b, f, c, t, a, h, M);
              }
              set(r, n, b, f, c, t, a, h, M) {
                const w = this.elements;
                return w[0] = r, w[3] = n, w[6] = b, w[1] = f, w[4] = c, w[7] = t, w[2] = a, w[5] = h, w[8] = M, this;
              }
              identity() {
                return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
              }
              copy(r) {
                const n = r.elements;
                this.set(n[0], n[3], n[6], n[1], n[4], n[7], n[2], n[5], n[8]);
              }
              multiplyScalar(r) {
                const n = this.elements;
                return n[0] *= r, n[3] *= r, n[6] *= r, n[1] *= r, n[4] *= r, n[7] *= r, n[2] *= r, n[5] *= r, n[8] *= r, this;
              }
              getInverse3(r) {
                const n = r.elements, b = this.elements;
                b[0] = n[4] * n[8] - n[5] * n[7], b[3] = n[6] * n[5] - n[3] * n[8], b[6] = n[3] * n[7] - n[6] * n[4], b[1] = n[7] * n[2] - n[1] * n[8], b[4] = n[0] * n[8] - n[6] * n[2], b[7] = n[1] * n[6] - n[0] * n[7], b[2] = n[1] * n[5] - n[2] * n[4], b[5] = n[2] * n[3] - n[0] * n[5], b[8] = n[0] * n[4] - n[1] * n[3];
                const f = n[0] * b[0] + n[3] * b[1] + n[6] * b[2];
                return this.multiplyScalar(1 / f), this;
              }
              getInverse(r, n) {
                const b = r.elements, f = this.elements;
                f[0] = b[10] * b[5] - b[6] * b[9], f[1] = -b[10] * b[1] + b[2] * b[9], f[2] = b[6] * b[1] - b[2] * b[5], f[3] = -b[10] * b[4] + b[6] * b[8], f[4] = b[10] * b[0] - b[2] * b[8], f[5] = -b[6] * b[0] + b[2] * b[4], f[6] = b[9] * b[4] - b[5] * b[8], f[7] = -b[9] * b[0] + b[1] * b[8], f[8] = b[5] * b[0] - b[1] * b[4];
                const c = b[0] * f[0] + b[1] * f[3] + b[2] * f[6];
                if (c === 0) {
                  const t = "Matrix3.getInverse(): can't invert matrix, determinant is 0";
                  if (n)
                    throw new Error(t);
                  return console.warn(t), this.identity(), this;
                }
                return this.multiplyScalar(1 / c), this;
              }
              // https://en.wikipedia.org/wiki/Determinant
              getDeterminant() {
                const r = this.elements;
                return r[0] * r[4] * r[8] + // +aei
                r[1] * r[5] * r[6] + // +bfg
                r[2] * r[3] * r[7] - // +cdh
                r[2] * r[4] * r[6] - // -ceg
                r[1] * r[3] * r[8] - // -bdi
                r[0] * r[5] * r[7];
              }
              transpose() {
                let r;
                const n = this.elements;
                return r = n[1], n[1] = n[3], n[3] = r, r = n[2], n[2] = n[6], n[6] = r, r = n[5], n[5] = n[7], n[7] = r, this;
              }
              clone() {
                const r = this.elements;
                return new L(r[0], r[3], r[6], r[1], r[4], r[7], r[2], r[5], r[8]);
              }
              getMatrix4() {
                const r = this.elements;
                return new u(r[0], r[3], r[6], 0, r[1], r[4], r[7], 0, r[2], r[5], r[8], 0);
              }
            }
            class C {
              constructor(r, n) {
                this.origin = r !== void 0 ? r : new A(), this.direction = n !== void 0 ? n : new A();
              }
              set(r, n) {
                return this.origin.copy(r), this.direction.copy(n), this;
              }
              copy(r) {
                return this.origin.copy(r.origin), this.direction.copy(r.direction), this;
              }
              at(r, n) {
                return (n || new A()).copy(this.direction).multiplyScalar(r).add(this.origin);
              }
              recast(r) {
                const n = o;
                return this.origin.copy(this.at(r, n)), this;
              }
              closestPointToPoint(r, n) {
                const b = n || new A();
                b.subVectors(r, this.origin);
                const f = b.dot(this.direction);
                return b.copy(this.direction).multiplyScalar(f).add(this.origin);
              }
              distanceToPoint(r) {
                const n = o, b = n.subVectors(r, this.origin).dot(this.direction);
                return n.copy(this.direction).multiplyScalar(b).add(this.origin), n.distanceTo(r);
              }
              // eslint-disable-next-line class-methods-use-this
              isIntersectionCylinder() {
              }
              isIntersectionSphere(r) {
                return this.distanceToPoint(r.center) <= r.radius;
              }
              isIntersectionPlane(r) {
                return r.normal.dot(this.direction) !== 0 || r.distanceToPoint(this.origin) === 0;
              }
              distanceToPlane(r) {
                const n = r.normal.dot(this.direction);
                return n === 0 ? r.distanceToPoint(this.origin) === 0 ? 0 : void 0 : -(this.origin.dot(r.normal) + r.constant) / n;
              }
              intersectPlane(r, n) {
                const b = this.distanceToPlane(r);
                if (b !== void 0)
                  return this.at(b, n);
              }
              applyMatrix4(r) {
                return this.direction.add(this.origin).applyMatrix4(r), this.origin.applyMatrix4(r), this.direction.sub(this.origin), this;
              }
              clone() {
                return new C().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/clamp.ts": (
          /*!***************************************!*\
            !*** ./src/WebGL/math/utils/clamp.ts ***!
            \***************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              clamp: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p, _, x) {
              return Math.min(Math.max(p, _), x);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/conversionMatrix3.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/math/utils/conversionMatrix3.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              conversionMatrix3: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/math.ts"
            );
            function p(_, x, o, g, E, u) {
              g = g * Math.PI / 180, E = E * Math.PI / 180, u = u * Math.PI / 180;
              const A = (b) => b * b, L = Math.cos(g), C = Math.cos(E), D = Math.cos(u), r = Math.sin(u);
              return new l.Matrix3(_, x * D, o * C, 0, x * r, o * (L - C * D) / r, 0, 0, o * Math.sqrt(1 - A(L) - A(C) - A(D) + 2 * L * C * D) / r);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/degToRad.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/math/utils/degToRad.ts ***!
            \******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              degToRad: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            const l = Math.PI / 180;
            function p(_) {
              return _ * l;
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Line.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Line.ts ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Line: () => (
                /* binding */
                x
              ),
              /* harmony export */
              LineStyle: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), p = e(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), _;
            (function(o) {
              o[o.LineStrip = 0] = "LineStrip", o[o.LinePieces = 1] = "LinePieces";
            })(_ || (_ = {}));
            class x extends p.Object3D {
              constructor(g, E = new l.LineBasicMaterial({
                color: Math.random() * 16777215
              }), u = _.LineStrip) {
                super(), this.geometry = g, this.material = E, this.type = u;
              }
              clone(g = new x(this.geometry, this.material, this.type)) {
                return super.clone.call(this, g), g;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Mesh.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Mesh.ts ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Mesh: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class p extends l.Object3D {
              constructor(x, o) {
                super(), this.geometry = x, this.material = o;
              }
              clone(x) {
                return x === void 0 && (x = new p(this.geometry, this.material)), super.clone.call(this, x), x;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Sprite.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/objects/Sprite.ts ***!
            \*************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Sprite: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), p = e(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class _ extends p.Object3D {
              constructor(o = new l.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 _(this.material)) {
                return p.Object3D.prototype.clone.call(this, o), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/objects/index.ts ***!
            \************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Line: () => (
                /* reexport safe */
                l.Line
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                l.LineStyle
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                p.Mesh
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                _.Sprite
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Line */
              "./src/WebGL/objects/Line.ts"
            ), p = e(
              /*! ./Mesh */
              "./src/WebGL/objects/Mesh.ts"
            ), _ = e(
              /*! ./Sprite */
              "./src/WebGL/objects/Sprite.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/ShaderType.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/shaders/ShaderType.ts ***!
            \*****************************************/
          /***/
          (y, s, e) => {
            e.r(s);
          }
        ),
        /***/
        "./src/WebGL/shaders/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/shaders/index.ts ***!
            \************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                l.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                p.ShaderUtils
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                l.basic
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                p.clone
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                l.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                l.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                l.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                l.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                l.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                l.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                l.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                l.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                l.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                l.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                l.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                l.volumetric
              )
              /* harmony export */
            });
            var l = e(
              /*! ./lib */
              "./src/WebGL/shaders/lib/index.ts"
            ), p = e(
              /*! ./utils */
              "./src/WebGL/shaders/utils/index.ts"
            );
            e(
              /*! ./ShaderType */
              "./src/WebGL/shaders/ShaderType.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/index.ts": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/index.ts ***!
            \**********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              basic: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/basic/uniforms.ts"
            ), p = e(
              /*! ./basic.frag */
              "./src/WebGL/shaders/lib/basic/basic.frag"
            ), _ = e(
              /*! ./basic.vert */
              "./src/WebGL/shaders/lib/basic/basic.vert"
            );
            const x = {
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/uniforms.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/uniforms.ts ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/index.ts": (
          /*!****************************************!*\
            !*** ./src/WebGL/shaders/lib/index.ts ***!
            \****************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ShaderLib: () => (
                /* binding */
                n
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                l.basic
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                p.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                _.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                x.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                o.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                g.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                E.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                u.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                A.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                L.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                C.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                D.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                r.volumetric
              )
              /* harmony export */
            });
            var l = e(
              /*! ./basic */
              "./src/WebGL/shaders/lib/basic/index.ts"
            ), p = e(
              /*! ./instanced */
              "./src/WebGL/shaders/lib/instanced/index.ts"
            ), _ = e(
              /*! ./lambert */
              "./src/WebGL/shaders/lib/lambert/index.ts"
            ), x = e(
              /*! ./lambertdouble */
              "./src/WebGL/shaders/lib/lambertdouble/index.ts"
            ), o = e(
              /*! ./outline */
              "./src/WebGL/shaders/lib/outline/index.ts"
            ), g = e(
              /*! ./screen */
              "./src/WebGL/shaders/lib/screen/index.ts"
            ), E = e(
              /*! ./screenaa */
              "./src/WebGL/shaders/lib/screenaa/index.ts"
            ), u = e(
              /*! ./sphereimposter */
              "./src/WebGL/shaders/lib/sphereimposter/index.ts"
            ), A = e(
              /*! ./sphereimposteroutline */
              "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts"
            ), L = e(
              /*! ./sprite */
              "./src/WebGL/shaders/lib/sprite/index.ts"
            ), C = e(
              /*! ./stickimposter */
              "./src/WebGL/shaders/lib/stickimposter/index.ts"
            ), D = e(
              /*! ./stickimposteroutline */
              "./src/WebGL/shaders/lib/stickimposteroutline/index.ts"
            ), r = e(
              /*! ./volumetric */
              "./src/WebGL/shaders/lib/volumetric/index.ts"
            );
            const n = {
              basic: l.basic,
              instanced: p.instanced,
              lambert: _.lambert,
              lambertdouble: x.lambertdouble,
              outline: o.outline,
              screen: g.screen,
              screenaa: E.screenaa,
              sphereimposter: u.sphereimposter,
              sphereimposteroutline: A.sphereimposteroutline,
              sprite: L.sprite,
              stickimposter: C.stickimposter,
              stickimposteroutline: D.stickimposteroutline,
              volumetric: r.volumetric
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/index.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/index.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              instanced: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/instanced/uniforms.ts"
            ), p = e(
              /*! ./instanced.frag */
              "./src/WebGL/shaders/lib/instanced/instanced.frag"
            ), _ = e(
              /*! ./instanced.vert */
              "./src/WebGL/shaders/lib/instanced/instanced.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/uniforms.ts": (
          /*!*****************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/uniforms.ts ***!
            \*****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              lambert: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambert/uniforms.ts"
            ), p = e(
              /*! ./lambert.frag */
              "./src/WebGL/shaders/lib/lambert/lambert.frag"
            ), _ = e(
              /*! ./lambert.vert */
              "./src/WebGL/shaders/lib/lambert/lambert.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/uniforms.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              lambertdouble: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts"
            ), p = e(
              /*! ./lambertdouble.frag */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag"
            ), _ = e(
              /*! ./lambertdouble.vert */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/uniforms.ts ***!
            \*********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              outline: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/outline/uniforms.ts"
            ), p = e(
              /*! ./outline.frag */
              "./src/WebGL/shaders/lib/outline/outline.frag"
            ), _ = e(
              /*! ./outline.vert */
              "./src/WebGL/shaders/lib/outline/outline.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/uniforms.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new l.Color(0, 0, 0) },
              fogColor: { type: "c", value: new l.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 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/index.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/index.ts ***!
            \***********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              screen: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screen/uniforms.ts"
            ), p = e(
              /*! ./screen.frag */
              "./src/WebGL/shaders/lib/screen/screen.frag"
            ), _ = e(
              /*! ./screen.vert */
              "./src/WebGL/shaders/lib/screen/screen.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/uniforms.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/index.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/index.ts ***!
            \*************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              screenaa: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screenaa/uniforms.ts"
            ), p = e(
              /*! ./screenaa.frag */
              "./src/WebGL/shaders/lib/screenaa/screenaa.frag"
            ), _ = e(
              /*! ./screenaa.vert */
              "./src/WebGL/shaders/lib/screenaa/screenaa.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/uniforms.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/uniforms.ts ***!
            \****************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/index.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/index.ts ***!
            \*******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              sphereimposter: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts"
            ), p = e(
              /*! ./sphereimposter.frag */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag"
            ), _ = e(
              /*! ./sphereimposter.vert */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert"
            );
            const x = {
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/uniforms.ts ***!
            \**********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \**************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              sphereimposteroutline: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts"
            ), p = e(
              /*! ./sphereimposteroutline.frag */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag"
            ), _ = e(
              /*! ./sphereimposteroutline.vert */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts": (
          /*!*****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts ***!
            \*****************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new l.Color(0, 0, 0) },
              fogColor: { type: "c", value: new l.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 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/index.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/index.ts ***!
            \***********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              sprite: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sprite/uniforms.ts"
            ), p = e(
              /*! ./sprite.frag */
              "./src/WebGL/shaders/lib/sprite/sprite.frag"
            ), _ = e(
              /*! ./sprite.vert */
              "./src/WebGL/shaders/lib/sprite/sprite.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/uniforms.ts ***!
            \**************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/index.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/index.ts ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              stickimposter: () => (
                /* binding */
                g
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposter/uniforms.ts"
            ), p = e(
              /*! ../../utils/stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            ), _ = e(
              /*! ./stickimposter.partial.frag */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag"
            ), x = e(
              /*! ./stickimposter.vert */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert"
            );
            const g = {
              fragmentShader: [p.default, _.default].join(`
`).replace("#define GLSLIFY 1", ""),
              vertexShader: x.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/uniforms.ts ***!
            \*********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \*************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              stickimposteroutline: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts"
            ), p = e(
              /*! ../../utils/stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            ), _ = e(
              /*! ./stickimposteroutline.vert */
              "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert"
            );
            const o = {
              fragmentShader: (p.default + "gl_FragColor = vec4(color,1.0);}").replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts ***!
            \****************************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              outlineColor: { type: "c", value: new l.Color(0, 0, 0) },
              outlineWidth: { type: "f", value: 0.1 },
              outlinePushback: { type: "f", value: 1 }
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/index.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/index.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              volumetric: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/volumetric/uniforms.ts"
            ), p = e(
              /*! ./volumetric.frag */
              "./src/WebGL/shaders/lib/volumetric/volumetric.frag"
            ), _ = e(
              /*! ./volumetric.vert */
              "./src/WebGL/shaders/lib/volumetric/volumetric.vert"
            );
            const x = {
              fragmentShader: p.default.replace("#define GLSLIFY 1", ""),
              vertexShader: _.default.replace("#define GLSLIFY 1", ""),
              uniforms: l.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/uniforms.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/uniforms.ts ***!
            \******************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const p = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new l.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 ***!
            \******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              clone: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../../colors */
              "./src/colors.ts"
            );
            function p(_) {
              let x = {};
              for (const g in _) {
                x[g] = {}, x[g].type = _[g].type;
                var o = _[g].value;
                o instanceof l.Color ? x[g].value = o.clone() : typeof o == "number" ? x[g].value = o : o instanceof Array ? x[g].value = [] : console.error("Error copying shader uniforms from ShaderLib: unknown type for uniform");
              }
              return x;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/utils/index.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/shaders/utils/index.ts ***!
            \******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              ShaderUtils: () => (
                /* binding */
                _
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                l.clone
              )
              /* harmony export */
            });
            var l = e(
              /*! ./clone */
              "./src/WebGL/shaders/utils/clone.ts"
            ), p = e(
              /*! ./stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            );
            const _ = {
              clone: l.clone,
              stickimposterFragmentShader: p.default
            };
          }
        ),
        /***/
        "./src/WebGL/shapes/Cylinder.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Cylinder.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Cylinder: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            let p = new l.Vector3();
            class _ {
              constructor(o = new l.Vector3(), g = new l.Vector3(), E = 0) {
                this.c1 = o, this.c2 = g, this.radius = E, this.direction = new l.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 p.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 ***!
            \************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Sphere: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class p {
              constructor(x = { x: 0, y: 0, z: 0 }, o = 0) {
                this.center = new l.Vector3(x.x, x.y, x.z), this.radius = o;
              }
              set(x, o) {
                return this.center.copy(x), this.radius = o, this;
              }
              copy(x) {
                return this.center.copy(x.center), this.radius = x.radius, this;
              }
              applyMatrix4(x) {
                return this.center.applyMatrix4(x), this.radius = this.radius * x.getMaxScaleOnAxis(), this;
              }
              translate(x) {
                return this.center.add(x), this;
              }
              equals(x) {
                return x.center.equals(this.center) && x.radius === this.radius;
              }
              clone() {
                return new p().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/Triangle.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Triangle.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Triangle: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const p = new l.Vector3();
            class _ {
              constructor(o = new l.Vector3(), g = new l.Vector3(), E = new l.Vector3()) {
                this.a = o, this.b = g, this.c = E;
              }
              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), p.subVectors(this.c, this.b), o.cross(p), o.normalize(), o;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/index.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/shapes/index.ts ***!
            \***********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                p.Cylinder
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                l.Sphere
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                _.Triangle
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Sphere */
              "./src/WebGL/shapes/Sphere.ts"
            ), p = e(
              /*! ./Cylinder */
              "./src/WebGL/shapes/Cylinder.ts"
            ), _ = e(
              /*! ./Triangle */
              "./src/WebGL/shapes/Triangle.ts"
            );
          }
        ),
        /***/
        "./src/autoload.ts": (
          /*!*************************!*\
            !*** ./src/autoload.ts ***!
            \*************************/
          /***/
          (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
            __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
              /* harmony export */
              autoinit: () => (
                /* binding */
                autoinit
              ),
              /* harmony export */
              autoload: () => (
                /* binding */
                autoload
              ),
              /* harmony export */
              processing_autoinit: () => (
                /* binding */
                processing_autoinit
              ),
              /* harmony export */
              viewers: () => (
                /* binding */
                viewers
              )
              /* harmony export */
            });
            var _GLViewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
              /*! ./GLViewer */
              "./src/GLViewer.ts"
            ), _ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
              /*! ./utilities */
              "./src/utilities.ts"
            ), _colors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
              /*! ./colors */
              "./src/colors.ts"
            ), autoinit = !1, processing_autoinit = !1, viewers = {};
            function autoload(viewer, callback) {
              var i, dataname, type;
              if (document.querySelector(".viewer_3Dmoljs") != null && (autoinit = !0), autoinit) {
                processing_autoinit = !0, viewer = viewer ?? null;
                var nviewers = 0;
                document.querySelectorAll(".viewer_3Dmoljs").forEach((viewerdiv) => {
                  var datauri = [], datatypes = [], uri = "";
                  viewerdiv.style.position == "static" && (viewerdiv.style.position = "relative");
                  var UI = null;
                  if (type = null, viewerdiv.dataset.pdb)
                    datauri.push("https://files.rcsb.org/view/" + viewerdiv.dataset.pdb + ".pdb"), datatypes.push("pdb");
                  else if (viewerdiv.dataset.cid)
                    datatypes.push("sdf"), datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + viewerdiv.dataset.cid + "/SDF?record_type=3d");
                  else if (viewerdiv.dataset.href || viewerdiv.dataset.url) {
                    viewerdiv.dataset.href ? uri = viewerdiv.dataset.href : uri = viewerdiv.dataset.url, datauri.push(uri), type = uri.substring(uri.lastIndexOf(".") + 1), datatypes.push(type);
                    var molName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("."));
                    molName == "/" && (molName = uri.substring(uri.lastIndexOf("/") + 1)), viewerdiv.dataset[datatypes[datatypes.length - 1]] = molName;
                  }
                  var divdata = viewerdiv.dataset;
                  for (i in divdata)
                    i.substring(0, 3) === "pdb" && i !== "pdb" ? (datauri.push("https://files.rcsb.org/view/" + divdata[i] + ".pdb"), datatypes.push("pdb")) : i.substring(0, 4) === "href" && i !== "href" ? (uri = divdata[i], datauri.push(uri), datatypes.push(uri.substring(uri.lastIndexOf(".") + 1))) : i.substring(0, 3) === "cid" && i !== "cid" && (datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + divdata[i] + "/SDF?record_type=3d"), datatypes.push("sdf"));
                  var options = {};
                  viewerdiv.dataset.options && (options = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.options));
                  var bgcolor = _colors__WEBPACK_IMPORTED_MODULE_3__.CC.color(viewerdiv.dataset.backgroundcolor), bgalpha = viewerdiv.dataset.backgroundalpha;
                  bgalpha = bgalpha == null ? 1 : parseFloat(bgalpha);
                  var style = { line: {} };
                  viewerdiv.dataset.style && (style = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.style));
                  var select = {};
                  viewerdiv.dataset.select && (select = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.select));
                  var selectstylelist = [], surfaces = [], labels = [], zoomto = {}, spin = null, d = viewerdiv.dataset, stylere = /style(.+)/, surfre = /surface(.*)/, reslabre = /labelres(.*)/, keys = [];
                  for (dataname in d)
                    Object.prototype.hasOwnProperty.call(d, dataname) && keys.push(dataname);
                  for (keys.sort(), i = 0; i < keys.length; i++) {
                    dataname = keys[i];
                    var m = stylere.exec(dataname), selname, newsel, styleobj;
                    m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), selectstylelist.push([newsel, styleobj])), m = surfre.exec(dataname), m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), surfaces.push([newsel, styleobj])), m = reslabre.exec(dataname), m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), labels.push([newsel, styleobj])), dataname == "zoomto" && (zoomto = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname])), dataname == "spin" && (spin = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]));
                  }
                  var applyStyles = function(y) {
                    for (y.setStyle(select, style), UI && UI.createSelectionAndStyle(select, style), i = 0; i < selectstylelist.length; i++) {
                      let s = selectstylelist[i][0] || {}, e = selectstylelist[i][1] || { line: {} };
                      y.setStyle(s, e), UI && UI.createSelectionAndStyle(select, style);
                    }
                    for (i = 0; i < surfaces.length; i++) {
                      let s = surfaces[i][0] || {}, e = surfaces[i][1] || {};
                      UI ? y.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, e, s, s).then((p) => {
                        UI.loadSurface("VDW", s, e, p);
                      }) : y.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, e, s, s);
                    }
                    for (i = 0; i < labels.length; i++) {
                      let s = labels[i][0] || {}, e = labels[i][1] || {};
                      y.addResLabels(s, e);
                    }
                    y.render(), y.zoomTo(zoomto), spin && y.spin(spin.axis, spin.speed);
                  }, glviewer = viewer;
                  try {
                    var config = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.config) || {};
                    config.backgroundColor === void 0 && (config.backgroundColor = bgcolor), config.backgroundAlpha === void 0 && (config.backgroundAlpha = bgalpha), glviewer == null ? glviewer = viewers[viewerdiv.id || nviewers++] = (0, _GLViewer__WEBPACK_IMPORTED_MODULE_0__.createViewer)(viewerdiv, config) : (glviewer.setBackgroundColor(bgcolor, bgalpha), glviewer.setConfig(config), UI && UI.initiateUI()), viewerdiv.dataset.ui && $3Dmol.StateManager && (UI = new $3Dmol.StateManager(glviewer));
                  } catch (y) {
                    console.log(y), viewerdiv.textContent = "WebGL appears to be disabled.";
                  }
                  if (datauri.length != 0) {
                    let i = 0;
                    var process = function(moldata) {
                      uri = datauri[i];
                      var type = viewerdiv.dataset.type || viewerdiv.dataset.datatype || datatypes[i];
                      if (glviewer.addModel(moldata, type, options), UI) {
                        var modelName = viewerdiv.dataset[datatypes[i]];
                        UI.setModelTitle(modelName);
                      }
                      if (i += 1, i < datauri.length)
                        (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.get)(datauri[i]).then(process);
                      else {
                        if (applyStyles(glviewer), viewerdiv.dataset.callback) {
                          var runres = eval(viewerdiv.dataset.callback);
                          typeof runres == "function" && runres(glviewer);
                        }
                        processing_autoinit = !1, callback && callback(glviewer);
                      }
                    };
                    (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.get)(datauri[0]).then(process);
                  } else {
                    if (viewerdiv.dataset.element) {
                      var moldataid = "#" + viewerdiv.dataset.element, molelem = document.querySelector(moldataid), moldata = molelem ? molelem.textContent : "";
                      type = viewerdiv.dataset.type || viewerdiv.dataset.datatype, glviewer.addModel(moldata, type, options);
                    }
                    if (applyStyles(glviewer), viewerdiv.dataset.callback) {
                      var runres = eval(viewerdiv.dataset.callback);
                      typeof runres == "function" && runres(glviewer);
                    }
                    processing_autoinit = !1, callback && callback(glviewer);
                  }
                });
              }
            }
            document.onreadystatechange = () => {
              document.readyState === "complete" && autoload();
            };
          }
        ),
        /***/
        "./src/colors.ts": (
          /*!***********************!*\
            !*** ./src/colors.ts ***!
            \***********************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CC: () => (
                /* binding */
                p
              ),
              /* harmony export */
              Color: () => (
                /* binding */
                l
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* binding */
                A
              ),
              /* harmony export */
              chains: () => (
                /* binding */
                u
              ),
              /* harmony export */
              elementColors: () => (
                /* binding */
                g
              ),
              /* harmony export */
              htmlColors: () => (
                /* binding */
                _
              ),
              /* harmony export */
              residues: () => (
                /* binding */
                E
              ),
              /* harmony export */
              ssColors: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            class l {
              constructor(C, D, r) {
                return this.r = 0, this.g = 0, this.b = 0, arguments.length > 1 && typeof C == "number" ? (this.r = C || 0, this.g = D || 0, this.b = r || 0, this) : this.set(C || 0);
              }
              set(C) {
                return C instanceof l ? C.clone() : (typeof C == "number" ? this.setHex(C) : typeof C == "object" && (this.r = (C == null ? void 0 : C.r) || 0, this.g = (C == null ? void 0 : C.g) || 0, this.b = (C == null ? void 0 : C.b) || 0), this);
              }
              setHex(C) {
                return C = Math.floor(C), this.r = (C >> 16 & 255) / 255, this.g = (C >> 8 & 255) / 255, this.b = (C & 255) / 255, this;
              }
              getHex() {
                var C = Math.round(this.r * 255), D = Math.round(this.g * 255), r = Math.round(this.b * 255);
                return C << 16 | D << 8 | r;
              }
              clone() {
                return new l(this.r, this.g, this.b);
              }
              copy(C) {
                return this.r = C.r, this.g = C.g, this.b = C.b, this;
              }
              //return object that represents color components from 0 to 255
              scaled() {
                var C = {};
                return C.r = Math.round(this.r * 255), C.g = Math.round(this.g * 255), C.b = Math.round(this.b * 255), C.a = 1, C;
              }
            }
            class p {
              static color(C) {
                if (!C)
                  return p.cache[0];
                if (C instanceof l)
                  return C;
                if (typeof C == "number" && typeof p.cache[C] < "u")
                  return p.cache[C];
                if (C && Array.isArray(C))
                  return C.map(p.color);
                let D = p.getHex(C), r = new l(D);
                return p.cache[D] = r, r;
              }
              static getHex(C) {
                var D;
                if (Array.isArray(C))
                  return C.map(p.getHex);
                if (typeof C == "string") {
                  let r = C;
                  if (!isNaN(parseInt(r)))
                    return parseInt(r);
                  if (r = r.trim(), r.length == 4 && r[0] == "#" && (r = "#" + r[1] + r[1] + r[2] + r[2] + r[3] + r[3]), r.length == 7 && r[0] == "#")
                    return parseInt(r.substring(1), 16);
                  let n = p.rgbRegEx.exec(r);
                  if (n) {
                    n[1] != "" && console.log("WARNING: Opacity value in rgba ignored.  Specify separately as opacity attribute.");
                    let b = 0;
                    for (let f = 2; f < 5; f++) {
                      b *= 256;
                      let c = n[f].endsWith("%") ? 255 * parseFloat(n[f]) / 100 : parseFloat(n[f]);
                      b += Math.round(c);
                    }
                    return b;
                  }
                  return ((D = window == null ? void 0 : window.$3Dmol) === null || D === void 0 ? void 0 : D.htmlColors[C.toLowerCase()]) || 0;
                }
                return C;
              }
            }
            p.rgbRegEx = /rgb(a?)\(\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)/i, p.cache = { 0: new l(0) };
            const _ = {
              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
            }, x = {
              //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
            }, g = {
              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 })
            }, E = {
              /** @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
              }
            }, u = {
              /** @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
              }
            }, A = {
              /** secondary structure pymol */
              ssPyMol: { prop: "ss", map: x.pyMol },
              ssJmol: { prop: "ss", map: x.Jmol },
              Jmol: { prop: "elem", map: g.Jmol },
              amino: { prop: "resn", map: E.amino },
              shapely: { prop: "resn", map: E.shapely },
              nucleic: { prop: "resn", map: E.nucleic },
              chain: { prop: "chain", map: u.atom },
              rasmol: { prop: "elem", map: g.rasmol },
              default: { prop: "elem", map: g.defaultColors },
              greenCarbon: { prop: "elem", map: g.greenCarbon },
              chainHetatm: { prop: "chain", map: u.hetatm },
              cyanCarbon: { prop: "elem", map: g.cyanCarbon },
              magentaCarbon: { prop: "elem", map: g.magentaCarbon },
              purpleCarbon: { prop: "elem", map: g.purpleCarbon },
              whiteCarbon: { prop: "elem", map: g.whiteCarbon },
              orangeCarbon: { prop: "elem", map: g.orangeCarbon },
              yellowCarbon: { prop: "elem", map: g.yellowCarbon },
              blueCarbon: { prop: "elem", map: g.blueCarbon }
            };
          }
        ),
        /***/
        "./src/glcartoon.ts": (
          /*!**************************!*\
            !*** ./src/glcartoon.ts ***!
            \**************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              drawCartoon: () => (
                /* binding */
                $
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var l = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), p = e(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), _ = e(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), x = e(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), o = e(
              /*! ./colors */
              "./src/colors.ts"
            ), g = e(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), E = e(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            function u(P, B) {
              var F = [], U = P;
              U = [], U.push(P[0]);
              var z, W, V, N, k, G, Q, ie, ge;
              for (z = 1, W = P.length - 1; z < W; z++)
                if (k = P[z], G = P[z + 1], k.smoothen) {
                  var le = new l.Vector3((k.x + G.x) / 2, (k.y + G.y) / 2, (k.z + G.z) / 2);
                  le.atom = k.atom, U.push(le);
                } else
                  U.push(k);
              for (U.push(P[P.length - 1]), z = -1, V = U.length; z <= V - 3; z++)
                if (N = U[z === -1 ? 0 : z], k = U[z + 1], G = U[z + 2], Q = U[z === V - 3 ? V - 1 : z + 3], ie = new l.Vector3().subVectors(G, N).multiplyScalar(0.5), ge = new l.Vector3().subVectors(Q, k).multiplyScalar(0.5), !G.skip)
                  for (var oe = 0; oe < B; oe++) {
                    var he = 1 / B * oe, se = k.x + he * ie.x + he * he * (-3 * k.x + 3 * G.x - 2 * ie.x - ge.x) + he * he * he * (2 * k.x - 2 * G.x + ie.x + ge.x), xe = k.y + he * ie.y + he * he * (-3 * k.y + 3 * G.y - 2 * ie.y - ge.y) + he * he * he * (2 * k.y - 2 * G.y + ie.y + ge.y), ye = k.z + he * ie.z + he * he * (-3 * k.z + 3 * G.z - 2 * ie.z - ge.z) + he * he * he * (2 * k.z - 2 * G.z + ie.z + ge.z), Pe = new l.Vector3(se, xe, ye);
                    oe < B / 2 ? Pe.atom = k.atom : Pe.atom = G.atom, F.push(Pe);
                  }
              return F.push(U[U.length - 1]), F;
            }
            const A = 0.5, L = 1.3, C = 0.8, D = 0.4, r = 0.4;
            function n(P, B, F, U) {
              for (var z, W, V, N, k = 0, G = B.length; k < G; k++) {
                N = Math.round(k * (U.length - 1) / G), V = o.CC.color(U[N]);
                var Q = P.updateGeoGroup(2), ie = Q.vertexArray, ge = Q.colorArray, le = Q.faceArray;
                z = Q.vertices, W = z * 3, ie[W] = B[k].x, ie[W + 1] = B[k].y, ie[W + 2] = B[k].z, ie[W + 3] = F[k].x, ie[W + 4] = F[k].y, ie[W + 5] = F[k].z;
                for (var oe = 0; oe < 6; ++oe)
                  ge[W + 3 * oe] = V.r, ge[W + 1 + 3 * oe] = V.g, ge[W + 2 + 3 * oe] = V.b;
                if (k > 0) {
                  var he = [z, z + 1, z - 1, z - 2], se = Q.faceidx;
                  le[se] = he[0], le[se + 1] = he[1], le[se + 2] = he[3], le[se + 3] = he[1], le[se + 4] = he[2], le[se + 5] = he[3], Q.faceidx += 6;
                }
                Q.vertices += 2;
              }
            }
            function b(P, B, F, U, z, W, V) {
              var N, k, G, Q;
              if (G = B.length, G < 2 || B[0].length < 2)
                return;
              for (N = 0; N < G; N++)
                B[N] = u(B[N], U);
              if (Q = B[0].length, !z)
                return n(P, B[0], B[G - 1], F);
              var ie, ge, le, oe, he, se, xe = [], ye = [], Pe = [];
              for (k = 0; k < G; k++)
                xe.push(0.25 + 1.5 * Math.sqrt((G - 1) * k - Math.pow(k, 2)) / (G - 1)), ye.push(0.5), Pe.push(2 * (Math.pow(k / G, 2) - k / G) + 0.6);
              var de = [];
              for (k = 0; k < G * 2 - 1; k++)
                de[k] = [k, k + 1, k + 1 - 2 * G, k - 2 * G];
              de[G * 2 - 1] = [
                k,
                k + 1 - 2 * G,
                k + 1 - 4 * G,
                k - 2 * G
              ];
              var pe, re, Se, ke, $e, ze, Re, Fe, Ie, We;
              let Ue = P.updateGeoGroup();
              for (N = 0; N < Q; N++) {
                let K = P.groups, q = !1;
                Ue = P.updateGeoGroup(2 * G), K != P.groups && N > 0 && (N = N - 1, q = !0), ze = Math.round(N * (F.length - 1) / Q), $e = o.CC.color(F[ze]), he = le, se = oe, le = [], oe = [], ie = [], B[0][N].atom !== void 0 && (ke = B[0][N].atom, V === "oval" ? ge = xe : V === "rectangle" ? ge = ye : V === "parabola" && (ge = Pe)), ge || (ge = ye);
                var Be, Ne;
                for (k = 0; k < G; k++)
                  N < Q - 1 ? Be = B[k][N + 1].clone().sub(B[k][N]) : Be = B[k][N - 1].clone().sub(B[k][N]).negate(), k < G - 1 ? Ne = B[k + 1][N].clone().sub(B[k][N]) : Ne = B[k - 1][N].clone().sub(B[k][N]).negate(), ie[k] = Ne.cross(Be).normalize().multiplyScalar(z * ge[k]);
                for (k = 0; k < G; k++)
                  le[k] = B[k][N].clone().add(ie[k].clone().negate());
                for (k = 0; k < G; k++)
                  oe[k] = B[k][N].clone().add(ie[k]);
                for (Re = Ue.vertexArray, Fe = Ue.colorArray, Ie = Ue.faceArray, pe = Ue.vertices, re = pe * 3, k = 0; k < G; k++)
                  Re[re + 3 * k + 0] = le[k].x, Re[re + 3 * k + 1] = le[k].y, Re[re + 3 * k + 2] = le[k].z;
                for (k = 0; k < G; k++)
                  Re[re + 3 * k + 0 + 3 * G] = oe[G - 1 - k].x, Re[re + 3 * k + 1 + 3 * G] = oe[G - 1 - k].y, Re[re + 3 * k + 2 + 3 * G] = oe[G - 1 - k].z;
                for (k = 0; k < 2 * G; ++k)
                  Fe[re + 3 * k + 0] = $e.r, Fe[re + 3 * k + 1] = $e.g, Fe[re + 3 * k + 2] = $e.b;
                if (N > 0 && !q) {
                  for (k = 0; k < G * 2; k++)
                    We = [
                      pe + de[k][0],
                      pe + de[k][1],
                      pe + de[k][2],
                      pe + de[k][3]
                    ], Se = Ue.faceidx, Ie[Se] = We[0], Ie[Se + 1] = We[1], Ie[Se + 2] = We[3], Ie[Se + 3] = We[1], Ie[Se + 4] = We[2], Ie[Se + 5] = We[3], Ue.faceidx += 6;
                  if (ke.clickable || ke.hoverable) {
                    var H = [];
                    H.push(new p.Triangle(he[0], le[0], le[G - 1])), H.push(new p.Triangle(he[0], le[G - 1], he[G - 1])), H.push(new p.Triangle(he[G - 1], le[G - 1], oe[G - 1])), H.push(new p.Triangle(he[G - 1], oe[G - 1], se[G - 1])), H.push(new p.Triangle(oe[0], se[0], se[G - 1])), H.push(new p.Triangle(oe[G - 1], oe[0], se[G - 1])), H.push(new p.Triangle(le[0], he[0], se[0])), H.push(new p.Triangle(oe[0], le[0], se[0]));
                    for (k in H)
                      ke.intersectionShape.triangle.push(H[k]);
                  }
                }
                Ue.vertices += 2 * G;
              }
              for (Re = Ue.vertexArray, Fe = Ue.colorArray, Ie = Ue.faceArray, pe = Ue.vertices, re = pe * 3, Se = Ue.faceidx, N = 0; N < G - 1; N++)
                We = [N, N + 1, 2 * G - 2 - N, 2 * G - 1 - N], Se = Ue.faceidx, Ie[Se] = We[0], Ie[Se + 1] = We[1], Ie[Se + 2] = We[3], Ie[Se + 3] = We[1], Ie[Se + 4] = We[2], Ie[Se + 5] = We[3], Ue.faceidx += 6;
              for (N = 0; N < G - 1; N++)
                We = [
                  pe - 1 - N,
                  pe - 2 - N,
                  pe - 2 * G + N + 1,
                  pe - 2 * G + N
                ], Se = Ue.faceidx, Ie[Se] = We[0], Ie[Se + 1] = We[1], Ie[Se + 2] = We[3], Ie[Se + 3] = We[1], Ie[Se + 4] = We[2], Ie[Se + 5] = We[3], Ue.faceidx += 6;
            }
            function f(P, B, F, U, z, W) {
              if (!(B.length < 2)) {
                var V, N;
                if (V = B[0], N = B[B.length - 1], V = u(V, U), N = u(N, U), !z)
                  return n(P, V, N, F);
                var k = [], G, Q, ie, ge, le, oe = [
                  [0, 2, -6, -8],
                  [-4, -2, 6, 4],
                  [7, -1, -5, 3],
                  [-3, 5, 1, -7]
                ], he, se, xe, ye, Pe, de, pe, re, Se, ke, $e, ze, Re, Fe, Ie, We, Ue;
                for (re = 0, Se = V.length; re < Se; re++) {
                  if (Pe = Math.round(re * (F.length - 1) / Se), ye = o.CC.color(F[Pe]), k.push(Q = V[re]), k.push(Q), k.push(ie = N[re]), k.push(ie), re < Se - 1) {
                    var Be = V[re + 1].clone().sub(V[re]), Ne = N[re].clone().sub(V[re]);
                    G = Ne.cross(Be).normalize().multiplyScalar(z);
                  }
                  for (k.push(ge = V[re].clone().add(G)), k.push(ge), k.push(le = N[re].clone().add(G)), k.push(le), Q.atom !== void 0 && (de = Q.atom), Fe = P.updateGeoGroup(8), Ie = Fe.vertexArray, We = Fe.colorArray, Ue = Fe.faceArray, he = Fe.vertices, se = he * 3, Ie[se] = Q.x, Ie[se + 1] = Q.y, Ie[se + 2] = Q.z, Ie[se + 3] = Q.x, Ie[se + 4] = Q.y, Ie[se + 5] = Q.z, Ie[se + 6] = ie.x, Ie[se + 7] = ie.y, Ie[se + 8] = ie.z, Ie[se + 9] = ie.x, Ie[se + 10] = ie.y, Ie[se + 11] = ie.z, Ie[se + 12] = ge.x, Ie[se + 13] = ge.y, Ie[se + 14] = ge.z, Ie[se + 15] = ge.x, Ie[se + 16] = ge.y, Ie[se + 17] = ge.z, Ie[se + 18] = le.x, Ie[se + 19] = le.y, Ie[se + 20] = le.z, Ie[se + 21] = le.x, Ie[se + 22] = le.y, Ie[se + 23] = le.z, ke = 0; ke < 8; ++ke)
                    We[se + 3 * ke] = ye.r, We[se + 1 + 3 * ke] = ye.g, We[se + 2 + 3 * ke] = ye.b;
                  if (re > 0) {
                    var H = pe !== void 0 && de !== void 0 && pe.serial !== de.serial;
                    for (ke = 0; ke < 4; ke++) {
                      var K = [
                        he + oe[ke][0],
                        he + oe[ke][1],
                        he + oe[ke][2],
                        he + oe[ke][3]
                      ];
                      if (xe = Fe.faceidx, Ue[xe] = K[0], Ue[xe + 1] = K[1], Ue[xe + 2] = K[3], Ue[xe + 3] = K[1], Ue[xe + 4] = K[2], Ue[xe + 5] = K[3], Fe.faceidx += 6, de.clickable || pe.clickable || de.hoverable || pe.hoverable) {
                        var q = k[K[3]].clone(), fe = k[K[0]].clone(), _e = k[K[2]].clone(), Me = k[K[1]].clone();
                        if (q.atom = k[K[3]].atom || null, _e.atom = k[K[2]].atom || null, fe.atom = k[K[0]].atom || null, Me.atom = k[K[1]].atom || null, H) {
                          var Ae = q.clone().add(fe).multiplyScalar(0.5), Z = _e.clone().add(Me).multiplyScalar(0.5), ue = q.clone().add(Me).multiplyScalar(0.5);
                          ke % 2 === 0 ? ((pe.clickable || pe.hoverable) && ($e = new p.Triangle(Ae, ue, q), ze = new p.Triangle(Z, _e, ue), Re = new p.Triangle(ue, _e, q), pe.intersectionShape.triangle.push($e), pe.intersectionShape.triangle.push(ze), pe.intersectionShape.triangle.push(Re)), (de.clickable || de.hoverable) && ($e = new p.Triangle(fe, Me, ue), ze = new p.Triangle(Me, Z, ue), Re = new p.Triangle(fe, ue, Ae), de.intersectionShape.triangle.push($e), de.intersectionShape.triangle.push(ze), de.intersectionShape.triangle.push(Re))) : ((de.clickable || de.hoverable) && ($e = new p.Triangle(Ae, ue, q), ze = new p.Triangle(Z, _e, ue), Re = new p.Triangle(ue, _e, q), de.intersectionShape.triangle.push($e), de.intersectionShape.triangle.push(ze), de.intersectionShape.triangle.push(Re)), (pe.clickable || pe.hoverable) && ($e = new p.Triangle(fe, Me, ue), ze = new p.Triangle(Me, Z, ue), Re = new p.Triangle(fe, ue, Ae), pe.intersectionShape.triangle.push($e), pe.intersectionShape.triangle.push(ze), pe.intersectionShape.triangle.push(Re)));
                        } else
                          (de.clickable || de.hoverable) && ($e = new p.Triangle(fe, Me, q), ze = new p.Triangle(Me, _e, q), de.intersectionShape.triangle.push($e), de.intersectionShape.triangle.push(ze));
                      }
                    }
                  }
                  Fe.vertices += 8, pe = de;
                }
                var we = k.length - 8;
                for (Fe = P.updateGeoGroup(8), Ie = Fe.vertexArray, We = Fe.colorArray, Ue = Fe.faceArray, he = Fe.vertices, se = he * 3, xe = Fe.faceidx, re = 0; re < 4; re++) {
                  k.push(k[re * 2]), k.push(k[we + re * 2]);
                  var Te = k[re * 2], ae = k[we + re * 2];
                  Ie[se + 6 * re] = Te.x, Ie[se + 1 + 6 * re] = Te.y, Ie[se + 2 + 6 * re] = Te.z, Ie[se + 3 + 6 * re] = ae.x, Ie[se + 4 + 6 * re] = ae.y, Ie[se + 5 + 6 * re] = ae.z, We[se + 6 * re] = ye.r, We[se + 1 + 6 * re] = ye.g, We[se + 2 + 6 * re] = ye.b, We[se + 3 + 6 * re] = ye.r, We[se + 4 + 6 * re] = ye.g, We[se + 5 + 6 * re] = ye.b;
                }
                we += 8, $e = [he, he + 2, he + 6, he + 4], ze = [he + 1, he + 5, he + 7, he + 3], Ue[xe] = $e[0], Ue[xe + 1] = $e[1], Ue[xe + 2] = $e[3], Ue[xe + 3] = $e[1], Ue[xe + 4] = $e[2], Ue[xe + 5] = $e[3], Ue[xe + 6] = ze[0], Ue[xe + 7] = ze[1], Ue[xe + 8] = ze[3], Ue[xe + 9] = ze[1], Ue[xe + 10] = ze[2], Ue[xe + 11] = ze[3], Fe.faceidx += 12, Fe.vertices += 8;
              }
            }
            function c(P, B, F, U, z, W, V) {
              (!V || V === "default") && (V = "rectangle"), V === "edged" ? f(P, B, F, U, z) : (V === "rectangle" || V === "oval" || V === "parabola") && b(P, B, F, U, z, W, V);
            }
            function t(P) {
              return P && P.elem === "C" && P.atom === "CA";
            }
            function a(P, B) {
              if (P && B && P.chain === B.chain) {
                if (!P.hetflag && !B.hetflag && P.reschain === B.reschain && (P.resi === B.resi || P.resi === B.resi - 1))
                  return !0;
                if (P.resi < B.resi) {
                  var F = P.x - B.x, U = P.y - B.y, z = P.z - B.z, W = F * F + U * U + z * z;
                  if (P.atom == "CA" && B.atom == "CA" && W < 16)
                    return !0;
                  if ((P.atom == "P" || B.atom == "P") && W < 64)
                    return !0;
                }
              }
              return !1;
            }
            function h(P, B, F, U, z) {
              if (!(B == null || B.vertices == 0)) {
                z && (B.initTypedArrays(), B.setUpNormals());
                var W = new _.MeshDoubleLambertMaterial();
                W.vertexColors = _.Coloring.FaceColors, typeof F == "number" && F >= 0 && F < 1 && (W.transparent = !0, W.opacity = F), W.outline = U;
                var V = new _.Mesh(B, W);
                P.add(V);
              }
            }
            function M(P, B, F, U, z, W, V, N, k) {
              var G, Q, ie, ge, le, oe;
              if (!(!U || !z || !V)) {
                var he = z.sub(U);
                he.normalize();
                var se = N[k];
                for (Q = k + 1; Q < N.length && (se = N[Q], se.atom != V.atom); Q++)
                  ;
                if (se = se ? new l.Vector3(se.x, se.y, se.z) : new l.Vector3(0, 0, 0), se.sub(U), V.ss === "arrow start") {
                  var xe = se.clone().multiplyScalar(0.3).cross(z);
                  U.add(xe);
                  var ye = se.clone().cross(he).normalize();
                  he.rotateAboutVector(ye, 0.43);
                }
                for (V.style.cartoon.ribbon ? G = V.style.cartoon.thickness || D : V.style.cartoon.width ? G = V.style.cartoon.width : V.ss === "c" ? V.atom === "P" ? G = C : G = A : V.ss === "arrow start" ? (G = L, le = !0) : V.ss === "arrow end" || V.ss === "h" && V.style.cartoon.tubes || V.ss === "tube start" ? G = A : G = L, W != null && he.dot(W) < 0 && he.negate(), he.multiplyScalar(G), Q = 0; Q < B; Q++)
                  ie = -1 + Q * 2 / (B - 1), ge = new l.Vector3(U.x + ie * he.x, U.y + ie * he.y, U.z + ie * he.z), ge.atom = V, F && V.ss === "s" && (ge.smoothen = !0), P[Q].push(ge);
                if (le)
                  for (he.multiplyScalar(2), Q = 0; Q < B; Q++)
                    ie = -1 + Q * 2 / (B - 1), ge = new l.Vector3(U.x + ie * he.x, U.y + ie * he.y, U.z + ie * he.z), ge.atom = V, ge.smoothen = !1, ge.skip = !0, P[Q].push(ge);
                return oe = V.style.cartoon.style || "default", P.style ? P.style != oe && (console.log("Warning: a cartoon chain's strand-style is ambiguous"), P.style = "default") : P.style = oe, (V.ss === "arrow start" || V.ss === "arrow end") && (V.ss = "s"), le;
              }
            }
            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
            }, S = { DA: !0, DG: !0, A: !0, G: !0 }, T = { DT: !0, DC: !0, U: !0, C: !0, T: !0 }, R = { DA: !0, DG: !0, A: !0, G: !0, DT: !0, DC: !0, U: !0, C: !0, T: !0 };
            function $(P, B, F, U = 10) {
              let z = U, W = U;
              var V, N, k, G, Q, ie, ge, le, oe, he, se, xe, ye, Pe, de, pe, re, Se, ke = new _.Geometry(!0), $e = new _.Geometry(!0), ze = [], Re = [], Fe = 1, Ie = !1, We = {};
              for (var Ue in x.Gradient.builtinGradients)
                x.Gradient.builtinGradients.hasOwnProperty(Ue) && (We[Ue] = new x.Gradient.builtinGradients[Ue](F[1], F[0]));
              var Be = function(Y, Oe) {
                return F && Oe.color === "spectrum" ? Oe.colorscheme in We ? We[Oe.colorscheme].valueToHex(Y.resi) : We.sinebow.valueToHex(Y.resi) : (0, E.getColorFromStyle)(Y, Oe).getHex();
              };
              for (le = 0; le < z; le++)
                Re[le] = [];
              var Ne = !1, H = !1, K = [];
              for (le in B) {
                if (G = B[le], G.elem === "C" && G.atom === "CA") {
                  var q = a(k, G);
                  q && G.ss === "s" ? Ne = !0 : Ne && (k && N && k.style.cartoon.arrows && N.style.cartoon.arrows && (k.ss = "arrow end", N.ss = "arrow start"), Ne = !1), q && (k.ss === "h" || k.ss == "tube start") && k.style.cartoon.tubes ? !H && k.ss != "tube start" && G.style.cartoon.tubes && (G.ss = "tube start", H = !0) : H && (k.ss === "tube start" ? k.ss = "tube end" : N && N.style.cartoon.tubes && (N.ss = "tube end"), H = !1), N = k, k = G;
                }
                G && G.atom in w && K.push(G);
              }
              H && k.style.cartoon.tubes && (k.ss = "tube end", H = !1);
              var fe = function(Y) {
                Re[0].length > 0 && c($e, Re, ze, W, ge, Fe, Re.style);
                var Oe = [], Ve = null;
                if (Y) {
                  for (le = 0; le < z; le++)
                    Oe[le] = Re[le][Re[le].length - 1];
                  Ve = ze[ze.length - 1];
                }
                for (Re = [], le = 0; le < z; le++)
                  Re[le] = [];
                if (ze = [], Y) {
                  for (le = 0; le < z; le++)
                    Re[le].push(Oe[le]);
                  ze.push(Ve);
                }
                h(P, $e, Fe, Ie, !0), h(P, ke, Fe, Ie, !1), $e = new _.Geometry(!0), ke = new _.Geometry(!0);
              };
              k = void 0;
              for (var _e = 0; _e < K.length; _e++) {
                G = K[_e];
                var Me = G.resn.trim(), Ae = Me in R;
                if (Fe = 1, V = G.style.cartoon, k && k.style.cartoon && (Fe = k.style.cartoon.opacity), k && k.style.cartoon && k.style.cartoon.outline && (Ie = k.style.cartoon.outline), k && k.style.cartoon && (!G.style.cartoon || k.style.cartoon.opacity != G.style.cartoon.opacity) && fe(k.chain == G.chain), V.style === "trace") {
                  if (!G.hetflag) {
                    if (G.elem === "C" && G.atom === "CA" || Ae && G.atom === "P" || G.atom === "BB") {
                      if (ie = Be(G, V), (0, E.isNumeric)(V.thickness) ? ge = V.thickness : ge = D, a(k, G))
                        if (ie == Q) {
                          var Z = o.CC.color(ie);
                          g.GLDraw.drawCylinder(ke, k, G, ge, Z, 2, 2);
                        } else {
                          var ue = new l.Vector3().addVectors(k, G).multiplyScalar(0.5), we = o.CC.color(Q), Te = o.CC.color(ie);
                          g.GLDraw.drawCylinder(ke, k, ue, ge, we, 2, 0), g.GLDraw.drawCylinder(ke, ue, G, ge, Te, 0, 2);
                        }
                      if ((G.clickable === !0 || G.hoverable) && G.intersectionShape !== void 0) {
                        var ae = new l.Vector3(G.x, G.y, G.z);
                        G.intersectionShape.sphere.push(new p.Sphere(ae, ge));
                      }
                      k = G, Q = ie;
                    }
                  }
                } else {
                  if (t(G) || Ae && (G.atom === "P" || G.atom.indexOf("O5") == 0)) {
                    if (Se)
                      if (G.ss === "tube end")
                        Se = !1, re = new l.Vector3(G.x, G.y, G.z), g.GLDraw.drawCylinder(ke, pe, re, 2, o.CC.color(Q), 1, 1), G.ss = "h";
                      else if (k.chain != G.chain || k.ss === "tube end")
                        Se = !1, k.ss = "h", re = new l.Vector3(k.x, k.y, k.z), g.GLDraw.drawCylinder(ke, pe, re, 2, o.CC.color(Q), 1, 1);
                      else
                        continue;
                    if (k && (!a(k, G) || k.ss === "tube start")) {
                      for (k.ss === "tube start" && (Se = !0, pe = new l.Vector3(k.x, k.y, k.z), k.ss = "h"), de && (xe ? Pe = new l.Vector3().addVectors(k, xe).multiplyScalar(0.5) : Pe = new l.Vector3(k.x, k.y, k.z), g.GLDraw.drawCylinder(ke, Pe, de, r, o.CC.color(de.color), 0, 2), M(Re, z, !0, xe, ye, se, k, K, _e), ze.push(ie), Pe = null, de = null), Re[0].length > 0 && c($e, Re, ze, W, ge, Fe, Re.style), Re = [], le = 0; le < z; le++)
                        Re[le] = [];
                      ze = [];
                    }
                    if (k === void 0 || k.rescode != G.rescode || k.resi != G.resi) {
                      if (de && k != null) {
                        Pe = new l.Vector3().addVectors(k, G).multiplyScalar(0.5);
                        var De = Pe.clone().sub(de).multiplyScalar(0.02);
                        Pe.add(De), g.GLDraw.drawCylinder(ke, Pe, de, r, o.CC.color(de.color), 0, 2), Pe = null, de = null;
                      }
                      ie = Be(G, V), ze.push(ie), (0, E.isNumeric)(V.thickness) ? ge = V.thickness : ge = D, k = G, oe = new l.Vector3(k.x, k.y, k.z), oe.resi = k.resi, Q = ie;
                    }
                    (G.clickable === !0 || G.hoverable === !0) && (G.intersectionShape === void 0 || G.intersectionShape.triangle === void 0) && (G.intersectionShape = {
                      sphere: null,
                      cylinder: [],
                      line: [],
                      triangle: []
                    });
                  } else
                    k != null && (t(k) && G.atom === "O" || Ae && k.atom === "P" && (G.atom === "OP2" || G.atom === "O2P") || Ae && k.atom.indexOf("O5") == 0 && G.atom.indexOf("C5") == 0) ? (he = new l.Vector3(G.x, G.y, G.z), he.resi = G.resi, (G.atom === "OP2" || G.atom === "O2P") && (ye = new l.Vector3(G.x, G.y, G.z))) : Ae && G.atom.indexOf("O3") == 0 ? xe = new l.Vector3(G.x, G.y, G.z) : (G.atom === "N1" && Me in S || G.atom === "N3" && Me in T) && (de = new l.Vector3(G.x, G.y, G.z), de.color = (0, E.getColorFromStyle)(G, V).getHex());
                  he && oe && he.resi === oe.resi && (M(Re, z, !0, oe, he, se, k, K, _e), se = he, oe = null, he = null, ze.push(ie));
                }
              }
              de && (xe ? Pe = new l.Vector3().addVectors(k, xe).multiplyScalar(0.5) : Pe = new l.Vector3(k.x, k.y, k.z), g.GLDraw.drawCylinder(ke, Pe, de, r, o.CC.color(de.color), 0, 2), M(Re, z, !0, xe, ye, se, k, K, _e), ze.push(ie)), fe(!1);
            }
          }
        ),
        /***/
        "./src/index.ts": (
          /*!**********************!*\
            !*** ./src/index.ts ***!
            \**********************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CAP: () => (
                /* reexport safe */
                r.CAP
              ),
              /* harmony export */
              CC: () => (
                /* reexport safe */
                p.CC
              ),
              /* harmony export */
              Color: () => (
                /* reexport safe */
                p.Color
              ),
              /* harmony export */
              CustomLinear: () => (
                /* reexport safe */
                l.CustomLinear
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                E.Cylinder
              ),
              /* harmony export */
              GLDraw: () => (
                /* reexport safe */
                r.GLDraw
              ),
              /* harmony export */
              GLModel: () => (
                /* reexport safe */
                b.GLModel
              ),
              /* harmony export */
              GLShape: () => (
                /* reexport safe */
                D.GLShape
              ),
              /* harmony export */
              GLViewer: () => (
                /* reexport safe */
                f.GLViewer
              ),
              /* harmony export */
              GLVolumetricRender: () => (
                /* reexport safe */
                C.GLVolumetricRender
              ),
              /* harmony export */
              Gradient: () => (
                /* reexport safe */
                l.Gradient
              ),
              /* harmony export */
              GradientType: () => (
                /* reexport safe */
                l.GradientType
              ),
              /* harmony export */
              Label: () => (
                /* reexport safe */
                _.Label
              ),
              /* harmony export */
              LabelCount: () => (
                /* reexport safe */
                _.LabelCount
              ),
              /* harmony export */
              MarchingCube: () => (
                /* reexport safe */
                A.MarchingCube
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* reexport safe */
                A.MarchingCubeInitializer
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                g.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                g.Matrix4
              ),
              /* harmony export */
              Parsers: () => (
                /* reexport safe */
                o.Parsers
              ),
              /* harmony export */
              PausableTimer: () => (
                /* reexport safe */
                u.PausableTimer
              ),
              /* harmony export */
              PointGrid: () => (
                /* reexport safe */
                A.PointGrid
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* reexport safe */
                A.ProteinSurface
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                g.Quaternion
              ),
              /* harmony export */
              ROYGB: () => (
                /* reexport safe */
                l.ROYGB
              ),
              /* harmony export */
              RWB: () => (
                /* reexport safe */
                l.RWB
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                g.Ray
              ),
              /* harmony export */
              Sinebow: () => (
                /* reexport safe */
                l.Sinebow
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                E.Sphere
              ),
              /* harmony export */
              SurfaceType: () => (
                /* reexport safe */
                A.SurfaceType
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                E.Triangle
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                g.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                g.Vector3
              ),
              /* harmony export */
              VolumeData: () => (
                /* reexport safe */
                L.VolumeData
              ),
              /* harmony export */
              adjustVolumeStyle: () => (
                /* reexport safe */
                u.adjustVolumeStyle
              ),
              /* harmony export */
              applyPartialCharges: () => (
                /* reexport safe */
                x.applyPartialCharges
              ),
              /* harmony export */
              autoinit: () => (
                /* reexport safe */
                c.autoinit
              ),
              /* harmony export */
              autoload: () => (
                /* reexport safe */
                c.autoload
              ),
              /* harmony export */
              base64ToArray: () => (
                /* reexport safe */
                u.base64ToArray
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                o.bondLength
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* reexport safe */
                p.builtinColorSchemes
              ),
              /* harmony export */
              builtinGradients: () => (
                /* reexport safe */
                l.builtinGradients
              ),
              /* harmony export */
              chains: () => (
                /* reexport safe */
                p.chains
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                g.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                g.conversionMatrix3
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* reexport safe */
                f.createStereoViewer
              ),
              /* harmony export */
              createViewer: () => (
                /* reexport safe */
                f.createViewer
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* reexport safe */
                f.createViewerGrid
              ),
              /* harmony export */
              deepCopy: () => (
                /* reexport safe */
                u.deepCopy
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                g.degToRad
              ),
              /* harmony export */
              download: () => (
                /* reexport safe */
                u.download
              ),
              /* harmony export */
              drawCartoon: () => (
                /* reexport safe */
                n.drawCartoon
              ),
              /* harmony export */
              elementColors: () => (
                /* reexport safe */
                p.elementColors
              ),
              /* harmony export */
              extend: () => (
                /* reexport safe */
                u.extend
              ),
              /* harmony export */
              get: () => (
                /* reexport safe */
                u.get
              ),
              /* harmony export */
              getAtomProperty: () => (
                /* reexport safe */
                u.getAtomProperty
              ),
              /* harmony export */
              getColorFromStyle: () => (
                /* reexport safe */
                u.getColorFromStyle
              ),
              /* harmony export */
              getElement: () => (
                /* reexport safe */
                u.getElement
              ),
              /* harmony export */
              getExtent: () => (
                /* reexport safe */
                u.getExtent
              ),
              /* harmony export */
              getGradient: () => (
                /* reexport safe */
                l.getGradient
              ),
              /* harmony export */
              getPropertyRange: () => (
                /* reexport safe */
                u.getPropertyRange
              ),
              /* harmony export */
              getbin: () => (
                /* reexport safe */
                u.getbin
              ),
              /* harmony export */
              htmlColors: () => (
                /* reexport safe */
                p.htmlColors
              ),
              /* harmony export */
              isEmptyObject: () => (
                /* reexport safe */
                u.isEmptyObject
              ),
              /* harmony export */
              isNumeric: () => (
                /* reexport safe */
                u.isNumeric
              ),
              /* harmony export */
              makeFunction: () => (
                /* reexport safe */
                u.makeFunction
              ),
              /* harmony export */
              mergeGeos: () => (
                /* reexport safe */
                u.mergeGeos
              ),
              /* harmony export */
              normalizeValue: () => (
                /* reexport safe */
                l.normalizeValue
              ),
              /* harmony export */
              partialCharges: () => (
                /* reexport safe */
                x.partialCharges
              ),
              /* harmony export */
              processing_autoinit: () => (
                /* reexport safe */
                c.processing_autoinit
              ),
              /* harmony export */
              residues: () => (
                /* reexport safe */
                p.residues
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                o.setBondLength
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* reexport safe */
                A.setSyncSurface
              ),
              /* harmony export */
              specStringToObject: () => (
                /* reexport safe */
                u.specStringToObject
              ),
              /* harmony export */
              splitMesh: () => (
                /* reexport safe */
                D.splitMesh
              ),
              /* harmony export */
              ssColors: () => (
                /* reexport safe */
                p.ssColors
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* reexport safe */
                n.subdivide_spline
              ),
              /* harmony export */
              syncSurface: () => (
                /* reexport safe */
                A.syncSurface
              ),
              /* harmony export */
              viewers: () => (
                /* reexport safe */
                c.viewers
              )
              /* harmony export */
            });
            var l = e(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), p = e(
              /*! ./colors */
              "./src/colors.ts"
            ), _ = e(
              /*! ./Label */
              "./src/Label.ts"
            ), x = e(
              /*! ./partialCharges */
              "./src/partialCharges.ts"
            ), o = e(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), g = e(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), E = e(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), u = e(
              /*! ./utilities */
              "./src/utilities.ts"
            ), A = e(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), L = e(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), C = e(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), D = e(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), r = e(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), n = e(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), b = e(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), f = e(
              /*! ./GLViewer */
              "./src/GLViewer.ts"
            ), c = e(
              /*! ./autoload */
              "./src/autoload.ts"
            );
            e(
              /*! ./specs */
              "./src/specs.ts"
            ), window && (window.$3Dmol = s);
          }
        ),
        /***/
        "./src/parsers/CDJSON.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/CDJSON.ts ***!
            \*******************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CDJSON: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p, _) {
              var x = [[]];
              typeof p == "string" && (p = JSON.parse(p));
              for (var o = p.m, g = o[0].a, E = o[0].b, u = o[0].s, A = _ !== void 0 && _.parseStyle !== void 0 ? _.parseStyle : u !== void 0, L = x[x.length - 1].length, C = 0; C < g.length; C++) {
                var D = g[C], r = {};
                r.id = D.i, r.x = D.x, r.y = D.y, r.z = D.z || 0, r.bonds = [], r.bondOrder = [];
                var n = D.l || "C";
                r.elem = n[0].toUpperCase() + n.substring(1).toLowerCase(), r.serial = x[x.length - 1].length, A && (r.style = u[D.s || 0]), x[x.length - 1].push(r);
              }
              for (let b = 0; b < E.length; b++) {
                let f = E[b], c = f.b + L, t = f.e + L, a = f.o || 1, h = x[x.length - 1][c], M = x[x.length - 1][t];
                h.bonds.push(t), h.bondOrder.push(a), M.bonds.push(c), M.bondOrder.push(a);
              }
              return x;
            }
          }
        ),
        /***/
        "./src/parsers/CIF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/CIF.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CIF: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), p = e(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), _ = e(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), x = e(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            );
            function o(g, E = {}) {
              var u = [], A = !E.doAssembly, L = u.modelData = [], C = E.assignBonds === void 0 ? !0 : E.assignBonds, D = function(K, q, fe, _e) {
                return new _.Vector3(q, fe, _e).applyMatrix3(K);
              };
              function r(K, q) {
                for (var fe = [], _e = 0, Me = 0; Me < K.length; ) {
                  for (; K.substring(Me, Me + q.length) !== q && Me < K.length; )
                    if (K[Me] === "'") {
                      for (Me++; Me < K.length && K[Me] !== "'"; )
                        Me++;
                      for (; K.substring(Me, Me + q.length) !== q && Me < K.length; )
                        Me++;
                    } else if (K[Me] === '"') {
                      for (Me++; Me < K.length && K[Me] !== '"'; )
                        Me++;
                      Me++;
                    } else
                      Me++;
                  fe.push(K.substring(_e, Me)), _e = Me = Me + q.length;
                }
                return fe;
              }
              var n = g.split(/\r?\n|\r/), b = [], f = !1;
              for (let K = 0; K < n.length; K++) {
                var c = n[K].split("#")[0];
                if (f ? c[0] === ";" && (f = !1) : c[0] === ";" && (f = !0), f || c !== "") {
                  if (!f && (c = c.trim(), c[0] === "_")) {
                    var t = c.split(/\s/)[0].indexOf(".");
                    if (t > -1) {
                      let q = c.split("");
                      q[t] = "_", c = q.join(""), c = c.substring(0, t) + "_" + c.substring(t + 1);
                    }
                  }
                  b.push(c);
                }
              }
              for (var a = 0; a < b.length; ) {
                for (; !b[a].startsWith("data_") || b[a] === "data_global"; )
                  a++;
                a++;
                for (var h = {}; a < b.length && !b[a].startsWith("data_"); )
                  if (b[a][0] === void 0)
                    a++;
                  else if (b[a][0] === "_") {
                    var M = b[a].split(/\s/)[0].toLowerCase(), w = h[M] = h[M] || [], S = b[a].substring(b[a].indexOf(M) + M.length);
                    if (S === "")
                      if (a++, b[a][0] === ";") {
                        var T = b[a].substring(1);
                        for (a++; b[a] !== ";"; )
                          T = T + `
` + b[a], a++;
                        w.push(T);
                      } else
                        w.push(b[a]);
                    else
                      w.push(S.trim());
                    a++;
                  } else if (b[a].substring(0, 5) === "loop_") {
                    a++;
                    for (var R = []; b[a] === "" || b[a][0] === "_"; ) {
                      if (b[a] !== "") {
                        let K = b[a].split(/\s/)[0].toLowerCase(), q = h[K] = h[K] || [];
                        R.push(q);
                      }
                      a++;
                    }
                    for (var $ = 0; a < b.length && b[a][0] !== "_" && !b[a].startsWith("loop_") && !b[a].startsWith("data_"); ) {
                      let K = r(b[a], " ");
                      for (var P = 0; P < K.length; P++)
                        K[P] !== "" && (R[$].push(K[P]), $ = ($ + 1) % R.length);
                      a++;
                    }
                  } else
                    a++;
                L.push({ symmetries: [] }), u.push([]);
                var B = h._atom_site_id !== void 0 ? h._atom_site_id.length : h._atom_site_label.length, F;
                if (h._cell_length_a !== void 0) {
                  var U = parseFloat(h._cell_length_a), z = parseFloat(h._cell_length_b), W = parseFloat(h._cell_length_c), V = parseFloat(h._cell_angle_alpha) || 90, N = parseFloat(h._cell_angle_beta) || 90, k = parseFloat(h._cell_angle_gamma) || 90;
                  F = (0, _.conversionMatrix3)(U, z, W, V, N, k), L[L.length - 1].cryst = {
                    a: U,
                    b: z,
                    c: W,
                    alpha: V,
                    beta: N,
                    gamma: k
                  };
                }
                for (var G = 0; G < B; G++)
                  if (!(h._atom_site_group_pdb !== void 0 && h._atom_site_group_pdb[G] === "TER")) {
                    var Q = {};
                    if (h._atom_site_cartn_x !== void 0)
                      Q.x = parseFloat(h._atom_site_cartn_x[G]), Q.y = parseFloat(h._atom_site_cartn_y[G]), Q.z = parseFloat(h._atom_site_cartn_z[G]);
                    else {
                      var ie = D(F, parseFloat(h._atom_site_fract_x[G]), parseFloat(h._atom_site_fract_y[G]), parseFloat(h._atom_site_fract_z[G]));
                      Q.x = ie.x, Q.y = ie.y, Q.z = ie.z;
                    }
                    Q.chain = h._atom_site_auth_asym_id ? h._atom_site_auth_asym_id[G] : h._atom_site_label_asym_id ? h._atom_site_label_asym_id[G] : void 0, Q.resi = h._atom_site_auth_seq_id ? parseInt(h._atom_site_auth_seq_id[G]) : h._atom_site_label_seq_id ? h._atom_site_label_seq_id[G] : void 0, Q.resn = h._atom_site_auth_comp_id ? h._atom_site_auth_comp_id[G].trim() : h._atom_site_label_comp_id ? h._atom_site_label_comp_id[G].trim() : void 0, Q.atom = h._atom_site_auth_atom_id ? h._atom_site_auth_atom_id[G].replace(/"/gm, "") : h._atom_site_label_atom_id ? h._atom_site_label_atom_id[G].replace(/"/gm, "") : void 0, Q.hetflag = !h._atom_site_group_pdb || h._atom_site_group_pdb[G] === "HETA" || h._atom_site_group_pdb[G] === "HETATM";
                    var ge = "X";
                    h._atom_site_type_symbol ? ge = h._atom_site_type_symbol[G].replace(/\(?\+?\d+.*/, "") : h._atom_site_label && (ge = h._atom_site_label[G].split("_")[0].replace(/\(?\d+.*/, "")), Q.elem = ge[0].toUpperCase() + ge.substring(1, 2).toLowerCase(), Q.bonds = [], Q.ss = "c", Q.serial = G, Q.bondOrder = [], Q.properties = {}, u[u.length - 1].push(Q);
                  }
                if (h._pdbx_struct_oper_list_id !== void 0 && !A)
                  for (let K = 0; K < h._pdbx_struct_oper_list_id.length; K++) {
                    var le = parseFloat(h["_pdbx_struct_oper_list_matrix[1][1]"][K]), oe = parseFloat(h["_pdbx_struct_oper_list_matrix[1][2]"][K]), he = parseFloat(h["_pdbx_struct_oper_list_matrix[1][3]"][K]), se = parseFloat(h["_pdbx_struct_oper_list_vector[1]"][K]), xe = parseFloat(h["_pdbx_struct_oper_list_matrix[2][1]"][K]), ye = parseFloat(h["_pdbx_struct_oper_list_matrix[2][2]"][K]), Pe = parseFloat(h["_pdbx_struct_oper_list_matrix[2][3]"][K]), de = parseFloat(h["_pdbx_struct_oper_list_vector[2]"][K]), pe = parseFloat(h["_pdbx_struct_oper_list_matrix[3][1]"][K]), re = parseFloat(h["_pdbx_struct_oper_list_matrix[3][2]"][K]), Se = parseFloat(h["_pdbx_struct_oper_list_matrix[3][3]"][K]), ke = parseFloat(h["_pdbx_struct_oper_list_vector[3]"][K]), $e = new _.Matrix4(le, oe, he, se, xe, ye, Pe, de, pe, re, Se, ke);
                    L[L.length - 1].symmetries.push($e);
                  }
                var ze = function(K) {
                  var q = K.match("-");
                  K = K.replace(/[-xyz]/g, "");
                  var fe = K.split("/"), _e, Me;
                  return fe[1] === void 0 ? Me = 1 : Me = parseInt(fe[1]), fe[0] === "" ? _e = 1 : _e = parseInt(fe[0]), _e / Me * (q ? -1 : 1);
                };
                if (h._symmetry_equiv_pos_as_xyz !== void 0 && !A)
                  for (var Re = 0; Re < h._symmetry_equiv_pos_as_xyz.length; Re++) {
                    var Fe = h._symmetry_equiv_pos_as_xyz[Re].replace(/["' ]/g, ""), Ie = Fe.split(",").map(function(q) {
                      return q.replace(/-/g, "+-");
                    });
                    let K = new _.Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
                    for (let q = 0; q < 3; q++) {
                      var We = Ie[q].split("+");
                      for (let fe = 0; fe < We.length; fe++) {
                        var Ue = We[fe];
                        if (Ue !== "") {
                          var Be = ze(Ue);
                          Ue.match("x") ? K.elements[q + 0] = Be : Ue.match("y") ? K.elements[q + 4] = Be : Ue.match("z") ? K.elements[q + 8] = Be : K.elements[q + 12] = Be;
                        }
                      }
                    }
                    var Ne = F.getMatrix4(), H = new _.Matrix4().getInverse(Ne, !0);
                    K = new _.Matrix4().multiplyMatrices(K, H), K = new _.Matrix4().multiplyMatrices(Ne, K), L[L.length - 1].symmetries.push(K);
                  }
              }
              for (let K = 0; K < u.length; K++)
                C && !(E.duplicateAssemblyAtoms && !E.dontConnectDuplicatedAtoms) && (0, x.assignPDBBonds)(u[K], E), (0, l.computeSecondaryStructure)(u[K], E.hbondCutoff), (0, p.processSymmetries)(L[K].symmetries, u[K], E, L[K].cryst), E.duplicateAssemblyAtoms && !E.dontConnectDuplicatedAtoms && C && (0, x.assignPDBBonds)(u[K], E);
              return u;
            }
          }
        ),
        /***/
        "./src/parsers/CUBE.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/CUBE.ts ***!
            \*****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              CUBE: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), _ = e(
              /*! ./utils/anumToSymbol */
              "./src/parsers/utils/anumToSymbol.ts"
            );
            function x(o, g) {
              g = g || {};
              var E = [[]], u = o.split(/\r?\n/), A = g.assignBonds === void 0 ? !0 : g.assignBonds;
              if (u.length < 6)
                return E;
              var L = u[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), C = Math.abs(parseFloat(L[0]));
              let D = {};
              var r = D.origin = new l.Vector3(parseFloat(L[1]), parseFloat(L[2]), parseFloat(L[3]));
              L = u[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), L = u[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var n = L[0] > 0 ? 0.529177 : 1;
              r.multiplyScalar(n);
              var b = Math.abs(L[0]), f = new l.Vector3(parseFloat(L[1]), parseFloat(L[2]), parseFloat(L[3])).multiplyScalar(n);
              L = u[4].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var c = Math.abs(L[0]), t = new l.Vector3(parseFloat(L[1]), parseFloat(L[2]), parseFloat(L[3])).multiplyScalar(n);
              L = u[5].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var a = Math.abs(L[0]), h = new l.Vector3(parseFloat(L[1]), parseFloat(L[2]), parseFloat(L[3])).multiplyScalar(n);
              if (D.size = { x: b, y: c, z: a }, D.unit = new l.Vector3(f.x, t.y, h.z), f.y != 0 || f.z != 0 || t.x != 0 || t.z != 0 || h.x != 0 || h.y != 0) {
                D.matrix4 = new l.Matrix4(f.x, t.x, h.x, 0, f.y, t.y, h.y, 0, f.z, t.z, h.z, 0, 0, 0, 0, 1);
                let P = new l.Matrix4().makeTranslation(r.x, r.y, r.z);
                D.matrix4 = D.matrix4.multiplyMatrices(P, D.matrix4), D.matrix = D.matrix4.matrix3FromTopLeft(), D.origin = new l.Vector3(0, 0, 0), D.unit = new l.Vector3(1, 1, 1);
              }
              E.modelData = [{ cryst: D }], u = u.splice(6, C);
              for (var M = E[E.length - 1].length, w = M + u.length, S = M; S < w; ++S) {
                var T = {};
                T.serial = S;
                var R = u[S - M], $ = R.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                T.elem = _.anumToSymbol[$[0]], T.x = parseFloat($[2]) * n, T.y = parseFloat($[3]) * n, T.z = parseFloat($[4]) * n, T.hetflag = !0, T.bonds = [], T.bondOrder = [], T.properties = {}, E[E.length - 1].push(T);
              }
              if (A)
                for (let P = 0; P < E.length; P++)
                  (0, p.assignBonds)(E[P], g);
              return E;
            }
          }
        ),
        /***/
        "./src/parsers/GRO.ts": (
          /*!****************************!*\
            !*** ./src/parsers/GRO.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              GRO: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), p = e(
              /*! ./utils/atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            );
            function _(x, o) {
              for (var g = [], E = x.split(/\r?\n|\r/); E.length > 0 && !(E.length < 3); ) {
                var u = parseInt(E[1]);
                if (isNaN(u) || u <= 0 || E.length < u + 3)
                  break;
                var A = [];
                g.push(A);
                for (var L = 2, C = A.length, D = C + u, r = C; r < D; r++) {
                  var n = E[L++], b = {};
                  b.serial = r, b.atom = n.slice(10, 15).trim(), b.elem = (0, p.atomNameToElem)(b.atom, !0), b.x = 10 * parseFloat(n.slice(20, 28)), b.y = 10 * parseFloat(n.slice(28, 36)), b.z = 10 * parseFloat(n.slice(36, 44)), b.resi = parseInt(n.slice(0, 5)), b.resn = n.slice(5, 10).trim(), b.bonds = [], b.bondOrder = [], b.properties = {}, n.length > 44 && (b.dx = 10 * parseFloat(n.slice(44, 52)), b.dy = 10 * parseFloat(n.slice(52, 60)), b.dz = 10 * parseFloat(n.slice(60, 68))), A[r] = b;
                }
                if (E.length <= L + 3) {
                  var f = E[L++], c = f.trim().split(/\s+/);
                  if (c.length == 3) {
                    for (var t = 0; t < 3; t++)
                      c[t] = parseFloat(c[t]) * 10;
                    g.box = c;
                  }
                }
                E.splice(0, ++L);
              }
              for (let a = 0; a < g.length; a++)
                (0, l.assignPDBBonds)(g[a], o);
              return g;
            }
          }
        ),
        /***/
        "./src/parsers/LAMMPSTRJ.ts": (
          /*!**********************************!*\
            !*** ./src/parsers/LAMMPSTRJ.ts ***!
            \**********************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              LAMMPSTRJ: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function p(_, x) {
              for (var o = [], g = {
                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"
              }, E = _.split(/\r?\n|\r/), u = 0, A = 0, L = 0; L < E.length - 9; ) {
                for (var C = L; C < E.length; C++)
                  if (E[C].match(/ITEM: NUMBER OF ATOMS/) && (A = parseInt(E[C + 1])), E[C].match(/ITEM: ATOMS/)) {
                    u = C + 1;
                    break;
                  }
                var D = E[u - 1].replace("ITEM: ATOMS ", "").split(" ");
                o.push([]);
                for (let a = u; a < u + A; a++) {
                  for (var r = {}, n = {}, b = E[a].split(" "), f = 0; f < b.length; f++) {
                    var c = g[D[f]];
                    c != null && (c == "serial" ? r[c] = parseInt(b[f]) : c == "x" || c == "y" || c === "z" ? r[c] = parseFloat(b[f]) : c == "charge" || c == "radius" ? n[c] = parseFloat(b[f]) : r[c] = b[f]), r.properties = n, r.bonds = [], r.bondOrder = [];
                  }
                  o[o.length - 1][a - u] = r;
                }
                L = u + A - 1;
              }
              if (x.assignBonds)
                for (var t = 0; t < o.length; t++)
                  (0, l.assignBonds)(o[t], x);
              return o;
            }
          }
        ),
        /***/
        "./src/parsers/MMTF.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MMTF.ts ***!
            \*****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MMTFparser: () => (
                /* binding */
                A
              )
              /* harmony export */
            });
            var l = e(
              /*! ../utilities */
              "./src/utilities.ts"
            ), p = e(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), _ = e(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), x = e(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), o = e(
              /*! ./src/vendor/mmtf.js */
              "./src/vendor/mmtf.js"
            ), g = function(L) {
              return String.fromCharCode.apply(null, L).replace(/\0/g, "");
            }, E = function(L) {
              return L == 0 || L == 2 || L == 4 ? "h" : L == 3 ? "s" : "c";
            };
            let u = /* @__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 A(L, C) {
              var D = !C.keepH, r = C.altLoc ? C.altLoc : "A", n = !!C.noSecondaryStructure, b = !C.noComputeSecondaryStructure, f = !C.doAssembly, c = C.assemblyIndex ? C.assemblyIndex : 0;
              typeof L == "string" ? L = (0, l.base64ToArray)(L) : L = new Uint8Array(L);
              var t = o.decode(L), a = [[]], h = a.modelData = [], M = 0, w = 0, S = 0, T = t.secStructList, R = t.bFactorList, $ = t.altLocList, P = t.occupancyList, B = t.bondAtomList, F = t.bondOrderList, U = t.numModels;
              if (U == 0)
                return a;
              C.multimodel || (U = 1);
              var z, W, V, N, k, G, Q = [];
              if (!f && t.bioAssemblyList && t.bioAssemblyList.length > 0) {
                var ie = t.bioAssemblyList[c].transformList;
                for (z = 0, G = ie.length; z < G; z++) {
                  var ge = new p.Matrix4(ie[z].matrix);
                  ge.transpose(), Q.push(ge);
                }
              }
              var le = null;
              if (t.unitCell) {
                var oe = t.unitCell;
                le = { a: oe[0], b: oe[1], c: oe[2], alpha: oe[3], beta: oe[4], gamma: oe[5] };
              }
              let he = [];
              t.entityList.forEach((ve) => {
                ve.chainIndexList.forEach((X) => {
                  he[X] = ve.type == "polymer";
                });
              });
              var se = 0;
              for (k = 0; k < U; k++) {
                var xe = t.chainsPerModel[k], ye = a[a.length - 1], Pe = [];
                for (h.push({ symmetries: Q, cryst: le }), z = 0; z < xe; ++z) {
                  var de = t.groupsPerChain[M], pe = g(t.chainIdList.subarray(M * 4, M * 4 + 4));
                  t.chainNameList && (pe = g(t.chainNameList.subarray(M * 4, M * 4 + 4)));
                  var re = w, Se = "";
                  for (W = 0; W < de; ++W) {
                    var ke = t.groupList[t.groupTypeList[w]], $e = ke.atomNameList.length, ze = 0, Re = !1, Fe = !1;
                    if (T) {
                      ze = T[w];
                      var Ie = E(ze);
                      (w == 0 || Ie != Se) && (Re = !0), Se = Ie;
                      var We = w + 1;
                      (We >= T.length || E(T[We] != Ie)) && (Fe = !0);
                    }
                    var Ue = t.groupIdList[w], Be = ke.groupName;
                    let ve = ke.chemCompType;
                    var Ne = S;
                    let X = u.has(ve) || !he[M];
                    for (V = 0; V < $e; ++V) {
                      var H = ke.elementList[V];
                      if (D && H == "H") {
                        S += 1;
                        continue;
                      }
                      var K = "";
                      R && (K = R[S]);
                      var q = "";
                      $ && $[S] && (q = String.fromCharCode($[S]));
                      var fe = "";
                      if (P && (fe = P[S]), q != "" && q != r && r != "*") {
                        S += 1;
                        continue;
                      }
                      var _e = t.atomIdList[S], Me = ke.atomNameList[V], Ae = 0;
                      ke.atomChargeList && (Ae = ke.atomChargeList[V]);
                      var Z = t.xCoordList[S], ue = t.yCoordList[S], we = t.zCoordList[S];
                      Pe[S] = ye.length, ye.push({
                        resn: Be,
                        x: Z,
                        y: ue,
                        z: we,
                        elem: H,
                        hetflag: X,
                        chain: pe,
                        resi: Ue,
                        icode: q,
                        rescode: Ue + (q != " " ? "^" + q : ""),
                        // resi
                        // and
                        // icode
                        serial: _e,
                        altLoc: q,
                        index: S,
                        atom: Me,
                        bonds: [],
                        ss: E(ze),
                        ssbegin: Re,
                        ssend: Fe,
                        bondOrder: [],
                        properties: { charge: Ae, occupancy: fe },
                        b: K
                      }), S += 1;
                    }
                    var Te = ke.bondAtomList;
                    for (V = 0, N = ke.bondOrderList.length; V < N; ++V) {
                      var ae = Ne + Te[V * 2], De = Ne + Te[V * 2 + 1], Y = ke.bondOrderList[V], Oe = Pe[ae], Ve = Pe[De], I = ye[Oe], me = ye[Ve];
                      I && me && (I.bonds.push(Ve), I.bondOrder.push(Y), me.bonds.push(Oe), me.bondOrder.push(Y));
                    }
                    w += 1;
                  }
                  for (w = re, W = 0; W < de; ++W)
                    w += 1;
                  M += 1;
                }
                if (B)
                  for (let ve = se, X = B.length; ve < X; ve += 2) {
                    let ne = B[ve], Ee = B[ve + 1], He = F ? F[ve / 2] : 1;
                    if (ne >= S) {
                      se = ve;
                      break;
                    }
                    let Ke = Pe[ne], je = Pe[Ee], qe = ye[Ke], wt = ye[je];
                    qe && wt && (qe.bonds.push(je), qe.bondOrder.push(He), wt.bonds.push(Ke), wt.bondOrder.push(He));
                  }
                C.multimodel && (C.onemol || a.push([]));
              }
              if (!f)
                for (let ve = 0; ve < a.length; ve++)
                  (0, x.processSymmetries)(h[ve].symmetries, a[ve], C, h[ve].cryst);
              return b && !n && (0, _.computeSecondaryStructure)(a, C.hbondCutoff), a;
            }
          }
        ),
        /***/
        "./src/parsers/MOL2.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MOL2.ts ***!
            \*****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              MOL2: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            let l = {
              "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 p(_, x) {
              var o = [[]], g = !1;
              typeof x.keepH < "u" && (g = !x.keepH);
              var E = _.search(/@<TRIPOS>MOLECULE/), u = _.search(/@<TRIPOS>ATOM/);
              if (E == -1 || u == -1)
                return o;
              for (var A = _.substring(E).split(/\r?\n|\r/); A.length > 0; ) {
                var L = [], C = A[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), D = parseInt(C[0]), r = 0;
                C.length > 1 && (r = parseInt(C[1]));
                var n = 4, b;
                for (b = 3; b < A.length; b++)
                  if (A[b] == "@<TRIPOS>ATOM") {
                    n = b + 1;
                    break;
                  }
                var f = o[o.length - 1].length, c = f + D, t;
                for (b = f; b < c; b++) {
                  t = A[n++], C = t.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                  var a = {}, h = C[5];
                  if (l[h] !== void 0 ? h = l[h] : (h = h.split(".")[0], h = h[0].toUpperCase() + h.substring(1).toLowerCase()), a.atom = C[1], a.elem = h, !(a.elem == "H" && g)) {
                    var M = o[o.length - 1].length, w = parseInt(C[0]);
                    a.serial = w, a.x = parseFloat(C[2]), a.y = parseFloat(C[3]), a.z = parseFloat(C[4]), a.atom = C[5];
                    var S = parseFloat(C[8]);
                    a.index = M, a.bonds = [], a.bondOrder = [], a.properties = {
                      charge: S,
                      partialCharge: S
                    }, L[w] = M, o[o.length - 1].push(a);
                  }
                }
                for (var T = !1; n < A.length; )
                  if (A[n++] == "@<TRIPOS>BOND") {
                    T = !0;
                    break;
                  }
                if (T && r)
                  for (b = 0; b < r; b++) {
                    t = A[n++], C = t.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                    var R = parseInt(C[1]), $ = o[o.length - 1][L[R]], P = parseInt(C[2]), B = o[o.length - 1][L[P]], F = parseInt(C[3]);
                    isNaN(F) && (F = 1), $ !== void 0 && B !== void 0 && ($.bonds.push(L[P]), $.bondOrder.push(F), B.bonds.push(L[R]), B.bondOrder.push(F));
                  }
                if (x.multimodel) {
                  x.onemol || o.push([]), A.splice(0, n), _ = A.join(`
`);
                  continue;
                } else
                  break;
              }
              return o;
            }
          }
        ),
        /***/
        "./src/parsers/PDB.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PDB.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              PDB: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/getSinglePDB */
              "./src/parsers/utils/getSinglePDB.ts"
            );
            function p(_, x) {
              x = x || {};
              var o = [], g = {};
              o.modelData = [];
              for (var E = _.split(/\r?\n|\r/); E.length > 0; ) {
                var u = (0, l.getSinglePDB)(E, x, g), A = u[0], L = u[1];
                if (E = u[2], A.length != 0) {
                  if (x.multimodel && x.onemol && o.length > 0)
                    for (var C = o[0].length, D = 0; D < A.length; D++) {
                      var r = A[D];
                      r.index = D;
                      for (var n = 0; n < r.bonds.length; n++)
                        r.bonds[n] += C;
                      o[0].push(r);
                    }
                  else
                    o.modelData.push(L), o.push(A);
                  if (!x.multimodel)
                    break;
                }
              }
              return o;
            }
          }
        ),
        /***/
        "./src/parsers/PQR.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PQR.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              PQR: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), p = e(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            );
            function _(x, o) {
              var g = [[]], E = !o.noSecondaryStructure;
              g.modelData = [{ symmetries: [] }];
              var u = [], A = x.split(/\r?\n|\r/), L;
              for (let T = 0; T < A.length; T++) {
                L = A[T].replace(/^\s*/, "");
                var C = L.substring(0, 6);
                if (C.indexOf("END") == 0)
                  if (o.multimodel) {
                    o.onemol || g.push([]);
                    continue;
                  } else
                    break;
                else if (C == "ATOM  " || C == "HETATM") {
                  var D;
                  let R = parseInt(L.substring(6, 11)), $ = L.substring(12, 16).replace(/ /g, ""), P = L.substring(17, 20).trim(), B = L.substring(21, 22), F = parseInt(L.substring(22, 26));
                  var r = L.substring(30).trim().split(/\s+/), n = parseFloat(r[0]), b = parseFloat(r[1]), f = parseFloat(r[2]), c = parseFloat(r[3]), t = parseFloat(r[4]), a = $[0];
                  $.length > 1 && $[1].toUpperCase() != $[1] && (a = $.substring(0, 2)), L[0] == "H" ? D = !0 : D = !1, u[R] = g[g.length - 1].length, g[g.length - 1].push({
                    resn: P,
                    x: n,
                    y: b,
                    z: f,
                    elem: a,
                    hetflag: D,
                    chain: B,
                    resi: F,
                    serial: R,
                    atom: $,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {
                      charge: c,
                      partialCharge: c,
                      radius: t
                    },
                    pdbline: L
                  });
                } else if (C == "CONECT") {
                  var h = parseInt(L.substring(6, 11)), M = g[g.length - 1][u[h]];
                  for (let R = 0; R < 4; R++) {
                    var w = parseInt(L.substring([11, 16, 21, 26][R], [11, 16, 21, 26][R] + 5)), S = g[g.length - 1][u[w]];
                    M !== void 0 && S !== void 0 && (M.bonds.push(u[w]), M.bondOrder.push(1));
                  }
                }
              }
              for (let T = 0; T < g.length; T++)
                (0, l.assignPDBBonds)(g[T], o), E && (0, p.computeSecondaryStructure)(g[T], o.hbondCutoff);
              return g;
            }
          }
        ),
        /***/
        "./src/parsers/PRMTOP.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/PRMTOP.ts ***!
            \*******************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              PRMTOP: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p) {
              var _ = [], x, o = 0, g = p.split(/\r?\n|\r/);
              if (g.length > 0 && g[0].includes("VERSION")) {
                var E = g.filter(function(n) {
                  return n.includes("POINTERS") || n.includes("ATOM_NAME") || n.includes("CHARGE") || n.includes("RADII") || n.includes("BONDS_INC_HYDROGEN") || n.includes("BONDS_WITHOUT_HYDROGEN");
                }), u = D("POINTERS");
                if (u == -1)
                  return [];
                var A = r(u), L = parseInt(g[u + 1].slice(0, A[1]));
                if (isNaN(L) || L <= 0)
                  return [];
                if (u = D("ATOM_NAME"), u == -1)
                  return [];
                A = r(u);
                var C = A[0];
                for (let n = 0; n < L / A[0]; n++) {
                  n == parseInt(L / A[0]) && (C = L % A[0]);
                  for (let b = 0; b < C; b++) {
                    let f = {}, c = { charge: "", radii: "" };
                    f.serial = o, f.x = 0, f.y = 0, f.z = 0, f.atom = g[u + 1].slice(A[1] * b, A[1] * (b + 1)), f.elem = g[u + 1].slice(A[1] * b, A[1] * b + 1), f.properties = c, f.bonds = [], f.bondOrder = [], _.push(f), o++;
                  }
                  u++;
                }
                if (u = D("CHARGE"), u != -1) {
                  A = r(u), o = 0, C = A[0];
                  for (let n = 0; n < L / A[0]; n++) {
                    n == parseInt(L / A[0]) && (C = L % A[0]);
                    for (let b = 0; b < C; b++)
                      _[o].properties.charge = parseFloat(g[u + 1].slice(A[1] * b, A[1] * (b + 1))), o++;
                    u++;
                  }
                }
                if (u = D("RADII"), u != -1) {
                  A = r(u), o = 0, C = A[0];
                  for (let n = 0; n < L / A[0]; n++) {
                    n == parseInt(L / A[0]) && (C = L % A[0]);
                    for (let b = 0; b < C; b++)
                      _[o].properties.radii = parseFloat(g[u + 1].slice(A[1] * b, A[1] * (b + 1))), o++;
                    u++;
                  }
                }
                if (u = D("BONDS_WITHOUT_HYDROGEN"), u != -1)
                  for (A = r(u), o = 0, C = A[0], u = u + 1; !g[u].match(/^%FLAG/); ) {
                    g[u + 1].match(/^%FLAG/) && (C = L % A[0]);
                    for (let n = 0; n < C; n++)
                      o % 3 == 0 ? x = parseInt(g[u].slice(A[1] * n, A[1] * (n + 1)) / 3) : o % 3 == 1 && _[x].bonds.push(parseInt(g[u].slice(A[1] * n, A[1] * (n + 1)) / 3)), o++;
                    u++;
                  }
                if (u = D("BONDS_INC_HYDROGEN"), u != -1)
                  for (A = r(u), o = 0, C = A[0], u = u + 1; !g[u].match(/^%FLAG/); ) {
                    g[u + 1].match(/^%FLAG/) && (C = L % A[0]);
                    for (let n = 0; n < C; n++)
                      o % 3 == 0 ? x = parseInt(g[u].slice(A[1] * n, A[1] * (n + 1)) / 3) : o % 3 == 1 && _[x].bonds.push(parseInt(g[u].slice(A[1] * n, A[1] * (n + 1)) / 3)), o++;
                    u++;
                  }
              } else
                return [];
              function D(n) {
                var b = g.indexOf(E.filter(function(f) {
                  return f.includes(n);
                })[0]);
                if (Number.isInteger(b) && b > 0) {
                  for (; !g[b].includes("FORMAT"); )
                    b++;
                  return b;
                } else
                  return -1;
              }
              function r(n) {
                var b = g[n].match(/\((\d*)\S*/), f = g[n].match(/[a-zA-Z](\d*)\)\s*/);
                return f == null && (f = g[n].match(/[a-zA-Z](\d*)\.\d*\)\s*/)), [b[1], f[1]];
              }
              return [_];
            }
          }
        ),
        /***/
        "./src/parsers/SDF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/SDF.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              SDF: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = function(x, o) {
              var g = [[]], E = !1;
              for (typeof o.keepH < "u" && (E = !o.keepH); x.length > 0 && !(x.length < 4); ) {
                var u = parseInt(x[3].substring(0, 3));
                if (isNaN(u) || u <= 0)
                  break;
                var A = parseInt(x[3].substring(3, 6)), L = 4;
                if (x.length < 4 + u + A)
                  break;
                var C = [], D = g[g.length - 1].length, r = D + u, n, b;
                for (n = D; n < r; n++, L++) {
                  b = x[L];
                  var f = {}, c = b.substring(31, 34).replace(/ /g, "");
                  f.atom = f.elem = c[0].toUpperCase() + c.substring(1).toLowerCase(), (f.elem !== "H" || !E) && (f.serial = n, C[n] = g[g.length - 1].length, f.x = parseFloat(b.substring(0, 10)), f.y = parseFloat(b.substring(10, 20)), f.z = parseFloat(b.substring(20, 30)), f.hetflag = !0, f.bonds = [], f.bondOrder = [], f.properties = {}, f.index = g[g.length - 1].length, g[g.length - 1].push(f));
                }
                for (n = 0; n < A; n++, L++) {
                  b = x[L];
                  var t = C[parseInt(b.substring(0, 3)) - 1 + D], a = C[parseInt(b.substring(3, 6)) - 1 + D], h = parseFloat(b.substring(6));
                  typeof t < "u" && typeof a < "u" && (g[g.length - 1][t].bonds.push(a), g[g.length - 1][t].bondOrder.push(h), g[g.length - 1][a].bonds.push(t), g[g.length - 1][a].bondOrder.push(h));
                }
                if (o.multimodel) {
                  for (o.onemol || g.push([]); x[L] !== "$$$$" && L < x.length; )
                    L++;
                  x.splice(0, ++L);
                } else
                  break;
              }
              return g;
            }, p = function(x, o) {
              var g = [[]], E = !1;
              for (typeof o.keepH < "u" && (E = !o.keepH); x.length > 0 && !(x.length < 8 || !x[4].startsWith("M  V30 BEGIN CTAB") || !x[5].startsWith("M  V30 COUNTS") || x[5].length < 14); ) {
                var u = x[5].substring(13).match(/\S+/g);
                if (u.length < 2)
                  break;
                var A = parseInt(u[0]);
                if (isNaN(A) || A <= 0)
                  break;
                var L = parseInt(u[1]), C = 7;
                if (x.length < 8 + A + L)
                  break;
                var D = [], r = g[g.length - 1].length, n = r + A, b, f;
                for (b = r; b < n; b++, C++) {
                  f = x[C];
                  var c = f.substring(6).match(/\S+/g);
                  if (c.length > 4) {
                    var t = {}, a = c[1].replace(/ /g, "");
                    t.atom = t.elem = a[0].toUpperCase() + a.substring(1).toLowerCase(), (t.elem !== "H" || !E) && (t.serial = b, D[b] = g[g.length - 1].length, t.x = parseFloat(c[2]), t.y = parseFloat(c[3]), t.z = parseFloat(c[4]), t.hetflag = !0, t.bonds = [], t.bondOrder = [], t.properties = {}, t.index = g[g.length - 1].length, g[g.length - 1].push(t));
                  }
                }
                if (x[C] === "M  V30 END ATOM")
                  C++;
                else
                  break;
                if (L !== 0 && x[C] === "M  V30 BEGIN BOND")
                  C++;
                else
                  break;
                for (b = 0; b < L; b++, C++) {
                  f = x[C];
                  var h = f.substring(6).match(/\S+/g);
                  if (h.length > 3) {
                    var M = D[parseInt(h[2]) - 1 + r], w = D[parseInt(h[3]) - 1 + r], S = parseFloat(h[1]);
                    typeof M < "u" && typeof w < "u" && (g[g.length - 1][M].bonds.push(w), g[g.length - 1][M].bondOrder.push(S), g[g.length - 1][w].bonds.push(M), g[g.length - 1][w].bondOrder.push(S));
                  }
                }
                if (o.multimodel) {
                  for (o.onemol || g.push([]); x[C] !== "$$$$" && C < x.length; )
                    C++;
                  x.splice(0, ++C);
                } else
                  break;
              }
              return g;
            };
            function _(x, o) {
              var g = "V2000", E = x.split(/\r?\n|\r/);
              return E.length > 3 && E[3].length > 38 && (g = E[3].substring(34, 39)), g === "V2000" ? l(E, o) : g === "V3000" ? p(E, o) : [[""]];
            }
          }
        ),
        /***/
        "./src/parsers/VASP.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/VASP.ts ***!
            \*****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              VASP: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            );
            function p(_) {
              var x = [[]], o = {}, g = _.replace(/^\s+/, "").split(/\r?\n/);
              if (g.length < 3)
                return x;
              if (g[1].match(/\d+/))
                o.length = parseFloat(g[1]);
              else
                return console.log("Warning: second line of the vasp structure file must be a number"), x;
              if (o.length < 0)
                return console.log("Warning: Vasp implementation for negative lattice lengths is not yet available"), x;
              o.xVec = new Float32Array(g[2].replace(/^\s+/, "").split(/\s+/)), o.yVec = new Float32Array(g[3].replace(/^\s+/, "").split(/\s+/)), o.zVec = new Float32Array(g[4].replace(/^\s+/, "").split(/\s+/));
              var E = new l.Matrix3(o.xVec[0], o.xVec[1], o.xVec[2], o.yVec[0], o.yVec[1], o.yVec[2], o.zVec[0], o.zVec[1], o.zVec[2]);
              E.multiplyScalar(o.length), x.modelData = [{ symmetries: [], cryst: { matrix: E } }];
              var u = g[5].replace(/\s+/, "").replace(/\s+$/, "").split(/\s+/), A = new Int16Array(g[6].replace(/^\s+/, "").split(/\s+/)), L = g[7].replace(/\s+/, "");
              if (L.match(/C/))
                L = "cartesian";
              else if (L.match(/D/))
                L = "direct";
              else
                return console.log("Warning: Unknown vasp mode in POSCAR file: mode must be either C(artesian) or D(irect)"), x;
              if (u.length != A.length)
                return console.log("Warning: declaration of atomary species wrong:"), console.log(u), console.log(A), x;
              g.splice(0, 8);
              for (var C = 0, D = 0, r = u.length; D < r; D++) {
                for (var n = u[D], b = 0, f = A[D]; b < f; b++) {
                  var c = new Float32Array(g[C + b].replace(/^\s+/, "").split(/\s+/)), t = {};
                  t.elem = n, L == "cartesian" ? (t.x = o.length * c[0], t.y = o.length * c[1], t.z = o.length * c[2]) : (t.x = o.length * (c[0] * o.xVec[0] + c[1] * o.yVec[0] + c[2] * o.zVec[0]), t.y = o.length * (c[0] * o.xVec[1] + c[1] * o.yVec[1] + c[2] * o.zVec[1]), t.z = o.length * (c[0] * o.xVec[2] + c[1] * o.yVec[2] + c[2] * o.zVec[2])), t.bonds = [], x[0].push(t);
                }
                C += A[D];
              }
              return x;
            }
          }
        ),
        /***/
        "./src/parsers/XYZ.ts": (
          /*!****************************!*\
            !*** ./src/parsers/XYZ.ts ***!
            \****************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              XYZ: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function _(x, o) {
              o = o || {};
              for (var g = [[]], E = o.assignBonds === void 0 ? !0 : o.assignBonds, u = x.split(/\r?\n|\r/); u.length > 0 && !(u.length < 3); ) {
                var A = parseInt(u[0]);
                if (isNaN(A) || A <= 0 || u.length < A + 2)
                  break;
                var L = /Lattice\s*=\s*["\{\}]([^"\{\}]+)["\{\}]\s*/gi, C = L.exec(u[1]);
                if (C != null && C.length > 1) {
                  var D = new Float32Array(C[1].split(/\s+/)), r = new l.Matrix3(D[0], D[3], D[6], D[1], D[4], D[7], D[2], D[5], D[8]);
                  g.modelData = [{ cryst: { matrix: r } }];
                }
                for (var n = 2, b = g[g.length - 1].length, f = b + A, c = b; c < f; c++) {
                  var t = u[n++], a = t.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), h = {};
                  h.serial = c;
                  var M = a[0];
                  h.atom = h.elem = M[0].toUpperCase() + M.substring(1, 2).toLowerCase(), h.x = parseFloat(a[1]), h.y = parseFloat(a[2]), h.z = parseFloat(a[3]), h.hetflag = !0, h.bonds = [], h.bondOrder = [], h.properties = {}, g[g.length - 1][c] = h, a.length >= 7 && (h.dx = parseFloat(a[4]), h.dy = parseFloat(a[5]), h.dz = parseFloat(a[6]));
                }
                if (o.multimodel)
                  g.push([]), u.splice(0, n);
                else
                  break;
              }
              if (E)
                for (let S = 0; S < g.length; S++)
                  (0, p.assignBonds)(g[S], o);
              if (o.onemol) {
                var w = g;
                g = [], g.push(w[0]);
                for (let S = 1; S < w.length; S++) {
                  let T = g[0].length;
                  for (let R = 0; R < w[S].length; R++) {
                    let $ = w[S][R];
                    for (let P = 0; P < $.bonds.length; P++)
                      $.bonds[P] = $.bonds[P] + T;
                    $.index = g[0].length, $.serial = g[0].length, g[0].push($);
                  }
                }
              }
              return g;
            }
          }
        ),
        /***/
        "./src/parsers/index.ts": (
          /*!******************************!*\
            !*** ./src/parsers/index.ts ***!
            \******************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Parsers: () => (
                /* binding */
                b
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                n.bondLength
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                n.setBondLength
              )
              /* harmony export */
            });
            var l = e(
              /*! ./VASP */
              "./src/parsers/VASP.ts"
            ), p = e(
              /*! ./CUBE */
              "./src/parsers/CUBE.ts"
            ), _ = e(
              /*! ./XYZ */
              "./src/parsers/XYZ.ts"
            ), x = e(
              /*! ./SDF */
              "./src/parsers/SDF.ts"
            ), o = e(
              /*! ./CDJSON */
              "./src/parsers/CDJSON.ts"
            ), g = e(
              /*! ./CIF */
              "./src/parsers/CIF.ts"
            ), E = e(
              /*! ./MOL2 */
              "./src/parsers/MOL2.ts"
            ), u = e(
              /*! ./PDB */
              "./src/parsers/PDB.ts"
            ), A = e(
              /*! ./PQR */
              "./src/parsers/PQR.ts"
            ), L = e(
              /*! ./MMTF */
              "./src/parsers/MMTF.ts"
            ), C = e(
              /*! ./PRMTOP */
              "./src/parsers/PRMTOP.ts"
            ), D = e(
              /*! ./GRO */
              "./src/parsers/GRO.ts"
            ), r = e(
              /*! ./LAMMPSTRJ */
              "./src/parsers/LAMMPSTRJ.ts"
            ), n = e(
              /*! ./utils/bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            const b = {
              vasp: l.VASP,
              VASP: l.VASP,
              cube: p.CUBE,
              CUBE: p.CUBE,
              xyz: _.XYZ,
              XYZ: _.XYZ,
              sdf: x.SDF,
              SDF: x.SDF,
              json: o.CDJSON,
              cdjson: o.CDJSON,
              CDJSON: o.CDJSON,
              mcif: g.CIF,
              cif: g.CIF,
              CIF: g.CIF,
              mol2: E.MOL2,
              MOL2: E.MOL2,
              pdb: u.PDB,
              PDB: u.PDB,
              pdbqt: u.PDB,
              PDBQT: u.PDB,
              pqr: A.PQR,
              PQR: A.PQR,
              mmtf: L.MMTFparser,
              MMTF: L.MMTFparser,
              prmtop: C.PRMTOP,
              PRMTOP: C.PRMTOP,
              gro: D.GRO,
              GRO: D.GRO,
              lammpstrj: r.LAMMPSTRJ,
              LAMMPSTRJ: r.LAMMPSTRJ
            };
          }
        ),
        /***/
        "./src/parsers/utils/anumToSymbol.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/anumToSymbol.ts ***!
            \*******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              anumToSymbol: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = {
              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 ***!
            \*******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              areConnected: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var l = e(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            const p = /* @__PURE__ */ new Set(["Na", "K", "Ca", "Mg", "Mn", "Sr"]);
            function _(x, o, g) {
              if (g && g.unboundCations && (p.has(x.elem) || p.has(o.elem)))
                return !1;
              let E = (0, l.bondLength)(x.elem) + (0, l.bondLength)(o.elem);
              E += 0.25, E *= E;
              let u = x.x - o.x;
              if (u *= u, u > E)
                return !1;
              let A = x.y - o.y;
              if (A *= A, A > E)
                return !1;
              let L = x.z - o.z;
              if (L *= L, L > E)
                return !1;
              const C = u + A + L;
              return !(isNaN(C) || C < 0.5 || C > E || x.altLoc !== o.altLoc && x.altLoc !== " " && o.altLoc !== " ");
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBackboneHBonds.ts": (
          /*!***************************************************!*\
            !*** ./src/parsers/utils/assignBackboneHBonds.ts ***!
            \***************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              assignBackboneHBonds: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p, _) {
              const x = _ || 3.2, o = x * x, g = [];
              for (let E = 0, u = p.length; E < u; E++) {
                p[E].index = E;
                const A = p[E];
                !A.hetflag && (A.atom === "N" || A.atom === "O") && (g.push(A), A.hbondOther = null, A.hbondDistanceSq = Number.POSITIVE_INFINITY);
              }
              g.sort(function(E, u) {
                return E.z - u.z;
              });
              for (let E = 0, u = g.length; E < u; E++) {
                const A = g[E];
                for (let L = E + 1; L < u; L++) {
                  const C = g[L], D = C.z - A.z;
                  if (D > x)
                    break;
                  if (C.atom == A.atom)
                    continue;
                  const r = Math.abs(C.y - A.y);
                  if (r > x)
                    continue;
                  const n = Math.abs(C.x - A.x);
                  if (n > x)
                    continue;
                  const b = n * n + r * r + D * D;
                  b > o || C.chain == A.chain && Math.abs(C.resi - A.resi) < 4 || (b < A.hbondDistanceSq && (A.hbondOther = C, A.hbondDistanceSq = b), b < C.hbondDistanceSq && (C.hbondOther = A, C.hbondDistanceSq = b));
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBonds.ts": (
          /*!******************************************!*\
            !*** ./src/parsers/utils/assignBonds.ts ***!
            \******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              assignBonds: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            );
            const p = [
              { 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 }
            ], _ = 4.95;
            function x(o, g) {
              for (let A = 0, L = o.length; A < L; A++)
                o[A].index || (o[A].index = A);
              const E = {
                x: {
                  y: {
                    z: []
                  }
                }
              };
              for (let A = 0; A < o.length; A++) {
                const L = o[A], C = Math.floor(L.x / _), D = Math.floor(L.y / _), r = Math.floor(L.z / _);
                E[C] || (E[C] = {}), E[C][D] || (E[C][D] = {}), E[C][D][r] || (E[C][D][r] = []), E[C][D][r].push(L);
              }
              function u(A, L) {
                for (let C = 0; C < A.length; C++) {
                  const D = A[C];
                  for (let r = 0; r < L.length; r++) {
                    const n = L[r];
                    if ((0, l.areConnected)(D, n, g)) {
                      const b = D.bonds.indexOf(n.index), f = n.bonds.indexOf(D.index);
                      b === -1 && f === -1 ? (D.bonds.push(n.index), D.bondOrder.push(1), n.bonds.push(D.index), n.bondOrder.push(1)) : b === -1 ? (D.bonds.push(n.index), D.bondOrder.push(n.bondOrder[f])) : f === -1 && (n.bonds.push(D.index), n.bondOrder.push(D.bondOrder[b]));
                    }
                  }
                }
              }
              for (let A in E) {
                const L = parseInt(A);
                for (let C in E[L]) {
                  const D = parseInt(C);
                  for (let r in E[L][D]) {
                    const n = parseInt(r), b = E[L][D][n];
                    for (let f = 0; f < b.length; f++) {
                      const c = b[f];
                      for (let t = f + 1; t < b.length; t++) {
                        const a = b[t];
                        (0, l.areConnected)(c, a, g) && c.bonds.indexOf(a.index) == -1 && (c.bonds.push(a.index), c.bondOrder.push(1), a.bonds.push(c.index), a.bondOrder.push(1));
                      }
                    }
                    for (let f = 0; f < p.length; f++) {
                      const c = p[f];
                      if (!E[L + c.x] || !E[L + c.x][D + c.y] || !E[L + c.x][D + c.y][n + c.z])
                        continue;
                      const t = E[L + c.x][D + c.y][n + c.z];
                      u(b, t);
                    }
                  }
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignPDBBonds.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/assignPDBBonds.ts ***!
            \*********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              assignPDBBonds: () => (
                /* binding */
                x
              )
              /* harmony export */
            });
            var l = e(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            ), p = e(
              /*! ./assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), _ = e(
              /*! ./standardResidues */
              "./src/parsers/utils/standardResidues.ts"
            );
            function x(o, g) {
              const E = [], u = [];
              for (let D = 0, r = o.length; D < r; D++) {
                const n = o[D];
                n.index = D, n.hetflag || !_.standardResidues.has(n.resn) ? u.push(n) : E.push(n);
              }
              (0, p.assignBonds)(u, g), E.sort(function(D, r) {
                return D.chain !== r.chain ? D.chain < r.chain ? -1 : 1 : D.resi - r.resi;
              });
              let A = -1, L = -1, C;
              for (let D = 0, r = E.length; D < r; D++) {
                const n = E[D];
                n.resi !== A && (A = n.resi, C || L++, C = !1), n.reschain = L;
                for (let b = D + 1; b < E.length; b++) {
                  const f = E[b];
                  if (f.chain !== n.chain || f.resi - n.resi > 1)
                    break;
                  (0, l.areConnected)(n, f, g) && (n.bonds.indexOf(f.index) === -1 && (n.bonds.push(f.index), n.bondOrder.push(1), f.bonds.push(n.index), f.bondOrder.push(1)), n.resi !== f.resi && (C = !0));
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/atomNameToElem.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/atomNameToElem.ts ***!
            \*********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              atomNameToElem: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            function p(_, x) {
              let o = _.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(), l.bondTable[o] === void 0 ? o = o[0] : x && (o === "Ca" || o === "Cd") && (o = "C")), o;
            }
          }
        ),
        /***/
        "./src/parsers/utils/bondLength.ts": (
          /*!*****************************************!*\
            !*** ./src/parsers/utils/bondLength.ts ***!
            \*****************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              bondLength: () => (
                /* binding */
                p
              ),
              /* harmony export */
              bondTable: () => (
                /* binding */
                l
              ),
              /* harmony export */
              setBondLength: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            let l = {
              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 p(x) {
              return l[x] || 1.6;
            }
            function _(x, o) {
              o < 0 && (o = 0), l[x] = o;
            }
          }
        ),
        /***/
        "./src/parsers/utils/computeSecondaryStructure.ts": (
          /*!********************************************************!*\
            !*** ./src/parsers/utils/computeSecondaryStructure.ts ***!
            \********************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              computeSecondaryStructure: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ./assignBackboneHBonds */
              "./src/parsers/utils/assignBackboneHBonds.ts"
            );
            function p(_, x) {
              (0, l.assignBackboneHBonds)(_, x);
              const o = {};
              let g, E, u, A, L, C;
              for (g = 0, E = _.length; g < E; g++)
                if (L = _[g], o[L.chain] === void 0 && (o[L.chain] = []), isFinite(L.hbondDistanceSq)) {
                  const D = L.hbondOther;
                  o[D.chain] === void 0 && (o[D.chain] = []), Math.abs(D.resi - L.resi) === 4 && (o[L.chain][L.resi] = "h");
                }
              for (u in o)
                for (A = 1; A < o[u].length - 1; A++) {
                  const D = o[u][A - 1], r = o[u][A + 1];
                  C = o[u][A], D == "h" && D == r && C != D && (o[u][A] = D);
                }
              for (g = 0, E = _.length; g < E; g++)
                L = _[g], isFinite(L.hbondDistanceSq) && o[L.chain][L.resi] != "h" && L.ss !== "h" && (o[L.chain][L.resi] = "maybesheet");
              for (let D = 0, r = _.length; D < r; D++)
                if (L = _[D], isFinite(L.hbondDistanceSq) && o[L.chain][L.resi] == "maybesheet") {
                  let n = L.hbondOther, b = o[n.chain][n.resi];
                  (b == "maybesheet" || b == "s") && (o[L.chain][L.resi] = "s", o[n.chain][n.resi] = "s");
                }
              for (let D in o) {
                for (let r = 1; r < o[D].length - 1; r++) {
                  const n = o[D][r - 1], b = o[D][r + 1];
                  C = o[D][r], n == "s" && n == b && C != n && (o[D][r] = n);
                }
                for (let r = 0; r < o[D].length; r++) {
                  const n = o[D][r];
                  (n == "h" || n == "s") && o[D][r - 1] != n && o[D][r + 1] != n && delete o[D][r];
                }
              }
              for (g = 0, E = _.length; g < E; g++)
                L = _[g], C = o[L.chain][L.resi], delete L.hbondOther, delete L.hbondDistanceSq, !(C === void 0 || C === "maybesheet") && (L.ss = C, o[L.chain][L.resi - 1] != C && (L.ssbegin = !0), o[L.chain][L.resi + 1] != C && (L.ssend = !0));
            }
          }
        ),
        /***/
        "./src/parsers/utils/getSinglePDB.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/getSinglePDB.ts ***!
            \*******************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              getSinglePDB: () => (
                /* binding */
                A
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            ), p = e(
              /*! ./atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            ), _ = e(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            ), x = e(
              /*! ./computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), o = e(
              /*! ./isEmpty */
              "./src/parsers/utils/isEmpty.ts"
            ), g = e(
              /*! ./processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), E = e(
              /*! ./assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), u = e(
              /*! ./validateBonds */
              "./src/parsers/utils/validateBonds.ts"
            );
            function A(L, C, D) {
              const r = [], n = C.assignBonds === void 0 ? !0 : C.assignBonds, b = !C.keepH, f = !!C.noSecondaryStructure, c = !C.noComputeSecondaryStructure, t = !C.doAssembly, a = C.altLoc ? C.altLoc : "A", h = { symmetries: [], cryst: void 0 };
              let M, w = [];
              const S = [];
              let T;
              const R = {};
              for (let $ = 0; $ < L.length; $++) {
                T = L[$].replace(/^\s*/, "");
                const P = T.substring(0, 6);
                let B, F, U;
                if (P.indexOf("END") === 0) {
                  if (w = L.slice($ + 1), P === "END")
                    for (const z in D)
                      D.hasOwnProperty(z) && delete D[z];
                  break;
                } else if (P === "ATOM  " || P === "HETATM") {
                  let z, W, V, N, k, G, Q, ie, ge, le, oe, he;
                  if (oe = T.substring(16, 17), oe !== " " && oe !== a && a !== "*" || (le = parseInt(T.substring(6, 11)), M = T.substring(12, 16).replace(/ /g, ""), z = T.substring(17, 20).replace(/ /g, ""), W = T.substring(21, 22), V = parseInt(T.substring(22, 26)), N = T.substring(26, 27), k = parseFloat(T.substring(30, 38)), G = parseFloat(T.substring(38, 46)), Q = parseFloat(T.substring(46, 54)), he = parseFloat(T.substring(60, 68)), ge = T.substring(76, 78).replace(/ /g, ""), ge === "" || _.bondTable[ge] === void 0 ? ge = (0, p.atomNameToElem)(T.substring(12, 14), T[0] == "A") : ge = ge[0].toUpperCase() + ge.substring(1).toLowerCase(), ge === "H" && b))
                    continue;
                  P[0] == "H" ? ie = !0 : ie = !1, S[le] = r.length, r.push({
                    resn: z,
                    x: k,
                    y: G,
                    z: Q,
                    elem: ge,
                    hetflag: ie,
                    altLoc: oe,
                    chain: W,
                    resi: V,
                    icode: N,
                    rescode: V + (N !== " " ? "^" + N : ""),
                    // resi
                    // and
                    // icode
                    serial: le,
                    atom: M,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {},
                    b: he,
                    pdbline: T
                  });
                } else if (P === "SHEET ") {
                  B = T.substring(21, 22), F = parseInt(T.substring(22, 26)), U = parseInt(T.substring(33, 37)), B in D || (D[B] = {}), D[B][F] = "s1";
                  for (let z = F + 1; z < U; z++)
                    D[B][z] = "s";
                  D[B][U] = "s2";
                } else if (P === "CONECT") {
                  const z = parseInt(T.substring(6, 11)), W = S[z], V = r[W], N = [11, 16, 21, 26];
                  for (let k = 0; k < 4; k++) {
                    const G = parseInt(T.substring(N[k], N[k] + 5)), Q = S[G];
                    let ie = W + ":" + Q;
                    const ge = r[Q];
                    if (V !== void 0 && ge !== void 0)
                      if (!R[ie])
                        R[ie] = 1, (V.bonds.length == 0 || V.bonds[V.bonds.length - 1] !== Q) && (V.bonds.push(Q), V.bondOrder.push(1));
                      else {
                        R[ie] += 1;
                        for (let le = 0; le < V.bonds.length; le++)
                          if (V.bonds[le] == Q) {
                            const oe = R[ie];
                            oe >= 4 ? V.bondOrder[le] = 1 : V.bondOrder[le] = oe;
                          }
                      }
                  }
                } else if (P === "HELIX ") {
                  B = T.substring(19, 20), F = parseInt(T.substring(21, 25)), U = parseInt(T.substring(33, 37)), B in D || (D[B] = {}), D[B][F] = "h1";
                  for (let z = F + 1; z < U; z++)
                    D[B][z] = "h";
                  D[B][U] = "h2";
                } else if (!t && P === "REMARK" && T.substring(13, 18) === "BIOMT") {
                  let z, W = new l.Matrix4();
                  for (z = 1; z <= 3; z++)
                    if (T = L[$].replace(/^\s*/, ""), parseInt(T.substring(18, 19)) == z)
                      W.elements[z - 1] = parseFloat(T.substring(23, 33)), W.elements[z - 1 + 4] = parseFloat(T.substring(33, 43)), W.elements[z - 1 + 8] = parseFloat(T.substring(43, 53)), W.elements[z - 1 + 12] = parseFloat(T.substring(53)), $++;
                    else
                      for (; T.substring(13, 18) === "BIOMT"; )
                        $++, T = L[$].replace(/^\s*/, "");
                  W.elements[3] = 0, W.elements[7] = 0, W.elements[11] = 0, W.elements[15] = 1, h.symmetries.push(W), $--;
                } else if (P === "CRYST1") {
                  let z, W, V, N, k, G;
                  z = parseFloat(T.substring(7, 15)), W = parseFloat(T.substring(16, 24)), V = parseFloat(T.substring(25, 33)), N = parseFloat(T.substring(34, 40)), k = parseFloat(T.substring(41, 47)), G = parseFloat(T.substring(48, 54)), h.cryst = {
                    a: z,
                    b: W,
                    c: V,
                    alpha: N,
                    beta: k,
                    gamma: G
                  };
                } else if (P === "ANISOU") {
                  const z = parseInt(T.substring(6, 11)), W = S[z], V = r[W];
                  if (V) {
                    const N = T.substring(30).trim().split(/\s+/), k = {
                      u11: parseInt(N[0]),
                      u22: parseInt(N[1]),
                      u33: parseInt(N[2]),
                      u12: parseInt(N[3]),
                      u13: parseInt(N[4]),
                      u23: parseInt(N[5])
                    };
                    V.uMat = k;
                  }
                }
              }
              if ((0, u.validateBonds)(r, S), n && (0, E.assignPDBBonds)(r, C), t || (0, g.processSymmetries)(h.symmetries, r, C, h.cryst), c && !f && (0, x.computeSecondaryStructure)(r, C.hbondCutoff), !(0, o.isEmpty)(D))
                for (let $ = 0; $ < r.length; $++) {
                  const P = r[$];
                  if (P !== void 0 && P.chain in D && P.resi in D[P.chain]) {
                    const B = D[P.chain][P.resi];
                    P.ss = B[0], B.length > 1 && (B[1] == "1" ? P.ssbegin = !0 : B[1] == "2" && (P.ssend = !0));
                  }
                }
              return [r, h, w];
            }
          }
        ),
        /***/
        "./src/parsers/utils/isEmpty.ts": (
          /*!**************************************!*\
            !*** ./src/parsers/utils/isEmpty.ts ***!
            \**************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              isEmpty: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p) {
              for (const _ in p)
                return !1;
              return !0;
            }
          }
        ),
        /***/
        "./src/parsers/utils/processSymmetries.ts": (
          /*!************************************************!*\
            !*** ./src/parsers/utils/processSymmetries.ts ***!
            \************************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              processSymmetries: () => (
                /* binding */
                p
              )
              /* harmony export */
            });
            var l = e(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            );
            function p(_, x, o, g) {
              const E = !o.duplicateAssemblyAtoms, u = x.length;
              let A = u, L = -1, C = null, D = null;
              (o.normalizeAssembly || o.wrapAtoms) && g && (C = (0, l.conversionMatrix3)(g.a, g.b, g.c, g.alpha, g.beta, g.gamma), D = new l.Matrix3(), D.getInverse3(C));
              let r = function(f) {
                let c = f.clone().applyMatrix3(D);
                const t = [c.x, c.y, c.z], a = [0, 0, 0];
                for (let M = 0; M < 3; M++) {
                  for (; t[M] < -1e-3; )
                    t[M] += 1, a[M] += 1;
                  for (; t[M] > 1.001; )
                    t[M] -= 1, a[M] -= 1;
                }
                const h = new l.Vector3(a[0], a[1], a[2]);
                return h.applyMatrix3(C), h;
              };
              if (o.normalizeAssembly && g)
                for (let f = 0; f < _.length; f++) {
                  const c = new l.Vector3(0, 0, 0);
                  for (let a = 0; a < u; a++) {
                    const h = new l.Vector3(x[a].x, x[a].y, x[a].z);
                    h.applyMatrix4(_[f]), c.add(h);
                  }
                  c.divideScalar(u);
                  const t = r(c);
                  _[f].isNearlyIdentity() && t.lengthSq() > 1e-3 && (L = f), _[f].translate(t);
                }
              if (E) {
                if (_.length > 1)
                  for (let f = 0; f < x.length; f++) {
                    var n = [];
                    for (let c = 0; c < _.length; c++)
                      if (!_[c].isNearlyIdentity()) {
                        var b = new l.Vector3();
                        b.set(x[f].x, x[f].y, x[f].z), b.applyMatrix4(_[c]), n.push(b);
                      }
                    x[f].symmetries = n;
                  }
              } else {
                for (let f = 0; f < u; f++)
                  x[f].sym = -1;
                for (let f = 0; f < _.length; f++)
                  if (!_[f].isNearlyIdentity() && L != f) {
                    let c = new l.Vector3();
                    for (let t = 0; t < u; t++) {
                      const a = [];
                      for (let M = 0; M < x[t].bonds.length; M++)
                        a.push(x[t].bonds[M] + A);
                      if (c.set(x[t].x, x[t].y, x[t].z), c.applyMatrix4(_[f]), o.wrapAtoms && g) {
                        let M = r(c);
                        c.add(M);
                      }
                      const h = {};
                      for (const M in x[t])
                        h[M] = x[t][M];
                      h.x = c.x, h.y = c.y, h.z = c.z, h.bonds = a, h.sym = f, h.index = x.length, x.push(h);
                    }
                    A = x.length;
                  } else
                    for (let c = 0; c < u; c++)
                      x[c].sym = f;
                if (o.wrapAtoms && g) {
                  let f = new l.Vector3();
                  for (let c = 0; c < u; c++) {
                    f.set(x[c].x, x[c].y, x[c].z);
                    let t = r(f);
                    f.add(t), x[c].x = f.x, x[c].y = f.y, x[c].z = f.z;
                  }
                }
                if (L >= 0) {
                  const f = new l.Vector3();
                  for (let c = 0; c < u; c++)
                    f.set(x[c].x, x[c].y, x[c].z), f.applyMatrix4(_[L]), x[c].x = f.x, x[c].y = f.y, x[c].z = f.z;
                }
                _.length = 0;
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/standardResidues.ts": (
          /*!***********************************************!*\
            !*** ./src/parsers/utils/standardResidues.ts ***!
            \***********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              standardResidues: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = /* @__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 ***!
            \********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              validateBonds: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            function l(p, _) {
              for (let x = 0, o = p.length; x < o; x++) {
                const g = p[x];
                for (let E = 0; E < g.bonds.length; E++) {
                  const u = g.bonds[E], A = p[u], L = _[g.serial];
                  A && L && A.bonds.indexOf(L) < 0 && (A.bonds.push(L), A.bondOrder.push(g.bondOrder[E]));
                }
              }
            }
          }
        ),
        /***/
        "./src/partialCharges.ts": (
          /*!*******************************!*\
            !*** ./src/partialCharges.ts ***!
            \*******************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              applyPartialCharges: () => (
                /* binding */
                p
              ),
              /* harmony export */
              partialCharges: () => (
                /* binding */
                l
              )
              /* harmony export */
            });
            const l = {
              "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 p(_, x) {
              if ((!x || typeof _.partialCharge > "u") && _.resn && _.atom) {
                var o = _.resn + ":" + _.atom;
                _.properties.partialCharge = l[o];
              }
            }
          }
        ),
        /***/
        "./src/specs.ts": (
          /*!**********************!*\
            !*** ./src/specs.ts ***!
            \**********************/
          /***/
          (y, s, e) => {
            e.r(s);
          }
        ),
        /***/
        "./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 */
              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"
            );
            function extend(y, s) {
              for (var e in s)
                s.hasOwnProperty(e) && s[e] !== void 0 && (y[e] = s[e]);
              return y;
            }
            function deepCopy(y) {
              let s, e, l;
              if (y == null)
                return {};
              if (typeof y != "object" || y === null)
                return y;
              s = Array.isArray(y) ? [] : {};
              for (l in y)
                e = y[l], s[l] = deepCopy(e);
              return s;
            }
            function isNumeric(y) {
              var s = typeof y;
              return (s === "number" || s === "string") && !isNaN(y - parseFloat(y));
            }
            function isEmptyObject(y) {
              var s;
              for (s in y)
                return !1;
              return !0;
            }
            function makeFunction(callback) {
              return callback && typeof callback == "string" && (callback = eval("(" + callback + ")")), callback && typeof callback != "function" ? null : callback;
            }
            function adjustVolumeStyle(y) {
              y && (y.volformat && !(y.voldata instanceof _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData) && (y.voldata = new _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData(y.voldata, y.volformat)), y.volscheme && (y.volscheme = _Gradient__WEBPACK_IMPORTED_MODULE_0__.Gradient.getGradient(y.volscheme)));
            }
            function getExtent(y, s) {
              var e, l, p, _, x, o, g, E, u, A, L = !s;
              if (e = l = p = 9999, _ = x = o = -9999, g = E = u = A = 0, y.length === 0)
                return [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
              for (var C = 0; C < y.length; C++) {
                var D = y[C];
                if (!(typeof D > "u" || !isFinite(D.x) || !isFinite(D.y) || !isFinite(D.z)) && (A++, g += D.x, E += D.y, u += D.z, e = e < D.x ? e : D.x, l = l < D.y ? l : D.y, p = p < D.z ? p : D.z, _ = _ > D.x ? _ : D.x, x = x > D.y ? x : D.y, o = o > D.z ? o : D.z, D.symmetries && L))
                  for (var r = 0; r < D.symmetries.length; r++)
                    A++, g += D.symmetries[r].x, E += D.symmetries[r].y, u += D.symmetries[r].z, e = e < D.symmetries[r].x ? e : D.symmetries[r].x, l = l < D.symmetries[r].y ? l : D.symmetries[r].y, p = p < D.symmetries[r].z ? p : D.symmetries[r].z, _ = _ > D.symmetries[r].x ? _ : D.symmetries[r].x, x = x > D.symmetries[r].y ? x : D.symmetries[r].y, o = o > D.symmetries[r].z ? o : D.symmetries[r].z;
              }
              return [
                [e, l, p],
                [_, x, o],
                [g / A, E / A, u / A]
              ];
            }
            function getPropertyRange(y, s) {
              for (var e = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY, p = 0, _ = y.length; p < _; p++) {
                var x = y[p], o = getAtomProperty(x, s);
                o != null && (o < e && (e = o), o > l && (l = o));
              }
              return !isFinite(e) && !isFinite(l) ? e = l = 0 : isFinite(e) ? isFinite(l) || (l = e) : e = l, [e, l];
            }
            class PausableTimer {
              constructor(s, e, l) {
                this.total_time_run = 0, this.fn = s, this.arg = l, this.countdown = e, this.start_time = (/* @__PURE__ */ new Date()).getTime(), this.ident = setTimeout(s, e, l);
              }
              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(y) {
              for (var s = window.atob(y), e = s.length, l = new Uint8Array(e), p = 0; p < e; p++)
                l[p] = s.charCodeAt(p);
              return l;
            }
            function getAtomProperty(y, s) {
              var e = null;
              return y.properties && typeof y.properties[s] < "u" ? e = y.properties[s] : typeof y[s] < "u" && (e = y[s]), e;
            }
            function mergeGeos(y, s) {
              var e = s.geometry;
              e !== void 0 && y.geometryGroups.push(e.geometryGroups[0]);
            }
            function specStringToObject(y) {
              if (typeof y == "object")
                return y;
              if (typeof y > "u" || y == null)
                return y;
              try {
                return JSON.parse(y);
              } catch {
              }
              y = y.replace(/%7E/g, "~");
              var s = function(L) {
                return isNumeric(L) ? Math.floor(parseFloat(L)) == parseInt(L) || L.indexOf(".") >= 0 ? parseFloat(L) : parseInt(L) : L === "true" ? !0 : L === "false" ? !1 : L;
              }, e = {};
              if (y === "all")
                return e;
              for (var l = y.split(";"), p = 0; p < l.length; p++) {
                var _ = l[p].split(":"), x = _[0], o = {}, g = _[1];
                if (g)
                  if (g = g.replace(/~/g, "="), g.indexOf("=") !== -1)
                    for (var E = g.split(","), u = 0; u < E.length; u++) {
                      var A = E[u].split("=", 2);
                      o[A[0]] = s(A[1]);
                    }
                  else
                    g.indexOf(",") !== -1 ? o = g.split(",") : o = s(g);
                e[x] = o;
              }
              return e;
            }
            function checkStatus(y) {
              if (!y.ok)
                throw new Error(`HTTP ${y.status} - ${y.statusText}`);
              return y;
            }
            function get(y, s) {
              var e = fetch(y).then(checkStatus).then((l) => l.text());
              return s ? e.then(s) : e;
            }
            function getbin(y, s, e, l) {
              var p;
              return e == "POST" ? p = fetch(y, { method: "POST", body: l }).then((_) => checkStatus(_)).then((_) => _.arrayBuffer()) : p = fetch(y).then((_) => checkStatus(_)).then((_) => _.arrayBuffer()), s ? p.then(s) : p;
            }
            function download(y, s, e, l) {
              var p = "", _ = "", x = "", o = "", g = null, E = s.addModel();
              if (y.indexOf(":") < 0 && (y.length == 4 ? y = "pdb:" + y : isNaN(y) ? y = "url:" + y : y = "cid:" + y), y.substring(0, 5) === "mmtf:")
                _ = e && e.pdbUri ? e.pdbUri : "https://mmtf.rcsb.org/v1.0/full/", y = y.substring(5).toUpperCase(), o = _ + y, e && typeof e.noComputeSecondaryStructure > "u" && (e.noComputeSecondaryStructure = !0), g = new Promise(function(A) {
                  getbin(o).then(function(L) {
                    E.addMolData(L, "mmtf", e), s.zoomTo(), s.render(), A(E);
                  }, function() {
                    console.log("fetch of " + o + " failed.");
                  });
                });
              else {
                if (y.substring(0, 4) === "pdb:") {
                  if (p = "mmtf", e && e.format && (p = e.format), e && typeof e.noComputeSecondaryStructure > "u" && (e.noComputeSecondaryStructure = !0), y = y.substring(4).toUpperCase(), !y.match(/^[1-9][A-Za-z0-9]{3}$/)) {
                    alert("Wrong PDB ID");
                    return;
                  }
                  p == "mmtf" ? (x = e && e.mmtfUri ? e.mmtfUri : "https://mmtf.rcsb.org/v1.0/full/", o = x + y.toUpperCase()) : (_ = e && e.pdbUri ? e.pdbUri : "https://files.rcsb.org/view/", o = _ + y + "." + p);
                } else if (y.substring(0, 4) == "cid:") {
                  if (p = "sdf", y = y.substring(4), !y.match(/^[0-9]+$/)) {
                    alert("Wrong Compound ID");
                    return;
                  }
                  o = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + y + "/SDF?record_type=3d";
                } else
                  y.substring(0, 4) == "url:" && (o = y.substring(4), p = o);
                var u = function(A) {
                  E.addMolData(A, p, e), s.zoomTo(), s.render();
                };
                g = new Promise(function(A) {
                  p == "mmtf" ? getbin(o).then(function(L) {
                    u(L), A(E);
                  }).catch(function() {
                    _ = e && e.pdbUri ? e.pdbUri : "https://files.rcsb.org/view/", o = _ + y + ".pdb", p = "pdb", console.log("falling back to pdb format"), get(o).then(function(L) {
                      u(L), A(E);
                    }).catch(function(L) {
                      u(""), A(E), console.log("fetch of " + o + " failed: " + L.statusText);
                    });
                  }) : get(o).then(function(L) {
                    u(L), A(E);
                  }).catch(function(L) {
                    u(""), A(E), console.log("fetch of " + o + " failed: " + L.statusText);
                  });
                });
              }
              return l ? (g.then(function(A) {
                l(A);
              }), E) : g;
            }
            function getColorFromStyle(y, s) {
              let e = s.colorscheme;
              if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[e] < "u")
                e = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[e];
              else if (typeof e == "string" && e.endsWith("Carbon")) {
                let x = e.substring(0, e.lastIndexOf("Carbon")).toLowerCase();
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[x] < "u") {
                  let o = Object.assign({}, _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors.defaultColors);
                  o.C = _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[x], _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[e] = { prop: "elem", map: o }, e = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[e];
                }
              }
              let l = y.color;
              if (typeof s.color < "u" && s.color != "spectrum" && (l = s.color), typeof e < "u") {
                let x, o;
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[e] < "u")
                  e = _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[e], typeof e[y[e.prop]] < "u" && (l = e.map[y[e.prop]]);
                else if (typeof e[y[e.prop]] < "u")
                  l = e.map[y[e.prop]];
                else if (typeof e.prop < "u" && typeof e.gradient < "u") {
                  x = e.prop;
                  var p = e.gradient;
                  typeof _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[p] < "u" && (p = new _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[p](e.min, e.max, e.mid ? e.mid : e.colors));
                  let g = p.range() || [-1, 1];
                  o = getAtomProperty(y, x), o != null && (l = p.valueToHex(o, g));
                } else
                  typeof e.prop < "u" && typeof e.map < "u" ? (x = e.prop, o = getAtomProperty(y, x), typeof e.map[o] < "u" && (l = e.map[o])) : typeof s.colorscheme[y.elem] < "u" ? l = s.colorscheme[y.elem] : console.log("Could not interpret colorscheme " + e);
              } else
                typeof s.colorfunc < "u" && (l = s.colorfunc(y));
              return _colors__WEBPACK_IMPORTED_MODULE_2__.CC.color(l);
            }
            function getElement(y) {
              let s = y;
              return typeof y == "string" ? s = document.querySelector("#" + y) : typeof y == "object" && y.get && (s = y.get(0)), s;
            }
          }
        ),
        /***/
        "./node_modules/upng-js/UPNG.js": (
          /*!**************************************!*\
            !*** ./node_modules/upng-js/UPNG.js ***!
            \**************************************/
          /***/
          (y, s, e) => {
            (function() {
              var l = {}, p;
              y.exports = l, p = e(
                /*! pako */
                "./node_modules/upng-js/node_modules/pako/index.js"
              ), function(_, x) {
                _.toRGBA8 = function(o) {
                  var g = o.width, E = o.height;
                  if (o.tabs.acTL == null)
                    return [_.toRGBA8.decodeImage(o.data, g, E, o).buffer];
                  var u = [];
                  o.frames[0].data == null && (o.frames[0].data = o.data);
                  for (var A, L = new Uint8Array(g * E * 4), C = 0; C < o.frames.length; C++) {
                    var D = o.frames[C], r = D.rect.x, n = D.rect.y, b = D.rect.width, f = D.rect.height, c = _.toRGBA8.decodeImage(D.data, b, f, o);
                    if (C == 0 ? A = c : D.blend == 0 ? _._copyTile(c, b, f, A, g, E, r, n, 0) : D.blend == 1 && _._copyTile(c, b, f, A, g, E, r, n, 1), u.push(A.buffer), A = A.slice(0), D.dispose != 0) {
                      if (D.dispose == 1)
                        _._copyTile(L, b, f, A, g, E, r, n, 0);
                      else if (D.dispose == 2) {
                        for (var t = C - 1; o.frames[t].dispose == 2; )
                          t--;
                        A = new Uint8Array(u[t]).slice(0);
                      }
                    }
                  }
                  return u;
                }, _.toRGBA8.decodeImage = function(o, g, E, u) {
                  var A = g * E, L = _.decode._getBPP(u), C = Math.ceil(g * L / 8), D = new Uint8Array(A * 4), r = new Uint32Array(D.buffer), n = u.ctype, b = u.depth, f = _._bin.readUshort;
                  if (n == 6) {
                    var c = A << 2;
                    if (b == 8)
                      for (var t = 0; t < c; t++)
                        D[t] = o[t];
                    if (b == 16)
                      for (var t = 0; t < c; t++)
                        D[t] = o[t << 1];
                  } else if (n == 2) {
                    var a = u.tabs.tRNS, h = -1, M = -1, w = -1;
                    if (a && (h = a[0], M = a[1], w = a[2]), b == 8)
                      for (var t = 0; t < A; t++) {
                        var S = t << 2, T = t * 3;
                        D[S] = o[T], D[S + 1] = o[T + 1], D[S + 2] = o[T + 2], D[S + 3] = 255, h != -1 && o[T] == h && o[T + 1] == M && o[T + 2] == w && (D[S + 3] = 0);
                      }
                    if (b == 16)
                      for (var t = 0; t < A; t++) {
                        var S = t << 2, T = t * 6;
                        D[S] = o[T], D[S + 1] = o[T + 2], D[S + 2] = o[T + 4], D[S + 3] = 255, h != -1 && f(o, T) == h && f(o, T + 2) == M && f(o, T + 4) == w && (D[S + 3] = 0);
                      }
                  } else if (n == 3) {
                    var R = u.tabs.PLTE, $ = u.tabs.tRNS, P = $ ? $.length : 0;
                    if (b == 1)
                      for (var B = 0; B < E; B++)
                        for (var F = B * C, U = B * g, t = 0; t < g; t++) {
                          var S = U + t << 2, z = o[F + (t >> 3)] >> 7 - ((t & 7) << 0) & 1, W = 3 * z;
                          D[S] = R[W], D[S + 1] = R[W + 1], D[S + 2] = R[W + 2], D[S + 3] = z < P ? $[z] : 255;
                        }
                    if (b == 2)
                      for (var B = 0; B < E; B++)
                        for (var F = B * C, U = B * g, t = 0; t < g; t++) {
                          var S = U + t << 2, z = o[F + (t >> 2)] >> 6 - ((t & 3) << 1) & 3, W = 3 * z;
                          D[S] = R[W], D[S + 1] = R[W + 1], D[S + 2] = R[W + 2], D[S + 3] = z < P ? $[z] : 255;
                        }
                    if (b == 4)
                      for (var B = 0; B < E; B++)
                        for (var F = B * C, U = B * g, t = 0; t < g; t++) {
                          var S = U + t << 2, z = o[F + (t >> 1)] >> 4 - ((t & 1) << 2) & 15, W = 3 * z;
                          D[S] = R[W], D[S + 1] = R[W + 1], D[S + 2] = R[W + 2], D[S + 3] = z < P ? $[z] : 255;
                        }
                    if (b == 8)
                      for (var t = 0; t < A; t++) {
                        var S = t << 2, z = o[t], W = 3 * z;
                        D[S] = R[W], D[S + 1] = R[W + 1], D[S + 2] = R[W + 2], D[S + 3] = z < P ? $[z] : 255;
                      }
                  } else if (n == 4) {
                    if (b == 8)
                      for (var t = 0; t < A; t++) {
                        var S = t << 2, V = t << 1, N = o[V];
                        D[S] = N, D[S + 1] = N, D[S + 2] = N, D[S + 3] = o[V + 1];
                      }
                    if (b == 16)
                      for (var t = 0; t < A; t++) {
                        var S = t << 2, V = t << 2, N = o[V];
                        D[S] = N, D[S + 1] = N, D[S + 2] = N, D[S + 3] = o[V + 2];
                      }
                  } else if (n == 0) {
                    var h = u.tabs.tRNS ? u.tabs.tRNS : -1;
                    if (b == 1)
                      for (var t = 0; t < A; t++) {
                        var N = 255 * (o[t >> 3] >> 7 - (t & 7) & 1), k = N == h * 255 ? 0 : 255;
                        r[t] = k << 24 | N << 16 | N << 8 | N;
                      }
                    if (b == 2)
                      for (var t = 0; t < A; t++) {
                        var N = 85 * (o[t >> 2] >> 6 - ((t & 3) << 1) & 3), k = N == h * 85 ? 0 : 255;
                        r[t] = k << 24 | N << 16 | N << 8 | N;
                      }
                    if (b == 4)
                      for (var t = 0; t < A; t++) {
                        var N = 17 * (o[t >> 1] >> 4 - ((t & 1) << 2) & 15), k = N == h * 17 ? 0 : 255;
                        r[t] = k << 24 | N << 16 | N << 8 | N;
                      }
                    if (b == 8)
                      for (var t = 0; t < A; t++) {
                        var N = o[t], k = N == h ? 0 : 255;
                        r[t] = k << 24 | N << 16 | N << 8 | N;
                      }
                    if (b == 16)
                      for (var t = 0; t < A; t++) {
                        var N = o[t << 1], k = f(o, t << 1) == h ? 0 : 255;
                        r[t] = k << 24 | N << 16 | N << 8 | N;
                      }
                  }
                  return D;
                }, _.decode = function(o) {
                  for (var g = new Uint8Array(o), E = 8, u = _._bin, A = u.readUshort, L = u.readUint, C = { tabs: {}, frames: [] }, D = new Uint8Array(g.length), r = 0, n, b = 0, f = [137, 80, 78, 71, 13, 10, 26, 10], c = 0; c < 8; c++)
                    if (g[c] != f[c])
                      throw "The input is not a PNG file!";
                  for (; E < g.length; ) {
                    var t = u.readUint(g, E);
                    E += 4;
                    var a = u.readASCII(g, E, 4);
                    if (E += 4, a == "IHDR")
                      _.decode._IHDR(g, E, C);
                    else if (a == "IDAT") {
                      for (var c = 0; c < t; c++)
                        D[r + c] = g[E + c];
                      r += t;
                    } else if (a == "acTL")
                      C.tabs[a] = { num_frames: L(g, E), num_plays: L(g, E + 4) }, n = new Uint8Array(g.length);
                    else if (a == "fcTL") {
                      if (b != 0) {
                        var h = C.frames[C.frames.length - 1];
                        h.data = _.decode._decompress(C, n.slice(0, b), h.rect.width, h.rect.height), b = 0;
                      }
                      var M = { x: L(g, E + 12), y: L(g, E + 16), width: L(g, E + 4), height: L(g, E + 8) }, w = A(g, E + 22);
                      w = A(g, E + 20) / (w == 0 ? 100 : w);
                      var S = { rect: M, delay: Math.round(w * 1e3), dispose: g[E + 24], blend: g[E + 25] };
                      C.frames.push(S);
                    } else if (a == "fdAT") {
                      for (var c = 0; c < t - 4; c++)
                        n[b + c] = g[E + c + 4];
                      b += t - 4;
                    } else if (a == "pHYs")
                      C.tabs[a] = [u.readUint(g, E), u.readUint(g, E + 4), g[E + 8]];
                    else if (a == "cHRM") {
                      C.tabs[a] = [];
                      for (var c = 0; c < 8; c++)
                        C.tabs[a].push(u.readUint(g, E + c * 4));
                    } else if (a == "tEXt") {
                      C.tabs[a] == null && (C.tabs[a] = {});
                      var T = u.nextZero(g, E), R = u.readASCII(g, E, T - E), $ = u.readASCII(g, T + 1, E + t - T - 1);
                      C.tabs[a][R] = $;
                    } else if (a == "iTXt") {
                      C.tabs[a] == null && (C.tabs[a] = {});
                      var T = 0, P = E;
                      T = u.nextZero(g, P);
                      var R = u.readASCII(g, P, T - P);
                      P = T + 1, g[P], g[P + 1], P += 2, T = u.nextZero(g, P), u.readASCII(g, P, T - P), P = T + 1, T = u.nextZero(g, P), u.readUTF8(g, P, T - P), P = T + 1;
                      var $ = u.readUTF8(g, P, t - (P - E));
                      C.tabs[a][R] = $;
                    } else if (a == "PLTE")
                      C.tabs[a] = u.readBytes(g, E, t);
                    else if (a == "hIST") {
                      var B = C.tabs.PLTE.length / 3;
                      C.tabs[a] = [];
                      for (var c = 0; c < B; c++)
                        C.tabs[a].push(A(g, E + c * 2));
                    } else if (a == "tRNS")
                      C.ctype == 3 ? C.tabs[a] = u.readBytes(g, E, t) : C.ctype == 0 ? C.tabs[a] = A(g, E) : C.ctype == 2 && (C.tabs[a] = [A(g, E), A(g, E + 2), A(g, E + 4)]);
                    else if (a == "gAMA")
                      C.tabs[a] = u.readUint(g, E) / 1e5;
                    else if (a == "sRGB")
                      C.tabs[a] = g[E];
                    else if (a == "bKGD")
                      C.ctype == 0 || C.ctype == 4 ? C.tabs[a] = [A(g, E)] : C.ctype == 2 || C.ctype == 6 ? C.tabs[a] = [A(g, E), A(g, E + 2), A(g, E + 4)] : C.ctype == 3 && (C.tabs[a] = g[E]);
                    else if (a == "IEND") {
                      if (b != 0) {
                        var h = C.frames[C.frames.length - 1];
                        h.data = _.decode._decompress(C, n.slice(0, b), h.rect.width, h.rect.height), b = 0;
                      }
                      C.data = _.decode._decompress(C, D, C.width, C.height);
                      break;
                    }
                    E += t, u.readUint(g, E), E += 4;
                  }
                  return delete C.compress, delete C.interlace, delete C.filter, C;
                }, _.decode._decompress = function(o, g, E, u) {
                  return o.compress == 0 && (g = _.decode._inflate(g)), o.interlace == 0 ? g = _.decode._filterZero(g, o, 0, E, u) : o.interlace == 1 && (g = _.decode._readInterlace(g, o)), g;
                }, _.decode._inflate = function(o) {
                  return x.inflate(o);
                }, _.decode._readInterlace = function(o, g) {
                  for (var E = g.width, u = g.height, A = _.decode._getBPP(g), L = A >> 3, C = Math.ceil(E * A / 8), D = new Uint8Array(u * C), r = 0, n = [0, 0, 4, 0, 2, 0, 1], b = [0, 4, 0, 2, 0, 1, 0], f = [8, 8, 8, 4, 4, 2, 2], c = [8, 8, 4, 4, 2, 2, 1], t = 0; t < 7; ) {
                    for (var a = f[t], h = c[t], M = 0, w = 0, S = n[t]; S < u; )
                      S += a, w++;
                    for (var T = b[t]; T < E; )
                      T += h, M++;
                    var R = Math.ceil(M * A / 8);
                    _.decode._filterZero(o, g, r, M, w);
                    for (var $ = 0, P = n[t]; P < u; ) {
                      for (var B = b[t], F = r + $ * R << 3; B < E; ) {
                        if (A == 1) {
                          var U = o[F >> 3];
                          U = U >> 7 - (F & 7) & 1, D[P * C + (B >> 3)] |= U << 7 - ((B & 3) << 0);
                        }
                        if (A == 2) {
                          var U = o[F >> 3];
                          U = U >> 6 - (F & 7) & 3, D[P * C + (B >> 2)] |= U << 6 - ((B & 3) << 1);
                        }
                        if (A == 4) {
                          var U = o[F >> 3];
                          U = U >> 4 - (F & 7) & 15, D[P * C + (B >> 1)] |= U << 4 - ((B & 1) << 2);
                        }
                        if (A >= 8)
                          for (var z = P * C + B * L, W = 0; W < L; W++)
                            D[z + W] = o[(F >> 3) + W];
                        F += A, B += h;
                      }
                      $++, P += a;
                    }
                    M * w != 0 && (r += w * (1 + R)), t = t + 1;
                  }
                  return D;
                }, _.decode._getBPP = function(o) {
                  var g = [1, null, 3, 1, 2, null, 4][o.ctype];
                  return g * o.depth;
                }, _.decode._filterZero = function(o, g, E, u, A) {
                  var L = _.decode._getBPP(g), C = Math.ceil(u * L / 8), D = _.decode._paeth;
                  L = Math.ceil(L / 8);
                  for (var r = 0; r < A; r++) {
                    var n = E + r * C, b = n + r + 1, f = o[b - 1];
                    if (f == 0)
                      for (var c = 0; c < C; c++)
                        o[n + c] = o[b + c];
                    else if (f == 1) {
                      for (var c = 0; c < L; c++)
                        o[n + c] = o[b + c];
                      for (var c = L; c < C; c++)
                        o[n + c] = o[b + c] + o[n + c - L] & 255;
                    } else if (r == 0) {
                      for (var c = 0; c < L; c++)
                        o[n + c] = o[b + c];
                      if (f == 2)
                        for (var c = L; c < C; c++)
                          o[n + c] = o[b + c] & 255;
                      if (f == 3)
                        for (var c = L; c < C; c++)
                          o[n + c] = o[b + c] + (o[n + c - L] >> 1) & 255;
                      if (f == 4)
                        for (var c = L; c < C; c++)
                          o[n + c] = o[b + c] + D(o[n + c - L], 0, 0) & 255;
                    } else {
                      if (f == 2)
                        for (var c = 0; c < C; c++)
                          o[n + c] = o[b + c] + o[n + c - C] & 255;
                      if (f == 3) {
                        for (var c = 0; c < L; c++)
                          o[n + c] = o[b + c] + (o[n + c - C] >> 1) & 255;
                        for (var c = L; c < C; c++)
                          o[n + c] = o[b + c] + (o[n + c - C] + o[n + c - L] >> 1) & 255;
                      }
                      if (f == 4) {
                        for (var c = 0; c < L; c++)
                          o[n + c] = o[b + c] + D(0, o[n + c - C], 0) & 255;
                        for (var c = L; c < C; c++)
                          o[n + c] = o[b + c] + D(o[n + c - L], o[n + c - C], o[n + c - L - C]) & 255;
                      }
                    }
                  }
                  return o;
                }, _.decode._paeth = function(o, g, E) {
                  var u = o + g - E, A = Math.abs(u - o), L = Math.abs(u - g), C = Math.abs(u - E);
                  return A <= L && A <= C ? o : L <= C ? g : E;
                }, _.decode._IHDR = function(o, g, E) {
                  var u = _._bin;
                  E.width = u.readUint(o, g), g += 4, E.height = u.readUint(o, g), g += 4, E.depth = o[g], g++, E.ctype = o[g], g++, E.compress = o[g], g++, E.filter = o[g], g++, E.interlace = o[g], g++;
                }, _._bin = {
                  nextZero: function(o, g) {
                    for (; o[g] != 0; )
                      g++;
                    return g;
                  },
                  readUshort: function(o, g) {
                    return o[g] << 8 | o[g + 1];
                  },
                  writeUshort: function(o, g, E) {
                    o[g] = E >> 8 & 255, o[g + 1] = E & 255;
                  },
                  readUint: function(o, g) {
                    return o[g] * 16777216 + (o[g + 1] << 16 | o[g + 2] << 8 | o[g + 3]);
                  },
                  writeUint: function(o, g, E) {
                    o[g] = E >> 24 & 255, o[g + 1] = E >> 16 & 255, o[g + 2] = E >> 8 & 255, o[g + 3] = E & 255;
                  },
                  readASCII: function(o, g, E) {
                    for (var u = "", A = 0; A < E; A++)
                      u += String.fromCharCode(o[g + A]);
                    return u;
                  },
                  writeASCII: function(o, g, E) {
                    for (var u = 0; u < E.length; u++)
                      o[g + u] = E.charCodeAt(u);
                  },
                  readBytes: function(o, g, E) {
                    for (var u = [], A = 0; A < E; A++)
                      u.push(o[g + A]);
                    return u;
                  },
                  pad: function(o) {
                    return o.length < 2 ? "0" + o : o;
                  },
                  readUTF8: function(o, g, E) {
                    for (var u = "", A, L = 0; L < E; L++)
                      u += "%" + _._bin.pad(o[g + L].toString(16));
                    try {
                      A = decodeURIComponent(u);
                    } catch {
                      return _._bin.readASCII(o, g, E);
                    }
                    return A;
                  }
                }, _._copyTile = function(o, g, E, u, A, L, C, D, r) {
                  for (var n = Math.min(g, A), b = Math.min(E, L), f = 0, c = 0, t = 0; t < b; t++)
                    for (var a = 0; a < n; a++)
                      if (C >= 0 && D >= 0 ? (f = t * g + a << 2, c = (D + t) * A + C + a << 2) : (f = (-D + t) * g - C + a << 2, c = t * A + a << 2), r == 0)
                        u[c] = o[f], u[c + 1] = o[f + 1], u[c + 2] = o[f + 2], u[c + 3] = o[f + 3];
                      else if (r == 1) {
                        var h = o[f + 3] * 0.00392156862745098, M = o[f] * h, w = o[f + 1] * h, S = o[f + 2] * h, T = u[c + 3] * (1 / 255), R = u[c] * T, $ = u[c + 1] * T, P = u[c + 2] * T, B = 1 - h, F = h + T * B, U = F == 0 ? 0 : 1 / F;
                        u[c + 3] = 255 * F, u[c + 0] = (M + R * B) * U, u[c + 1] = (w + $ * B) * U, u[c + 2] = (S + P * B) * U;
                      } else if (r == 2) {
                        var h = o[f + 3], M = o[f], w = o[f + 1], S = o[f + 2], T = u[c + 3], R = u[c], $ = u[c + 1], P = u[c + 2];
                        h == T && M == R && w == $ && S == P ? (u[c] = 0, u[c + 1] = 0, u[c + 2] = 0, u[c + 3] = 0) : (u[c] = M, u[c + 1] = w, u[c + 2] = S, u[c + 3] = h);
                      } else if (r == 3) {
                        var h = o[f + 3], M = o[f], w = o[f + 1], S = o[f + 2], T = u[c + 3], R = u[c], $ = u[c + 1], P = u[c + 2];
                        if (h == T && M == R && w == $ && S == P)
                          continue;
                        if (h < 220 && T > 20)
                          return !1;
                      }
                  return !0;
                }, _.encode = function(o, g, E, u, A, L) {
                  u == null && (u = 0), L == null && (L = !1);
                  for (var C = new Uint8Array(o[0].byteLength * o.length + 100), D = [137, 80, 78, 71, 13, 10, 26, 10], r = 0; r < 8; r++)
                    C[r] = D[r];
                  var n = 8, b = _._bin, f = _.crc.crc, c = b.writeUint, t = b.writeUshort, a = b.writeASCII, h = _.encode.compressPNG(o, g, E, u, L);
                  c(C, n, 13), n += 4, a(C, n, "IHDR"), n += 4, c(C, n, g), n += 4, c(C, n, E), n += 4, C[n] = h.depth, n++, C[n] = h.ctype, n++, C[n] = 0, n++, C[n] = 0, n++, C[n] = 0, n++, c(C, n, f(C, n - 17, 17)), n += 4, c(C, n, 1), n += 4, a(C, n, "sRGB"), n += 4, C[n] = 1, n++, c(C, n, f(C, n - 5, 5)), n += 4;
                  var M = o.length > 1;
                  if (M && (c(C, n, 8), n += 4, a(C, n, "acTL"), n += 4, c(C, n, o.length), n += 4, c(C, n, 0), n += 4, c(C, n, f(C, n - 12, 12)), n += 4), h.ctype == 3) {
                    var w = h.plte.length;
                    c(C, n, w * 3), n += 4, a(C, n, "PLTE"), n += 4;
                    for (var r = 0; r < w; r++) {
                      var S = r * 3, T = h.plte[r], R = T & 255, $ = T >> 8 & 255, P = T >> 16 & 255;
                      C[n + S + 0] = R, C[n + S + 1] = $, C[n + S + 2] = P;
                    }
                    if (n += w * 3, c(C, n, f(C, n - w * 3 - 4, w * 3 + 4)), n += 4, h.gotAlpha) {
                      c(C, n, w), n += 4, a(C, n, "tRNS"), n += 4;
                      for (var r = 0; r < w; r++)
                        C[n + r] = h.plte[r] >> 24 & 255;
                      n += w, c(C, n, f(C, n - w - 4, w + 4)), n += 4;
                    }
                  }
                  for (var B = 0, F = 0; F < h.frames.length; F++) {
                    var U = h.frames[F];
                    M && (c(C, n, 26), n += 4, a(C, n, "fcTL"), n += 4, c(C, n, B++), n += 4, c(C, n, U.rect.width), n += 4, c(C, n, U.rect.height), n += 4, c(C, n, U.rect.x), n += 4, c(C, n, U.rect.y), n += 4, t(C, n, A[F]), n += 2, t(C, n, 1e3), n += 2, C[n] = U.dispose, n++, C[n] = U.blend, n++, c(C, n, f(C, n - 30, 30)), n += 4);
                    var z = U.cimg, w = z.length;
                    c(C, n, w + (F == 0 ? 0 : 4)), n += 4;
                    var W = n;
                    a(C, n, F == 0 ? "IDAT" : "fdAT"), n += 4, F != 0 && (c(C, n, B++), n += 4);
                    for (var r = 0; r < w; r++)
                      C[n + r] = z[r];
                    n += w, c(C, n, f(C, W, n - W)), n += 4;
                  }
                  return c(C, n, 0), n += 4, a(C, n, "IEND"), n += 4, c(C, n, f(C, n - 4, 4)), n += 4, C.buffer.slice(0, n);
                }, _.encode.compressPNG = function(o, g, E, u, A) {
                  for (var L = _.encode.compress(o, g, E, u, !1, A), C = 0; C < o.length; C++) {
                    var D = L.frames[C];
                    D.rect.width;
                    var r = D.rect.height, n = D.bpl, b = D.bpp, f = new Uint8Array(r * n + r);
                    D.cimg = _.encode._filterZero(D.img, r, b, n, f);
                  }
                  return L;
                }, _.encode.compress = function(o, g, E, u, A, L) {
                  L == null && (L = !1);
                  for (var C = 6, D = 8, r = 4, n = 255, b = 0; b < o.length; b++)
                    for (var f = new Uint8Array(o[b]), c = f.length, t = 0; t < c; t += 4)
                      n &= f[t + 3];
                  var a = n != 255, h = {}, M = [];
                  if (o.length != 0 && (h[0] = 0, M.push(0), u != 0 && u--), u != 0) {
                    var w = _.quantize(o, u, A);
                    o = w.bufs;
                    for (var t = 0; t < w.plte.length; t++) {
                      var S = w.plte[t].est.rgba;
                      h[S] == null && (h[S] = M.length, M.push(S));
                    }
                  } else
                    for (var b = 0; b < o.length; b++)
                      for (var T = new Uint32Array(o[b]), c = T.length, t = 0; t < c; t++) {
                        var S = T[t];
                        if ((t < g || S != T[t - 1] && S != T[t - g]) && h[S] == null && (h[S] = M.length, M.push(S), M.length >= 300))
                          break;
                      }
                  var R = a ? A : !1, $ = M.length;
                  $ <= 256 && L == !1 && ($ <= 2 ? D = 1 : $ <= 4 ? D = 2 : $ <= 16 ? D = 4 : D = 8, A && (D = 8), a = !0);
                  for (var P = [], b = 0; b < o.length; b++) {
                    var B = new Uint8Array(o[b]), F = new Uint32Array(B.buffer), U = 0, z = 0, W = g, V = E, N = 0;
                    if (b != 0 && !R) {
                      for (var k = A || b == 1 || P[P.length - 2].dispose == 2 ? 1 : 2, G = 0, Q = 1e9, ie = 0; ie < k; ie++) {
                        for (var de = new Uint8Array(o[b - 1 - ie]), ge = new Uint32Array(o[b - 1 - ie]), le = g, oe = E, he = -1, se = -1, xe = 0; xe < E; xe++)
                          for (var ye = 0; ye < g; ye++) {
                            var t = xe * g + ye;
                            F[t] != ge[t] && (ye < le && (le = ye), ye > he && (he = ye), xe < oe && (oe = xe), xe > se && (se = xe));
                          }
                        var Pe = he == -1 ? 1 : (he - le + 1) * (se - oe + 1);
                        Pe < Q && (Q = Pe, G = ie, he == -1 ? (U = z = 0, W = V = 1) : (U = le, z = oe, W = he - le + 1, V = se - oe + 1));
                      }
                      var de = new Uint8Array(o[b - 1 - G]);
                      G == 1 && (P[P.length - 1].dispose = 2);
                      var pe = new Uint8Array(W * V * 4);
                      new Uint32Array(pe.buffer), _._copyTile(de, g, E, pe, W, V, -U, -z, 0), _._copyTile(B, g, E, pe, W, V, -U, -z, 3) ? (_._copyTile(B, g, E, pe, W, V, -U, -z, 2), N = 1) : (_._copyTile(B, g, E, pe, W, V, -U, -z, 0), N = 0), B = pe, F = new Uint32Array(B.buffer);
                    }
                    var re = 4 * W;
                    if ($ <= 256 && L == !1) {
                      re = Math.ceil(D * W / 8);
                      for (var pe = new Uint8Array(re * V), xe = 0; xe < V; xe++) {
                        var t = xe * re, Se = xe * W;
                        if (D == 8)
                          for (var ye = 0; ye < W; ye++)
                            pe[t + ye] = h[F[Se + ye]];
                        else if (D == 4)
                          for (var ye = 0; ye < W; ye++)
                            pe[t + (ye >> 1)] |= h[F[Se + ye]] << 4 - (ye & 1) * 4;
                        else if (D == 2)
                          for (var ye = 0; ye < W; ye++)
                            pe[t + (ye >> 2)] |= h[F[Se + ye]] << 6 - (ye & 3) * 2;
                        else if (D == 1)
                          for (var ye = 0; ye < W; ye++)
                            pe[t + (ye >> 3)] |= h[F[Se + ye]] << 7 - (ye & 7) * 1;
                      }
                      B = pe, C = 3, r = 1;
                    } else if (a == !1 && o.length == 1) {
                      for (var pe = new Uint8Array(W * V * 3), ke = W * V, t = 0; t < ke; t++) {
                        var $e = t * 3, ze = t * 4;
                        pe[$e] = B[ze], pe[$e + 1] = B[ze + 1], pe[$e + 2] = B[ze + 2];
                      }
                      B = pe, C = 2, r = 3, re = 3 * W;
                    }
                    P.push({ rect: { x: U, y: z, width: W, height: V }, img: B, bpl: re, bpp: r, blend: N, dispose: R ? 1 : 0 });
                  }
                  return { ctype: C, depth: D, plte: M, gotAlpha: a, frames: P };
                }, _.encode._filterZero = function(o, g, E, u, A) {
                  for (var L = [], C = 0; C < 5; C++)
                    if (!(g * u > 5e5 && (C == 2 || C == 3 || C == 4))) {
                      for (var D = 0; D < g; D++)
                        _.encode._filterLine(A, o, D, u, E, C);
                      if (L.push(x.deflate(A)), E == 1)
                        break;
                    }
                  for (var r, n = 1e9, b = 0; b < L.length; b++)
                    L[b].length < n && (r = b, n = L[b].length);
                  return L[r];
                }, _.encode._filterLine = function(o, g, E, u, A, L) {
                  var C = E * u, D = C + E, r = _.decode._paeth;
                  if (o[D] = L, D++, L == 0)
                    for (var n = 0; n < u; n++)
                      o[D + n] = g[C + n];
                  else if (L == 1) {
                    for (var n = 0; n < A; n++)
                      o[D + n] = g[C + n];
                    for (var n = A; n < u; n++)
                      o[D + n] = g[C + n] - g[C + n - A] + 256 & 255;
                  } else if (E == 0) {
                    for (var n = 0; n < A; n++)
                      o[D + n] = g[C + n];
                    if (L == 2)
                      for (var n = A; n < u; n++)
                        o[D + n] = g[C + n];
                    if (L == 3)
                      for (var n = A; n < u; n++)
                        o[D + n] = g[C + n] - (g[C + n - A] >> 1) + 256 & 255;
                    if (L == 4)
                      for (var n = A; n < u; n++)
                        o[D + n] = g[C + n] - r(g[C + n - A], 0, 0) + 256 & 255;
                  } else {
                    if (L == 2)
                      for (var n = 0; n < u; n++)
                        o[D + n] = g[C + n] + 256 - g[C + n - u] & 255;
                    if (L == 3) {
                      for (var n = 0; n < A; n++)
                        o[D + n] = g[C + n] + 256 - (g[C + n - u] >> 1) & 255;
                      for (var n = A; n < u; n++)
                        o[D + n] = g[C + n] + 256 - (g[C + n - u] + g[C + n - A] >> 1) & 255;
                    }
                    if (L == 4) {
                      for (var n = 0; n < A; n++)
                        o[D + n] = g[C + n] + 256 - r(0, g[C + n - u], 0) & 255;
                      for (var n = A; n < u; n++)
                        o[D + n] = g[C + n] + 256 - r(g[C + n - A], g[C + n - u], g[C + n - A - u]) & 255;
                    }
                  }
                }, _.crc = {
                  table: function() {
                    for (var o = new Uint32Array(256), g = 0; g < 256; g++) {
                      for (var E = g, u = 0; u < 8; u++)
                        E & 1 ? E = 3988292384 ^ E >>> 1 : E = E >>> 1;
                      o[g] = E;
                    }
                    return o;
                  }(),
                  update: function(o, g, E, u) {
                    for (var A = 0; A < u; A++)
                      o = _.crc.table[(o ^ g[E + A]) & 255] ^ o >>> 8;
                    return o;
                  },
                  crc: function(o, g, E) {
                    return _.crc.update(4294967295, o, g, E) ^ 4294967295;
                  }
                }, _.quantize = function(o, g, E) {
                  for (var u = [], A = 0, L = 0; L < o.length; L++)
                    u.push(_.encode.alphaMul(new Uint8Array(o[L]), E)), A += o[L].byteLength;
                  for (var C = new Uint8Array(A), D = new Uint32Array(C.buffer), r = 0, L = 0; L < u.length; L++) {
                    for (var n = u[L], b = n.length, f = 0; f < b; f++)
                      C[r + f] = n[f];
                    r += b;
                  }
                  var c = { i0: 0, i1: C.length, bst: null, est: null, tdst: 0, left: null, right: null };
                  c.bst = _.quantize.stats(C, c.i0, c.i1), c.est = _.quantize.estats(c.bst);
                  for (var t = [c]; t.length < g; ) {
                    for (var a = 0, h = 0, L = 0; L < t.length; L++)
                      t[L].est.L > a && (a = t[L].est.L, h = L);
                    if (a < 1e-3)
                      break;
                    var M = t[h], w = _.quantize.splitPixels(C, D, M.i0, M.i1, M.est.e, M.est.eMq255), S = { i0: M.i0, i1: w, bst: null, est: null, tdst: 0, left: null, right: null };
                    S.bst = _.quantize.stats(C, S.i0, S.i1), S.est = _.quantize.estats(S.bst);
                    var T = { i0: w, i1: M.i1, bst: null, est: null, tdst: 0, left: null, right: null };
                    T.bst = { R: [], m: [], N: M.bst.N - S.bst.N };
                    for (var L = 0; L < 16; L++)
                      T.bst.R[L] = M.bst.R[L] - S.bst.R[L];
                    for (var L = 0; L < 4; L++)
                      T.bst.m[L] = M.bst.m[L] - S.bst.m[L];
                    T.est = _.quantize.estats(T.bst), M.left = S, M.right = T, t[h] = S, t.push(T);
                  }
                  t.sort(function(k, G) {
                    return G.bst.N - k.bst.N;
                  });
                  for (var R = 0; R < u.length; R++) {
                    for (var $ = _.quantize.planeDst, P = new Uint8Array(u[R].buffer), B = new Uint32Array(u[R].buffer), F = P.length, L = 0; L < F; L += 4) {
                      for (var U = P[L] * 0.00392156862745098, z = P[L + 1] * (1 / 255), W = P[L + 2] * (1 / 255), V = P[L + 3] * (1 / 255), N = c; N.left; )
                        N = $(N.est, U, z, W, V) <= 0 ? N.left : N.right;
                      B[L >> 2] = N.est.rgba;
                    }
                    u[R] = B.buffer;
                  }
                  return { bufs: u, plte: t };
                }, _.quantize.getNearest = function(o, g, E, u, A) {
                  if (o.left == null)
                    return o.tdst = _.quantize.dist(o.est.q, g, E, u, A), o;
                  var L = _.quantize.planeDst(o.est, g, E, u, A), C = o.left, D = o.right;
                  L > 0 && (C = o.right, D = o.left);
                  var r = _.quantize.getNearest(C, g, E, u, A);
                  if (r.tdst <= L * L)
                    return r;
                  var n = _.quantize.getNearest(D, g, E, u, A);
                  return n.tdst < r.tdst ? n : r;
                }, _.quantize.planeDst = function(o, g, E, u, A) {
                  var L = o.e;
                  return L[0] * g + L[1] * E + L[2] * u + L[3] * A - o.eMq;
                }, _.quantize.dist = function(o, g, E, u, A) {
                  var L = g - o[0], C = E - o[1], D = u - o[2], r = A - o[3];
                  return L * L + C * C + D * D + r * r;
                }, _.quantize.splitPixels = function(o, g, E, u, A, L) {
                  var C = _.quantize.vecDot;
                  for (u -= 4; E < u; ) {
                    for (; C(o, E, A) <= L; )
                      E += 4;
                    for (; C(o, u, A) > L; )
                      u -= 4;
                    if (E >= u)
                      break;
                    var D = g[E >> 2];
                    g[E >> 2] = g[u >> 2], g[u >> 2] = D, E += 4, u -= 4;
                  }
                  for (; C(o, E, A) > L; )
                    E -= 4;
                  return E + 4;
                }, _.quantize.vecDot = function(o, g, E) {
                  return o[g] * E[0] + o[g + 1] * E[1] + o[g + 2] * E[2] + o[g + 3] * E[3];
                }, _.quantize.stats = function(o, g, E) {
                  for (var u = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], A = [0, 0, 0, 0], L = E - g >> 2, C = g; C < E; C += 4) {
                    var D = o[C] * 0.00392156862745098, r = o[C + 1] * (1 / 255), n = o[C + 2] * (1 / 255), b = o[C + 3] * (1 / 255);
                    A[0] += D, A[1] += r, A[2] += n, A[3] += b, u[0] += D * D, u[1] += D * r, u[2] += D * n, u[3] += D * b, u[5] += r * r, u[6] += r * n, u[7] += r * b, u[10] += n * n, u[11] += n * b, u[15] += b * b;
                  }
                  return u[4] = u[1], u[8] = u[2], u[12] = u[3], u[9] = u[6], u[13] = u[7], u[14] = u[11], { R: u, m: A, N: L };
                }, _.quantize.estats = function(o) {
                  var g = o.R, E = o.m, u = o.N, A = E[0], L = E[1], C = E[2], D = E[3], r = u == 0 ? 0 : 1 / u, n = [
                    g[0] - A * A * r,
                    g[1] - A * L * r,
                    g[2] - A * C * r,
                    g[3] - A * D * r,
                    g[4] - L * A * r,
                    g[5] - L * L * r,
                    g[6] - L * C * r,
                    g[7] - L * D * r,
                    g[8] - C * A * r,
                    g[9] - C * L * r,
                    g[10] - C * C * r,
                    g[11] - C * D * r,
                    g[12] - D * A * r,
                    g[13] - D * L * r,
                    g[14] - D * C * r,
                    g[15] - D * D * r
                  ], b = n, f = _.M4, c = [0.5, 0.5, 0.5, 0.5], t = 0, a = 0;
                  if (u != 0)
                    for (var h = 0; h < 10 && (c = f.multVec(b, c), a = Math.sqrt(f.dot(c, c)), c = f.sml(1 / a, c), !(Math.abs(a - t) < 1e-9)); h++)
                      t = a;
                  var M = [A * r, L * r, C * r, D * r], w = f.dot(f.sml(255, M), c), S = M[3] < 1e-3 ? 0 : 1 / M[3];
                  return {
                    Cov: n,
                    q: M,
                    e: c,
                    L: t,
                    eMq255: w,
                    eMq: f.dot(c, M),
                    rgba: (Math.round(255 * M[3]) << 24 | Math.round(255 * M[2] * S) << 16 | Math.round(255 * M[1] * S) << 8 | Math.round(255 * M[0] * S) << 0) >>> 0
                  };
                }, _.M4 = {
                  multVec: function(o, g) {
                    return [
                      o[0] * g[0] + o[1] * g[1] + o[2] * g[2] + o[3] * g[3],
                      o[4] * g[0] + o[5] * g[1] + o[6] * g[2] + o[7] * g[3],
                      o[8] * g[0] + o[9] * g[1] + o[10] * g[2] + o[11] * g[3],
                      o[12] * g[0] + o[13] * g[1] + o[14] * g[2] + o[15] * g[3]
                    ];
                  },
                  dot: function(o, g) {
                    return o[0] * g[0] + o[1] * g[1] + o[2] * g[2] + o[3] * g[3];
                  },
                  sml: function(o, g) {
                    return [o * g[0], o * g[1], o * g[2], o * g[3]];
                  }
                }, _.encode.alphaMul = function(o, g) {
                  for (var E = new Uint8Array(o.length), u = o.length >> 2, A = 0; A < u; A++) {
                    var L = A << 2, C = o[L + 3];
                    g && (C = C < 128 ? 0 : 255);
                    var D = C * (1 / 255);
                    E[L + 0] = o[L + 0] * D, E[L + 1] = o[L + 1] * D, E[L + 2] = o[L + 2] * D, E[L + 3] = C;
                  }
                  return E;
                };
              }(l, p);
            })();
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/index.js": (
          /*!*********************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/index.js ***!
            \*********************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ./lib/utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ).assign, p = e(
              /*! ./lib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/deflate.js"
            ), _ = e(
              /*! ./lib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/inflate.js"
            ), x = e(
              /*! ./lib/zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), o = {};
            l(o, p, _, x), y.exports = o;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/deflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/deflate.js ***!
            \***************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ./zlib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js"
            ), p = e(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), _ = e(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), x = e(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), o = e(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), g = Object.prototype.toString, E = 0, u = 4, A = 0, L = 1, C = 2, D = -1, r = 0, n = 8;
            function b(a) {
              if (!(this instanceof b))
                return new b(a);
              this.options = p.assign({
                level: D,
                method: n,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: r,
                to: ""
              }, a || {});
              var h = this.options;
              h.raw && h.windowBits > 0 ? h.windowBits = -h.windowBits : h.gzip && h.windowBits > 0 && h.windowBits < 16 && (h.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new o(), this.strm.avail_out = 0;
              var M = l.deflateInit2(
                this.strm,
                h.level,
                h.method,
                h.windowBits,
                h.memLevel,
                h.strategy
              );
              if (M !== A)
                throw new Error(x[M]);
              if (h.header && l.deflateSetHeader(this.strm, h.header), h.dictionary) {
                var w;
                if (typeof h.dictionary == "string" ? w = _.string2buf(h.dictionary) : g.call(h.dictionary) === "[object ArrayBuffer]" ? w = new Uint8Array(h.dictionary) : w = h.dictionary, M = l.deflateSetDictionary(this.strm, w), M !== A)
                  throw new Error(x[M]);
                this._dict_set = !0;
              }
            }
            b.prototype.push = function(a, h) {
              var M = this.strm, w = this.options.chunkSize, S, T;
              if (this.ended)
                return !1;
              T = h === ~~h ? h : h === !0 ? u : E, typeof a == "string" ? M.input = _.string2buf(a) : g.call(a) === "[object ArrayBuffer]" ? M.input = new Uint8Array(a) : M.input = a, M.next_in = 0, M.avail_in = M.input.length;
              do {
                if (M.avail_out === 0 && (M.output = new p.Buf8(w), M.next_out = 0, M.avail_out = w), S = l.deflate(M, T), S !== L && S !== A)
                  return this.onEnd(S), this.ended = !0, !1;
                (M.avail_out === 0 || M.avail_in === 0 && (T === u || T === C)) && (this.options.to === "string" ? this.onData(_.buf2binstring(p.shrinkBuf(M.output, M.next_out))) : this.onData(p.shrinkBuf(M.output, M.next_out)));
              } while ((M.avail_in > 0 || M.avail_out === 0) && S !== L);
              return T === u ? (S = l.deflateEnd(this.strm), this.onEnd(S), this.ended = !0, S === A) : (T === C && (this.onEnd(A), M.avail_out = 0), !0);
            }, b.prototype.onData = function(a) {
              this.chunks.push(a);
            }, b.prototype.onEnd = function(a) {
              a === A && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = p.flattenChunks(this.chunks)), this.chunks = [], this.err = a, this.msg = this.strm.msg;
            };
            function f(a, h) {
              var M = new b(h);
              if (M.push(a, !0), M.err)
                throw M.msg || x[M.err];
              return M.result;
            }
            function c(a, h) {
              return h = h || {}, h.raw = !0, f(a, h);
            }
            function t(a, h) {
              return h = h || {}, h.gzip = !0, f(a, h);
            }
            s.Deflate = b, s.deflate = f, s.deflateRaw = c, s.gzip = t;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/inflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/inflate.js ***!
            \***************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ./zlib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js"
            ), p = e(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), _ = e(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), x = e(
              /*! ./zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), o = e(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), g = e(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), E = e(
              /*! ./zlib/gzheader */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js"
            ), u = Object.prototype.toString;
            function A(D) {
              if (!(this instanceof A))
                return new A(D);
              this.options = p.assign({
                chunkSize: 16384,
                windowBits: 0,
                to: ""
              }, D || {});
              var r = this.options;
              r.raw && r.windowBits >= 0 && r.windowBits < 16 && (r.windowBits = -r.windowBits, r.windowBits === 0 && (r.windowBits = -15)), r.windowBits >= 0 && r.windowBits < 16 && !(D && D.windowBits) && (r.windowBits += 32), r.windowBits > 15 && r.windowBits < 48 && (r.windowBits & 15 || (r.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new g(), this.strm.avail_out = 0;
              var n = l.inflateInit2(
                this.strm,
                r.windowBits
              );
              if (n !== x.Z_OK)
                throw new Error(o[n]);
              if (this.header = new E(), l.inflateGetHeader(this.strm, this.header), r.dictionary && (typeof r.dictionary == "string" ? r.dictionary = _.string2buf(r.dictionary) : u.call(r.dictionary) === "[object ArrayBuffer]" && (r.dictionary = new Uint8Array(r.dictionary)), r.raw && (n = l.inflateSetDictionary(this.strm, r.dictionary), n !== x.Z_OK)))
                throw new Error(o[n]);
            }
            A.prototype.push = function(D, r) {
              var n = this.strm, b = this.options.chunkSize, f = this.options.dictionary, c, t, a, h, M, w = !1;
              if (this.ended)
                return !1;
              t = r === ~~r ? r : r === !0 ? x.Z_FINISH : x.Z_NO_FLUSH, typeof D == "string" ? n.input = _.binstring2buf(D) : u.call(D) === "[object ArrayBuffer]" ? n.input = new Uint8Array(D) : n.input = D, n.next_in = 0, n.avail_in = n.input.length;
              do {
                if (n.avail_out === 0 && (n.output = new p.Buf8(b), n.next_out = 0, n.avail_out = b), c = l.inflate(n, x.Z_NO_FLUSH), c === x.Z_NEED_DICT && f && (c = l.inflateSetDictionary(this.strm, f)), c === x.Z_BUF_ERROR && w === !0 && (c = x.Z_OK, w = !1), c !== x.Z_STREAM_END && c !== x.Z_OK)
                  return this.onEnd(c), this.ended = !0, !1;
                n.next_out && (n.avail_out === 0 || c === x.Z_STREAM_END || n.avail_in === 0 && (t === x.Z_FINISH || t === x.Z_SYNC_FLUSH)) && (this.options.to === "string" ? (a = _.utf8border(n.output, n.next_out), h = n.next_out - a, M = _.buf2string(n.output, a), n.next_out = h, n.avail_out = b - h, h && p.arraySet(n.output, n.output, a, h, 0), this.onData(M)) : this.onData(p.shrinkBuf(n.output, n.next_out))), n.avail_in === 0 && n.avail_out === 0 && (w = !0);
              } while ((n.avail_in > 0 || n.avail_out === 0) && c !== x.Z_STREAM_END);
              return c === x.Z_STREAM_END && (t = x.Z_FINISH), t === x.Z_FINISH ? (c = l.inflateEnd(this.strm), this.onEnd(c), this.ended = !0, c === x.Z_OK) : (t === x.Z_SYNC_FLUSH && (this.onEnd(x.Z_OK), n.avail_out = 0), !0);
            }, A.prototype.onData = function(D) {
              this.chunks.push(D);
            }, A.prototype.onEnd = function(D) {
              D === x.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = p.flattenChunks(this.chunks)), this.chunks = [], this.err = D, this.msg = this.strm.msg;
            };
            function L(D, r) {
              var n = new A(r);
              if (n.push(D, !0), n.err)
                throw n.msg || o[n.err];
              return n.result;
            }
            function C(D, r) {
              return r = r || {}, r.raw = !0, L(D, r);
            }
            s.Inflate = A, s.inflate = L, s.inflateRaw = C, s.ungzip = L;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/common.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/common.js ***!
            \********************************************************************/
          /***/
          (y, s) => {
            var e = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
            function l(x, o) {
              return Object.prototype.hasOwnProperty.call(x, o);
            }
            s.assign = function(x) {
              for (var o = Array.prototype.slice.call(arguments, 1); o.length; ) {
                var g = o.shift();
                if (g) {
                  if (typeof g != "object")
                    throw new TypeError(g + "must be non-object");
                  for (var E in g)
                    l(g, E) && (x[E] = g[E]);
                }
              }
              return x;
            }, s.shrinkBuf = function(x, o) {
              return x.length === o ? x : x.subarray ? x.subarray(0, o) : (x.length = o, x);
            };
            var p = {
              arraySet: function(x, o, g, E, u) {
                if (o.subarray && x.subarray) {
                  x.set(o.subarray(g, g + E), u);
                  return;
                }
                for (var A = 0; A < E; A++)
                  x[u + A] = o[g + A];
              },
              // Join array of chunks to single array.
              flattenChunks: function(x) {
                var o, g, E, u, A, L;
                for (E = 0, o = 0, g = x.length; o < g; o++)
                  E += x[o].length;
                for (L = new Uint8Array(E), u = 0, o = 0, g = x.length; o < g; o++)
                  A = x[o], L.set(A, u), u += A.length;
                return L;
              }
            }, _ = {
              arraySet: function(x, o, g, E, u) {
                for (var A = 0; A < E; A++)
                  x[u + A] = o[g + A];
              },
              // Join array of chunks to single array.
              flattenChunks: function(x) {
                return [].concat.apply([], x);
              }
            };
            s.setTyped = function(x) {
              x ? (s.Buf8 = Uint8Array, s.Buf16 = Uint16Array, s.Buf32 = Int32Array, s.assign(s, p)) : (s.Buf8 = Array, s.Buf16 = Array, s.Buf32 = Array, s.assign(s, _));
            }, s.setTyped(e);
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/strings.js ***!
            \*********************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ./common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), p = !0, _ = !0;
            try {
              String.fromCharCode.apply(null, [0]);
            } catch {
              p = !1;
            }
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              _ = !1;
            }
            for (var x = new l.Buf8(256), o = 0; o < 256; o++)
              x[o] = o >= 252 ? 6 : o >= 248 ? 5 : o >= 240 ? 4 : o >= 224 ? 3 : o >= 192 ? 2 : 1;
            x[254] = x[254] = 1, s.string2buf = function(E) {
              var u, A, L, C, D, r = E.length, n = 0;
              for (C = 0; C < r; C++)
                A = E.charCodeAt(C), (A & 64512) === 55296 && C + 1 < r && (L = E.charCodeAt(C + 1), (L & 64512) === 56320 && (A = 65536 + (A - 55296 << 10) + (L - 56320), C++)), n += A < 128 ? 1 : A < 2048 ? 2 : A < 65536 ? 3 : 4;
              for (u = new l.Buf8(n), D = 0, C = 0; D < n; C++)
                A = E.charCodeAt(C), (A & 64512) === 55296 && C + 1 < r && (L = E.charCodeAt(C + 1), (L & 64512) === 56320 && (A = 65536 + (A - 55296 << 10) + (L - 56320), C++)), A < 128 ? u[D++] = A : A < 2048 ? (u[D++] = 192 | A >>> 6, u[D++] = 128 | A & 63) : A < 65536 ? (u[D++] = 224 | A >>> 12, u[D++] = 128 | A >>> 6 & 63, u[D++] = 128 | A & 63) : (u[D++] = 240 | A >>> 18, u[D++] = 128 | A >>> 12 & 63, u[D++] = 128 | A >>> 6 & 63, u[D++] = 128 | A & 63);
              return u;
            };
            function g(E, u) {
              if (u < 65534 && (E.subarray && _ || !E.subarray && p))
                return String.fromCharCode.apply(null, l.shrinkBuf(E, u));
              for (var A = "", L = 0; L < u; L++)
                A += String.fromCharCode(E[L]);
              return A;
            }
            s.buf2binstring = function(E) {
              return g(E, E.length);
            }, s.binstring2buf = function(E) {
              for (var u = new l.Buf8(E.length), A = 0, L = u.length; A < L; A++)
                u[A] = E.charCodeAt(A);
              return u;
            }, s.buf2string = function(E, u) {
              var A, L, C, D, r = u || E.length, n = new Array(r * 2);
              for (L = 0, A = 0; A < r; ) {
                if (C = E[A++], C < 128) {
                  n[L++] = C;
                  continue;
                }
                if (D = x[C], D > 4) {
                  n[L++] = 65533, A += D - 1;
                  continue;
                }
                for (C &= D === 2 ? 31 : D === 3 ? 15 : 7; D > 1 && A < r; )
                  C = C << 6 | E[A++] & 63, D--;
                if (D > 1) {
                  n[L++] = 65533;
                  continue;
                }
                C < 65536 ? n[L++] = C : (C -= 65536, n[L++] = 55296 | C >> 10 & 1023, n[L++] = 56320 | C & 1023);
              }
              return g(n, L);
            }, s.utf8border = function(E, u) {
              var A;
              for (u = u || E.length, u > E.length && (u = E.length), A = u - 1; A >= 0 && (E[A] & 192) === 128; )
                A--;
              return A < 0 || A === 0 ? u : A + x[E[A]] > u ? A : u;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js ***!
            \********************************************************************/
          /***/
          (y) => {
            function s(e, l, p, _) {
              for (var x = e & 65535 | 0, o = e >>> 16 & 65535 | 0, g = 0; p !== 0; ) {
                g = p > 2e3 ? 2e3 : p, p -= g;
                do
                  x = x + l[_++] | 0, o = o + x | 0;
                while (--g);
                x %= 65521, o %= 65521;
              }
              return x | o << 16 | 0;
            }
            y.exports = s;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js": (
          /*!**********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js ***!
            \**********************************************************************/
          /***/
          (y) => {
            y.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 ***!
            \******************************************************************/
          /***/
          (y) => {
            function s() {
              for (var p, _ = [], x = 0; x < 256; x++) {
                p = x;
                for (var o = 0; o < 8; o++)
                  p = p & 1 ? 3988292384 ^ p >>> 1 : p >>> 1;
                _[x] = p;
              }
              return _;
            }
            var e = s();
            function l(p, _, x, o) {
              var g = e, E = o + x;
              p ^= -1;
              for (var u = o; u < E; u++)
                p = p >>> 8 ^ g[(p ^ _[u]) & 255];
              return p ^ -1;
            }
            y.exports = l;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js ***!
            \********************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), p = e(
              /*! ./trees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js"
            ), _ = e(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), x = e(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), o = e(
              /*! ./messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), g = 0, E = 1, u = 3, A = 4, L = 5, C = 0, D = 1, r = -2, n = -3, b = -5, f = -1, c = 1, t = 2, a = 3, h = 4, M = 0, w = 2, S = 8, T = 9, R = 15, $ = 8, P = 29, B = 256, F = B + 1 + P, U = 30, z = 19, W = 2 * F + 1, V = 15, N = 3, k = 258, G = k + N + 1, Q = 32, ie = 42, ge = 69, le = 73, oe = 91, he = 103, se = 113, xe = 666, ye = 1, Pe = 2, de = 3, pe = 4, re = 3;
            function Se(I, me) {
              return I.msg = o[me], me;
            }
            function ke(I) {
              return (I << 1) - (I > 4 ? 9 : 0);
            }
            function $e(I) {
              for (var me = I.length; --me >= 0; )
                I[me] = 0;
            }
            function ze(I) {
              var me = I.state, ve = me.pending;
              ve > I.avail_out && (ve = I.avail_out), ve !== 0 && (l.arraySet(I.output, me.pending_buf, me.pending_out, ve, I.next_out), I.next_out += ve, me.pending_out += ve, I.total_out += ve, I.avail_out -= ve, me.pending -= ve, me.pending === 0 && (me.pending_out = 0));
            }
            function Re(I, me) {
              p._tr_flush_block(I, I.block_start >= 0 ? I.block_start : -1, I.strstart - I.block_start, me), I.block_start = I.strstart, ze(I.strm);
            }
            function Fe(I, me) {
              I.pending_buf[I.pending++] = me;
            }
            function Ie(I, me) {
              I.pending_buf[I.pending++] = me >>> 8 & 255, I.pending_buf[I.pending++] = me & 255;
            }
            function We(I, me, ve, X) {
              var ne = I.avail_in;
              return ne > X && (ne = X), ne === 0 ? 0 : (I.avail_in -= ne, l.arraySet(me, I.input, I.next_in, ne, ve), I.state.wrap === 1 ? I.adler = _(I.adler, me, ne, ve) : I.state.wrap === 2 && (I.adler = x(I.adler, me, ne, ve)), I.next_in += ne, I.total_in += ne, ne);
            }
            function Ue(I, me) {
              var ve = I.max_chain_length, X = I.strstart, ne, Ee, He = I.prev_length, Ke = I.nice_match, je = I.strstart > I.w_size - G ? I.strstart - (I.w_size - G) : 0, qe = I.window, wt = I.w_mask, nt = I.prev, rt = I.strstart + k, tt = qe[X + He - 1], yt = qe[X + He];
              I.prev_length >= I.good_match && (ve >>= 2), Ke > I.lookahead && (Ke = I.lookahead);
              do
                if (ne = me, !(qe[ne + He] !== yt || qe[ne + He - 1] !== tt || qe[ne] !== qe[X] || qe[++ne] !== qe[X + 1])) {
                  X += 2, ne++;
                  do
                    ;
                  while (qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && qe[++X] === qe[++ne] && X < rt);
                  if (Ee = k - (rt - X), X = rt - k, Ee > He) {
                    if (I.match_start = me, He = Ee, Ee >= Ke)
                      break;
                    tt = qe[X + He - 1], yt = qe[X + He];
                  }
                }
              while ((me = nt[me & wt]) > je && --ve !== 0);
              return He <= I.lookahead ? He : I.lookahead;
            }
            function Be(I) {
              var me = I.w_size, ve, X, ne, Ee, He;
              do {
                if (Ee = I.window_size - I.lookahead - I.strstart, I.strstart >= me + (me - G)) {
                  l.arraySet(I.window, I.window, me, me, 0), I.match_start -= me, I.strstart -= me, I.block_start -= me, X = I.hash_size, ve = X;
                  do
                    ne = I.head[--ve], I.head[ve] = ne >= me ? ne - me : 0;
                  while (--X);
                  X = me, ve = X;
                  do
                    ne = I.prev[--ve], I.prev[ve] = ne >= me ? ne - me : 0;
                  while (--X);
                  Ee += me;
                }
                if (I.strm.avail_in === 0)
                  break;
                if (X = We(I.strm, I.window, I.strstart + I.lookahead, Ee), I.lookahead += X, I.lookahead + I.insert >= N)
                  for (He = I.strstart - I.insert, I.ins_h = I.window[He], I.ins_h = (I.ins_h << I.hash_shift ^ I.window[He + 1]) & I.hash_mask; I.insert && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[He + N - 1]) & I.hash_mask, I.prev[He & I.w_mask] = I.head[I.ins_h], I.head[I.ins_h] = He, He++, I.insert--, !(I.lookahead + I.insert < N)); )
                    ;
              } while (I.lookahead < G && I.strm.avail_in !== 0);
            }
            function Ne(I, me) {
              var ve = 65535;
              for (ve > I.pending_buf_size - 5 && (ve = I.pending_buf_size - 5); ; ) {
                if (I.lookahead <= 1) {
                  if (Be(I), I.lookahead === 0 && me === g)
                    return ye;
                  if (I.lookahead === 0)
                    break;
                }
                I.strstart += I.lookahead, I.lookahead = 0;
                var X = I.block_start + ve;
                if ((I.strstart === 0 || I.strstart >= X) && (I.lookahead = I.strstart - X, I.strstart = X, Re(I, !1), I.strm.avail_out === 0) || I.strstart - I.block_start >= I.w_size - G && (Re(I, !1), I.strm.avail_out === 0))
                  return ye;
              }
              return I.insert = 0, me === A ? (Re(I, !0), I.strm.avail_out === 0 ? de : pe) : (I.strstart > I.block_start && (Re(I, !1), I.strm.avail_out === 0), ye);
            }
            function H(I, me) {
              for (var ve, X; ; ) {
                if (I.lookahead < G) {
                  if (Be(I), I.lookahead < G && me === g)
                    return ye;
                  if (I.lookahead === 0)
                    break;
                }
                if (ve = 0, I.lookahead >= N && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + N - 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 - G && (I.match_length = Ue(I, ve)), I.match_length >= N)
                  if (X = p._tr_tally(I, I.strstart - I.match_start, I.match_length - N), I.lookahead -= I.match_length, I.match_length <= I.max_lazy_match && I.lookahead >= N) {
                    I.match_length--;
                    do
                      I.strstart++, I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + N - 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
                  X = p._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++;
                if (X && (Re(I, !1), I.strm.avail_out === 0))
                  return ye;
              }
              return I.insert = I.strstart < N - 1 ? I.strstart : N - 1, me === A ? (Re(I, !0), I.strm.avail_out === 0 ? de : pe) : I.last_lit && (Re(I, !1), I.strm.avail_out === 0) ? ye : Pe;
            }
            function K(I, me) {
              for (var ve, X, ne; ; ) {
                if (I.lookahead < G) {
                  if (Be(I), I.lookahead < G && me === g)
                    return ye;
                  if (I.lookahead === 0)
                    break;
                }
                if (ve = 0, I.lookahead >= N && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + N - 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 = N - 1, ve !== 0 && I.prev_length < I.max_lazy_match && I.strstart - ve <= I.w_size - G && (I.match_length = Ue(I, ve), I.match_length <= 5 && (I.strategy === c || I.match_length === N && I.strstart - I.match_start > 4096) && (I.match_length = N - 1)), I.prev_length >= N && I.match_length <= I.prev_length) {
                  ne = I.strstart + I.lookahead - N, X = p._tr_tally(I, I.strstart - 1 - I.prev_match, I.prev_length - N), I.lookahead -= I.prev_length - 1, I.prev_length -= 2;
                  do
                    ++I.strstart <= ne && (I.ins_h = (I.ins_h << I.hash_shift ^ I.window[I.strstart + N - 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 = N - 1, I.strstart++, X && (Re(I, !1), I.strm.avail_out === 0))
                    return ye;
                } else if (I.match_available) {
                  if (X = p._tr_tally(I, 0, I.window[I.strstart - 1]), X && Re(I, !1), I.strstart++, I.lookahead--, I.strm.avail_out === 0)
                    return ye;
                } else
                  I.match_available = 1, I.strstart++, I.lookahead--;
              }
              return I.match_available && (X = p._tr_tally(I, 0, I.window[I.strstart - 1]), I.match_available = 0), I.insert = I.strstart < N - 1 ? I.strstart : N - 1, me === A ? (Re(I, !0), I.strm.avail_out === 0 ? de : pe) : I.last_lit && (Re(I, !1), I.strm.avail_out === 0) ? ye : Pe;
            }
            function q(I, me) {
              for (var ve, X, ne, Ee, He = I.window; ; ) {
                if (I.lookahead <= k) {
                  if (Be(I), I.lookahead <= k && me === g)
                    return ye;
                  if (I.lookahead === 0)
                    break;
                }
                if (I.match_length = 0, I.lookahead >= N && I.strstart > 0 && (ne = I.strstart - 1, X = He[ne], X === He[++ne] && X === He[++ne] && X === He[++ne])) {
                  Ee = I.strstart + k;
                  do
                    ;
                  while (X === He[++ne] && X === He[++ne] && X === He[++ne] && X === He[++ne] && X === He[++ne] && X === He[++ne] && X === He[++ne] && X === He[++ne] && ne < Ee);
                  I.match_length = k - (Ee - ne), I.match_length > I.lookahead && (I.match_length = I.lookahead);
                }
                if (I.match_length >= N ? (ve = p._tr_tally(I, 1, I.match_length - N), I.lookahead -= I.match_length, I.strstart += I.match_length, I.match_length = 0) : (ve = p._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++), ve && (Re(I, !1), I.strm.avail_out === 0))
                  return ye;
              }
              return I.insert = 0, me === A ? (Re(I, !0), I.strm.avail_out === 0 ? de : pe) : I.last_lit && (Re(I, !1), I.strm.avail_out === 0) ? ye : Pe;
            }
            function fe(I, me) {
              for (var ve; ; ) {
                if (I.lookahead === 0 && (Be(I), I.lookahead === 0)) {
                  if (me === g)
                    return ye;
                  break;
                }
                if (I.match_length = 0, ve = p._tr_tally(I, 0, I.window[I.strstart]), I.lookahead--, I.strstart++, ve && (Re(I, !1), I.strm.avail_out === 0))
                  return ye;
              }
              return I.insert = 0, me === A ? (Re(I, !0), I.strm.avail_out === 0 ? de : pe) : I.last_lit && (Re(I, !1), I.strm.avail_out === 0) ? ye : Pe;
            }
            function _e(I, me, ve, X, ne) {
              this.good_length = I, this.max_lazy = me, this.nice_length = ve, this.max_chain = X, this.func = ne;
            }
            var Me;
            Me = [
              /*      good lazy nice chain */
              new _e(0, 0, 0, 0, Ne),
              /* 0 store only */
              new _e(4, 4, 8, 4, H),
              /* 1 max speed, no lazy matches */
              new _e(4, 5, 16, 8, H),
              /* 2 */
              new _e(4, 6, 32, 32, H),
              /* 3 */
              new _e(4, 4, 16, 16, K),
              /* 4 lazy matches */
              new _e(8, 16, 32, 32, K),
              /* 5 */
              new _e(8, 16, 128, 128, K),
              /* 6 */
              new _e(8, 32, 128, 256, K),
              /* 7 */
              new _e(32, 128, 258, 1024, K),
              /* 8 */
              new _e(32, 258, 258, 4096, K)
              /* 9 max compression */
            ];
            function Ae(I) {
              I.window_size = 2 * I.w_size, $e(I.head), I.max_lazy_match = Me[I.level].max_lazy, I.good_match = Me[I.level].good_length, I.nice_match = Me[I.level].nice_length, I.max_chain_length = Me[I.level].max_chain, I.strstart = 0, I.block_start = 0, I.lookahead = 0, I.insert = 0, I.match_length = I.prev_length = N - 1, I.match_available = 0, I.ins_h = 0;
            }
            function Z() {
              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 = S, 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 l.Buf16(W * 2), this.dyn_dtree = new l.Buf16((2 * U + 1) * 2), this.bl_tree = new l.Buf16((2 * z + 1) * 2), $e(this.dyn_ltree), $e(this.dyn_dtree), $e(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new l.Buf16(V + 1), this.heap = new l.Buf16(2 * F + 1), $e(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new l.Buf16(2 * F + 1), $e(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 ue(I) {
              var me;
              return !I || !I.state ? Se(I, r) : (I.total_in = I.total_out = 0, I.data_type = w, me = I.state, me.pending = 0, me.pending_out = 0, me.wrap < 0 && (me.wrap = -me.wrap), me.status = me.wrap ? ie : se, I.adler = me.wrap === 2 ? 0 : 1, me.last_flush = g, p._tr_init(me), C);
            }
            function we(I) {
              var me = ue(I);
              return me === C && Ae(I.state), me;
            }
            function Te(I, me) {
              return !I || !I.state || I.state.wrap !== 2 ? r : (I.state.gzhead = me, C);
            }
            function ae(I, me, ve, X, ne, Ee) {
              if (!I)
                return r;
              var He = 1;
              if (me === f && (me = 6), X < 0 ? (He = 0, X = -X) : X > 15 && (He = 2, X -= 16), ne < 1 || ne > T || ve !== S || X < 8 || X > 15 || me < 0 || me > 9 || Ee < 0 || Ee > h)
                return Se(I, r);
              X === 8 && (X = 9);
              var Ke = new Z();
              return I.state = Ke, Ke.strm = I, Ke.wrap = He, Ke.gzhead = null, Ke.w_bits = X, Ke.w_size = 1 << Ke.w_bits, Ke.w_mask = Ke.w_size - 1, Ke.hash_bits = ne + 7, Ke.hash_size = 1 << Ke.hash_bits, Ke.hash_mask = Ke.hash_size - 1, Ke.hash_shift = ~~((Ke.hash_bits + N - 1) / N), Ke.window = new l.Buf8(Ke.w_size * 2), Ke.head = new l.Buf16(Ke.hash_size), Ke.prev = new l.Buf16(Ke.w_size), Ke.lit_bufsize = 1 << ne + 6, Ke.pending_buf_size = Ke.lit_bufsize * 4, Ke.pending_buf = new l.Buf8(Ke.pending_buf_size), Ke.d_buf = 1 * Ke.lit_bufsize, Ke.l_buf = 3 * Ke.lit_bufsize, Ke.level = me, Ke.strategy = Ee, Ke.method = ve, we(I);
            }
            function De(I, me) {
              return ae(I, me, S, R, $, M);
            }
            function Y(I, me) {
              var ve, X, ne, Ee;
              if (!I || !I.state || me > L || me < 0)
                return I ? Se(I, r) : r;
              if (X = I.state, !I.output || !I.input && I.avail_in !== 0 || X.status === xe && me !== A)
                return Se(I, I.avail_out === 0 ? b : r);
              if (X.strm = I, ve = X.last_flush, X.last_flush = me, X.status === ie)
                if (X.wrap === 2)
                  I.adler = 0, Fe(X, 31), Fe(X, 139), Fe(X, 8), X.gzhead ? (Fe(
                    X,
                    (X.gzhead.text ? 1 : 0) + (X.gzhead.hcrc ? 2 : 0) + (X.gzhead.extra ? 4 : 0) + (X.gzhead.name ? 8 : 0) + (X.gzhead.comment ? 16 : 0)
                  ), Fe(X, X.gzhead.time & 255), Fe(X, X.gzhead.time >> 8 & 255), Fe(X, X.gzhead.time >> 16 & 255), Fe(X, X.gzhead.time >> 24 & 255), Fe(X, X.level === 9 ? 2 : X.strategy >= t || X.level < 2 ? 4 : 0), Fe(X, X.gzhead.os & 255), X.gzhead.extra && X.gzhead.extra.length && (Fe(X, X.gzhead.extra.length & 255), Fe(X, X.gzhead.extra.length >> 8 & 255)), X.gzhead.hcrc && (I.adler = x(I.adler, X.pending_buf, X.pending, 0)), X.gzindex = 0, X.status = ge) : (Fe(X, 0), Fe(X, 0), Fe(X, 0), Fe(X, 0), Fe(X, 0), Fe(X, X.level === 9 ? 2 : X.strategy >= t || X.level < 2 ? 4 : 0), Fe(X, re), X.status = se);
                else {
                  var He = S + (X.w_bits - 8 << 4) << 8, Ke = -1;
                  X.strategy >= t || X.level < 2 ? Ke = 0 : X.level < 6 ? Ke = 1 : X.level === 6 ? Ke = 2 : Ke = 3, He |= Ke << 6, X.strstart !== 0 && (He |= Q), He += 31 - He % 31, X.status = se, Ie(X, He), X.strstart !== 0 && (Ie(X, I.adler >>> 16), Ie(X, I.adler & 65535)), I.adler = 1;
                }
              if (X.status === ge)
                if (X.gzhead.extra) {
                  for (ne = X.pending; X.gzindex < (X.gzhead.extra.length & 65535) && !(X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), ze(I), ne = X.pending, X.pending === X.pending_buf_size)); )
                    Fe(X, X.gzhead.extra[X.gzindex] & 255), X.gzindex++;
                  X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), X.gzindex === X.gzhead.extra.length && (X.gzindex = 0, X.status = le);
                } else
                  X.status = le;
              if (X.status === le)
                if (X.gzhead.name) {
                  ne = X.pending;
                  do {
                    if (X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), ze(I), ne = X.pending, X.pending === X.pending_buf_size)) {
                      Ee = 1;
                      break;
                    }
                    X.gzindex < X.gzhead.name.length ? Ee = X.gzhead.name.charCodeAt(X.gzindex++) & 255 : Ee = 0, Fe(X, Ee);
                  } while (Ee !== 0);
                  X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), Ee === 0 && (X.gzindex = 0, X.status = oe);
                } else
                  X.status = oe;
              if (X.status === oe)
                if (X.gzhead.comment) {
                  ne = X.pending;
                  do {
                    if (X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), ze(I), ne = X.pending, X.pending === X.pending_buf_size)) {
                      Ee = 1;
                      break;
                    }
                    X.gzindex < X.gzhead.comment.length ? Ee = X.gzhead.comment.charCodeAt(X.gzindex++) & 255 : Ee = 0, Fe(X, Ee);
                  } while (Ee !== 0);
                  X.gzhead.hcrc && X.pending > ne && (I.adler = x(I.adler, X.pending_buf, X.pending - ne, ne)), Ee === 0 && (X.status = he);
                } else
                  X.status = he;
              if (X.status === he && (X.gzhead.hcrc ? (X.pending + 2 > X.pending_buf_size && ze(I), X.pending + 2 <= X.pending_buf_size && (Fe(X, I.adler & 255), Fe(X, I.adler >> 8 & 255), I.adler = 0, X.status = se)) : X.status = se), X.pending !== 0) {
                if (ze(I), I.avail_out === 0)
                  return X.last_flush = -1, C;
              } else if (I.avail_in === 0 && ke(me) <= ke(ve) && me !== A)
                return Se(I, b);
              if (X.status === xe && I.avail_in !== 0)
                return Se(I, b);
              if (I.avail_in !== 0 || X.lookahead !== 0 || me !== g && X.status !== xe) {
                var je = X.strategy === t ? fe(X, me) : X.strategy === a ? q(X, me) : Me[X.level].func(X, me);
                if ((je === de || je === pe) && (X.status = xe), je === ye || je === de)
                  return I.avail_out === 0 && (X.last_flush = -1), C;
                if (je === Pe && (me === E ? p._tr_align(X) : me !== L && (p._tr_stored_block(X, 0, 0, !1), me === u && ($e(X.head), X.lookahead === 0 && (X.strstart = 0, X.block_start = 0, X.insert = 0))), ze(I), I.avail_out === 0))
                  return X.last_flush = -1, C;
              }
              return me !== A ? C : X.wrap <= 0 ? D : (X.wrap === 2 ? (Fe(X, I.adler & 255), Fe(X, I.adler >> 8 & 255), Fe(X, I.adler >> 16 & 255), Fe(X, I.adler >> 24 & 255), Fe(X, I.total_in & 255), Fe(X, I.total_in >> 8 & 255), Fe(X, I.total_in >> 16 & 255), Fe(X, I.total_in >> 24 & 255)) : (Ie(X, I.adler >>> 16), Ie(X, I.adler & 65535)), ze(I), X.wrap > 0 && (X.wrap = -X.wrap), X.pending !== 0 ? C : D);
            }
            function Oe(I) {
              var me;
              return !I || !I.state ? r : (me = I.state.status, me !== ie && me !== ge && me !== le && me !== oe && me !== he && me !== se && me !== xe ? Se(I, r) : (I.state = null, me === se ? Se(I, n) : C));
            }
            function Ve(I, me) {
              var ve = me.length, X, ne, Ee, He, Ke, je, qe, wt;
              if (!I || !I.state || (X = I.state, He = X.wrap, He === 2 || He === 1 && X.status !== ie || X.lookahead))
                return r;
              for (He === 1 && (I.adler = _(I.adler, me, ve, 0)), X.wrap = 0, ve >= X.w_size && (He === 0 && ($e(X.head), X.strstart = 0, X.block_start = 0, X.insert = 0), wt = new l.Buf8(X.w_size), l.arraySet(wt, me, ve - X.w_size, X.w_size, 0), me = wt, ve = X.w_size), Ke = I.avail_in, je = I.next_in, qe = I.input, I.avail_in = ve, I.next_in = 0, I.input = me, Be(X); X.lookahead >= N; ) {
                ne = X.strstart, Ee = X.lookahead - (N - 1);
                do
                  X.ins_h = (X.ins_h << X.hash_shift ^ X.window[ne + N - 1]) & X.hash_mask, X.prev[ne & X.w_mask] = X.head[X.ins_h], X.head[X.ins_h] = ne, ne++;
                while (--Ee);
                X.strstart = ne, X.lookahead = N - 1, Be(X);
              }
              return X.strstart += X.lookahead, X.block_start = X.strstart, X.insert = X.lookahead, X.lookahead = 0, X.match_length = X.prev_length = N - 1, X.match_available = 0, I.next_in = je, I.input = qe, I.avail_in = Ke, X.wrap = He, C;
            }
            s.deflateInit = De, s.deflateInit2 = ae, s.deflateReset = we, s.deflateResetKeep = ue, s.deflateSetHeader = Te, s.deflate = Y, s.deflateEnd = Oe, s.deflateSetDictionary = Ve, s.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 ***!
            \*********************************************************************/
          /***/
          (y) => {
            function s() {
              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;
            }
            y.exports = s;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js ***!
            \********************************************************************/
          /***/
          (y) => {
            var s = 30, e = 12;
            y.exports = function(p, _) {
              var x, o, g, E, u, A, L, C, D, r, n, b, f, c, t, a, h, M, w, S, T, R, $, P, B;
              x = p.state, o = p.next_in, P = p.input, g = o + (p.avail_in - 5), E = p.next_out, B = p.output, u = E - (_ - p.avail_out), A = E + (p.avail_out - 257), L = x.dmax, C = x.wsize, D = x.whave, r = x.wnext, n = x.window, b = x.hold, f = x.bits, c = x.lencode, t = x.distcode, a = (1 << x.lenbits) - 1, h = (1 << x.distbits) - 1;
              e:
                do {
                  f < 15 && (b += P[o++] << f, f += 8, b += P[o++] << f, f += 8), M = c[b & a];
                  t:
                    for (; ; ) {
                      if (w = M >>> 24, b >>>= w, f -= w, w = M >>> 16 & 255, w === 0)
                        B[E++] = M & 65535;
                      else if (w & 16) {
                        S = M & 65535, w &= 15, w && (f < w && (b += P[o++] << f, f += 8), S += b & (1 << w) - 1, b >>>= w, f -= w), f < 15 && (b += P[o++] << f, f += 8, b += P[o++] << f, f += 8), M = t[b & h];
                        i:
                          for (; ; ) {
                            if (w = M >>> 24, b >>>= w, f -= w, w = M >>> 16 & 255, w & 16) {
                              if (T = M & 65535, w &= 15, f < w && (b += P[o++] << f, f += 8, f < w && (b += P[o++] << f, f += 8)), T += b & (1 << w) - 1, T > L) {
                                p.msg = "invalid distance too far back", x.mode = s;
                                break e;
                              }
                              if (b >>>= w, f -= w, w = E - u, T > w) {
                                if (w = T - w, w > D && x.sane) {
                                  p.msg = "invalid distance too far back", x.mode = s;
                                  break e;
                                }
                                if (R = 0, $ = n, r === 0) {
                                  if (R += C - w, w < S) {
                                    S -= w;
                                    do
                                      B[E++] = n[R++];
                                    while (--w);
                                    R = E - T, $ = B;
                                  }
                                } else if (r < w) {
                                  if (R += C + r - w, w -= r, w < S) {
                                    S -= w;
                                    do
                                      B[E++] = n[R++];
                                    while (--w);
                                    if (R = 0, r < S) {
                                      w = r, S -= w;
                                      do
                                        B[E++] = n[R++];
                                      while (--w);
                                      R = E - T, $ = B;
                                    }
                                  }
                                } else if (R += r - w, w < S) {
                                  S -= w;
                                  do
                                    B[E++] = n[R++];
                                  while (--w);
                                  R = E - T, $ = B;
                                }
                                for (; S > 2; )
                                  B[E++] = $[R++], B[E++] = $[R++], B[E++] = $[R++], S -= 3;
                                S && (B[E++] = $[R++], S > 1 && (B[E++] = $[R++]));
                              } else {
                                R = E - T;
                                do
                                  B[E++] = B[R++], B[E++] = B[R++], B[E++] = B[R++], S -= 3;
                                while (S > 2);
                                S && (B[E++] = B[R++], S > 1 && (B[E++] = B[R++]));
                              }
                            } else if (w & 64) {
                              p.msg = "invalid distance code", x.mode = s;
                              break e;
                            } else {
                              M = t[(M & 65535) + (b & (1 << w) - 1)];
                              continue i;
                            }
                            break;
                          }
                      } else if (w & 64)
                        if (w & 32) {
                          x.mode = e;
                          break e;
                        } else {
                          p.msg = "invalid literal/length code", x.mode = s;
                          break e;
                        }
                      else {
                        M = c[(M & 65535) + (b & (1 << w) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (o < g && E < A);
              S = f >> 3, o -= S, f -= S << 3, b &= (1 << f) - 1, p.next_in = o, p.next_out = E, p.avail_in = o < g ? 5 + (g - o) : 5 - (o - g), p.avail_out = E < A ? 257 + (A - E) : 257 - (E - A), x.hold = b, x.bits = f;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js ***!
            \********************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), p = e(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), _ = e(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), x = e(
              /*! ./inffast */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js"
            ), o = e(
              /*! ./inftrees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js"
            ), g = 0, E = 1, u = 2, A = 4, L = 5, C = 6, D = 0, r = 1, n = 2, b = -2, f = -3, c = -4, t = -5, a = 8, h = 1, M = 2, w = 3, S = 4, T = 5, R = 6, $ = 7, P = 8, B = 9, F = 10, U = 11, z = 12, W = 13, V = 14, N = 15, k = 16, G = 17, Q = 18, ie = 19, ge = 20, le = 21, oe = 22, he = 23, se = 24, xe = 25, ye = 26, Pe = 27, de = 28, pe = 29, re = 30, Se = 31, ke = 32, $e = 852, ze = 592, Re = 15, Fe = Re;
            function Ie(ae) {
              return (ae >>> 24 & 255) + (ae >>> 8 & 65280) + ((ae & 65280) << 8) + ((ae & 255) << 24);
            }
            function We() {
              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 l.Buf16(320), this.work = new l.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
            }
            function Ue(ae) {
              var De;
              return !ae || !ae.state ? b : (De = ae.state, ae.total_in = ae.total_out = De.total = 0, ae.msg = "", De.wrap && (ae.adler = De.wrap & 1), De.mode = h, De.last = 0, De.havedict = 0, De.dmax = 32768, De.head = null, De.hold = 0, De.bits = 0, De.lencode = De.lendyn = new l.Buf32($e), De.distcode = De.distdyn = new l.Buf32(ze), De.sane = 1, De.back = -1, D);
            }
            function Be(ae) {
              var De;
              return !ae || !ae.state ? b : (De = ae.state, De.wsize = 0, De.whave = 0, De.wnext = 0, Ue(ae));
            }
            function Ne(ae, De) {
              var Y, Oe;
              return !ae || !ae.state || (Oe = ae.state, De < 0 ? (Y = 0, De = -De) : (Y = (De >> 4) + 1, De < 48 && (De &= 15)), De && (De < 8 || De > 15)) ? b : (Oe.window !== null && Oe.wbits !== De && (Oe.window = null), Oe.wrap = Y, Oe.wbits = De, Be(ae));
            }
            function H(ae, De) {
              var Y, Oe;
              return ae ? (Oe = new We(), ae.state = Oe, Oe.window = null, Y = Ne(ae, De), Y !== D && (ae.state = null), Y) : b;
            }
            function K(ae) {
              return H(ae, Fe);
            }
            var q = !0, fe, _e;
            function Me(ae) {
              if (q) {
                var De;
                for (fe = new l.Buf32(512), _e = new l.Buf32(32), De = 0; De < 144; )
                  ae.lens[De++] = 8;
                for (; De < 256; )
                  ae.lens[De++] = 9;
                for (; De < 280; )
                  ae.lens[De++] = 7;
                for (; De < 288; )
                  ae.lens[De++] = 8;
                for (o(E, ae.lens, 0, 288, fe, 0, ae.work, { bits: 9 }), De = 0; De < 32; )
                  ae.lens[De++] = 5;
                o(u, ae.lens, 0, 32, _e, 0, ae.work, { bits: 5 }), q = !1;
              }
              ae.lencode = fe, ae.lenbits = 9, ae.distcode = _e, ae.distbits = 5;
            }
            function Ae(ae, De, Y, Oe) {
              var Ve, I = ae.state;
              return I.window === null && (I.wsize = 1 << I.wbits, I.wnext = 0, I.whave = 0, I.window = new l.Buf8(I.wsize)), Oe >= I.wsize ? (l.arraySet(I.window, De, Y - I.wsize, I.wsize, 0), I.wnext = 0, I.whave = I.wsize) : (Ve = I.wsize - I.wnext, Ve > Oe && (Ve = Oe), l.arraySet(I.window, De, Y - Oe, Ve, I.wnext), Oe -= Ve, Oe ? (l.arraySet(I.window, De, Y - Oe, Oe, 0), I.wnext = Oe, I.whave = I.wsize) : (I.wnext += Ve, I.wnext === I.wsize && (I.wnext = 0), I.whave < I.wsize && (I.whave += Ve))), 0;
            }
            function Z(ae, De) {
              var Y, Oe, Ve, I, me, ve, X, ne, Ee, He, Ke, je, qe, wt, nt = 0, rt, tt, yt, _t, It, Ot, vt, mt, pt = new l.Buf8(4), Ct, Mt, Ft = (
                /* permutation of code lengths */
                [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]
              );
              if (!ae || !ae.state || !ae.output || !ae.input && ae.avail_in !== 0)
                return b;
              Y = ae.state, Y.mode === z && (Y.mode = W), me = ae.next_out, Ve = ae.output, X = ae.avail_out, I = ae.next_in, Oe = ae.input, ve = ae.avail_in, ne = Y.hold, Ee = Y.bits, He = ve, Ke = X, mt = D;
              e:
                for (; ; )
                  switch (Y.mode) {
                    case h:
                      if (Y.wrap === 0) {
                        Y.mode = W;
                        break;
                      }
                      for (; Ee < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if (Y.wrap & 2 && ne === 35615) {
                        Y.check = 0, pt[0] = ne & 255, pt[1] = ne >>> 8 & 255, Y.check = _(Y.check, pt, 2, 0), ne = 0, Ee = 0, Y.mode = M;
                        break;
                      }
                      if (Y.flags = 0, Y.head && (Y.head.done = !1), !(Y.wrap & 1) || /* check if zlib header allowed */
                      (((ne & 255) << 8) + (ne >> 8)) % 31) {
                        ae.msg = "incorrect header check", Y.mode = re;
                        break;
                      }
                      if ((ne & 15) !== a) {
                        ae.msg = "unknown compression method", Y.mode = re;
                        break;
                      }
                      if (ne >>>= 4, Ee -= 4, vt = (ne & 15) + 8, Y.wbits === 0)
                        Y.wbits = vt;
                      else if (vt > Y.wbits) {
                        ae.msg = "invalid window size", Y.mode = re;
                        break;
                      }
                      Y.dmax = 1 << vt, ae.adler = Y.check = 1, Y.mode = ne & 512 ? F : z, ne = 0, Ee = 0;
                      break;
                    case M:
                      for (; Ee < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if (Y.flags = ne, (Y.flags & 255) !== a) {
                        ae.msg = "unknown compression method", Y.mode = re;
                        break;
                      }
                      if (Y.flags & 57344) {
                        ae.msg = "unknown header flags set", Y.mode = re;
                        break;
                      }
                      Y.head && (Y.head.text = ne >> 8 & 1), Y.flags & 512 && (pt[0] = ne & 255, pt[1] = ne >>> 8 & 255, Y.check = _(Y.check, pt, 2, 0)), ne = 0, Ee = 0, Y.mode = w;
                    case w:
                      for (; Ee < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      Y.head && (Y.head.time = ne), Y.flags & 512 && (pt[0] = ne & 255, pt[1] = ne >>> 8 & 255, pt[2] = ne >>> 16 & 255, pt[3] = ne >>> 24 & 255, Y.check = _(Y.check, pt, 4, 0)), ne = 0, Ee = 0, Y.mode = S;
                    case S:
                      for (; Ee < 16; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      Y.head && (Y.head.xflags = ne & 255, Y.head.os = ne >> 8), Y.flags & 512 && (pt[0] = ne & 255, pt[1] = ne >>> 8 & 255, Y.check = _(Y.check, pt, 2, 0)), ne = 0, Ee = 0, Y.mode = T;
                    case T:
                      if (Y.flags & 1024) {
                        for (; Ee < 16; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        Y.length = ne, Y.head && (Y.head.extra_len = ne), Y.flags & 512 && (pt[0] = ne & 255, pt[1] = ne >>> 8 & 255, Y.check = _(Y.check, pt, 2, 0)), ne = 0, Ee = 0;
                      } else
                        Y.head && (Y.head.extra = null);
                      Y.mode = R;
                    case R:
                      if (Y.flags & 1024 && (je = Y.length, je > ve && (je = ve), je && (Y.head && (vt = Y.head.extra_len - Y.length, Y.head.extra || (Y.head.extra = new Array(Y.head.extra_len)), l.arraySet(
                        Y.head.extra,
                        Oe,
                        I,
                        // extra field is limited to 65536 bytes
                        // - no need for additional size check
                        je,
                        /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                        vt
                      )), Y.flags & 512 && (Y.check = _(Y.check, Oe, je, I)), ve -= je, I += je, Y.length -= je), Y.length))
                        break e;
                      Y.length = 0, Y.mode = $;
                    case $:
                      if (Y.flags & 2048) {
                        if (ve === 0)
                          break e;
                        je = 0;
                        do
                          vt = Oe[I + je++], Y.head && vt && Y.length < 65536 && (Y.head.name += String.fromCharCode(vt));
                        while (vt && je < ve);
                        if (Y.flags & 512 && (Y.check = _(Y.check, Oe, je, I)), ve -= je, I += je, vt)
                          break e;
                      } else
                        Y.head && (Y.head.name = null);
                      Y.length = 0, Y.mode = P;
                    case P:
                      if (Y.flags & 4096) {
                        if (ve === 0)
                          break e;
                        je = 0;
                        do
                          vt = Oe[I + je++], Y.head && vt && Y.length < 65536 && (Y.head.comment += String.fromCharCode(vt));
                        while (vt && je < ve);
                        if (Y.flags & 512 && (Y.check = _(Y.check, Oe, je, I)), ve -= je, I += je, vt)
                          break e;
                      } else
                        Y.head && (Y.head.comment = null);
                      Y.mode = B;
                    case B:
                      if (Y.flags & 512) {
                        for (; Ee < 16; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        if (ne !== (Y.check & 65535)) {
                          ae.msg = "header crc mismatch", Y.mode = re;
                          break;
                        }
                        ne = 0, Ee = 0;
                      }
                      Y.head && (Y.head.hcrc = Y.flags >> 9 & 1, Y.head.done = !0), ae.adler = Y.check = 0, Y.mode = z;
                      break;
                    case F:
                      for (; Ee < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      ae.adler = Y.check = Ie(ne), ne = 0, Ee = 0, Y.mode = U;
                    case U:
                      if (Y.havedict === 0)
                        return ae.next_out = me, ae.avail_out = X, ae.next_in = I, ae.avail_in = ve, Y.hold = ne, Y.bits = Ee, n;
                      ae.adler = Y.check = 1, Y.mode = z;
                    case z:
                      if (De === L || De === C)
                        break e;
                    case W:
                      if (Y.last) {
                        ne >>>= Ee & 7, Ee -= Ee & 7, Y.mode = Pe;
                        break;
                      }
                      for (; Ee < 3; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      switch (Y.last = ne & 1, ne >>>= 1, Ee -= 1, ne & 3) {
                        case 0:
                          Y.mode = V;
                          break;
                        case 1:
                          if (Me(Y), Y.mode = ge, De === C) {
                            ne >>>= 2, Ee -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          Y.mode = G;
                          break;
                        case 3:
                          ae.msg = "invalid block type", Y.mode = re;
                      }
                      ne >>>= 2, Ee -= 2;
                      break;
                    case V:
                      for (ne >>>= Ee & 7, Ee -= Ee & 7; Ee < 32; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if ((ne & 65535) !== (ne >>> 16 ^ 65535)) {
                        ae.msg = "invalid stored block lengths", Y.mode = re;
                        break;
                      }
                      if (Y.length = ne & 65535, ne = 0, Ee = 0, Y.mode = N, De === C)
                        break e;
                    case N:
                      Y.mode = k;
                    case k:
                      if (je = Y.length, je) {
                        if (je > ve && (je = ve), je > X && (je = X), je === 0)
                          break e;
                        l.arraySet(Ve, Oe, I, je, me), ve -= je, I += je, X -= je, me += je, Y.length -= je;
                        break;
                      }
                      Y.mode = z;
                      break;
                    case G:
                      for (; Ee < 14; ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if (Y.nlen = (ne & 31) + 257, ne >>>= 5, Ee -= 5, Y.ndist = (ne & 31) + 1, ne >>>= 5, Ee -= 5, Y.ncode = (ne & 15) + 4, ne >>>= 4, Ee -= 4, Y.nlen > 286 || Y.ndist > 30) {
                        ae.msg = "too many length or distance symbols", Y.mode = re;
                        break;
                      }
                      Y.have = 0, Y.mode = Q;
                    case Q:
                      for (; Y.have < Y.ncode; ) {
                        for (; Ee < 3; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        Y.lens[Ft[Y.have++]] = ne & 7, ne >>>= 3, Ee -= 3;
                      }
                      for (; Y.have < 19; )
                        Y.lens[Ft[Y.have++]] = 0;
                      if (Y.lencode = Y.lendyn, Y.lenbits = 7, Ct = { bits: Y.lenbits }, mt = o(g, Y.lens, 0, 19, Y.lencode, 0, Y.work, Ct), Y.lenbits = Ct.bits, mt) {
                        ae.msg = "invalid code lengths set", Y.mode = re;
                        break;
                      }
                      Y.have = 0, Y.mode = ie;
                    case ie:
                      for (; Y.have < Y.nlen + Y.ndist; ) {
                        for (; nt = Y.lencode[ne & (1 << Y.lenbits) - 1], rt = nt >>> 24, tt = nt >>> 16 & 255, yt = nt & 65535, !(rt <= Ee); ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        if (yt < 16)
                          ne >>>= rt, Ee -= rt, Y.lens[Y.have++] = yt;
                        else {
                          if (yt === 16) {
                            for (Mt = rt + 2; Ee < Mt; ) {
                              if (ve === 0)
                                break e;
                              ve--, ne += Oe[I++] << Ee, Ee += 8;
                            }
                            if (ne >>>= rt, Ee -= rt, Y.have === 0) {
                              ae.msg = "invalid bit length repeat", Y.mode = re;
                              break;
                            }
                            vt = Y.lens[Y.have - 1], je = 3 + (ne & 3), ne >>>= 2, Ee -= 2;
                          } else if (yt === 17) {
                            for (Mt = rt + 3; Ee < Mt; ) {
                              if (ve === 0)
                                break e;
                              ve--, ne += Oe[I++] << Ee, Ee += 8;
                            }
                            ne >>>= rt, Ee -= rt, vt = 0, je = 3 + (ne & 7), ne >>>= 3, Ee -= 3;
                          } else {
                            for (Mt = rt + 7; Ee < Mt; ) {
                              if (ve === 0)
                                break e;
                              ve--, ne += Oe[I++] << Ee, Ee += 8;
                            }
                            ne >>>= rt, Ee -= rt, vt = 0, je = 11 + (ne & 127), ne >>>= 7, Ee -= 7;
                          }
                          if (Y.have + je > Y.nlen + Y.ndist) {
                            ae.msg = "invalid bit length repeat", Y.mode = re;
                            break;
                          }
                          for (; je--; )
                            Y.lens[Y.have++] = vt;
                        }
                      }
                      if (Y.mode === re)
                        break;
                      if (Y.lens[256] === 0) {
                        ae.msg = "invalid code -- missing end-of-block", Y.mode = re;
                        break;
                      }
                      if (Y.lenbits = 9, Ct = { bits: Y.lenbits }, mt = o(E, Y.lens, 0, Y.nlen, Y.lencode, 0, Y.work, Ct), Y.lenbits = Ct.bits, mt) {
                        ae.msg = "invalid literal/lengths set", Y.mode = re;
                        break;
                      }
                      if (Y.distbits = 6, Y.distcode = Y.distdyn, Ct = { bits: Y.distbits }, mt = o(u, Y.lens, Y.nlen, Y.ndist, Y.distcode, 0, Y.work, Ct), Y.distbits = Ct.bits, mt) {
                        ae.msg = "invalid distances set", Y.mode = re;
                        break;
                      }
                      if (Y.mode = ge, De === C)
                        break e;
                    case ge:
                      Y.mode = le;
                    case le:
                      if (ve >= 6 && X >= 258) {
                        ae.next_out = me, ae.avail_out = X, ae.next_in = I, ae.avail_in = ve, Y.hold = ne, Y.bits = Ee, x(ae, Ke), me = ae.next_out, Ve = ae.output, X = ae.avail_out, I = ae.next_in, Oe = ae.input, ve = ae.avail_in, ne = Y.hold, Ee = Y.bits, Y.mode === z && (Y.back = -1);
                        break;
                      }
                      for (Y.back = 0; nt = Y.lencode[ne & (1 << Y.lenbits) - 1], rt = nt >>> 24, tt = nt >>> 16 & 255, yt = nt & 65535, !(rt <= Ee); ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if (tt && !(tt & 240)) {
                        for (_t = rt, It = tt, Ot = yt; nt = Y.lencode[Ot + ((ne & (1 << _t + It) - 1) >> _t)], rt = nt >>> 24, tt = nt >>> 16 & 255, yt = nt & 65535, !(_t + rt <= Ee); ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        ne >>>= _t, Ee -= _t, Y.back += _t;
                      }
                      if (ne >>>= rt, Ee -= rt, Y.back += rt, Y.length = yt, tt === 0) {
                        Y.mode = ye;
                        break;
                      }
                      if (tt & 32) {
                        Y.back = -1, Y.mode = z;
                        break;
                      }
                      if (tt & 64) {
                        ae.msg = "invalid literal/length code", Y.mode = re;
                        break;
                      }
                      Y.extra = tt & 15, Y.mode = oe;
                    case oe:
                      if (Y.extra) {
                        for (Mt = Y.extra; Ee < Mt; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        Y.length += ne & (1 << Y.extra) - 1, ne >>>= Y.extra, Ee -= Y.extra, Y.back += Y.extra;
                      }
                      Y.was = Y.length, Y.mode = he;
                    case he:
                      for (; nt = Y.distcode[ne & (1 << Y.distbits) - 1], rt = nt >>> 24, tt = nt >>> 16 & 255, yt = nt & 65535, !(rt <= Ee); ) {
                        if (ve === 0)
                          break e;
                        ve--, ne += Oe[I++] << Ee, Ee += 8;
                      }
                      if (!(tt & 240)) {
                        for (_t = rt, It = tt, Ot = yt; nt = Y.distcode[Ot + ((ne & (1 << _t + It) - 1) >> _t)], rt = nt >>> 24, tt = nt >>> 16 & 255, yt = nt & 65535, !(_t + rt <= Ee); ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        ne >>>= _t, Ee -= _t, Y.back += _t;
                      }
                      if (ne >>>= rt, Ee -= rt, Y.back += rt, tt & 64) {
                        ae.msg = "invalid distance code", Y.mode = re;
                        break;
                      }
                      Y.offset = yt, Y.extra = tt & 15, Y.mode = se;
                    case se:
                      if (Y.extra) {
                        for (Mt = Y.extra; Ee < Mt; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        Y.offset += ne & (1 << Y.extra) - 1, ne >>>= Y.extra, Ee -= Y.extra, Y.back += Y.extra;
                      }
                      if (Y.offset > Y.dmax) {
                        ae.msg = "invalid distance too far back", Y.mode = re;
                        break;
                      }
                      Y.mode = xe;
                    case xe:
                      if (X === 0)
                        break e;
                      if (je = Ke - X, Y.offset > je) {
                        if (je = Y.offset - je, je > Y.whave && Y.sane) {
                          ae.msg = "invalid distance too far back", Y.mode = re;
                          break;
                        }
                        je > Y.wnext ? (je -= Y.wnext, qe = Y.wsize - je) : qe = Y.wnext - je, je > Y.length && (je = Y.length), wt = Y.window;
                      } else
                        wt = Ve, qe = me - Y.offset, je = Y.length;
                      je > X && (je = X), X -= je, Y.length -= je;
                      do
                        Ve[me++] = wt[qe++];
                      while (--je);
                      Y.length === 0 && (Y.mode = le);
                      break;
                    case ye:
                      if (X === 0)
                        break e;
                      Ve[me++] = Y.length, X--, Y.mode = le;
                      break;
                    case Pe:
                      if (Y.wrap) {
                        for (; Ee < 32; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne |= Oe[I++] << Ee, Ee += 8;
                        }
                        if (Ke -= X, ae.total_out += Ke, Y.total += Ke, Ke && (ae.adler = Y.check = /*UPDATE(state.check, put - _out, _out);*/
                        Y.flags ? _(Y.check, Ve, Ke, me - Ke) : p(Y.check, Ve, Ke, me - Ke)), Ke = X, (Y.flags ? ne : Ie(ne)) !== Y.check) {
                          ae.msg = "incorrect data check", Y.mode = re;
                          break;
                        }
                        ne = 0, Ee = 0;
                      }
                      Y.mode = de;
                    case de:
                      if (Y.wrap && Y.flags) {
                        for (; Ee < 32; ) {
                          if (ve === 0)
                            break e;
                          ve--, ne += Oe[I++] << Ee, Ee += 8;
                        }
                        if (ne !== (Y.total & 4294967295)) {
                          ae.msg = "incorrect length check", Y.mode = re;
                          break;
                        }
                        ne = 0, Ee = 0;
                      }
                      Y.mode = pe;
                    case pe:
                      mt = r;
                      break e;
                    case re:
                      mt = f;
                      break e;
                    case Se:
                      return c;
                    case ke:
                    default:
                      return b;
                  }
              return ae.next_out = me, ae.avail_out = X, ae.next_in = I, ae.avail_in = ve, Y.hold = ne, Y.bits = Ee, (Y.wsize || Ke !== ae.avail_out && Y.mode < re && (Y.mode < Pe || De !== A)) && Ae(ae, ae.output, ae.next_out, Ke - ae.avail_out), He -= ae.avail_in, Ke -= ae.avail_out, ae.total_in += He, ae.total_out += Ke, Y.total += Ke, Y.wrap && Ke && (ae.adler = Y.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
              Y.flags ? _(Y.check, Ve, Ke, ae.next_out - Ke) : p(Y.check, Ve, Ke, ae.next_out - Ke)), ae.data_type = Y.bits + (Y.last ? 64 : 0) + (Y.mode === z ? 128 : 0) + (Y.mode === ge || Y.mode === N ? 256 : 0), (He === 0 && Ke === 0 || De === A) && mt === D && (mt = t), mt;
            }
            function ue(ae) {
              if (!ae || !ae.state)
                return b;
              var De = ae.state;
              return De.window && (De.window = null), ae.state = null, D;
            }
            function we(ae, De) {
              var Y;
              return !ae || !ae.state || (Y = ae.state, !(Y.wrap & 2)) ? b : (Y.head = De, De.done = !1, D);
            }
            function Te(ae, De) {
              var Y = De.length, Oe, Ve, I;
              return !ae || !ae.state || (Oe = ae.state, Oe.wrap !== 0 && Oe.mode !== U) ? b : Oe.mode === U && (Ve = 1, Ve = p(Ve, De, Y, 0), Ve !== Oe.check) ? f : (I = Ae(ae, De, Y, Y), I ? (Oe.mode = Se, c) : (Oe.havedict = 1, D));
            }
            s.inflateReset = Be, s.inflateReset2 = Ne, s.inflateResetKeep = Ue, s.inflateInit = K, s.inflateInit2 = H, s.inflate = Z, s.inflateEnd = ue, s.inflateGetHeader = we, s.inflateSetDictionary = Te, s.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 ***!
            \*********************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), p = 15, _ = 852, x = 592, o = 0, g = 1, E = 2, u = [
              /* 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
            ], A = [
              /* 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
            ], L = [
              /* 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
            ], C = [
              /* 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
            ];
            y.exports = function(r, n, b, f, c, t, a, h) {
              var M = h.bits, w = 0, S = 0, T = 0, R = 0, $ = 0, P = 0, B = 0, F = 0, U = 0, z = 0, W, V, N, k, G, Q = null, ie = 0, ge, le = new l.Buf16(p + 1), oe = new l.Buf16(p + 1), he = null, se = 0, xe, ye, Pe;
              for (w = 0; w <= p; w++)
                le[w] = 0;
              for (S = 0; S < f; S++)
                le[n[b + S]]++;
              for ($ = M, R = p; R >= 1 && le[R] === 0; R--)
                ;
              if ($ > R && ($ = R), R === 0)
                return c[t++] = 20971520, c[t++] = 20971520, h.bits = 1, 0;
              for (T = 1; T < R && le[T] === 0; T++)
                ;
              for ($ < T && ($ = T), F = 1, w = 1; w <= p; w++)
                if (F <<= 1, F -= le[w], F < 0)
                  return -1;
              if (F > 0 && (r === o || R !== 1))
                return -1;
              for (oe[1] = 0, w = 1; w < p; w++)
                oe[w + 1] = oe[w] + le[w];
              for (S = 0; S < f; S++)
                n[b + S] !== 0 && (a[oe[n[b + S]]++] = S);
              if (r === o ? (Q = he = a, ge = 19) : r === g ? (Q = u, ie -= 257, he = A, se -= 257, ge = 256) : (Q = L, he = C, ge = -1), z = 0, S = 0, w = T, G = t, P = $, B = 0, N = -1, U = 1 << $, k = U - 1, r === g && U > _ || r === E && U > x)
                return 1;
              for (; ; ) {
                xe = w - B, a[S] < ge ? (ye = 0, Pe = a[S]) : a[S] > ge ? (ye = he[se + a[S]], Pe = Q[ie + a[S]]) : (ye = 96, Pe = 0), W = 1 << w - B, V = 1 << P, T = V;
                do
                  V -= W, c[G + (z >> B) + V] = xe << 24 | ye << 16 | Pe | 0;
                while (V !== 0);
                for (W = 1 << w - 1; z & W; )
                  W >>= 1;
                if (W !== 0 ? (z &= W - 1, z += W) : z = 0, S++, --le[w] === 0) {
                  if (w === R)
                    break;
                  w = n[b + a[S]];
                }
                if (w > $ && (z & k) !== N) {
                  for (B === 0 && (B = $), G += T, P = w - B, F = 1 << P; P + B < R && (F -= le[P + B], !(F <= 0)); )
                    P++, F <<= 1;
                  if (U += 1 << P, r === g && U > _ || r === E && U > x)
                    return 1;
                  N = z & k, c[N] = $ << 24 | P << 16 | G - t | 0;
                }
              }
              return z !== 0 && (c[G + z] = w - B << 24 | 4194304 | 0), h.bits = $, 0;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js ***!
            \*********************************************************************/
          /***/
          (y) => {
            y.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 ***!
            \******************************************************************/
          /***/
          (y, s, e) => {
            var l = e(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), p = 4, _ = 0, x = 1, o = 2;
            function g(Z) {
              for (var ue = Z.length; --ue >= 0; )
                Z[ue] = 0;
            }
            var E = 0, u = 1, A = 2, L = 3, C = 258, D = 29, r = 256, n = r + 1 + D, b = 30, f = 19, c = 2 * n + 1, t = 15, a = 16, h = 7, M = 256, w = 16, S = 17, T = 18, R = (
              /* 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]
            ), $ = (
              /* 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]
            ), P = (
              /* 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]
            ), B = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], F = 512, U = new Array((n + 2) * 2);
            g(U);
            var z = new Array(b * 2);
            g(z);
            var W = new Array(F);
            g(W);
            var V = new Array(C - L + 1);
            g(V);
            var N = new Array(D);
            g(N);
            var k = new Array(b);
            g(k);
            function G(Z, ue, we, Te, ae) {
              this.static_tree = Z, this.extra_bits = ue, this.extra_base = we, this.elems = Te, this.max_length = ae, this.has_stree = Z && Z.length;
            }
            var Q, ie, ge;
            function le(Z, ue) {
              this.dyn_tree = Z, this.max_code = 0, this.stat_desc = ue;
            }
            function oe(Z) {
              return Z < 256 ? W[Z] : W[256 + (Z >>> 7)];
            }
            function he(Z, ue) {
              Z.pending_buf[Z.pending++] = ue & 255, Z.pending_buf[Z.pending++] = ue >>> 8 & 255;
            }
            function se(Z, ue, we) {
              Z.bi_valid > a - we ? (Z.bi_buf |= ue << Z.bi_valid & 65535, he(Z, Z.bi_buf), Z.bi_buf = ue >> a - Z.bi_valid, Z.bi_valid += we - a) : (Z.bi_buf |= ue << Z.bi_valid & 65535, Z.bi_valid += we);
            }
            function xe(Z, ue, we) {
              se(
                Z,
                we[ue * 2],
                we[ue * 2 + 1]
                /*.Len*/
              );
            }
            function ye(Z, ue) {
              var we = 0;
              do
                we |= Z & 1, Z >>>= 1, we <<= 1;
              while (--ue > 0);
              return we >>> 1;
            }
            function Pe(Z) {
              Z.bi_valid === 16 ? (he(Z, Z.bi_buf), Z.bi_buf = 0, Z.bi_valid = 0) : Z.bi_valid >= 8 && (Z.pending_buf[Z.pending++] = Z.bi_buf & 255, Z.bi_buf >>= 8, Z.bi_valid -= 8);
            }
            function de(Z, ue) {
              var we = ue.dyn_tree, Te = ue.max_code, ae = ue.stat_desc.static_tree, De = ue.stat_desc.has_stree, Y = ue.stat_desc.extra_bits, Oe = ue.stat_desc.extra_base, Ve = ue.stat_desc.max_length, I, me, ve, X, ne, Ee, He = 0;
              for (X = 0; X <= t; X++)
                Z.bl_count[X] = 0;
              for (we[Z.heap[Z.heap_max] * 2 + 1] = 0, I = Z.heap_max + 1; I < c; I++)
                me = Z.heap[I], X = we[we[me * 2 + 1] * 2 + 1] + 1, X > Ve && (X = Ve, He++), we[me * 2 + 1] = X, !(me > Te) && (Z.bl_count[X]++, ne = 0, me >= Oe && (ne = Y[me - Oe]), Ee = we[me * 2], Z.opt_len += Ee * (X + ne), De && (Z.static_len += Ee * (ae[me * 2 + 1] + ne)));
              if (He !== 0) {
                do {
                  for (X = Ve - 1; Z.bl_count[X] === 0; )
                    X--;
                  Z.bl_count[X]--, Z.bl_count[X + 1] += 2, Z.bl_count[Ve]--, He -= 2;
                } while (He > 0);
                for (X = Ve; X !== 0; X--)
                  for (me = Z.bl_count[X]; me !== 0; )
                    ve = Z.heap[--I], !(ve > Te) && (we[ve * 2 + 1] !== X && (Z.opt_len += (X - we[ve * 2 + 1]) * we[ve * 2], we[ve * 2 + 1] = X), me--);
              }
            }
            function pe(Z, ue, we) {
              var Te = new Array(t + 1), ae = 0, De, Y;
              for (De = 1; De <= t; De++)
                Te[De] = ae = ae + we[De - 1] << 1;
              for (Y = 0; Y <= ue; Y++) {
                var Oe = Z[Y * 2 + 1];
                Oe !== 0 && (Z[Y * 2] = ye(Te[Oe]++, Oe));
              }
            }
            function re() {
              var Z, ue, we, Te, ae, De = new Array(t + 1);
              for (we = 0, Te = 0; Te < D - 1; Te++)
                for (N[Te] = we, Z = 0; Z < 1 << R[Te]; Z++)
                  V[we++] = Te;
              for (V[we - 1] = Te, ae = 0, Te = 0; Te < 16; Te++)
                for (k[Te] = ae, Z = 0; Z < 1 << $[Te]; Z++)
                  W[ae++] = Te;
              for (ae >>= 7; Te < b; Te++)
                for (k[Te] = ae << 7, Z = 0; Z < 1 << $[Te] - 7; Z++)
                  W[256 + ae++] = Te;
              for (ue = 0; ue <= t; ue++)
                De[ue] = 0;
              for (Z = 0; Z <= 143; )
                U[Z * 2 + 1] = 8, Z++, De[8]++;
              for (; Z <= 255; )
                U[Z * 2 + 1] = 9, Z++, De[9]++;
              for (; Z <= 279; )
                U[Z * 2 + 1] = 7, Z++, De[7]++;
              for (; Z <= 287; )
                U[Z * 2 + 1] = 8, Z++, De[8]++;
              for (pe(U, n + 1, De), Z = 0; Z < b; Z++)
                z[Z * 2 + 1] = 5, z[Z * 2] = ye(Z, 5);
              Q = new G(U, R, r + 1, n, t), ie = new G(z, $, 0, b, t), ge = new G(new Array(0), P, 0, f, h);
            }
            function Se(Z) {
              var ue;
              for (ue = 0; ue < n; ue++)
                Z.dyn_ltree[ue * 2] = 0;
              for (ue = 0; ue < b; ue++)
                Z.dyn_dtree[ue * 2] = 0;
              for (ue = 0; ue < f; ue++)
                Z.bl_tree[ue * 2] = 0;
              Z.dyn_ltree[M * 2] = 1, Z.opt_len = Z.static_len = 0, Z.last_lit = Z.matches = 0;
            }
            function ke(Z) {
              Z.bi_valid > 8 ? he(Z, Z.bi_buf) : Z.bi_valid > 0 && (Z.pending_buf[Z.pending++] = Z.bi_buf), Z.bi_buf = 0, Z.bi_valid = 0;
            }
            function $e(Z, ue, we, Te) {
              ke(Z), Te && (he(Z, we), he(Z, ~we)), l.arraySet(Z.pending_buf, Z.window, ue, we, Z.pending), Z.pending += we;
            }
            function ze(Z, ue, we, Te) {
              var ae = ue * 2, De = we * 2;
              return Z[ae] < Z[De] || Z[ae] === Z[De] && Te[ue] <= Te[we];
            }
            function Re(Z, ue, we) {
              for (var Te = Z.heap[we], ae = we << 1; ae <= Z.heap_len && (ae < Z.heap_len && ze(ue, Z.heap[ae + 1], Z.heap[ae], Z.depth) && ae++, !ze(ue, Te, Z.heap[ae], Z.depth)); )
                Z.heap[we] = Z.heap[ae], we = ae, ae <<= 1;
              Z.heap[we] = Te;
            }
            function Fe(Z, ue, we) {
              var Te, ae, De = 0, Y, Oe;
              if (Z.last_lit !== 0)
                do
                  Te = Z.pending_buf[Z.d_buf + De * 2] << 8 | Z.pending_buf[Z.d_buf + De * 2 + 1], ae = Z.pending_buf[Z.l_buf + De], De++, Te === 0 ? xe(Z, ae, ue) : (Y = V[ae], xe(Z, Y + r + 1, ue), Oe = R[Y], Oe !== 0 && (ae -= N[Y], se(Z, ae, Oe)), Te--, Y = oe(Te), xe(Z, Y, we), Oe = $[Y], Oe !== 0 && (Te -= k[Y], se(Z, Te, Oe)));
                while (De < Z.last_lit);
              xe(Z, M, ue);
            }
            function Ie(Z, ue) {
              var we = ue.dyn_tree, Te = ue.stat_desc.static_tree, ae = ue.stat_desc.has_stree, De = ue.stat_desc.elems, Y, Oe, Ve = -1, I;
              for (Z.heap_len = 0, Z.heap_max = c, Y = 0; Y < De; Y++)
                we[Y * 2] !== 0 ? (Z.heap[++Z.heap_len] = Ve = Y, Z.depth[Y] = 0) : we[Y * 2 + 1] = 0;
              for (; Z.heap_len < 2; )
                I = Z.heap[++Z.heap_len] = Ve < 2 ? ++Ve : 0, we[I * 2] = 1, Z.depth[I] = 0, Z.opt_len--, ae && (Z.static_len -= Te[I * 2 + 1]);
              for (ue.max_code = Ve, Y = Z.heap_len >> 1; Y >= 1; Y--)
                Re(Z, we, Y);
              I = De;
              do
                Y = Z.heap[
                  1
                  /*SMALLEST*/
                ], Z.heap[
                  1
                  /*SMALLEST*/
                ] = Z.heap[Z.heap_len--], Re(
                  Z,
                  we,
                  1
                  /*SMALLEST*/
                ), Oe = Z.heap[
                  1
                  /*SMALLEST*/
                ], Z.heap[--Z.heap_max] = Y, Z.heap[--Z.heap_max] = Oe, we[I * 2] = we[Y * 2] + we[Oe * 2], Z.depth[I] = (Z.depth[Y] >= Z.depth[Oe] ? Z.depth[Y] : Z.depth[Oe]) + 1, we[Y * 2 + 1] = we[Oe * 2 + 1] = I, Z.heap[
                  1
                  /*SMALLEST*/
                ] = I++, Re(
                  Z,
                  we,
                  1
                  /*SMALLEST*/
                );
              while (Z.heap_len >= 2);
              Z.heap[--Z.heap_max] = Z.heap[
                1
                /*SMALLEST*/
              ], de(Z, ue), pe(we, Ve, Z.bl_count);
            }
            function We(Z, ue, we) {
              var Te, ae = -1, De, Y = ue[0 * 2 + 1], Oe = 0, Ve = 7, I = 4;
              for (Y === 0 && (Ve = 138, I = 3), ue[(we + 1) * 2 + 1] = 65535, Te = 0; Te <= we; Te++)
                De = Y, Y = ue[(Te + 1) * 2 + 1], !(++Oe < Ve && De === Y) && (Oe < I ? Z.bl_tree[De * 2] += Oe : De !== 0 ? (De !== ae && Z.bl_tree[De * 2]++, Z.bl_tree[w * 2]++) : Oe <= 10 ? Z.bl_tree[S * 2]++ : Z.bl_tree[T * 2]++, Oe = 0, ae = De, Y === 0 ? (Ve = 138, I = 3) : De === Y ? (Ve = 6, I = 3) : (Ve = 7, I = 4));
            }
            function Ue(Z, ue, we) {
              var Te, ae = -1, De, Y = ue[0 * 2 + 1], Oe = 0, Ve = 7, I = 4;
              for (Y === 0 && (Ve = 138, I = 3), Te = 0; Te <= we; Te++)
                if (De = Y, Y = ue[(Te + 1) * 2 + 1], !(++Oe < Ve && De === Y)) {
                  if (Oe < I)
                    do
                      xe(Z, De, Z.bl_tree);
                    while (--Oe !== 0);
                  else
                    De !== 0 ? (De !== ae && (xe(Z, De, Z.bl_tree), Oe--), xe(Z, w, Z.bl_tree), se(Z, Oe - 3, 2)) : Oe <= 10 ? (xe(Z, S, Z.bl_tree), se(Z, Oe - 3, 3)) : (xe(Z, T, Z.bl_tree), se(Z, Oe - 11, 7));
                  Oe = 0, ae = De, Y === 0 ? (Ve = 138, I = 3) : De === Y ? (Ve = 6, I = 3) : (Ve = 7, I = 4);
                }
            }
            function Be(Z) {
              var ue;
              for (We(Z, Z.dyn_ltree, Z.l_desc.max_code), We(Z, Z.dyn_dtree, Z.d_desc.max_code), Ie(Z, Z.bl_desc), ue = f - 1; ue >= 3 && Z.bl_tree[B[ue] * 2 + 1] === 0; ue--)
                ;
              return Z.opt_len += 3 * (ue + 1) + 5 + 5 + 4, ue;
            }
            function Ne(Z, ue, we, Te) {
              var ae;
              for (se(Z, ue - 257, 5), se(Z, we - 1, 5), se(Z, Te - 4, 4), ae = 0; ae < Te; ae++)
                se(Z, Z.bl_tree[B[ae] * 2 + 1], 3);
              Ue(Z, Z.dyn_ltree, ue - 1), Ue(Z, Z.dyn_dtree, we - 1);
            }
            function H(Z) {
              var ue = 4093624447, we;
              for (we = 0; we <= 31; we++, ue >>>= 1)
                if (ue & 1 && Z.dyn_ltree[we * 2] !== 0)
                  return _;
              if (Z.dyn_ltree[18] !== 0 || Z.dyn_ltree[20] !== 0 || Z.dyn_ltree[26] !== 0)
                return x;
              for (we = 32; we < r; we++)
                if (Z.dyn_ltree[we * 2] !== 0)
                  return x;
              return _;
            }
            var K = !1;
            function q(Z) {
              K || (re(), K = !0), Z.l_desc = new le(Z.dyn_ltree, Q), Z.d_desc = new le(Z.dyn_dtree, ie), Z.bl_desc = new le(Z.bl_tree, ge), Z.bi_buf = 0, Z.bi_valid = 0, Se(Z);
            }
            function fe(Z, ue, we, Te) {
              se(Z, (E << 1) + (Te ? 1 : 0), 3), $e(Z, ue, we, !0);
            }
            function _e(Z) {
              se(Z, u << 1, 3), xe(Z, M, U), Pe(Z);
            }
            function Me(Z, ue, we, Te) {
              var ae, De, Y = 0;
              Z.level > 0 ? (Z.strm.data_type === o && (Z.strm.data_type = H(Z)), Ie(Z, Z.l_desc), Ie(Z, Z.d_desc), Y = Be(Z), ae = Z.opt_len + 3 + 7 >>> 3, De = Z.static_len + 3 + 7 >>> 3, De <= ae && (ae = De)) : ae = De = we + 5, we + 4 <= ae && ue !== -1 ? fe(Z, ue, we, Te) : Z.strategy === p || De === ae ? (se(Z, (u << 1) + (Te ? 1 : 0), 3), Fe(Z, U, z)) : (se(Z, (A << 1) + (Te ? 1 : 0), 3), Ne(Z, Z.l_desc.max_code + 1, Z.d_desc.max_code + 1, Y + 1), Fe(Z, Z.dyn_ltree, Z.dyn_dtree)), Se(Z), Te && ke(Z);
            }
            function Ae(Z, ue, we) {
              return Z.pending_buf[Z.d_buf + Z.last_lit * 2] = ue >>> 8 & 255, Z.pending_buf[Z.d_buf + Z.last_lit * 2 + 1] = ue & 255, Z.pending_buf[Z.l_buf + Z.last_lit] = we & 255, Z.last_lit++, ue === 0 ? Z.dyn_ltree[we * 2]++ : (Z.matches++, ue--, Z.dyn_ltree[(V[we] + r + 1) * 2]++, Z.dyn_dtree[oe(ue) * 2]++), Z.last_lit === Z.lit_bufsize - 1;
            }
            s._tr_init = q, s._tr_stored_block = fe, s._tr_flush_block = Me, s._tr_tally = Ae, s._tr_align = _e;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js ***!
            \********************************************************************/
          /***/
          (y) => {
            function s() {
              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;
            }
            y.exports = s;
          }
        ),
        /***/
        "./src/SurfaceWorker.js": (
          /*!******************************!*\
            !*** ./src/SurfaceWorker.js ***!
            \******************************/
          /***/
          () => {
            $3Dmol.workerString = (function() {
              self.onmessage = function(y) {
                var s = y.data, e = s.type;
                if (e < 0)
                  self.atomData = s.atoms, self.volume = s.volume, self.ps = new ProteinSurface();
                else {
                  var l = self.ps;
                  l.initparm(s.expandedExtent, e != 1, self.volume), l.fillvoxels(self.atomData, s.extendedAtoms), l.buildboundary(), (e === 4 || e === 2) && (l.fastdistancemap(), l.boundingatom(!1), l.fillvoxelswaals(self.atomData, s.extendedAtoms)), l.marchingcube(e);
                  var p = l.getFacesAndVertices(s.atomsToShow);
                  self.postMessage(p);
                }
              };
            }).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 ***!
            \*************************/
          /***/
          (y) => {
            typeof y.exports == "object" && (y.exports = window.$3Dmol);
          }
        ),
        /***/
        "./src/vendor/mmtf.js": (
          /*!****************************!*\
            !*** ./src/vendor/mmtf.js ***!
            \****************************/
          /***/
          function(y, s) {
            (function(e, l) {
              l(s);
            })(this, function(e) {
              function l(H, K, q) {
                for (var fe = (H.byteLength, 0), _e = q.length; _e > fe; fe++) {
                  var Me = q.charCodeAt(fe);
                  if (128 > Me)
                    H.setUint8(K++, Me >>> 0 & 127 | 0);
                  else if (2048 > Me)
                    H.setUint8(K++, Me >>> 6 & 31 | 192), H.setUint8(K++, Me >>> 0 & 63 | 128);
                  else if (65536 > Me)
                    H.setUint8(K++, Me >>> 12 & 15 | 224), H.setUint8(K++, Me >>> 6 & 63 | 128), H.setUint8(K++, Me >>> 0 & 63 | 128);
                  else {
                    if (!(1114112 > Me))
                      throw new Error("bad codepoint " + Me);
                    H.setUint8(K++, Me >>> 18 & 7 | 240), H.setUint8(K++, Me >>> 12 & 63 | 128), H.setUint8(K++, Me >>> 6 & 63 | 128), H.setUint8(K++, Me >>> 0 & 63 | 128);
                  }
                }
              }
              function p(H) {
                for (var K = 0, q = 0, fe = H.length; fe > q; q++) {
                  var _e = H.charCodeAt(q);
                  if (128 > _e)
                    K += 1;
                  else if (2048 > _e)
                    K += 2;
                  else if (65536 > _e)
                    K += 3;
                  else {
                    if (!(1114112 > _e))
                      throw new Error("bad codepoint " + _e);
                    K += 4;
                  }
                }
                return K;
              }
              function _(H, K, q) {
                var fe = typeof H;
                if (fe === "string") {
                  var _e = p(H);
                  if (32 > _e)
                    return K.setUint8(q, 160 | _e), l(K, q + 1, H), 1 + _e;
                  if (256 > _e)
                    return K.setUint8(q, 217), K.setUint8(q + 1, _e), l(K, q + 2, H), 2 + _e;
                  if (65536 > _e)
                    return K.setUint8(q, 218), K.setUint16(q + 1, _e), l(K, q + 3, H), 3 + _e;
                  if (4294967296 > _e)
                    return K.setUint8(q, 219), K.setUint32(q + 1, _e), l(K, q + 5, H), 5 + _e;
                }
                if (H instanceof Uint8Array) {
                  var _e = H.byteLength, Me = new Uint8Array(K.buffer);
                  if (256 > _e)
                    return K.setUint8(q, 196), K.setUint8(q + 1, _e), Me.set(H, q + 2), 2 + _e;
                  if (65536 > _e)
                    return K.setUint8(q, 197), K.setUint16(q + 1, _e), Me.set(H, q + 3), 3 + _e;
                  if (4294967296 > _e)
                    return K.setUint8(q, 198), K.setUint32(q + 1, _e), Me.set(H, q + 5), 5 + _e;
                }
                if (fe === "number") {
                  if (!isFinite(H))
                    throw new Error("Number not finite: " + H);
                  if (Math.floor(H) !== H)
                    return K.setUint8(q, 203), K.setFloat64(q + 1, H), 9;
                  if (H >= 0) {
                    if (128 > H)
                      return K.setUint8(q, H), 1;
                    if (256 > H)
                      return K.setUint8(q, 204), K.setUint8(q + 1, H), 2;
                    if (65536 > H)
                      return K.setUint8(q, 205), K.setUint16(q + 1, H), 3;
                    if (4294967296 > H)
                      return K.setUint8(q, 206), K.setUint32(q + 1, H), 5;
                    throw new Error("Number too big 0x" + H.toString(16));
                  }
                  if (H >= -32)
                    return K.setInt8(q, H), 1;
                  if (H >= -128)
                    return K.setUint8(q, 208), K.setInt8(q + 1, H), 2;
                  if (H >= -32768)
                    return K.setUint8(q, 209), K.setInt16(q + 1, H), 3;
                  if (H >= -2147483648)
                    return K.setUint8(q, 210), K.setInt32(q + 1, H), 5;
                  throw new Error("Number too small -0x" + (-H).toString(16).substr(1));
                }
                if (H === null)
                  return K.setUint8(q, 192), 1;
                if (fe === "boolean")
                  return K.setUint8(q, H ? 195 : 194), 1;
                if (fe === "object") {
                  var _e, ue = 0, Ae = Array.isArray(H);
                  if (Ae)
                    _e = H.length;
                  else {
                    var Z = Object.keys(H);
                    _e = Z.length;
                  }
                  var ue;
                  if (16 > _e ? (K.setUint8(q, _e | (Ae ? 144 : 128)), ue = 1) : 65536 > _e ? (K.setUint8(q, Ae ? 220 : 222), K.setUint16(q + 1, _e), ue = 3) : 4294967296 > _e && (K.setUint8(q, Ae ? 221 : 223), K.setUint32(q + 1, _e), ue = 5), Ae)
                    for (var we = 0; _e > we; we++)
                      ue += _(H[we], K, q + ue);
                  else
                    for (var we = 0; _e > we; we++) {
                      var Te = Z[we];
                      ue += _(Te, K, q + ue), ue += _(H[Te], K, q + ue);
                    }
                  return ue;
                }
                throw new Error("Unknown type " + fe);
              }
              function x(H) {
                var K = typeof H;
                if (K === "string") {
                  var q = p(H);
                  if (32 > q)
                    return 1 + q;
                  if (256 > q)
                    return 2 + q;
                  if (65536 > q)
                    return 3 + q;
                  if (4294967296 > q)
                    return 5 + q;
                }
                if (H instanceof Uint8Array) {
                  var q = H.byteLength;
                  if (256 > q)
                    return 2 + q;
                  if (65536 > q)
                    return 3 + q;
                  if (4294967296 > q)
                    return 5 + q;
                }
                if (K === "number") {
                  if (Math.floor(H) !== H)
                    return 9;
                  if (H >= 0) {
                    if (128 > H)
                      return 1;
                    if (256 > H)
                      return 2;
                    if (65536 > H)
                      return 3;
                    if (4294967296 > H)
                      return 5;
                    throw new Error("Number too big 0x" + H.toString(16));
                  }
                  if (H >= -32)
                    return 1;
                  if (H >= -128)
                    return 2;
                  if (H >= -32768)
                    return 3;
                  if (H >= -2147483648)
                    return 5;
                  throw new Error("Number too small -0x" + H.toString(16).substr(1));
                }
                if (K === "boolean" || H === null)
                  return 1;
                if (K === "object") {
                  var q, fe = 0;
                  if (Array.isArray(H)) {
                    q = H.length;
                    for (var _e = 0; q > _e; _e++)
                      fe += x(H[_e]);
                  } else {
                    var Me = Object.keys(H);
                    q = Me.length;
                    for (var _e = 0; q > _e; _e++) {
                      var Ae = Me[_e];
                      fe += x(Ae) + x(H[Ae]);
                    }
                  }
                  if (16 > q)
                    return 1 + fe;
                  if (65536 > q)
                    return 3 + fe;
                  if (4294967296 > q)
                    return 5 + fe;
                  throw new Error("Array or object too long 0x" + q.toString(16));
                }
                throw new Error("Unknown type " + K);
              }
              function o(H) {
                var K = new ArrayBuffer(x(H)), q = new DataView(K);
                return _(H, q, 0), new Uint8Array(K);
              }
              function g(H, K, q) {
                return K ? new H(K.buffer, K.byteOffset, K.byteLength / (q || 1)) : void 0;
              }
              function E(H) {
                return g(DataView, H);
              }
              function u(H) {
                return g(Uint8Array, H);
              }
              function A(H) {
                return g(Int8Array, H);
              }
              function L(H) {
                return g(Int32Array, H, 4);
              }
              function C(H) {
                return g(Float32Array, H, 4);
              }
              function D(H, K) {
                var q = H.length / 2;
                K || (K = new Int16Array(q));
                for (var fe = 0, _e = 0; q > fe; ++fe, _e += 2)
                  K[fe] = H[_e] << 8 ^ H[_e + 1] << 0;
                return K;
              }
              function r(H, K) {
                var q = H.length;
                K || (K = new Uint8Array(2 * q));
                for (var fe = E(K), _e = 0; q > _e; ++_e)
                  fe.setInt16(2 * _e, H[_e]);
                return u(K);
              }
              function n(H, K) {
                var q = H.length / 4;
                K || (K = new Int32Array(q));
                for (var fe = 0, _e = 0; q > fe; ++fe, _e += 4)
                  K[fe] = H[_e] << 24 ^ H[_e + 1] << 16 ^ H[_e + 2] << 8 ^ H[_e + 3] << 0;
                return K;
              }
              function b(H, K) {
                var q = H.length;
                K || (K = new Uint8Array(4 * q));
                for (var fe = E(K), _e = 0; q > _e; ++_e)
                  fe.setInt32(4 * _e, H[_e]);
                return u(K);
              }
              function f(H, K) {
                var q = H.length;
                K || (K = new Float32Array(q / 4));
                for (var fe = E(K), _e = E(H), Me = 0, Ae = 0, Z = q / 4; Z > Me; ++Me, Ae += 4)
                  fe.setFloat32(Ae, _e.getFloat32(Ae), !0);
                return K;
              }
              function c(H, K, q) {
                var fe = H.length, _e = 1 / K;
                q || (q = new Float32Array(fe));
                for (var Me = 0; fe > Me; ++Me)
                  q[Me] = H[Me] * _e;
                return q;
              }
              function t(H, K, q) {
                var fe = H.length;
                q || (q = new Int32Array(fe));
                for (var _e = 0; fe > _e; ++_e)
                  q[_e] = Math.round(H[_e] * K);
                return q;
              }
              function a(H, K) {
                var q, fe;
                if (!K) {
                  var _e = 0;
                  for (q = 0, fe = H.length; fe > q; q += 2)
                    _e += H[q + 1];
                  K = new H.constructor(_e);
                }
                var Me = 0;
                for (q = 0, fe = H.length; fe > q; q += 2)
                  for (var Ae = H[q], Z = H[q + 1], ue = 0; Z > ue; ++ue)
                    K[Me] = Ae, ++Me;
                return K;
              }
              function h(H) {
                if (H.length === 0)
                  return new Int32Array();
                var K, q, fe = 2;
                for (K = 1, q = H.length; q > K; ++K)
                  H[K - 1] !== H[K] && (fe += 2);
                var _e = new Int32Array(fe), Me = 0, Ae = 1;
                for (K = 1, q = H.length; q > K; ++K)
                  H[K - 1] !== H[K] ? (_e[Me] = H[K - 1], _e[Me + 1] = Ae, Ae = 1, Me += 2) : ++Ae;
                return _e[Me] = H[H.length - 1], _e[Me + 1] = Ae, _e;
              }
              function M(H, K) {
                var q = H.length;
                K || (K = new H.constructor(q)), q && (K[0] = H[0]);
                for (var fe = 1; q > fe; ++fe)
                  K[fe] = H[fe] + K[fe - 1];
                return K;
              }
              function w(H, K) {
                var q = H.length;
                K || (K = new H.constructor(q)), K[0] = H[0];
                for (var fe = 1; q > fe; ++fe)
                  K[fe] = H[fe] - H[fe - 1];
                return K;
              }
              function S(H, K) {
                var q, fe, _e = H instanceof Int8Array ? 127 : 32767, Me = -_e - 1, Ae = H.length;
                if (!K) {
                  var Z = 0;
                  for (q = 0; Ae > q; ++q)
                    H[q] < _e && H[q] > Me && ++Z;
                  K = new Int32Array(Z);
                }
                for (q = 0, fe = 0; Ae > q; ) {
                  for (var ue = 0; H[q] === _e || H[q] === Me; )
                    ue += H[q], ++q;
                  ue += H[q], ++q, K[fe] = ue, ++fe;
                }
                return K;
              }
              function T(H, K) {
                var q, fe = K ? 127 : 32767, _e = -fe - 1, Me = H.length, Ae = 0;
                for (q = 0; Me > q; ++q) {
                  var Z = H[q];
                  Z === 0 ? ++Ae : Z > 0 ? (Ae += Math.ceil(Z / fe), Z % fe === 0 && (Ae += 1)) : (Ae += Math.ceil(Z / _e), Z % _e === 0 && (Ae += 1));
                }
                var ue = K ? new Int8Array(Ae) : new Int16Array(Ae), we = 0;
                for (q = 0; Me > q; ++q) {
                  var Z = H[q];
                  if (Z >= 0)
                    for (; Z >= fe; )
                      ue[we] = fe, ++we, Z -= fe;
                  else
                    for (; _e >= Z; )
                      ue[we] = _e, ++we, Z -= _e;
                  ue[we] = Z, ++we;
                }
                return ue;
              }
              function R(H, K) {
                return M(a(H), K);
              }
              function $(H) {
                return h(w(H));
              }
              function P(H, K, q) {
                return c(a(H, L(q)), K, q);
              }
              function B(H, K) {
                return h(t(H, K));
              }
              function F(H, K, q) {
                return c(M(H, L(q)), K, q);
              }
              function U(H, K, q) {
                return w(t(H, K), q);
              }
              function z(H, K, q) {
                return c(S(H, L(q)), K, q);
              }
              function W(H, K, q) {
                var fe = S(H, L(q));
                return F(fe, K, C(fe));
              }
              function V(H, K, q) {
                return T(U(H, K), q);
              }
              function N(Me) {
                var K = E(Me), q = K.getInt32(0), fe = K.getInt32(4), _e = Me.subarray(8, 12), Me = Me.subarray(12);
                return [q, Me, fe, _e];
              }
              function k(H, K, q, fe) {
                var _e = new ArrayBuffer(12 + fe.byteLength), Me = new Uint8Array(_e), Ae = new DataView(_e);
                return Ae.setInt32(0, H), Ae.setInt32(4, K), q && Me.set(q, 8), Me.set(fe, 12), Me;
              }
              function G(H) {
                var K = H.length, q = u(H);
                return k(2, K, void 0, q);
              }
              function Q(H) {
                var K = H.length, q = b(H);
                return k(4, K, void 0, q);
              }
              function ie(H, K) {
                var q = H.length / K, fe = b([K]), _e = u(H);
                return k(5, q, fe, _e);
              }
              function ge(H) {
                var K = H.length, q = b(h(H));
                return k(6, K, void 0, q);
              }
              function le(H) {
                var K = H.length, q = b($(H));
                return k(8, K, void 0, q);
              }
              function oe(H, K) {
                var q = H.length, fe = b([K]), _e = b(B(H, K));
                return k(9, q, fe, _e);
              }
              function he(H, K) {
                var q = H.length, fe = b([K]), _e = r(V(H, K));
                return k(10, q, fe, _e);
              }
              function se(H) {
                var K = {};
                return Re.forEach(function(q) {
                  H[q] !== void 0 && (K[q] = H[q]);
                }), H.bondAtomList && (K.bondAtomList = Q(H.bondAtomList)), H.bondOrderList && (K.bondOrderList = G(H.bondOrderList)), K.xCoordList = he(H.xCoordList, 1e3), K.yCoordList = he(H.yCoordList, 1e3), K.zCoordList = he(H.zCoordList, 1e3), H.bFactorList && (K.bFactorList = he(H.bFactorList, 100)), H.atomIdList && (K.atomIdList = le(H.atomIdList)), H.altLocList && (K.altLocList = ge(H.altLocList)), H.occupancyList && (K.occupancyList = oe(H.occupancyList, 100)), K.groupIdList = le(H.groupIdList), K.groupTypeList = Q(H.groupTypeList), H.secStructList && (K.secStructList = G(H.secStructList)), H.insCodeList && (K.insCodeList = ge(H.insCodeList)), H.sequenceIndexList && (K.sequenceIndexList = le(H.sequenceIndexList)), K.chainIdList = ie(H.chainIdList, 4), H.chainNameList && (K.chainNameList = ie(H.chainNameList, 4)), K;
              }
              function xe(H) {
                function K(ue) {
                  for (var we = {}, Te = 0; ue > Te; Te++) {
                    var ae = Me();
                    we[ae] = Me();
                  }
                  return we;
                }
                function q(ue) {
                  var we = H.subarray(Ae, Ae + ue);
                  return Ae += ue, we;
                }
                function fe(ue) {
                  var we = H.subarray(Ae, Ae + ue);
                  Ae += ue;
                  var Te = 65535;
                  if (ue > Te) {
                    for (var ae = [], De = 0; De < we.length; De += Te)
                      ae.push(String.fromCharCode.apply(null, we.subarray(De, De + Te)));
                    return ae.join("");
                  }
                  return String.fromCharCode.apply(null, we);
                }
                function _e(ue) {
                  for (var we = new Array(ue), Te = 0; ue > Te; Te++)
                    we[Te] = Me();
                  return we;
                }
                function Me() {
                  var ue, we, Te = H[Ae];
                  if (!(128 & Te))
                    return Ae++, Te;
                  if ((240 & Te) === 128)
                    return we = 15 & Te, Ae++, K(we);
                  if ((240 & Te) === 144)
                    return we = 15 & Te, Ae++, _e(we);
                  if ((224 & Te) === 160)
                    return we = 31 & Te, Ae++, fe(we);
                  if ((224 & Te) === 224)
                    return ue = Z.getInt8(Ae), Ae++, ue;
                  switch (Te) {
                    case 192:
                      return Ae++, null;
                    case 194:
                      return Ae++, !1;
                    case 195:
                      return Ae++, !0;
                    case 196:
                      return we = Z.getUint8(Ae + 1), Ae += 2, q(we);
                    case 197:
                      return we = Z.getUint16(Ae + 1), Ae += 3, q(we);
                    case 198:
                      return we = Z.getUint32(Ae + 1), Ae += 5, q(we);
                    case 202:
                      return ue = Z.getFloat32(Ae + 1), Ae += 5, ue;
                    case 203:
                      return ue = Z.getFloat64(Ae + 1), Ae += 9, ue;
                    case 204:
                      return ue = H[Ae + 1], Ae += 2, ue;
                    case 205:
                      return ue = Z.getUint16(Ae + 1), Ae += 3, ue;
                    case 206:
                      return ue = Z.getUint32(Ae + 1), Ae += 5, ue;
                    case 208:
                      return ue = Z.getInt8(Ae + 1), Ae += 2, ue;
                    case 209:
                      return ue = Z.getInt16(Ae + 1), Ae += 3, ue;
                    case 210:
                      return ue = Z.getInt32(Ae + 1), Ae += 5, ue;
                    case 217:
                      return we = Z.getUint8(Ae + 1), Ae += 2, fe(we);
                    case 218:
                      return we = Z.getUint16(Ae + 1), Ae += 3, fe(we);
                    case 219:
                      return we = Z.getUint32(Ae + 1), Ae += 5, fe(we);
                    case 220:
                      return we = Z.getUint16(Ae + 1), Ae += 3, _e(we);
                    case 221:
                      return we = Z.getUint32(Ae + 1), Ae += 5, _e(we);
                    case 222:
                      return we = Z.getUint16(Ae + 1), Ae += 3, K(we);
                    case 223:
                      return we = Z.getUint32(Ae + 1), Ae += 5, K(we);
                  }
                  throw new Error("Unknown type 0x" + Te.toString(16));
                }
                var Ae = 0, Z = new DataView(H.buffer);
                return Me();
              }
              function ye(H, K, q, fe) {
                switch (H) {
                  case 1:
                    return f(K);
                  case 2:
                    return A(K);
                  case 3:
                    return D(K);
                  case 4:
                    return n(K);
                  case 5:
                    return u(K);
                  case 6:
                    return a(n(K), new Uint8Array(q));
                  case 7:
                    return a(n(K));
                  case 8:
                    return R(n(K));
                  case 9:
                    return P(n(K), n(fe)[0]);
                  case 10:
                    return W(D(K), n(fe)[0]);
                  case 11:
                    return c(D(K), n(fe)[0]);
                  case 12:
                    return z(D(K), n(fe)[0]);
                  case 13:
                    return z(A(K), n(fe)[0]);
                  case 14:
                    return S(D(K));
                  case 15:
                    return S(A(K));
                }
              }
              function Pe(H, K) {
                K = K || {};
                var q = K.ignoreFields, fe = {};
                return Ie.forEach(function(_e) {
                  var Me = q ? q.indexOf(_e) !== -1 : !1, Ae = H[_e];
                  Me || Ae === void 0 || (Ae instanceof Uint8Array ? fe[_e] = ye.apply(null, N(Ae)) : fe[_e] = Ae);
                }), fe;
              }
              function de(H) {
                return String.fromCharCode.apply(null, H).replace(/\0/g, "");
              }
              function pe(H, K, q) {
                q = q || {};
                var fe, _e, Me, Ae, Z, ue, we = q.firstModelOnly, Te = K.onModel, ae = K.onChain, De = K.onGroup, Y = K.onAtom, Oe = K.onBond, Ve = 0, I = 0, me = 0, ve = 0, X = 0, ne = -1, Ee = H.chainNameList, He = H.secStructList, Ke = H.insCodeList, je = H.sequenceIndexList, qe = H.atomIdList, wt = H.bFactorList, nt = H.altLocList, rt = H.occupancyList, tt = H.bondAtomList, yt = H.bondOrderList;
                for (fe = 0, _e = H.chainsPerModel.length; _e > fe && !(we && Ve > 0); ++fe) {
                  var _t = H.chainsPerModel[Ve];
                  for (Te && Te({ chainCount: _t, modelIndex: Ve }), Me = 0; _t > Me; ++Me) {
                    var It = H.groupsPerChain[I];
                    if (ae) {
                      var Ot = de(H.chainIdList.subarray(4 * I, 4 * I + 4)), vt = null;
                      Ee && (vt = de(Ee.subarray(4 * I, 4 * I + 4))), ae({ groupCount: It, chainIndex: I, modelIndex: Ve, chainId: Ot, chainName: vt });
                    }
                    for (Ae = 0; It > Ae; ++Ae) {
                      var mt = H.groupList[H.groupTypeList[me]], pt = mt.atomNameList.length;
                      if (De) {
                        var Ct = null;
                        He && (Ct = He[me]);
                        var Mt = null;
                        H.insCodeList && (Mt = String.fromCharCode(Ke[me]));
                        var Ft = null;
                        je && (Ft = je[me]), De({ atomCount: pt, groupIndex: me, chainIndex: I, modelIndex: Ve, groupId: H.groupIdList[me], groupType: H.groupTypeList[me], groupName: mt.groupName, singleLetterCode: mt.singleLetterCode, chemCompType: mt.chemCompType, secStruct: Ct, insCode: Mt, sequenceIndex: Ft });
                      }
                      for (Z = 0; pt > Z; ++Z) {
                        if (Y) {
                          var hi = null;
                          qe && (hi = qe[ve]);
                          var Ut = null;
                          wt && (Ut = wt[ve]);
                          var di = null;
                          nt && (di = String.fromCharCode(nt[ve]));
                          var ci = null;
                          rt && (ci = rt[ve]), Y({ atomIndex: ve, groupIndex: me, chainIndex: I, modelIndex: Ve, atomId: hi, element: mt.elementList[Z], atomName: mt.atomNameList[Z], formalCharge: mt.formalChargeList[Z], xCoord: H.xCoordList[ve], yCoord: H.yCoordList[ve], zCoord: H.zCoordList[ve], bFactor: Ut, altLoc: di, occupancy: ci });
                        }
                        ve += 1;
                      }
                      if (Oe) {
                        var ui = mt.bondAtomList;
                        for (Z = 0, ue = mt.bondOrderList.length; ue > Z; ++Z)
                          Oe({ atomIndex1: ve - pt + ui[2 * Z], atomIndex2: ve - pt + ui[2 * Z + 1], bondOrder: mt.bondOrderList[Z] });
                      }
                      me += 1;
                    }
                    I += 1;
                  }
                  if (X = ne + 1, ne = ve - 1, Oe && tt)
                    for (Z = 0, ue = tt.length; ue > Z; Z += 2) {
                      var _i = tt[Z], pi = tt[Z + 1];
                      (_i >= X && ne >= _i || pi >= X && ne >= pi) && Oe({ atomIndex1: _i, atomIndex2: pi, bondOrder: yt ? yt[Z / 2] : null });
                    }
                  Ve += 1;
                }
              }
              function re(H) {
                return o(se(H));
              }
              function Se(H, K) {
                H instanceof ArrayBuffer && (H = new Uint8Array(H));
                var q;
                return q = H instanceof Uint8Array ? xe(H) : H, Pe(q, K);
              }
              function ke(H, K, q, fe) {
                function _e() {
                  try {
                    var Ae = Se(Me.response);
                    q(Ae);
                  } catch (Z) {
                    fe(Z);
                  }
                }
                var Me = new XMLHttpRequest();
                Me.addEventListener("load", _e, !0), Me.addEventListener("error", fe, !0), Me.responseType = "arraybuffer", Me.open("GET", K + H.toUpperCase()), Me.send();
              }
              function $e(H, K, q) {
                ke(H, Be, K, q);
              }
              function ze(H, K, q) {
                ke(H, Ne, K, q);
              }
              var Re = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], Fe = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], Ie = Re.concat(Fe), We = "v1.0.1", Ue = "//mmtf.rcsb.org/v1.0/", Be = Ue + "full/", Ne = Ue + "reduced/";
              e.encode = re, e.decode = Se, e.traverse = pe, e.fetch = $e, e.fetchReduced = ze, e.version = We, e.fetchUrl = Be, e.fetchReducedUrl = Ne, e.encodeMsgpack = o, e.encodeMmtf = se, e.decodeMsgpack = xe, e.decodeMmtf = Pe;
            });
          }
        ),
        /***/
        "./node_modules/pako/dist/pako.esm.mjs": (
          /*!*********************************************!*\
            !*** ./node_modules/pako/dist/pako.esm.mjs ***!
            \*********************************************/
          /***/
          (y, s, e) => {
            e.r(s), e.d(s, {
              /* harmony export */
              Deflate: () => (
                /* binding */
                Wr
              ),
              /* harmony export */
              Inflate: () => (
                /* binding */
                jr
              ),
              /* harmony export */
              constants: () => (
                /* binding */
                Yr
              ),
              /* harmony export */
              default: () => (
                /* binding */
                js
              ),
              /* harmony export */
              deflate: () => (
                /* binding */
                Gr
              ),
              /* harmony export */
              deflateRaw: () => (
                /* binding */
                Nr
              ),
              /* harmony export */
              gzip: () => (
                /* binding */
                Vr
              ),
              /* harmony export */
              inflate: () => (
                /* binding */
                Hr
              ),
              /* harmony export */
              inflateRaw: () => (
                /* binding */
                Kr
              ),
              /* harmony export */
              ungzip: () => (
                /* binding */
                Zr
              )
              /* harmony export */
            });
            /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
            const l = 4, p = 0, _ = 1, x = 2;
            function o(v) {
              let j = v.length;
              for (; --j >= 0; )
                v[j] = 0;
            }
            const g = 0, E = 1, u = 2, A = 3, L = 258, C = 29, D = 256, r = D + 1 + C, n = 30, b = 19, f = 2 * r + 1, c = 15, t = 16, a = 7, h = 256, M = 16, w = 17, S = 18, T = (
              /* 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])
            ), R = (
              /* 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])
            ), $ = (
              /* 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])
            ), P = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), B = 512, F = new Array((r + 2) * 2);
            o(F);
            const U = new Array(n * 2);
            o(U);
            const z = new Array(B);
            o(z);
            const W = new Array(L - A + 1);
            o(W);
            const V = new Array(C);
            o(V);
            const N = new Array(n);
            o(N);
            function k(v, j, O, J, te) {
              this.static_tree = v, this.extra_bits = j, this.extra_base = O, this.elems = J, this.max_length = te, this.has_stree = v && v.length;
            }
            let G, Q, ie;
            function ge(v, j) {
              this.dyn_tree = v, this.max_code = 0, this.stat_desc = j;
            }
            const le = (v) => v < 256 ? z[v] : z[256 + (v >>> 7)], oe = (v, j) => {
              v.pending_buf[v.pending++] = j & 255, v.pending_buf[v.pending++] = j >>> 8 & 255;
            }, he = (v, j, O) => {
              v.bi_valid > t - O ? (v.bi_buf |= j << v.bi_valid & 65535, oe(v, v.bi_buf), v.bi_buf = j >> t - v.bi_valid, v.bi_valid += O - t) : (v.bi_buf |= j << v.bi_valid & 65535, v.bi_valid += O);
            }, se = (v, j, O) => {
              he(
                v,
                O[j * 2],
                O[j * 2 + 1]
                /*.Len*/
              );
            }, xe = (v, j) => {
              let O = 0;
              do
                O |= v & 1, v >>>= 1, O <<= 1;
              while (--j > 0);
              return O >>> 1;
            }, ye = (v) => {
              v.bi_valid === 16 ? (oe(v, v.bi_buf), v.bi_buf = 0, v.bi_valid = 0) : v.bi_valid >= 8 && (v.pending_buf[v.pending++] = v.bi_buf & 255, v.bi_buf >>= 8, v.bi_valid -= 8);
            }, Pe = (v, j) => {
              const O = j.dyn_tree, J = j.max_code, te = j.stat_desc.static_tree, ee = j.stat_desc.has_stree, Ce = j.stat_desc.extra_bits, be = j.stat_desc.extra_base, Xe = j.stat_desc.max_length;
              let ce, Le, ht, Ye, Ge, Qe, xt = 0;
              for (Ye = 0; Ye <= c; Ye++)
                v.bl_count[Ye] = 0;
              for (O[v.heap[v.heap_max] * 2 + 1] = 0, ce = v.heap_max + 1; ce < f; ce++)
                Le = v.heap[ce], Ye = O[O[Le * 2 + 1] * 2 + 1] + 1, Ye > Xe && (Ye = Xe, xt++), O[Le * 2 + 1] = Ye, !(Le > J) && (v.bl_count[Ye]++, Ge = 0, Le >= be && (Ge = Ce[Le - be]), Qe = O[Le * 2], v.opt_len += Qe * (Ye + Ge), ee && (v.static_len += Qe * (te[Le * 2 + 1] + Ge)));
              if (xt !== 0) {
                do {
                  for (Ye = Xe - 1; v.bl_count[Ye] === 0; )
                    Ye--;
                  v.bl_count[Ye]--, v.bl_count[Ye + 1] += 2, v.bl_count[Xe]--, xt -= 2;
                } while (xt > 0);
                for (Ye = Xe; Ye !== 0; Ye--)
                  for (Le = v.bl_count[Ye]; Le !== 0; )
                    ht = v.heap[--ce], !(ht > J) && (O[ht * 2 + 1] !== Ye && (v.opt_len += (Ye - O[ht * 2 + 1]) * O[ht * 2], O[ht * 2 + 1] = Ye), Le--);
              }
            }, de = (v, j, O) => {
              const J = new Array(c + 1);
              let te = 0, ee, Ce;
              for (ee = 1; ee <= c; ee++)
                te = te + O[ee - 1] << 1, J[ee] = te;
              for (Ce = 0; Ce <= j; Ce++) {
                let be = v[Ce * 2 + 1];
                be !== 0 && (v[Ce * 2] = xe(J[be]++, be));
              }
            }, pe = () => {
              let v, j, O, J, te;
              const ee = new Array(c + 1);
              for (O = 0, J = 0; J < C - 1; J++)
                for (V[J] = O, v = 0; v < 1 << T[J]; v++)
                  W[O++] = J;
              for (W[O - 1] = J, te = 0, J = 0; J < 16; J++)
                for (N[J] = te, v = 0; v < 1 << R[J]; v++)
                  z[te++] = J;
              for (te >>= 7; J < n; J++)
                for (N[J] = te << 7, v = 0; v < 1 << R[J] - 7; v++)
                  z[256 + te++] = J;
              for (j = 0; j <= c; j++)
                ee[j] = 0;
              for (v = 0; v <= 143; )
                F[v * 2 + 1] = 8, v++, ee[8]++;
              for (; v <= 255; )
                F[v * 2 + 1] = 9, v++, ee[9]++;
              for (; v <= 279; )
                F[v * 2 + 1] = 7, v++, ee[7]++;
              for (; v <= 287; )
                F[v * 2 + 1] = 8, v++, ee[8]++;
              for (de(F, r + 1, ee), v = 0; v < n; v++)
                U[v * 2 + 1] = 5, U[v * 2] = xe(v, 5);
              G = new k(F, T, D + 1, r, c), Q = new k(U, R, 0, n, c), ie = new k(new Array(0), $, 0, b, a);
            }, re = (v) => {
              let j;
              for (j = 0; j < r; j++)
                v.dyn_ltree[j * 2] = 0;
              for (j = 0; j < n; j++)
                v.dyn_dtree[j * 2] = 0;
              for (j = 0; j < b; j++)
                v.bl_tree[j * 2] = 0;
              v.dyn_ltree[h * 2] = 1, v.opt_len = v.static_len = 0, v.sym_next = v.matches = 0;
            }, Se = (v) => {
              v.bi_valid > 8 ? oe(v, v.bi_buf) : v.bi_valid > 0 && (v.pending_buf[v.pending++] = v.bi_buf), v.bi_buf = 0, v.bi_valid = 0;
            }, ke = (v, j, O, J) => {
              const te = j * 2, ee = O * 2;
              return v[te] < v[ee] || v[te] === v[ee] && J[j] <= J[O];
            }, $e = (v, j, O) => {
              const J = v.heap[O];
              let te = O << 1;
              for (; te <= v.heap_len && (te < v.heap_len && ke(j, v.heap[te + 1], v.heap[te], v.depth) && te++, !ke(j, J, v.heap[te], v.depth)); )
                v.heap[O] = v.heap[te], O = te, te <<= 1;
              v.heap[O] = J;
            }, ze = (v, j, O) => {
              let J, te, ee = 0, Ce, be;
              if (v.sym_next !== 0)
                do
                  J = v.pending_buf[v.sym_buf + ee++] & 255, J += (v.pending_buf[v.sym_buf + ee++] & 255) << 8, te = v.pending_buf[v.sym_buf + ee++], J === 0 ? se(v, te, j) : (Ce = W[te], se(v, Ce + D + 1, j), be = T[Ce], be !== 0 && (te -= V[Ce], he(v, te, be)), J--, Ce = le(J), se(v, Ce, O), be = R[Ce], be !== 0 && (J -= N[Ce], he(v, J, be)));
                while (ee < v.sym_next);
              se(v, h, j);
            }, Re = (v, j) => {
              const O = j.dyn_tree, J = j.stat_desc.static_tree, te = j.stat_desc.has_stree, ee = j.stat_desc.elems;
              let Ce, be, Xe = -1, ce;
              for (v.heap_len = 0, v.heap_max = f, Ce = 0; Ce < ee; Ce++)
                O[Ce * 2] !== 0 ? (v.heap[++v.heap_len] = Xe = Ce, v.depth[Ce] = 0) : O[Ce * 2 + 1] = 0;
              for (; v.heap_len < 2; )
                ce = v.heap[++v.heap_len] = Xe < 2 ? ++Xe : 0, O[ce * 2] = 1, v.depth[ce] = 0, v.opt_len--, te && (v.static_len -= J[ce * 2 + 1]);
              for (j.max_code = Xe, Ce = v.heap_len >> 1; Ce >= 1; Ce--)
                $e(v, O, Ce);
              ce = ee;
              do
                Ce = v.heap[
                  1
                  /*SMALLEST*/
                ], v.heap[
                  1
                  /*SMALLEST*/
                ] = v.heap[v.heap_len--], $e(
                  v,
                  O,
                  1
                  /*SMALLEST*/
                ), be = v.heap[
                  1
                  /*SMALLEST*/
                ], v.heap[--v.heap_max] = Ce, v.heap[--v.heap_max] = be, O[ce * 2] = O[Ce * 2] + O[be * 2], v.depth[ce] = (v.depth[Ce] >= v.depth[be] ? v.depth[Ce] : v.depth[be]) + 1, O[Ce * 2 + 1] = O[be * 2 + 1] = ce, v.heap[
                  1
                  /*SMALLEST*/
                ] = ce++, $e(
                  v,
                  O,
                  1
                  /*SMALLEST*/
                );
              while (v.heap_len >= 2);
              v.heap[--v.heap_max] = v.heap[
                1
                /*SMALLEST*/
              ], Pe(v, j), de(O, Xe, v.bl_count);
            }, Fe = (v, j, O) => {
              let J, te = -1, ee, Ce = j[0 * 2 + 1], be = 0, Xe = 7, ce = 4;
              for (Ce === 0 && (Xe = 138, ce = 3), j[(O + 1) * 2 + 1] = 65535, J = 0; J <= O; J++)
                ee = Ce, Ce = j[(J + 1) * 2 + 1], !(++be < Xe && ee === Ce) && (be < ce ? v.bl_tree[ee * 2] += be : ee !== 0 ? (ee !== te && v.bl_tree[ee * 2]++, v.bl_tree[M * 2]++) : be <= 10 ? v.bl_tree[w * 2]++ : v.bl_tree[S * 2]++, be = 0, te = ee, Ce === 0 ? (Xe = 138, ce = 3) : ee === Ce ? (Xe = 6, ce = 3) : (Xe = 7, ce = 4));
            }, Ie = (v, j, O) => {
              let J, te = -1, ee, Ce = j[0 * 2 + 1], be = 0, Xe = 7, ce = 4;
              for (Ce === 0 && (Xe = 138, ce = 3), J = 0; J <= O; J++)
                if (ee = Ce, Ce = j[(J + 1) * 2 + 1], !(++be < Xe && ee === Ce)) {
                  if (be < ce)
                    do
                      se(v, ee, v.bl_tree);
                    while (--be !== 0);
                  else
                    ee !== 0 ? (ee !== te && (se(v, ee, v.bl_tree), be--), se(v, M, v.bl_tree), he(v, be - 3, 2)) : be <= 10 ? (se(v, w, v.bl_tree), he(v, be - 3, 3)) : (se(v, S, v.bl_tree), he(v, be - 11, 7));
                  be = 0, te = ee, Ce === 0 ? (Xe = 138, ce = 3) : ee === Ce ? (Xe = 6, ce = 3) : (Xe = 7, ce = 4);
                }
            }, We = (v) => {
              let j;
              for (Fe(v, v.dyn_ltree, v.l_desc.max_code), Fe(v, v.dyn_dtree, v.d_desc.max_code), Re(v, v.bl_desc), j = b - 1; j >= 3 && v.bl_tree[P[j] * 2 + 1] === 0; j--)
                ;
              return v.opt_len += 3 * (j + 1) + 5 + 5 + 4, j;
            }, Ue = (v, j, O, J) => {
              let te;
              for (he(v, j - 257, 5), he(v, O - 1, 5), he(v, J - 4, 4), te = 0; te < J; te++)
                he(v, v.bl_tree[P[te] * 2 + 1], 3);
              Ie(v, v.dyn_ltree, j - 1), Ie(v, v.dyn_dtree, O - 1);
            }, Be = (v) => {
              let j = 4093624447, O;
              for (O = 0; O <= 31; O++, j >>>= 1)
                if (j & 1 && v.dyn_ltree[O * 2] !== 0)
                  return p;
              if (v.dyn_ltree[9 * 2] !== 0 || v.dyn_ltree[10 * 2] !== 0 || v.dyn_ltree[13 * 2] !== 0)
                return _;
              for (O = 32; O < D; O++)
                if (v.dyn_ltree[O * 2] !== 0)
                  return _;
              return p;
            };
            let Ne = !1;
            const H = (v) => {
              Ne || (pe(), Ne = !0), v.l_desc = new ge(v.dyn_ltree, G), v.d_desc = new ge(v.dyn_dtree, Q), v.bl_desc = new ge(v.bl_tree, ie), v.bi_buf = 0, v.bi_valid = 0, re(v);
            }, K = (v, j, O, J) => {
              he(v, (g << 1) + (J ? 1 : 0), 3), Se(v), oe(v, O), oe(v, ~O), O && v.pending_buf.set(v.window.subarray(j, j + O), v.pending), v.pending += O;
            }, q = (v) => {
              he(v, E << 1, 3), se(v, h, F), ye(v);
            }, fe = (v, j, O, J) => {
              let te, ee, Ce = 0;
              v.level > 0 ? (v.strm.data_type === x && (v.strm.data_type = Be(v)), Re(v, v.l_desc), Re(v, v.d_desc), Ce = We(v), te = v.opt_len + 3 + 7 >>> 3, ee = v.static_len + 3 + 7 >>> 3, ee <= te && (te = ee)) : te = ee = O + 5, O + 4 <= te && j !== -1 ? K(v, j, O, J) : v.strategy === l || ee === te ? (he(v, (E << 1) + (J ? 1 : 0), 3), ze(v, F, U)) : (he(v, (u << 1) + (J ? 1 : 0), 3), Ue(v, v.l_desc.max_code + 1, v.d_desc.max_code + 1, Ce + 1), ze(v, v.dyn_ltree, v.dyn_dtree)), re(v), J && Se(v);
            }, _e = (v, j, O) => (v.pending_buf[v.sym_buf + v.sym_next++] = j, v.pending_buf[v.sym_buf + v.sym_next++] = j >> 8, v.pending_buf[v.sym_buf + v.sym_next++] = O, j === 0 ? v.dyn_ltree[O * 2]++ : (v.matches++, j--, v.dyn_ltree[(W[O] + D + 1) * 2]++, v.dyn_dtree[le(j) * 2]++), v.sym_next === v.sym_end);
            var Me = H, Ae = K, Z = fe, ue = _e, we = q, Te = {
              _tr_init: Me,
              _tr_stored_block: Ae,
              _tr_flush_block: Z,
              _tr_tally: ue,
              _tr_align: we
            }, De = (v, j, O, J) => {
              let te = v & 65535 | 0, ee = v >>> 16 & 65535 | 0, Ce = 0;
              for (; O !== 0; ) {
                Ce = O > 2e3 ? 2e3 : O, O -= Ce;
                do
                  te = te + j[J++] | 0, ee = ee + te | 0;
                while (--Ce);
                te %= 65521, ee %= 65521;
              }
              return te | ee << 16 | 0;
            };
            const Y = () => {
              let v, j = [];
              for (var O = 0; O < 256; O++) {
                v = O;
                for (var J = 0; J < 8; J++)
                  v = v & 1 ? 3988292384 ^ v >>> 1 : v >>> 1;
                j[O] = v;
              }
              return j;
            }, Oe = new Uint32Array(Y());
            var I = (v, j, O, J) => {
              const te = Oe, ee = J + O;
              v ^= -1;
              for (let Ce = J; Ce < ee; Ce++)
                v = v >>> 8 ^ te[(v ^ j[Ce]) & 255];
              return v ^ -1;
            }, me = {
              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: X, _tr_stored_block: ne, _tr_flush_block: Ee, _tr_tally: He, _tr_align: Ke } = Te, {
              Z_NO_FLUSH: je,
              Z_PARTIAL_FLUSH: qe,
              Z_FULL_FLUSH: wt,
              Z_FINISH: nt,
              Z_BLOCK: rt,
              Z_OK: tt,
              Z_STREAM_END: yt,
              Z_STREAM_ERROR: _t,
              Z_DATA_ERROR: It,
              Z_BUF_ERROR: Ot,
              Z_DEFAULT_COMPRESSION: vt,
              Z_FILTERED: mt,
              Z_HUFFMAN_ONLY: pt,
              Z_RLE: Ct,
              Z_FIXED: Mt,
              Z_DEFAULT_STRATEGY: Ft,
              Z_UNKNOWN: hi,
              Z_DEFLATED: Ut
            } = ve, di = 9, ci = 15, ui = 8, Ci = 256 + 1 + 29, Qr = 30, Jr = 19, qr = 2 * Ci + 1, en = 15, at = 3, $t = 258, Tt = $t + at + 1, tn = 32, Kt = 42, Li = 57, Di = 69, Si = 73, Oi = 91, Ti = 103, Wt = 113, qt = 666, At = 1, Zt = 2, Gt = 3, Yt = 4, rn = 3, Nt = (v, j) => (v.msg = me[j], j), Vi = (v) => v * 2 - (v > 4 ? 9 : 0), Bt = (v) => {
              let j = v.length;
              for (; --j >= 0; )
                v[j] = 0;
            }, nn = (v) => {
              let j, O, J, te = v.w_size;
              j = v.hash_size, J = j;
              do
                O = v.head[--J], v.head[J] = O >= te ? O - te : 0;
              while (--j);
              j = te, J = j;
              do
                O = v.prev[--J], v.prev[J] = O >= te ? O - te : 0;
              while (--j);
            };
            let kt = (v, j, O) => (j << v.hash_shift ^ O) & v.hash_mask;
            const Lt = (v) => {
              const j = v.state;
              let O = j.pending;
              O > v.avail_out && (O = v.avail_out), O !== 0 && (v.output.set(j.pending_buf.subarray(j.pending_out, j.pending_out + O), v.next_out), v.next_out += O, j.pending_out += O, v.total_out += O, v.avail_out -= O, j.pending -= O, j.pending === 0 && (j.pending_out = 0));
            }, Dt = (v, j) => {
              Ee(v, v.block_start >= 0 ? v.block_start : -1, v.strstart - v.block_start, j), v.block_start = v.strstart, Lt(v.strm);
            }, dt = (v, j) => {
              v.pending_buf[v.pending++] = j;
            }, ei = (v, j) => {
              v.pending_buf[v.pending++] = j >>> 8 & 255, v.pending_buf[v.pending++] = j & 255;
            }, Pi = (v, j, O, J) => {
              let te = v.avail_in;
              return te > J && (te = J), te === 0 ? 0 : (v.avail_in -= te, j.set(v.input.subarray(v.next_in, v.next_in + te), O), v.state.wrap === 1 ? v.adler = De(v.adler, j, te, O) : v.state.wrap === 2 && (v.adler = I(v.adler, j, te, O)), v.next_in += te, v.total_in += te, te);
            }, ji = (v, j) => {
              let O = v.max_chain_length, J = v.strstart, te, ee, Ce = v.prev_length, be = v.nice_match;
              const Xe = v.strstart > v.w_size - Tt ? v.strstart - (v.w_size - Tt) : 0, ce = v.window, Le = v.w_mask, ht = v.prev, Ye = v.strstart + $t;
              let Ge = ce[J + Ce - 1], Qe = ce[J + Ce];
              v.prev_length >= v.good_match && (O >>= 2), be > v.lookahead && (be = v.lookahead);
              do
                if (te = j, !(ce[te + Ce] !== Qe || ce[te + Ce - 1] !== Ge || ce[te] !== ce[J] || ce[++te] !== ce[J + 1])) {
                  J += 2, te++;
                  do
                    ;
                  while (ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && ce[++J] === ce[++te] && J < Ye);
                  if (ee = $t - (Ye - J), J = Ye - $t, ee > Ce) {
                    if (v.match_start = j, Ce = ee, ee >= be)
                      break;
                    Ge = ce[J + Ce - 1], Qe = ce[J + Ce];
                  }
                }
              while ((j = ht[j & Le]) > Xe && --O !== 0);
              return Ce <= v.lookahead ? Ce : v.lookahead;
            }, Xt = (v) => {
              const j = v.w_size;
              let O, J, te;
              do {
                if (J = v.window_size - v.lookahead - v.strstart, v.strstart >= j + (j - Tt) && (v.window.set(v.window.subarray(j, j + j - J), 0), v.match_start -= j, v.strstart -= j, v.block_start -= j, v.insert > v.strstart && (v.insert = v.strstart), nn(v), J += j), v.strm.avail_in === 0)
                  break;
                if (O = Pi(v.strm, v.window, v.strstart + v.lookahead, J), v.lookahead += O, v.lookahead + v.insert >= at)
                  for (te = v.strstart - v.insert, v.ins_h = v.window[te], v.ins_h = kt(v, v.ins_h, v.window[te + 1]); v.insert && (v.ins_h = kt(v, v.ins_h, v.window[te + at - 1]), v.prev[te & v.w_mask] = v.head[v.ins_h], v.head[v.ins_h] = te, te++, v.insert--, !(v.lookahead + v.insert < at)); )
                    ;
              } while (v.lookahead < Tt && v.strm.avail_in !== 0);
            }, Hi = (v, j) => {
              let O = v.pending_buf_size - 5 > v.w_size ? v.w_size : v.pending_buf_size - 5, J, te, ee, Ce = 0, be = v.strm.avail_in;
              do {
                if (J = 65535, ee = v.bi_valid + 42 >> 3, v.strm.avail_out < ee || (ee = v.strm.avail_out - ee, te = v.strstart - v.block_start, J > te + v.strm.avail_in && (J = te + v.strm.avail_in), J > ee && (J = ee), J < O && (J === 0 && j !== nt || j === je || J !== te + v.strm.avail_in)))
                  break;
                Ce = j === nt && J === te + v.strm.avail_in ? 1 : 0, ne(v, 0, 0, Ce), v.pending_buf[v.pending - 4] = J, v.pending_buf[v.pending - 3] = J >> 8, v.pending_buf[v.pending - 2] = ~J, v.pending_buf[v.pending - 1] = ~J >> 8, Lt(v.strm), te && (te > J && (te = J), v.strm.output.set(v.window.subarray(v.block_start, v.block_start + te), v.strm.next_out), v.strm.next_out += te, v.strm.avail_out -= te, v.strm.total_out += te, v.block_start += te, J -= te), J && (Pi(v.strm, v.strm.output, v.strm.next_out, J), v.strm.next_out += J, v.strm.avail_out -= J, v.strm.total_out += J);
              } while (Ce === 0);
              return be -= v.strm.avail_in, be && (be >= v.w_size ? (v.matches = 2, v.window.set(v.strm.input.subarray(v.strm.next_in - v.w_size, v.strm.next_in), 0), v.strstart = v.w_size, v.insert = v.strstart) : (v.window_size - v.strstart <= be && (v.strstart -= v.w_size, v.window.set(v.window.subarray(v.w_size, v.w_size + v.strstart), 0), v.matches < 2 && v.matches++, v.insert > v.strstart && (v.insert = v.strstart)), v.window.set(v.strm.input.subarray(v.strm.next_in - be, v.strm.next_in), v.strstart), v.strstart += be, v.insert += be > v.w_size - v.insert ? v.w_size - v.insert : be), v.block_start = v.strstart), v.high_water < v.strstart && (v.high_water = v.strstart), Ce ? Yt : j !== je && j !== nt && v.strm.avail_in === 0 && v.strstart === v.block_start ? Zt : (ee = v.window_size - v.strstart, v.strm.avail_in > ee && v.block_start >= v.w_size && (v.block_start -= v.w_size, v.strstart -= v.w_size, v.window.set(v.window.subarray(v.w_size, v.w_size + v.strstart), 0), v.matches < 2 && v.matches++, ee += v.w_size, v.insert > v.strstart && (v.insert = v.strstart)), ee > v.strm.avail_in && (ee = v.strm.avail_in), ee && (Pi(v.strm, v.window, v.strstart, ee), v.strstart += ee, v.insert += ee > v.w_size - v.insert ? v.w_size - v.insert : ee), v.high_water < v.strstart && (v.high_water = v.strstart), ee = v.bi_valid + 42 >> 3, ee = v.pending_buf_size - ee > 65535 ? 65535 : v.pending_buf_size - ee, O = ee > v.w_size ? v.w_size : ee, te = v.strstart - v.block_start, (te >= O || (te || j === nt) && j !== je && v.strm.avail_in === 0 && te <= ee) && (J = te > ee ? ee : te, Ce = j === nt && v.strm.avail_in === 0 && J === te ? 1 : 0, ne(v, v.block_start, J, Ce), v.block_start += J, Lt(v.strm)), Ce ? Gt : At);
            }, Ii = (v, j) => {
              let O, J;
              for (; ; ) {
                if (v.lookahead < Tt) {
                  if (Xt(v), v.lookahead < Tt && j === je)
                    return At;
                  if (v.lookahead === 0)
                    break;
                }
                if (O = 0, v.lookahead >= at && (v.ins_h = kt(v, v.ins_h, v.window[v.strstart + at - 1]), O = v.prev[v.strstart & v.w_mask] = v.head[v.ins_h], v.head[v.ins_h] = v.strstart), O !== 0 && v.strstart - O <= v.w_size - Tt && (v.match_length = ji(v, O)), v.match_length >= at)
                  if (J = He(v, v.strstart - v.match_start, v.match_length - at), v.lookahead -= v.match_length, v.match_length <= v.max_lazy_match && v.lookahead >= at) {
                    v.match_length--;
                    do
                      v.strstart++, v.ins_h = kt(v, v.ins_h, v.window[v.strstart + at - 1]), O = v.prev[v.strstart & v.w_mask] = v.head[v.ins_h], v.head[v.ins_h] = v.strstart;
                    while (--v.match_length !== 0);
                    v.strstart++;
                  } else
                    v.strstart += v.match_length, v.match_length = 0, v.ins_h = v.window[v.strstart], v.ins_h = kt(v, v.ins_h, v.window[v.strstart + 1]);
                else
                  J = He(v, 0, v.window[v.strstart]), v.lookahead--, v.strstart++;
                if (J && (Dt(v, !1), v.strm.avail_out === 0))
                  return At;
              }
              return v.insert = v.strstart < at - 1 ? v.strstart : at - 1, j === nt ? (Dt(v, !0), v.strm.avail_out === 0 ? Gt : Yt) : v.sym_next && (Dt(v, !1), v.strm.avail_out === 0) ? At : Zt;
            }, Qt = (v, j) => {
              let O, J, te;
              for (; ; ) {
                if (v.lookahead < Tt) {
                  if (Xt(v), v.lookahead < Tt && j === je)
                    return At;
                  if (v.lookahead === 0)
                    break;
                }
                if (O = 0, v.lookahead >= at && (v.ins_h = kt(v, v.ins_h, v.window[v.strstart + at - 1]), O = v.prev[v.strstart & v.w_mask] = v.head[v.ins_h], v.head[v.ins_h] = v.strstart), v.prev_length = v.match_length, v.prev_match = v.match_start, v.match_length = at - 1, O !== 0 && v.prev_length < v.max_lazy_match && v.strstart - O <= v.w_size - Tt && (v.match_length = ji(v, O), v.match_length <= 5 && (v.strategy === mt || v.match_length === at && v.strstart - v.match_start > 4096) && (v.match_length = at - 1)), v.prev_length >= at && v.match_length <= v.prev_length) {
                  te = v.strstart + v.lookahead - at, J = He(v, v.strstart - 1 - v.prev_match, v.prev_length - at), v.lookahead -= v.prev_length - 1, v.prev_length -= 2;
                  do
                    ++v.strstart <= te && (v.ins_h = kt(v, v.ins_h, v.window[v.strstart + at - 1]), O = v.prev[v.strstart & v.w_mask] = v.head[v.ins_h], v.head[v.ins_h] = v.strstart);
                  while (--v.prev_length !== 0);
                  if (v.match_available = 0, v.match_length = at - 1, v.strstart++, J && (Dt(v, !1), v.strm.avail_out === 0))
                    return At;
                } else if (v.match_available) {
                  if (J = He(v, 0, v.window[v.strstart - 1]), J && Dt(v, !1), v.strstart++, v.lookahead--, v.strm.avail_out === 0)
                    return At;
                } else
                  v.match_available = 1, v.strstart++, v.lookahead--;
              }
              return v.match_available && (J = He(v, 0, v.window[v.strstart - 1]), v.match_available = 0), v.insert = v.strstart < at - 1 ? v.strstart : at - 1, j === nt ? (Dt(v, !0), v.strm.avail_out === 0 ? Gt : Yt) : v.sym_next && (Dt(v, !1), v.strm.avail_out === 0) ? At : Zt;
            }, sn = (v, j) => {
              let O, J, te, ee;
              const Ce = v.window;
              for (; ; ) {
                if (v.lookahead <= $t) {
                  if (Xt(v), v.lookahead <= $t && j === je)
                    return At;
                  if (v.lookahead === 0)
                    break;
                }
                if (v.match_length = 0, v.lookahead >= at && v.strstart > 0 && (te = v.strstart - 1, J = Ce[te], J === Ce[++te] && J === Ce[++te] && J === Ce[++te])) {
                  ee = v.strstart + $t;
                  do
                    ;
                  while (J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && J === Ce[++te] && te < ee);
                  v.match_length = $t - (ee - te), v.match_length > v.lookahead && (v.match_length = v.lookahead);
                }
                if (v.match_length >= at ? (O = He(v, 1, v.match_length - at), v.lookahead -= v.match_length, v.strstart += v.match_length, v.match_length = 0) : (O = He(v, 0, v.window[v.strstart]), v.lookahead--, v.strstart++), O && (Dt(v, !1), v.strm.avail_out === 0))
                  return At;
              }
              return v.insert = 0, j === nt ? (Dt(v, !0), v.strm.avail_out === 0 ? Gt : Yt) : v.sym_next && (Dt(v, !1), v.strm.avail_out === 0) ? At : Zt;
            }, an = (v, j) => {
              let O;
              for (; ; ) {
                if (v.lookahead === 0 && (Xt(v), v.lookahead === 0)) {
                  if (j === je)
                    return At;
                  break;
                }
                if (v.match_length = 0, O = He(v, 0, v.window[v.strstart]), v.lookahead--, v.strstart++, O && (Dt(v, !1), v.strm.avail_out === 0))
                  return At;
              }
              return v.insert = 0, j === nt ? (Dt(v, !0), v.strm.avail_out === 0 ? Gt : Yt) : v.sym_next && (Dt(v, !1), v.strm.avail_out === 0) ? At : Zt;
            };
            function Pt(v, j, O, J, te) {
              this.good_length = v, this.max_lazy = j, this.nice_length = O, this.max_chain = J, this.func = te;
            }
            const ti = [
              /*      good lazy nice chain */
              new Pt(0, 0, 0, 0, Hi),
              /* 0 store only */
              new Pt(4, 4, 8, 4, Ii),
              /* 1 max speed, no lazy matches */
              new Pt(4, 5, 16, 8, Ii),
              /* 2 */
              new Pt(4, 6, 32, 32, Ii),
              /* 3 */
              new Pt(4, 4, 16, 16, Qt),
              /* 4 lazy matches */
              new Pt(8, 16, 32, 32, Qt),
              /* 5 */
              new Pt(8, 16, 128, 128, Qt),
              /* 6 */
              new Pt(8, 32, 128, 256, Qt),
              /* 7 */
              new Pt(32, 128, 258, 1024, Qt),
              /* 8 */
              new Pt(32, 258, 258, 4096, Qt)
              /* 9 max compression */
            ], ln = (v) => {
              v.window_size = 2 * v.w_size, Bt(v.head), v.max_lazy_match = ti[v.level].max_lazy, v.good_match = ti[v.level].good_length, v.nice_match = ti[v.level].nice_length, v.max_chain_length = ti[v.level].max_chain, v.strstart = 0, v.block_start = 0, v.lookahead = 0, v.insert = 0, v.match_length = v.prev_length = at - 1, v.match_available = 0, v.ins_h = 0;
            };
            function on() {
              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 = Ut, 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(qr * 2), this.dyn_dtree = new Uint16Array((2 * Qr + 1) * 2), this.bl_tree = new Uint16Array((2 * Jr + 1) * 2), Bt(this.dyn_ltree), Bt(this.dyn_dtree), Bt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(en + 1), this.heap = new Uint16Array(2 * Ci + 1), Bt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * Ci + 1), Bt(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 ii = (v) => {
              if (!v)
                return 1;
              const j = v.state;
              return !j || j.strm !== v || j.status !== Kt && //#ifdef GZIP
              j.status !== Li && //#endif
              j.status !== Di && j.status !== Si && j.status !== Oi && j.status !== Ti && j.status !== Wt && j.status !== qt ? 1 : 0;
            }, Ki = (v) => {
              if (ii(v))
                return Nt(v, _t);
              v.total_in = v.total_out = 0, v.data_type = hi;
              const j = v.state;
              return j.pending = 0, j.pending_out = 0, j.wrap < 0 && (j.wrap = -j.wrap), j.status = //#ifdef GZIP
              j.wrap === 2 ? Li : (
                //#endif
                j.wrap ? Kt : Wt
              ), v.adler = j.wrap === 2 ? 0 : 1, j.last_flush = -2, X(j), tt;
            }, Zi = (v) => {
              const j = Ki(v);
              return j === tt && ln(v.state), j;
            }, fn = (v, j) => ii(v) || v.state.wrap !== 2 ? _t : (v.state.gzhead = j, tt), Yi = (v, j, O, J, te, ee) => {
              if (!v)
                return _t;
              let Ce = 1;
              if (j === vt && (j = 6), J < 0 ? (Ce = 0, J = -J) : J > 15 && (Ce = 2, J -= 16), te < 1 || te > di || O !== Ut || J < 8 || J > 15 || j < 0 || j > 9 || ee < 0 || ee > Mt || J === 8 && Ce !== 1)
                return Nt(v, _t);
              J === 8 && (J = 9);
              const be = new on();
              return v.state = be, be.strm = v, be.status = Kt, be.wrap = Ce, be.gzhead = null, be.w_bits = J, be.w_size = 1 << be.w_bits, be.w_mask = be.w_size - 1, be.hash_bits = te + 7, be.hash_size = 1 << be.hash_bits, be.hash_mask = be.hash_size - 1, be.hash_shift = ~~((be.hash_bits + at - 1) / at), be.window = new Uint8Array(be.w_size * 2), be.head = new Uint16Array(be.hash_size), be.prev = new Uint16Array(be.w_size), be.lit_bufsize = 1 << te + 6, be.pending_buf_size = be.lit_bufsize * 4, be.pending_buf = new Uint8Array(be.pending_buf_size), be.sym_buf = be.lit_bufsize, be.sym_end = (be.lit_bufsize - 1) * 3, be.level = j, be.strategy = ee, be.method = O, Zi(v);
            }, hn = (v, j) => Yi(v, j, Ut, ci, ui, Ft), dn = (v, j) => {
              if (ii(v) || j > rt || j < 0)
                return v ? Nt(v, _t) : _t;
              const O = v.state;
              if (!v.output || v.avail_in !== 0 && !v.input || O.status === qt && j !== nt)
                return Nt(v, v.avail_out === 0 ? Ot : _t);
              const J = O.last_flush;
              if (O.last_flush = j, O.pending !== 0) {
                if (Lt(v), v.avail_out === 0)
                  return O.last_flush = -1, tt;
              } else if (v.avail_in === 0 && Vi(j) <= Vi(J) && j !== nt)
                return Nt(v, Ot);
              if (O.status === qt && v.avail_in !== 0)
                return Nt(v, Ot);
              if (O.status === Kt && O.wrap === 0 && (O.status = Wt), O.status === Kt) {
                let te = Ut + (O.w_bits - 8 << 4) << 8, ee = -1;
                if (O.strategy >= pt || O.level < 2 ? ee = 0 : O.level < 6 ? ee = 1 : O.level === 6 ? ee = 2 : ee = 3, te |= ee << 6, O.strstart !== 0 && (te |= tn), te += 31 - te % 31, ei(O, te), O.strstart !== 0 && (ei(O, v.adler >>> 16), ei(O, v.adler & 65535)), v.adler = 1, O.status = Wt, Lt(v), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (O.status === Li) {
                if (v.adler = 0, dt(O, 31), dt(O, 139), dt(O, 8), O.gzhead)
                  dt(
                    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)
                  ), dt(O, O.gzhead.time & 255), dt(O, O.gzhead.time >> 8 & 255), dt(O, O.gzhead.time >> 16 & 255), dt(O, O.gzhead.time >> 24 & 255), dt(O, O.level === 9 ? 2 : O.strategy >= pt || O.level < 2 ? 4 : 0), dt(O, O.gzhead.os & 255), O.gzhead.extra && O.gzhead.extra.length && (dt(O, O.gzhead.extra.length & 255), dt(O, O.gzhead.extra.length >> 8 & 255)), O.gzhead.hcrc && (v.adler = I(v.adler, O.pending_buf, O.pending, 0)), O.gzindex = 0, O.status = Di;
                else if (dt(O, 0), dt(O, 0), dt(O, 0), dt(O, 0), dt(O, 0), dt(O, O.level === 9 ? 2 : O.strategy >= pt || O.level < 2 ? 4 : 0), dt(O, rn), O.status = Wt, Lt(v), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (O.status === Di) {
                if (O.gzhead.extra) {
                  let te = O.pending, ee = (O.gzhead.extra.length & 65535) - O.gzindex;
                  for (; O.pending + ee > O.pending_buf_size; ) {
                    let be = O.pending_buf_size - O.pending;
                    if (O.pending_buf.set(O.gzhead.extra.subarray(O.gzindex, O.gzindex + be), O.pending), O.pending = O.pending_buf_size, O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te)), O.gzindex += be, Lt(v), O.pending !== 0)
                      return O.last_flush = -1, tt;
                    te = 0, ee -= be;
                  }
                  let Ce = new Uint8Array(O.gzhead.extra);
                  O.pending_buf.set(Ce.subarray(O.gzindex, O.gzindex + ee), O.pending), O.pending += ee, O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te)), O.gzindex = 0;
                }
                O.status = Si;
              }
              if (O.status === Si) {
                if (O.gzhead.name) {
                  let te = O.pending, ee;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te)), Lt(v), O.pending !== 0)
                        return O.last_flush = -1, tt;
                      te = 0;
                    }
                    O.gzindex < O.gzhead.name.length ? ee = O.gzhead.name.charCodeAt(O.gzindex++) & 255 : ee = 0, dt(O, ee);
                  } while (ee !== 0);
                  O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te)), O.gzindex = 0;
                }
                O.status = Oi;
              }
              if (O.status === Oi) {
                if (O.gzhead.comment) {
                  let te = O.pending, ee;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te)), Lt(v), O.pending !== 0)
                        return O.last_flush = -1, tt;
                      te = 0;
                    }
                    O.gzindex < O.gzhead.comment.length ? ee = O.gzhead.comment.charCodeAt(O.gzindex++) & 255 : ee = 0, dt(O, ee);
                  } while (ee !== 0);
                  O.gzhead.hcrc && O.pending > te && (v.adler = I(v.adler, O.pending_buf, O.pending - te, te));
                }
                O.status = Ti;
              }
              if (O.status === Ti) {
                if (O.gzhead.hcrc) {
                  if (O.pending + 2 > O.pending_buf_size && (Lt(v), O.pending !== 0))
                    return O.last_flush = -1, tt;
                  dt(O, v.adler & 255), dt(O, v.adler >> 8 & 255), v.adler = 0;
                }
                if (O.status = Wt, Lt(v), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (v.avail_in !== 0 || O.lookahead !== 0 || j !== je && O.status !== qt) {
                let te = O.level === 0 ? Hi(O, j) : O.strategy === pt ? an(O, j) : O.strategy === Ct ? sn(O, j) : ti[O.level].func(O, j);
                if ((te === Gt || te === Yt) && (O.status = qt), te === At || te === Gt)
                  return v.avail_out === 0 && (O.last_flush = -1), tt;
                if (te === Zt && (j === qe ? Ke(O) : j !== rt && (ne(O, 0, 0, !1), j === wt && (Bt(O.head), O.lookahead === 0 && (O.strstart = 0, O.block_start = 0, O.insert = 0))), Lt(v), v.avail_out === 0))
                  return O.last_flush = -1, tt;
              }
              return j !== nt ? tt : O.wrap <= 0 ? yt : (O.wrap === 2 ? (dt(O, v.adler & 255), dt(O, v.adler >> 8 & 255), dt(O, v.adler >> 16 & 255), dt(O, v.adler >> 24 & 255), dt(O, v.total_in & 255), dt(O, v.total_in >> 8 & 255), dt(O, v.total_in >> 16 & 255), dt(O, v.total_in >> 24 & 255)) : (ei(O, v.adler >>> 16), ei(O, v.adler & 65535)), Lt(v), O.wrap > 0 && (O.wrap = -O.wrap), O.pending !== 0 ? tt : yt);
            }, cn = (v) => {
              if (ii(v))
                return _t;
              const j = v.state.status;
              return v.state = null, j === Wt ? Nt(v, It) : tt;
            }, un = (v, j) => {
              let O = j.length;
              if (ii(v))
                return _t;
              const J = v.state, te = J.wrap;
              if (te === 2 || te === 1 && J.status !== Kt || J.lookahead)
                return _t;
              if (te === 1 && (v.adler = De(v.adler, j, O, 0)), J.wrap = 0, O >= J.w_size) {
                te === 0 && (Bt(J.head), J.strstart = 0, J.block_start = 0, J.insert = 0);
                let Xe = new Uint8Array(J.w_size);
                Xe.set(j.subarray(O - J.w_size, O), 0), j = Xe, O = J.w_size;
              }
              const ee = v.avail_in, Ce = v.next_in, be = v.input;
              for (v.avail_in = O, v.next_in = 0, v.input = j, Xt(J); J.lookahead >= at; ) {
                let Xe = J.strstart, ce = J.lookahead - (at - 1);
                do
                  J.ins_h = kt(J, J.ins_h, J.window[Xe + at - 1]), J.prev[Xe & J.w_mask] = J.head[J.ins_h], J.head[J.ins_h] = Xe, Xe++;
                while (--ce);
                J.strstart = Xe, J.lookahead = at - 1, Xt(J);
              }
              return J.strstart += J.lookahead, J.block_start = J.strstart, J.insert = J.lookahead, J.lookahead = 0, J.match_length = J.prev_length = at - 1, J.match_available = 0, v.next_in = Ce, v.input = be, v.avail_in = ee, J.wrap = te, tt;
            };
            var _n = hn, pn = Yi, gn = Zi, vn = Ki, mn = fn, bn = dn, xn = cn, yn = un, wn = "pako deflate (from Nodeca project)", ri = {
              deflateInit: _n,
              deflateInit2: pn,
              deflateReset: gn,
              deflateResetKeep: vn,
              deflateSetHeader: mn,
              deflate: bn,
              deflateEnd: xn,
              deflateSetDictionary: yn,
              deflateInfo: wn
            };
            const En = (v, j) => Object.prototype.hasOwnProperty.call(v, j);
            var Mn = function(v) {
              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)
                    En(O, J) && (v[J] = O[J]);
                }
              }
              return v;
            }, An = (v) => {
              let j = 0;
              for (let J = 0, te = v.length; J < te; J++)
                j += v[J].length;
              const O = new Uint8Array(j);
              for (let J = 0, te = 0, ee = v.length; J < ee; J++) {
                let Ce = v[J];
                O.set(Ce, te), te += Ce.length;
              }
              return O;
            }, gi = {
              assign: Mn,
              flattenChunks: An
            };
            let Xi = !0;
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              Xi = !1;
            }
            const ni = new Uint8Array(256);
            for (let v = 0; v < 256; v++)
              ni[v] = v >= 252 ? 6 : v >= 248 ? 5 : v >= 240 ? 4 : v >= 224 ? 3 : v >= 192 ? 2 : 1;
            ni[254] = ni[254] = 1;
            var Cn = (v) => {
              if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
                return new TextEncoder().encode(v);
              let j, O, J, te, ee, Ce = v.length, be = 0;
              for (te = 0; te < Ce; te++)
                O = v.charCodeAt(te), (O & 64512) === 55296 && te + 1 < Ce && (J = v.charCodeAt(te + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), te++)), be += O < 128 ? 1 : O < 2048 ? 2 : O < 65536 ? 3 : 4;
              for (j = new Uint8Array(be), ee = 0, te = 0; ee < be; te++)
                O = v.charCodeAt(te), (O & 64512) === 55296 && te + 1 < Ce && (J = v.charCodeAt(te + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), te++)), O < 128 ? j[ee++] = O : O < 2048 ? (j[ee++] = 192 | O >>> 6, j[ee++] = 128 | O & 63) : O < 65536 ? (j[ee++] = 224 | O >>> 12, j[ee++] = 128 | O >>> 6 & 63, j[ee++] = 128 | O & 63) : (j[ee++] = 240 | O >>> 18, j[ee++] = 128 | O >>> 12 & 63, j[ee++] = 128 | O >>> 6 & 63, j[ee++] = 128 | O & 63);
              return j;
            };
            const Ln = (v, j) => {
              if (j < 65534 && v.subarray && Xi)
                return String.fromCharCode.apply(null, v.length === j ? v : v.subarray(0, j));
              let O = "";
              for (let J = 0; J < j; J++)
                O += String.fromCharCode(v[J]);
              return O;
            };
            var Dn = (v, j) => {
              const O = j || v.length;
              if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
                return new TextDecoder().decode(v.subarray(0, j));
              let J, te;
              const ee = new Array(O * 2);
              for (te = 0, J = 0; J < O; ) {
                let Ce = v[J++];
                if (Ce < 128) {
                  ee[te++] = Ce;
                  continue;
                }
                let be = ni[Ce];
                if (be > 4) {
                  ee[te++] = 65533, J += be - 1;
                  continue;
                }
                for (Ce &= be === 2 ? 31 : be === 3 ? 15 : 7; be > 1 && J < O; )
                  Ce = Ce << 6 | v[J++] & 63, be--;
                if (be > 1) {
                  ee[te++] = 65533;
                  continue;
                }
                Ce < 65536 ? ee[te++] = Ce : (Ce -= 65536, ee[te++] = 55296 | Ce >> 10 & 1023, ee[te++] = 56320 | Ce & 1023);
              }
              return Ln(ee, te);
            }, Sn = (v, j) => {
              j = j || v.length, j > v.length && (j = v.length);
              let O = j - 1;
              for (; O >= 0 && (v[O] & 192) === 128; )
                O--;
              return O < 0 || O === 0 ? j : O + ni[v[O]] > j ? O : j;
            }, si = {
              string2buf: Cn,
              buf2string: Dn,
              utf8border: Sn
            };
            function On() {
              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 Qi = On;
            const Ji = Object.prototype.toString, {
              Z_NO_FLUSH: Tn,
              Z_SYNC_FLUSH: Pn,
              Z_FULL_FLUSH: In,
              Z_FINISH: Rn,
              Z_OK: vi,
              Z_STREAM_END: zn,
              Z_DEFAULT_COMPRESSION: $n,
              Z_DEFAULT_STRATEGY: Bn,
              Z_DEFLATED: kn
            } = ve;
            function ai(v) {
              this.options = gi.assign({
                level: $n,
                method: kn,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: Bn
              }, v || {});
              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 Qi(), this.strm.avail_out = 0;
              let O = ri.deflateInit2(
                this.strm,
                j.level,
                j.method,
                j.windowBits,
                j.memLevel,
                j.strategy
              );
              if (O !== vi)
                throw new Error(me[O]);
              if (j.header && ri.deflateSetHeader(this.strm, j.header), j.dictionary) {
                let J;
                if (typeof j.dictionary == "string" ? J = si.string2buf(j.dictionary) : Ji.call(j.dictionary) === "[object ArrayBuffer]" ? J = new Uint8Array(j.dictionary) : J = j.dictionary, O = ri.deflateSetDictionary(this.strm, J), O !== vi)
                  throw new Error(me[O]);
                this._dict_set = !0;
              }
            }
            ai.prototype.push = function(v, j) {
              const O = this.strm, J = this.options.chunkSize;
              let te, ee;
              if (this.ended)
                return !1;
              for (j === ~~j ? ee = j : ee = j === !0 ? Rn : Tn, typeof v == "string" ? O.input = si.string2buf(v) : Ji.call(v) === "[object ArrayBuffer]" ? O.input = new Uint8Array(v) : O.input = v, 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), (ee === Pn || ee === In) && O.avail_out <= 6) {
                  this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0;
                  continue;
                }
                if (te = ri.deflate(O, ee), te === zn)
                  return O.next_out > 0 && this.onData(O.output.subarray(0, O.next_out)), te = ri.deflateEnd(this.strm), this.onEnd(te), this.ended = !0, te === vi;
                if (O.avail_out === 0) {
                  this.onData(O.output);
                  continue;
                }
                if (ee > 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;
            }, ai.prototype.onData = function(v) {
              this.chunks.push(v);
            }, ai.prototype.onEnd = function(v) {
              v === vi && (this.result = gi.flattenChunks(this.chunks)), this.chunks = [], this.err = v, this.msg = this.strm.msg;
            };
            function Ri(v, j) {
              const O = new ai(j);
              if (O.push(v, !0), O.err)
                throw O.msg || me[O.err];
              return O.result;
            }
            function Fn(v, j) {
              return j = j || {}, j.raw = !0, Ri(v, j);
            }
            function Un(v, j) {
              return j = j || {}, j.gzip = !0, Ri(v, j);
            }
            var Wn = ai, Gn = Ri, Nn = Fn, Vn = Un, jn = ve, Hn = {
              Deflate: Wn,
              deflate: Gn,
              deflateRaw: Nn,
              gzip: Vn,
              constants: jn
            };
            const mi = 16209, Kn = 16191;
            var Zn = function(j, O) {
              let J, te, ee, Ce, be, Xe, ce, Le, ht, Ye, Ge, Qe, xt, ot, it, ut, st, Ze, ct, Et, Je, gt, ft, et;
              const lt = j.state;
              J = j.next_in, ft = j.input, te = J + (j.avail_in - 5), ee = j.next_out, et = j.output, Ce = ee - (O - j.avail_out), be = ee + (j.avail_out - 257), Xe = lt.dmax, ce = lt.wsize, Le = lt.whave, ht = lt.wnext, Ye = lt.window, Ge = lt.hold, Qe = lt.bits, xt = lt.lencode, ot = lt.distcode, it = (1 << lt.lenbits) - 1, ut = (1 << lt.distbits) - 1;
              e:
                do {
                  Qe < 15 && (Ge += ft[J++] << Qe, Qe += 8, Ge += ft[J++] << Qe, Qe += 8), st = xt[Ge & it];
                  t:
                    for (; ; ) {
                      if (Ze = st >>> 24, Ge >>>= Ze, Qe -= Ze, Ze = st >>> 16 & 255, Ze === 0)
                        et[ee++] = st & 65535;
                      else if (Ze & 16) {
                        ct = st & 65535, Ze &= 15, Ze && (Qe < Ze && (Ge += ft[J++] << Qe, Qe += 8), ct += Ge & (1 << Ze) - 1, Ge >>>= Ze, Qe -= Ze), Qe < 15 && (Ge += ft[J++] << Qe, Qe += 8, Ge += ft[J++] << Qe, Qe += 8), st = ot[Ge & ut];
                        i:
                          for (; ; ) {
                            if (Ze = st >>> 24, Ge >>>= Ze, Qe -= Ze, Ze = st >>> 16 & 255, Ze & 16) {
                              if (Et = st & 65535, Ze &= 15, Qe < Ze && (Ge += ft[J++] << Qe, Qe += 8, Qe < Ze && (Ge += ft[J++] << Qe, Qe += 8)), Et += Ge & (1 << Ze) - 1, Et > Xe) {
                                j.msg = "invalid distance too far back", lt.mode = mi;
                                break e;
                              }
                              if (Ge >>>= Ze, Qe -= Ze, Ze = ee - Ce, Et > Ze) {
                                if (Ze = Et - Ze, Ze > Le && lt.sane) {
                                  j.msg = "invalid distance too far back", lt.mode = mi;
                                  break e;
                                }
                                if (Je = 0, gt = Ye, ht === 0) {
                                  if (Je += ce - Ze, Ze < ct) {
                                    ct -= Ze;
                                    do
                                      et[ee++] = Ye[Je++];
                                    while (--Ze);
                                    Je = ee - Et, gt = et;
                                  }
                                } else if (ht < Ze) {
                                  if (Je += ce + ht - Ze, Ze -= ht, Ze < ct) {
                                    ct -= Ze;
                                    do
                                      et[ee++] = Ye[Je++];
                                    while (--Ze);
                                    if (Je = 0, ht < ct) {
                                      Ze = ht, ct -= Ze;
                                      do
                                        et[ee++] = Ye[Je++];
                                      while (--Ze);
                                      Je = ee - Et, gt = et;
                                    }
                                  }
                                } else if (Je += ht - Ze, Ze < ct) {
                                  ct -= Ze;
                                  do
                                    et[ee++] = Ye[Je++];
                                  while (--Ze);
                                  Je = ee - Et, gt = et;
                                }
                                for (; ct > 2; )
                                  et[ee++] = gt[Je++], et[ee++] = gt[Je++], et[ee++] = gt[Je++], ct -= 3;
                                ct && (et[ee++] = gt[Je++], ct > 1 && (et[ee++] = gt[Je++]));
                              } else {
                                Je = ee - Et;
                                do
                                  et[ee++] = et[Je++], et[ee++] = et[Je++], et[ee++] = et[Je++], ct -= 3;
                                while (ct > 2);
                                ct && (et[ee++] = et[Je++], ct > 1 && (et[ee++] = et[Je++]));
                              }
                            } else if (Ze & 64) {
                              j.msg = "invalid distance code", lt.mode = mi;
                              break e;
                            } else {
                              st = ot[(st & 65535) + (Ge & (1 << Ze) - 1)];
                              continue i;
                            }
                            break;
                          }
                      } else if (Ze & 64)
                        if (Ze & 32) {
                          lt.mode = Kn;
                          break e;
                        } else {
                          j.msg = "invalid literal/length code", lt.mode = mi;
                          break e;
                        }
                      else {
                        st = xt[(st & 65535) + (Ge & (1 << Ze) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (J < te && ee < be);
              ct = Qe >> 3, J -= ct, Qe -= ct << 3, Ge &= (1 << Qe) - 1, j.next_in = J, j.next_out = ee, j.avail_in = J < te ? 5 + (te - J) : 5 - (J - te), j.avail_out = ee < be ? 257 + (be - ee) : 257 - (ee - be), lt.hold = Ge, lt.bits = Qe;
            };
            const Jt = 15, qi = 852, er = 592, tr = 0, zi = 1, ir = 2, Yn = 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
            ]), Xn = 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
            ]), Qn = 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
            ]), Jn = 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 li = (v, j, O, J, te, ee, Ce, be) => {
              const Xe = be.bits;
              let ce = 0, Le = 0, ht = 0, Ye = 0, Ge = 0, Qe = 0, xt = 0, ot = 0, it = 0, ut = 0, st, Ze, ct, Et, Je, gt = null, ft;
              const et = new Uint16Array(Jt + 1), lt = new Uint16Array(Jt + 1);
              let Ht = null, Xr, Mi, Ai;
              for (ce = 0; ce <= Jt; ce++)
                et[ce] = 0;
              for (Le = 0; Le < J; Le++)
                et[j[O + Le]]++;
              for (Ge = Xe, Ye = Jt; Ye >= 1 && et[Ye] === 0; Ye--)
                ;
              if (Ge > Ye && (Ge = Ye), Ye === 0)
                return te[ee++] = 1 << 24 | 64 << 16 | 0, te[ee++] = 1 << 24 | 64 << 16 | 0, be.bits = 1, 0;
              for (ht = 1; ht < Ye && et[ht] === 0; ht++)
                ;
              for (Ge < ht && (Ge = ht), ot = 1, ce = 1; ce <= Jt; ce++)
                if (ot <<= 1, ot -= et[ce], ot < 0)
                  return -1;
              if (ot > 0 && (v === tr || Ye !== 1))
                return -1;
              for (lt[1] = 0, ce = 1; ce < Jt; ce++)
                lt[ce + 1] = lt[ce] + et[ce];
              for (Le = 0; Le < J; Le++)
                j[O + Le] !== 0 && (Ce[lt[j[O + Le]]++] = Le);
              if (v === tr ? (gt = Ht = Ce, ft = 20) : v === zi ? (gt = Yn, Ht = Xn, ft = 257) : (gt = Qn, Ht = Jn, ft = 0), ut = 0, Le = 0, ce = ht, Je = ee, Qe = Ge, xt = 0, ct = -1, it = 1 << Ge, Et = it - 1, v === zi && it > qi || v === ir && it > er)
                return 1;
              for (; ; ) {
                Xr = ce - xt, Ce[Le] + 1 < ft ? (Mi = 0, Ai = Ce[Le]) : Ce[Le] >= ft ? (Mi = Ht[Ce[Le] - ft], Ai = gt[Ce[Le] - ft]) : (Mi = 96, Ai = 0), st = 1 << ce - xt, Ze = 1 << Qe, ht = Ze;
                do
                  Ze -= st, te[Je + (ut >> xt) + Ze] = Xr << 24 | Mi << 16 | Ai | 0;
                while (Ze !== 0);
                for (st = 1 << ce - 1; ut & st; )
                  st >>= 1;
                if (st !== 0 ? (ut &= st - 1, ut += st) : ut = 0, Le++, --et[ce] === 0) {
                  if (ce === Ye)
                    break;
                  ce = j[O + Ce[Le]];
                }
                if (ce > Ge && (ut & Et) !== ct) {
                  for (xt === 0 && (xt = Ge), Je += ht, Qe = ce - xt, ot = 1 << Qe; Qe + xt < Ye && (ot -= et[Qe + xt], !(ot <= 0)); )
                    Qe++, ot <<= 1;
                  if (it += 1 << Qe, v === zi && it > qi || v === ir && it > er)
                    return 1;
                  ct = ut & Et, te[ct] = Ge << 24 | Qe << 16 | Je - ee | 0;
                }
              }
              return ut !== 0 && (te[Je + ut] = ce - xt << 24 | 64 << 16 | 0), be.bits = Ge, 0;
            };
            const qn = 0, rr = 1, nr = 2, {
              Z_FINISH: sr,
              Z_BLOCK: es,
              Z_TREES: bi,
              Z_OK: Vt,
              Z_STREAM_END: ts,
              Z_NEED_DICT: is,
              Z_STREAM_ERROR: St,
              Z_DATA_ERROR: ar,
              Z_MEM_ERROR: lr,
              Z_BUF_ERROR: rs,
              Z_DEFLATED: or
            } = ve, xi = 16180, fr = 16181, hr = 16182, dr = 16183, cr = 16184, ur = 16185, _r = 16186, pr = 16187, gr = 16188, vr = 16189, yi = 16190, Rt = 16191, $i = 16192, mr = 16193, Bi = 16194, br = 16195, xr = 16196, yr = 16197, wr = 16198, wi = 16199, Ei = 16200, Er = 16201, Mr = 16202, Ar = 16203, Cr = 16204, Lr = 16205, ki = 16206, Dr = 16207, Sr = 16208, bt = 16209, Or = 16210, Tr = 16211, ns = 852, ss = 592, as = 15, Pr = (v) => (v >>> 24 & 255) + (v >>> 8 & 65280) + ((v & 65280) << 8) + ((v & 255) << 24);
            function ls() {
              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 jt = (v) => {
              if (!v)
                return 1;
              const j = v.state;
              return !j || j.strm !== v || j.mode < xi || j.mode > Tr ? 1 : 0;
            }, Ir = (v) => {
              if (jt(v))
                return St;
              const j = v.state;
              return v.total_in = v.total_out = j.total = 0, v.msg = "", j.wrap && (v.adler = j.wrap & 1), j.mode = xi, 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(ns), j.distcode = j.distdyn = new Int32Array(ss), j.sane = 1, j.back = -1, Vt;
            }, Rr = (v) => {
              if (jt(v))
                return St;
              const j = v.state;
              return j.wsize = 0, j.whave = 0, j.wnext = 0, Ir(v);
            }, zr = (v, j) => {
              let O;
              if (jt(v))
                return St;
              const J = v.state;
              return j < 0 ? (O = 0, j = -j) : (O = (j >> 4) + 5, j < 48 && (j &= 15)), j && (j < 8 || j > 15) ? St : (J.window !== null && J.wbits !== j && (J.window = null), J.wrap = O, J.wbits = j, Rr(v));
            }, $r = (v, j) => {
              if (!v)
                return St;
              const O = new ls();
              v.state = O, O.strm = v, O.window = null, O.mode = xi;
              const J = zr(v, j);
              return J !== Vt && (v.state = null), J;
            }, os = (v) => $r(v, as);
            let Br = !0, Fi, Ui;
            const fs = (v) => {
              if (Br) {
                Fi = new Int32Array(512), Ui = new Int32Array(32);
                let j = 0;
                for (; j < 144; )
                  v.lens[j++] = 8;
                for (; j < 256; )
                  v.lens[j++] = 9;
                for (; j < 280; )
                  v.lens[j++] = 7;
                for (; j < 288; )
                  v.lens[j++] = 8;
                for (li(rr, v.lens, 0, 288, Fi, 0, v.work, { bits: 9 }), j = 0; j < 32; )
                  v.lens[j++] = 5;
                li(nr, v.lens, 0, 32, Ui, 0, v.work, { bits: 5 }), Br = !1;
              }
              v.lencode = Fi, v.lenbits = 9, v.distcode = Ui, v.distbits = 5;
            }, kr = (v, j, O, J) => {
              let te;
              const ee = v.state;
              return ee.window === null && (ee.wsize = 1 << ee.wbits, ee.wnext = 0, ee.whave = 0, ee.window = new Uint8Array(ee.wsize)), J >= ee.wsize ? (ee.window.set(j.subarray(O - ee.wsize, O), 0), ee.wnext = 0, ee.whave = ee.wsize) : (te = ee.wsize - ee.wnext, te > J && (te = J), ee.window.set(j.subarray(O - J, O - J + te), ee.wnext), J -= te, J ? (ee.window.set(j.subarray(O - J, O), 0), ee.wnext = J, ee.whave = ee.wsize) : (ee.wnext += te, ee.wnext === ee.wsize && (ee.wnext = 0), ee.whave < ee.wsize && (ee.whave += te))), 0;
            }, hs = (v, j) => {
              let O, J, te, ee, Ce, be, Xe, ce, Le, ht, Ye, Ge, Qe, xt, ot = 0, it, ut, st, Ze, ct, Et, Je, gt;
              const ft = new Uint8Array(4);
              let et, lt;
              const Ht = (
                /* 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 (jt(v) || !v.output || !v.input && v.avail_in !== 0)
                return St;
              O = v.state, O.mode === Rt && (O.mode = $i), Ce = v.next_out, te = v.output, Xe = v.avail_out, ee = v.next_in, J = v.input, be = v.avail_in, ce = O.hold, Le = O.bits, ht = be, Ye = Xe, gt = Vt;
              e:
                for (; ; )
                  switch (O.mode) {
                    case xi:
                      if (O.wrap === 0) {
                        O.mode = $i;
                        break;
                      }
                      for (; Le < 16; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if (O.wrap & 2 && ce === 35615) {
                        O.wbits === 0 && (O.wbits = 15), O.check = 0, ft[0] = ce & 255, ft[1] = ce >>> 8 & 255, O.check = I(O.check, ft, 2, 0), ce = 0, Le = 0, O.mode = fr;
                        break;
                      }
                      if (O.head && (O.head.done = !1), !(O.wrap & 1) || /* check if zlib header allowed */
                      (((ce & 255) << 8) + (ce >> 8)) % 31) {
                        v.msg = "incorrect header check", O.mode = bt;
                        break;
                      }
                      if ((ce & 15) !== or) {
                        v.msg = "unknown compression method", O.mode = bt;
                        break;
                      }
                      if (ce >>>= 4, Le -= 4, Je = (ce & 15) + 8, O.wbits === 0 && (O.wbits = Je), Je > 15 || Je > O.wbits) {
                        v.msg = "invalid window size", O.mode = bt;
                        break;
                      }
                      O.dmax = 1 << O.wbits, O.flags = 0, v.adler = O.check = 1, O.mode = ce & 512 ? vr : Rt, ce = 0, Le = 0;
                      break;
                    case fr:
                      for (; Le < 16; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if (O.flags = ce, (O.flags & 255) !== or) {
                        v.msg = "unknown compression method", O.mode = bt;
                        break;
                      }
                      if (O.flags & 57344) {
                        v.msg = "unknown header flags set", O.mode = bt;
                        break;
                      }
                      O.head && (O.head.text = ce >> 8 & 1), O.flags & 512 && O.wrap & 4 && (ft[0] = ce & 255, ft[1] = ce >>> 8 & 255, O.check = I(O.check, ft, 2, 0)), ce = 0, Le = 0, O.mode = hr;
                    case hr:
                      for (; Le < 32; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      O.head && (O.head.time = ce), O.flags & 512 && O.wrap & 4 && (ft[0] = ce & 255, ft[1] = ce >>> 8 & 255, ft[2] = ce >>> 16 & 255, ft[3] = ce >>> 24 & 255, O.check = I(O.check, ft, 4, 0)), ce = 0, Le = 0, O.mode = dr;
                    case dr:
                      for (; Le < 16; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      O.head && (O.head.xflags = ce & 255, O.head.os = ce >> 8), O.flags & 512 && O.wrap & 4 && (ft[0] = ce & 255, ft[1] = ce >>> 8 & 255, O.check = I(O.check, ft, 2, 0)), ce = 0, Le = 0, O.mode = cr;
                    case cr:
                      if (O.flags & 1024) {
                        for (; Le < 16; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        O.length = ce, O.head && (O.head.extra_len = ce), O.flags & 512 && O.wrap & 4 && (ft[0] = ce & 255, ft[1] = ce >>> 8 & 255, O.check = I(O.check, ft, 2, 0)), ce = 0, Le = 0;
                      } else
                        O.head && (O.head.extra = null);
                      O.mode = ur;
                    case ur:
                      if (O.flags & 1024 && (Ge = O.length, Ge > be && (Ge = be), Ge && (O.head && (Je = O.head.extra_len - O.length, O.head.extra || (O.head.extra = new Uint8Array(O.head.extra_len)), O.head.extra.set(
                        J.subarray(
                          ee,
                          // extra field is limited to 65536 bytes
                          // - no need for additional size check
                          ee + Ge
                        ),
                        /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                        Je
                      )), O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, Ge, ee)), be -= Ge, ee += Ge, O.length -= Ge), O.length))
                        break e;
                      O.length = 0, O.mode = _r;
                    case _r:
                      if (O.flags & 2048) {
                        if (be === 0)
                          break e;
                        Ge = 0;
                        do
                          Je = J[ee + Ge++], O.head && Je && O.length < 65536 && (O.head.name += String.fromCharCode(Je));
                        while (Je && Ge < be);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, Ge, ee)), be -= Ge, ee += Ge, Je)
                          break e;
                      } else
                        O.head && (O.head.name = null);
                      O.length = 0, O.mode = pr;
                    case pr:
                      if (O.flags & 4096) {
                        if (be === 0)
                          break e;
                        Ge = 0;
                        do
                          Je = J[ee + Ge++], O.head && Je && O.length < 65536 && (O.head.comment += String.fromCharCode(Je));
                        while (Je && Ge < be);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = I(O.check, J, Ge, ee)), be -= Ge, ee += Ge, Je)
                          break e;
                      } else
                        O.head && (O.head.comment = null);
                      O.mode = gr;
                    case gr:
                      if (O.flags & 512) {
                        for (; Le < 16; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        if (O.wrap & 4 && ce !== (O.check & 65535)) {
                          v.msg = "header crc mismatch", O.mode = bt;
                          break;
                        }
                        ce = 0, Le = 0;
                      }
                      O.head && (O.head.hcrc = O.flags >> 9 & 1, O.head.done = !0), v.adler = O.check = 0, O.mode = Rt;
                      break;
                    case vr:
                      for (; Le < 32; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      v.adler = O.check = Pr(ce), ce = 0, Le = 0, O.mode = yi;
                    case yi:
                      if (O.havedict === 0)
                        return v.next_out = Ce, v.avail_out = Xe, v.next_in = ee, v.avail_in = be, O.hold = ce, O.bits = Le, is;
                      v.adler = O.check = 1, O.mode = Rt;
                    case Rt:
                      if (j === es || j === bi)
                        break e;
                    case $i:
                      if (O.last) {
                        ce >>>= Le & 7, Le -= Le & 7, O.mode = ki;
                        break;
                      }
                      for (; Le < 3; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      switch (O.last = ce & 1, ce >>>= 1, Le -= 1, ce & 3) {
                        case 0:
                          O.mode = mr;
                          break;
                        case 1:
                          if (fs(O), O.mode = wi, j === bi) {
                            ce >>>= 2, Le -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          O.mode = xr;
                          break;
                        case 3:
                          v.msg = "invalid block type", O.mode = bt;
                      }
                      ce >>>= 2, Le -= 2;
                      break;
                    case mr:
                      for (ce >>>= Le & 7, Le -= Le & 7; Le < 32; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if ((ce & 65535) !== (ce >>> 16 ^ 65535)) {
                        v.msg = "invalid stored block lengths", O.mode = bt;
                        break;
                      }
                      if (O.length = ce & 65535, ce = 0, Le = 0, O.mode = Bi, j === bi)
                        break e;
                    case Bi:
                      O.mode = br;
                    case br:
                      if (Ge = O.length, Ge) {
                        if (Ge > be && (Ge = be), Ge > Xe && (Ge = Xe), Ge === 0)
                          break e;
                        te.set(J.subarray(ee, ee + Ge), Ce), be -= Ge, ee += Ge, Xe -= Ge, Ce += Ge, O.length -= Ge;
                        break;
                      }
                      O.mode = Rt;
                      break;
                    case xr:
                      for (; Le < 14; ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if (O.nlen = (ce & 31) + 257, ce >>>= 5, Le -= 5, O.ndist = (ce & 31) + 1, ce >>>= 5, Le -= 5, O.ncode = (ce & 15) + 4, ce >>>= 4, Le -= 4, O.nlen > 286 || O.ndist > 30) {
                        v.msg = "too many length or distance symbols", O.mode = bt;
                        break;
                      }
                      O.have = 0, O.mode = yr;
                    case yr:
                      for (; O.have < O.ncode; ) {
                        for (; Le < 3; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        O.lens[Ht[O.have++]] = ce & 7, ce >>>= 3, Le -= 3;
                      }
                      for (; O.have < 19; )
                        O.lens[Ht[O.have++]] = 0;
                      if (O.lencode = O.lendyn, O.lenbits = 7, et = { bits: O.lenbits }, gt = li(qn, O.lens, 0, 19, O.lencode, 0, O.work, et), O.lenbits = et.bits, gt) {
                        v.msg = "invalid code lengths set", O.mode = bt;
                        break;
                      }
                      O.have = 0, O.mode = wr;
                    case wr:
                      for (; O.have < O.nlen + O.ndist; ) {
                        for (; ot = O.lencode[ce & (1 << O.lenbits) - 1], it = ot >>> 24, ut = ot >>> 16 & 255, st = ot & 65535, !(it <= Le); ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        if (st < 16)
                          ce >>>= it, Le -= it, O.lens[O.have++] = st;
                        else {
                          if (st === 16) {
                            for (lt = it + 2; Le < lt; ) {
                              if (be === 0)
                                break e;
                              be--, ce += J[ee++] << Le, Le += 8;
                            }
                            if (ce >>>= it, Le -= it, O.have === 0) {
                              v.msg = "invalid bit length repeat", O.mode = bt;
                              break;
                            }
                            Je = O.lens[O.have - 1], Ge = 3 + (ce & 3), ce >>>= 2, Le -= 2;
                          } else if (st === 17) {
                            for (lt = it + 3; Le < lt; ) {
                              if (be === 0)
                                break e;
                              be--, ce += J[ee++] << Le, Le += 8;
                            }
                            ce >>>= it, Le -= it, Je = 0, Ge = 3 + (ce & 7), ce >>>= 3, Le -= 3;
                          } else {
                            for (lt = it + 7; Le < lt; ) {
                              if (be === 0)
                                break e;
                              be--, ce += J[ee++] << Le, Le += 8;
                            }
                            ce >>>= it, Le -= it, Je = 0, Ge = 11 + (ce & 127), ce >>>= 7, Le -= 7;
                          }
                          if (O.have + Ge > O.nlen + O.ndist) {
                            v.msg = "invalid bit length repeat", O.mode = bt;
                            break;
                          }
                          for (; Ge--; )
                            O.lens[O.have++] = Je;
                        }
                      }
                      if (O.mode === bt)
                        break;
                      if (O.lens[256] === 0) {
                        v.msg = "invalid code -- missing end-of-block", O.mode = bt;
                        break;
                      }
                      if (O.lenbits = 9, et = { bits: O.lenbits }, gt = li(rr, O.lens, 0, O.nlen, O.lencode, 0, O.work, et), O.lenbits = et.bits, gt) {
                        v.msg = "invalid literal/lengths set", O.mode = bt;
                        break;
                      }
                      if (O.distbits = 6, O.distcode = O.distdyn, et = { bits: O.distbits }, gt = li(nr, O.lens, O.nlen, O.ndist, O.distcode, 0, O.work, et), O.distbits = et.bits, gt) {
                        v.msg = "invalid distances set", O.mode = bt;
                        break;
                      }
                      if (O.mode = wi, j === bi)
                        break e;
                    case wi:
                      O.mode = Ei;
                    case Ei:
                      if (be >= 6 && Xe >= 258) {
                        v.next_out = Ce, v.avail_out = Xe, v.next_in = ee, v.avail_in = be, O.hold = ce, O.bits = Le, Zn(v, Ye), Ce = v.next_out, te = v.output, Xe = v.avail_out, ee = v.next_in, J = v.input, be = v.avail_in, ce = O.hold, Le = O.bits, O.mode === Rt && (O.back = -1);
                        break;
                      }
                      for (O.back = 0; ot = O.lencode[ce & (1 << O.lenbits) - 1], it = ot >>> 24, ut = ot >>> 16 & 255, st = ot & 65535, !(it <= Le); ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if (ut && !(ut & 240)) {
                        for (Ze = it, ct = ut, Et = st; ot = O.lencode[Et + ((ce & (1 << Ze + ct) - 1) >> Ze)], it = ot >>> 24, ut = ot >>> 16 & 255, st = ot & 65535, !(Ze + it <= Le); ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        ce >>>= Ze, Le -= Ze, O.back += Ze;
                      }
                      if (ce >>>= it, Le -= it, O.back += it, O.length = st, ut === 0) {
                        O.mode = Lr;
                        break;
                      }
                      if (ut & 32) {
                        O.back = -1, O.mode = Rt;
                        break;
                      }
                      if (ut & 64) {
                        v.msg = "invalid literal/length code", O.mode = bt;
                        break;
                      }
                      O.extra = ut & 15, O.mode = Er;
                    case Er:
                      if (O.extra) {
                        for (lt = O.extra; Le < lt; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        O.length += ce & (1 << O.extra) - 1, ce >>>= O.extra, Le -= O.extra, O.back += O.extra;
                      }
                      O.was = O.length, O.mode = Mr;
                    case Mr:
                      for (; ot = O.distcode[ce & (1 << O.distbits) - 1], it = ot >>> 24, ut = ot >>> 16 & 255, st = ot & 65535, !(it <= Le); ) {
                        if (be === 0)
                          break e;
                        be--, ce += J[ee++] << Le, Le += 8;
                      }
                      if (!(ut & 240)) {
                        for (Ze = it, ct = ut, Et = st; ot = O.distcode[Et + ((ce & (1 << Ze + ct) - 1) >> Ze)], it = ot >>> 24, ut = ot >>> 16 & 255, st = ot & 65535, !(Ze + it <= Le); ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        ce >>>= Ze, Le -= Ze, O.back += Ze;
                      }
                      if (ce >>>= it, Le -= it, O.back += it, ut & 64) {
                        v.msg = "invalid distance code", O.mode = bt;
                        break;
                      }
                      O.offset = st, O.extra = ut & 15, O.mode = Ar;
                    case Ar:
                      if (O.extra) {
                        for (lt = O.extra; Le < lt; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        O.offset += ce & (1 << O.extra) - 1, ce >>>= O.extra, Le -= O.extra, O.back += O.extra;
                      }
                      if (O.offset > O.dmax) {
                        v.msg = "invalid distance too far back", O.mode = bt;
                        break;
                      }
                      O.mode = Cr;
                    case Cr:
                      if (Xe === 0)
                        break e;
                      if (Ge = Ye - Xe, O.offset > Ge) {
                        if (Ge = O.offset - Ge, Ge > O.whave && O.sane) {
                          v.msg = "invalid distance too far back", O.mode = bt;
                          break;
                        }
                        Ge > O.wnext ? (Ge -= O.wnext, Qe = O.wsize - Ge) : Qe = O.wnext - Ge, Ge > O.length && (Ge = O.length), xt = O.window;
                      } else
                        xt = te, Qe = Ce - O.offset, Ge = O.length;
                      Ge > Xe && (Ge = Xe), Xe -= Ge, O.length -= Ge;
                      do
                        te[Ce++] = xt[Qe++];
                      while (--Ge);
                      O.length === 0 && (O.mode = Ei);
                      break;
                    case Lr:
                      if (Xe === 0)
                        break e;
                      te[Ce++] = O.length, Xe--, O.mode = Ei;
                      break;
                    case ki:
                      if (O.wrap) {
                        for (; Le < 32; ) {
                          if (be === 0)
                            break e;
                          be--, ce |= J[ee++] << Le, Le += 8;
                        }
                        if (Ye -= Xe, v.total_out += Ye, O.total += Ye, O.wrap & 4 && Ye && (v.adler = O.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
                        O.flags ? I(O.check, te, Ye, Ce - Ye) : De(O.check, te, Ye, Ce - Ye)), Ye = Xe, O.wrap & 4 && (O.flags ? ce : Pr(ce)) !== O.check) {
                          v.msg = "incorrect data check", O.mode = bt;
                          break;
                        }
                        ce = 0, Le = 0;
                      }
                      O.mode = Dr;
                    case Dr:
                      if (O.wrap && O.flags) {
                        for (; Le < 32; ) {
                          if (be === 0)
                            break e;
                          be--, ce += J[ee++] << Le, Le += 8;
                        }
                        if (O.wrap & 4 && ce !== (O.total & 4294967295)) {
                          v.msg = "incorrect length check", O.mode = bt;
                          break;
                        }
                        ce = 0, Le = 0;
                      }
                      O.mode = Sr;
                    case Sr:
                      gt = ts;
                      break e;
                    case bt:
                      gt = ar;
                      break e;
                    case Or:
                      return lr;
                    case Tr:
                    default:
                      return St;
                  }
              return v.next_out = Ce, v.avail_out = Xe, v.next_in = ee, v.avail_in = be, O.hold = ce, O.bits = Le, (O.wsize || Ye !== v.avail_out && O.mode < bt && (O.mode < ki || j !== sr)) && kr(v, v.output, v.next_out, Ye - v.avail_out), ht -= v.avail_in, Ye -= v.avail_out, v.total_in += ht, v.total_out += Ye, O.total += Ye, O.wrap & 4 && Ye && (v.adler = O.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
              O.flags ? I(O.check, te, Ye, v.next_out - Ye) : De(O.check, te, Ye, v.next_out - Ye)), v.data_type = O.bits + (O.last ? 64 : 0) + (O.mode === Rt ? 128 : 0) + (O.mode === wi || O.mode === Bi ? 256 : 0), (ht === 0 && Ye === 0 || j === sr) && gt === Vt && (gt = rs), gt;
            }, ds = (v) => {
              if (jt(v))
                return St;
              let j = v.state;
              return j.window && (j.window = null), v.state = null, Vt;
            }, cs = (v, j) => {
              if (jt(v))
                return St;
              const O = v.state;
              return O.wrap & 2 ? (O.head = j, j.done = !1, Vt) : St;
            }, us = (v, j) => {
              const O = j.length;
              let J, te, ee;
              return jt(v) || (J = v.state, J.wrap !== 0 && J.mode !== yi) ? St : J.mode === yi && (te = 1, te = De(te, j, O, 0), te !== J.check) ? ar : (ee = kr(v, j, O, O), ee ? (J.mode = Or, lr) : (J.havedict = 1, Vt));
            };
            var _s = Rr, ps = zr, gs = Ir, vs = os, ms = $r, bs = hs, xs = ds, ys = cs, ws = us, Es = "pako inflate (from Nodeca project)", zt = {
              inflateReset: _s,
              inflateReset2: ps,
              inflateResetKeep: gs,
              inflateInit: vs,
              inflateInit2: ms,
              inflate: bs,
              inflateEnd: xs,
              inflateGetHeader: ys,
              inflateSetDictionary: ws,
              inflateInfo: Es
            };
            function Ms() {
              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 As = Ms;
            const Fr = Object.prototype.toString, {
              Z_NO_FLUSH: Cs,
              Z_FINISH: Ls,
              Z_OK: oi,
              Z_STREAM_END: Wi,
              Z_NEED_DICT: Gi,
              Z_STREAM_ERROR: Ds,
              Z_DATA_ERROR: Ur,
              Z_MEM_ERROR: Ss
            } = ve;
            function fi(v) {
              this.options = gi.assign({
                chunkSize: 65536,
                windowBits: 15,
                to: ""
              }, v || {});
              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 && !(v && v.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 Qi(), this.strm.avail_out = 0;
              let O = zt.inflateInit2(
                this.strm,
                j.windowBits
              );
              if (O !== oi)
                throw new Error(me[O]);
              if (this.header = new As(), zt.inflateGetHeader(this.strm, this.header), j.dictionary && (typeof j.dictionary == "string" ? j.dictionary = si.string2buf(j.dictionary) : Fr.call(j.dictionary) === "[object ArrayBuffer]" && (j.dictionary = new Uint8Array(j.dictionary)), j.raw && (O = zt.inflateSetDictionary(this.strm, j.dictionary), O !== oi)))
                throw new Error(me[O]);
            }
            fi.prototype.push = function(v, j) {
              const O = this.strm, J = this.options.chunkSize, te = this.options.dictionary;
              let ee, Ce, be;
              if (this.ended)
                return !1;
              for (j === ~~j ? Ce = j : Ce = j === !0 ? Ls : Cs, Fr.call(v) === "[object ArrayBuffer]" ? O.input = new Uint8Array(v) : O.input = v, 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), ee = zt.inflate(O, Ce), ee === Gi && te && (ee = zt.inflateSetDictionary(O, te), ee === oi ? ee = zt.inflate(O, Ce) : ee === Ur && (ee = Gi)); O.avail_in > 0 && ee === Wi && O.state.wrap > 0 && v[O.next_in] !== 0; )
                  zt.inflateReset(O), ee = zt.inflate(O, Ce);
                switch (ee) {
                  case Ds:
                  case Ur:
                  case Gi:
                  case Ss:
                    return this.onEnd(ee), this.ended = !0, !1;
                }
                if (be = O.avail_out, O.next_out && (O.avail_out === 0 || ee === Wi))
                  if (this.options.to === "string") {
                    let Xe = si.utf8border(O.output, O.next_out), ce = O.next_out - Xe, Le = si.buf2string(O.output, Xe);
                    O.next_out = ce, O.avail_out = J - ce, ce && O.output.set(O.output.subarray(Xe, Xe + ce), 0), this.onData(Le);
                  } else
                    this.onData(O.output.length === O.next_out ? O.output : O.output.subarray(0, O.next_out));
                if (!(ee === oi && be === 0)) {
                  if (ee === Wi)
                    return ee = zt.inflateEnd(this.strm), this.onEnd(ee), this.ended = !0, !0;
                  if (O.avail_in === 0)
                    break;
                }
              }
              return !0;
            }, fi.prototype.onData = function(v) {
              this.chunks.push(v);
            }, fi.prototype.onEnd = function(v) {
              v === oi && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = gi.flattenChunks(this.chunks)), this.chunks = [], this.err = v, this.msg = this.strm.msg;
            };
            function Ni(v, j) {
              const O = new fi(j);
              if (O.push(v), O.err)
                throw O.msg || me[O.err];
              return O.result;
            }
            function Os(v, j) {
              return j = j || {}, j.raw = !0, Ni(v, j);
            }
            var Ts = fi, Ps = Ni, Is = Os, Rs = Ni, zs = ve, $s = {
              Inflate: Ts,
              inflate: Ps,
              inflateRaw: Is,
              ungzip: Rs,
              constants: zs
            };
            const { Deflate: Bs, deflate: ks, deflateRaw: Fs, gzip: Us } = Hn, { Inflate: Ws, inflate: Gs, inflateRaw: Ns, ungzip: Vs } = $s;
            var Wr = Bs, Gr = ks, Nr = Fs, Vr = Us, jr = Ws, Hr = Gs, Kr = Ns, Zr = Vs, Yr = ve, js = {
              Deflate: Wr,
              deflate: Gr,
              deflateRaw: Nr,
              gzip: Vr,
              Inflate: jr,
              inflate: Hr,
              inflateRaw: Kr,
              ungzip: Zr,
              constants: Yr
            };
          }
        )
        /******/
      }, __webpack_module_cache__ = {};
      function __webpack_require__(y) {
        var s = __webpack_module_cache__[y];
        if (s !== void 0)
          return s.exports;
        var e = __webpack_module_cache__[y] = {
          /******/
          // no module.id needed
          /******/
          // no module.loaded needed
          /******/
          exports: {}
          /******/
        };
        return __webpack_modules__[y].call(e.exports, e, e.exports, __webpack_require__), e.exports;
      }
      __webpack_require__.n = (y) => {
        var s = y && y.__esModule ? (
          /******/
          () => y.default
        ) : (
          /******/
          () => y
        );
        return __webpack_require__.d(s, { a: s }), s;
      }, __webpack_require__.d = (y, s) => {
        for (var e in s)
          __webpack_require__.o(s, e) && !__webpack_require__.o(y, e) && Object.defineProperty(y, e, { enumerable: !0, get: s[e] });
      }, __webpack_require__.o = (y, s) => Object.prototype.hasOwnProperty.call(y, s), __webpack_require__.r = (y) => {
        typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(y, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(y, "__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);
var _3DmolExports = _3Dmol.exports;
const Dmol = /* @__PURE__ */ getDefaultExportFromCjs(_3DmolExports), Molecule_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$7,
  append: append$5,
  attr: attr$6,
  binding_callbacks: binding_callbacks$4,
  detach: detach$7,
  element: element$6,
  init: init$7,
  insert: insert$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$5,
  text: text$5,
  toggle_class: toggle_class$5
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$3, afterUpdate: afterUpdate$2 } = window.__gradio__svelte__internal;
function create_if_block$5(y) {
  let s, e, l, p, _, x, o, g, E, u, A, L, C, D, r, n, b, f, c, t, a, h, M, w, S;
  function T(U, z) {
    return (
      /*attachmentIndex*/
      U[1] !== null ? create_if_block_2$3 : create_else_block_1$2
    );
  }
  let R = T(y), $ = R(y);
  function P(U, z) {
    return (
      /*deleteIndexes*/
      U[2].length > 0 ? create_if_block_1$4 : create_else_block$4
    );
  }
  let B = P(y), F = B(y);
  return {
    c() {
      s = element$6("div"), s.textContent = "Covalent Modification", e = space$5(), l = element$6("div"), l.innerHTML = '<svg data-slot="icon" fill="none" stroke-width="1.5" class="w-4 h-4 svelte-1jhdl43" 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-1jhdl43"></path></svg> <span class="px-2 svelte-1jhdl43">click on atoms in viewer to select them</span>', p = space$5(), _ = element$6("div"), x = element$6("button"), x.innerHTML = '<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-1jhdl43"><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-1jhdl43"></path></svg> <span class="svelte-1jhdl43">Attachment atom</span>', o = space$5(), g = element$6("button"), g.innerHTML = '<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-1jhdl43"><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-1jhdl43"></path></svg> <span class="svelte-1jhdl43">Atoms to delete</span>', E = space$5(), u = element$6("div"), A = element$6("table"), L = element$6("thead"), L.innerHTML = '<tr class="svelte-1jhdl43"><th scope="col" class="px-6 py-3 svelte-1jhdl43"></th> <th scope="col" class="px-6 py-3 svelte-1jhdl43">index</th></tr>', C = space$5(), D = element$6("tbody"), r = element$6("tr"), n = element$6("th"), n.textContent = "Attachment atom", b = space$5(), f = element$6("td"), $.c(), c = space$5(), t = element$6("tr"), a = element$6("th"), a.textContent = "Deleted atoms", h = space$5(), M = element$6("td"), F.c(), attr$6(s, "class", "w-full text-center text-lg mb-2 svelte-1jhdl43"), attr$6(l, "class", "flex items-center space-x-2 justify-center mb-2 text-xs svelte-1jhdl43"), attr$6(x, "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-1jhdl43"), attr$6(x, "id", "attach"), toggle_class$5(
        x,
        "active",
        /*mode*/
        y[3] === "attach"
      ), attr$6(g, "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-1jhdl43"), attr$6(g, "id", "delete"), toggle_class$5(
        g,
        "active",
        /*mode*/
        y[3] === "delete"
      ), attr$6(_, "class", "flex rounded-full border-2 border-gray-200 bg-gray-200 text-sm leading-none text-gray-500 svelte-1jhdl43"), attr$6(L, "class", "text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400 svelte-1jhdl43"), attr$6(n, "scope", "row"), attr$6(n, "class", "px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white text-right svelte-1jhdl43"), attr$6(f, "class", "px-6 py-4 font-mono svelte-1jhdl43"), attr$6(r, "class", "bg-white border-b dark:bg-gray-800 dark:border-gray-700 svelte-1jhdl43"), attr$6(a, "scope", "row"), attr$6(a, "class", "px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white text-right svelte-1jhdl43"), attr$6(M, "class", "px-6 py-4 font-mono svelte-1jhdl43"), attr$6(t, "class", "bg-white dark:bg-gray-800 svelte-1jhdl43"), attr$6(D, "class", "svelte-1jhdl43"), attr$6(A, "class", "w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 svelte-1jhdl43"), attr$6(u, "class", "relative overflow-x-auto mt-3 svelte-1jhdl43");
    },
    m(U, z) {
      insert$7(U, s, z), insert$7(U, e, z), insert$7(U, l, z), insert$7(U, p, z), insert$7(U, _, z), append$5(_, x), append$5(_, o), append$5(_, g), insert$7(U, E, z), insert$7(U, u, z), append$5(u, A), append$5(A, L), append$5(A, C), append$5(A, D), append$5(D, r), append$5(r, n), append$5(r, b), append$5(r, f), $.m(f, null), append$5(D, c), append$5(D, t), append$5(t, a), append$5(t, h), append$5(t, M), F.m(M, null), w || (S = [
        listen$2(
          x,
          "click",
          /*click_handler*/
          y[7]
        ),
        listen$2(
          g,
          "click",
          /*click_handler_1*/
          y[8]
        )
      ], w = !0);
    },
    p(U, z) {
      z & /*mode*/
      8 && toggle_class$5(
        x,
        "active",
        /*mode*/
        U[3] === "attach"
      ), z & /*mode*/
      8 && toggle_class$5(
        g,
        "active",
        /*mode*/
        U[3] === "delete"
      ), R === (R = T(U)) && $ ? $.p(U, z) : ($.d(1), $ = R(U), $ && ($.c(), $.m(f, null))), B === (B = P(U)) && F ? F.p(U, z) : (F.d(1), F = B(U), F && (F.c(), F.m(M, null)));
    },
    d(U) {
      U && (detach$7(s), detach$7(e), detach$7(l), detach$7(p), detach$7(_), detach$7(E), detach$7(u)), $.d(), F.d(), w = !1, run_all$2(S);
    }
  };
}
function create_else_block_1$2(y) {
  let s;
  return {
    c() {
      s = text$5("not selected");
    },
    m(e, l) {
      insert$7(e, s, l);
    },
    p: noop$7,
    d(e) {
      e && detach$7(s);
    }
  };
}
function create_if_block_2$3(y) {
  let s;
  return {
    c() {
      s = text$5(
        /*attachmentIndex*/
        y[1]
      );
    },
    m(e, l) {
      insert$7(e, s, l);
    },
    p(e, l) {
      l & /*attachmentIndex*/
      2 && set_data$5(
        s,
        /*attachmentIndex*/
        e[1]
      );
    },
    d(e) {
      e && detach$7(s);
    }
  };
}
function create_else_block$4(y) {
  let s;
  return {
    c() {
      s = text$5("no atoms are deleted");
    },
    m(e, l) {
      insert$7(e, s, l);
    },
    p: noop$7,
    d(e) {
      e && detach$7(s);
    }
  };
}
function create_if_block_1$4(y) {
  let s = (
    /*deleteIndexes*/
    y[2].join(", ") + ""
  ), e;
  return {
    c() {
      e = text$5(s);
    },
    m(l, p) {
      insert$7(l, e, p);
    },
    p(l, p) {
      p & /*deleteIndexes*/
      4 && s !== (s = /*deleteIndexes*/
      l[2].join(", ") + "") && set_data$5(e, s);
    },
    d(l) {
      l && detach$7(e);
    }
  };
}
function create_fragment$7(y) {
  let s, e, l, p, _, x = (
    /*showCovMod*/
    y[0] > -1 && create_if_block$5(y)
  );
  return {
    c() {
      s = element$6("div"), e = element$6("div"), l = element$6("div"), p = space$5(), _ = element$6("div"), x && x.c(), attr$6(l, "class", "mol-canvas svelte-1jhdl43"), attr$6(e, "class", "relative svelte-1jhdl43"), attr$6(_, "class", "flex flex-col justify-center svelte-1jhdl43"), attr$6(s, "class", "mol-wrapper svelte-1jhdl43");
    },
    m(o, g) {
      insert$7(o, s, g), append$5(s, e), append$5(e, l), y[6](l), append$5(s, p), append$5(s, _), x && x.m(_, null);
    },
    p(o, [g]) {
      /*showCovMod*/
      o[0] > -1 ? x ? x.p(o, g) : (x = create_if_block$5(o), x.c(), x.m(_, null)) : x && (x.d(1), x = null);
    },
    i: noop$7,
    o: noop$7,
    d(o) {
      o && detach$7(s), y[6](null), x && x.d();
    }
  };
}
function instance$7(y, s, e) {
  const l = createEventDispatcher$3();
  let p = null, _ = [], x = "attach";
  function o(r) {
    r.setStyle({ stick: {} }), u > -1 && (p !== null && r.addStyle({ index: p }, { sphere: { color: "blue", scale: 0.5 } }), r.addStyle({ index: _ }, { sphere: { color: "red", scale: 0.5 } }), l("updateMol", {
      attachmentIndex: p,
      deleteIndexes: _,
      index: u,
      mol: r.exportJSON()
    }));
  }
  function g(r, n) {
    let b = Dmol.createViewer(n, {});
    return b.addModel(r, "sdf"), o(b), b.setBackgroundColor("white"), b.zoomTo(), b.getModel(0).setClickable({}, !0, function(f, c, t, a) {
      u > -1 && (x === "attach" ? e(1, p = f.serial) : (_.includes(f.serial) ? e(2, _ = _.filter((h) => h !== f.serial)) : _.push(f.serial), e(2, _), o(c)));
    }), b.render(), b;
  }
  let { molvalue: E = "" } = s, { showCovMod: u = -1 } = s, A = null;
  afterUpdate$2(() => {
    g(E, A);
  });
  function L(r) {
    binding_callbacks$4[r ? "unshift" : "push"](() => {
      A = r, e(4, A);
    });
  }
  const C = () => e(3, x = "attach"), D = () => e(3, x = "delete");
  return y.$$set = (r) => {
    "molvalue" in r && e(5, E = r.molvalue), "showCovMod" in r && e(0, u = r.showCovMod);
  }, [
    u,
    p,
    _,
    x,
    A,
    E,
    L,
    C,
    D
  ];
}
class Molecule extends SvelteComponent$7 {
  constructor(s) {
    super(), init$7(this, s, instance$7, create_fragment$7, safe_not_equal$8, { molvalue: 5, showCovMod: 0 });
  }
}
const Accordion_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$6,
  add_render_callback: add_render_callback$2,
  append: append$4,
  attr: attr$5,
  check_outros: check_outros$4,
  create_component: create_component$4,
  destroy_component: destroy_component$4,
  destroy_each: destroy_each$1,
  detach: detach$6,
  element: element$5,
  empty: empty$3,
  ensure_array_like: ensure_array_like$1,
  group_outros: group_outros$4,
  init: init$6,
  insert: insert$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$4,
  svg_element: svg_element$1,
  text: text$4,
  toggle_class: toggle_class$4,
  transition_in: transition_in$4,
  transition_out: transition_out$4
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal;
function get_each_context$1(y, s, e) {
  const l = y.slice();
  return l[35] = s[e], l[36] = s, l[37] = e, l;
}
function get_each_context_1$1(y, s, e) {
  const l = y.slice();
  return l[38] = s[e], l;
}
function get_each_context_2(y, s, e) {
  const l = y.slice();
  return l[41] = s[e], l;
}
function get_each_context_3(y, s, e) {
  const l = y.slice();
  return l[44] = s[e], l[37] = e, l;
}
function get_each_context_4(y, s, e) {
  const l = y.slice();
  return l[38] = s[e], l;
}
function get_each_context_5(y, s, e) {
  const l = y.slice();
  return l[48] = s[e], l[49] = s, l[37] = e, l;
}
function get_each_context_6(y, s, e) {
  const l = y.slice();
  return l[50] = s[e], l;
}
function create_if_block_11$1(y) {
  let s, e;
  function l(x, o) {
    return o[0] & /*vals*/
    1 && (s = null), s == null && (s = !!/*metals*/
    x[8].includes(
      /*item*/
      x[48].name
    )), s ? create_if_block_12$1 : create_else_block_2;
  }
  let p = l(y, [-1, -1]), _ = p(y);
  return {
    c() {
      _.c(), e = empty$3();
    },
    m(x, o) {
      _.m(x, o), insert$6(x, e, o);
    },
    p(x, o) {
      p === (p = l(x, o)) && _ ? _.p(x, o) : (_.d(1), _ = p(x), _ && (_.c(), _.m(e.parentNode, e)));
    },
    d(x) {
      x && detach$6(e), _.d(x);
    }
  };
}
function create_else_block_2(y) {
  let s = (
    /*item*/
    y[48].smiles + ""
  ), e;
  return {
    c() {
      e = text$4(s);
    },
    m(l, p) {
      insert$6(l, e, p);
    },
    p(l, p) {
      p[0] & /*vals*/
      1 && s !== (s = /*item*/
      l[48].smiles + "") && set_data$4(e, s);
    },
    d(l) {
      l && detach$6(e);
    }
  };
}
function create_if_block_12$1(y) {
  let s = (
    /*item*/
    y[48].name + ""
  ), e;
  return {
    c() {
      e = text$4(s);
    },
    m(l, p) {
      insert$6(l, e, p);
    },
    p(l, p) {
      p[0] & /*vals*/
      1 && s !== (s = /*item*/
      l[48].name + "") && set_data$4(e, s);
    },
    d(l) {
      l && detach$6(e);
    }
  };
}
function create_if_block_8$1(y) {
  let s, e, l, p, _, x;
  const o = [create_if_block_9$1, create_if_block_10$1], g = [];
  function E(u, A) {
    return A[0] & /*vals*/
    1 && (l = null), l == null && (l = !!["DNA", "RNA", "protein"].includes(
      /*item*/
      u[48].class
    )), l ? 0 : (
      /*item*/
      u[48].class === "ligand" ? 1 : -1
    );
  }
  return ~(p = E(y, [-1, -1])) && (_ = g[p] = o[p](y)), {
    c() {
      s = element$5("div"), e = element$5("div"), _ && _.c(), attr$5(e, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900 svelte-bt9x4p"), attr$5(s, "id", `accordion-collapse-body-${/*i*/
      y[37]}`), attr$5(s, "aria-labelledby", `accordion-collapse-heading-${/*i*/
      y[37]}`), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(u, A) {
      insert$6(u, s, A), append$4(s, e), ~p && g[p].m(e, null), x = !0;
    },
    p(u, A) {
      let L = p;
      p = E(u, A), p === L ? ~p && g[p].p(u, A) : (_ && (group_outros$4(), transition_out$4(g[L], 1, 1, () => {
        g[L] = null;
      }), check_outros$4()), ~p ? (_ = g[p], _ ? _.p(u, A) : (_ = g[p] = o[p](u), _.c()), transition_in$4(_, 1), _.m(e, null)) : _ = null);
    },
    i(u) {
      x || (transition_in$4(_), x = !0);
    },
    o(u) {
      transition_out$4(_), x = !1;
    },
    d(u) {
      u && detach$6(s), ~p && g[p].d();
    }
  };
}
function create_if_block_10$1(y) {
  let s, e, l, p, _, x, o, g, E, u, A, L, C, D, r, n, b, f, c, t;
  function a(...S) {
    return (
      /*input_handler_1*/
      y[17](
        /*i*/
        y[37],
        ...S
      )
    );
  }
  x = new SearchInput({
    props: {
      database: "rcsb-3ligand",
      index: (
        /*i*/
        y[37]
      )
    }
  }), x.$on(
    "triggerFetch",
    /*handleMessage*/
    y[13]
  );
  function h(...S) {
    return (
      /*input_handler_2*/
      y[18](
        /*i*/
        y[37],
        ...S
      )
    );
  }
  let M = ensure_array_like$1(
    /*metals*/
    y[8]
  ), w = [];
  for (let S = 0; S < M.length; S += 1)
    w[S] = create_each_block_6(get_each_context_6(y, M, S));
  return {
    c() {
      s = element$5("textarea"), l = space$4(), p = element$5("div"), p.textContent = "- or -", _ = space$4(), create_component$4(x.$$.fragment), o = space$4(), g = element$5("div"), g.textContent = "- or -", E = space$4(), u = element$5("textarea"), L = space$4(), C = element$5("div"), C.textContent = "- or -", D = space$4(), r = element$5("div"), r.textContent = "Metal ion", n = space$4(), b = element$5("div");
      for (let S = 0; S < w.length; S += 1)
        w[S].c();
      attr$5(s, "rows", "1"), attr$5(s, "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(s, "placeholder", "SMILES like CCC ..."), s.value = e = /*item*/
      y[48].smiles, attr$5(p, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(g, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(u, "rows", "3"), attr$5(u, "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(u, "placeholder", "SDF format 3D molecule ..."), u.value = A = /*item*/
      y[48].sdf, attr$5(C, "class", "text-center text-gray-400 w-full my-2 svelte-bt9x4p"), attr$5(r, "class", "text-center text-gray-600 font-bold mb-2 svelte-bt9x4p"), attr$5(b, "class", "flex justify-center space-x-2 svelte-bt9x4p");
    },
    m(S, T) {
      insert$6(S, s, T), insert$6(S, l, T), insert$6(S, p, T), insert$6(S, _, T), mount_component$4(x, S, T), insert$6(S, o, T), insert$6(S, g, T), insert$6(S, E, T), insert$6(S, u, T), insert$6(S, L, T), insert$6(S, C, T), insert$6(S, D, T), insert$6(S, r, T), insert$6(S, n, T), insert$6(S, b, T);
      for (let R = 0; R < w.length; R += 1)
        w[R] && w[R].m(b, null);
      f = !0, c || (t = [
        listen$1(s, "input", a),
        listen$1(u, "input", h)
      ], c = !0);
    },
    p(S, T) {
      if (y = S, (!f || T[0] & /*vals*/
      1 && e !== (e = /*item*/
      y[48].smiles)) && (s.value = e), (!f || T[0] & /*vals*/
      1 && A !== (A = /*item*/
      y[48].sdf)) && (u.value = A), T[0] & /*vals, metals, dispatch*/
      289) {
        M = ensure_array_like$1(
          /*metals*/
          y[8]
        );
        let R;
        for (R = 0; R < M.length; R += 1) {
          const $ = get_each_context_6(y, M, R);
          w[R] ? w[R].p($, T) : (w[R] = create_each_block_6($), w[R].c(), w[R].m(b, null));
        }
        for (; R < w.length; R += 1)
          w[R].d(1);
        w.length = M.length;
      }
    },
    i(S) {
      f || (transition_in$4(x.$$.fragment, S), f = !0);
    },
    o(S) {
      transition_out$4(x.$$.fragment, S), f = !1;
    },
    d(S) {
      S && (detach$6(s), detach$6(l), detach$6(p), detach$6(_), detach$6(o), detach$6(g), detach$6(E), detach$6(u), detach$6(L), detach$6(C), detach$6(D), detach$6(r), detach$6(n), detach$6(b)), destroy_component$4(x, S), destroy_each$1(w, S), c = !1, run_all$1(t);
    }
  };
}
function create_if_block_9$1(y) {
  let s, e, l, p;
  function _(...x) {
    return (
      /*input_handler*/
      y[16](
        /*i*/
        y[37],
        ...x
      )
    );
  }
  return {
    c() {
      s = element$5("textarea"), attr$5(s, "id", "message"), attr$5(s, "rows", "4"), attr$5(s, "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(s, "placeholder", "MSAVGH..."), s.value = e = /*item*/
      y[48].sequence;
    },
    m(x, o) {
      insert$6(x, s, o), l || (p = listen$1(s, "input", _), l = !0);
    },
    p(x, o) {
      y = x, o[0] & /*vals*/
      1 && e !== (e = /*item*/
      y[48].sequence) && (s.value = e);
    },
    i: noop$6,
    o: noop$6,
    d(x) {
      x && detach$6(s), l = !1, p();
    }
  };
}
function create_each_block_6(y) {
  let s, e, l, p, _;
  function x() {
    return (
      /*click_handler_2*/
      y[19](
        /*metal*/
        y[50],
        /*i*/
        y[37]
      )
    );
  }
  return {
    c() {
      s = element$5("button"), e = element$5("span"), e.textContent = `${/*metal*/
      y[50]}`, l = space$4(), attr$5(e, "class", "font-medium text-gray-600 dark:text-gray-300 svelte-bt9x4p"), attr$5(s, "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(
        s,
        "bg-blue-200",
        /*item*/
        y[48].name === /*metal*/
        y[50]
      ), toggle_class$4(
        s,
        "bg-violet-100",
        /*item*/
        y[48].name !== /*metal*/
        y[50]
      );
    },
    m(o, g) {
      insert$6(o, s, g), append$4(s, e), append$4(s, l), p || (_ = listen$1(s, "click", x), p = !0);
    },
    p(o, g) {
      y = o, g[0] & /*vals, metals*/
      257 && toggle_class$4(
        s,
        "bg-blue-200",
        /*item*/
        y[48].name === /*metal*/
        y[50]
      ), g[0] & /*vals, metals*/
      257 && toggle_class$4(
        s,
        "bg-violet-100",
        /*item*/
        y[48].name !== /*metal*/
        y[50]
      );
    },
    d(o) {
      o && detach$6(s), p = !1, _();
    }
  };
}
function create_if_block_3$2(y) {
  let s, e, l, p, _;
  const x = [create_if_block_4$2, create_if_block_6$1], o = [];
  function g(E, u) {
    return u[0] & /*vals*/
    1 && (s = null), s == null && (s = !!["DNA", "RNA", "protein"].includes(
      /*item*/
      E[48].class
    )), s ? 0 : (
      /*item*/
      E[48].class === "ligand" ? 1 : -1
    );
  }
  return ~(e = g(y, [-1, -1])) && (l = o[e] = x[e](y)), {
    c() {
      l && l.c(), p = empty$3();
    },
    m(E, u) {
      ~e && o[e].m(E, u), insert$6(E, p, u), _ = !0;
    },
    p(E, u) {
      let A = e;
      e = g(E, u), e === A ? ~e && o[e].p(E, u) : (l && (group_outros$4(), transition_out$4(o[A], 1, 1, () => {
        o[A] = null;
      }), check_outros$4()), ~e ? (l = o[e], l ? l.p(E, u) : (l = o[e] = x[e](E), l.c()), transition_in$4(l, 1), l.m(p.parentNode, p)) : l = null);
    },
    i(E) {
      _ || (transition_in$4(l), _ = !0);
    },
    o(E) {
      transition_out$4(l), _ = !1;
    },
    d(E) {
      E && detach$6(p), ~e && o[e].d(E);
    }
  };
}
function create_if_block_6$1(y) {
  let s, e, l = (
    /*item*/
    y[48].sdf !== "" && create_if_block_7$1(y)
  );
  return {
    c() {
      l && l.c(), s = empty$3();
    },
    m(p, _) {
      l && l.m(p, _), insert$6(p, s, _), e = !0;
    },
    p(p, _) {
      /*item*/
      p[48].sdf !== "" ? l ? (l.p(p, _), _[0] & /*vals*/
      1 && transition_in$4(l, 1)) : (l = create_if_block_7$1(p), l.c(), transition_in$4(l, 1), l.m(s.parentNode, s)) : l && (group_outros$4(), transition_out$4(l, 1, 1, () => {
        l = null;
      }), check_outros$4());
    },
    i(p) {
      e || (transition_in$4(l), e = !0);
    },
    o(p) {
      transition_out$4(l), e = !1;
    },
    d(p) {
      p && detach$6(s), l && l.d(p);
    }
  };
}
function create_if_block_4$2(y) {
  let s, e, l, p = (
    /*item*/
    y[48].sequence !== "" && create_if_block_5$2(y)
  );
  return {
    c() {
      s = element$5("div"), e = element$5("div"), p && p.c(), 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*/
        y[37] != /*vals*/
        y[0].length - 1
      ), attr$5(s, "id", `accordion-collapse-body-${/*i*/
      y[37]}`), attr$5(s, "aria-labelledby", `accordion-collapse-heading-${/*i*/
      y[37]}`), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(_, x) {
      insert$6(_, s, x), append$4(s, e), p && p.m(e, null), l = !0;
    },
    p(_, x) {
      /*item*/
      _[48].sequence !== "" ? p ? (p.p(_, x), x[0] & /*vals*/
      1 && transition_in$4(p, 1)) : (p = create_if_block_5$2(_), p.c(), transition_in$4(p, 1), p.m(e, null)) : p && (group_outros$4(), transition_out$4(p, 1, 1, () => {
        p = null;
      }), check_outros$4()), (!l || x[0] & /*vals*/
      1) && toggle_class$4(
        e,
        "border-b-0",
        /*i*/
        _[37] != /*vals*/
        _[0].length - 1
      );
    },
    i(_) {
      l || (transition_in$4(p), l = !0);
    },
    o(_) {
      transition_out$4(p), l = !1;
    },
    d(_) {
      _ && detach$6(s), p && p.d();
    }
  };
}
function create_if_block_7$1(y) {
  let s, e, l, p;
  return l = new Molecule({
    props: {
      molvalue: (
        /*item*/
        y[48].sdf
      ),
      showCovMod: (
        /*showCovModVals*/
        y[2][
          /*i*/
          y[37]
        ]
      )
    }
  }), l.$on(
    "updateMol",
    /*updateMol*/
    y[12]
  ), {
    c() {
      s = element$5("div"), e = element$5("div"), create_component$4(l.$$.fragment), attr$5(e, "class", "relative svelte-bt9x4p"), attr$5(s, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 svelte-bt9x4p"), toggle_class$4(
        s,
        "border-b-0",
        /*i*/
        y[37] != /*vals*/
        y[0].length - 1
      );
    },
    m(_, x) {
      insert$6(_, s, x), append$4(s, e), mount_component$4(l, e, null), p = !0;
    },
    p(_, x) {
      const o = {};
      x[0] & /*vals*/
      1 && (o.molvalue = /*item*/
      _[48].sdf), x[0] & /*showCovModVals*/
      4 && (o.showCovMod = /*showCovModVals*/
      _[2][
        /*i*/
        _[37]
      ]), l.$set(o), (!p || x[0] & /*vals*/
      1) && toggle_class$4(
        s,
        "border-b-0",
        /*i*/
        _[37] != /*vals*/
        _[0].length - 1
      );
    },
    i(_) {
      p || (transition_in$4(l.$$.fragment, _), p = !0);
    },
    o(_) {
      transition_out$4(l.$$.fragment, _), p = !1;
    },
    d(_) {
      _ && detach$6(s), destroy_component$4(l);
    }
  };
}
function create_if_block_5$2(y) {
  let s, e;
  return s = new Sequence({
    props: { seq: (
      /*item*/
      y[48].sequence
    ) }
  }), {
    c() {
      create_component$4(s.$$.fragment);
    },
    m(l, p) {
      mount_component$4(s, l, p), e = !0;
    },
    p(l, p) {
      const _ = {};
      p[0] & /*vals*/
      1 && (_.seq = /*item*/
      l[48].sequence), s.$set(_);
    },
    i(l) {
      e || (transition_in$4(s.$$.fragment, l), e = !0);
    },
    o(l) {
      transition_out$4(s.$$.fragment, l), e = !1;
    },
    d(l) {
      destroy_component$4(s, l);
    }
  };
}
function create_each_block_5(y) {
  let s, e, l, p, _ = (
    /*item*/
    y[48].chain + ""
  ), x, o, g, E, u = (
    /*labels*/
    y[6][
      /*item*/
      y[48].class
    ] + ""
  ), A, L, C, D, r, n, b, f, c, t, a, h, M, w, S, T, R, $ = !/*item*/
  y[48].open && /*item*/
  y[48].class === "ligand" && create_if_block_11$1(y);
  function P(...z) {
    return (
      /*click_handler*/
      y[14](
        /*i*/
        y[37],
        ...z
      )
    );
  }
  function B() {
    return (
      /*click_handler_1*/
      y[15](
        /*item*/
        y[48],
        /*each_value_5*/
        y[49],
        /*i*/
        y[37]
      )
    );
  }
  let F = (
    /*item*/
    y[48].open && create_if_block_8$1(y)
  ), U = !/*item*/
  y[48].open && create_if_block_3$2(y);
  return {
    c() {
      s = element$5("h2"), e = element$5("button"), l = element$5("div"), p = element$5("span"), x = text$4(_), g = space$4(), E = element$5("span"), A = text$4(u), L = space$4(), C = element$5("span"), $ && $.c(), D = space$4(), r = element$5("div"), n = svg_element$1("svg"), b = svg_element$1("path"), f = space$4(), c = svg_element$1("svg"), t = svg_element$1("path"), h = space$4(), F && F.c(), M = space$4(), U && U.c(), w = empty$3(), attr$5(p, "class", o = "inline-flex items-center justify-center p-1 px-2 text-xs font-semibold rounded-full " + /*colorCode*/
      y[7][
        /*item*/
        y[48].class
      ] + " svelte-bt9x4p"), attr$5(E, "class", "svelte-bt9x4p"), attr$5(C, "class", "px-2 text-gray-800 font-bold svelte-bt9x4p"), attr$5(l, "class", "svelte-bt9x4p"), attr$5(b, "stroke-linecap", "round"), attr$5(b, "stroke-linejoin", "round"), attr$5(b, "d", "M6 18 18 6M6 6l12 12"), attr$5(b, "class", "svelte-bt9x4p"), attr$5(n, "data-slot", "icon"), attr$5(n, "fill", "none"), attr$5(n, "stroke-width", "3"), attr$5(n, "stroke", "currentColor"), attr$5(n, "viewBox", "0 0 24 24"), attr$5(n, "xmlns", "http://www.w3.org/2000/svg"), attr$5(n, "aria-hidden", "true"), attr$5(n, "class", "w-4 h-4 text-red-800 svelte-bt9x4p"), attr$5(t, "stroke", "currentColor"), attr$5(t, "stroke-linecap", "round"), attr$5(t, "stroke-linejoin", "round"), attr$5(t, "stroke-width", "2"), attr$5(t, "d", "M9 5 5 1 1 5"), attr$5(t, "class", "svelte-bt9x4p"), attr$5(c, "data-accordion-icon", ""), attr$5(c, "class", "w-3 h-3 shrink-0 svelte-bt9x4p"), attr$5(c, "aria-hidden", "true"), attr$5(c, "xmlns", "http://www.w3.org/2000/svg"), attr$5(c, "fill", "none"), attr$5(c, "viewBox", "0 0 10 6"), toggle_class$4(
        c,
        "rotate-180",
        /*item*/
        y[48].open
      ), toggle_class$4(c, "-rotate-90", !/*item*/
      y[48].open), attr$5(r, "class", "flex items-center space-x-2 svelte-bt9x4p"), attr$5(e, "type", "button"), attr$5(e, "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(e, "data-accordion-target", `#accordion-collapse-body-${/*i*/
      y[37]}`), attr$5(e, "aria-expanded", a = /*item*/
      y[48].open), attr$5(e, "aria-controls", `accordion-collapse-body-${/*i*/
      y[37]}`), toggle_class$4(
        e,
        "rounded-t-xl",
        /*i*/
        y[37] === 0
      ), toggle_class$4(
        e,
        "rounded-b-xl",
        /*i*/
        y[37] == /*vals*/
        y[0].length - 1
      ), toggle_class$4(
        e,
        "border-b-0",
        /*i*/
        y[37] != /*vals*/
        y[0].length - 1
      ), attr$5(s, "id", `accordion-collapse-heading-${/*i*/
      y[37]}`), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(z, W) {
      insert$6(z, s, W), append$4(s, e), append$4(e, l), append$4(l, p), append$4(p, x), append$4(l, g), append$4(l, E), append$4(E, A), append$4(l, L), append$4(l, C), $ && $.m(C, null), append$4(e, D), append$4(e, r), append$4(r, n), append$4(n, b), append$4(r, f), append$4(r, c), append$4(c, t), insert$6(z, h, W), F && F.m(z, W), insert$6(z, M, W), U && U.m(z, W), insert$6(z, w, W), S = !0, T || (R = [
        listen$1(n, "click", P),
        listen$1(e, "click", B)
      ], T = !0);
    },
    p(z, W) {
      y = z, (!S || W[0] & /*vals*/
      1) && _ !== (_ = /*item*/
      y[48].chain + "") && set_data$4(x, _), (!S || W[0] & /*vals*/
      1 && o !== (o = "inline-flex items-center justify-center p-1 px-2 text-xs font-semibold rounded-full " + /*colorCode*/
      y[7][
        /*item*/
        y[48].class
      ] + " svelte-bt9x4p")) && attr$5(p, "class", o), (!S || W[0] & /*vals*/
      1) && u !== (u = /*labels*/
      y[6][
        /*item*/
        y[48].class
      ] + "") && set_data$4(A, u), !/*item*/
      y[48].open && /*item*/
      y[48].class === "ligand" ? $ ? $.p(y, W) : ($ = create_if_block_11$1(y), $.c(), $.m(C, null)) : $ && ($.d(1), $ = null), (!S || W[0] & /*vals*/
      1) && toggle_class$4(
        c,
        "rotate-180",
        /*item*/
        y[48].open
      ), (!S || W[0] & /*vals*/
      1) && toggle_class$4(c, "-rotate-90", !/*item*/
      y[48].open), (!S || W[0] & /*vals*/
      1 && a !== (a = /*item*/
      y[48].open)) && attr$5(e, "aria-expanded", a), (!S || W[0] & /*vals*/
      1) && toggle_class$4(
        e,
        "rounded-b-xl",
        /*i*/
        y[37] == /*vals*/
        y[0].length - 1
      ), (!S || W[0] & /*vals*/
      1) && toggle_class$4(
        e,
        "border-b-0",
        /*i*/
        y[37] != /*vals*/
        y[0].length - 1
      ), /*item*/
      y[48].open ? F ? (F.p(y, W), W[0] & /*vals*/
      1 && transition_in$4(F, 1)) : (F = create_if_block_8$1(y), F.c(), transition_in$4(F, 1), F.m(M.parentNode, M)) : F && (group_outros$4(), transition_out$4(F, 1, 1, () => {
        F = null;
      }), check_outros$4()), /*item*/
      y[48].open ? U && (group_outros$4(), transition_out$4(U, 1, 1, () => {
        U = null;
      }), check_outros$4()) : U ? (U.p(y, W), W[0] & /*vals*/
      1 && transition_in$4(U, 1)) : (U = create_if_block_3$2(y), U.c(), transition_in$4(U, 1), U.m(w.parentNode, w));
    },
    i(z) {
      S || (transition_in$4(F), transition_in$4(U), S = !0);
    },
    o(z) {
      transition_out$4(F), transition_out$4(U), S = !1;
    },
    d(z) {
      z && (detach$6(s), detach$6(h), detach$6(M), detach$6(w)), $ && $.d(), F && F.d(z), U && U.d(z), T = !1, run_all$1(R);
    }
  };
}
function create_if_block$4(y) {
  let s, e, l, p = ensure_array_like$1(
    /*covMods*/
    y[1]
  ), _ = [];
  for (let x = 0; x < p.length; x += 1)
    _[x] = create_each_block$1(get_each_context$1(y, p, x));
  return {
    c() {
      s = element$5("h4"), s.textContent = "Covalent Modification", e = space$4();
      for (let x = 0; x < _.length; x += 1)
        _[x].c();
      l = empty$3(), attr$5(s, "class", "text-center font-bold text-xl svelte-bt9x4p");
    },
    m(x, o) {
      insert$6(x, s, o), insert$6(x, e, o);
      for (let g = 0; g < _.length; g += 1)
        _[g] && _[g].m(x, o);
      insert$6(x, l, o);
    },
    p(x, o) {
      if (o[0] & /*dispatch, covMods, ligandChains, getResAtoms, getResname, getResidues, proteinChains*/
      3642) {
        p = ensure_array_like$1(
          /*covMods*/
          x[1]
        );
        let g;
        for (g = 0; g < p.length; g += 1) {
          const E = get_each_context$1(x, p, g);
          _[g] ? _[g].p(E, o) : (_[g] = create_each_block$1(E), _[g].c(), _[g].m(l.parentNode, l));
        }
        for (; g < _.length; g += 1)
          _[g].d(1);
        _.length = p.length;
      }
    },
    d(x) {
      x && (detach$6(s), detach$6(e), detach$6(l)), destroy_each$1(_, x);
    }
  };
}
function create_each_block_4(y) {
  let s, e = (
    /*chain*/
    y[38] + ""
  ), l, p;
  return {
    c() {
      s = element$5("option"), l = text$4(e), s.__value = p = /*chain*/
      y[38], set_input_value$1(s, s.__value), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(_, x) {
      insert$6(_, s, x), append$4(s, l);
    },
    p(_, x) {
      x[0] & /*proteinChains*/
      8 && e !== (e = /*chain*/
      _[38] + "") && set_data$4(l, e), x[0] & /*proteinChains*/
      8 && p !== (p = /*chain*/
      _[38]) && (s.__value = p, set_input_value$1(s, s.__value));
    },
    d(_) {
      _ && detach$6(s);
    }
  };
}
function create_each_block_3(y) {
  let s, e = (
    /*i*/
    y[37] + 1 + ""
  ), l, p, _ = (
    /*resi*/
    y[44] + ""
  ), x;
  return {
    c() {
      s = element$5("option"), l = text$4(e), p = space$4(), x = text$4(_), s.__value = /*i*/
      y[37] + 1, set_input_value$1(s, s.__value), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(o, g) {
      insert$6(o, s, g), append$4(s, l), append$4(s, p), append$4(s, x);
    },
    p(o, g) {
      g[0] & /*covMods*/
      2 && _ !== (_ = /*resi*/
      o[44] + "") && set_data$4(x, _);
    },
    d(o) {
      o && detach$6(s);
    }
  };
}
function create_else_block_1$1(y) {
  let s;
  return {
    c() {
      s = element$5("option"), s.disabled = !0, s.__value = "", set_input_value$1(s, s.__value), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(e, l) {
      insert$6(e, s, l);
    },
    p: noop$6,
    d(e) {
      e && detach$6(s);
    }
  };
}
function create_if_block_2$2(y) {
  let s, e = ensure_array_like$1(
    /*getResAtoms*/
    y[9](
      /*covMod*/
      y[35]
    )
  ), l = [];
  for (let p = 0; p < e.length; p += 1)
    l[p] = create_each_block_2(get_each_context_2(y, e, p));
  return {
    c() {
      for (let p = 0; p < l.length; p += 1)
        l[p].c();
      s = empty$3();
    },
    m(p, _) {
      for (let x = 0; x < l.length; x += 1)
        l[x] && l[x].m(p, _);
      insert$6(p, s, _);
    },
    p(p, _) {
      if (_[0] & /*getResAtoms, covMods, getResname*/
      2562) {
        e = ensure_array_like$1(
          /*getResAtoms*/
          p[9](
            /*covMod*/
            p[35]
          )
        );
        let x;
        for (x = 0; x < e.length; x += 1) {
          const o = get_each_context_2(p, e, x);
          l[x] ? l[x].p(o, _) : (l[x] = create_each_block_2(o), l[x].c(), l[x].m(s.parentNode, s));
        }
        for (; x < l.length; x += 1)
          l[x].d(1);
        l.length = e.length;
      }
    },
    d(p) {
      p && detach$6(s), destroy_each$1(l, p);
    }
  };
}
function create_each_block_2(y) {
  let s, e, l = (
    /*getResname*/
    y[11](
      /*covMod*/
      y[35]
    ) + ""
  ), p, _, x = (
    /*atom*/
    y[41] + ""
  ), o, g;
  return {
    c() {
      s = text$4(`}
                      `), e = element$5("option"), p = text$4(l), _ = text$4(":"), o = text$4(x), e.__value = g = /*atom*/
      y[41], set_input_value$1(e, e.__value), attr$5(e, "class", "svelte-bt9x4p");
    },
    m(E, u) {
      insert$6(E, s, u), insert$6(E, e, u), append$4(e, p), append$4(e, _), append$4(e, o);
    },
    p(E, u) {
      u[0] & /*covMods*/
      2 && l !== (l = /*getResname*/
      E[11](
        /*covMod*/
        E[35]
      ) + "") && set_data$4(p, l), u[0] & /*covMods*/
      2 && x !== (x = /*atom*/
      E[41] + "") && set_data$4(o, x), u[0] & /*covMods, proteinChains*/
      10 && g !== (g = /*atom*/
      E[41]) && (e.__value = g, set_input_value$1(e, e.__value));
    },
    d(E) {
      E && (detach$6(s), detach$6(e));
    }
  };
}
function create_each_block_1$1(y) {
  let s, e = (
    /*chain*/
    y[38] + ""
  ), l, p, _;
  return {
    c() {
      s = element$5("option"), l = text$4(e), s.__value = p = /*chain*/
      y[38], set_input_value$1(s, s.__value), s.selected = _ = /*chain*/
      y[38] === /*covMod*/
      y[35].ligand, attr$5(s, "class", "svelte-bt9x4p");
    },
    m(x, o) {
      insert$6(x, s, o), append$4(s, l);
    },
    p(x, o) {
      o[0] & /*ligandChains*/
      16 && e !== (e = /*chain*/
      x[38] + "") && set_data$4(l, e), o[0] & /*ligandChains*/
      16 && p !== (p = /*chain*/
      x[38]) && (s.__value = p, set_input_value$1(s, s.__value)), o[0] & /*ligandChains, covMods, proteinChains*/
      26 && _ !== (_ = /*chain*/
      x[38] === /*covMod*/
      x[35].ligand) && (s.selected = _);
    },
    d(x) {
      x && detach$6(s);
    }
  };
}
function create_else_block$3(y) {
  let s;
  return {
    c() {
      s = element$5("p"), s.textContent = "click on atom", attr$5(s, "class", "font-mono svelte-bt9x4p");
    },
    m(e, l) {
      insert$6(e, s, l);
    },
    p: noop$6,
    d(e) {
      e && detach$6(s);
    }
  };
}
function create_if_block_1$3(y) {
  let s, e, l = (
    /*covMod*/
    y[35].attachmentIndex + ""
  ), p;
  return {
    c() {
      s = element$5("p"), e = text$4("index "), p = text$4(l), attr$5(s, "class", "font-mono svelte-bt9x4p");
    },
    m(_, x) {
      insert$6(_, s, x), append$4(s, e), append$4(s, p);
    },
    p(_, x) {
      x[0] & /*covMods*/
      2 && l !== (l = /*covMod*/
      _[35].attachmentIndex + "") && set_data$4(p, l);
    },
    d(_) {
      _ && detach$6(s);
    }
  };
}
function create_each_block$1(y) {
  let s, e, l, p, _, x, o, g, E, u, A, L, C, D, r, n, b, f, c, t, a, h, M, w, S, T, R, $, P, B, F, U, z, W, V, N, k, G, Q, ie, ge, le = ensure_array_like$1(
    /*proteinChains*/
    y[3]
  ), oe = [];
  for (let Be = 0; Be < le.length; Be += 1)
    oe[Be] = create_each_block_4(get_each_context_4(y, le, Be));
  function he() {
    y[20].call(
      E,
      /*i*/
      y[37]
    );
  }
  let se = ensure_array_like$1(
    /*getResidues*/
    y[10](
      /*covMod*/
      y[35]
    )
  ), xe = [];
  for (let Be = 0; Be < se.length; Be += 1)
    xe[Be] = create_each_block_3(get_each_context_3(y, se, Be));
  function ye() {
    y[22].call(
      A,
      /*i*/
      y[37]
    );
  }
  function Pe(Be, Ne) {
    return (
      /*covMod*/
      Be[35].residue != "" ? create_if_block_2$2 : create_else_block_1$1
    );
  }
  let de = Pe(y), pe = de(y);
  function re() {
    y[24].call(
      C,
      /*i*/
      y[37]
    );
  }
  function Se() {
    y[26].call(
      r,
      /*i*/
      y[37]
    );
  }
  let ke = ensure_array_like$1(
    /*ligandChains*/
    y[4]
  ), $e = [];
  for (let Be = 0; Be < ke.length; Be += 1)
    $e[Be] = create_each_block_1$1(get_each_context_1$1(y, ke, Be));
  function ze() {
    y[28].call(
      R,
      /*i*/
      y[37]
    );
  }
  function Re(Be, Ne) {
    return (
      /*covMod*/
      Be[35].attachmentIndex ? create_if_block_1$3 : create_else_block$3
    );
  }
  let Fe = Re(y), Ie = Fe(y);
  function We() {
    y[30].call(
      F,
      /*i*/
      y[37]
    );
  }
  function Ue(...Be) {
    return (
      /*click_handler_3*/
      y[32](
        /*i*/
        y[37],
        ...Be
      )
    );
  }
  return {
    c() {
      s = element$5("div"), e = element$5("div"), l = element$5("div"), p = element$5("div"), p.innerHTML = '<span class="text-base font-medium text-gray-900 svelte-bt9x4p">Protein</span>', _ = space$4(), x = element$5("div"), x.innerHTML = '<span class="svelte-bt9x4p">Chain</span> <span class="svelte-bt9x4p">Residue</span> <span class="svelte-bt9x4p">Atom</span> <span class="svelte-bt9x4p">Chirality</span>', o = space$4(), g = element$5("div"), E = element$5("select");
      for (let Be = 0; Be < oe.length; Be += 1)
        oe[Be].c();
      u = space$4(), A = element$5("select");
      for (let Be = 0; Be < xe.length; Be += 1)
        xe[Be].c();
      L = space$4(), C = element$5("select"), pe.c(), D = space$4(), r = element$5("select"), n = element$5("option"), n.textContent = "no chirality defined", b = element$5("option"), b.textContent = "CW", f = element$5("option"), f.textContent = "CCW", c = space$4(), t = element$5("div"), a = element$5("div"), h = element$5("div"), h.innerHTML = '<span class="w-full whitespace-nowrap text-center text-base font-medium text-gray-900 svelte-bt9x4p">Small molecule</span>', M = space$4(), w = element$5("div"), w.innerHTML = '<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>', S = space$4(), T = element$5("div"), R = element$5("select");
      for (let Be = 0; Be < $e.length; Be += 1)
        $e[Be].c();
      $ = space$4(), P = element$5("div"), Ie.c(), B = space$4(), F = element$5("select"), U = element$5("option"), U.textContent = "no chirality defined", z = element$5("option"), z.textContent = "CW", W = element$5("option"), W.textContent = "CCW", V = space$4(), N = element$5("div"), k = svg_element$1("svg"), G = svg_element$1("path"), Q = space$4(), attr$5(p, "class", "flex justify-center svelte-bt9x4p"), attr$5(x, "class", "grid grid-cols-4 font-bold svelte-bt9x4p"), attr$5(E, "name", ""), attr$5(E, "id", ""), attr$5(E, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].protein === void 0 && add_render_callback$2(he), attr$5(A, "name", ""), attr$5(A, "id", ""), attr$5(A, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].residue === void 0 && add_render_callback$2(ye), attr$5(C, "name", ""), attr$5(C, "id", ""), attr$5(C, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].atom === void 0 && add_render_callback$2(re), n.__value = "", set_input_value$1(n, n.__value), attr$5(n, "class", "svelte-bt9x4p"), b.__value = "CW", set_input_value$1(b, b.__value), attr$5(b, "class", "svelte-bt9x4p"), f.__value = "CCW", set_input_value$1(f, f.__value), attr$5(f, "class", "svelte-bt9x4p"), attr$5(r, "name", ""), attr$5(r, "id", ""), attr$5(r, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].protein_symmetry === void 0 && add_render_callback$2(Se), attr$5(g, "class", "grid grid-cols-4 svelte-bt9x4p"), attr$5(l, "class", "w-3/5 flex-col px-2 svelte-bt9x4p"), attr$5(h, "class", "flex justify-center svelte-bt9x4p"), attr$5(w, "class", "grid grid-cols-3 font-bold svelte-bt9x4p"), attr$5(R, "name", ""), attr$5(R, "id", ""), attr$5(R, "title", "click on atom in structure"), attr$5(R, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].ligand === void 0 && add_render_callback$2(ze), attr$5(P, "class", "svelte-bt9x4p"), U.__value = "", set_input_value$1(U, U.__value), attr$5(U, "class", "svelte-bt9x4p"), z.__value = "CW", set_input_value$1(z, z.__value), attr$5(z, "class", "svelte-bt9x4p"), W.__value = "CCW", set_input_value$1(W, W.__value), attr$5(W, "class", "svelte-bt9x4p"), attr$5(F, "name", ""), attr$5(F, "id", ""), attr$5(F, "class", "svelte-bt9x4p"), /*covMods*/
      y[1][
        /*i*/
        y[37]
      ].ligand_symmetry === void 0 && add_render_callback$2(We), attr$5(T, "class", "grid grid-cols-3 svelte-bt9x4p"), attr$5(a, "class", "flex-col p-1 svelte-bt9x4p"), attr$5(t, "class", "w-2/5 px-2 svelte-bt9x4p"), attr$5(e, "class", "flex divide-x rounded border p-1 w-full svelte-bt9x4p"), attr$5(G, "stroke-linecap", "round"), attr$5(G, "stroke-linejoin", "round"), attr$5(G, "d", "M6 18 18 6M6 6l12 12"), attr$5(G, "class", "svelte-bt9x4p"), attr$5(k, "data-slot", "icon"), attr$5(k, "fill", "none"), attr$5(k, "stroke-width", "2"), attr$5(k, "stroke", "currentColor"), attr$5(k, "viewBox", "0 0 24 24"), attr$5(k, "xmlns", "http://www.w3.org/2000/svg"), attr$5(k, "aria-hidden", "true"), attr$5(k, "class", "w-8 h-8 text-red-800 cursor-pointer svelte-bt9x4p"), attr$5(N, "class", "flex items-center p-2 svelte-bt9x4p"), attr$5(s, "class", "flex p-10 svelte-bt9x4p");
    },
    m(Be, Ne) {
      insert$6(Be, s, Ne), append$4(s, e), append$4(e, l), append$4(l, p), append$4(l, _), append$4(l, x), append$4(l, o), append$4(l, g), append$4(g, E);
      for (let H = 0; H < oe.length; H += 1)
        oe[H] && oe[H].m(E, null);
      select_option(
        E,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].protein,
        !0
      ), append$4(g, u), append$4(g, A);
      for (let H = 0; H < xe.length; H += 1)
        xe[H] && xe[H].m(A, null);
      select_option(
        A,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].residue,
        !0
      ), append$4(g, L), append$4(g, C), pe.m(C, null), select_option(
        C,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].atom,
        !0
      ), append$4(g, D), append$4(g, r), append$4(r, n), append$4(r, b), append$4(r, f), select_option(
        r,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].protein_symmetry,
        !0
      ), append$4(e, c), append$4(e, t), append$4(t, a), append$4(a, h), append$4(a, M), append$4(a, w), append$4(a, S), append$4(a, T), append$4(T, R);
      for (let H = 0; H < $e.length; H += 1)
        $e[H] && $e[H].m(R, null);
      select_option(
        R,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].ligand,
        !0
      ), append$4(T, $), append$4(T, P), Ie.m(P, null), append$4(T, B), append$4(T, F), append$4(F, U), append$4(F, z), append$4(F, W), select_option(
        F,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].ligand_symmetry,
        !0
      ), append$4(s, V), append$4(s, N), append$4(N, k), append$4(k, G), append$4(s, Q), ie || (ge = [
        listen$1(E, "change", he),
        listen$1(
          E,
          "change",
          /*change_handler*/
          y[21]
        ),
        listen$1(A, "change", ye),
        listen$1(
          A,
          "change",
          /*change_handler_1*/
          y[23]
        ),
        listen$1(C, "change", re),
        listen$1(
          C,
          "change",
          /*change_handler_2*/
          y[25]
        ),
        listen$1(r, "change", Se),
        listen$1(
          r,
          "change",
          /*change_handler_3*/
          y[27]
        ),
        listen$1(R, "change", ze),
        listen$1(
          R,
          "change",
          /*change_handler_4*/
          y[29]
        ),
        listen$1(F, "change", We),
        listen$1(
          F,
          "change",
          /*change_handler_5*/
          y[31]
        ),
        listen$1(k, "click", Ue)
      ], ie = !0);
    },
    p(Be, Ne) {
      if (y = Be, Ne[0] & /*proteinChains*/
      8) {
        le = ensure_array_like$1(
          /*proteinChains*/
          y[3]
        );
        let H;
        for (H = 0; H < le.length; H += 1) {
          const K = get_each_context_4(y, le, H);
          oe[H] ? oe[H].p(K, Ne) : (oe[H] = create_each_block_4(K), oe[H].c(), oe[H].m(E, null));
        }
        for (; H < oe.length; H += 1)
          oe[H].d(1);
        oe.length = le.length;
      }
      if (Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        E,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].protein
      ), Ne[0] & /*getResidues, covMods*/
      1026) {
        se = ensure_array_like$1(
          /*getResidues*/
          y[10](
            /*covMod*/
            y[35]
          )
        );
        let H;
        for (H = 0; H < se.length; H += 1) {
          const K = get_each_context_3(y, se, H);
          xe[H] ? xe[H].p(K, Ne) : (xe[H] = create_each_block_3(K), xe[H].c(), xe[H].m(A, null));
        }
        for (; H < xe.length; H += 1)
          xe[H].d(1);
        xe.length = se.length;
      }
      if (Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        A,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].residue
      ), de === (de = Pe(y)) && pe ? pe.p(y, Ne) : (pe.d(1), pe = de(y), pe && (pe.c(), pe.m(C, null))), Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        C,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].atom
      ), Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        r,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].protein_symmetry
      ), Ne[0] & /*ligandChains, covMods*/
      18) {
        ke = ensure_array_like$1(
          /*ligandChains*/
          y[4]
        );
        let H;
        for (H = 0; H < ke.length; H += 1) {
          const K = get_each_context_1$1(y, ke, H);
          $e[H] ? $e[H].p(K, Ne) : ($e[H] = create_each_block_1$1(K), $e[H].c(), $e[H].m(R, null));
        }
        for (; H < $e.length; H += 1)
          $e[H].d(1);
        $e.length = ke.length;
      }
      Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        R,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].ligand
      ), Fe === (Fe = Re(y)) && Ie ? Ie.p(y, Ne) : (Ie.d(1), Ie = Fe(y), Ie && (Ie.c(), Ie.m(P, null))), Ne[0] & /*covMods, proteinChains*/
      10 && select_option(
        F,
        /*covMods*/
        y[1][
          /*i*/
          y[37]
        ].ligand_symmetry
      );
    },
    d(Be) {
      Be && detach$6(s), destroy_each$1(oe, Be), destroy_each$1(xe, Be), pe.d(), destroy_each$1($e, Be), Ie.d(), ie = !1, run_all$1(ge);
    }
  };
}
function create_fragment$6(y) {
  let s, e, l, p, _ = ensure_array_like$1(
    /*vals*/
    y[0]
  ), x = [];
  for (let E = 0; E < _.length; E += 1)
    x[E] = create_each_block_5(get_each_context_5(y, _, E));
  const o = (E) => transition_out$4(x[E], 1, 1, () => {
    x[E] = null;
  });
  let g = (
    /*covMods*/
    y[1].length > 0 && create_if_block$4(y)
  );
  return {
    c() {
      s = element$5("div");
      for (let E = 0; E < x.length; E += 1)
        x[E].c();
      e = space$4(), l = element$5("div"), g && g.c(), attr$5(l, "class", "p-5 border border-t-0 border-gray-200 dark:border-gray-700 w-full svelte-bt9x4p"), attr$5(s, "id", "accordion-collapse"), attr$5(s, "data-accordion", "collapse"), attr$5(s, "class", "svelte-bt9x4p");
    },
    m(E, u) {
      insert$6(E, s, u);
      for (let A = 0; A < x.length; A += 1)
        x[A] && x[A].m(s, null);
      append$4(s, e), append$4(s, l), g && g.m(l, null), p = !0;
    },
    p(E, u) {
      if (u[0] & /*vals, showCovModVals, updateMol, dispatch, metals, handleMessage, labels, colorCode*/
      12773) {
        _ = ensure_array_like$1(
          /*vals*/
          E[0]
        );
        let A;
        for (A = 0; A < _.length; A += 1) {
          const L = get_each_context_5(E, _, A);
          x[A] ? (x[A].p(L, u), transition_in$4(x[A], 1)) : (x[A] = create_each_block_5(L), x[A].c(), transition_in$4(x[A], 1), x[A].m(s, e));
        }
        for (group_outros$4(), A = _.length; A < x.length; A += 1)
          o(A);
        check_outros$4();
      }
      /*covMods*/
      E[1].length > 0 ? g ? g.p(E, u) : (g = create_if_block$4(E), g.c(), g.m(l, null)) : g && (g.d(1), g = null);
    },
    i(E) {
      if (!p) {
        for (let u = 0; u < _.length; u += 1)
          transition_in$4(x[u]);
        p = !0;
      }
    },
    o(E) {
      x = x.filter(Boolean);
      for (let u = 0; u < x.length; u += 1)
        transition_out$4(x[u]);
      p = !1;
    },
    d(E) {
      E && detach$6(s), destroy_each$1(x, E), g && g.d();
    }
  };
}
function instance$6(y, s, e) {
  const l = createEventDispatcher$2();
  let { vals: p = [] } = s, { covMods: _ = [] } = s, x = [], o = {
    DNA: "NA sequence",
    RNA: "NA sequence",
    protein: "Protein sequence",
    ligand: "Small molecule"
  }, g = {
    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"
  }, E = ["ZN", "MG", "CA", "FE", "NA", "K", "CL", "CU", "MN", "CO", "NI"], u = [], A = [], L = {
    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"]
  }, C = {
    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 D(G) {
    let Q = p.find((ge) => ge.chain === G.protein).sequence;
    if (Q.length < G.residue)
      return alert("Residue number is too high"), [];
    let ie = Q[G.residue - 1];
    return L[ie];
  }
  function r(G) {
    let Q = p.find((ie) => ie.chain === G.protein).sequence;
    return Array.from(Q).map((ie) => C[ie]);
  }
  function n(G) {
    let ie = p.find((ge) => ge.chain === G.protein).sequence[G.residue - 1];
    return C[ie];
  }
  function b(G) {
    let Q = G.detail.index;
    e(1, _[Q].mol = G.detail.mol, _), e(1, _[Q].attachmentIndex = G.detail.attachmentIndex, _), e(1, _[Q].deleteIndexes = G.detail.deleteIndexes, _), l("updateCovMod", _);
  }
  function f(G) {
    fetch(`https://files.rcsb.org/ligands/download/${G.detail.text}_ideal.sdf`).then((Q) => {
      if (!Q.ok)
        throw new Error("Network response was not ok");
      return Q.text();
    }).then((Q) => {
      l("updateVals", {
        sdf: Q,
        index: G.detail.index,
        close: !0
      });
    }).catch((Q) => {
      alert("Error fetching sdf file");
    });
  }
  const c = (G, Q) => {
    l("removeVal", G);
  }, t = (G, Q, ie) => e(0, Q[ie].open = !G.open, p), a = (G, Q) => {
    l("updateVals", { sequence: Q.target.value, index: G });
  }, h = (G, Q) => {
    l("updateVals", { smiles: Q.target.value, index: G });
  }, M = (G, Q) => {
    l("updateVals", { sdf: Q.target.value, index: G });
  }, w = (G, Q) => l("updateVals", { name: G, index: Q });
  function S(G) {
    _[G].protein = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const T = () => l("updateCovMod", _);
  function R(G) {
    _[G].residue = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const $ = () => l("updateCovMod", _);
  function P(G) {
    _[G].atom = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const B = () => l("updateCovMod", _);
  function F(G) {
    _[G].protein_symmetry = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const U = () => l("updateCovMod", _);
  function z(G) {
    _[G].ligand = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const W = () => l("updateCovMod", _);
  function V(G) {
    _[G].ligand_symmetry = select_value(this), e(1, _), e(3, u), e(0, p);
  }
  const N = () => l("updateCovMod", _), k = (G, Q) => {
    l("removeCovMod", G);
  };
  return y.$$set = (G) => {
    "vals" in G && e(0, p = G.vals), "covMods" in G && e(1, _ = G.covMods);
  }, y.$$.update = () => {
    y.$$.dirty[0] & /*covMods, vals*/
    3 && _ && e(2, x = p.map((G) => _.findIndex((Q) => Q.ligand === G.chain))), y.$$.dirty[0] & /*vals*/
    1 && e(3, u = p.filter((G) => G.class === "protein").map((G) => G.chain)), y.$$.dirty[0] & /*vals*/
    1 && e(4, A = p.filter((G) => G.class === "ligand").map((G) => G.chain));
  }, [
    p,
    _,
    x,
    u,
    A,
    l,
    o,
    g,
    E,
    D,
    r,
    n,
    b,
    f,
    c,
    t,
    a,
    h,
    M,
    w,
    S,
    T,
    R,
    $,
    P,
    B,
    F,
    U,
    z,
    W,
    V,
    N,
    k
  ];
}
class Accordion extends SvelteComponent$6 {
  constructor(s) {
    super(), init$6(this, s, instance$6, create_fragment$6, safe_not_equal$7, { vals: 0, covMods: 1 }, null, [-1, -1]);
  }
}
const SequenceInput_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$5,
  attr: attr$4,
  check_outros: check_outros$3,
  create_component: create_component$3,
  destroy_component: destroy_component$3,
  detach: detach$5,
  element: element$4,
  empty: empty$2,
  flush: flush$1,
  group_outros: group_outros$3,
  init: init$5,
  insert: insert$5,
  mount_component: mount_component$3,
  noop: noop$5,
  safe_not_equal: safe_not_equal$6,
  space: space$3,
  transition_in: transition_in$3,
  transition_out: transition_out$3
} = window.__gradio__svelte__internal, { tick: tick$2 } = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$1, onMount: onMount$3, afterUpdate: afterUpdate$1 } = window.__gradio__svelte__internal;
function create_if_block$3(y) {
  let s, e, l, p;
  const _ = [create_if_block_1$2, create_else_block$2], x = [];
  function o(g, E) {
    return (
      /*vals*/
      g[0].length > 0 ? 0 : 1
    );
  }
  return s = o(y), e = x[s] = _[s](y), {
    c() {
      e.c(), l = empty$2();
    },
    m(g, E) {
      x[s].m(g, E), insert$5(g, l, E), p = !0;
    },
    p(g, E) {
      let u = s;
      s = o(g), s === u ? x[s].p(g, E) : (group_outros$3(), transition_out$3(x[u], 1, 1, () => {
        x[u] = null;
      }), check_outros$3(), e = x[s], e ? e.p(g, E) : (e = x[s] = _[s](g), e.c()), transition_in$3(e, 1), e.m(l.parentNode, l));
    },
    i(g) {
      p || (transition_in$3(e), p = !0);
    },
    o(g) {
      transition_out$3(e), p = !1;
    },
    d(g) {
      g && detach$5(l), x[s].d(g);
    }
  };
}
function create_else_block$2(y) {
  let s, e, l, p, _, x, o, g;
  return _ = new SearchInput({ props: { database: "rcsb-bioass" } }), _.$on(
    "triggerFetch",
    /*handleMessage*/
    y[2]
  ), {
    c() {
      s = element$4("div"), s.textContent = "Empty input", e = space$3(), l = element$4("div"), l.textContent = "You can import a protein from the PDB", p = space$3(), create_component$3(_.$$.fragment), x = space$3(), o = element$4("div"), o.textContent = "- or create the input from scratch -", attr$4(s, "class", "my-8 text-center text-gray-600 svelte-13zuw1o"), attr$4(l, "class", "text-center text-gray-400 svelte-13zuw1o"), attr$4(o, "class", "text-center text-gray-400 w-full my-2 svelte-13zuw1o");
    },
    m(E, u) {
      insert$5(E, s, u), insert$5(E, e, u), insert$5(E, l, u), insert$5(E, p, u), mount_component$3(_, E, u), insert$5(E, x, u), insert$5(E, o, u), g = !0;
    },
    p: noop$5,
    i(E) {
      g || (transition_in$3(_.$$.fragment, E), g = !0);
    },
    o(E) {
      transition_out$3(_.$$.fragment, E), g = !1;
    },
    d(E) {
      E && (detach$5(s), detach$5(e), detach$5(l), detach$5(p), detach$5(x), detach$5(o)), destroy_component$3(_, E);
    }
  };
}
function create_if_block_1$2(y) {
  let s, e;
  return s = new Accordion({
    props: {
      vals: (
        /*vals*/
        y[0]
      ),
      covMods: (
        /*covMods*/
        y[1]
      )
    }
  }), s.$on(
    "updateVals",
    /*update*/
    y[3]
  ), s.$on(
    "removeVal",
    /*remove*/
    y[5]
  ), s.$on(
    "removeCovMod",
    /*removeCovMod*/
    y[7]
  ), s.$on(
    "updateCovMod",
    /*syncCovMod*/
    y[8]
  ), {
    c() {
      create_component$3(s.$$.fragment);
    },
    m(l, p) {
      mount_component$3(s, l, p), e = !0;
    },
    p(l, p) {
      const _ = {};
      p & /*vals*/
      1 && (_.vals = /*vals*/
      l[0]), p & /*covMods*/
      2 && (_.covMods = /*covMods*/
      l[1]), s.$set(_);
    },
    i(l) {
      e || (transition_in$3(s.$$.fragment, l), e = !0);
    },
    o(l) {
      transition_out$3(s.$$.fragment, l), e = !1;
    },
    d(l) {
      destroy_component$3(s, l);
    }
  };
}
function create_fragment$5(y) {
  let s, e, l, p = (
    /*vals*/
    y[0] != null && create_if_block$3(y)
  );
  return e = new Button({ props: { vals: (
    /*vals*/
    y[0]
  ) } }), e.$on(
    "addNewChain",
    /*insertChain*/
    y[4]
  ), e.$on(
    "addCovalentModification",
    /*addCovMod*/
    y[6]
  ), {
    c() {
      p && p.c(), s = space$3(), create_component$3(e.$$.fragment);
    },
    m(_, x) {
      p && p.m(_, x), insert$5(_, s, x), mount_component$3(e, _, x), l = !0;
    },
    p(_, [x]) {
      /*vals*/
      _[0] != null ? p ? (p.p(_, x), x & /*vals*/
      1 && transition_in$3(p, 1)) : (p = create_if_block$3(_), p.c(), transition_in$3(p, 1), p.m(s.parentNode, s)) : p && (group_outros$3(), transition_out$3(p, 1, 1, () => {
        p = null;
      }), check_outros$3());
      const o = {};
      x & /*vals*/
      1 && (o.vals = /*vals*/
      _[0]), e.$set(o);
    },
    i(_) {
      l || (transition_in$3(p), transition_in$3(e.$$.fragment, _), l = !0);
    },
    o(_) {
      transition_out$3(p), transition_out$3(e.$$.fragment, _), l = !1;
    },
    d(_) {
      _ && detach$5(s), p && p.d(_), destroy_component$3(e, _);
    }
  };
}
async function getSDF(y) {
  return await fetch(`https://files.rcsb.org/ligands/download/${y}_ideal.sdf`).then((e) => {
    if (!e.ok)
      throw new Error("Network response was not ok");
    return e.text();
  }).catch((e) => {
    alert("Error fetching sdf file");
  });
}
function nextChainTemp(y) {
  if (y == "")
    return "A";
  let s = "";
  return y == "Z" ? s = "AA" : y.length > 1 && y.slice(-1) === "Z" ? s = String.fromCharCode(y.charCodeAt(0) + 1) + "A" : s = y.slice(0, -1) + String.fromCharCode(y.slice(-1).charCodeAt(0) + 1), s;
}
async function fetchMolecules(y) {
  const s = `https://www.ebi.ac.uk/pdbe/api/pdb/entry/molecules/${y}`;
  try {
    const e = await fetch(s);
    if (!e.ok)
      throw new Error(`Error fetching molecules for PDB ID ${y}: ${e.statusText}`);
    return await e.json();
  } catch (e) {
    console.error("Error fetching molecules:", e);
  }
}
async function fetchXmlText(y) {
  try {
    const s = await fetch(y);
    if (!s.ok)
      throw new Error(`Error fetching XML: ${s.statusText}`);
    return await s.text();
  } catch (s) {
    console.error("Error fetching XML:", s);
  }
}
function parseAssembly(y) {
  const s = {
    id: y.getAttribute("id"),
    composition: y.getAttribute("composition"),
    molecularWeight: y.getAttribute("molecular_weight"),
    name: y.getAttribute("name")
  }, e = [];
  return y.querySelectorAll("entity").forEach((l) => {
    e.push({
      chainIds: l.getAttribute("chain_ids"),
      class: l.getAttribute("class"),
      count: l.getAttribute("count"),
      entityId: Number(l.getAttribute("entity_id"))
      // Added entityId
    });
  }), s.entities = e, s;
}
function extractEntityInfo(y, s) {
  if (y.class === "DNA" || y.class === "RNA" || y.class === "protein") {
    const e = s.find((l) => l.entity_id === y.entityId);
    if (e)
      return e.sequence;
  } else {
    const e = s.find((l) => l.entity_id === y.entityId);
    if (e)
      return e.chem_comp_ids[0];
  }
}
function importBioAssembly(y) {
  const s = fetchMolecules(y).then((_) => _).catch((_) => {
    console.error("Error:", _);
  }), e = `https://www.ebi.ac.uk/pdbe/static/entry/${y}-assembly.xml`, l = fetchXmlText(e).then((_) => {
    const x = [];
    return new DOMParser().parseFromString(_, "text/xml").querySelectorAll("assembly").forEach((u) => {
      x.push(parseAssembly(u));
    }), x;
  });
  return Promise.all([s, l]).then(([_, x]) => {
    let o = [];
    return x[0].entities.forEach((E) => {
      const u = extractEntityInfo(E, _[y]);
      o.push({
        class: E.class,
        entityInfo: u,
        count: E.count
      });
    }), o;
  });
}
function instance$5(y, s, e) {
  let { value: l = { chains: [], covMods: [] } } = s;
  const p = createEventDispatcher$1();
  let _ = ["ZN", "MG", "CA", "FE", "NA", "K", "CL", "CU", "MN", "CO", "NI"];
  async function x(n) {
    let b = n.detail.text;
    b = b.toLowerCase();
    let f = await importBioAssembly(b), c = [], t = "";
    await Promise.all(f.map(async (a) => {
      if (["DNA", "RNA", "protein"].includes(a.class))
        for (let h = 0; h < a.count; h++)
          t = nextChainTemp(t), c.push({
            class: a.class,
            name: "",
            smiles: "",
            sdf: "",
            sequence: a.entityInfo,
            open: !1,
            chain: t
          }), await tick$2();
      else if (a.class === "ligand") {
        let h = "", M = "";
        _.includes(a.entityInfo) ? h = a.entityInfo : M = await getSDF(a.entityInfo);
        for (let w = 0; w < a.count; w++)
          t = nextChainTemp(t), c.push({
            class: a.class,
            name: h,
            smiles: "",
            sdf: M,
            sequence: "",
            open: !1,
            chain: t
          });
        await tick$2();
      }
    })), e(0, o = c), p("updateVals", o);
  }
  let o = [], g = [];
  function E(n) {
    n.detail.sequence !== void 0 && e(0, o[n.detail.index].sequence = n.detail.sequence, o), n.detail.name !== void 0 && (e(0, o[n.detail.index].name = n.detail.name, o), e(0, o[n.detail.index].open = n.detail.open, o), e(0, o[n.detail.index].sdf = "", o), e(0, o[n.detail.index].smiles = "", o)), n.detail.smiles !== void 0 && (e(0, o[n.detail.index].smiles = n.detail.smiles, o), e(0, o[n.detail.index].sdf = "", o), e(0, o[n.detail.index].name = "", o)), n.detail.sdf !== void 0 && (n.detail.close == !0 && e(0, o[n.detail.index].open = !1, o), e(0, o[n.detail.index].sdf = n.detail.sdf, o), e(0, o[n.detail.index].name = "", o), e(0, o[n.detail.index].smiles = "", o)), p("updateVals", o);
  }
  function u() {
    let n = "A";
    for (let f of o)
      f.chain > n && (n = f.chain);
    let b = "";
    if (n < "Z")
      b = String.fromCharCode(n.charCodeAt(0) + 1);
    else {
      let f = n.slice(-1);
      f < "Z" ? b = n.slice(0, -1) + String.fromCharCode(f.charCodeAt(0) + 1) : b = n + "A";
    }
    return b;
  }
  function A(n) {
    let b = u();
    o.push({
      class: n.detail.type,
      name: "",
      smiles: "",
      sdf: "",
      sequence: "",
      open: !0,
      chain: b
    }), e(0, o);
  }
  function L(n) {
    o.splice(n.detail, 1), e(0, o), p("updateVals", o);
  }
  function C(n) {
    let b = o.find((t) => t.class === "protein").chain;
    if (b === void 0) {
      alert("Please add a protein chain first");
      return;
    }
    let f = o.find((t) => t.class === "ligand").chain;
    if (f === void 0) {
      alert("Please add a ligand chain first");
      return;
    }
    let c = {
      protein: b,
      residue: "1",
      atom: "N",
      protein_symmetry: "CW",
      ligand: f,
      attachmentIndex: 1,
      deleteIndexes: [],
      ligand_symmetry: "CW"
    };
    g.push(c), e(1, g), e(0, o), p("updateCovMod", g);
  }
  function D(n) {
    g.splice(n.detail, 1), e(1, g);
  }
  function r(n) {
    e(1, g = n.detail), p("updateCovMod", g);
  }
  return onMount$3(async () => {
    e(0, o = l.chains), e(1, g = l.covMods);
  }), y.$$set = (n) => {
    "value" in n && e(9, l = n.value);
  }, [
    o,
    g,
    x,
    E,
    A,
    L,
    C,
    D,
    r,
    l
  ];
}
class SequenceInput extends SvelteComponent$5 {
  constructor(s) {
    super(), init$5(this, s, instance$5, create_fragment$5, safe_not_equal$6, { value: 9 });
  }
  get value() {
    return this.$$.ctx[9];
  }
  set value(s) {
    this.$$set({ value: s }), flush$1();
  }
}
function pretty_si(y) {
  let s = ["", "k", "M", "G", "T", "P", "E", "Z"], e = 0;
  for (; y > 1e3 && e < s.length - 1; )
    y /= 1e3, e++;
  let l = s[e];
  return (Number.isInteger(y) ? y : y.toFixed(1)) + l;
}
function noop$4() {
}
const identity = (y) => y;
function safe_not_equal$5(y, s) {
  return y != y ? s == s : y !== s || y && typeof y == "object" || typeof y == "function";
}
const is_client = typeof window < "u";
let now = is_client ? () => window.performance.now() : () => Date.now(), raf = is_client ? (y) => requestAnimationFrame(y) : noop$4;
const tasks = /* @__PURE__ */ new Set();
function run_tasks(y) {
  tasks.forEach((s) => {
    s.c(y) || (tasks.delete(s), s.f());
  }), tasks.size !== 0 && raf(run_tasks);
}
function loop(y) {
  let s;
  return tasks.size === 0 && raf(run_tasks), {
    promise: new Promise((e) => {
      tasks.add(s = { c: y, f: e });
    }),
    abort() {
      tasks.delete(s);
    }
  };
}
function fade(y, { delay: s = 0, duration: e = 400, easing: l = identity } = {}) {
  const p = +getComputedStyle(y).opacity;
  return {
    delay: s,
    duration: e,
    easing: l,
    css: (_) => `opacity: ${_ * p}`
  };
}
const subscriber_queue = [];
function writable(y, s = noop$4) {
  let e;
  const l = /* @__PURE__ */ new Set();
  function p(o) {
    if (safe_not_equal$5(y, o) && (y = o, e)) {
      const g = !subscriber_queue.length;
      for (const E of l)
        E[1](), subscriber_queue.push(E, y);
      if (g) {
        for (let E = 0; E < subscriber_queue.length; E += 2)
          subscriber_queue[E][0](subscriber_queue[E + 1]);
        subscriber_queue.length = 0;
      }
    }
  }
  function _(o) {
    p(o(y));
  }
  function x(o, g = noop$4) {
    const E = [o, g];
    return l.add(E), l.size === 1 && (e = s(p, _) || noop$4), o(y), () => {
      l.delete(E), l.size === 0 && e && (e(), e = null);
    };
  }
  return { set: p, update: _, subscribe: x };
}
function is_date(y) {
  return Object.prototype.toString.call(y) === "[object Date]";
}
function tick_spring(y, s, e, l) {
  if (typeof e == "number" || is_date(e)) {
    const p = l - e, _ = (e - s) / (y.dt || 1 / 60), x = y.opts.stiffness * p, o = y.opts.damping * _, g = (x - o) * y.inv_mass, E = (_ + g) * y.dt;
    return Math.abs(E) < y.opts.precision && Math.abs(p) < y.opts.precision ? l : (y.settled = !1, is_date(e) ? new Date(e.getTime() + E) : e + E);
  } else {
    if (Array.isArray(e))
      return e.map(
        (p, _) => tick_spring(y, s[_], e[_], l[_])
      );
    if (typeof e == "object") {
      const p = {};
      for (const _ in e)
        p[_] = tick_spring(y, s[_], e[_], l[_]);
      return p;
    } else
      throw new Error(`Cannot spring ${typeof e} values`);
  }
}
function spring(y, s = {}) {
  const e = writable(y), { stiffness: l = 0.15, damping: p = 0.8, precision: _ = 0.01 } = s;
  let x, o, g, E = y, u = y, A = 1, L = 0, C = !1;
  function D(n, b = {}) {
    u = n;
    const f = g = {};
    return y == null || b.hard || r.stiffness >= 1 && r.damping >= 1 ? (C = !0, x = now(), E = n, e.set(y = u), Promise.resolve()) : (b.soft && (L = 1 / ((b.soft === !0 ? 0.5 : +b.soft) * 60), A = 0), o || (x = now(), C = !1, o = loop((c) => {
      if (C)
        return C = !1, o = null, !1;
      A = Math.min(A + L, 1);
      const t = {
        inv_mass: A,
        opts: r,
        settled: !0,
        dt: (c - x) * 60 / 1e3
      }, a = tick_spring(t, E, y, u);
      return x = c, E = y, e.set(y = a), t.settled && (o = null), !t.settled;
    })), new Promise((c) => {
      o.promise.then(() => {
        f === g && c();
      });
    }));
  }
  const r = {
    set: D,
    update: (n, b) => D(n(u, y), b),
    subscribe: e.subscribe,
    stiffness: l,
    damping: p,
    precision: _
  };
  return r;
}
const Loader_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$4,
  append: append$3,
  attr: attr$3,
  component_subscribe,
  detach: detach$4,
  element: element$3,
  init: init$4,
  insert: insert$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(y) {
  let s, e, l, p, _, x, o, g, E, u, A, L;
  return {
    c() {
      s = element$3("div"), e = svg_element("svg"), l = svg_element("g"), p = svg_element("path"), _ = svg_element("path"), x = svg_element("path"), o = svg_element("path"), g = svg_element("g"), E = svg_element("path"), u = svg_element("path"), A = svg_element("path"), L = svg_element("path"), attr$3(p, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), attr$3(p, "fill", "#FF7C00"), attr$3(p, "fill-opacity", "0.4"), attr$3(p, "class", "svelte-43sxxs"), attr$3(_, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), attr$3(_, "fill", "#FF7C00"), attr$3(_, "class", "svelte-43sxxs"), attr$3(x, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), attr$3(x, "fill", "#FF7C00"), attr$3(x, "fill-opacity", "0.4"), attr$3(x, "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(l, "transform", "translate(" + /*$top*/
      y[1][0] + "px, " + /*$top*/
      y[1][1] + "px)"), attr$3(E, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), attr$3(E, "fill", "#FF7C00"), attr$3(E, "fill-opacity", "0.4"), attr$3(E, "class", "svelte-43sxxs"), attr$3(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), attr$3(u, "fill", "#FF7C00"), attr$3(u, "class", "svelte-43sxxs"), attr$3(A, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), attr$3(A, "fill", "#FF7C00"), attr$3(A, "fill-opacity", "0.4"), attr$3(A, "class", "svelte-43sxxs"), attr$3(L, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), attr$3(L, "fill", "#FF7C00"), attr$3(L, "class", "svelte-43sxxs"), set_style$1(g, "transform", "translate(" + /*$bottom*/
      y[2][0] + "px, " + /*$bottom*/
      y[2][1] + "px)"), attr$3(e, "viewBox", "-1200 -1200 3000 3000"), attr$3(e, "fill", "none"), attr$3(e, "xmlns", "http://www.w3.org/2000/svg"), attr$3(e, "class", "svelte-43sxxs"), attr$3(s, "class", "svelte-43sxxs"), toggle_class$3(
        s,
        "margin",
        /*margin*/
        y[0]
      );
    },
    m(C, D) {
      insert$4(C, s, D), append$3(s, e), append$3(e, l), append$3(l, p), append$3(l, _), append$3(l, x), append$3(l, o), append$3(e, g), append$3(g, E), append$3(g, u), append$3(g, A), append$3(g, L);
    },
    p(C, [D]) {
      D & /*$top*/
      2 && set_style$1(l, "transform", "translate(" + /*$top*/
      C[1][0] + "px, " + /*$top*/
      C[1][1] + "px)"), D & /*$bottom*/
      4 && set_style$1(g, "transform", "translate(" + /*$bottom*/
      C[2][0] + "px, " + /*$bottom*/
      C[2][1] + "px)"), D & /*margin*/
      1 && toggle_class$3(
        s,
        "margin",
        /*margin*/
        C[0]
      );
    },
    i: noop$3,
    o: noop$3,
    d(C) {
      C && detach$4(s);
    }
  };
}
function instance$4(y, s, e) {
  let l, p, { margin: _ = !0 } = s;
  const x = spring([0, 0]);
  component_subscribe(y, x, (L) => e(1, l = L));
  const o = spring([0, 0]);
  component_subscribe(y, o, (L) => e(2, p = L));
  let g;
  async function E() {
    await Promise.all([x.set([125, 140]), o.set([-125, -140])]), await Promise.all([x.set([-125, 140]), o.set([125, -140])]), await Promise.all([x.set([-125, 0]), o.set([125, -0])]), await Promise.all([x.set([125, 0]), o.set([-125, 0])]);
  }
  async function u() {
    await E(), g || u();
  }
  async function A() {
    await Promise.all([x.set([125, 0]), o.set([-125, 0])]), u();
  }
  return onMount$2(() => (A(), () => g = !0)), y.$$set = (L) => {
    "margin" in L && e(0, _ = L.margin);
  }, [_, l, p, x, o];
}
class Loader extends SvelteComponent$4 {
  constructor(s) {
    super(), init$4(this, s, instance$4, create_fragment$4, safe_not_equal$4, { margin: 0 });
  }
}
const index_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$3,
  append: append$2,
  attr: attr$2,
  binding_callbacks: binding_callbacks$3,
  check_outros: check_outros$2,
  create_component: create_component$2,
  create_slot,
  destroy_component: destroy_component$2,
  destroy_each,
  detach: detach$3,
  element: element$2,
  empty: empty$1,
  ensure_array_like,
  get_all_dirty_from_scope,
  get_slot_changes,
  group_outros: group_outros$2,
  init: init$3,
  insert: insert$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$2,
  text: text$3,
  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, get_error_slot_changes = (y) => ({}), get_error_slot_context = (y) => ({});
function get_each_context(y, s, e) {
  const l = y.slice();
  return l[38] = s[e], l[40] = e, l;
}
function get_each_context_1(y, s, e) {
  const l = y.slice();
  return l[38] = s[e], l;
}
function create_if_block_17(y) {
  let s, e = (
    /*i18n*/
    y[1]("common.error") + ""
  ), l, p, _;
  const x = (
    /*#slots*/
    y[29].error
  ), o = create_slot(
    x,
    y,
    /*$$scope*/
    y[28],
    get_error_slot_context
  );
  return {
    c() {
      s = element$2("span"), l = text$3(e), p = space$2(), o && o.c(), attr$2(s, "class", "error svelte-1yserjw");
    },
    m(g, E) {
      insert$3(g, s, E), append$2(s, l), insert$3(g, p, E), o && o.m(g, E), _ = !0;
    },
    p(g, E) {
      (!_ || E[0] & /*i18n*/
      2) && e !== (e = /*i18n*/
      g[1]("common.error") + "") && set_data$3(l, e), o && o.p && (!_ || E[0] & /*$$scope*/
      268435456) && update_slot_base(
        o,
        x,
        g,
        /*$$scope*/
        g[28],
        _ ? get_slot_changes(
          x,
          /*$$scope*/
          g[28],
          E,
          get_error_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          g[28]
        ),
        get_error_slot_context
      );
    },
    i(g) {
      _ || (transition_in$2(o, g), _ = !0);
    },
    o(g) {
      transition_out$2(o, g), _ = !1;
    },
    d(g) {
      g && (detach$3(s), detach$3(p)), o && o.d(g);
    }
  };
}
function create_if_block$2(y) {
  let s, e, l, p, _, x, o, g, E, u = (
    /*variant*/
    y[8] === "default" && /*show_eta_bar*/
    y[18] && /*show_progress*/
    y[6] === "full" && create_if_block_16(y)
  );
  function A(c, t) {
    if (
      /*progress*/
      c[7]
    )
      return create_if_block_11;
    if (
      /*queue_position*/
      c[2] !== null && /*queue_size*/
      c[3] !== void 0 && /*queue_position*/
      c[2] >= 0
    )
      return create_if_block_14;
    if (
      /*queue_position*/
      c[2] === 0
    )
      return create_if_block_15;
  }
  let L = A(y), C = L && L(y), D = (
    /*timer*/
    y[5] && create_if_block_10(y)
  );
  const r = [create_if_block_2$1, create_if_block_9], n = [];
  function b(c, t) {
    return (
      /*last_progress_level*/
      c[15] != null ? 0 : (
        /*show_progress*/
        c[6] === "full" ? 1 : -1
      )
    );
  }
  ~(_ = b(y)) && (x = n[_] = r[_](y));
  let f = !/*timer*/
  y[5] && create_if_block_1$1(y);
  return {
    c() {
      u && u.c(), s = space$2(), e = element$2("div"), C && C.c(), l = space$2(), D && D.c(), p = space$2(), x && x.c(), o = space$2(), f && f.c(), g = empty$1(), attr$2(e, "class", "progress-text svelte-1yserjw"), toggle_class$2(
        e,
        "meta-text-center",
        /*variant*/
        y[8] === "center"
      ), toggle_class$2(
        e,
        "meta-text",
        /*variant*/
        y[8] === "default"
      );
    },
    m(c, t) {
      u && u.m(c, t), insert$3(c, s, t), insert$3(c, e, t), C && C.m(e, null), append$2(e, l), D && D.m(e, null), insert$3(c, p, t), ~_ && n[_].m(c, t), insert$3(c, o, t), f && f.m(c, t), insert$3(c, g, t), E = !0;
    },
    p(c, t) {
      /*variant*/
      c[8] === "default" && /*show_eta_bar*/
      c[18] && /*show_progress*/
      c[6] === "full" ? u ? u.p(c, t) : (u = create_if_block_16(c), u.c(), u.m(s.parentNode, s)) : u && (u.d(1), u = null), L === (L = A(c)) && C ? C.p(c, t) : (C && C.d(1), C = L && L(c), C && (C.c(), C.m(e, l))), /*timer*/
      c[5] ? D ? D.p(c, t) : (D = create_if_block_10(c), D.c(), D.m(e, null)) : D && (D.d(1), D = null), (!E || t[0] & /*variant*/
      256) && toggle_class$2(
        e,
        "meta-text-center",
        /*variant*/
        c[8] === "center"
      ), (!E || t[0] & /*variant*/
      256) && toggle_class$2(
        e,
        "meta-text",
        /*variant*/
        c[8] === "default"
      );
      let a = _;
      _ = b(c), _ === a ? ~_ && n[_].p(c, t) : (x && (group_outros$2(), transition_out$2(n[a], 1, 1, () => {
        n[a] = null;
      }), check_outros$2()), ~_ ? (x = n[_], x ? x.p(c, t) : (x = n[_] = r[_](c), x.c()), transition_in$2(x, 1), x.m(o.parentNode, o)) : x = null), /*timer*/
      c[5] ? f && (f.d(1), f = null) : f ? f.p(c, t) : (f = create_if_block_1$1(c), f.c(), f.m(g.parentNode, g));
    },
    i(c) {
      E || (transition_in$2(x), E = !0);
    },
    o(c) {
      transition_out$2(x), E = !1;
    },
    d(c) {
      c && (detach$3(s), detach$3(e), detach$3(p), detach$3(o), detach$3(g)), u && u.d(c), C && C.d(), D && D.d(), ~_ && n[_].d(c), f && f.d(c);
    }
  };
}
function create_if_block_16(y) {
  let s, e = `translateX(${/*eta_level*/
  (y[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      s = element$2("div"), attr$2(s, "class", "eta-bar svelte-1yserjw"), set_style(s, "transform", e);
    },
    m(l, p) {
      insert$3(l, s, p);
    },
    p(l, p) {
      p[0] & /*eta_level*/
      131072 && e !== (e = `translateX(${/*eta_level*/
      (l[17] || 0) * 100 - 100}%)`) && set_style(s, "transform", e);
    },
    d(l) {
      l && detach$3(s);
    }
  };
}
function create_if_block_15(y) {
  let s;
  return {
    c() {
      s = text$3("processing |");
    },
    m(e, l) {
      insert$3(e, s, l);
    },
    p: noop$2,
    d(e) {
      e && detach$3(s);
    }
  };
}
function create_if_block_14(y) {
  let s, e = (
    /*queue_position*/
    y[2] + 1 + ""
  ), l, p, _, x;
  return {
    c() {
      s = text$3("queue: "), l = text$3(e), p = text$3("/"), _ = text$3(
        /*queue_size*/
        y[3]
      ), x = text$3(" |");
    },
    m(o, g) {
      insert$3(o, s, g), insert$3(o, l, g), insert$3(o, p, g), insert$3(o, _, g), insert$3(o, x, g);
    },
    p(o, g) {
      g[0] & /*queue_position*/
      4 && e !== (e = /*queue_position*/
      o[2] + 1 + "") && set_data$3(l, e), g[0] & /*queue_size*/
      8 && set_data$3(
        _,
        /*queue_size*/
        o[3]
      );
    },
    d(o) {
      o && (detach$3(s), detach$3(l), detach$3(p), detach$3(_), detach$3(x));
    }
  };
}
function create_if_block_11(y) {
  let s, e = ensure_array_like(
    /*progress*/
    y[7]
  ), l = [];
  for (let p = 0; p < e.length; p += 1)
    l[p] = create_each_block_1(get_each_context_1(y, e, p));
  return {
    c() {
      for (let p = 0; p < l.length; p += 1)
        l[p].c();
      s = empty$1();
    },
    m(p, _) {
      for (let x = 0; x < l.length; x += 1)
        l[x] && l[x].m(p, _);
      insert$3(p, s, _);
    },
    p(p, _) {
      if (_[0] & /*progress*/
      128) {
        e = ensure_array_like(
          /*progress*/
          p[7]
        );
        let x;
        for (x = 0; x < e.length; x += 1) {
          const o = get_each_context_1(p, e, x);
          l[x] ? l[x].p(o, _) : (l[x] = create_each_block_1(o), l[x].c(), l[x].m(s.parentNode, s));
        }
        for (; x < l.length; x += 1)
          l[x].d(1);
        l.length = e.length;
      }
    },
    d(p) {
      p && detach$3(s), destroy_each(l, p);
    }
  };
}
function create_if_block_12(y) {
  let s, e = (
    /*p*/
    y[38].unit + ""
  ), l, p, _ = " ", x;
  function o(u, A) {
    return (
      /*p*/
      u[38].length != null ? create_if_block_13 : create_else_block$1
    );
  }
  let g = o(y), E = g(y);
  return {
    c() {
      E.c(), s = space$2(), l = text$3(e), p = text$3(" | "), x = text$3(_);
    },
    m(u, A) {
      E.m(u, A), insert$3(u, s, A), insert$3(u, l, A), insert$3(u, p, A), insert$3(u, x, A);
    },
    p(u, A) {
      g === (g = o(u)) && E ? E.p(u, A) : (E.d(1), E = g(u), E && (E.c(), E.m(s.parentNode, s))), A[0] & /*progress*/
      128 && e !== (e = /*p*/
      u[38].unit + "") && set_data$3(l, e);
    },
    d(u) {
      u && (detach$3(s), detach$3(l), detach$3(p), detach$3(x)), E.d(u);
    }
  };
}
function create_else_block$1(y) {
  let s = pretty_si(
    /*p*/
    y[38].index || 0
  ) + "", e;
  return {
    c() {
      e = text$3(s);
    },
    m(l, p) {
      insert$3(l, e, p);
    },
    p(l, p) {
      p[0] & /*progress*/
      128 && s !== (s = pretty_si(
        /*p*/
        l[38].index || 0
      ) + "") && set_data$3(e, s);
    },
    d(l) {
      l && detach$3(e);
    }
  };
}
function create_if_block_13(y) {
  let s = pretty_si(
    /*p*/
    y[38].index || 0
  ) + "", e, l, p = pretty_si(
    /*p*/
    y[38].length
  ) + "", _;
  return {
    c() {
      e = text$3(s), l = text$3("/"), _ = text$3(p);
    },
    m(x, o) {
      insert$3(x, e, o), insert$3(x, l, o), insert$3(x, _, o);
    },
    p(x, o) {
      o[0] & /*progress*/
      128 && s !== (s = pretty_si(
        /*p*/
        x[38].index || 0
      ) + "") && set_data$3(e, s), o[0] & /*progress*/
      128 && p !== (p = pretty_si(
        /*p*/
        x[38].length
      ) + "") && set_data$3(_, p);
    },
    d(x) {
      x && (detach$3(e), detach$3(l), detach$3(_));
    }
  };
}
function create_each_block_1(y) {
  let s, e = (
    /*p*/
    y[38].index != null && create_if_block_12(y)
  );
  return {
    c() {
      e && e.c(), s = empty$1();
    },
    m(l, p) {
      e && e.m(l, p), insert$3(l, s, p);
    },
    p(l, p) {
      /*p*/
      l[38].index != null ? e ? e.p(l, p) : (e = create_if_block_12(l), e.c(), e.m(s.parentNode, s)) : e && (e.d(1), e = null);
    },
    d(l) {
      l && detach$3(s), e && e.d(l);
    }
  };
}
function create_if_block_10(y) {
  let s, e = (
    /*eta*/
    y[0] ? `/${/*formatted_eta*/
    y[19]}` : ""
  ), l, p;
  return {
    c() {
      s = text$3(
        /*formatted_timer*/
        y[20]
      ), l = text$3(e), p = text$3("s");
    },
    m(_, x) {
      insert$3(_, s, x), insert$3(_, l, x), insert$3(_, p, x);
    },
    p(_, x) {
      x[0] & /*formatted_timer*/
      1048576 && set_data$3(
        s,
        /*formatted_timer*/
        _[20]
      ), x[0] & /*eta, formatted_eta*/
      524289 && e !== (e = /*eta*/
      _[0] ? `/${/*formatted_eta*/
      _[19]}` : "") && set_data$3(l, e);
    },
    d(_) {
      _ && (detach$3(s), detach$3(l), detach$3(p));
    }
  };
}
function create_if_block_9(y) {
  let s, e;
  return s = new Loader({
    props: { margin: (
      /*variant*/
      y[8] === "default"
    ) }
  }), {
    c() {
      create_component$2(s.$$.fragment);
    },
    m(l, p) {
      mount_component$2(s, l, p), e = !0;
    },
    p(l, p) {
      const _ = {};
      p[0] & /*variant*/
      256 && (_.margin = /*variant*/
      l[8] === "default"), s.$set(_);
    },
    i(l) {
      e || (transition_in$2(s.$$.fragment, l), e = !0);
    },
    o(l) {
      transition_out$2(s.$$.fragment, l), e = !1;
    },
    d(l) {
      destroy_component$2(s, l);
    }
  };
}
function create_if_block_2$1(y) {
  let s, e, l, p, _, x = `${/*last_progress_level*/
  y[15] * 100}%`, o = (
    /*progress*/
    y[7] != null && create_if_block_3$1(y)
  );
  return {
    c() {
      s = element$2("div"), e = element$2("div"), o && o.c(), l = space$2(), p = element$2("div"), _ = element$2("div"), attr$2(e, "class", "progress-level-inner svelte-1yserjw"), attr$2(_, "class", "progress-bar svelte-1yserjw"), set_style(_, "width", x), attr$2(p, "class", "progress-bar-wrap svelte-1yserjw"), attr$2(s, "class", "progress-level svelte-1yserjw");
    },
    m(g, E) {
      insert$3(g, s, E), append$2(s, e), o && o.m(e, null), append$2(s, l), append$2(s, p), append$2(p, _), y[30](_);
    },
    p(g, E) {
      /*progress*/
      g[7] != null ? o ? o.p(g, E) : (o = create_if_block_3$1(g), o.c(), o.m(e, null)) : o && (o.d(1), o = null), E[0] & /*last_progress_level*/
      32768 && x !== (x = `${/*last_progress_level*/
      g[15] * 100}%`) && set_style(_, "width", x);
    },
    i: noop$2,
    o: noop$2,
    d(g) {
      g && detach$3(s), o && o.d(), y[30](null);
    }
  };
}
function create_if_block_3$1(y) {
  let s, e = ensure_array_like(
    /*progress*/
    y[7]
  ), l = [];
  for (let p = 0; p < e.length; p += 1)
    l[p] = create_each_block(get_each_context(y, e, p));
  return {
    c() {
      for (let p = 0; p < l.length; p += 1)
        l[p].c();
      s = empty$1();
    },
    m(p, _) {
      for (let x = 0; x < l.length; x += 1)
        l[x] && l[x].m(p, _);
      insert$3(p, s, _);
    },
    p(p, _) {
      if (_[0] & /*progress_level, progress*/
      16512) {
        e = ensure_array_like(
          /*progress*/
          p[7]
        );
        let x;
        for (x = 0; x < e.length; x += 1) {
          const o = get_each_context(p, e, x);
          l[x] ? l[x].p(o, _) : (l[x] = create_each_block(o), l[x].c(), l[x].m(s.parentNode, s));
        }
        for (; x < l.length; x += 1)
          l[x].d(1);
        l.length = e.length;
      }
    },
    d(p) {
      p && detach$3(s), destroy_each(l, p);
    }
  };
}
function create_if_block_4$1(y) {
  let s, e, l, p, _ = (
    /*i*/
    y[40] !== 0 && create_if_block_8()
  ), x = (
    /*p*/
    y[38].desc != null && create_if_block_7(y)
  ), o = (
    /*p*/
    y[38].desc != null && /*progress_level*/
    y[14] && /*progress_level*/
    y[14][
      /*i*/
      y[40]
    ] != null && create_if_block_6()
  ), g = (
    /*progress_level*/
    y[14] != null && create_if_block_5$1(y)
  );
  return {
    c() {
      _ && _.c(), s = space$2(), x && x.c(), e = space$2(), o && o.c(), l = space$2(), g && g.c(), p = empty$1();
    },
    m(E, u) {
      _ && _.m(E, u), insert$3(E, s, u), x && x.m(E, u), insert$3(E, e, u), o && o.m(E, u), insert$3(E, l, u), g && g.m(E, u), insert$3(E, p, u);
    },
    p(E, u) {
      /*p*/
      E[38].desc != null ? x ? x.p(E, u) : (x = create_if_block_7(E), x.c(), x.m(e.parentNode, e)) : x && (x.d(1), x = null), /*p*/
      E[38].desc != null && /*progress_level*/
      E[14] && /*progress_level*/
      E[14][
        /*i*/
        E[40]
      ] != null ? o || (o = create_if_block_6(), o.c(), o.m(l.parentNode, l)) : o && (o.d(1), o = null), /*progress_level*/
      E[14] != null ? g ? g.p(E, u) : (g = create_if_block_5$1(E), g.c(), g.m(p.parentNode, p)) : g && (g.d(1), g = null);
    },
    d(E) {
      E && (detach$3(s), detach$3(e), detach$3(l), detach$3(p)), _ && _.d(E), x && x.d(E), o && o.d(E), g && g.d(E);
    }
  };
}
function create_if_block_8(y) {
  let s;
  return {
    c() {
      s = text$3(" /");
    },
    m(e, l) {
      insert$3(e, s, l);
    },
    d(e) {
      e && detach$3(s);
    }
  };
}
function create_if_block_7(y) {
  let s = (
    /*p*/
    y[38].desc + ""
  ), e;
  return {
    c() {
      e = text$3(s);
    },
    m(l, p) {
      insert$3(l, e, p);
    },
    p(l, p) {
      p[0] & /*progress*/
      128 && s !== (s = /*p*/
      l[38].desc + "") && set_data$3(e, s);
    },
    d(l) {
      l && detach$3(e);
    }
  };
}
function create_if_block_6(y) {
  let s;
  return {
    c() {
      s = text$3("-");
    },
    m(e, l) {
      insert$3(e, s, l);
    },
    d(e) {
      e && detach$3(s);
    }
  };
}
function create_if_block_5$1(y) {
  let s = (100 * /*progress_level*/
  (y[14][
    /*i*/
    y[40]
  ] || 0)).toFixed(1) + "", e, l;
  return {
    c() {
      e = text$3(s), l = text$3("%");
    },
    m(p, _) {
      insert$3(p, e, _), insert$3(p, l, _);
    },
    p(p, _) {
      _[0] & /*progress_level*/
      16384 && s !== (s = (100 * /*progress_level*/
      (p[14][
        /*i*/
        p[40]
      ] || 0)).toFixed(1) + "") && set_data$3(e, s);
    },
    d(p) {
      p && (detach$3(e), detach$3(l));
    }
  };
}
function create_each_block(y) {
  let s, e = (
    /*p*/
    (y[38].desc != null || /*progress_level*/
    y[14] && /*progress_level*/
    y[14][
      /*i*/
      y[40]
    ] != null) && create_if_block_4$1(y)
  );
  return {
    c() {
      e && e.c(), s = empty$1();
    },
    m(l, p) {
      e && e.m(l, p), insert$3(l, s, p);
    },
    p(l, p) {
      /*p*/
      l[38].desc != null || /*progress_level*/
      l[14] && /*progress_level*/
      l[14][
        /*i*/
        l[40]
      ] != null ? e ? e.p(l, p) : (e = create_if_block_4$1(l), e.c(), e.m(s.parentNode, s)) : e && (e.d(1), e = null);
    },
    d(l) {
      l && detach$3(s), e && e.d(l);
    }
  };
}
function create_if_block_1$1(y) {
  let s, e;
  return {
    c() {
      s = element$2("p"), e = text$3(
        /*loading_text*/
        y[9]
      ), attr$2(s, "class", "loading svelte-1yserjw");
    },
    m(l, p) {
      insert$3(l, s, p), append$2(s, e);
    },
    p(l, p) {
      p[0] & /*loading_text*/
      512 && set_data$3(
        e,
        /*loading_text*/
        l[9]
      );
    },
    d(l) {
      l && detach$3(s);
    }
  };
}
function create_fragment$3(y) {
  let s, e, l, p, _;
  const x = [create_if_block$2, create_if_block_17], o = [];
  function g(E, u) {
    return (
      /*status*/
      E[4] === "pending" ? 0 : (
        /*status*/
        E[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(e = g(y)) && (l = o[e] = x[e](y)), {
    c() {
      s = element$2("div"), l && l.c(), attr$2(s, "class", p = "wrap " + /*variant*/
      y[8] + " " + /*show_progress*/
      y[6] + " svelte-1yserjw"), toggle_class$2(s, "hide", !/*status*/
      y[4] || /*status*/
      y[4] === "complete" || /*show_progress*/
      y[6] === "hidden"), toggle_class$2(
        s,
        "translucent",
        /*variant*/
        y[8] === "center" && /*status*/
        (y[4] === "pending" || /*status*/
        y[4] === "error") || /*translucent*/
        y[11] || /*show_progress*/
        y[6] === "minimal"
      ), toggle_class$2(
        s,
        "generating",
        /*status*/
        y[4] === "generating"
      ), toggle_class$2(
        s,
        "border",
        /*border*/
        y[12]
      ), set_style(
        s,
        "position",
        /*absolute*/
        y[10] ? "absolute" : "static"
      ), set_style(
        s,
        "padding",
        /*absolute*/
        y[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(E, u) {
      insert$3(E, s, u), ~e && o[e].m(s, null), y[31](s), _ = !0;
    },
    p(E, u) {
      let A = e;
      e = g(E), e === A ? ~e && o[e].p(E, u) : (l && (group_outros$2(), transition_out$2(o[A], 1, 1, () => {
        o[A] = null;
      }), check_outros$2()), ~e ? (l = o[e], l ? l.p(E, u) : (l = o[e] = x[e](E), l.c()), transition_in$2(l, 1), l.m(s, null)) : l = null), (!_ || u[0] & /*variant, show_progress*/
      320 && p !== (p = "wrap " + /*variant*/
      E[8] + " " + /*show_progress*/
      E[6] + " svelte-1yserjw")) && attr$2(s, "class", p), (!_ || u[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$2(s, "hide", !/*status*/
      E[4] || /*status*/
      E[4] === "complete" || /*show_progress*/
      E[6] === "hidden"), (!_ || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && toggle_class$2(
        s,
        "translucent",
        /*variant*/
        E[8] === "center" && /*status*/
        (E[4] === "pending" || /*status*/
        E[4] === "error") || /*translucent*/
        E[11] || /*show_progress*/
        E[6] === "minimal"
      ), (!_ || u[0] & /*variant, show_progress, status*/
      336) && toggle_class$2(
        s,
        "generating",
        /*status*/
        E[4] === "generating"
      ), (!_ || u[0] & /*variant, show_progress, border*/
      4416) && toggle_class$2(
        s,
        "border",
        /*border*/
        E[12]
      ), u[0] & /*absolute*/
      1024 && set_style(
        s,
        "position",
        /*absolute*/
        E[10] ? "absolute" : "static"
      ), u[0] & /*absolute*/
      1024 && set_style(
        s,
        "padding",
        /*absolute*/
        E[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(E) {
      _ || (transition_in$2(l), _ = !0);
    },
    o(E) {
      transition_out$2(l), _ = !1;
    },
    d(E) {
      E && detach$3(s), ~e && o[e].d(), y[31](null);
    }
  };
}
let items = [], called = !1;
async function scroll_into_view(y, s = !0) {
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && s !== !0)) {
    if (items.push(y), !called)
      called = !0;
    else
      return;
    await tick$1(), requestAnimationFrame(() => {
      let e = [0, 0];
      for (let l = 0; l < items.length; l++) {
        const _ = items[l].getBoundingClientRect();
        (l === 0 || _.top + window.scrollY <= e[0]) && (e[0] = _.top + window.scrollY, e[1] = l);
      }
      window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), called = !1, items = [];
    });
  }
}
function instance$3(y, s, e) {
  let l, { $$slots: p = {}, $$scope: _ } = s, { i18n: x } = s, { eta: o = null } = s, { queue_position: g } = s, { queue_size: E } = s, { status: u } = s, { scroll_to_output: A = !1 } = s, { timer: L = !0 } = s, { show_progress: C = "full" } = s, { message: D = null } = s, { progress: r = null } = s, { variant: n = "default" } = s, { loading_text: b = "Loading..." } = s, { absolute: f = !0 } = s, { translucent: c = !1 } = s, { border: t = !1 } = s, { autoscroll: a } = s, h, M = !1, w = 0, S = 0, T = null, R = null, $ = 0, P = null, B, F = null, U = !0;
  const z = () => {
    e(0, o = e(26, T = e(19, N = null))), e(24, w = performance.now()), e(25, S = 0), M = !0, W();
  };
  function W() {
    requestAnimationFrame(() => {
      e(25, S = (performance.now() - w) / 1e3), M && W();
    });
  }
  function V() {
    e(25, S = 0), e(0, o = e(26, T = e(19, N = null))), M && (M = !1);
  }
  onDestroy(() => {
    M && V();
  });
  let N = null;
  function k(Q) {
    binding_callbacks$3[Q ? "unshift" : "push"](() => {
      F = Q, e(16, F), e(7, r), e(14, P), e(15, B);
    });
  }
  function G(Q) {
    binding_callbacks$3[Q ? "unshift" : "push"](() => {
      h = Q, e(13, h);
    });
  }
  return y.$$set = (Q) => {
    "i18n" in Q && e(1, x = Q.i18n), "eta" in Q && e(0, o = Q.eta), "queue_position" in Q && e(2, g = Q.queue_position), "queue_size" in Q && e(3, E = Q.queue_size), "status" in Q && e(4, u = Q.status), "scroll_to_output" in Q && e(21, A = Q.scroll_to_output), "timer" in Q && e(5, L = Q.timer), "show_progress" in Q && e(6, C = Q.show_progress), "message" in Q && e(22, D = Q.message), "progress" in Q && e(7, r = Q.progress), "variant" in Q && e(8, n = Q.variant), "loading_text" in Q && e(9, b = Q.loading_text), "absolute" in Q && e(10, f = Q.absolute), "translucent" in Q && e(11, c = Q.translucent), "border" in Q && e(12, t = Q.border), "autoscroll" in Q && e(23, a = Q.autoscroll), "$$scope" in Q && e(28, _ = Q.$$scope);
  }, y.$$.update = () => {
    y.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    218103809 && (o === null && e(0, o = T), o != null && T !== o && (e(27, R = (performance.now() - w) / 1e3 + o), e(19, N = R.toFixed(1)), e(26, T = o))), y.$$.dirty[0] & /*eta_from_start, timer_diff*/
    167772160 && e(17, $ = R === null || R <= 0 || !S ? null : Math.min(S / R, 1)), y.$$.dirty[0] & /*progress*/
    128 && r != null && e(18, U = !1), y.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (r != null ? e(14, P = r.map((Q) => {
      if (Q.index != null && Q.length != null)
        return Q.index / Q.length;
      if (Q.progress != null)
        return Q.progress;
    })) : e(14, P = null), P ? (e(15, B = P[P.length - 1]), F && (B === 0 ? e(16, F.style.transition = "0", F) : e(16, F.style.transition = "150ms", F))) : e(15, B = void 0)), y.$$.dirty[0] & /*status*/
    16 && (u === "pending" ? z() : V()), y.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    10493968 && h && A && (u === "pending" || u === "complete") && scroll_into_view(h, a), y.$$.dirty[0] & /*status, message*/
    4194320, y.$$.dirty[0] & /*timer_diff*/
    33554432 && e(20, l = S.toFixed(1));
  }, [
    o,
    x,
    g,
    E,
    u,
    L,
    C,
    r,
    n,
    b,
    f,
    c,
    t,
    h,
    P,
    B,
    F,
    $,
    U,
    N,
    l,
    A,
    D,
    a,
    w,
    S,
    T,
    R,
    _,
    p,
    k,
    G
  ];
}
class Static extends SvelteComponent$3 {
  constructor(s) {
    super(), init$3(
      this,
      s,
      instance$3,
      create_fragment$3,
      safe_not_equal$3,
      {
        i18n: 1,
        eta: 0,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 21,
        timer: 5,
        show_progress: 6,
        message: 22,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 23
      },
      null,
      [-1, -1]
    );
  }
}
const ToastContent_svelte_svelte_type_style_lang = "", Toast_svelte_svelte_type_style_lang = "", Example_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$2,
  add_iframe_resize_listener,
  add_render_callback: add_render_callback$1,
  append: append$1,
  attr: attr$1,
  binding_callbacks: binding_callbacks$2,
  detach: detach$2,
  element: element$1,
  init: init$2,
  insert: insert$2,
  noop: noop$1,
  safe_not_equal: safe_not_equal$2,
  set_data: set_data$2,
  text: text$2,
  toggle_class: toggle_class$1
} = window.__gradio__svelte__internal, { onMount: onMount$1 } = window.__gradio__svelte__internal;
function create_fragment$2(y) {
  let s, e = (
    /*value*/
    (y[0] ? (
      /*value*/
      y[0]
    ) : "") + ""
  ), l, p;
  return {
    c() {
      s = element$1("div"), l = text$2(e), attr$1(s, "class", "svelte-84cxb8"), add_render_callback$1(() => (
        /*div_elementresize_handler*/
        y[5].call(s)
      )), toggle_class$1(
        s,
        "table",
        /*type*/
        y[1] === "table"
      ), toggle_class$1(
        s,
        "gallery",
        /*type*/
        y[1] === "gallery"
      ), toggle_class$1(
        s,
        "selected",
        /*selected*/
        y[2]
      );
    },
    m(_, x) {
      insert$2(_, s, x), append$1(s, l), p = add_iframe_resize_listener(
        s,
        /*div_elementresize_handler*/
        y[5].bind(s)
      ), y[6](s);
    },
    p(_, [x]) {
      x & /*value*/
      1 && e !== (e = /*value*/
      (_[0] ? (
        /*value*/
        _[0]
      ) : "") + "") && set_data$2(l, e), x & /*type*/
      2 && toggle_class$1(
        s,
        "table",
        /*type*/
        _[1] === "table"
      ), x & /*type*/
      2 && toggle_class$1(
        s,
        "gallery",
        /*type*/
        _[1] === "gallery"
      ), x & /*selected*/
      4 && toggle_class$1(
        s,
        "selected",
        /*selected*/
        _[2]
      );
    },
    i: noop$1,
    o: noop$1,
    d(_) {
      _ && detach$2(s), p(), y[6](null);
    }
  };
}
function instance$2(y, s, e) {
  let { value: l } = s, { type: p } = s, { selected: _ = !1 } = s, x, o;
  function g(A, L) {
    !A || !L || (o.style.setProperty("--local-text-width", `${L < 150 ? L : 200}px`), e(4, o.style.whiteSpace = "unset", o));
  }
  onMount$1(() => {
    g(o, x);
  });
  function E() {
    x = this.clientWidth, e(3, x);
  }
  function u(A) {
    binding_callbacks$2[A ? "unshift" : "push"](() => {
      o = A, e(4, o);
    });
  }
  return y.$$set = (A) => {
    "value" in A && e(0, l = A.value), "type" in A && e(1, p = A.type), "selected" in A && e(2, _ = A.selected);
  }, [l, p, _, x, o, E, u];
}
class Example extends SvelteComponent$2 {
  constructor(s) {
    super(), init$2(this, s, instance$2, create_fragment$2, safe_not_equal$2, { value: 0, type: 1, selected: 2 });
  }
}
const Textbox_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$1,
  action_destroyer,
  add_render_callback,
  append,
  attr,
  binding_callbacks: binding_callbacks$1,
  bubble,
  check_outros: check_outros$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: insert$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(y) {
  let s;
  return {
    c() {
      s = text$1(
        /*label*/
        y[3]
      );
    },
    m(e, l) {
      insert$1(e, s, l);
    },
    p(e, l) {
      l[0] & /*label*/
      8 && set_data$1(
        s,
        /*label*/
        e[3]
      );
    },
    d(e) {
      e && detach$1(s);
    }
  };
}
function create_else_block(y) {
  let s, e, l, p, _, x, o, g, E = (
    /*show_label*/
    y[6] && /*show_copy_button*/
    y[10] && create_if_block_4(y)
  );
  return {
    c() {
      E && E.c(), s = space$1(), e = element("textarea"), attr(e, "data-testid", "textbox"), attr(e, "class", "scroll-hide svelte-18tqgac"), attr(e, "dir", l = /*rtl*/
      y[11] ? "rtl" : "ltr"), attr(
        e,
        "placeholder",
        /*placeholder*/
        y[2]
      ), attr(
        e,
        "rows",
        /*lines*/
        y[1]
      ), e.disabled = /*disabled*/
      y[5], e.autofocus = /*autofocus*/
      y[12], attr(e, "style", p = /*text_align*/
      y[13] ? "text-align: " + /*text_align*/
      y[13] : "");
    },
    m(u, A) {
      E && E.m(u, A), insert$1(u, s, A), insert$1(u, e, A), set_input_value(
        e,
        /*value*/
        y[0]
      ), y[38](e), x = !0, /*autofocus*/
      y[12] && e.focus(), o || (g = [
        action_destroyer(_ = /*text_area_resize*/
        y[20].call(
          null,
          e,
          /*value*/
          y[0]
        )),
        listen(
          e,
          "input",
          /*textarea_input_handler*/
          y[37]
        ),
        listen(
          e,
          "keypress",
          /*handle_keypress*/
          y[18]
        ),
        listen(
          e,
          "blur",
          /*blur_handler_3*/
          y[29]
        ),
        listen(
          e,
          "select",
          /*handle_select*/
          y[17]
        ),
        listen(
          e,
          "focus",
          /*focus_handler_3*/
          y[30]
        ),
        listen(
          e,
          "scroll",
          /*handle_scroll*/
          y[19]
        )
      ], o = !0);
    },
    p(u, A) {
      /*show_label*/
      u[6] && /*show_copy_button*/
      u[10] ? E ? (E.p(u, A), A[0] & /*show_label, show_copy_button*/
      1088 && transition_in$1(E, 1)) : (E = create_if_block_4(u), E.c(), transition_in$1(E, 1), E.m(s.parentNode, s)) : E && (group_outros$1(), transition_out$1(E, 1, 1, () => {
        E = null;
      }), check_outros$1()), (!x || A[0] & /*rtl*/
      2048 && l !== (l = /*rtl*/
      u[11] ? "rtl" : "ltr")) && attr(e, "dir", l), (!x || A[0] & /*placeholder*/
      4) && attr(
        e,
        "placeholder",
        /*placeholder*/
        u[2]
      ), (!x || A[0] & /*lines*/
      2) && attr(
        e,
        "rows",
        /*lines*/
        u[1]
      ), (!x || A[0] & /*disabled*/
      32) && (e.disabled = /*disabled*/
      u[5]), (!x || A[0] & /*autofocus*/
      4096) && (e.autofocus = /*autofocus*/
      u[12]), (!x || A[0] & /*text_align*/
      8192 && p !== (p = /*text_align*/
      u[13] ? "text-align: " + /*text_align*/
      u[13] : "")) && attr(e, "style", p), _ && is_function(_.update) && A[0] & /*value*/
      1 && _.update.call(
        null,
        /*value*/
        u[0]
      ), A[0] & /*value*/
      1 && set_input_value(
        e,
        /*value*/
        u[0]
      );
    },
    i(u) {
      x || (transition_in$1(E), x = !0);
    },
    o(u) {
      transition_out$1(E), x = !1;
    },
    d(u) {
      u && (detach$1(s), detach$1(e)), E && E.d(u), y[38](null), o = !1, run_all(g);
    }
  };
}
function create_if_block$1(y) {
  let s;
  function e(_, x) {
    if (
      /*type*/
      _[9] === "text"
    )
      return create_if_block_1;
    if (
      /*type*/
      _[9] === "password"
    )
      return create_if_block_2;
    if (
      /*type*/
      _[9] === "email"
    )
      return create_if_block_3;
  }
  let l = e(y), p = l && l(y);
  return {
    c() {
      p && p.c(), s = empty();
    },
    m(_, x) {
      p && p.m(_, x), insert$1(_, s, x);
    },
    p(_, x) {
      l === (l = e(_)) && p ? p.p(_, x) : (p && p.d(1), p = l && l(_), p && (p.c(), p.m(s.parentNode, s)));
    },
    i: noop,
    o: noop,
    d(_) {
      _ && detach$1(s), p && p.d(_);
    }
  };
}
function create_if_block_4(y) {
  let s, e, l, p;
  const _ = [create_if_block_5, create_else_block_1], x = [];
  function o(g, E) {
    return (
      /*copied*/
      g[15] ? 0 : 1
    );
  }
  return s = o(y), e = x[s] = _[s](y), {
    c() {
      e.c(), l = empty();
    },
    m(g, E) {
      x[s].m(g, E), insert$1(g, l, E), p = !0;
    },
    p(g, E) {
      let u = s;
      s = o(g), s === u ? x[s].p(g, E) : (group_outros$1(), transition_out$1(x[u], 1, 1, () => {
        x[u] = null;
      }), check_outros$1(), e = x[s], e ? e.p(g, E) : (e = x[s] = _[s](g), e.c()), transition_in$1(e, 1), e.m(l.parentNode, l));
    },
    i(g) {
      p || (transition_in$1(e), p = !0);
    },
    o(g) {
      transition_out$1(e), p = !1;
    },
    d(g) {
      g && detach$1(l), x[s].d(g);
    }
  };
}
function create_else_block_1(y) {
  let s, e, l, p, _;
  return e = new Copy({}), {
    c() {
      s = element("button"), create_component$1(e.$$.fragment), attr(s, "aria-label", "Copy"), attr(s, "aria-roledescription", "Copy text"), attr(s, "class", "svelte-18tqgac");
    },
    m(x, o) {
      insert$1(x, s, o), mount_component$1(e, s, null), l = !0, p || (_ = listen(
        s,
        "click",
        /*handle_copy*/
        y[16]
      ), p = !0);
    },
    p: noop,
    i(x) {
      l || (transition_in$1(e.$$.fragment, x), l = !0);
    },
    o(x) {
      transition_out$1(e.$$.fragment, x), l = !1;
    },
    d(x) {
      x && detach$1(s), destroy_component$1(e), p = !1, _();
    }
  };
}
function create_if_block_5(y) {
  let s, e, l, p;
  return e = new Check({}), {
    c() {
      s = element("button"), create_component$1(e.$$.fragment), attr(s, "aria-label", "Copied"), attr(s, "aria-roledescription", "Text copied"), attr(s, "class", "svelte-18tqgac");
    },
    m(_, x) {
      insert$1(_, s, x), mount_component$1(e, s, null), p = !0;
    },
    p: noop,
    i(_) {
      p || (transition_in$1(e.$$.fragment, _), _ && (l || add_render_callback(() => {
        l = create_in_transition(s, fade, { duration: 300 }), l.start();
      })), p = !0);
    },
    o(_) {
      transition_out$1(e.$$.fragment, _), p = !1;
    },
    d(_) {
      _ && detach$1(s), destroy_component$1(e);
    }
  };
}
function create_if_block_3(y) {
  let s, e, l;
  return {
    c() {
      s = element("input"), attr(s, "data-testid", "textbox"), attr(s, "type", "email"), attr(s, "class", "scroll-hide svelte-18tqgac"), attr(
        s,
        "placeholder",
        /*placeholder*/
        y[2]
      ), s.disabled = /*disabled*/
      y[5], s.autofocus = /*autofocus*/
      y[12], attr(s, "autocomplete", "email");
    },
    m(p, _) {
      insert$1(p, s, _), set_input_value(
        s,
        /*value*/
        y[0]
      ), y[36](s), /*autofocus*/
      y[12] && s.focus(), e || (l = [
        listen(
          s,
          "input",
          /*input_input_handler_2*/
          y[35]
        ),
        listen(
          s,
          "keypress",
          /*handle_keypress*/
          y[18]
        ),
        listen(
          s,
          "blur",
          /*blur_handler_2*/
          y[27]
        ),
        listen(
          s,
          "select",
          /*handle_select*/
          y[17]
        ),
        listen(
          s,
          "focus",
          /*focus_handler_2*/
          y[28]
        )
      ], e = !0);
    },
    p(p, _) {
      _[0] & /*placeholder*/
      4 && attr(
        s,
        "placeholder",
        /*placeholder*/
        p[2]
      ), _[0] & /*disabled*/
      32 && (s.disabled = /*disabled*/
      p[5]), _[0] & /*autofocus*/
      4096 && (s.autofocus = /*autofocus*/
      p[12]), _[0] & /*value*/
      1 && s.value !== /*value*/
      p[0] && set_input_value(
        s,
        /*value*/
        p[0]
      );
    },
    d(p) {
      p && detach$1(s), y[36](null), e = !1, run_all(l);
    }
  };
}
function create_if_block_2(y) {
  let s, e, l;
  return {
    c() {
      s = element("input"), attr(s, "data-testid", "password"), attr(s, "type", "password"), attr(s, "class", "scroll-hide svelte-18tqgac"), attr(
        s,
        "placeholder",
        /*placeholder*/
        y[2]
      ), s.disabled = /*disabled*/
      y[5], s.autofocus = /*autofocus*/
      y[12], attr(s, "autocomplete", "");
    },
    m(p, _) {
      insert$1(p, s, _), set_input_value(
        s,
        /*value*/
        y[0]
      ), y[34](s), /*autofocus*/
      y[12] && s.focus(), e || (l = [
        listen(
          s,
          "input",
          /*input_input_handler_1*/
          y[33]
        ),
        listen(
          s,
          "keypress",
          /*handle_keypress*/
          y[18]
        ),
        listen(
          s,
          "blur",
          /*blur_handler_1*/
          y[25]
        ),
        listen(
          s,
          "select",
          /*handle_select*/
          y[17]
        ),
        listen(
          s,
          "focus",
          /*focus_handler_1*/
          y[26]
        )
      ], e = !0);
    },
    p(p, _) {
      _[0] & /*placeholder*/
      4 && attr(
        s,
        "placeholder",
        /*placeholder*/
        p[2]
      ), _[0] & /*disabled*/
      32 && (s.disabled = /*disabled*/
      p[5]), _[0] & /*autofocus*/
      4096 && (s.autofocus = /*autofocus*/
      p[12]), _[0] & /*value*/
      1 && s.value !== /*value*/
      p[0] && set_input_value(
        s,
        /*value*/
        p[0]
      );
    },
    d(p) {
      p && detach$1(s), y[34](null), e = !1, run_all(l);
    }
  };
}
function create_if_block_1(y) {
  let s, e, l, p, _;
  return {
    c() {
      s = element("input"), attr(s, "data-testid", "textbox"), attr(s, "type", "text"), attr(s, "class", "scroll-hide svelte-18tqgac"), attr(s, "dir", e = /*rtl*/
      y[11] ? "rtl" : "ltr"), attr(
        s,
        "placeholder",
        /*placeholder*/
        y[2]
      ), s.disabled = /*disabled*/
      y[5], s.autofocus = /*autofocus*/
      y[12], attr(s, "style", l = /*text_align*/
      y[13] ? "text-align: " + /*text_align*/
      y[13] : "");
    },
    m(x, o) {
      insert$1(x, s, o), set_input_value(
        s,
        /*value*/
        y[0]
      ), y[32](s), /*autofocus*/
      y[12] && s.focus(), p || (_ = [
        listen(
          s,
          "input",
          /*input_input_handler*/
          y[31]
        ),
        listen(
          s,
          "keypress",
          /*handle_keypress*/
          y[18]
        ),
        listen(
          s,
          "blur",
          /*blur_handler*/
          y[23]
        ),
        listen(
          s,
          "select",
          /*handle_select*/
          y[17]
        ),
        listen(
          s,
          "focus",
          /*focus_handler*/
          y[24]
        )
      ], p = !0);
    },
    p(x, o) {
      o[0] & /*rtl*/
      2048 && e !== (e = /*rtl*/
      x[11] ? "rtl" : "ltr") && attr(s, "dir", e), o[0] & /*placeholder*/
      4 && attr(
        s,
        "placeholder",
        /*placeholder*/
        x[2]
      ), o[0] & /*disabled*/
      32 && (s.disabled = /*disabled*/
      x[5]), o[0] & /*autofocus*/
      4096 && (s.autofocus = /*autofocus*/
      x[12]), o[0] & /*text_align*/
      8192 && l !== (l = /*text_align*/
      x[13] ? "text-align: " + /*text_align*/
      x[13] : "") && attr(s, "style", l), o[0] & /*value*/
      1 && s.value !== /*value*/
      x[0] && set_input_value(
        s,
        /*value*/
        x[0]
      );
    },
    d(x) {
      x && detach$1(s), y[32](null), p = !1, run_all(_);
    }
  };
}
function create_fragment$1(y) {
  let s, e, l, p, _, x;
  e = new BlockTitle({
    props: {
      show_label: (
        /*show_label*/
        y[6]
      ),
      info: (
        /*info*/
        y[4]
      ),
      $$slots: { default: [create_default_slot$1] },
      $$scope: { ctx: y }
    }
  });
  const o = [create_if_block$1, create_else_block], g = [];
  function E(u, A) {
    return (
      /*lines*/
      u[1] === 1 && /*max_lines*/
      u[8] === 1 ? 0 : 1
    );
  }
  return p = E(y), _ = g[p] = o[p](y), {
    c() {
      s = element("label"), create_component$1(e.$$.fragment), l = space$1(), _.c(), attr(s, "class", "svelte-18tqgac"), toggle_class(
        s,
        "container",
        /*container*/
        y[7]
      );
    },
    m(u, A) {
      insert$1(u, s, A), mount_component$1(e, s, null), append(s, l), g[p].m(s, null), x = !0;
    },
    p(u, A) {
      const L = {};
      A[0] & /*show_label*/
      64 && (L.show_label = /*show_label*/
      u[6]), A[0] & /*info*/
      16 && (L.info = /*info*/
      u[4]), A[0] & /*label*/
      8 | A[1] & /*$$scope*/
      131072 && (L.$$scope = { dirty: A, ctx: u }), e.$set(L);
      let C = p;
      p = E(u), p === C ? g[p].p(u, A) : (group_outros$1(), transition_out$1(g[C], 1, 1, () => {
        g[C] = null;
      }), check_outros$1(), _ = g[p], _ ? _.p(u, A) : (_ = g[p] = o[p](u), _.c()), transition_in$1(_, 1), _.m(s, null)), (!x || A[0] & /*container*/
      128) && toggle_class(
        s,
        "container",
        /*container*/
        u[7]
      );
    },
    i(u) {
      x || (transition_in$1(e.$$.fragment, u), transition_in$1(_), x = !0);
    },
    o(u) {
      transition_out$1(e.$$.fragment, u), transition_out$1(_), x = !1;
    },
    d(u) {
      u && detach$1(s), destroy_component$1(e), g[p].d();
    }
  };
}
function instance$1(y, s, e) {
  let { value: l = "" } = s, { value_is_output: p = !1 } = s, { lines: _ = 1 } = s, { placeholder: x = "Type here..." } = s, { label: o } = s, { info: g = void 0 } = s, { disabled: E = !1 } = s, { show_label: u = !0 } = s, { container: A = !0 } = s, { max_lines: L } = s, { type: C = "text" } = s, { show_copy_button: D = !1 } = s, { rtl: r = !1 } = s, { autofocus: n = !1 } = s, { text_align: b = void 0 } = s, { autoscroll: f = !0 } = s, c, t = !1, a, h, M = 0, w = !1;
  const S = createEventDispatcher();
  beforeUpdate(() => {
    h = c && c.offsetHeight + c.scrollTop > c.scrollHeight - 100;
  });
  const T = () => {
    h && f && !w && c.scrollTo(0, c.scrollHeight);
  };
  function R() {
    S("change", l), p || S("input");
  }
  afterUpdate(() => {
    n && c.focus(), h && f && T(), e(21, p = !1);
  });
  async function $() {
    "clipboard" in navigator && (await navigator.clipboard.writeText(l), P());
  }
  function P() {
    e(15, t = !0), a && clearTimeout(a), a = setTimeout(
      () => {
        e(15, t = !1);
      },
      1e3
    );
  }
  function B(re) {
    const Se = re.target, ke = Se.value, $e = [Se.selectionStart, Se.selectionEnd];
    S("select", { value: ke.substring(...$e), index: $e });
  }
  async function F(re) {
    await tick(), (re.key === "Enter" && re.shiftKey && _ > 1 || re.key === "Enter" && !re.shiftKey && _ === 1 && L >= 1) && (re.preventDefault(), S("submit"));
  }
  function U(re) {
    const Se = re.target, ke = Se.scrollTop;
    ke < M && (w = !0), M = ke;
    const $e = Se.scrollHeight - Se.clientHeight;
    ke >= $e && (w = !1);
  }
  async function z(re) {
    if (await tick(), _ === L)
      return;
    let Se = L === void 0 ? !1 : L === void 0 ? 21 * 11 : 21 * (L + 1), ke = 21 * (_ + 1);
    const $e = re.target;
    $e.style.height = "1px";
    let ze;
    Se && $e.scrollHeight > Se ? ze = Se : $e.scrollHeight < ke ? ze = ke : ze = $e.scrollHeight, $e.style.height = `${ze}px`;
  }
  function W(re, Se) {
    if (_ !== L && (re.style.overflowY = "scroll", re.addEventListener("input", z), !!Se.trim()))
      return z({ target: re }), {
        destroy: () => re.removeEventListener("input", z)
      };
  }
  function V(re) {
    bubble.call(this, y, re);
  }
  function N(re) {
    bubble.call(this, y, re);
  }
  function k(re) {
    bubble.call(this, y, re);
  }
  function G(re) {
    bubble.call(this, y, re);
  }
  function Q(re) {
    bubble.call(this, y, re);
  }
  function ie(re) {
    bubble.call(this, y, re);
  }
  function ge(re) {
    bubble.call(this, y, re);
  }
  function le(re) {
    bubble.call(this, y, re);
  }
  function oe() {
    l = this.value, e(0, l);
  }
  function he(re) {
    binding_callbacks$1[re ? "unshift" : "push"](() => {
      c = re, e(14, c);
    });
  }
  function se() {
    l = this.value, e(0, l);
  }
  function xe(re) {
    binding_callbacks$1[re ? "unshift" : "push"](() => {
      c = re, e(14, c);
    });
  }
  function ye() {
    l = this.value, e(0, l);
  }
  function Pe(re) {
    binding_callbacks$1[re ? "unshift" : "push"](() => {
      c = re, e(14, c);
    });
  }
  function de() {
    l = this.value, e(0, l);
  }
  function pe(re) {
    binding_callbacks$1[re ? "unshift" : "push"](() => {
      c = re, e(14, c);
    });
  }
  return y.$$set = (re) => {
    "value" in re && e(0, l = re.value), "value_is_output" in re && e(21, p = re.value_is_output), "lines" in re && e(1, _ = re.lines), "placeholder" in re && e(2, x = re.placeholder), "label" in re && e(3, o = re.label), "info" in re && e(4, g = re.info), "disabled" in re && e(5, E = re.disabled), "show_label" in re && e(6, u = re.show_label), "container" in re && e(7, A = re.container), "max_lines" in re && e(8, L = re.max_lines), "type" in re && e(9, C = re.type), "show_copy_button" in re && e(10, D = re.show_copy_button), "rtl" in re && e(11, r = re.rtl), "autofocus" in re && e(12, n = re.autofocus), "text_align" in re && e(13, b = re.text_align), "autoscroll" in re && e(22, f = re.autoscroll);
  }, y.$$.update = () => {
    y.$$.dirty[0] & /*value*/
    1 && l === null && e(0, l = ""), y.$$.dirty[0] & /*value, el, lines, max_lines*/
    16643 && c && _ !== L && z({ target: c }), y.$$.dirty[0] & /*value*/
    1 && R();
  }, [
    l,
    _,
    x,
    o,
    g,
    E,
    u,
    A,
    L,
    C,
    D,
    r,
    n,
    b,
    c,
    t,
    $,
    B,
    F,
    U,
    W,
    p,
    f,
    V,
    N,
    k,
    G,
    Q,
    ie,
    ge,
    le,
    oe,
    he,
    se,
    xe,
    ye,
    Pe,
    de,
    pe
  ];
}
class Textbox extends SvelteComponent$1 {
  constructor(s) {
    super(), init$1(
      this,
      s,
      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,
  create_component,
  destroy_component,
  detach,
  flush,
  get_spread_object,
  get_spread_update,
  group_outros,
  init,
  insert,
  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(y) {
  let s, e;
  const l = [
    { autoscroll: (
      /*gradio*/
      y[1].autoscroll
    ) },
    { i18n: (
      /*gradio*/
      y[1].i18n
    ) },
    /*loading_status*/
    y[11]
  ];
  let p = {};
  for (let _ = 0; _ < l.length; _ += 1)
    p = assign(p, l[_]);
  return s = new Static({ props: p }), {
    c() {
      create_component(s.$$.fragment);
    },
    m(_, x) {
      mount_component(s, _, x), e = !0;
    },
    p(_, x) {
      const o = x & /*gradio, loading_status*/
      2050 ? get_spread_update(l, [
        x & /*gradio*/
        2 && { autoscroll: (
          /*gradio*/
          _[1].autoscroll
        ) },
        x & /*gradio*/
        2 && { i18n: (
          /*gradio*/
          _[1].i18n
        ) },
        x & /*loading_status*/
        2048 && get_spread_object(
          /*loading_status*/
          _[11]
        )
      ]) : {};
      s.$set(o);
    },
    i(_) {
      e || (transition_in(s.$$.fragment, _), e = !0);
    },
    o(_) {
      transition_out(s.$$.fragment, _), e = !1;
    },
    d(_) {
      destroy_component(s, _);
    }
  };
}
function create_default_slot_1(y) {
  let s;
  return {
    c() {
      s = text(
        /*label*/
        y[2]
      );
    },
    m(e, l) {
      insert(e, s, l);
    },
    p(e, l) {
      l & /*label*/
      4 && set_data(
        s,
        /*label*/
        e[2]
      );
    },
    d(e) {
      e && detach(s);
    }
  };
}
function create_default_slot(y) {
  let s, e, l, p, _, x, o = (
    /*loading_status*/
    y[11] && create_if_block(y)
  );
  e = new BlockTitle({
    props: {
      show_label: (
        /*show_label*/
        y[7]
      ),
      info: (
        /*info*/
        y[3]
      ),
      $$slots: { default: [create_default_slot_1] },
      $$scope: { ctx: y }
    }
  });
  function g(u) {
    y[14](u);
  }
  let E = {};
  return (
    /*value*/
    y[0] !== void 0 && (E.value = /*value*/
    y[0]), p = new SequenceInput({ props: E }), binding_callbacks.push(() => bind(p, "value", g)), p.$on(
      "updateVals",
      /*syncValue*/
      y[12]
    ), p.$on(
      "updateCovMod",
      /*syncCovMod*/
      y[13]
    ), {
      c() {
        o && o.c(), s = space(), create_component(e.$$.fragment), l = space(), create_component(p.$$.fragment);
      },
      m(u, A) {
        o && o.m(u, A), insert(u, s, A), mount_component(e, u, A), insert(u, l, A), mount_component(p, u, A), x = !0;
      },
      p(u, A) {
        /*loading_status*/
        u[11] ? o ? (o.p(u, A), A & /*loading_status*/
        2048 && transition_in(o, 1)) : (o = create_if_block(u), o.c(), transition_in(o, 1), o.m(s.parentNode, s)) : o && (group_outros(), transition_out(o, 1, 1, () => {
          o = null;
        }), check_outros());
        const L = {};
        A & /*show_label*/
        128 && (L.show_label = /*show_label*/
        u[7]), A & /*info*/
        8 && (L.info = /*info*/
        u[3]), A & /*$$scope, label*/
        32772 && (L.$$scope = { dirty: A, ctx: u }), e.$set(L);
        const C = {};
        !_ && A & /*value*/
        1 && (_ = !0, C.value = /*value*/
        u[0], add_flush_callback(() => _ = !1)), p.$set(C);
      },
      i(u) {
        x || (transition_in(o), transition_in(e.$$.fragment, u), transition_in(p.$$.fragment, u), x = !0);
      },
      o(u) {
        transition_out(o), transition_out(e.$$.fragment, u), transition_out(p.$$.fragment, u), x = !1;
      },
      d(u) {
        u && (detach(s), detach(l)), o && o.d(u), destroy_component(e, u), destroy_component(p, u);
      }
    }
  );
}
function create_fragment(y) {
  let s, e;
  return s = new Block({
    props: {
      visible: (
        /*visible*/
        y[6]
      ),
      elem_id: (
        /*elem_id*/
        y[4]
      ),
      elem_classes: (
        /*elem_classes*/
        y[5]
      ),
      scale: (
        /*scale*/
        y[9]
      ),
      min_width: (
        /*min_width*/
        y[10]
      ),
      allow_overflow: !1,
      padding: (
        /*container*/
        y[8]
      ),
      $$slots: { default: [create_default_slot] },
      $$scope: { ctx: y }
    }
  }), {
    c() {
      create_component(s.$$.fragment);
    },
    m(l, p) {
      mount_component(s, l, p), e = !0;
    },
    p(l, [p]) {
      const _ = {};
      p & /*visible*/
      64 && (_.visible = /*visible*/
      l[6]), p & /*elem_id*/
      16 && (_.elem_id = /*elem_id*/
      l[4]), p & /*elem_classes*/
      32 && (_.elem_classes = /*elem_classes*/
      l[5]), p & /*scale*/
      512 && (_.scale = /*scale*/
      l[9]), p & /*min_width*/
      1024 && (_.min_width = /*min_width*/
      l[10]), p & /*container*/
      256 && (_.padding = /*container*/
      l[8]), p & /*$$scope, value, show_label, info, label, gradio, loading_status*/
      34959 && (_.$$scope = { dirty: p, ctx: l }), s.$set(_);
    },
    i(l) {
      e || (transition_in(s.$$.fragment, l), e = !0);
    },
    o(l) {
      transition_out(s.$$.fragment, l), e = !1;
    },
    d(l) {
      destroy_component(s, l);
    }
  };
}
function instance(y, s, e) {
  let { gradio: l } = s, { label: p = "CofoldingInput" } = s, { info: _ = void 0 } = s, { elem_id: x = "" } = s, { elem_classes: o = [] } = s, { visible: g = !0 } = s, { value: E = { chains: [], covMods: [] } } = s, { show_label: u } = s, { container: A = !0 } = s, { scale: L = null } = s, { min_width: C = void 0 } = s, { loading_status: D = void 0 } = s;
  function r(f) {
    let c = f.detail.map((t) => Object.fromEntries(Object.entries(t).filter(([a, h]) => a !== "open" && h !== "")));
    e(0, E.chains = c, E);
  }
  function n(f) {
    e(0, E.covMods = f.detail, E);
  }
  onMount(() => {
  });
  function b(f) {
    E = f, e(0, E);
  }
  return y.$$set = (f) => {
    "gradio" in f && e(1, l = f.gradio), "label" in f && e(2, p = f.label), "info" in f && e(3, _ = f.info), "elem_id" in f && e(4, x = f.elem_id), "elem_classes" in f && e(5, o = f.elem_classes), "visible" in f && e(6, g = f.visible), "value" in f && e(0, E = f.value), "show_label" in f && e(7, u = f.show_label), "container" in f && e(8, A = f.container), "scale" in f && e(9, L = f.scale), "min_width" in f && e(10, C = f.min_width), "loading_status" in f && e(11, D = f.loading_status);
  }, [
    E,
    l,
    p,
    _,
    x,
    o,
    g,
    u,
    A,
    L,
    C,
    D,
    r,
    n,
    b
  ];
}
class Index extends SvelteComponent {
  constructor(s) {
    super(), init(this, s, 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(s) {
    this.$$set({ gradio: s }), flush();
  }
  get label() {
    return this.$$.ctx[2];
  }
  set label(s) {
    this.$$set({ label: s }), flush();
  }
  get info() {
    return this.$$.ctx[3];
  }
  set info(s) {
    this.$$set({ info: s }), flush();
  }
  get elem_id() {
    return this.$$.ctx[4];
  }
  set elem_id(s) {
    this.$$set({ elem_id: s }), flush();
  }
  get elem_classes() {
    return this.$$.ctx[5];
  }
  set elem_classes(s) {
    this.$$set({ elem_classes: s }), flush();
  }
  get visible() {
    return this.$$.ctx[6];
  }
  set visible(s) {
    this.$$set({ visible: s }), flush();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(s) {
    this.$$set({ value: s }), flush();
  }
  get show_label() {
    return this.$$.ctx[7];
  }
  set show_label(s) {
    this.$$set({ show_label: s }), flush();
  }
  get container() {
    return this.$$.ctx[8];
  }
  set container(s) {
    this.$$set({ container: s }), flush();
  }
  get scale() {
    return this.$$.ctx[9];
  }
  set scale(s) {
    this.$$set({ scale: s }), flush();
  }
  get min_width() {
    return this.$$.ctx[10];
  }
  set min_width(s) {
    this.$$set({ min_width: s }), flush();
  }
  get loading_status() {
    return this.$$.ctx[11];
  }
  set loading_status(s) {
    this.$$set({ loading_status: s }), flush();
  }
}
export {
  Example as BaseExample,
  Textbox as BaseTextbox,
  Index as default
};
