const Block_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$l,
  assign: assign$1,
  create_slot: create_slot$4,
  detach: detach$l,
  element: element$d,
  get_all_dirty_from_scope: get_all_dirty_from_scope$4,
  get_slot_changes: get_slot_changes$4,
  get_spread_update: get_spread_update$1,
  init: init$l,
  insert: insert$l,
  safe_not_equal: safe_not_equal$m,
  set_dynamic_element_data,
  set_style: set_style$6,
  toggle_class: toggle_class$b,
  transition_in: transition_in$c,
  transition_out: transition_out$b,
  update_slot_base: update_slot_base$4
} = window.__gradio__svelte__internal;
function create_dynamic_element(r) {
  let e, t, n;
  const f = (
    /*#slots*/
    r[17].default
  ), u = create_slot$4(
    f,
    r,
    /*$$scope*/
    r[16],
    null
  );
  let y = [
    { "data-testid": (
      /*test_id*/
      r[7]
    ) },
    { id: (
      /*elem_id*/
      r[2]
    ) },
    {
      class: t = "block " + /*elem_classes*/
      r[3].join(" ") + " svelte-1t38q2d"
    }
  ], h = {};
  for (let _ = 0; _ < y.length; _ += 1)
    h = assign$1(h, y[_]);
  return {
    c() {
      e = element$d(
        /*tag*/
        r[14]
      ), u && u.c(), set_dynamic_element_data(
        /*tag*/
        r[14]
      )(e, h), toggle_class$b(
        e,
        "hidden",
        /*visible*/
        r[10] === !1
      ), toggle_class$b(
        e,
        "padded",
        /*padding*/
        r[6]
      ), toggle_class$b(
        e,
        "border_focus",
        /*border_mode*/
        r[5] === "focus"
      ), toggle_class$b(e, "hide-container", !/*explicit_call*/
      r[8] && !/*container*/
      r[9]), set_style$6(e, "height", typeof /*height*/
      r[0] == "number" ? (
        /*height*/
        r[0] + "px"
      ) : void 0), set_style$6(e, "width", typeof /*width*/
      r[1] == "number" ? `calc(min(${/*width*/
      r[1]}px, 100%))` : void 0), set_style$6(
        e,
        "border-style",
        /*variant*/
        r[4]
      ), set_style$6(
        e,
        "overflow",
        /*allow_overflow*/
        r[11] ? "visible" : "hidden"
      ), set_style$6(
        e,
        "flex-grow",
        /*scale*/
        r[12]
      ), set_style$6(e, "min-width", `calc(min(${/*min_width*/
      r[13]}px, 100%))`), set_style$6(e, "border-width", "var(--block-border-width)");
    },
    m(_, E) {
      insert$l(_, e, E), u && u.m(e, null), n = !0;
    },
    p(_, E) {
      u && u.p && (!n || E & /*$$scope*/
      65536) && update_slot_base$4(
        u,
        f,
        _,
        /*$$scope*/
        _[16],
        n ? get_slot_changes$4(
          f,
          /*$$scope*/
          _[16],
          E,
          null
        ) : get_all_dirty_from_scope$4(
          /*$$scope*/
          _[16]
        ),
        null
      ), set_dynamic_element_data(
        /*tag*/
        _[14]
      )(e, h = get_spread_update$1(y, [
        (!n || E & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          _[7]
        ) },
        (!n || E & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          _[2]
        ) },
        (!n || E & /*elem_classes*/
        8 && t !== (t = "block " + /*elem_classes*/
        _[3].join(" ") + " svelte-1t38q2d")) && { class: t }
      ])), toggle_class$b(
        e,
        "hidden",
        /*visible*/
        _[10] === !1
      ), toggle_class$b(
        e,
        "padded",
        /*padding*/
        _[6]
      ), toggle_class$b(
        e,
        "border_focus",
        /*border_mode*/
        _[5] === "focus"
      ), toggle_class$b(e, "hide-container", !/*explicit_call*/
      _[8] && !/*container*/
      _[9]), E & /*height*/
      1 && set_style$6(e, "height", typeof /*height*/
      _[0] == "number" ? (
        /*height*/
        _[0] + "px"
      ) : void 0), E & /*width*/
      2 && set_style$6(e, "width", typeof /*width*/
      _[1] == "number" ? `calc(min(${/*width*/
      _[1]}px, 100%))` : void 0), E & /*variant*/
      16 && set_style$6(
        e,
        "border-style",
        /*variant*/
        _[4]
      ), E & /*allow_overflow*/
      2048 && set_style$6(
        e,
        "overflow",
        /*allow_overflow*/
        _[11] ? "visible" : "hidden"
      ), E & /*scale*/
      4096 && set_style$6(
        e,
        "flex-grow",
        /*scale*/
        _[12]
      ), E & /*min_width*/
      8192 && set_style$6(e, "min-width", `calc(min(${/*min_width*/
      _[13]}px, 100%))`);
    },
    i(_) {
      n || (transition_in$c(u, _), n = !0);
    },
    o(_) {
      transition_out$b(u, _), n = !1;
    },
    d(_) {
      _ && detach$l(e), u && u.d(_);
    }
  };
}
function create_fragment$l(r) {
  let e, t = (
    /*tag*/
    r[14] && create_dynamic_element(r)
  );
  return {
    c() {
      t && t.c();
    },
    m(n, f) {
      t && t.m(n, f), e = !0;
    },
    p(n, [f]) {
      /*tag*/
      n[14] && t.p(n, f);
    },
    i(n) {
      e || (transition_in$c(t, n), e = !0);
    },
    o(n) {
      transition_out$b(t, n), e = !1;
    },
    d(n) {
      t && t.d(n);
    }
  };
}
function instance$f(r, e, t) {
  let { $$slots: n = {}, $$scope: f } = e, { height: u = void 0 } = e, { width: y = void 0 } = e, { elem_id: h = "" } = e, { elem_classes: _ = [] } = e, { variant: E = "solid" } = e, { border_mode: c = "base" } = e, { padding: C = !0 } = e, { type: b = "normal" } = e, { test_id: A = void 0 } = e, { explicit_call: S = !1 } = e, { container: s = !0 } = e, { visible: o = !0 } = e, { allow_overflow: w = !0 } = e, { scale: p = null } = e, { min_width: v = 0 } = e, a = b === "fieldset" ? "fieldset" : "div";
  return r.$$set = (l) => {
    "height" in l && t(0, u = l.height), "width" in l && t(1, y = l.width), "elem_id" in l && t(2, h = l.elem_id), "elem_classes" in l && t(3, _ = l.elem_classes), "variant" in l && t(4, E = l.variant), "border_mode" in l && t(5, c = l.border_mode), "padding" in l && t(6, C = l.padding), "type" in l && t(15, b = l.type), "test_id" in l && t(7, A = l.test_id), "explicit_call" in l && t(8, S = l.explicit_call), "container" in l && t(9, s = l.container), "visible" in l && t(10, o = l.visible), "allow_overflow" in l && t(11, w = l.allow_overflow), "scale" in l && t(12, p = l.scale), "min_width" in l && t(13, v = l.min_width), "$$scope" in l && t(16, f = l.$$scope);
  }, [
    u,
    y,
    h,
    _,
    E,
    c,
    C,
    A,
    S,
    s,
    o,
    w,
    p,
    v,
    a,
    b,
    f,
    n
  ];
}
class Block extends SvelteComponent$l {
  constructor(e) {
    super(), init$l(this, e, instance$f, create_fragment$l, safe_not_equal$m, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 15,
      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 = "", BlockTitle_svelte_svelte_type_style_lang = "", BlockLabel_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$k,
  append: append$i,
  attr: attr$i,
  create_component: create_component$8,
  destroy_component: destroy_component$8,
  detach: detach$k,
  element: element$c,
  init: init$k,
  insert: insert$k,
  mount_component: mount_component$8,
  safe_not_equal: safe_not_equal$l,
  set_data: set_data$7,
  space: space$b,
  text: text$7,
  toggle_class: toggle_class$a,
  transition_in: transition_in$b,
  transition_out: transition_out$a
} = window.__gradio__svelte__internal;
function create_fragment$k(r) {
  let e, t, n, f, u, y;
  return n = new /*Icon*/
  r[1]({}), {
    c() {
      e = element$c("label"), t = element$c("span"), create_component$8(n.$$.fragment), f = space$b(), u = text$7(
        /*label*/
        r[0]
      ), attr$i(t, "class", "svelte-9gxdi0"), attr$i(e, "for", ""), attr$i(e, "data-testid", "block-label"), attr$i(e, "class", "svelte-9gxdi0"), toggle_class$a(e, "hide", !/*show_label*/
      r[2]), toggle_class$a(e, "sr-only", !/*show_label*/
      r[2]), toggle_class$a(
        e,
        "float",
        /*float*/
        r[4]
      ), toggle_class$a(
        e,
        "hide-label",
        /*disable*/
        r[3]
      );
    },
    m(h, _) {
      insert$k(h, e, _), append$i(e, t), mount_component$8(n, t, null), append$i(e, f), append$i(e, u), y = !0;
    },
    p(h, [_]) {
      (!y || _ & /*label*/
      1) && set_data$7(
        u,
        /*label*/
        h[0]
      ), (!y || _ & /*show_label*/
      4) && toggle_class$a(e, "hide", !/*show_label*/
      h[2]), (!y || _ & /*show_label*/
      4) && toggle_class$a(e, "sr-only", !/*show_label*/
      h[2]), (!y || _ & /*float*/
      16) && toggle_class$a(
        e,
        "float",
        /*float*/
        h[4]
      ), (!y || _ & /*disable*/
      8) && toggle_class$a(
        e,
        "hide-label",
        /*disable*/
        h[3]
      );
    },
    i(h) {
      y || (transition_in$b(n.$$.fragment, h), y = !0);
    },
    o(h) {
      transition_out$a(n.$$.fragment, h), y = !1;
    },
    d(h) {
      h && detach$k(e), destroy_component$8(n);
    }
  };
}
function instance$e(r, e, t) {
  let { label: n = null } = e, { Icon: f } = e, { show_label: u = !0 } = e, { disable: y = !1 } = e, { float: h = !0 } = e;
  return r.$$set = (_) => {
    "label" in _ && t(0, n = _.label), "Icon" in _ && t(1, f = _.Icon), "show_label" in _ && t(2, u = _.show_label), "disable" in _ && t(3, y = _.disable), "float" in _ && t(4, h = _.float);
  }, [n, f, u, y, h];
}
class BlockLabel extends SvelteComponent$k {
  constructor(e) {
    super(), init$k(this, e, instance$e, create_fragment$k, safe_not_equal$l, {
      label: 0,
      Icon: 1,
      show_label: 2,
      disable: 3,
      float: 4
    });
  }
}
const IconButton_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$j,
  append: append$h,
  attr: attr$h,
  bubble: bubble$3,
  create_component: create_component$7,
  destroy_component: destroy_component$7,
  detach: detach$j,
  element: element$b,
  init: init$j,
  insert: insert$j,
  listen: listen$4,
  mount_component: mount_component$7,
  safe_not_equal: safe_not_equal$k,
  set_data: set_data$6,
  space: space$a,
  text: text$6,
  toggle_class: toggle_class$9,
  transition_in: transition_in$a,
  transition_out: transition_out$9
} = window.__gradio__svelte__internal;
function create_if_block$9(r) {
  let e, t;
  return {
    c() {
      e = element$b("span"), t = text$6(
        /*label*/
        r[1]
      ), attr$h(e, "class", "svelte-xtz2g8");
    },
    m(n, f) {
      insert$j(n, e, f), append$h(e, t);
    },
    p(n, f) {
      f & /*label*/
      2 && set_data$6(
        t,
        /*label*/
        n[1]
      );
    },
    d(n) {
      n && detach$j(e);
    }
  };
}
function create_fragment$j(r) {
  let e, t, n, f, u, y, h, _ = (
    /*show_label*/
    r[2] && create_if_block$9(r)
  );
  return f = new /*Icon*/
  r[0]({}), {
    c() {
      e = element$b("button"), _ && _.c(), t = space$a(), n = element$b("div"), create_component$7(f.$$.fragment), attr$h(n, "class", "svelte-xtz2g8"), toggle_class$9(
        n,
        "small",
        /*size*/
        r[4] === "small"
      ), toggle_class$9(
        n,
        "large",
        /*size*/
        r[4] === "large"
      ), attr$h(
        e,
        "aria-label",
        /*label*/
        r[1]
      ), attr$h(
        e,
        "title",
        /*label*/
        r[1]
      ), attr$h(e, "class", "svelte-xtz2g8"), toggle_class$9(
        e,
        "pending",
        /*pending*/
        r[3]
      ), toggle_class$9(
        e,
        "padded",
        /*padded*/
        r[5]
      );
    },
    m(E, c) {
      insert$j(E, e, c), _ && _.m(e, null), append$h(e, t), append$h(e, n), mount_component$7(f, n, null), u = !0, y || (h = listen$4(
        e,
        "click",
        /*click_handler*/
        r[6]
      ), y = !0);
    },
    p(E, [c]) {
      /*show_label*/
      E[2] ? _ ? _.p(E, c) : (_ = create_if_block$9(E), _.c(), _.m(e, t)) : _ && (_.d(1), _ = null), (!u || c & /*size*/
      16) && toggle_class$9(
        n,
        "small",
        /*size*/
        E[4] === "small"
      ), (!u || c & /*size*/
      16) && toggle_class$9(
        n,
        "large",
        /*size*/
        E[4] === "large"
      ), (!u || c & /*label*/
      2) && attr$h(
        e,
        "aria-label",
        /*label*/
        E[1]
      ), (!u || c & /*label*/
      2) && attr$h(
        e,
        "title",
        /*label*/
        E[1]
      ), (!u || c & /*pending*/
      8) && toggle_class$9(
        e,
        "pending",
        /*pending*/
        E[3]
      ), (!u || c & /*padded*/
      32) && toggle_class$9(
        e,
        "padded",
        /*padded*/
        E[5]
      );
    },
    i(E) {
      u || (transition_in$a(f.$$.fragment, E), u = !0);
    },
    o(E) {
      transition_out$9(f.$$.fragment, E), u = !1;
    },
    d(E) {
      E && detach$j(e), _ && _.d(), destroy_component$7(f), y = !1, h();
    }
  };
}
function instance$d(r, e, t) {
  let { Icon: n } = e, { label: f = "" } = e, { show_label: u = !1 } = e, { pending: y = !1 } = e, { size: h = "small" } = e, { padded: _ = !0 } = e;
  function E(c) {
    bubble$3.call(this, r, c);
  }
  return r.$$set = (c) => {
    "Icon" in c && t(0, n = c.Icon), "label" in c && t(1, f = c.label), "show_label" in c && t(2, u = c.show_label), "pending" in c && t(3, y = c.pending), "size" in c && t(4, h = c.size), "padded" in c && t(5, _ = c.padded);
  }, [n, f, u, y, h, _, E];
}
class IconButton extends SvelteComponent$j {
  constructor(e) {
    super(), init$j(this, e, instance$d, create_fragment$j, safe_not_equal$k, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5
    });
  }
}
const Empty_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$i,
  append: append$g,
  attr: attr$g,
  binding_callbacks: binding_callbacks$4,
  create_slot: create_slot$3,
  detach: detach$i,
  element: element$a,
  get_all_dirty_from_scope: get_all_dirty_from_scope$3,
  get_slot_changes: get_slot_changes$3,
  init: init$i,
  insert: insert$i,
  safe_not_equal: safe_not_equal$j,
  toggle_class: toggle_class$8,
  transition_in: transition_in$9,
  transition_out: transition_out$8,
  update_slot_base: update_slot_base$3
} = window.__gradio__svelte__internal;
function create_fragment$i(r) {
  let e, t, n;
  const f = (
    /*#slots*/
    r[5].default
  ), u = create_slot$3(
    f,
    r,
    /*$$scope*/
    r[4],
    null
  );
  return {
    c() {
      e = element$a("div"), t = element$a("div"), u && u.c(), attr$g(t, "class", "icon svelte-3w3rth"), attr$g(e, "class", "empty svelte-3w3rth"), attr$g(e, "aria-label", "Empty value"), toggle_class$8(
        e,
        "small",
        /*size*/
        r[0] === "small"
      ), toggle_class$8(
        e,
        "large",
        /*size*/
        r[0] === "large"
      ), toggle_class$8(
        e,
        "unpadded_box",
        /*unpadded_box*/
        r[1]
      ), toggle_class$8(
        e,
        "small_parent",
        /*parent_height*/
        r[3]
      );
    },
    m(y, h) {
      insert$i(y, e, h), append$g(e, t), u && u.m(t, null), r[6](e), n = !0;
    },
    p(y, [h]) {
      u && u.p && (!n || h & /*$$scope*/
      16) && update_slot_base$3(
        u,
        f,
        y,
        /*$$scope*/
        y[4],
        n ? get_slot_changes$3(
          f,
          /*$$scope*/
          y[4],
          h,
          null
        ) : get_all_dirty_from_scope$3(
          /*$$scope*/
          y[4]
        ),
        null
      ), (!n || h & /*size*/
      1) && toggle_class$8(
        e,
        "small",
        /*size*/
        y[0] === "small"
      ), (!n || h & /*size*/
      1) && toggle_class$8(
        e,
        "large",
        /*size*/
        y[0] === "large"
      ), (!n || h & /*unpadded_box*/
      2) && toggle_class$8(
        e,
        "unpadded_box",
        /*unpadded_box*/
        y[1]
      ), (!n || h & /*parent_height*/
      8) && toggle_class$8(
        e,
        "small_parent",
        /*parent_height*/
        y[3]
      );
    },
    i(y) {
      n || (transition_in$9(u, y), n = !0);
    },
    o(y) {
      transition_out$8(u, y), n = !1;
    },
    d(y) {
      y && detach$i(e), u && u.d(y), r[6](null);
    }
  };
}
function _optionalChain$1(r) {
  let e, t = r[0], n = 1;
  for (; n < r.length; ) {
    const f = r[n], u = r[n + 1];
    if (n += 2, (f === "optionalAccess" || f === "optionalCall") && t == null)
      return;
    f === "access" || f === "optionalAccess" ? (e = t, t = u(t)) : (f === "call" || f === "optionalCall") && (t = u((...y) => t.call(e, ...y)), e = void 0);
  }
  return t;
}
function instance$c(r, e, t) {
  let n, { $$slots: f = {}, $$scope: u } = e, { size: y = "small" } = e, { unpadded_box: h = !1 } = e, _;
  function E(C) {
    if (!C)
      return !1;
    const { height: b } = C.getBoundingClientRect(), { height: A } = _optionalChain$1([
      C,
      "access",
      (S) => S.parentElement,
      "optionalAccess",
      (S) => S.getBoundingClientRect,
      "call",
      (S) => S()
    ]) || { height: b };
    return b > A + 2;
  }
  function c(C) {
    binding_callbacks$4[C ? "unshift" : "push"](() => {
      _ = C, t(2, _);
    });
  }
  return r.$$set = (C) => {
    "size" in C && t(0, y = C.size), "unpadded_box" in C && t(1, h = C.unpadded_box), "$$scope" in C && t(4, u = C.$$scope);
  }, r.$$.update = () => {
    r.$$.dirty & /*el*/
    4 && t(3, n = E(_));
  }, [y, h, _, n, u, f, c];
}
class Empty extends SvelteComponent$i {
  constructor(e) {
    super(), init$i(this, e, instance$c, create_fragment$i, safe_not_equal$j, { size: 0, unpadded_box: 1 });
  }
}
const {
  SvelteComponent: SvelteComponent$h,
  append: append$f,
  attr: attr$f,
  detach: detach$h,
  init: init$h,
  insert: insert$h,
  noop: noop$c,
  safe_not_equal: safe_not_equal$i,
  set_style: set_style$5,
  svg_element: svg_element$8
} = window.__gradio__svelte__internal;
function create_fragment$h(r) {
  let e, t, n, f;
  return {
    c() {
      e = svg_element$8("svg"), t = svg_element$8("g"), n = svg_element$8("path"), f = svg_element$8("path"), attr$f(n, "d", "M18,6L6.087,17.913"), set_style$5(n, "fill", "none"), set_style$5(n, "fill-rule", "nonzero"), set_style$5(n, "stroke-width", "2px"), attr$f(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$f(f, "d", "M4.364,4.364L19.636,19.636"), set_style$5(f, "fill", "none"), set_style$5(f, "fill-rule", "nonzero"), set_style$5(f, "stroke-width", "2px"), attr$f(e, "width", "100%"), attr$f(e, "height", "100%"), attr$f(e, "viewBox", "0 0 24 24"), attr$f(e, "version", "1.1"), attr$f(e, "xmlns", "http://www.w3.org/2000/svg"), attr$f(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$f(e, "xml:space", "preserve"), attr$f(e, "stroke", "currentColor"), set_style$5(e, "fill-rule", "evenodd"), set_style$5(e, "clip-rule", "evenodd"), set_style$5(e, "stroke-linecap", "round"), set_style$5(e, "stroke-linejoin", "round");
    },
    m(u, y) {
      insert$h(u, e, y), append$f(e, t), append$f(t, n), append$f(e, f);
    },
    p: noop$c,
    i: noop$c,
    o: noop$c,
    d(u) {
      u && detach$h(e);
    }
  };
}
class Clear extends SvelteComponent$h {
  constructor(e) {
    super(), init$h(this, e, null, create_fragment$h, safe_not_equal$i, {});
  }
}
const DropdownArrow_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$g,
  append: append$e,
  attr: attr$e,
  detach: detach$g,
  init: init$g,
  insert: insert$g,
  noop: noop$b,
  safe_not_equal: safe_not_equal$h,
  svg_element: svg_element$7
} = window.__gradio__svelte__internal;
function create_fragment$g(r) {
  let e, t;
  return {
    c() {
      e = svg_element$7("svg"), t = svg_element$7("path"), attr$e(t, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), attr$e(e, "xmlns", "http://www.w3.org/2000/svg"), attr$e(e, "width", "100%"), attr$e(e, "height", "100%"), attr$e(e, "viewBox", "0 0 24 24"), attr$e(e, "fill", "none"), attr$e(e, "stroke", "currentColor"), attr$e(e, "stroke-width", "1.5"), attr$e(e, "stroke-linecap", "round"), attr$e(e, "stroke-linejoin", "round"), attr$e(e, "class", "feather feather-edit-2");
    },
    m(n, f) {
      insert$g(n, e, f), append$e(e, t);
    },
    p: noop$b,
    i: noop$b,
    o: noop$b,
    d(n) {
      n && detach$g(e);
    }
  };
}
class Edit extends SvelteComponent$g {
  constructor(e) {
    super(), init$g(this, e, null, create_fragment$g, safe_not_equal$h, {});
  }
}
const {
  SvelteComponent: SvelteComponent$f,
  append: append$d,
  attr: attr$d,
  detach: detach$f,
  init: init$f,
  insert: insert$f,
  noop: noop$a,
  safe_not_equal: safe_not_equal$g,
  svg_element: svg_element$6
} = window.__gradio__svelte__internal;
function create_fragment$f(r) {
  let e, t, n;
  return {
    c() {
      e = svg_element$6("svg"), t = svg_element$6("path"), n = svg_element$6("polyline"), attr$d(t, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), attr$d(n, "points", "13 2 13 9 20 9"), attr$d(e, "xmlns", "http://www.w3.org/2000/svg"), attr$d(e, "width", "100%"), attr$d(e, "height", "100%"), attr$d(e, "viewBox", "0 0 24 24"), attr$d(e, "fill", "none"), attr$d(e, "stroke", "currentColor"), attr$d(e, "stroke-width", "1.5"), attr$d(e, "stroke-linecap", "round"), attr$d(e, "stroke-linejoin", "round"), attr$d(e, "class", "feather feather-file");
    },
    m(f, u) {
      insert$f(f, e, u), append$d(e, t), append$d(e, n);
    },
    p: noop$a,
    i: noop$a,
    o: noop$a,
    d(f) {
      f && detach$f(e);
    }
  };
}
let File$1 = class extends SvelteComponent$f {
  constructor(e) {
    super(), init$f(this, e, null, create_fragment$f, safe_not_equal$g, {});
  }
};
const {
  SvelteComponent: SvelteComponent$e,
  append: append$c,
  attr: attr$c,
  detach: detach$e,
  init: init$e,
  insert: insert$e,
  noop: noop$9,
  safe_not_equal: safe_not_equal$f,
  svg_element: svg_element$5
} = window.__gradio__svelte__internal;
function create_fragment$e(r) {
  let e, t, n;
  return {
    c() {
      e = svg_element$5("svg"), t = svg_element$5("polyline"), n = svg_element$5("path"), attr$c(t, "points", "1 4 1 10 7 10"), attr$c(n, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), attr$c(e, "xmlns", "http://www.w3.org/2000/svg"), attr$c(e, "width", "100%"), attr$c(e, "height", "100%"), attr$c(e, "viewBox", "0 0 24 24"), attr$c(e, "fill", "none"), attr$c(e, "stroke", "currentColor"), attr$c(e, "stroke-width", "2"), attr$c(e, "stroke-linecap", "round"), attr$c(e, "stroke-linejoin", "round"), attr$c(e, "class", "feather feather-rotate-ccw");
    },
    m(f, u) {
      insert$e(f, e, u), append$c(e, t), append$c(e, n);
    },
    p: noop$9,
    i: noop$9,
    o: noop$9,
    d(f) {
      f && detach$e(e);
    }
  };
}
class Undo extends SvelteComponent$e {
  constructor(e) {
    super(), init$e(this, e, null, create_fragment$e, safe_not_equal$f, {});
  }
}
const {
  SvelteComponent: SvelteComponent$d,
  append: append$b,
  attr: attr$b,
  detach: detach$d,
  init: init$d,
  insert: insert$d,
  noop: noop$8,
  safe_not_equal: safe_not_equal$e,
  svg_element: svg_element$4
} = window.__gradio__svelte__internal;
function create_fragment$d(r) {
  let e, t, n, f;
  return {
    c() {
      e = svg_element$4("svg"), t = svg_element$4("path"), n = svg_element$4("polyline"), f = svg_element$4("line"), attr$b(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), attr$b(n, "points", "17 8 12 3 7 8"), attr$b(f, "x1", "12"), attr$b(f, "y1", "3"), attr$b(f, "x2", "12"), attr$b(f, "y2", "15"), attr$b(e, "xmlns", "http://www.w3.org/2000/svg"), attr$b(e, "width", "90%"), attr$b(e, "height", "90%"), attr$b(e, "viewBox", "0 0 24 24"), attr$b(e, "fill", "none"), attr$b(e, "stroke", "currentColor"), attr$b(e, "stroke-width", "2"), attr$b(e, "stroke-linecap", "round"), attr$b(e, "stroke-linejoin", "round"), attr$b(e, "class", "feather feather-upload");
    },
    m(u, y) {
      insert$d(u, e, y), append$b(e, t), append$b(e, n), append$b(e, f);
    },
    p: noop$8,
    i: noop$8,
    o: noop$8,
    d(u) {
      u && detach$d(e);
    }
  };
}
let Upload$1 = class extends SvelteComponent$d {
  constructor(e) {
    super(), init$d(this, e, null, create_fragment$d, safe_not_equal$e, {});
  }
};
const color_values = [
  { color: "red", primary: 600, secondary: 100 },
  { color: "green", primary: 600, secondary: 100 },
  { color: "blue", primary: 600, secondary: 100 },
  { color: "yellow", primary: 500, secondary: 100 },
  { color: "purple", primary: 600, secondary: 100 },
  { color: "teal", primary: 600, secondary: 100 },
  { color: "orange", primary: 600, secondary: 100 },
  { color: "cyan", primary: 600, secondary: 100 },
  { color: "lime", primary: 500, secondary: 100 },
  { color: "pink", primary: 600, secondary: 100 }
], tw_colors = {
  inherit: "inherit",
  current: "currentColor",
  transparent: "transparent",
  black: "#000",
  white: "#fff",
  slate: {
    50: "#f8fafc",
    100: "#f1f5f9",
    200: "#e2e8f0",
    300: "#cbd5e1",
    400: "#94a3b8",
    500: "#64748b",
    600: "#475569",
    700: "#334155",
    800: "#1e293b",
    900: "#0f172a",
    950: "#020617"
  },
  gray: {
    50: "#f9fafb",
    100: "#f3f4f6",
    200: "#e5e7eb",
    300: "#d1d5db",
    400: "#9ca3af",
    500: "#6b7280",
    600: "#4b5563",
    700: "#374151",
    800: "#1f2937",
    900: "#111827",
    950: "#030712"
  },
  zinc: {
    50: "#fafafa",
    100: "#f4f4f5",
    200: "#e4e4e7",
    300: "#d4d4d8",
    400: "#a1a1aa",
    500: "#71717a",
    600: "#52525b",
    700: "#3f3f46",
    800: "#27272a",
    900: "#18181b",
    950: "#09090b"
  },
  neutral: {
    50: "#fafafa",
    100: "#f5f5f5",
    200: "#e5e5e5",
    300: "#d4d4d4",
    400: "#a3a3a3",
    500: "#737373",
    600: "#525252",
    700: "#404040",
    800: "#262626",
    900: "#171717",
    950: "#0a0a0a"
  },
  stone: {
    50: "#fafaf9",
    100: "#f5f5f4",
    200: "#e7e5e4",
    300: "#d6d3d1",
    400: "#a8a29e",
    500: "#78716c",
    600: "#57534e",
    700: "#44403c",
    800: "#292524",
    900: "#1c1917",
    950: "#0c0a09"
  },
  red: {
    50: "#fef2f2",
    100: "#fee2e2",
    200: "#fecaca",
    300: "#fca5a5",
    400: "#f87171",
    500: "#ef4444",
    600: "#dc2626",
    700: "#b91c1c",
    800: "#991b1b",
    900: "#7f1d1d",
    950: "#450a0a"
  },
  orange: {
    50: "#fff7ed",
    100: "#ffedd5",
    200: "#fed7aa",
    300: "#fdba74",
    400: "#fb923c",
    500: "#f97316",
    600: "#ea580c",
    700: "#c2410c",
    800: "#9a3412",
    900: "#7c2d12",
    950: "#431407"
  },
  amber: {
    50: "#fffbeb",
    100: "#fef3c7",
    200: "#fde68a",
    300: "#fcd34d",
    400: "#fbbf24",
    500: "#f59e0b",
    600: "#d97706",
    700: "#b45309",
    800: "#92400e",
    900: "#78350f",
    950: "#451a03"
  },
  yellow: {
    50: "#fefce8",
    100: "#fef9c3",
    200: "#fef08a",
    300: "#fde047",
    400: "#facc15",
    500: "#eab308",
    600: "#ca8a04",
    700: "#a16207",
    800: "#854d0e",
    900: "#713f12",
    950: "#422006"
  },
  lime: {
    50: "#f7fee7",
    100: "#ecfccb",
    200: "#d9f99d",
    300: "#bef264",
    400: "#a3e635",
    500: "#84cc16",
    600: "#65a30d",
    700: "#4d7c0f",
    800: "#3f6212",
    900: "#365314",
    950: "#1a2e05"
  },
  green: {
    50: "#f0fdf4",
    100: "#dcfce7",
    200: "#bbf7d0",
    300: "#86efac",
    400: "#4ade80",
    500: "#22c55e",
    600: "#16a34a",
    700: "#15803d",
    800: "#166534",
    900: "#14532d",
    950: "#052e16"
  },
  emerald: {
    50: "#ecfdf5",
    100: "#d1fae5",
    200: "#a7f3d0",
    300: "#6ee7b7",
    400: "#34d399",
    500: "#10b981",
    600: "#059669",
    700: "#047857",
    800: "#065f46",
    900: "#064e3b",
    950: "#022c22"
  },
  teal: {
    50: "#f0fdfa",
    100: "#ccfbf1",
    200: "#99f6e4",
    300: "#5eead4",
    400: "#2dd4bf",
    500: "#14b8a6",
    600: "#0d9488",
    700: "#0f766e",
    800: "#115e59",
    900: "#134e4a",
    950: "#042f2e"
  },
  cyan: {
    50: "#ecfeff",
    100: "#cffafe",
    200: "#a5f3fc",
    300: "#67e8f9",
    400: "#22d3ee",
    500: "#06b6d4",
    600: "#0891b2",
    700: "#0e7490",
    800: "#155e75",
    900: "#164e63",
    950: "#083344"
  },
  sky: {
    50: "#f0f9ff",
    100: "#e0f2fe",
    200: "#bae6fd",
    300: "#7dd3fc",
    400: "#38bdf8",
    500: "#0ea5e9",
    600: "#0284c7",
    700: "#0369a1",
    800: "#075985",
    900: "#0c4a6e",
    950: "#082f49"
  },
  blue: {
    50: "#eff6ff",
    100: "#dbeafe",
    200: "#bfdbfe",
    300: "#93c5fd",
    400: "#60a5fa",
    500: "#3b82f6",
    600: "#2563eb",
    700: "#1d4ed8",
    800: "#1e40af",
    900: "#1e3a8a",
    950: "#172554"
  },
  indigo: {
    50: "#eef2ff",
    100: "#e0e7ff",
    200: "#c7d2fe",
    300: "#a5b4fc",
    400: "#818cf8",
    500: "#6366f1",
    600: "#4f46e5",
    700: "#4338ca",
    800: "#3730a3",
    900: "#312e81",
    950: "#1e1b4b"
  },
  violet: {
    50: "#f5f3ff",
    100: "#ede9fe",
    200: "#ddd6fe",
    300: "#c4b5fd",
    400: "#a78bfa",
    500: "#8b5cf6",
    600: "#7c3aed",
    700: "#6d28d9",
    800: "#5b21b6",
    900: "#4c1d95",
    950: "#2e1065"
  },
  purple: {
    50: "#faf5ff",
    100: "#f3e8ff",
    200: "#e9d5ff",
    300: "#d8b4fe",
    400: "#c084fc",
    500: "#a855f7",
    600: "#9333ea",
    700: "#7e22ce",
    800: "#6b21a8",
    900: "#581c87",
    950: "#3b0764"
  },
  fuchsia: {
    50: "#fdf4ff",
    100: "#fae8ff",
    200: "#f5d0fe",
    300: "#f0abfc",
    400: "#e879f9",
    500: "#d946ef",
    600: "#c026d3",
    700: "#a21caf",
    800: "#86198f",
    900: "#701a75",
    950: "#4a044e"
  },
  pink: {
    50: "#fdf2f8",
    100: "#fce7f3",
    200: "#fbcfe8",
    300: "#f9a8d4",
    400: "#f472b6",
    500: "#ec4899",
    600: "#db2777",
    700: "#be185d",
    800: "#9d174d",
    900: "#831843",
    950: "#500724"
  },
  rose: {
    50: "#fff1f2",
    100: "#ffe4e6",
    200: "#fecdd3",
    300: "#fda4af",
    400: "#fb7185",
    500: "#f43f5e",
    600: "#e11d48",
    700: "#be123c",
    800: "#9f1239",
    900: "#881337",
    950: "#4c0519"
  }
};
color_values.reduce(
  (r, { color: e, primary: t, secondary: n }) => ({
    ...r,
    [e]: {
      primary: tw_colors[e][t],
      secondary: tw_colors[e][n]
    }
  }),
  {}
);
const UploadText_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$c,
  append: append$a,
  attr: attr$a,
  create_component: create_component$6,
  destroy_component: destroy_component$6,
  detach: detach$c,
  element: element$9,
  init: init$c,
  insert: insert$c,
  mount_component: mount_component$6,
  safe_not_equal: safe_not_equal$d,
  set_data: set_data$5,
  space: space$9,
  text: text$5,
  toggle_class: toggle_class$7,
  transition_in: transition_in$8,
  transition_out: transition_out$7
} = window.__gradio__svelte__internal;
function create_if_block$8(r) {
  let e, t, n = (
    /*i18n*/
    r[1]("common.or") + ""
  ), f, u, y, h = (
    /*message*/
    (r[2] || /*i18n*/
    r[1]("upload_text.click_to_upload")) + ""
  ), _;
  return {
    c() {
      e = element$9("span"), t = text$5("- "), f = text$5(n), u = text$5(" -"), y = space$9(), _ = text$5(h), attr$a(e, "class", "or svelte-kzcjhc");
    },
    m(E, c) {
      insert$c(E, e, c), append$a(e, t), append$a(e, f), append$a(e, u), insert$c(E, y, c), insert$c(E, _, c);
    },
    p(E, c) {
      c & /*i18n*/
      2 && n !== (n = /*i18n*/
      E[1]("common.or") + "") && set_data$5(f, n), c & /*message, i18n*/
      6 && h !== (h = /*message*/
      (E[2] || /*i18n*/
      E[1]("upload_text.click_to_upload")) + "") && set_data$5(_, h);
    },
    d(E) {
      E && (detach$c(e), detach$c(y), detach$c(_));
    }
  };
}
function create_fragment$c(r) {
  let e, t, n, f, u = (
    /*i18n*/
    r[1](
      /*defs*/
      r[5][
        /*type*/
        r[0]
      ] || /*defs*/
      r[5].file
    ) + ""
  ), y, h, _;
  n = new Upload$1({});
  let E = (
    /*mode*/
    r[3] !== "short" && create_if_block$8(r)
  );
  return {
    c() {
      e = element$9("div"), t = element$9("span"), create_component$6(n.$$.fragment), f = space$9(), y = text$5(u), h = space$9(), E && E.c(), attr$a(t, "class", "icon-wrap svelte-kzcjhc"), toggle_class$7(
        t,
        "hovered",
        /*hovered*/
        r[4]
      ), attr$a(e, "class", "wrap svelte-kzcjhc");
    },
    m(c, C) {
      insert$c(c, e, C), append$a(e, t), mount_component$6(n, t, null), append$a(e, f), append$a(e, y), append$a(e, h), E && E.m(e, null), _ = !0;
    },
    p(c, [C]) {
      (!_ || C & /*hovered*/
      16) && toggle_class$7(
        t,
        "hovered",
        /*hovered*/
        c[4]
      ), (!_ || C & /*i18n, type*/
      3) && u !== (u = /*i18n*/
      c[1](
        /*defs*/
        c[5][
          /*type*/
          c[0]
        ] || /*defs*/
        c[5].file
      ) + "") && set_data$5(y, u), /*mode*/
      c[3] !== "short" ? E ? E.p(c, C) : (E = create_if_block$8(c), E.c(), E.m(e, null)) : E && (E.d(1), E = null);
    },
    i(c) {
      _ || (transition_in$8(n.$$.fragment, c), _ = !0);
    },
    o(c) {
      transition_out$7(n.$$.fragment, c), _ = !1;
    },
    d(c) {
      c && detach$c(e), destroy_component$6(n), E && E.d();
    }
  };
}
function instance$b(r, e, t) {
  let { type: n = "file" } = e, { i18n: f } = e, { message: u = void 0 } = e, { mode: y = "full" } = e, { hovered: h = !1 } = e;
  const _ = {
    image: "upload_text.drop_image",
    video: "upload_text.drop_video",
    audio: "upload_text.drop_audio",
    file: "upload_text.drop_file",
    csv: "upload_text.drop_csv"
  };
  return r.$$set = (E) => {
    "type" in E && t(0, n = E.type), "i18n" in E && t(1, f = E.i18n), "message" in E && t(2, u = E.message), "mode" in E && t(3, y = E.mode), "hovered" in E && t(4, h = E.hovered);
  }, [n, f, u, y, h, _];
}
class UploadText extends SvelteComponent$c {
  constructor(e) {
    super(), init$c(this, e, instance$b, create_fragment$c, safe_not_equal$d, {
      type: 0,
      i18n: 1,
      message: 2,
      mode: 3,
      hovered: 4
    });
  }
}
const Toolbar_svelte_svelte_type_style_lang = "", prettyBytes = (r) => {
  let e = ["B", "KB", "MB", "GB", "PB"], t = 0;
  for (; r > 1024; )
    r /= 1024, t++;
  let n = e[t];
  return r.toFixed(1) + "&nbsp;" + n;
}, display_file_name = (r) => {
  var e;
  e = r.orig_name;
  const t = 30;
  if (e.length > t) {
    const n = e.substring(0, t), f = e.lastIndexOf(".");
    if (f !== -1) {
      const u = e.slice(f);
      return `${n}..${u}`;
    }
    return n;
  }
  return e;
}, display_file_size = (r) => {
  var e = 0;
  if (Array.isArray(r))
    for (var t of r)
      t.size !== void 0 && (e += t.size);
  else
    e = r.size || 0;
  return prettyBytes(e);
}, FilePreview_svelte_svelte_type_style_lang = "", {
  HtmlTag,
  SvelteComponent: SvelteComponent$b,
  append: append$9,
  attr: attr$9,
  destroy_each: destroy_each$3,
  detach: detach$b,
  element: element$8,
  ensure_array_like: ensure_array_like$3,
  init: init$b,
  insert: insert$b,
  listen: listen$3,
  noop: noop$7,
  safe_not_equal: safe_not_equal$c,
  set_data: set_data$4,
  set_style: set_style$4,
  space: space$8,
  text: text$4,
  toggle_class: toggle_class$6
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal;
function get_each_context$3(r, e, t) {
  const n = r.slice();
  return n[6] = e[t], n[8] = t, n;
}
function create_else_block$6(r) {
  let e = (
    /*i18n*/
    r[3]("file.uploading") + ""
  ), t;
  return {
    c() {
      t = text$4(e);
    },
    m(n, f) {
      insert$b(n, t, f);
    },
    p(n, f) {
      f & /*i18n*/
      8 && e !== (e = /*i18n*/
      n[3]("file.uploading") + "") && set_data$4(t, e);
    },
    d(n) {
      n && detach$b(t);
    }
  };
}
function create_if_block$7(r) {
  let e, t, n = display_file_size(
    /*file*/
    r[6]
  ) + "", f, u, y;
  return {
    c() {
      e = element$8("a"), t = new HtmlTag(!1), f = text$4(" ⇣"), t.a = f, attr$9(e, "href", u = /*file*/
      r[6].url), attr$9(e, "target", "_blank"), attr$9(e, "download", y = window.__is_colab__ ? null : (
        /*file*/
        r[6].orig_name
      )), attr$9(e, "class", "svelte-usqupg");
    },
    m(h, _) {
      insert$b(h, e, _), t.m(n, e), append$9(e, f);
    },
    p(h, _) {
      _ & /*value*/
      1 && n !== (n = display_file_size(
        /*file*/
        h[6]
      ) + "") && t.p(n), _ & /*value*/
      1 && u !== (u = /*file*/
      h[6].url) && attr$9(e, "href", u), _ & /*value*/
      1 && y !== (y = window.__is_colab__ ? null : (
        /*file*/
        h[6].orig_name
      )) && attr$9(e, "download", y);
    },
    d(h) {
      h && detach$b(e);
    }
  };
}
function create_each_block$3(r) {
  let e, t, n = display_file_name(
    /*file*/
    r[6]
  ) + "", f, u, y, h, _, E;
  function c(S, s) {
    return (
      /*file*/
      S[6].url ? create_if_block$7 : create_else_block$6
    );
  }
  let C = c(r), b = C(r);
  function A() {
    return (
      /*click_handler*/
      r[5](
        /*file*/
        r[6],
        /*i*/
        r[8]
      )
    );
  }
  return {
    c() {
      e = element$8("tr"), t = element$8("td"), f = text$4(n), u = space$8(), y = element$8("td"), b.c(), h = space$8(), attr$9(t, "class", "svelte-usqupg"), attr$9(y, "class", "download svelte-usqupg"), attr$9(e, "class", "file svelte-usqupg"), toggle_class$6(
        e,
        "selectable",
        /*selectable*/
        r[1]
      );
    },
    m(S, s) {
      insert$b(S, e, s), append$9(e, t), append$9(t, f), append$9(e, u), append$9(e, y), b.m(y, null), append$9(e, h), _ || (E = listen$3(e, "click", A), _ = !0);
    },
    p(S, s) {
      r = S, s & /*value*/
      1 && n !== (n = display_file_name(
        /*file*/
        r[6]
      ) + "") && set_data$4(f, n), C === (C = c(r)) && b ? b.p(r, s) : (b.d(1), b = C(r), b && (b.c(), b.m(y, null))), s & /*selectable*/
      2 && toggle_class$6(
        e,
        "selectable",
        /*selectable*/
        r[1]
      );
    },
    d(S) {
      S && detach$b(e), b.d(), _ = !1, E();
    }
  };
}
function create_fragment$b(r) {
  let e, t, n, f = ensure_array_like$3(Array.isArray(
    /*value*/
    r[0]
  ) ? (
    /*value*/
    r[0]
  ) : [
    /*value*/
    r[0]
  ]), u = [];
  for (let y = 0; y < f.length; y += 1)
    u[y] = create_each_block$3(get_each_context$3(r, f, y));
  return {
    c() {
      e = element$8("div"), t = element$8("table"), n = element$8("tbody");
      for (let y = 0; y < u.length; y += 1)
        u[y].c();
      attr$9(n, "class", "svelte-usqupg"), attr$9(t, "class", "file-preview svelte-usqupg"), attr$9(e, "class", "file-preview-holder svelte-usqupg"), set_style$4(e, "max-height", typeof /*height*/
      r[2] === void 0 ? "auto" : (
        /*height*/
        r[2] + "px"
      ));
    },
    m(y, h) {
      insert$b(y, e, h), append$9(e, t), append$9(t, n);
      for (let _ = 0; _ < u.length; _ += 1)
        u[_] && u[_].m(n, null);
    },
    p(y, [h]) {
      if (h & /*selectable, dispatch, Array, value, window, i18n*/
      27) {
        f = ensure_array_like$3(Array.isArray(
          /*value*/
          y[0]
        ) ? (
          /*value*/
          y[0]
        ) : [
          /*value*/
          y[0]
        ]);
        let _;
        for (_ = 0; _ < f.length; _ += 1) {
          const E = get_each_context$3(y, f, _);
          u[_] ? u[_].p(E, h) : (u[_] = create_each_block$3(E), u[_].c(), u[_].m(n, null));
        }
        for (; _ < u.length; _ += 1)
          u[_].d(1);
        u.length = f.length;
      }
      h & /*height*/
      4 && set_style$4(e, "max-height", typeof /*height*/
      y[2] === void 0 ? "auto" : (
        /*height*/
        y[2] + "px"
      ));
    },
    i: noop$7,
    o: noop$7,
    d(y) {
      y && detach$b(e), destroy_each$3(u, y);
    }
  };
}
function instance$a(r, e, t) {
  const n = createEventDispatcher$4();
  let { value: f } = e, { selectable: u = !1 } = e, { height: y = void 0 } = e, { i18n: h } = e;
  const _ = (E, c) => n("select", { value: E.orig_name, index: c });
  return r.$$set = (E) => {
    "value" in E && t(0, f = E.value), "selectable" in E && t(1, u = E.selectable), "height" in E && t(2, y = E.height), "i18n" in E && t(3, h = E.i18n);
  }, [f, u, y, h, n, _];
}
class FilePreview extends SvelteComponent$b {
  constructor(e) {
    super(), init$b(this, e, instance$a, create_fragment$b, safe_not_equal$c, {
      value: 0,
      selectable: 1,
      height: 2,
      i18n: 3
    });
  }
}
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function getDefaultExportFromCjs(r) {
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var _3Dmol$1 = { exports: {} };
/*!
 * 3dmol v2.0.6
 * JavaScript/TypeScript molecular visualization library
 * Author: David Koes and contributors
 */
(function(module, exports) {
  (function(e, t) {
    module.exports = t();
  })(commonjsGlobal, () => (
    /******/
    (() => {
      var __webpack_modules__ = {
        /***/
        "./node_modules/iobuffer/lib-esm/IOBuffer.js": (
          /*!***************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/IOBuffer.js ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              IOBuffer: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var n = t(
              /*! ./text */
              "./node_modules/iobuffer/lib-esm/text.browser.js"
            );
            const f = 1024 * 8, u = (() => {
              const _ = new Uint8Array(4), E = new Uint32Array(_.buffer);
              return !((E[0] = 1) & _[0]);
            })(), y = {
              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 h {
              /**
               * @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 = f, c = {}) {
                let C = !1;
                typeof E == "number" ? E = new ArrayBuffer(E) : (C = !0, this.lastWrittenByte = E.byteLength);
                const b = c.offset ? c.offset >>> 0 : 0, A = E.byteLength - b;
                let S = b;
                (ArrayBuffer.isView(E) || E instanceof h) && (E.byteLength !== E.buffer.byteLength && (S = E.byteOffset + b), E = E.buffer), C ? this.lastWrittenByte = A : this.lastWrittenByte = 0, this.buffer = E, this.length = A, this.byteLength = A, this.byteOffset = S, this.offset = 0, this.littleEndian = !0, this._data = new DataView(this.buffer, S, A), 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 C = (this.offset + E) * 2, b = new Uint8Array(C);
                  b.set(new Uint8Array(this.buffer)), this.buffer = b.buffer, this.length = this.byteLength = C, 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, c) {
                const C = y[c].BYTES_PER_ELEMENT * E, b = this.byteOffset + this.offset, A = this.buffer.slice(b, b + C);
                if (this.littleEndian === u && c !== "uint8" && c !== "int8") {
                  const s = new Uint8Array(this.buffer.slice(b, b + C));
                  s.reverse();
                  const o = new y[c](s.buffer);
                  return this.offset += C, o.reverse(), o;
                }
                const S = new y[c](A);
                return this.offset += C, S;
              }
              /**
               * 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 c = "";
                for (let C = 0; C < E; C++)
                  c += this.readChar();
                return c;
              }
              /**
               * Read the next `n` bytes, return a UTF-8 decoded string and move pointer
               * forward by `n` bytes.
               */
              readUtf8(E = 1) {
                return (0, n.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, c = "utf-8") {
                return (0, n.decode)(this.readBytes(E), c);
              }
              /**
               * 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 c = 0; c < E.length; c++)
                  this._data.setUint8(this.offset++, E[c]);
                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 c = 0; c < E.length; c++)
                  this.writeUint8(E.charCodeAt(c));
                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, n.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(r) {
              if (r.TextEncoder && r.TextDecoder)
                return !1;
              function e(n = "utf-8") {
                if (n !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${n}') is invalid.`);
              }
              Object.defineProperty(e.prototype, "encoding", {
                value: "utf-8"
              }), e.prototype.encode = function(n, f = { stream: !1 }) {
                if (f.stream)
                  throw new Error("Failed to encode: the 'stream' option is unsupported.");
                let u = 0;
                const y = n.length;
                let h = 0, _ = Math.max(32, y + (y >> 1) + 7), E = new Uint8Array(_ >> 3 << 3);
                for (; u < y; ) {
                  let c = n.charCodeAt(u++);
                  if (c >= 55296 && c <= 56319) {
                    if (u < y) {
                      const C = n.charCodeAt(u);
                      (C & 64512) === 56320 && (++u, c = ((c & 1023) << 10) + (C & 1023) + 65536);
                    }
                    if (c >= 55296 && c <= 56319)
                      continue;
                  }
                  if (h + 4 > E.length) {
                    _ += 8, _ *= 1 + u / n.length * 2, _ = _ >> 3 << 3;
                    const C = new Uint8Array(_);
                    C.set(E), E = C;
                  }
                  if (c & 4294967168)
                    if (!(c & 4294965248))
                      E[h++] = c >> 6 & 31 | 192;
                    else if (!(c & 4294901760))
                      E[h++] = c >> 12 & 15 | 224, E[h++] = c >> 6 & 63 | 128;
                    else if (!(c & 4292870144))
                      E[h++] = c >> 18 & 7 | 240, E[h++] = c >> 12 & 63 | 128, E[h++] = c >> 6 & 63 | 128;
                    else
                      continue;
                  else {
                    E[h++] = c;
                    continue;
                  }
                  E[h++] = c & 63 | 128;
                }
                return E.slice(0, h);
              };
              function t(n = "utf-8", f = { fatal: !1 }) {
                if (n !== "utf-8")
                  throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${n}') is invalid.`);
                if (f.fatal)
                  throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");
              }
              Object.defineProperty(t.prototype, "encoding", {
                value: "utf-8"
              }), Object.defineProperty(t.prototype, "fatal", { value: !1 }), Object.defineProperty(t.prototype, "ignoreBOM", {
                value: !1
              }), t.prototype.decode = function(n, f = { stream: !1 }) {
                if (f.stream)
                  throw new Error("Failed to decode: the 'stream' option is unsupported.");
                const u = new Uint8Array(n);
                let y = 0;
                const h = u.length, _ = [];
                for (; y < h; ) {
                  const E = u[y++];
                  if (E === 0)
                    break;
                  if (!(E & 128))
                    _.push(E);
                  else if ((E & 224) === 192) {
                    const c = u[y++] & 63;
                    _.push((E & 31) << 6 | c);
                  } else if ((E & 240) === 224) {
                    const c = u[y++] & 63, C = u[y++] & 63;
                    _.push((E & 31) << 12 | c << 6 | C);
                  } else if ((E & 248) === 240) {
                    const c = u[y++] & 63, C = u[y++] & 63, b = u[y++] & 63;
                    let A = (E & 7) << 18 | c << 12 | C << 6 | b;
                    A > 65535 && (A -= 65536, _.push(A >>> 10 & 1023 | 55296), A = 56320 | A & 1023), _.push(A);
                  }
                }
                return String.fromCharCode.apply(null, _);
              }, r.TextEncoder = e, r.TextDecoder = t;
            })(typeof window < "u" ? window : typeof self < "u" ? self : this);
          }
        ),
        /***/
        "./node_modules/iobuffer/lib-esm/text.browser.js": (
          /*!*******************************************************!*\
            !*** ./node_modules/iobuffer/lib-esm/text.browser.js ***!
            \*******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              decode: () => (
                /* binding */
                n
              ),
              /* harmony export */
              encode: () => (
                /* binding */
                u
              )
              /* harmony export */
            }), t(
              /*! ./text-encoding-polyfill */
              "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js"
            );
            function n(y, h = "utf8") {
              return new TextDecoder(h).decode(y);
            }
            const f = new TextEncoder();
            function u(y) {
              return f.encode(y);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/data.js": (
          /*!***********************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/data.js ***!
            \***********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              nonRecord: () => (
                /* binding */
                f
              ),
              /* harmony export */
              record: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            );
            function f(y, h) {
              const _ = (0, n.str2num)(h.type), E = h.size / (0, n.num2bytes)(_), c = new Array(E);
              for (let C = 0; C < E; C++)
                c[C] = (0, n.readType)(y, _, 1);
              return c;
            }
            function u(y, h, _) {
              const E = (0, n.str2num)(h.type), c = h.size ? h.size / (0, n.num2bytes)(E) : 1, C = _.length, b = new Array(C), A = _.recordStep;
              if (A)
                for (let S = 0; S < C; S++) {
                  const s = y.offset;
                  b[S] = (0, n.readType)(y, E, c), y.seek(s + A);
                }
              else
                throw new Error("recordDimension.recordStep is undefined");
              return b;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/header.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/header.js ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              header: () => (
                /* binding */
                c
              )
              /* harmony export */
            });
            var n = t(
              /*! ./types */
              "./node_modules/netcdfjs/lib-esm/types.js"
            ), f = t(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            const u = 0, y = 10, h = 11, _ = 12, E = 0;
            function c(S, s) {
              const o = { version: s }, w = {
                length: S.readUint32()
              }, p = C(S);
              Array.isArray(p) || (w.id = p.recordId, w.name = p.recordName, o.dimensions = p.dimensions), o.globalAttributes = b(S);
              const v = A(S, w == null ? void 0 : w.id, s);
              return Array.isArray(v) || (o.variables = v.variables, w.recordStep = v.recordStep), o.recordDimension = w, o;
            }
            function C(S) {
              const s = {};
              let o, w;
              const p = S.readUint32();
              let v;
              if (p === u)
                return (0, f.notNetcdf)(S.readUint32() !== u, "wrong empty tag for list of dimensions"), [];
              {
                (0, f.notNetcdf)(p !== y, "wrong tag for list of dimensions");
                const a = S.readUint32();
                v = new Array(a);
                for (let l = 0; l < a; l++) {
                  const g = (0, f.readName)(S), M = S.readUint32();
                  M === E && (o = l, w = g), v[l] = {
                    name: g,
                    size: M
                  };
                }
              }
              return o !== void 0 && (s.recordId = o), w !== void 0 && (s.recordName = w), s.dimensions = v, s;
            }
            function b(S) {
              const s = S.readUint32();
              let o;
              if (s === u)
                return (0, f.notNetcdf)(S.readUint32() !== u, "wrong empty tag for list of attributes"), [];
              {
                (0, f.notNetcdf)(s !== _, "wrong tag for list of attributes");
                const w = S.readUint32();
                o = new Array(w);
                for (let p = 0; p < w; p++) {
                  const v = (0, f.readName)(S), a = S.readUint32();
                  (0, f.notNetcdf)(a < 1 || a > 6, `non valid type ${a}`);
                  const l = S.readUint32(), g = (0, n.readType)(S, a, l);
                  (0, f.padding)(S), o[p] = {
                    name: v,
                    type: (0, n.num2str)(a),
                    value: g
                  };
                }
              }
              return o;
            }
            function A(S, s, o) {
              const w = S.readUint32();
              let p = 0, v;
              if (w === u)
                return (0, f.notNetcdf)(S.readUint32() !== u, "wrong empty tag for list of variables"), [];
              {
                (0, f.notNetcdf)(w !== h, "wrong tag for list of variables");
                const a = S.readUint32();
                v = new Array(a);
                for (let l = 0; l < a; l++) {
                  const g = (0, f.readName)(S), M = S.readUint32(), L = new Array(M);
                  for (let B = 0; B < M; B++)
                    L[B] = S.readUint32();
                  const T = b(S), D = S.readUint32();
                  (0, f.notNetcdf)(D < 1 && D > 6, `non valid type ${D}`);
                  const I = S.readUint32();
                  let z = S.readUint32();
                  o === 2 && ((0, f.notNetcdf)(z > 0, "offsets larger than 4GB not supported"), z = S.readUint32());
                  let P = !1;
                  typeof s < "u" && L[0] === s && (p += I, P = !0), v[l] = {
                    name: g,
                    dimensions: L,
                    attributes: T,
                    type: (0, n.num2str)(D),
                    size: I,
                    offset: z,
                    record: P
                  };
                }
              }
              return {
                variables: v,
                recordStep: p
              };
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/index.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/index.js ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              NetCDFReader: () => (
                /* reexport safe */
                n.NetCDFReader
              )
              /* harmony export */
            });
            var n = t(
              /*! ./parser */
              "./node_modules/netcdfjs/lib-esm/parser.js"
            );
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/parser.js": (
          /*!*************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/parser.js ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              NetCDFReader: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! iobuffer */
              "./node_modules/iobuffer/lib-esm/IOBuffer.js"
            ), f = t(
              /*! ./data */
              "./node_modules/netcdfjs/lib-esm/data.js"
            ), u = t(
              /*! ./header */
              "./node_modules/netcdfjs/lib-esm/header.js"
            ), y = t(
              /*! ./toString */
              "./node_modules/netcdfjs/lib-esm/toString.js"
            ), h = t(
              /*! ./utils */
              "./node_modules/netcdfjs/lib-esm/utils.js"
            );
            class _ {
              constructor(c) {
                this.toString = y.toString;
                const C = new n.IOBuffer(c);
                C.setBigEndian(), (0, h.notNetcdf)(C.readChars(3) !== "CDF", "should start with CDF");
                const b = C.readByte();
                (0, h.notNetcdf)(b > 2, "unknown version"), this.header = (0, u.header)(C, b), this.buffer = C;
              }
              /**
               * @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(c) {
                const C = this.globalAttributes.find((b) => b.name === c);
                return C ? C.value : null;
              }
              /**
               * Returns the value of a variable as a string
               * @param - variableName
               * @return - Value of the variable as a string or null
               */
              getDataVariableAsString(c) {
                const C = this.getDataVariable(c);
                return C ? C.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(c) {
                let C;
                if (typeof c == "string" ? C = this.header.variables.find((b) => b.name === c) : C = c, C === void 0)
                  throw new Error("Not a valid NetCDF v3.x file: variable not found");
                return this.buffer.seek(C.offset), C.record ? (0, f.record)(this.buffer, C, this.header.recordDimension) : (0, f.nonRecord)(this.buffer, C);
              }
              /**
               * Check if a dataVariable exists
               * @param variableName - Name of the variable to find
               * @return boolean
               */
              dataVariableExists(c) {
                return this.header.variables.find((b) => b.name === c) !== void 0;
              }
              /**
               * Check if an attribute exists
               * @param attributeName - Name of the attribute to find
               * @return boolean
               */
              attributeExists(c) {
                return this.globalAttributes.find((b) => b.name === c) !== void 0;
              }
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/toString.js": (
          /*!***************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/toString.js ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              toString: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n() {
              const f = [];
              f.push("DIMENSIONS");
              for (const y of this.dimensions)
                f.push(`  ${y.name.padEnd(30)} = size: ${y.size}`);
              f.push(""), f.push("GLOBAL ATTRIBUTES");
              for (const y of this.globalAttributes)
                f.push(`  ${y.name.padEnd(30)} = ${y.value}`);
              const u = JSON.parse(JSON.stringify(this.variables));
              f.push(""), f.push("VARIABLES:");
              for (const y of u) {
                y.value = this.getDataVariable(y);
                let h = JSON.stringify(y.value);
                h.length > 50 && (h = h.substring(0, 50)), isNaN(y.value.length) || (h += ` (length: ${y.value.length})`), f.push(`  ${y.name.padEnd(30)} = ${h}`);
              }
              return f.join(`
`);
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/types.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/types.js ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              num2bytes: () => (
                /* binding */
                u
              ),
              /* harmony export */
              num2str: () => (
                /* binding */
                f
              ),
              /* harmony export */
              readType: () => (
                /* binding */
                _
              ),
              /* harmony export */
              str2num: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            const n = {
              BYTE: 1,
              CHAR: 2,
              SHORT: 3,
              INT: 4,
              FLOAT: 5,
              DOUBLE: 6
            };
            function f(c) {
              switch (Number(c)) {
                case n.BYTE:
                  return "byte";
                case n.CHAR:
                  return "char";
                case n.SHORT:
                  return "short";
                case n.INT:
                  return "int";
                case n.FLOAT:
                  return "float";
                case n.DOUBLE:
                  return "double";
                default:
                  return "undefined";
              }
            }
            function u(c) {
              switch (Number(c)) {
                case n.BYTE:
                  return 1;
                case n.CHAR:
                  return 1;
                case n.SHORT:
                  return 2;
                case n.INT:
                  return 4;
                case n.FLOAT:
                  return 4;
                case n.DOUBLE:
                  return 8;
                default:
                  return -1;
              }
            }
            function y(c) {
              switch (String(c)) {
                case "byte":
                  return n.BYTE;
                case "char":
                  return n.CHAR;
                case "short":
                  return n.SHORT;
                case "int":
                  return n.INT;
                case "float":
                  return n.FLOAT;
                case "double":
                  return n.DOUBLE;
                default:
                  return -1;
              }
            }
            function h(c, C) {
              if (c !== 1) {
                const b = new Array(c);
                for (let A = 0; A < c; A++)
                  b[A] = C();
                return b;
              } else
                return C();
            }
            function _(c, C, b) {
              switch (C) {
                case n.BYTE:
                  return Array.from(c.readBytes(b));
                case n.CHAR:
                  return E(c.readChars(b));
                case n.SHORT:
                  return h(b, c.readInt16.bind(c));
                case n.INT:
                  return h(b, c.readInt32.bind(c));
                case n.FLOAT:
                  return h(b, c.readFloat32.bind(c));
                case n.DOUBLE:
                  return h(b, c.readFloat64.bind(c));
                default:
                  throw new Error(`non valid type ${C}`);
              }
            }
            function E(c) {
              return c.charCodeAt(c.length - 1) === 0 ? c.substring(0, c.length - 1) : c;
            }
          }
        ),
        /***/
        "./node_modules/netcdfjs/lib-esm/utils.js": (
          /*!************************************************!*\
            !*** ./node_modules/netcdfjs/lib-esm/utils.js ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              notNetcdf: () => (
                /* binding */
                n
              ),
              /* harmony export */
              padding: () => (
                /* binding */
                f
              ),
              /* harmony export */
              readName: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            function n(y, h) {
              if (y)
                throw new TypeError(`Not a valid NetCDF v3.x file: ${h}`);
            }
            function f(y) {
              y.offset % 4 !== 0 && y.skip(4 - y.offset % 4);
            }
            function u(y) {
              const h = y.readUint32(), _ = y.readChars(h);
              return f(y), _;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/basic.frag": (
          /*!************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/basic.frag ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `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 ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `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 ***!
            \********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `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 ***!
            \********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `

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

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

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

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

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

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

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

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

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

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

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 ***!
            \**********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `
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 ***!
            \**********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `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 ***!
            \**************************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              default: () => n
              /* harmony export */
            });
            const n = `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 ***!
            \***********************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CAP: () => (
                /* binding */
                f
              ),
              /* harmony export */
              GLDraw: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), f;
            (function(y) {
              y[y.NONE = 0] = "NONE", y[y.FLAT = 1] = "FLAT", y[y.ROUND = 2] = "ROUND";
            })(f || (f = {}));
            var u;
            (function(y) {
              function h(s, o, w) {
                var p = Math.hypot(s, o), v, a, l, g, M;
                p < 1e-4 ? (a = 0, l = 1) : (a = -s / p, l = o / p), o = -a * s + l * o, v = Math.hypot(o, w), v < 1e-4 ? (g = 0, M = 1) : (g = w / v, M = o / v);
                var L = new Float32Array(9);
                return L[0] = l, L[1] = a, L[2] = 0, L[3] = -a * M, L[4] = l * M, L[5] = g, L[6] = a * g, L[7] = -l * g, L[8] = M, L;
              }
              class _ {
                constructor() {
                  this.cache = {};
                  let o = [], w = 4, p = Math.pow(2, w), v = 2, a = Math.pow(2, v), l = p / a, g;
                  for (o[0] = new n.Vector3(-1, 0, 0), o[l] = new n.Vector3(0, 0, 1), o[l * 2] = new n.Vector3(1, 0, 0), o[l * 3] = new n.Vector3(0, 0, -1), v = 3; v <= w; v++) {
                    for (a = Math.pow(2, v - 1), l = p / a, g = 0; g < a - 1; g++)
                      o[l / 2 + g * l] = o[g * l].clone().add(o[(g + 1) * l]).normalize();
                    g = a - 1, o[l / 2 + g * l] = o[g * l].clone().add(o[0]).normalize();
                  }
                  this.basisVectors = o;
                }
                getVerticesForRadius(o, w, p) {
                  if (typeof this.cache < "u" && this.cache[o] !== void 0 && this.cache[o][w + p] !== void 0)
                    return this.cache[o][w + p];
                  for (var v = this.basisVectors.length, a = [], l = [], g, M = 0; M < v; M++)
                    a.push(this.basisVectors[M].clone().multiplyScalar(o)), a.push(this.basisVectors[M].clone().multiplyScalar(o)), g = this.basisVectors[M].clone().normalize(), l.push(g), l.push(g);
                  var L = [], T = 10, D = v, I = 0, z = Math.PI * 2, P = 0, B = Math.PI, F, N, $ = !1, k = !1;
                  for (N = 0; N <= T; N++) {
                    $ = N === 0 || N === T, k = N === T / 2;
                    var G = [], H = [];
                    for (F = 0; F <= D; F++) {
                      if (k) {
                        var U = F < D ? 2 * F : 0;
                        H.push(U + 1), G.push(U);
                        continue;
                      }
                      var V = F / D, Q = N / T;
                      if (!$ || F === 0)
                        if (F < D) {
                          var ae = new n.Vector3();
                          ae.x = -o * Math.cos(I + V * z) * Math.sin(P + Q * B), w == 1 ? ae.y = 0 : ae.y = o * Math.cos(P + Q * B), ae.z = o * Math.sin(I + V * z) * Math.sin(P + Q * B), Math.abs(ae.x) < 1e-5 && (ae.x = 0), Math.abs(ae.y) < 1e-5 && (ae.y = 0), Math.abs(ae.z) < 1e-5 && (ae.z = 0), w == f.FLAT ? (g = new n.Vector3(0, Math.cos(P + Q * B), 0), g.normalize()) : (g = new n.Vector3(ae.x, ae.y, ae.z), g.normalize()), a.push(ae), l.push(g), G.push(a.length - 1);
                        } else
                          G.push(a.length - D);
                      else
                        $ && G.push(a.length - 1);
                    }
                    k && L.push(H), L.push(G);
                  }
                  var oe = {
                    vertices: a,
                    normals: l,
                    verticesRows: L,
                    w: D,
                    h: T
                  };
                  return o in this.cache || (this.cache[o] = {}), this.cache[o][w + p] = oe, oe;
                }
              }
              var E = new _();
              function c(s, o, w, p, v, a = 0, l = 0) {
                if (!(!o || !w)) {
                  var g = l || a;
                  v = v || { r: 0, g: 0, b: 0 };
                  var M = h(w.x - o.x, w.y - o.y, w.z - o.z), L = E.getVerticesForRadius(p, l, "to"), T = L.w, D = L.h, I = g ? D * T + 2 : 2 * T, z = s.updateGeoGroup(I), P = L.vertices, B = L.normals, F = L.verticesRows, N = F[D / 2], $ = F[D / 2 + 1], k = z.vertices, G, H, U, V, Q, ae, oe = z.vertexArray, q = z.normalArray, me = z.colorArray, ne = z.faceArray;
                  for (U = 0; U < T; ++U) {
                    var fe = 2 * U;
                    V = M[0] * P[fe].x + M[3] * P[fe].y + M[6] * P[fe].z, Q = M[1] * P[fe].x + M[4] * P[fe].y + M[7] * P[fe].z, ae = M[5] * P[fe].y + M[8] * P[fe].z, G = 3 * (k + fe), H = z.faceidx, oe[G] = V + o.x, oe[G + 1] = Q + o.y, oe[G + 2] = ae + o.z, oe[G + 3] = V + w.x, oe[G + 4] = Q + w.y, oe[G + 5] = ae + w.z, q[G] = V, q[G + 3] = V, q[G + 1] = Q, q[G + 4] = Q, q[G + 2] = ae, q[G + 5] = ae, me[G] = v.r, me[G + 3] = v.r, me[G + 1] = v.g, me[G + 4] = v.g, me[G + 2] = v.b, me[G + 5] = v.b, ne[H] = $[U] + k, ne[H + 1] = $[U + 1] + k, ne[H + 2] = N[U] + k, ne[H + 3] = N[U] + k, ne[H + 4] = $[U + 1] + k, ne[H + 5] = N[U + 1] + k, z.faceidx += 6;
                  }
                  if (g) {
                    var Ce = l ? 0 : D / 2, Me = a ? D + 1 : D / 2 + 1, Te, se, pe, we, ke, Ue, Ne, Be, ue, ye, ge, Se, ze, He, We, Y, K, ee, de, ve, Ie, Re, Z, ce, Ae, Fe, he, Oe, j, $e, Ve, R;
                    for (Q = Ce; Q < Me; Q++)
                      if (Q !== D / 2) {
                        var be = Q <= D / 2 ? w : o, Ee = E.getVerticesForRadius(p, l, "to"), X = E.getVerticesForRadius(p, a, "from");
                        for (be === w ? (P = Ee.vertices, B = Ee.normals, F = Ee.verticesRows) : be == o && (P = X.vertices, B = X.normals, F = X.verticesRows), V = 0; V < T; V++)
                          H = z.faceidx, Te = F[Q][V + 1], j = (Te + k) * 3, se = F[Q][V], $e = (se + k) * 3, pe = F[Q + 1][V], Ve = (pe + k) * 3, we = F[Q + 1][V + 1], R = (we + k) * 3, ke = M[0] * P[Te].x + M[3] * P[Te].y + M[6] * P[Te].z, Ue = M[0] * P[se].x + M[3] * P[se].y + M[6] * P[se].z, Ne = M[0] * P[pe].x + M[3] * P[pe].y + M[6] * P[pe].z, Be = M[0] * P[we].x + M[3] * P[we].y + M[6] * P[we].z, ue = M[1] * P[Te].x + M[4] * P[Te].y + M[7] * P[Te].z, ye = M[1] * P[se].x + M[4] * P[se].y + M[7] * P[se].z, ge = M[1] * P[pe].x + M[4] * P[pe].y + M[7] * P[pe].z, Se = M[1] * P[we].x + M[4] * P[we].y + M[7] * P[we].z, ze = M[5] * P[Te].y + M[8] * P[Te].z, He = M[5] * P[se].y + M[8] * P[se].z, We = M[5] * P[pe].y + M[8] * P[pe].z, Y = M[5] * P[we].y + M[8] * P[we].z, oe[j] = ke + be.x, oe[$e] = Ue + be.x, oe[Ve] = Ne + be.x, oe[R] = Be + be.x, oe[j + 1] = ue + be.y, oe[$e + 1] = ye + be.y, oe[Ve + 1] = ge + be.y, oe[R + 1] = Se + be.y, oe[j + 2] = ze + be.z, oe[$e + 2] = He + be.z, oe[Ve + 2] = We + be.z, oe[R + 2] = Y + be.z, me[j] = v.r, me[$e] = v.r, me[Ve] = v.r, me[R] = v.r, me[j + 1] = v.g, me[$e + 1] = v.g, me[Ve + 1] = v.g, me[R + 1] = v.g, me[j + 2] = v.b, me[$e + 2] = v.b, me[Ve + 2] = v.b, me[R + 2] = v.b, K = M[0] * B[Te].x + M[3] * B[Te].y + M[6] * B[Te].z, ee = M[0] * B[se].x + M[3] * B[se].y + M[6] * B[se].z, de = M[0] * B[pe].x + M[3] * B[pe].y + M[6] * B[pe].z, ve = M[0] * B[we].x + M[3] * B[we].y + M[6] * B[we].z, Ie = M[1] * B[Te].x + M[4] * B[Te].y + M[7] * B[Te].z, Re = M[1] * B[se].x + M[4] * B[se].y + M[7] * B[se].z, Z = M[1] * B[pe].x + M[4] * B[pe].y + M[7] * B[pe].z, ce = M[1] * B[we].x + M[4] * B[we].y + M[7] * B[we].z, Ae = M[5] * B[Te].y + M[8] * B[Te].z, Fe = M[5] * B[se].y + M[8] * B[se].z, he = M[5] * B[pe].y + M[8] * B[pe].z, Oe = M[5] * B[we].y + M[8] * B[we].z, Q === 0 ? (q[j] = K, q[Ve] = de, q[R] = ve, q[j + 1] = Ie, q[Ve + 1] = Z, q[R + 1] = ce, q[j + 2] = Ae, q[Ve + 2] = he, q[R + 2] = Oe, ne[H] = Te + k, ne[H + 1] = pe + k, ne[H + 2] = we + k, z.faceidx += 3) : Q === Me - 1 ? (q[j] = K, q[$e] = ee, q[Ve] = de, q[j + 1] = Ie, q[$e + 1] = Re, q[Ve + 1] = Z, q[j + 2] = Ae, q[$e + 2] = Fe, q[Ve + 2] = he, ne[H] = Te + k, ne[H + 1] = se + k, ne[H + 2] = pe + k, z.faceidx += 3) : (q[j] = K, q[$e] = ee, q[R] = ve, q[j + 1] = Ie, q[$e + 1] = Re, q[R + 1] = ce, q[j + 2] = Ae, q[$e + 2] = Fe, q[R + 2] = Oe, q[$e] = ee, q[Ve] = de, q[R] = ve, q[$e + 1] = Re, q[Ve + 1] = Z, q[R + 1] = ce, q[$e + 2] = Fe, q[Ve + 2] = he, q[R + 2] = Oe, ne[H] = Te + k, ne[H + 1] = se + k, ne[H + 2] = we + k, ne[H + 3] = se + k, ne[H + 4] = pe + k, ne[H + 5] = we + k, z.faceidx += 6);
                      }
                  }
                  z.vertices += I;
                }
              }
              y.drawCylinder = c;
              function C(s, o, w, p, v) {
                if (!o || !w)
                  return;
                v = v || { r: 0, g: 0, b: 0 };
                let a = new n.Vector3(w.x - o.x, w.y - o.y, w.z - o.z);
                var l = h(a.x, a.y, a.z);
                a = a.normalize();
                var g = E.basisVectors.length, M = E.basisVectors, L = g + 2, T = s.updateGeoGroup(L), D = T.vertices, I, z, P, B, F, N, $ = T.vertexArray, k = T.normalArray, G = T.colorArray, H = T.faceArray;
                for (I = D * 3, $[I] = o.x, $[I + 1] = o.y, $[I + 2] = o.z, k[I] = -a.x, k[I + 1] = -a.y, k[I + 2] = -a.z, G[I] = v.r, G[I + 1] = v.g, G[I + 2] = v.b, $[I + 3] = w.x, $[I + 4] = w.y, $[I + 5] = w.z, k[I + 3] = a.x, k[I + 4] = a.y, k[I + 5] = a.z, G[I + 3] = v.r, G[I + 4] = v.g, G[I + 5] = v.b, I += 6, P = 0; P < g; ++P) {
                  var U = M[P].clone();
                  U.multiplyScalar(p), B = l[0] * U.x + l[3] * U.y + l[6] * U.z, F = l[1] * U.x + l[4] * U.y + l[7] * U.z, N = l[5] * U.y + l[8] * U.z, $[I] = B + o.x, $[I + 1] = F + o.y, $[I + 2] = N + o.z, k[I] = B, k[I + 1] = F, k[I + 2] = N, G[I] = v.r, G[I + 1] = v.g, G[I + 2] = v.b, I += 3;
                }
                for (T.vertices += g + 2, z = T.faceidx, P = 0; P < g; P++) {
                  var V = D + 2 + P, Q = D + 2 + (P + 1) % g;
                  H[z] = V, H[z + 1] = Q, H[z + 2] = D, z += 3, H[z] = V, H[z + 1] = Q, H[z + 2] = D + 1, z += 3;
                }
                T.faceidx += 6 * g;
              }
              y.drawCone = C;
              class b {
                constructor() {
                  this.cache = /* @__PURE__ */ new Map();
                }
                getVerticesForRadius(o, w) {
                  w = w || 2, this.cache.has(w) || this.cache.set(w, /* @__PURE__ */ new Map());
                  let p = this.cache.get(w);
                  if (p.has(o))
                    return p.get(o);
                  var v = {
                    vertices: [],
                    verticesRows: [],
                    normals: []
                  }, a = 16 * w, l = 10 * w;
                  o < 1 && (a = 10 * w, l = 8 * w);
                  var g = 0, M = Math.PI * 2, L = 0, T = Math.PI, D, I;
                  for (I = 0; I <= l; I++) {
                    let P = [];
                    for (D = 0; D <= a; D++) {
                      let B = D / a, F = I / l, N = -o * Math.cos(g + B * M) * Math.sin(L + F * T), $ = o * Math.cos(L + F * T), k = o * Math.sin(g + B * M) * Math.sin(L + F * T);
                      var z = new n.Vector3(N, $, k);
                      z.normalize(), v.vertices.push({ x: N, y: $, z: k }), v.normals.push(z), P.push(v.vertices.length - 1);
                    }
                    v.verticesRows.push(P);
                  }
                  return p.set(o, v), v;
                }
              }
              var A = new b();
              function S(s, o, w, p, v) {
                var a = A.getVerticesForRadius(w, v), l = a.vertices, g = a.normals, M = s.updateGeoGroup(l.length), L = M.vertices, T = M.vertexArray, D = M.colorArray, I = M.faceArray, z = M.lineArray, P = M.normalArray;
                for (let N = 0, $ = l.length; N < $; ++N) {
                  let k = 3 * (L + N), G = l[N];
                  T[k] = G.x + o.x, T[k + 1] = G.y + o.y, T[k + 2] = G.z + o.z, D[k] = p.r, D[k + 1] = p.g, D[k + 2] = p.b;
                }
                M.vertices += l.length;
                let B = a.verticesRows, F = B.length - 1;
                for (let N = 0; N < F; N++) {
                  let $ = B[N].length - 1;
                  for (let k = 0; k < $; k++) {
                    let G = M.faceidx, H = M.lineidx, U = B[N][k + 1] + L, V = U * 3, Q = B[N][k] + L, ae = Q * 3, oe = B[N + 1][k] + L, q = oe * 3, me = B[N + 1][k + 1] + L, ne = me * 3, fe = g[U - L], Ce = g[Q - L], Me = g[oe - L], Te = g[me - L];
                    Math.abs(l[U - L].y) === w ? (P[V] = fe.x, P[q] = Me.x, P[ne] = Te.x, P[V + 1] = fe.y, P[q + 1] = Me.y, P[ne + 1] = Te.y, P[V + 2] = fe.z, P[q + 2] = Me.z, P[ne + 2] = Te.z, I[G] = U, I[G + 1] = oe, I[G + 2] = me, z[H] = U, z[H + 1] = oe, z[H + 2] = U, z[H + 3] = me, z[H + 4] = oe, z[H + 5] = me, M.faceidx += 3, M.lineidx += 6) : Math.abs(l[oe - L].y) === w ? (P[V] = fe.x, P[ae] = Ce.x, P[q] = Me.x, P[V + 1] = fe.y, P[ae + 1] = Ce.y, P[q + 1] = Me.y, P[V + 2] = fe.z, P[ae + 2] = Ce.z, P[q + 2] = Me.z, I[G] = U, I[G + 1] = Q, I[G + 2] = oe, z[H] = U, z[H + 1] = Q, z[H + 2] = U, z[H + 3] = oe, z[H + 4] = Q, z[H + 5] = oe, M.faceidx += 3, M.lineidx += 6) : (P[V] = fe.x, P[ae] = Ce.x, P[ne] = Te.x, P[V + 1] = fe.y, P[ae + 1] = Ce.y, P[ne + 1] = Te.y, P[V + 2] = fe.z, P[ae + 2] = Ce.z, P[ne + 2] = Te.z, P[ae] = Ce.x, P[q] = Me.x, P[ne] = Te.x, P[ae + 1] = Ce.y, P[q + 1] = Me.y, P[ne + 1] = Te.y, P[ae + 2] = Ce.z, P[q + 2] = Me.z, P[ne + 2] = Te.z, I[G] = U, I[G + 1] = Q, I[G + 2] = me, I[G + 3] = Q, I[G + 4] = oe, I[G + 5] = me, z[H] = U, z[H + 1] = Q, z[H + 2] = U, z[H + 3] = me, z[H + 4] = Q, z[H + 5] = oe, z[H + 6] = oe, z[H + 7] = me, M.faceidx += 6, M.lineidx += 8);
                  }
                }
              }
              y.drawSphere = S;
            })(u || (u = {}));
          }
        ),
        /***/
        "./src/GLModel.ts": (
          /*!************************!*\
            !*** ./src/GLModel.ts ***!
            \************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLModel: () => (
                /* binding */
                o
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), u = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), y = t(
              /*! ./colors */
              "./src/colors.ts"
            ), h = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), _ = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), E = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), c = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), C = t(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), b = t(
              /*! netcdfjs */
              "./node_modules/netcdfjs/lib-esm/index.js"
            ), A = t(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            ), S = t(
              /*! ./parsers/utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function s(w) {
              let p;
              return typeof w == "string" ? p = new TextEncoder().encode(w) : p = new Uint8Array(w), (0, A.inflate)(p, {
                to: "string"
              });
            }
            class o {
              // class functions
              // return true if a and b represent the same style
              static sameObj(p, v) {
                return p && v ? JSON.stringify(p) == JSON.stringify(v) : p == v;
              }
              constructor(p, v) {
                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 u.Matrix4(), this.dontDuplicateAtoms = !0, this.defaultColor = y.elementColors.defaultColor, this.defaultStickRadius = 0.25, this.options = v || {}, this.ElementColors = this.options.defaultcolors ? this.options.defaultcolors : y.elementColors.defaultColors, this.defaultSphereRadius = this.options.defaultSphereRadius ? this.options.defaultSphereRadius : 1.5, this.defaultCartoonQuality = this.options.cartoonQuality ? this.options.cartoonQuality : 10, this.id = p;
              }
              // return proper radius for atom given style
              /**
               *
               * @param {AtomSpec} atom
               * @param {atomstyle} style
               * @return {number}
               *
               */
              getRadiusFromStyle(p, v) {
                var a = this.defaultSphereRadius;
                if (typeof v.radius < "u")
                  a = v.radius;
                else if (o.vdwRadii[p.elem])
                  a = o.vdwRadii[p.elem];
                else if (p.elem.length > 1) {
                  let l = p.elem;
                  l = l[0].toUpperCase() + l[1].toLowerCase(), o.vdwRadii[l] && (a = o.vdwRadii[l]);
                }
                return typeof v.scale < "u" && (a *= v.scale), a;
              }
              // cross drawing
              /**
               *
               * @param {AtomSpec} atom
               * @param {Record<number, Geometry>} geos
               */
              drawAtomCross(p, v) {
                if (p.style.cross) {
                  var a = p.style.cross;
                  if (!a.hidden) {
                    var l = a.linewidth || o.defaultlineWidth;
                    v[l] || (v[l] = new n.Geometry());
                    var g = v[l].updateGeoGroup(6), M = this.getRadiusFromStyle(p, a), L = [
                      [M, 0, 0],
                      [-M, 0, 0],
                      [0, M, 0],
                      [0, -M, 0],
                      [0, 0, M],
                      [0, 0, -M]
                    ], T = p.clickable || p.hoverable;
                    T && p.intersectionShape === void 0 && (p.intersectionShape = { sphere: [], cylinder: [], line: [] });
                    for (var D = (0, E.getColorFromStyle)(p, a), I = g.vertexArray, z = g.colorArray, P = 0; P < 6; P++) {
                      var B = g.vertices * 3;
                      if (g.vertices++, I[B] = p.x + L[P][0], I[B + 1] = p.y + L[P][1], I[B + 2] = p.z + L[P][2], z[B] = D.r, z[B + 1] = D.g, z[B + 2] = D.b, T) {
                        var F = new u.Vector3(L[P][0], L[P][1], L[P][2]);
                        F.multiplyScalar(0.1), F.set(F.x + p.x, F.y + p.y, F.z + p.z), p.intersectionShape.line.push(F);
                      }
                    }
                  }
                }
              }
              getGoodCross(p, v, a, l) {
                for (var g = null, M = -1, L = 0, T = p.bonds.length; L < T; L++)
                  if (p.bonds[L] != v.index) {
                    let I = p.bonds[L], z = this.atoms[I], B = new u.Vector3(z.x, z.y, z.z).clone();
                    B.sub(a);
                    let F = B.clone();
                    F.cross(l);
                    var D = F.lengthSq();
                    if (D > M && (M = D, g = F, M > 0.1))
                      return g;
                  }
                return g;
              }
              //from atom, return a normalized vector v that is orthogonal and along which
              //it is appropraite to draw multiple bonds
              getSideBondV(p, v, a) {
                var l, g, M, L, T, D = new u.Vector3(p.x, p.y, p.z), I = new u.Vector3(v.x, v.y, v.z), z = I.clone(), P = null;
                if (z.sub(D), p.bonds.length === 1)
                  v.bonds.length === 1 ? (P = z.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1) : (l = (a + 1) % v.bonds.length, g = v.bonds[l], M = this.atoms[g], L = new u.Vector3(M.x, M.y, M.z), T = L.clone(), T.sub(D), P = T.clone(), P.cross(z));
                else if (P = this.getGoodCross(p, v, D, z), P.lengthSq() < 0.01) {
                  var B = this.getGoodCross(v, p, D, z);
                  B != null && (P = B);
                }
                return P.lengthSq() < 0.01 && (P = z.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1), P.cross(z), P.normalize(), P;
              }
              addLine(p, v, a, l, g, M) {
                p[a] = l.x, p[a + 1] = l.y, p[a + 2] = l.z, v[a] = M.r, v[a + 1] = M.g, v[a + 2] = M.b, p[a + 3] = g.x, p[a + 4] = g.y, p[a + 5] = g.z, v[a + 3] = M.r, v[a + 4] = M.g, v[a + 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(p, v, a) {
                if (p.style.line) {
                  var l = p.style.line;
                  if (!l.hidden) {
                    var g, M, L, T, D = l.linewidth || o.defaultlineWidth;
                    a[D] || (a[D] = new n.Geometry());
                    for (var I = a[D].updateGeoGroup(6 * p.bonds.length), z = I.vertexArray, P = I.colorArray, B = 0; B < p.bonds.length; B++) {
                      var F = p.bonds[B], N = v[F];
                      if (N.style.line && !(p.index >= N.index)) {
                        var $ = new u.Vector3(p.x, p.y, p.z), k = new u.Vector3(N.x, N.y, N.z), G = $.clone().add(k).multiplyScalar(0.5), H = !1, U = p.clickable || p.hoverable, V = N.clickable || N.hoverable;
                        (U || V) && (U && (p.intersectionShape === void 0 && (p.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), p.intersectionShape.line.push($), p.intersectionShape.line.push(G)), V && (N.intersectionShape === void 0 && (N.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), N.intersectionShape.line.push(G), N.intersectionShape.line.push(k)));
                        var Q = (0, E.getColorFromStyle)(p, p.style.line), ae = (0, E.getColorFromStyle)(N, N.style.line);
                        if (p.bondStyles && p.bondStyles[B]) {
                          var oe = p.bondStyles[B];
                          if (!oe.iswire)
                            continue;
                          oe.singleBond && (H = !0), typeof oe.color1 < "u" && (Q = y.CC.color(oe.color1)), typeof oe.color2 < "u" && (ae = y.CC.color(oe.color2));
                        }
                        var q = I.vertices * 3, me, ne;
                        if (p.bondOrder[B] > 1 && p.bondOrder[B] < 4 && !H) {
                          var fe = this.getSideBondV(p, N, B), Ce = k.clone();
                          Ce.sub($), p.bondOrder[B] == 2 ? (fe.multiplyScalar(0.1), g = $.clone(), g.add(fe), M = $.clone(), M.sub(fe), L = g.clone(), L.add(Ce), T = M.clone(), T.add(Ce), Q == ae ? (I.vertices += 4, this.addLine(z, P, q, g, L, Q), this.addLine(z, P, q + 6, M, T, Q)) : (I.vertices += 8, Ce.multiplyScalar(0.5), me = g.clone(), me.add(Ce), ne = M.clone(), ne.add(Ce), this.addLine(z, P, q, g, me, Q), this.addLine(z, P, q + 6, me, L, ae), this.addLine(z, P, q + 12, M, ne, Q), this.addLine(z, P, q + 18, ne, T, ae))) : p.bondOrder[B] == 3 && (fe.multiplyScalar(0.1), g = $.clone(), g.add(fe), M = $.clone(), M.sub(fe), L = g.clone(), L.add(Ce), T = M.clone(), T.add(Ce), Q == ae ? (I.vertices += 6, this.addLine(z, P, q, $, k, Q), this.addLine(z, P, q + 6, g, L, Q), this.addLine(z, P, q + 12, M, T, Q)) : (I.vertices += 12, Ce.multiplyScalar(0.5), me = g.clone(), me.add(Ce), ne = M.clone(), ne.add(Ce), this.addLine(z, P, q, $, G, Q), this.addLine(z, P, q + 6, G, k, ae), this.addLine(z, P, q + 12, g, me, Q), this.addLine(z, P, q + 18, me, L, ae), this.addLine(z, P, q + 24, M, ne, Q), this.addLine(z, P, q + 30, ne, T, ae)));
                        } else
                          Q == ae ? (I.vertices += 2, this.addLine(z, P, q, $, k, Q)) : (I.vertices += 4, this.addLine(z, P, q, $, G, Q), this.addLine(z, P, q + 6, G, k, ae));
                      }
                    }
                  }
                }
              }
              //sphere drawing
              //See also: drawCylinder
              /**
               *
               * @param {AtomSpec} atom
               * @param {Geometry} geo
               */
              drawAtomSphere(p, v) {
                if (p.style.sphere) {
                  var a = p.style.sphere;
                  if (!a.hidden) {
                    var l = (0, E.getColorFromStyle)(p, a), g = this.getRadiusFromStyle(p, a);
                    if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) {
                      var M = new u.Vector3(p.x, p.y, p.z);
                      p.intersectionShape.sphere.push(new f.Sphere(M, g));
                    }
                    h.GLDraw.drawSphere(v, p, g, l);
                  }
                }
              }
              /** Register atom shaped click handlers */
              drawAtomClickSphere(p) {
                if (p.style.clicksphere) {
                  var v = p.style.clicksphere;
                  if (!v.hidden) {
                    var a = this.getRadiusFromStyle(p, v);
                    if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) {
                      var l = new u.Vector3(p.x, p.y, p.z);
                      p.intersectionShape.sphere.push(new f.Sphere(l, a));
                    }
                  }
                }
              }
              drawAtomInstanced(p, v) {
                if (p.style.sphere) {
                  var a = p.style.sphere;
                  if (!a.hidden) {
                    var l = this.getRadiusFromStyle(p, a), g = (0, E.getColorFromStyle)(p, a), M = v.updateGeoGroup(1), L = M.vertices, T = L * 3, D = M.vertexArray, I = M.colorArray, z = M.radiusArray;
                    if (D[T] = p.x, D[T + 1] = p.y, D[T + 2] = p.z, I[T] = g.r, I[T + 1] = g.g, I[T + 2] = g.b, z[L] = l, (p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) {
                      var P = new u.Vector3(p.x, p.y, p.z);
                      p.intersectionShape.sphere.push(new f.Sphere(P, l));
                    }
                    M.vertices += 1;
                  }
                }
              }
              drawSphereImposter(p, v, a, l) {
                var g = p.updateGeoGroup(4), M, L = g.vertices, T = L * 3, D = g.vertexArray, I = g.colorArray;
                for (M = 0; M < 4; M++)
                  D[T + 3 * M] = v.x, D[T + 3 * M + 1] = v.y, D[T + 3 * M + 2] = v.z;
                var z = g.normalArray;
                for (M = 0; M < 4; M++)
                  I[T + 3 * M] = l.r, I[T + 3 * M + 1] = l.g, I[T + 3 * M + 2] = l.b;
                z[T + 0] = -a, z[T + 1] = a, z[T + 2] = 0, z[T + 3] = -a, z[T + 4] = -a, z[T + 5] = 0, z[T + 6] = a, z[T + 7] = -a, z[T + 8] = 0, z[T + 9] = a, z[T + 10] = a, z[T + 11] = 0, g.vertices += 4;
                var P = g.faceArray, B = g.faceidx;
                P[B + 0] = L, P[B + 1] = L + 1, P[B + 2] = L + 2, P[B + 3] = L + 2, P[B + 4] = L + 3, P[B + 5] = L, g.faceidx += 6;
              }
              //dkoes -  code for sphere imposters
              drawAtomImposter(p, v) {
                if (p.style.sphere) {
                  var a = p.style.sphere;
                  if (!a.hidden) {
                    var l = this.getRadiusFromStyle(p, a), g = (0, E.getColorFromStyle)(p, a);
                    if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) {
                      var M = new u.Vector3(p.x, p.y, p.z);
                      p.intersectionShape.sphere.push(new f.Sphere(M, l));
                    }
                    this.drawSphereImposter(v, p, l, g);
                  }
                }
              }
              static drawStickImposter(p, v, a, l, g) {
                for (var M = p.updateGeoGroup(4), L = M.vertices, T = L * 3, D = M.vertexArray, I = M.colorArray, z = M.radiusArray, P = M.normalArray, B = g.r, F = g.g, N = g.b, $ = function(V) {
                  var Q = -V;
                  return Q == 0 && (Q = -1e-4), Q;
                }, k = T, G = 0; G < 4; G++)
                  D[k] = v.x, P[k] = a.x, I[k] = B, k++, D[k] = v.y, P[k] = a.y, I[k] = F, k++, D[k] = v.z, P[k] = a.z, G < 2 ? I[k] = N : I[k] = $(N), k++;
                M.vertices += 4, z[L] = -l, z[L + 1] = l, z[L + 2] = -l, z[L + 3] = l;
                var H = M.faceArray, U = M.faceidx;
                H[U + 0] = L, H[U + 1] = L + 1, H[U + 2] = L + 2, H[U + 3] = L + 2, H[U + 4] = L + 3, H[U + 5] = L, M.faceidx += 6;
              }
              // draws cylinders and small spheres (at bond radius)
              drawBondSticks(p, v, a) {
                if (p.style.stick) {
                  var l = p.style.stick;
                  if (!l.hidden) {
                    var g = l.radius || this.defaultStickRadius, M = l.doubleBondScaling || 0.4, L = l.tripleBondScaling || 0.25, T = g, D = l.singleBonds || !1, I = 0, z = 0, P, B, F, N, $, k, G, H, U, V, Q, ae = (0, E.getColorFromStyle)(p, l), oe, q, me;
                    !p.capDrawn && p.bonds.length < 4 && (I = 2);
                    var ne = h.GLDraw.drawCylinder;
                    for (a.imposter && (ne = o.drawStickImposter), F = 0; F < p.bonds.length; F++) {
                      var fe = p.bonds[F], Ce = v[fe];
                      if (oe = q = me = null, p.index < Ce.index) {
                        var Me = Ce.style;
                        if (!Me.stick || Me.stick.hidden)
                          continue;
                        var Te = (0, E.getColorFromStyle)(Ce, Me.stick);
                        if (T = g, N = D, p.bondStyles && p.bondStyles[F]) {
                          if ($ = p.bondStyles[F], $.iswire)
                            continue;
                          $.radius && (T = $.radius), $.singleBond && (N = !0), typeof $.color1 < "u" && (ae = y.CC.color($.color1)), typeof $.color2 < "u" && (Te = y.CC.color($.color2));
                        }
                        var se = new u.Vector3(p.x, p.y, p.z), pe = new u.Vector3(Ce.x, Ce.y, Ce.z);
                        if (p.bondOrder[F] <= 1 || N || p.bondOrder[F] > 3) {
                          if (p.bondOrder[F] < 1 && (T *= p.bondOrder[F]), !Ce.capDrawn && Ce.bonds.length < 4 && (z = 2), ae != Te ? (oe = new u.Vector3().addVectors(se, pe).multiplyScalar(0.5), ne(a, se, oe, T, ae, I, 0), ne(a, oe, pe, T, Te, 0, z)) : ne(a, se, pe, T, ae, I, z), P = p.clickable || p.hoverable, B = Ce.clickable || Ce.hoverable, P || B) {
                            if (oe || (oe = new u.Vector3().addVectors(se, pe).multiplyScalar(0.5)), P) {
                              var we = new f.Cylinder(se, oe, T), ke = new f.Sphere(se, T);
                              p.intersectionShape.cylinder.push(we), p.intersectionShape.sphere.push(ke);
                            }
                            if (B) {
                              var Ue = new f.Cylinder(pe, oe, T), Ne = new f.Sphere(pe, T);
                              Ce.intersectionShape.cylinder.push(Ue), Ce.intersectionShape.sphere.push(Ne);
                            }
                          }
                        } else if (p.bondOrder[F] > 1) {
                          var Be = 0, ue = 0;
                          T != g && (Be = 2, ue = 2);
                          var ye = pe.clone(), ge = null;
                          ye.sub(se);
                          var Se, ze, He, We, Y;
                          ge = this.getSideBondV(p, Ce, F), p.bondOrder[F] == 2 ? (Se = T * M, ge.multiplyScalar(Se * 1.5), ze = se.clone(), ze.add(ge), He = se.clone(), He.sub(ge), We = ze.clone(), We.add(ye), Y = He.clone(), Y.add(ye), ae != Te ? (oe = new u.Vector3().addVectors(ze, We).multiplyScalar(0.5), q = new u.Vector3().addVectors(He, Y).multiplyScalar(0.5), ne(a, ze, oe, Se, ae, Be, 0), ne(a, oe, We, Se, Te, 0, ue), ne(a, He, q, Se, ae, Be, 0), ne(a, q, Y, Se, Te, 0, ue)) : (ne(a, ze, We, Se, ae, Be, ue), ne(a, He, Y, Se, ae, Be, ue)), P = p.clickable || p.hoverable, B = Ce.clickable || Ce.hoverable, (P || B) && (oe || (oe = new u.Vector3().addVectors(ze, We).multiplyScalar(0.5)), q || (q = new u.Vector3().addVectors(He, Y).multiplyScalar(0.5)), P && (k = new f.Cylinder(ze, oe, Se), G = new f.Cylinder(He, q, Se), p.intersectionShape.cylinder.push(k), p.intersectionShape.cylinder.push(G)), B && (U = new f.Cylinder(We, oe, Se), V = new f.Cylinder(Y, q, Se), Ce.intersectionShape.cylinder.push(U), Ce.intersectionShape.cylinder.push(V)))) : p.bondOrder[F] == 3 && (Se = T * L, ge.cross(ye), ge.normalize(), ge.multiplyScalar(Se * 3), ze = se.clone(), ze.add(ge), He = se.clone(), He.sub(ge), We = ze.clone(), We.add(ye), Y = He.clone(), Y.add(ye), ae != Te ? (oe = new u.Vector3().addVectors(ze, We).multiplyScalar(0.5), q = new u.Vector3().addVectors(He, Y).multiplyScalar(0.5), me = new u.Vector3().addVectors(se, pe).multiplyScalar(0.5), ne(a, ze, oe, Se, ae, Be, 0), ne(a, oe, We, Se, Te, 0, ue), ne(a, se, me, Se, ae, I, 0), ne(a, me, pe, Se, Te, 0, z), ne(a, He, q, Se, ae, Be, 0), ne(a, q, Y, Se, Te, 0, ue)) : (ne(a, ze, We, Se, ae, Be, ue), ne(a, se, pe, Se, ae, I, z), ne(a, He, Y, Se, ae, Be, ue)), P = p.clickable || p.hoverable, B = Ce.clickable || Ce.hoverable, (P || B) && (oe || (oe = new u.Vector3().addVectors(ze, We).multiplyScalar(0.5)), q || (q = new u.Vector3().addVectors(He, Y).multiplyScalar(0.5)), me || (me = new u.Vector3().addVectors(se, pe).multiplyScalar(0.5)), P && (k = new f.Cylinder(ze.clone(), oe.clone(), Se), G = new f.Cylinder(He.clone(), q.clone(), Se), H = new f.Cylinder(se.clone(), me.clone(), Se), p.intersectionShape.cylinder.push(k), p.intersectionShape.cylinder.push(G), p.intersectionShape.cylinder.push(H)), B && (U = new f.Cylinder(We.clone(), oe.clone(), Se), V = new f.Cylinder(Y.clone(), q.clone(), Se), Q = new f.Cylinder(pe.clone(), me.clone(), Se), Ce.intersectionShape.cylinder.push(U), Ce.intersectionShape.cylinder.push(V), Ce.intersectionShape.cylinder.push(Q))));
                        }
                      }
                    }
                    var K = !1, ee = 0, de = !1;
                    for (F = 0; F < p.bonds.length; F++)
                      N = D, p.bondStyles && p.bondStyles[F] && ($ = p.bondStyles[F], $.singleBond && (N = !0), $.radius && $.radius != g && (de = !0)), (N || p.bondOrder[F] == 1) && ee++;
                    de ? ee > 0 && (K = !0) : ee == 0 && (p.bonds.length > 0 || l.showNonBonded) && (K = !0), K && (T = g, a.imposter ? this.drawSphereImposter(a.sphereGeometry, p, T, ae) : h.GLDraw.drawSphere(a, p, T, ae));
                  }
                }
              }
              // 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(p, v) {
                v = v || {};
                var a = new n.Object3D(), l = [], g = {}, M = {}, L = this.drawAtomSphere, T = null, D = null;
                v.supportsImposters ? (L = this.drawAtomImposter, T = new n.Geometry(!0), T.imposter = !0, D = new n.Geometry(!0, !0), D.imposter = !0, D.sphereGeometry = new n.Geometry(!0), D.sphereGeometry.imposter = !0, D.drawnCaps = {}) : v.supportsAIA ? (L = this.drawAtomInstanced, T = new n.Geometry(!1, !0, !0), T.instanced = !0, D = new n.Geometry(!0)) : (T = new n.Geometry(!0), D = new n.Geometry(!0));
                var I, z, P, B, F = {}, N = [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY];
                for (I = 0, P = p.length; I < P; I++) {
                  var $ = p[I];
                  if ($ && $.style) {
                    ($.clickable || $.hoverable) && $.intersectionShape === void 0 && ($.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), B = { line: void 0, cross: void 0, stick: void 0, sphere: void 0 };
                    for (z in B)
                      $.style[z] ? $.style[z].opacity ? B[z] = parseFloat($.style[z].opacity) : B[z] = 1 : B[z] = void 0, F[z] ? B[z] != null && F[z] != B[z] && (console.log("Warning: " + z + " opacity is ambiguous"), F[z] = 1) : F[z] = B[z];
                    L.call(this, $, T), this.drawAtomClickSphere($), this.drawAtomCross($, M), this.drawBondLines($, p, g), this.drawBondSticks($, p, D), typeof $.style.cartoon < "u" && !$.style.cartoon.hidden && ($.style.cartoon.color === "spectrum" && typeof $.resi == "number" && !$.hetflag && ($.resi < N[0] && (N[0] = $.resi), $.resi > N[1] && (N[1] = $.resi)), l.push($));
                  }
                }
                if (l.length > 0 && (0, _.drawCartoon)(a, l, N, this.defaultCartoonQuality), T && T.vertices > 0) {
                  T.initTypedArrays();
                  var k = null, G = null;
                  T.imposter ? k = new n.SphereImposterMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }) : T.instanced ? (G = new n.Geometry(!0), h.GLDraw.drawSphere(G, { x: 0, y: 0, z: 0 }, 1, new y.Color(0.5, 0.5, 0.5)), G.initTypedArrays(), k = new n.InstancedMaterial({
                    sphereMaterial: new n.MeshLambertMaterial({
                      ambient: 0,
                      vertexColors: !0,
                      reflectivity: 0
                    }),
                    sphere: G
                  })) : k = new n.MeshLambertMaterial({
                    ambient: 0,
                    vertexColors: !0,
                    reflectivity: 0
                  }), F.sphere < 1 && F.sphere >= 0 && (k.transparent = !0, k.opacity = F.sphere), G = new n.Mesh(T, k), a.add(G);
                }
                if (D.vertices > 0) {
                  var H = null, U = null, V = D.sphereGeometry;
                  (!V || typeof V.vertices > "u" || V.vertices == 0) && (V = null), D.initTypedArrays(), V && V.initTypedArrays();
                  var Q = { ambient: 0, vertexColors: !0, reflectivity: 0 };
                  D.imposter ? (H = new n.StickImposterMaterial(Q), U = new n.SphereImposterMaterial(Q)) : (H = new n.MeshLambertMaterial(Q), U = new n.MeshLambertMaterial(Q), H.wireframe && (D.setUpWireframe(), V && V.setUpWireframe())), F.stick < 1 && F.stick >= 0 && (H.transparent = !0, H.opacity = F.stick, U.transparent = !0, U.opacity = F.stick);
                  var ae = new n.Mesh(D, H);
                  if (a.add(ae), V) {
                    var oe = new n.Mesh(V, U);
                    a.add(oe);
                  }
                }
                var q;
                for (I in g)
                  if (g.hasOwnProperty(I)) {
                    q = I;
                    var me = new n.LineBasicMaterial({
                      linewidth: q,
                      vertexColors: !0
                    });
                    F.line < 1 && F.line >= 0 && (me.transparent = !0, me.opacity = F.line), g[I].initTypedArrays();
                    var ne = new n.Line(g[I], me, n.LineStyle.LinePieces);
                    a.add(ne);
                  }
                for (I in M)
                  if (M.hasOwnProperty(I)) {
                    q = I;
                    var fe = new n.LineBasicMaterial({
                      linewidth: q,
                      vertexColors: !0
                    });
                    F.cross < 1 && F.cross >= 0 && (fe.transparent = !0, fe.opacity = F.cross), M[I].initTypedArrays();
                    var Ce = new n.Line(M[I], fe, n.LineStyle.LinePieces);
                    a.add(Ce);
                  }
                if (this.dontDuplicateAtoms && this.modelData.symmetries && this.modelData.symmetries.length > 0) {
                  var Me = new n.Object3D(), Te;
                  for (Te = 0; Te < this.modelData.symmetries.length; Te++) {
                    var se = new n.Object3D();
                    se = a.clone(), se.matrix.copy(this.modelData.symmetries[Te]), se.matrixAutoUpdate = !1, Me.add(se);
                  }
                  return Me;
                }
                return a;
              }
              /**
               * 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(p) {
                this.atoms = p.atoms, this.frames = p.frames, this.molObj = null;
              }
              /**
               * Returns crystallographic information if present.
               *
               *
               */
              getCrystData() {
                if (this.modelData.cryst) {
                  if (!this.modelData.cryst.matrix) {
                    const p = this.modelData.cryst;
                    this.modelData.cryst.matrix = (0, u.conversionMatrix3)(p.a, p.b, p.c, p.alpha, p.beta, p.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(p, v, a, l, g, M) {
                p = p || 1, v = v || 1, a = a || 1, l = l || 90, g = g || 90, M = M || 90;
                const L = (0, u.conversionMatrix3)(p, v, a, l, g, M);
                this.modelData.cryst = {
                  a: p,
                  b: v,
                  c: a,
                  alpha: l,
                  beta: g,
                  gamma: M,
                  matrix: L
                };
              }
              /**
               * 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(p) {
                p = p || new u.Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), this.modelData.cryst = {
                  matrix: p
                };
              }
              /**
               * 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(p) {
                typeof p > "u" ? this.modelData.symmetries = [this.idMatrix] : this.modelData.symmetries = p;
              }
              /**
               * 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(p, v, a, l) {
                var g = v - p;
                return g < -a ? v + l : g > a ? v - l : v;
              }
              //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 p = this.box[0], v = this.box[1], a = this.box[2], l = p * 0.9, g = v * 0.9, M = a * 0.9, L = 0; L < this.atomdfs.length; L++)
                    for (var T = this.atomdfs[L], D = 1; D < T.length; D++) {
                      var I = this.atoms[T[D][0]], z = this.atoms[T[D][1]];
                      I.x = this.adjustCoord(z.x, I.x, l, p), I.y = this.adjustCoord(z.y, I.y, g, v), I.z = this.adjustCoord(z.z, I.z, M, a);
                    }
              }
              /**
               * 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(p, v) {
                var a = this.getNumFrames();
                let l = this;
                return new Promise(function(g, M) {
                  if (a == 0 && g(), (p < 0 || p >= a) && (p = a - 1), l.frames.url != null) {
                    var L = l.frames.url;
                    (0, E.getbin)(L + "/traj/frame/" + p + "/" + l.frames.path, void 0, "POST", void 0).then(function(T) {
                      for (var D = new Float32Array(T, 44), I = 0, z = 0; z < l.atoms.length; z++)
                        l.atoms[z].x = D[I++], l.atoms[z].y = D[I++], l.atoms[z].z = D[I++];
                      l.box && l.atomdfs && l.adjustCoordinatesToBox(), g();
                    }).catch(M);
                  } else
                    l.atoms = l.frames[p], g();
                  l.molObj = null, l.modelDatas && p < l.modelDatas.length && (l.modelData = l.modelDatas[p], l.unitCellObjects && v && (v.removeUnitCell(l), v.addUnitCell(l)));
                });
              }
              /**
               * Add atoms as frames of model
               *
               * @param {AtomSpec[]} atoms - atoms to be added
               */
              addFrame(p) {
                this.frames.push(p);
              }
              /**
              	     * 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(p = 10, v = 1, a = !1, l, g) {
                var M = 0, L = p;
                a && (M = -p, L = p), this.frames !== void 0 && this.frames.origIndex !== void 0 ? this.setFrame(this.frames.origIndex) : this.setFrame(0), M < L && (this.frames = []), a && (this.frames.origIndex = p);
                for (var T = M; T < L; T++) {
                  var D = [], I = this.frames.length;
                  if (T == 0 && !g) {
                    this.frames.push(this.atoms);
                    continue;
                  }
                  for (var z = 0; z < this.atoms.length; z++) {
                    var P = (0, E.getAtomProperty)(this.atoms[z], "dx"), B = (0, E.getAtomProperty)(this.atoms[z], "dy"), F = (0, E.getAtomProperty)(this.atoms[z], "dz"), N = new u.Vector3(P, B, F), $ = new u.Vector3(this.atoms[z].x, this.atoms[z].y, this.atoms[z].z), k = T * v / p;
                    N.multiplyScalar(k), $.add(N);
                    var G = {};
                    for (var H in this.atoms[z])
                      G[H] = this.atoms[z][H];
                    if (G.x = $.x, G.y = $.y, G.z = $.z, D.push(G), l && g) {
                      var U = (0, E.extend)({}, g), V = new u.Vector3(P, B, F);
                      if (V.multiplyScalar(v), V.add($), U.start = $, U.end = V, U.frame = I, !U.color) {
                        var Q = G.style.sphere;
                        Q || (Q = G.style.stick), Q || (Q = G.style.line), U.color = (0, E.getColorFromStyle)(G, Q);
                      }
                      l.addArrow(U);
                    }
                  }
                  this.frames.push(D);
                }
              }
              // set default style and colors for atoms
              setAtomDefaults(p) {
                for (let v = 0; v < p.length; v++) {
                  let a = p[v];
                  a && (a.style = a.style || (0, E.deepCopy)(o.defaultAtomStyle), a.color = a.color || this.ElementColors[a.elem] || this.defaultColor, a.model = this.id, (a.clickable || a.hoverable) && (a.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(p, v, a = {}) {
                var l = o.parseMolData(p, v, a);
                this.dontDuplicateAtoms = !a.duplicateAssemblyAtoms;
                var g = l.modelData;
                if (g && (Array.isArray(g) ? (this.modelData = g[0], a.frames && (this.modelDatas = g)) : this.modelData = g), l.box ? this.box = l.box : this.box = null, this.frames.length == 0) {
                  for (let L = 0; L < l.length; L++)
                    l[L].length != 0 && this.frames.push(l[L]);
                  this.frames[0] && (this.atoms = this.frames[0]);
                } else if (a.frames)
                  for (let L = 0; L < l.length; L++)
                    this.frames.push(l[L]);
                else
                  for (var M = 0; M < l.length; M++)
                    this.addAtoms(l[M]);
                for (let L = 0; L < this.frames.length; L++)
                  this.setAtomDefaults(this.frames[L]);
                a.vibrate && a.vibrate.frames && a.vibrate.amplitude && this.vibrate(a.vibrate.frames, a.vibrate.amplitude), a.style && this.setStyle({}, a.style);
              }
              setDontDuplicateAtoms(p) {
                this.dontDuplicateAtoms = p;
              }
              setModelData(p) {
                this.modelData = p;
              }
              //return true if atom value matches property val
              propertyMatches(p, v) {
                if (p == v)
                  return !0;
                if (typeof v == "string" && typeof p == "number") {
                  var a = v.match(/(-?\d+)\s*-\s*(-?\d+)/);
                  if (a) {
                    var l = parseInt(a[1]), g = parseInt(a[2]);
                    if (a && p >= l && p <= g)
                      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(p, v) {
                if (typeof p != "object" || p == null || p.__cache_created)
                  return p;
                const a = {};
                for (const l in p) {
                  const g = p[l];
                  if (Array.isArray(g)) {
                    a[l] = [];
                    for (let M = 0; M < g.length; M++)
                      a[l].push(o.deepCopyAndCache(g[M], v));
                  } else
                    typeof g == "object" && l != "properties" && l != "model" ? a[l] = o.deepCopyAndCache(g, v) : a[l] = g;
                  if (l == "and" || l == "or") {
                    const M = [];
                    for (const L of a[l]) {
                      const T = /* @__PURE__ */ new Set();
                      for (const D of v.selectedAtoms(L))
                        T.add(D.index);
                      M.push(T);
                    }
                    if (l == "and") {
                      const L = function(D, I) {
                        const z = /* @__PURE__ */ new Set();
                        for (const P of I)
                          D.has(P) && z.add(P);
                        return z;
                      };
                      let T = new Set(M[0]);
                      for (const D of M.splice(1))
                        T = L(T, D);
                      a[l].__cached_results = T;
                    } else if (l == "or") {
                      const L = /* @__PURE__ */ new Set();
                      for (const T of M)
                        for (const D of T)
                          L.add(D);
                      a[l].__cached_results = L;
                    }
                  }
                }
                return a.__cache_created = !0, a;
              }
              /** 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(p, v) {
                if (typeof v > "u")
                  return !0;
                var a = !!v.invert, l = !0;
                for (var g in v)
                  if (g == "and" || g == "or" || g == "not") {
                    if (g == "not") {
                      if (this.atomIsSelected(p, v[g])) {
                        l = !1;
                        break;
                      }
                    } else if (v[g].__cached_results === void 0 && (v = o.deepCopyAndCache(v, this)), l = v[g].__cached_results.has(p.index), !l)
                      break;
                  } else if (g === "predicate") {
                    if (!v.predicate(p)) {
                      l = !1;
                      break;
                    }
                  } else if (g == "properties" && p[g]) {
                    for (var M in v.properties)
                      if (!M.startsWith("__cache")) {
                        if (typeof p.properties[M] > "u") {
                          l = !1;
                          break;
                        }
                        if (p.properties[M] != v.properties[M]) {
                          l = !1;
                          break;
                        }
                      }
                  } else if (v.hasOwnProperty(g) && !o.ignoredKeys.has(g) && !g.startsWith("__cache")) {
                    if (typeof p[g] > "u") {
                      l = !1;
                      break;
                    }
                    var L = !1;
                    if (g === "bonds") {
                      var T = v[g];
                      if (T != p.bonds.length) {
                        l = !1;
                        break;
                      }
                    } else if (Array.isArray(v[g])) {
                      var D = v[g], I = p[g];
                      for (let z = 0; z < D.length; z++)
                        if (this.propertyMatches(I, D[z])) {
                          L = !0;
                          break;
                        }
                      if (!L) {
                        l = !1;
                        break;
                      }
                    } else {
                      let z = v[g];
                      if (!this.propertyMatches(p[g], z)) {
                        l = !1;
                        break;
                      }
                    }
                  }
                return a ? !l : l;
              }
              static squaredDistance(p, v) {
                var a = v.x - p.x, l = v.y - p.y, g = v.z - p.z;
                return a * a + l * l + g * g;
              }
              /** 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(p, v) {
                if (v <= 0)
                  return p;
                for (var a = (0, E.getExtent)(p, void 0), l = [[], [], []], g = 0; g < 3; g++)
                  l[0][g] = a[0][g] - v, l[1][g] = a[1][g] + v, l[2][g] = a[2][g];
                var M = [];
                for (let I = 0; I < this.atoms.length; I++) {
                  var L = this.atoms[I].x, T = this.atoms[I].y, D = this.atoms[I].z;
                  L >= l[0][0] && L <= l[1][0] && T >= l[0][1] && T <= l[1][1] && D >= l[0][2] && D <= l[1][2] && (L >= a[0][0] && L <= a[1][0] && T >= a[0][1] && T <= a[1][1] && D >= a[0][2] && D <= a[1][2] || M.push(this.atoms[I]));
                }
                return M;
              }
              static getFloat(p) {
                return typeof p == "number" ? p : parseFloat(p);
              }
              /** 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(p, v) {
                var a = [];
                p = o.deepCopyAndCache(p || {}, this), v || (v = this.atoms);
                for (var l = v.length, g = 0; g < l; g++) {
                  var M = v[g];
                  M && this.atomIsSelected(M, p) && a.push(M);
                }
                if (p.hasOwnProperty("expand")) {
                  const G = o.getFloat(p.expand);
                  let H = this.expandAtomList(a, G), U = a.length;
                  const V = G * G;
                  for (let Q = 0; Q < H.length; Q++)
                    for (let ae = 0; ae < U; ae++) {
                      var L = o.squaredDistance(H[Q], a[ae]);
                      L < V && L > 0 && a.push(H[Q]);
                    }
                }
                if (p.hasOwnProperty("within") && p.within.hasOwnProperty("sel") && p.within.hasOwnProperty("distance")) {
                  var T = this.selectedAtoms(p.within.sel, this.atoms), D = {};
                  const G = o.getFloat(p.within.distance), H = G * G;
                  for (let U = 0; U < T.length; U++)
                    for (let V = 0; V < a.length; V++) {
                      let Q = o.squaredDistance(T[U], a[V]);
                      Q < H && Q > 0 && (D[V] = 1);
                    }
                  var I = [];
                  if (p.within.invert)
                    for (let U = 0; U < a.length; U++)
                      D[U] || I.push(a[U]);
                  else
                    for (let U in D)
                      I.push(a[U]);
                  a = I;
                }
                if (p.hasOwnProperty("byres")) {
                  var z = {}, P = [], B = [];
                  for (let G = 0; G < a.length; G++) {
                    let H = a[G];
                    var F = H.chain, N = H.resi;
                    if (z[F] === void 0 && (z[F] = {}), H.hasOwnProperty("resi") && z[F][N] === void 0) {
                      for (z[F][N] = !0, B.push(H); B.length > 0; )
                        if (H = B.pop(), F = H.chain, N = H.resi, P[H.index] === void 0) {
                          P[H.index] = !0;
                          for (var $ = 0; $ < H.bonds.length; $++) {
                            var k = this.atoms[H.bonds[$]];
                            P[k.index] === void 0 && k.hasOwnProperty("resi") && k.chain == F && k.resi == N && (B.push(k), a.push(k));
                          }
                        }
                    }
                  }
                }
                return a;
              }
              /** 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(p) {
                this.molObj = null;
                var v = this.atoms.length, a = [], l;
                for (l = 0; l < p.length; l++)
                  typeof p[l].index > "u" && (p[l].index = l), typeof p[l].serial > "u" && (p[l].serial = l), a[p[l].index] = v + l;
                for (l = 0; l < p.length; l++) {
                  var g = p[l], M = a[g.index], L = (0, E.extend)({}, g);
                  L.index = M, L.bonds = [], L.bondOrder = [], L.model = this.id, L.style = L.style || (0, E.deepCopy)(o.defaultAtomStyle), typeof L.color > "u" && (L.color = this.ElementColors[L.elem] || this.defaultColor);
                  for (var T = g.bonds ? g.bonds.length : 0, D = 0; D < T; D++) {
                    var I = a[g.bonds[D]];
                    typeof I < "u" && (L.bonds.push(I), L.bondOrder.push(g.bondOrder ? g.bondOrder[D] : 1));
                  }
                  this.atoms.push(L);
                }
              }
              /** 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, S.assignBonds)(this.atoms);
              }
              /** Remove specified atoms from model
               *
               * @param {AtomSpec[]} badatoms - list of atoms
               */
              removeAtoms(p) {
                this.molObj = null;
                var v = [], a;
                for (a = 0; a < p.length; a++)
                  v[p[a].index] = !0;
                var l = [];
                for (a = 0; a < this.atoms.length; a++) {
                  var g = this.atoms[a];
                  v[g.index] || l.push(g);
                }
                this.atoms = [], this.addAtoms(l);
              }
              /** 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(p, v, a) {
                typeof v > "u" && typeof a > "u" && (v = p, p = {}), p = p, typeof v == "string" && (v = (0, E.specStringToObject)(v));
                var l = !1, g = this, M = function(T) {
                  var D = g.selectedAtoms(p, T);
                  for (let I = 0; I < T.length; I++)
                    T[I] && (T[I].capDrawn = !1);
                  for (let I = 0; I < D.length; I++) {
                    l = !0, (D[I].clickable || D[I].hoverable) && (D[I].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), a || (D[I].style = {});
                    for (let z in v)
                      v.hasOwnProperty(z) && (D[I].style[z] = D[I].style[z] || {}, Object.assign(D[I].style[z], v[z]));
                  }
                };
                if (p.frame !== void 0 && p.frame < this.frames.length) {
                  let T = p.frame;
                  T < 0 && (T = this.frames.length + T), M(this.frames[T]);
                } else {
                  M(this.atoms);
                  for (var L = 0; L < this.frames.length; L++)
                    this.frames[L] !== this.atoms && M(this.frames[L]);
                }
                l && (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(p, v, a) {
                if (v = !!v, a = (0, E.makeFunction)(a), a === null) {
                  console.log("Callback is not a function");
                  return;
                }
                var l = this.selectedAtoms(p, this.atoms), g = l.length;
                for (let M = 0; M < g; M++)
                  l[M].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, l[M].clickable = v, a && (l[M].callback = a);
                g > 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(p, v, a, l) {
                if (v = !!v, a = (0, E.makeFunction)(a), l = (0, E.makeFunction)(l), a === null) {
                  console.log("Hover_callback is not a function");
                  return;
                }
                if (l === null) {
                  console.log("Unhover_callback is not a function");
                  return;
                }
                var g = this.selectedAtoms(p, this.atoms), M = g.length;
                for (let L = 0; L < M; L++)
                  g[L].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, g[L].hoverable = v, a && (g[L].hover_callback = a), l && (g[L].unhover_callback = l);
                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(p, v) {
                v = !!v;
                var a, l = this.selectedAtoms(p, this.atoms), g = l.length;
                for (a = 0; a < g; a++)
                  l[a].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, l[a].contextMenuEnabled = v;
                g > 0 && (this.molObj = null);
              }
              /** given a mapping from element to color, set atom colors
               *
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(p, v) {
                if (!(this.molObj !== null && o.sameObj(v, this.lastColors))) {
                  this.lastColors = v;
                  var a = this.selectedAtoms(p, a);
                  a.length > 0 && (this.molObj = null);
                  for (var l = 0; l < a.length; l++) {
                    var g = a[l];
                    typeof v[g.elem] < "u" && (g.color = v[g.elem]);
                  }
                }
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               */
              setColorByProperty(p, v, a, l) {
                var g, M, L = this.selectedAtoms(p, L);
                for (this.lastColors = null, L.length > 0 && (this.molObj = null), typeof a == "string" && typeof c.Gradient.builtinGradients[a] < "u" && (a = new c.Gradient.builtinGradients[a]()), a = a, l || (l = a.range()), l || (l = (0, E.getPropertyRange)(L, v)), g = 0; g < L.length; g++) {
                  M = L[g];
                  var T = (0, E.getAtomProperty)(M, v);
                  T != null && (M.color = a.valueToHex(parseFloat(M.properties[v]), l));
                }
              }
              /**
              	     * @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(p, v) {
                var a = this.selectedAtoms(p, a);
                if (typeof v == "function") {
                  this.lastColors = null, a.length > 0 && (this.molObj = null);
                  for (let l = 0; l < a.length; l++) {
                    let g = a[l];
                    g.color = v(g);
                  }
                }
              }
              /** 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(p = !1) {
                var v = { a: [], b: [] };
                p && (v.s = []);
                for (let l = 0; l < this.atoms.length; l++) {
                  let g = {}, M = this.atoms[l];
                  if (g.x = M.x, g.y = M.y, g.z = M.z, M.elem != "C" && (g.l = M.elem), p) {
                    for (var a = 0; a < v.s.length && JSON.stringify(M.style) !== JSON.stringify(v.s[a]); )
                      a++;
                    a === v.s.length && v.s.push(M.style), a !== 0 && (g.s = a);
                  }
                  v.a.push(g);
                  for (let L = 0; L < M.bonds.length; L++) {
                    let T = l, D = M.bonds[L];
                    if (T >= D)
                      continue;
                    let I = {
                      b: T,
                      e: D
                    }, z = M.bondOrder[L];
                    z != 1 && (I.o = z), v.b.push(I);
                  }
                }
                return v;
              }
              /** 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(p, v) {
                (this.molObj === null || v.regen) && (this.molObj = this.createMolObj(this.atoms, v), this.renderedMolObj && (p.remove(this.renderedMolObj), this.renderedMolObj = null), this.renderedMolObj = this.molObj.clone(), this.hidden && (this.renderedMolObj.setVisible(!1), this.molObj.setVisible(!1)), p.add(this.renderedMolObj));
              }
              /** return a VRML string representation of the model.  Does not include VRML header information
               * @return VRML
               */
              exportVRML() {
                var p = this.createMolObj(this.atoms, { supportsImposters: !1, supportsAIA: !1 });
                return p.vrml();
              }
              /** Remove any renderable mol object from scene
               *
               * @param {Object3D} group
               */
              removegl(p) {
                this.renderedMolObj && (this.renderedMolObj.geometry !== void 0 && this.renderedMolObj.geometry.dispose(), this.renderedMolObj.material !== void 0 && this.renderedMolObj.material.dispose(), p.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(p, v, a, l) {
                for (var g = this.selectedAtoms(v, g), M = (0, E.deepCopy)(l), L = 0; L < g.length; L++) {
                  var T = g[L], D = null;
                  typeof T[p] < "u" ? D = String(T[p]) : typeof T.properties[p] < "u" && (D = String(T.properties[p])), D != null && (M.position = T, a.addLabel(D, 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(p, v, a, l = !1) {
                var g = [], M = function(T, D) {
                  for (var I = T.selectedAtoms(p, I), z = {}, P = 0; P < I.length; P++) {
                    var B = I[P], F = B.chain, N = B.resn, $ = B.resi, k = N + "" + $;
                    z[F] || (z[F] = {}), z[F][k] || (z[F][k] = []), z[F][k].push(B);
                  }
                  var G = (0, E.deepCopy)(a);
                  for (let U in z)
                    if (z.hasOwnProperty(U)) {
                      var H = z[U];
                      for (let V in H)
                        if (H.hasOwnProperty(V)) {
                          let Q = H[V], ae = new u.Vector3(0, 0, 0);
                          for (let q = 0; q < Q.length; q++) {
                            let me = Q[q];
                            ae.x += me.x, ae.y += me.y, ae.z += me.z;
                          }
                          ae.divideScalar(Q.length), G.position = ae, G.frame = D;
                          let oe = v.addLabel(V, G, void 0, !0);
                          g.push(oe);
                        }
                    }
                };
                if (l) {
                  var L = this.getNumFrames();
                  let T = this.atoms;
                  for (let D = 0; D < L; D++)
                    this.frames[D] && (this.atoms = this.frames[D], M(this, D));
                  this.atoms = T;
                } else
                  M(this);
                return g;
              }
              //recurse over the current atoms to establish a depth first order
              setupDFS() {
                this.atomdfs = [];
                var p = this, v = new Int8Array(this.atoms.length);
                v.fill(0);
                for (var a = function(L, T, D) {
                  D.push([L, T]);
                  var I = p.atoms[L];
                  v[L] = 1;
                  for (var z = 0; z < I.bonds.length; z++) {
                    var P = I.bonds[z];
                    p.atoms[P] && !v[P] && a(P, L, D);
                  }
                }, l = 0; l < this.atoms.length; l++) {
                  var g = this.atoms[l];
                  if (g && !v[l]) {
                    var M = [];
                    a(l, -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(p, v) {
                this.frames = [];
                var a = this;
                return this.box && this.setupDFS(), p.startsWith("http") || (p = "http://" + p), (0, E.get)(p + "/traj/numframes/" + v, function(l) {
                  if (!isNaN(parseInt(l)))
                    return a.frames.push(a.atoms), a.frames.numFrames = l, a.frames.url = p, a.frames.path = v, a.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(p, v) {
                if (v = v || "", !p)
                  return [];
                if (/\.gz$/.test(v)) {
                  v = v.replace(/\.gz$/, "");
                  try {
                    p = s(p);
                  } catch (z) {
                    console.log(z);
                  }
                }
                var a = { mdcrd: "", inpcrd: "", pdb: "", netcdf: "", array: "" };
                if (a.hasOwnProperty(v)) {
                  this.frames = [];
                  for (var l = this.atoms.length, g = o.parseCrd(p, v), M = 0; M < g.length; ) {
                    for (var L = [], T = 0; T < l; T++) {
                      var D = {};
                      for (var I in this.atoms[T])
                        D[I] = this.atoms[T][I];
                      L[T] = D, L[T].x = g[M++], L[T].y = g[M++], L[T].z = g[M++];
                    }
                    this.frames.push(L);
                  }
                  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(p) {
              }
              static parseCrd(p, v) {
                var a = [], l = 0;
                if (v == "pdb")
                  for (var g = p.indexOf(`
ATOM`); g != -1; ) {
                    for (; p.slice(g, g + 5) == `
ATOM` || p.slice(g, g + 7) == `
HETATM`; )
                      a[l++] = parseFloat(p.slice(g + 31, g + 39)), a[l++] = parseFloat(p.slice(g + 39, g + 47)), a[l++] = parseFloat(p.slice(g + 47, g + 55)), g = p.indexOf(`
`, g + 54), p.slice(g, g + 4) == `
TER` && (g = p.indexOf(`
`, g + 5));
                    g = p.indexOf(`
ATOM`, g);
                  }
                else if (v == "netcdf") {
                  var M = new b.NetCDFReader(p);
                  a = [].concat.apply([], M.getDataVariable("coordinates"));
                } else {
                  if (v == "array" || Array.isArray(p))
                    return p.flat(2);
                  {
                    let L = p.indexOf(`
`);
                    v == "inpcrd" && (L = p.indexOf(`
`, L + 1)), p = p.slice(L + 1), a = p.match(/\S+/g).map(parseFloat);
                  }
                }
                return a;
              }
              static parseMolData(p, v = "", a) {
                if (!p)
                  return [];
                if (/\.gz$/.test(v)) {
                  v = v.replace(/\.gz$/, "");
                  try {
                    p = s(p);
                  } catch (M) {
                    console.log(M);
                  }
                }
                typeof C.Parsers[v] > "u" && (v = v.split(".").pop(), typeof C.Parsers[v] > "u" && (console.log("Unknown format: " + v), p instanceof Uint8Array ? v = "mmtf" : p.match(/^@<TRIPOS>MOLECULE/gm) ? v = "mol2" : p.match(/^data_/gm) && p.match(/^loop_/gm) ? v = "cif" : p.match(/^HETATM/gm) || p.match(/^ATOM/gm) ? v = "pdb" : p.match(/ITEM: TIMESTEP/gm) ? v = "lammpstrj" : p.match(/^.*\n.*\n.\s*(\d+)\s+(\d+)/gm) ? v = "sdf" : p.match(/^%VERSION\s+VERSION_STAMP/gm) ? v = "prmtop" : v = "xyz", console.log("Best guess: " + v)));
                var l = C.Parsers[v], g = l(p, a);
                return g;
              }
            }
            o.defaultAtomStyle = {
              line: {}
            }, o.defaultlineWidth = 1, o.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
            }, o.ignoredKeys = /* @__PURE__ */ new Set(["props", "invert", "model", "frame", "byres", "expand", "within", "and", "or", "not"]);
          }
        ),
        /***/
        "./src/GLShape.ts": (
          /*!************************!*\
            !*** ./src/GLShape.ts ***!
            \************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLShape: () => (
                /* binding */
                b
              ),
              /* harmony export */
              splitMesh: () => (
                /* binding */
                A
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), u = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), y = t(
              /*! ./colors */
              "./src/colors.ts"
            ), h = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), _ = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), E = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), c = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), C = t(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            class b {
              static finalizeGeo(s) {
                var o = s.updateGeoGroup(0);
                o.vertices > 0 && o.truncateArrayBuffers(!0, !0);
              }
              /*
               *
               * @param {Geometry}
               *            geo
               * @param {Color | colorlike} color
               */
              static updateColor(s, o) {
                o = o || y.CC.color(o), s.colorsNeedUpdate = !0;
                var w, p, v;
                o.constructor !== Array && (w = o.r, p = o.g, v = o.b);
                for (let a in s.geometryGroups) {
                  let l = s.geometryGroups[a], g = l.colorArray;
                  for (let M = 0, L = l.vertices; M < L; ++M) {
                    if (o.constructor === Array) {
                      let T = o[M];
                      w = T.r, p = T.g, v = T.b;
                    }
                    g[M * 3] = w, g[M * 3 + 1] = p, g[M * 3 + 2] = v;
                  }
                }
              }
              /*
               * @param {GLShape}
               *            shape
               * @param {geometryGroup}
               *            geoGroup
               * @param {ArrowSpec}
               *            spec
               */
              static drawArrow(s, o, w) {
                var p = w.start, v = w.end, a = w.radius, l = w.radiusRatio, g = w.mid, M = w.midpos;
                if (!(p && v))
                  return;
                var L = o.updateGeoGroup(51), T = new u.Vector3(v.x, v.y, v.z).sub(p);
                if (M) {
                  let he = T.length();
                  M > 0 ? g = M / he : g = (he + M) / he;
                }
                T.multiplyScalar(g);
                var D = new u.Vector3(p.x, p.y, p.z).add(T), I = T.clone().negate();
                let z = new u.Vector3(p.x, p.y, p.z);
                s.intersectionShape.cylinder.push(new f.Cylinder(z, D.clone(), a)), s.intersectionShape.sphere.push(new f.Sphere(z, a));
                var P = [];
                P[0] = T.clone(), Math.abs(P[0].x) > 1e-4 ? P[0].y += 1 : P[0].x += 1, P[0].cross(T), P[0].normalize(), P[4] = P[0].clone(), P[4].crossVectors(P[0], T), 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 = L.vertices, F = L.vertexArray, N = L.faceArray, $ = L.normalArray, k = L.lineArray, G, H, U;
                for (H = 0, U = P.length; H < U; ++H) {
                  G = 3 * (B + 3 * H);
                  var V = P[H].clone().multiplyScalar(a).add(p), Q = P[H].clone().multiplyScalar(a).add(D), ae = P[H].clone().multiplyScalar(a * l).add(D);
                  if (F[G] = V.x, F[G + 1] = V.y, F[G + 2] = V.z, F[G + 3] = Q.x, F[G + 4] = Q.y, F[G + 5] = Q.z, F[G + 6] = ae.x, F[G + 7] = ae.y, F[G + 8] = ae.z, H > 0) {
                    var oe = F[G - 3], q = F[G - 2], me = F[G - 1], ne = new u.Vector3(oe, q, me), fe = new u.Vector3(v.x, v.y, v.z), Ce = D.clone(), Me = new u.Vector3(ae.x, ae.y, ae.z);
                    s.intersectionShape.triangle.push(new f.Triangle(Me, fe, ne)), s.intersectionShape.triangle.push(new f.Triangle(ne.clone(), Ce, Me.clone()));
                  }
                }
                L.vertices += 48, G = L.vertices * 3, F[G] = p.x, F[G + 1] = p.y, F[G + 2] = p.z, F[G + 3] = D.x, F[G + 4] = D.y, F[G + 5] = D.z, F[G + 6] = v.x, F[G + 7] = v.y, F[G + 8] = v.z, L.vertices += 3;
                var Te, se, pe, we, ke, Ue, Ne, Be, ue, ye, ge, Se, ze, He, We, Y, K, ee, de, ve = L.vertices - 3, Ie = L.vertices - 2, Re = L.vertices - 1, Z = ve * 3, ce = Ie * 3, Ae = Re * 3;
                for (H = 0, U = P.length - 1; H < U; ++H) {
                  var Fe = B + 3 * H;
                  G = Fe * 3, se = L.faceidx, pe = L.lineidx, we = Fe, ye = we * 3, ke = Fe + 1, ge = ke * 3, Ue = Fe + 2, Se = Ue * 3, Ne = Fe + 4, ze = Ne * 3, Be = Fe + 5, He = Be * 3, ue = Fe + 3, We = ue * 3, Y = K = P[H], ee = de = P[H + 1], $[ye] = Y.x, $[ge] = K.x, $[We] = de.x, $[ye + 1] = Y.y, $[ge + 1] = K.y, $[We + 1] = de.y, $[ye + 2] = Y.z, $[ge + 2] = K.z, $[We + 2] = de.z, $[ge] = K.x, $[ze] = ee.x, $[We] = de.x, $[ge + 1] = K.y, $[ze + 1] = ee.y, $[We + 1] = de.y, $[ge + 2] = K.z, $[ze + 2] = ee.z, $[We + 2] = de.z, $[Se] = K.x, $[He] = ee.x, $[Se + 1] = K.y, $[He + 1] = ee.y, $[Se + 2] = K.z, $[He + 2] = ee.z, N[se] = we, N[se + 1] = ke, N[se + 2] = ue, N[se + 3] = ke, N[se + 4] = Ne, N[se + 5] = ue, N[se + 6] = we, N[se + 7] = ue, N[se + 8] = ve, N[se + 9] = Ue, N[se + 10] = Ie, N[se + 11] = Be, N[se + 12] = Ue, N[se + 13] = Re, N[se + 14] = Be, k[pe] = we, k[pe + 1] = ke, k[pe + 2] = we, k[pe + 3] = ue, k[pe + 4] = Ne, k[pe + 5] = ue, k[pe + 6] = we, k[pe + 7] = ue, k[pe + 8] = Ue, k[pe + 9] = ke, k[pe + 10] = Ue, k[pe + 11] = Be, k[pe + 12] = Ne, k[pe + 13] = Be, k[pe + 14] = Ue, k[pe + 15] = Re, k[pe + 16] = Ue, k[pe + 17] = Be, k[pe + 18] = Re, k[pe + 19] = Be, L.faceidx += 15, L.lineidx += 20;
                }
                Te = [
                  B + 45,
                  B + 46,
                  B + 1,
                  B,
                  B + 47,
                  B + 2
                ], se = L.faceidx, pe = L.lineidx, we = Te[0], ye = we * 3, ke = Te[1], ge = ke * 3, Ue = Te[4], Se = Ue * 3, Ne = Te[2], ze = Ne * 3, Be = Te[5], He = Be * 3, ue = Te[3], We = ue * 3, Y = K = P[15], ee = de = P[0], $[ye] = Y.x, $[ge] = K.x, $[We] = de.x, $[ye + 1] = Y.y, $[ge + 1] = K.y, $[We + 1] = de.y, $[ye + 2] = Y.z, $[ge + 2] = K.z, $[We + 2] = de.z, $[ge] = K.x, $[ze] = ee.x, $[We] = de.x, $[ge + 1] = K.y, $[ze + 1] = ee.y, $[We + 1] = de.y, $[ge + 2] = K.z, $[ze + 2] = ee.z, $[We + 2] = de.z, $[Se] = K.x, $[He] = ee.x, $[Se + 1] = K.y, $[He + 1] = ee.y, $[Se + 2] = K.z, $[He + 2] = ee.z, T.normalize(), I.normalize(), $[Z] = I.x, $[ce] = $[Ae] = T.x, $[Z + 1] = I.y, $[ce + 1] = $[Ae + 1] = T.y, $[Z + 2] = I.z, $[ce + 2] = $[Ae + 2] = T.z, N[se] = we, N[se + 1] = ke, N[se + 2] = ue, N[se + 3] = ke, N[se + 4] = Ne, N[se + 5] = ue, N[se + 6] = we, N[se + 7] = ue, N[se + 8] = ve, N[se + 9] = Ue, N[se + 10] = Ie, N[se + 11] = Be, N[se + 12] = Ue, N[se + 13] = Re, N[se + 14] = Be, k[pe] = we, k[pe + 1] = ke, k[pe + 2] = we, k[pe + 3] = ue, k[pe + 4] = Ne, k[pe + 5] = ue, k[pe + 6] = we, k[pe + 7] = ue, k[pe + 8] = Ue, k[pe + 9] = ke, k[pe + 10] = Ue, k[pe + 11] = Be, k[pe + 12] = Ne, k[pe + 13] = Be, k[pe + 14] = Ue, k[pe + 15] = Re, k[pe + 16] = Ue, k[pe + 17] = Be, k[pe + 18] = Re, k[pe + 19] = Be, L.faceidx += 15, L.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(s, o, w, p) {
                s.center.set(0, 0, 0);
                let v = 1 / 0, a = 1 / 0, l = 1 / 0, g = -1 / 0, M = -1 / 0, L = -1 / 0;
                s.box && (v = s.box.min.x, g = s.box.max.x, a = s.box.min.y, M = s.box.max.y, l = s.box.min.z, L = s.box.max.z);
                for (let z = 0, P = p; z < P; z++) {
                  var T = w[z * 3], D = w[z * 3 + 1], I = w[z * 3 + 2];
                  T < v && (v = T), D < a && (a = D), I < l && (l = I), T > g && (g = T), D > M && (M = D), I > L && (L = I);
                }
                s.center.set((g + v) / 2, (M + a) / 2, (L + l) / 2), s.radius = s.center.distanceTo({ x: g, y: M, z: L }), s.box = { min: { x: v, y: a, z: l }, max: { x: g, y: M, z: L } };
              }
              //helper function for adding an appropriately sized mesh
              static addCustomGeo(s, o, w, p, v) {
                var a = o.addGeoGroup(), l = w.vertexArr, g = w.normalArr, M = w.faceArr;
                a.vertices = l.length, a.faceidx = M.length;
                var L, T, D, I, z, P, B, F, N, $ = a.vertexArray, k = a.colorArray;
                for (p.constructor !== Array && (F = p.r, N = p.g, I = p.b), P = 0, B = a.vertices; P < B; ++P)
                  L = P * 3, T = l[P], $[L] = T.x, $[L + 1] = T.y, $[L + 2] = T.z, p.constructor === Array && (z = p[P], F = z.r, N = z.g, I = z.b), k[L] = F, k[L + 1] = N, k[L + 2] = I;
                if (v)
                  for (P = 0, B = a.faceidx / 3; P < B; ++P) {
                    L = P * 3, D = M[L], I = M[L + 1], z = M[L + 2];
                    var G = new u.Vector3(), H = new u.Vector3(), U = new u.Vector3();
                    s.intersectionShape.triangle.push(new f.Triangle(G.copy(l[D]), H.copy(l[I]), U.copy(l[z])));
                  }
                if (v) {
                  var V = new u.Vector3(0, 0, 0), Q = 0;
                  for (let q = 0; q < o.geometryGroups.length; q++)
                    V.add(o.geometryGroups[q].getCentroid()), Q++;
                  V.divideScalar(Q), b.updateBoundingFromPoints(s.boundingSphere, { centroid: V }, $, a.vertices);
                }
                if (a.faceArray = new Uint16Array(M), a.truncateArrayBuffers(!0, !0), g.length < a.vertices)
                  a.setNormals();
                else {
                  var ae = a.normalArray = new Float32Array(a.vertices * 3), oe;
                  for (P = 0, B = a.vertices; P < B; ++P)
                    L = P * 3, oe = g[P], ae[L] = oe.x, ae[L + 1] = oe.y, ae[L + 2] = oe.z;
                }
                a.setLineIndices(), a.lineidx = a.lineArray.length;
              }
              /*
               *
               * @param {$3Dmol.GLShape}
               *            shape
               * @param {ShapeSpec}
               *            stylespec
               * @returns {undefined}
               */
              static updateFromStyle(s, o) {
                typeof o.color < "u" ? (s.color = o.color || new y.Color(), o.color instanceof y.Color || (s.color = y.CC.color(o.color))) : s.color = y.CC.color(0), s.wireframe = !!o.wireframe, s.opacity = o.alpha ? (0, u.clamp)(o.alpha, 0, 1) : 1, typeof o.opacity < "u" && (s.opacity = (0, u.clamp)(o.opacity, 0, 1)), s.side = o.side !== void 0 ? o.side : n.DoubleSide, s.linewidth = typeof o.linewidth > "u" ? 1 : o.linewidth, s.clickable = !!o.clickable, s.callback = (0, C.makeFunction)(o.callback), s.hoverable = !!o.hoverable, s.hover_callback = (0, C.makeFunction)(o.hover_callback), s.unhover_callback = (0, C.makeFunction)(o.unhover_callback), s.hidden = o.hidden, s.frame = o.frame;
              }
              /**
               * Custom renderable shape
               *
               * @constructor
               *
               * @param {ShapeSpec} stylespec
               */
              constructor(s) {
                this.color = 16777215, this.hidden = !1, this.wireframe = !1, this.opacity = 1, this.linewidth = 1, this.clickable = !1, this.hoverable = !1, this.side = n.DoubleSide, this.stylespec = s || {}, this.boundingSphere = new f.Sphere(), this.intersectionShape = {
                  sphere: [],
                  cylinder: [],
                  line: [],
                  triangle: []
                }, b.updateFromStyle(this, this.stylespec), this.components = [], this.shapeObj = null, this.renderedShapeObj = null, this.geo = new n.Geometry(!0), this.linegeo = new n.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(s) {
                for (var o in s)
                  this.stylespec[o] = s[o];
                if (b.updateFromStyle(this, this.stylespec), s.voldata && s.volscheme) {
                  (0, C.adjustVolumeStyle)(s);
                  const w = s.volscheme, p = s.voldata, v = y.CC, a = w.range() || [-1, 1];
                  this.geo.setColors(function(l, g, M) {
                    let L = p.getVal(l, g, M);
                    return v.color(w.valueToHex(L, a));
                  }), delete this.color;
                }
              }
              /**
               * Creates a custom shape from supplied vertex and face arrays
               * @param {CustomShapeSpec} customSpec
               */
              addCustom(s) {
                s.vertexArr = s.vertexArr || [], s.faceArr = s.faceArr || [], s.normalArr = s.normalArr || [], b.drawCustom(this, this.geo, s);
              }
              /**
               * 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(s) {
                s.center || (s.center = new u.Vector3(0, 0, 0)), s.radius = s.radius ? (0, u.clamp)(s.radius, 0, 1 / 0) : 1.5, s.color = y.CC.color(s.color), this.intersectionShape.sphere.push(new f.Sphere(s.center, s.radius)), E.GLDraw.drawSphere(this.geo, s.center, s.radius, s.color, s.quality), this.components.push({
                  centroid: new u.Vector3(s.center.x, s.center.y, s.center.z)
                });
                var o = this.geo.updateGeoGroup(0);
                b.updateBoundingFromPoints(this.boundingSphere, this.components, o.vertexArray, o.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(s) {
                var o = s.dimensions || { w: 1, h: 1, d: 1 }, w;
                typeof o.w == "number" ? w = { x: o.w, y: 0, z: 0 } : w = o.w;
                var p;
                typeof o.h == "number" ? p = { x: 0, y: o.h, z: 0 } : p = o.h;
                var v;
                typeof o.d == "number" ? v = { x: 0, y: 0, z: o.d } : v = o.d;
                var a = s.corner;
                a == null && (s.center !== void 0 ? a = {
                  x: s.center.x - 0.5 * (w.x + p.x + v.x),
                  y: s.center.y - 0.5 * (w.y + p.y + v.y),
                  z: s.center.z - 0.5 * (w.z + p.z + v.z)
                } : a = { x: 0, y: 0, z: 0 });
                var l = [
                  { x: a.x, y: a.y, z: a.z },
                  { x: a.x + w.x, y: a.y + w.y, z: a.z + w.z },
                  { x: a.x + p.x, y: a.y + p.y, z: a.z + p.z },
                  { x: a.x + w.x + p.x, y: a.y + w.y + p.y, z: a.z + w.z + p.z },
                  { x: a.x + v.x, y: a.y + v.y, z: a.z + v.z },
                  { x: a.x + w.x + v.x, y: a.y + w.y + v.y, z: a.z + w.z + v.z },
                  { x: a.x + p.x + v.x, y: a.y + p.y + v.y, z: a.z + p.z + v.z },
                  { x: a.x + w.x + p.x + v.x, y: a.y + w.y + p.y + v.y, z: a.z + w.z + p.z + v.z }
                ], g = [], M = [];
                g.splice(g.length, 0, l[0], l[1], l[2], l[3]), M.splice(M.length, 0, 0, 2, 1, 1, 2, 3);
                var L = 4;
                g.splice(g.length, 0, l[2], l[3], l[6], l[7]), M.splice(M.length, 0, L + 0, L + 2, L + 1, L + 1, L + 2, L + 3), L += 4, g.splice(g.length, 0, l[4], l[5], l[0], l[1]), M.splice(M.length, 0, L + 0, L + 2, L + 1, L + 1, L + 2, L + 3), L += 4, g.splice(g.length, 0, l[6], l[7], l[4], l[5]), M.splice(M.length, 0, L + 0, L + 2, L + 1, L + 1, L + 2, L + 3), L += 4, g.splice(g.length, 0, l[3], l[1], l[7], l[5]), M.splice(M.length, 0, L + 0, L + 2, L + 1, L + 1, L + 2, L + 3), L += 4, g.splice(g.length, 0, l[2], l[6], l[0], l[4]), M.splice(M.length, 0, L + 0, L + 2, L + 1, L + 1, L + 2, L + 3), L += 4;
                var T = (0, C.extend)({}, s);
                T.vertexArr = g, T.faceArr = M, T.normalArr = [], b.drawCustom(this, this.geo, T);
                var D = new u.Vector3();
                this.components.push({
                  centroid: D.addVectors(l[0], l[7]).multiplyScalar(0.5)
                });
                var I = this.geo.updateGeoGroup(0);
                b.updateBoundingFromPoints(this.boundingSphere, this.components, I.vertexArray, I.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(s) {
                var o, w;
                s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0), s.end ? (w = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof w.x > "u" && (w.x = 3)) : w = new u.Vector3(0, 0, 0);
                var p = s.radius || 0.1, v = y.CC.color(s.color);
                this.intersectionShape.cylinder.push(new f.Cylinder(o, w, p)), E.GLDraw.drawCylinder(this.geo, o, w, p, v, s.fromCap, s.toCap);
                var a = new u.Vector3();
                this.components.push({
                  centroid: a.addVectors(o, w).multiplyScalar(0.5)
                });
                var l = this.geo.updateGeoGroup(0);
                b.updateBoundingFromPoints(this.boundingSphere, this.components, l.vertexArray, l.vertices);
              }
              /**
               * Creates a dashed cylinder shape
               * @param {CylinderSpec} cylinderSpec
               */
              addDashedCylinder(s) {
                s.dashLength = s.dashLength || 0.25, s.gapLength = s.gapLength || 0.25;
                var o;
                s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0);
                var w;
                s.end ? (w = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof w.x > "u" && (w.x = 3)) : w = new u.Vector3(3, 0, 0);
                for (var p = s.radius || 0.1, v = y.CC.color(s.color), a = Math.sqrt(Math.pow(o.x - w.x, 2) + Math.pow(o.y - w.y, 2) + Math.pow(o.z - w.z, 2)), l = a / (s.gapLength + s.dashLength), g = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0), M = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), L = new u.Vector3((w.x - o.x) / (a / s.gapLength), (w.y - o.y) / (a / s.gapLength), (w.z - o.z) / (a / s.gapLength)), T = new u.Vector3((w.x - o.x) / (a / s.dashLength), (w.y - o.y) / (a / s.dashLength), (w.z - o.z) / (a / s.dashLength)), D = 0; D < l; D++)
                  M = new u.Vector3(g.x + T.x, g.y + T.y, g.z + T.z), this.intersectionShape.cylinder.push(new f.Cylinder(g, M, p)), E.GLDraw.drawCylinder(this.geo, g, M, p, v, s.fromCap, s.toCap), g = new u.Vector3(M.x + L.x, M.y + L.y, M.z + L.z);
                var I = new u.Vector3();
                this.components.push({
                  centroid: I.addVectors(o, w).multiplyScalar(0.5)
                });
                var z = this.geo.updateGeoGroup(0);
                b.updateBoundingFromPoints(this.boundingSphere, this.components, z.vertexArray, z.vertices);
              }
              /**
               * Creates a curved shape
               * @param {CurveSpec} curveSpec
               */
              addCurve(s) {
                s.points = s.points || [], s.smooth = s.smooth || 10, typeof s.fromCap > "u" && (s.fromCap = 2), typeof s.toCap > "u" && (s.toCap = 2);
                var o = (0, c.subdivide_spline)(s.points, s.smooth);
                if (o.length < 3) {
                  console.log("Too few points in addCurve");
                  return;
                }
                var w = s.radius || 0.1, p = y.CC.color(s.color), v = 0, a = o.length - 1, l = o[0].distanceTo(o[1]), g = Math.ceil(2 * w / l);
                if (s.toArrow) {
                  a -= g;
                  let D = {
                    start: o[a],
                    end: o[o.length - 1],
                    radius: w,
                    color: p,
                    mid: 1e-4
                  };
                  this.addArrow(D);
                }
                if (s.fromArrow) {
                  v += g;
                  let D = {
                    start: o[v],
                    end: o[0],
                    radius: w,
                    color: p,
                    mid: 1e-4
                  };
                  this.addArrow(D);
                }
                for (var M = Math.ceil(o.length / 2), L = { radius: w, color: p, fromCap: 2, toCap: 2 }, T = v; T < a; T++)
                  L.start = o[T], L.end = o[T + 1], L.fromCap = 2, L.toCap = 2, T < M ? (L.fromCap = 2, L.toCap = 0) : T > M ? (L.fromCap = 0, L.toCap = 2) : (L.fromCap = 2, L.toCap = 2), this.addCylinder(L);
              }
              /**
               * 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(s) {
                var o, w;
                s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0), s.end ? (w = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof w.x > "u" && (w.x = 3)) : w = new u.Vector3(3, 0, 0);
                var p = this.geo.updateGeoGroup(2), v = p.vertices, a = v * 3, l = p.vertexArray;
                l[a] = o.x, l[a + 1] = o.y, l[a + 2] = o.z, l[a + 3] = w.x, l[a + 4] = w.y, l[a + 5] = w.z, p.vertices += 2;
                var g = p.lineArray, M = p.lineidx;
                g[M] = v, g[M + 1] = v + 1, p.lineidx += 2;
                var L = new u.Vector3();
                this.components.push({
                  centroid: L.addVectors(o, w).multiplyScalar(0.5)
                }), p = this.geo.updateGeoGroup(0), b.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices);
              }
              /**
               * Creates an arrow shape
               * @param {ArrowSpec} arrowSpec
               @example
                $3Dmol.download("pdb:4DM7",viewer,{},function(){
                        viewer.setBackgroundColor(0xffffffff);
                        viewer.addArrow({
                            start: {x:-10.0, y:0.0, z:0.0},
                            end: {x:0.0, y:-10.0, z:0.0},
                            radius: 1.0,
                            radiusRadio:1.0,
                            mid:1.0,
                            clickable:true,
                            callback:function(){
                                this.color.setHex(0xFF0000FF);
                                viewer.render( );
                            }
                        });
                        viewer.render();
                      });
               */
              addArrow(s) {
                if (s.start ? s.start = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : s.start = new u.Vector3(0, 0, 0), s.dir instanceof u.Vector3 && typeof s.length == "number") {
                  var o = s.dir.clone().multiplyScalar(s.length).add(s.start);
                  s.end = o;
                } else
                  s.end ? (s.end = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof s.end.x > "u" && (s.end.x = 3)) : s.end = new u.Vector3(3, 0, 0);
                s.radius = s.radius || 0.1, s.radiusRatio = s.radiusRatio || 1.618034, s.mid = 0 < s.mid && s.mid < 1 ? s.mid : 0.618034, b.drawArrow(this, this.geo, s);
                var w = new u.Vector3();
                this.components.push({
                  centroid: w.addVectors(s.start, s.end).multiplyScalar(0.5)
                });
                var p = this.geo.updateGeoGroup(0);
                b.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices);
              }
              static distance_from(s, o) {
                return Math.sqrt(Math.pow(s.x - o.x, 2) + Math.pow(s.y - o.y, 2) + Math.pow(s.z - o.z, 2));
              }
              static inSelectedRegion(s, o, w) {
                for (var p = 0; p < o.length; p++)
                  if (b.distance_from(o[p], s) <= w)
                    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(s, o, w) {
                var p = o.isoval !== void 0 && typeof o.isoval == "number" ? o.isoval : 0, v = !!o.voxel, a = o.smoothness === void 0 ? 1 : o.smoothness, l = s.size.x, g = s.size.y, M = s.size.z, L = new Int16Array(l * g * M), T = s.data, D, I;
                for (D = 0, I = L.length; D < I; ++D)
                  L[D] = -1;
                var z = new Uint8Array(l * g * M);
                for (D = 0, I = T.length; D < I; ++D) {
                  var P = p >= 0 ? T[D] - p : p - T[D];
                  P > 0 && (z[D] |= b.ISDONE);
                }
                var B = [], F = [];
                h.MarchingCube.march(z, B, F, {
                  fulltable: !0,
                  voxel: v,
                  unitCube: s.unit,
                  origin: s.origin,
                  matrix: s.matrix,
                  nX: l,
                  nY: g,
                  nZ: M
                }), !v && a > 0 && h.MarchingCube.laplacianSmooth(a, B, F);
                var N = [], $ = [], k = [];
                if (o.selectedRegion && o.coords === void 0 && (o.coords = o.selectedRegion), o.coords !== void 0) {
                  var G = o.coords[0].x, H = o.coords[0].y, U = o.coords[0].z, V = o.coords[0].x, Q = o.coords[0].y, ae = o.coords[0].z;
                  for (let se = 0; se < o.coords.length; se++)
                    o.coords[se].x > G ? G = o.coords[se].x : o.coords[se].x < V && (V = o.coords[se].x), o.coords[se].y > H ? H = o.coords[se].y : o.coords[se].y < Q && (Q = o.coords[se].y), o.coords[se].z > U ? U = o.coords[se].z : o.coords[se].z < ae && (ae = o.coords[se].z);
                  var oe = 2;
                  o.radius !== void 0 && (oe = o.radius), o.selectedOffset !== void 0 && (oe = o.selectedOffset), o.seldist !== void 0 && (oe = o.seldist), V -= oe, G += oe, Q -= oe, H += oe, ae -= oe, U += oe;
                  for (let se = 0; se < B.length; se++)
                    B[se].x > V && B[se].x < G && B[se].y > Q && B[se].y < H && B[se].z > ae && B[se].z < U && b.inSelectedRegion(B[se], o.coords, oe) ? (N.push($.length), $.push(B[se])) : N.push(-1);
                  for (let se = 0; se + 2 < F.length; se += 3)
                    N[F[se]] !== -1 && N[F[se + 1]] !== -1 && N[F[se + 2]] !== -1 && (k.push(F[se] - (F[se] - N[F[se]])), k.push(F[se + 1] - (F[se + 1] - N[F[se + 1]])), k.push(F[se + 2] - (F[se + 2] - N[F[se + 2]])));
                  B = $, F = k;
                }
                b.drawCustom(this, this.geo, {
                  vertexArr: B,
                  faceArr: F,
                  normalArr: [],
                  clickable: o.clickable,
                  hoverable: o.hoverable
                }), this.updateStyle(o);
                var q = new u.Vector3(s.origin.x, s.origin.y, s.origin.z), me = new u.Vector3(s.size.x * s.unit.x, s.size.y * s.unit.y, s.size.z * s.unit.z), ne = new u.Vector3(0, 0, 0), fe = q.clone(), Ce = q.clone().add(me);
                for (let se = 0; se < B.length; se++)
                  ne.add(B[se]), fe.max(B[se]), Ce.min(B[se]);
                ne.divideScalar(B.length);
                var Me = ne.distanceTo(Ce), Te = ne.distanceTo(fe);
                this.boundingSphere.center = ne, this.boundingSphere.radius = Math.max(Me, Te), typeof w == "function" && w();
              }
              /**
               * @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(s, o, w) {
                s = new _.VolumeData(s, o), this.addIsosurface(s, w);
              }
              //for internal use, truncate buffers to save memory
              finalize() {
                return b.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.geo;
              }
              /*
               * Initialize webgl objects for rendering
               * @param {$3Dmol.Object3D} group
               *
               */
              globj(s) {
                if (this.renderedShapeObj && (s.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  b.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.wireframe && this.geo.setUpWireframe(), typeof this.color < "u" && b.updateColor(this.geo, this.color), this.shapeObj = new n.Object3D();
                  var o = null;
                  this.side == n.DoubleSide ? o = new n.MeshDoubleLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: n.Coloring.VertexColors
                  }) : o = new n.MeshLambertMaterial({
                    wireframe: this.wireframe,
                    side: this.side,
                    transparent: this.opacity < 1,
                    opacity: this.opacity,
                    wireframeLinewidth: this.linewidth,
                    vertexColors: n.Coloring.VertexColors
                  });
                  var w = new n.Mesh(this.geo, o);
                  this.shapeObj.add(w);
                  var p = new n.LineBasicMaterial({
                    linewidth: this.linewidth,
                    color: this.color
                  }), v = new n.Line(this.linegeo, p, n.LineStyle.LinePieces);
                  this.shapeObj.add(v), this.renderedShapeObj = this.shapeObj.clone(), s.add(this.renderedShapeObj);
                }
              }
              removegl(s) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), s.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;
              }
            }
            b.ISDONE = 2, b.drawCustom = function(S, s, o) {
              var w = o, p = w.vertexArr, v = w.faceArr;
              (p.length === 0 || v.length === 0) && console.warn("Error adding custom shape component: No vertices and/or face indices supplied!");
              var a = o.color;
              typeof a > "u" && (a = S.color), a = y.CC.color(a);
              for (var l = A(w), g = 0, M = l.length; g < M; g++)
                b.addCustomGeo(S, s, l[g], l[g].colorArr ? l[g].colorArr : a, o.clickable);
            };
            function A(S) {
              var s = 64e3;
              if (S.vertexArr.length < s)
                return [S];
              var o = [{ vertexArr: [], normalArr: [], faceArr: [] }];
              S.colorArr && (o.colorArr = []);
              var w = [], p = [], v = 0, a = S.faceArr;
              for (let g = 0, M = a.length; g < M; g += 3) {
                let L = o[v];
                for (let T = 0; T < 3; T++) {
                  var l = a[g + T];
                  w[l] !== v && (w[l] = v, p[l] = L.vertexArr.length, L.vertexArr.push(S.vertexArr[l]), S.normalArr && S.normalArr[l] && L.normalArr.push(S.normalArr[l]), S.colorArr && S.colorArr[l] && L.colorArr.push(S.colorArr[l])), L.faceArr.push(p[l]);
                }
                L.vertexArr.length >= s && (o.push({ vertexArr: [], normalArr: [], faceArr: [] }), S.colorArr && (o.colorArr = []), v++);
              }
              return o;
            }
          }
        ),
        /***/
        "./src/GLViewer.ts": (
          /*!*************************!*\
            !*** ./src/GLViewer.ts ***!
            \*************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLViewer: () => (
                /* binding */
                s
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* binding */
                p
              ),
              /* harmony export */
              createViewer: () => (
                /* binding */
                o
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* binding */
                w
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), u = t(
              /*! ./colors */
              "./src/colors.ts"
            ), y = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), h = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), _ = t(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), E = t(
              /*! ./Label */
              "./src/Label.ts"
            ), c = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), C = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), b = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), A = t(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), S = t(
              /*! upng-js */
              "./node_modules/upng-js/UPNG.js"
            );
            class s {
              //reimplement jquery getwidth/height
              getRect() {
                let a = this.container, l = a.getBoundingClientRect();
                if (l.width == 0 && l.height == 0 && a.style.display === "none") {
                  let g = a.style.position, M = a.style.visibility;
                  a.style.display = "block", a.style.visibility = "hidden", a.style.position = "absolute", l = a.getBoundingClientRect(), a.style.display = "none", a.style.visibility = M, a.style.position = g;
                }
                return l;
              }
              getWidth() {
                return this.getRect().width;
              }
              getHeight() {
                return this.getRect().height;
              }
              setupRenderer() {
                this.renderer = new n.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 n.Scene(), this.scene.fog = new n.Fog(this.bgColor, 100, 200), this.modelGroup = new n.Object3D(), this.rotationGroup = new n.Object3D(), this.rotationGroup.useQuaternion = !0, this.rotationGroup.quaternion = new f.Quaternion(0, 0, 0, 1), this.rotationGroup.add(this.modelGroup), this.scene.add(this.rotationGroup);
                var a = new n.Light(16777215);
                a.position = new f.Vector3(0.2, 0.2, 1).normalize(), a.intensity = 1, this.scene.add(a);
              }
              initContainer(a) {
                this.container = a, 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 a = 0;
                for (let g in this.surfaces)
                  if (this.surfaces.hasOwnProperty(g)) {
                    var l = parseInt(g);
                    isNaN(l) || l > a && (a = l);
                  }
                return a + 1;
              }
              setSlabAndFog() {
                let a = this.camera.position.z - this.rotationGroup.position.z;
                a < 1 && (a = 1), this.camera.near = a + this.slabNear, this.camera.near < 1 && (this.camera.near = 1), this.camera.far = a + this.slabFar, this.camera.near + 1 > this.camera.far && (this.camera.far = this.camera.near + 1), this.camera.fov = this.fov, this.camera.right = a * 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(a) {
                if (this.renderer.setViewport(), !!this.scene && (this.setSlabAndFog(), this.renderer.render(this.scene, this.camera), this.viewChangeCallback && this.viewChangeCallback(this._viewer.getView()), !a && this.linkedViewers.length > 0))
                  for (var l = this._viewer.getView(), g = 0; g < this.linkedViewers.length; g++) {
                    var M = this.linkedViewers[g];
                    M.setView(l, !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 a = 0, l = this.models.length; a < l; a++) {
                  let g = this.models[a];
                  if (g) {
                    let M = g.selectedAtoms({
                      clickable: !0
                    }), L = g.selectedAtoms({
                      hoverable: !0
                    }), T = g.selectedAtoms({ contextMenuEnabled: !0 });
                    for (let D = 0; D < L.length; D++)
                      this.hoverables.push(L[D]);
                    for (let D = 0; D < M.length; D++)
                      this.clickables.push(M[D]);
                    for (let D = 0; D < T.length; D++)
                      this.contextMenuEnabledAtoms.push(T[D]);
                  }
                }
                for (let a = 0, l = this.shapes.length; a < l; a++) {
                  let g = this.shapes[a];
                  g && g.clickable && this.clickables.push(g), g && g.hoverable && this.hoverables.push(g);
                }
              }
              // Checks for selection intersects on mousedown
              handleClickSelection(a, l, g) {
                let M = this.targetedObjects(a, l, this.clickables);
                if (M.length) {
                  var L = M[0].clickable;
                  L.callback !== void 0 && (typeof L.callback != "function" && (L.callback = (0, y.makeFunction)(L.callback)), typeof L.callback == "function" && L.callback(L, this._viewer, g, this.container, M));
                }
              }
              //return offset of container
              canvasOffset() {
                let a = this.glDOM, l = a.getBoundingClientRect(), g = a.ownerDocument, M = g.documentElement, L = g.defaultView;
                return {
                  top: l.top + L.pageYOffset - M.clientTop,
                  left: l.left + L.pageXOffset - M.clientLeft
                };
              }
              //set current_hover to sel (which can be null), calling appropraite callbacks
              setHover(a, l, g) {
                this.current_hover != a && (this.current_hover && (typeof this.current_hover.unhover_callback != "function" && (this.current_hover.unhover_callback = (0, y.makeFunction)(this.current_hover.unhover_callback)), this.current_hover.unhover_callback(this.current_hover, this._viewer, l, this.container, g)), this.current_hover = a, a && a.hover_callback !== void 0 && (typeof a.hover_callback != "function" && (a.hover_callback = (0, y.makeFunction)(a.hover_callback)), typeof a.hover_callback == "function" && a.hover_callback(a, this._viewer, l, this.container, g)));
              }
              //checks for selection intersects on hover
              handleHoverSelection(a, l, g) {
                if (this.hoverables.length == 0)
                  return;
                let M = this.targetedObjects(a, l, this.hoverables);
                if (M.length) {
                  var L = M[0].clickable;
                  this.setHover(L, g, M), this.current_hover = L;
                } 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(a, l) {
                let g = this.targetedObjects(a, l, this.hoverables);
                (g.length == 0 || g[0] === void 0) && this.setHover(null), g[0] !== void 0 && g[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(a, { allowTolerance: l = a.targetTouches, tolerance: g = 5 } = {}) {
                const M = this.getX(a), L = this.getY(a);
                if (l) {
                  const T = Math.abs(M - this.mouseStartX), D = Math.abs(L - this.mouseStartY);
                  return T <= g && D <= g;
                } else
                  return M === this.mouseStartX && L === this.mouseStartY;
              }
              calcTouchDistance(a) {
                var l = a.targetTouches[0].pageX - a.targetTouches[1].pageX, g = a.targetTouches[0].pageY - a.targetTouches[1].pageY;
                return Math.hypot(l, g);
              }
              //check targetTouches as well
              getX(a) {
                var l = a.pageX;
                return l == null && (l = a.pageX), a.targetTouches && a.targetTouches[0] ? l = a.targetTouches[0].pageX : a.changedTouches && a.changedTouches[0] && (l = a.changedTouches[0].pageX), l;
              }
              getY(a) {
                var l = a.pageY;
                return l == null && (l = a.pageY), a.targetTouches && a.targetTouches[0] ? l = a.targetTouches[0].pageY : a.changedTouches && a.changedTouches[0] && (l = a.changedTouches[0].pageY), l;
              }
              //for grid viewers, return true if point is in this viewer
              isInViewer(a, l) {
                if (this.viewers != null) {
                  var g = this.WIDTH / this.cols, M = this.HEIGHT / this.rows, L = this.canvasOffset(), T = a - L.left, D = l - L.top, I = this.rows - Math.floor(D / M) - 1, z = Math.floor(T / g);
                  if (I != this.row || z != 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(a) {
                if (this.config.lowerZoomLimit && this.config.lowerZoomLimit > 0) {
                  let l = this.CAMERA_Z - this.config.lowerZoomLimit;
                  a > l && (a = l);
                }
                if (this.config.upperZoomLimit && this.config.upperZoomLimit > 0) {
                  let l = this.CAMERA_Z - this.config.upperZoomLimit;
                  a < l && (a = l);
                }
                return a > this.CAMERA_Z - 1 && (a = this.CAMERA_Z - 1), a;
              }
              //interpolate between two normalized quaternions (t between 0 and 1)
              //https://en.wikipedia.org/wiki/Slerp
              static slerp(a, l, g) {
                if (g == 1)
                  return l.clone();
                if (g == 0)
                  return a.clone();
                let M = a.x * l.x + a.y * l.y + a.z * l.z + a.w * l.w;
                if (M > 0.9995) {
                  let B = new f.Quaternion(a.x + g * (l.x - a.x), a.y + g * (l.y - a.y), a.z + g * (l.z - a.z), a.w + g * (l.w - a.w));
                  return B.normalize(), B;
                }
                M < 0 && (l = l.clone().multiplyScalar(-1), M = -M), M > 1 ? M = 1 : M < -1 && (M = -1);
                var L = Math.acos(M), T = L * g, D = l.clone();
                D.sub(a.clone().multiplyScalar(M)), D.normalize();
                var I = Math.cos(T), z = Math.sin(T), P = new f.Quaternion(a.x * I + D.x * z, a.y * I + D.y * z, a.z * I + D.z * z, a.w * I + D.w * z);
                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(a, l = {}) {
                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 f.Quaternion(0, 0, 0, 1), this.dq = new f.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 = l, this.callback = this.config.callback, this.defaultcolors = this.config.defaultcolors, this.defaultcolors || (this.defaultcolors = u.elementColors.defaultColors), this.nomouse = this.config.nomouse, this.bgColor = 0, this.config.backgroundColor = this.config.backgroundColor || "#ffffff", typeof this.config.backgroundColor < "u" && (this.bgColor = u.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 = a, 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 n.Camera(this.fov, this.ASPECT, this.NEAR, this.FAR, this.config.orthographic), this.camera.position = new f.Vector3(this.camerax, 0, this.CAMERA_Z), this.lookingAt = new f.Vector3(), this.camera.lookAt(this.lookingAt), this.raycaster = new n.Raycaster(new f.Vector3(0, 0, 0), new f.Vector3(0, 0, 0)), this.projector = new n.Projector(), this.initializeScene(), this.renderer.setClearColorHex(this.bgColor, this.config.backgroundAlpha), this.scene.fog.color = u.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 (g) {
                  console.log("error with glviewer callback: " + g);
                }
              }
              /**
              * 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(a, l, g) {
                var M = {
                  x: a,
                  y: l,
                  z: -1
                };
                return Array.isArray(g) || (g = this.selectedAtoms(g)), g.length == 0 ? [] : (this.raycaster.setFromCamera(M, this.camera), this.raycaster.intersectObjects(this.modelGroup, g));
              }
              /** 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(a) {
                let l = !1;
                Array.isArray(a) || (a = [a], l = !0);
                let g = this.renderer.getXRatio(), M = this.renderer.getYRatio(), L = this.col, T = this.row, D = L * (this.WIDTH / g), I = (M - T - 1) * (this.HEIGHT / M), z = [], P = this.canvasOffset();
                return a.forEach((B) => {
                  let F = new f.Vector3(B.x, B.y, B.z);
                  F.applyMatrix4(this.modelGroup.matrixWorld), this.projector.projectVector(F, this.camera);
                  let N = this.WIDTH / g * (F.x + 1) / 2 + P.left + D, $ = -(this.HEIGHT / M) * (F.y - 1) / 2 + P.top + I;
                  z.push({ x: N, y: $ });
                }), l && (z = z[0]), z;
              }
              /**
               * 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(a, l, g) {
                var M = a / this.WIDTH, L = l / this.HEIGHT, T = g === void 0 ? this.rotationGroup.position.z : g, D = this.rotationGroup.quaternion, I = new f.Vector3(0, 0, T);
                return this.projector.projectVector(I, this.camera), I.x += M * 2, I.y -= L * 2, this.projector.unprojectVector(I, this.camera), I.z = 0, I.applyQuaternion(D), I;
              }
              /**
               * 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(a, l) {
                let g = this.canvasOffset(), M = new f.Vector3(l.x, l.y, l.z);
                M.applyMatrix4(this.modelGroup.matrixWorld);
                let L = M.clone();
                this.projector.projectVector(M, this.camera);
                let T = new f.Vector3((a.x - g.left) * 2 / this.WIDTH - 1, (a.y - g.top) * 2 / -this.HEIGHT + 1, M.z);
                return this.projector.unprojectVector(T, this.camera), T.distanceTo(L);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setViewChangeCallback(a) {
                (typeof a == "function" || a == null) && (this.viewChangeCallback = a);
              }
              /**
               * Set a callback to call when the view has potentially changed.
               *
              */
              setStateChangeCallback(a) {
                (typeof a == "function" || a == null) && (this.stateChangeCallback = a);
              }
              /**
               * 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(a) {
                this.config = a;
              }
              /**
               * Return object representing internal state of
               * the viewer appropriate for passing to setInternalState
               *
              */
              getInternalState() {
                var a = { models: [], surfaces: [], shapes: [], labels: [] };
                for (let l = 0; l < this.models.length; l++)
                  this.models[l] && (a.models[l] = this.models[l].getInternalState());
                return a;
              }
              /**
               * Overwrite internal state of the viewer with passed  object
               * which should come from getInternalState.
               *
              */
              setInternalState(a) {
                this.clear();
                var l = a.models;
                for (let g = 0; g < l.length; g++)
                  l[g] && (this.models[g] = new _.GLModel(g), this.models[g].setInternalState(l[g]));
                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(a, l) {
                typeof a < "u" && (this.config.lowerZoomLimit = a), l && (this.config.upperZoomLimit = l), 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(a) {
                a.fov !== void 0 && (this.fov = a.fov, this.camera.fov = this.fov), a.z !== void 0 && (this.CAMERA_Z = a.z, this.camera.z = this.CAMERA_Z), a.orthographic !== void 0 && (this.camera.ortho = a.orthographic);
              }
              _handleMouseDown(a) {
                if (a.preventDefault(), !this.scene)
                  return;
                var l = this.getX(a), g = this.getY(a);
                if (l === void 0)
                  return;
                this.isDragging = !0, this.mouseButton = a.which, this.mouseStartX = l, this.mouseStartY = g, this.touchHold = !0, this.touchDistanceStart = 0, a.targetTouches && a.targetTouches.length == 2 && (this.touchDistanceStart = this.calcTouchDistance(a)), 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() {
                  a.targetTouches && M.touchHold == !0 && (M.glDOM = M.renderer.domElement, M.glDOM.dispatchEvent(new Event("contextmenu")));
                }, 1e3);
              }
              _handleMouseUp(a) {
                if (this.touchHold = !1, this.isDragging && this.scene) {
                  var l = this.getX(a), g = this.getY(a);
                  if (this.closeEnoughForClick(a) && this.isInViewer(l, g)) {
                    let M = this.mouseXY(l, g);
                    this.handleClickSelection(M.x, M.y, a);
                  }
                }
                this.isDragging = !1;
              }
              _handleMouseScroll(a) {
                if (a.preventDefault(), !!this.scene) {
                  var l = this.getX(a), g = this.getY(a);
                  if (l !== void 0 && !(!this.control_all && !this.isInViewer(l, g))) {
                    var M = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, L = 1;
                    if (a.ctrlKey && (L = -1), a.detail)
                      this.rotationGroup.position.z += L * M * a.detail / 10;
                    else if (a.wheelDelta) {
                      let T = a.wheelDelta * 600 / (a.wheelDelta + 600);
                      this.rotationGroup.position.z -= L * M * T / 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(a) {
                let l = this;
                return a = a || 1, new Promise(function(g) {
                  let M = 0, L = l.viewChangeCallback, T = [], D = [], I = Date.now();
                  l.viewChangeCallback = function() {
                    D.push(Date.now() - I), I = Date.now(), T.push(new Promise((z) => {
                      l.getCanvas().toBlob(function(P) {
                        P.arrayBuffer().then(z);
                      }, "image/png");
                    })), M += 1, M == a && (l.viewChangeCallback = L, Promise.all(T).then((z) => {
                      let P = [];
                      for (let G = 0; G < z.length; G++) {
                        let H = (0, S.decode)(z[G]);
                        P.push((0, S.toRGBA8)(H)[0]);
                      }
                      let B = l.getCanvas().width, F = l.getCanvas().height, N = (0, S.encode)(P, B, F, 0, D), $ = new Blob([N], { type: "image/png" }), k = new FileReader();
                      k.onload = function(G) {
                        g(G.target.result);
                      }, k.readAsDataURL($);
                    }));
                  };
                });
              }
              /**
               * 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(a) {
                this.hoverDuration = a;
              }
              mouseXY(a, l) {
                let g = this.canvasOffset(), M = this.renderer.getXRatio(), L = this.renderer.getYRatio(), T = this.col, D = this.row, I = T * (this.WIDTH / M), z = (L - D - 1) * (this.HEIGHT / L), P = (a - g.left - I) / (this.WIDTH / M) * 2 - 1, B = -((l - g.top - z) / (this.HEIGHT / L)) * 2 + 1;
                return { x: P, y: B };
              }
              _handleMouseMove(a) {
                clearTimeout(this.hoverTimeout), a.preventDefault();
                let l = this.getX(a), g = this.getY(a);
                if (l === void 0)
                  return;
                let M = this.renderer.getXRatio(), L = this.renderer.getYRatio(), T = this.mouseXY(l, g), D = this;
                this.current_hover !== null && this.handleHoverContinue(T.x, T.y);
                var I = 0;
                if (!(!this.control_all && !this.isInViewer(l, g)) && this.scene && (this.hoverables.length > 0 && (this.hoverTimeout = setTimeout(function() {
                  D.handleHoverSelection(T.x, T.y, a);
                }, this.hoverDuration)), !!this.isDragging)) {
                  var z = (l - this.mouseStartX) / this.WIDTH, P = (g - this.mouseStartY) / this.HEIGHT;
                  if (this.touchDistanceStart != 0 && a.targetTouches && a.targetTouches.length == 2) {
                    var B = this.calcTouchDistance(a);
                    I = 2, P = (B - this.touchDistanceStart) * 2 / (this.WIDTH + this.HEIGHT);
                  } else
                    a.targetTouches && a.targetTouches.length == 3 && (I = 1);
                  z *= M, P *= L;
                  var F = Math.hypot(z, P), N;
                  if (I == 3 || this.mouseButton == 3 && a.ctrlKey)
                    this.slabNear = this.cslabNear + z * 100, this.slabFar = this.cslabFar - P * 100;
                  else if (I == 2 || this.mouseButton == 3 || a.shiftKey)
                    N = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, N < 80 && (N = 80), this.rotationGroup.position.z = this.cz + P * N, this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z);
                  else if (I == 1 || this.mouseButton == 2 || a.ctrlKey) {
                    var $ = this.screenOffsetToModel(M * (l - this.mouseStartX), L * (g - this.mouseStartY));
                    this.modelGroup.position.addVectors(this.currentModelPos, $);
                  } else if ((I === 0 || this.mouseButton == 1) && F !== 0) {
                    var k = Math.sin(F * Math.PI) / F;
                    this.dq.x = Math.cos(F * Math.PI), this.dq.y = 0, this.dq.z = k * z, this.dq.w = -k * P, this.rotationGroup.quaternion.set(1, 0, 0, 0), this.rotationGroup.quaternion.multiply(this.dq), this.rotationGroup.quaternion.multiply(this.cq);
                  }
                  this.show();
                }
              }
              _handleContextMenu(a) {
                a.preventDefault();
                var l = this.getX(a), g = this.getY(a);
                if (!(l != this.mouseStartX || g != this.mouseStartY)) {
                  var T = this.mouseStartX, D = this.mouseStartY, L = this.canvasOffset();
                  let I = this.mouseXY(T, D), z = I.x, P = I.y, B = this.targetedObjects(z, P, this.contextMenuEnabledAtoms);
                  var M = null;
                  B.length && (M = B[0].clickable);
                  var L = this.canvasOffset(), T = this.mouseStartX - L.left, D = this.mouseStartY - L.top;
                  this.userContextMenuHandler && this.userContextMenuHandler(M, T, D, 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(a) {
                let l = (0, y.getElement)(a) || this.container;
                return this.initContainer(l), 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(a, l) {
                (typeof l > "u" || l < 0 || l > 1) && (l = 1);
                var g = u.CC.color(a);
                return this.scene.fog.color = g, this.bgColor = g.getHex(), this.renderer.setClearColorHex(g.getHex(), l), 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(a) {
                this.camera.ortho = a === "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(a) {
                if (a.style === "outline") {
                  var l = {};
                  a.color && (l.color = u.CC.color(a.color)), a.width && (l.width = a.width), this.renderer.enableOutline(l);
                } 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(a) {
                return this.WIDTH = a || 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(a) {
                return this.HEIGHT = a || this.HEIGHT, this.updateSize(), this;
              }
              /**
               * Resize viewer according to containing HTML element's dimensions
               *
               */
              resize() {
                this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight();
                let a = !1;
                if (this.renderer.isLost() && this.WIDTH > 0 && this.HEIGHT > 0 && (this.container.querySelector("canvas").remove(), this.setupRenderer(), this.initContainer(this.container), a = !0), this.WIDTH == 0 || this.HEIGHT == 0 ? this.animated && this._viewer.pauseAnimate() : this.animated && this._viewer.resumeAnimate(), this.updateSize(), a) {
                  let l = this.renderer.supportedExtensions();
                  l.regen = !0, this._viewer.render(null, l);
                } 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(a) {
                return a === void 0 ? this.models.length == 0 ? null : this.models[this.models.length - 1] : a instanceof _.GLModel ? a : a in this.models ? this.models[a] : 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(a, l = 1) {
                if (clearInterval(this.spinInterval), typeof a > "u" && (a = "y"), typeof a == "boolean")
                  if (a)
                    a = "y";
                  else
                    return;
                Array.isArray(a) && (a = { x: a[0], y: a[1], z: a[2] });
                var g = this;
                this.spinInterval = setInterval(function() {
                  !g.getCanvas().isConnected && g.renderer.isLost() && clearInterval(g.spinInterval), g.rotate(1 * l, a);
                }, 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(a, l, g, M, L, T) {
                var D = 20, I = Math.ceil(a / D);
                I < 1 && (I = 1), this.incAnim();
                var z = {
                  mpos: this.modelGroup.position.clone(),
                  rz: this.rotationGroup.position.z,
                  rot: this.rotationGroup.quaternion.clone(),
                  cam: this.lookingAt.clone()
                };
                if (l) {
                  let F = new Array(I);
                  for (let G = 0; G < I; G++) {
                    let H = (G + 1) / I, U = { mpos: z.mpos, rz: z.rz, rot: z.rot };
                    U.mpos = g.clone().sub(z.mpos).multiplyScalar(H).add(z.mpos), U.rz = z.rz + H * (M - z.rz), U.rot = s.slerp(z.rot, L, H), U.cam = T.clone().sub(z.cam).multiplyScalar(H).add(z.cam), F[G] = U;
                  }
                  let N = 0, $ = this, k = function() {
                    var G = F[N];
                    N += 1, $.modelGroup.position = G.mpos, $.rotationGroup.position.z = G.rz, $.rotationGroup.quaternion = G.rot, $.camera.lookAt(G.cam), N < F.length ? setTimeout(k, D) : $.decAnim(), $.show();
                  };
                  setTimeout(k, D);
                } else {
                  var P = {};
                  let F = 1 / I;
                  if (g && (P.mpos = g.clone().sub(z.mpos).multiplyScalar(F)), typeof M < "u" && M != null && (P.rz = F * (M - z.rz)), L) {
                    var B = s.slerp(z.rot, L, F);
                    P.rot = z.rot.clone().inverse().multiply(B);
                  }
                  T && (P.cam = T.clone().sub(z.cam).multiplyScalar(F));
                  let N = 0, $ = this, k = function() {
                    N += 1, P.mpos && $.modelGroup.position.add(P.mpos), P.rz && ($.rotationGroup.position.z += P.rz), P.rot && $.rotationGroup.quaternion.multiply(P.rot), P.cam && ($.lookingAt.add(P.cam), $.camera.lookAt($.lookingAt)), N < I ? setTimeout(k, D) : $.decAnim(), $.show();
                  };
                  setTimeout(k, D);
                }
              }
              /**
              	     * 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(a, l = "y", g = 0, M = !1) {
                if (l == "x" ? l = { x: 1, y: 0, z: 0 } : l == "y" ? l = { x: 0, y: 1, z: 0 } : l == "z" && (l = { x: 0, y: 0, z: 1 }), l == "vx" ? l = { vx: 1, vy: 0, vz: 0 } : l == "vy" ? l = { vx: 0, vy: 1, vz: 0 } : l == "vz" && (l = { vx: 0, vy: 0, vz: 1 }), typeof l.vx < "u") {
                  var L = new f.Vector3(l.vx, l.vy, l.vz);
                  L.applyQuaternion(this.rotationGroup.quaternion), l = { x: L.x, y: L.y, z: L.z };
                }
                var T = function(P) {
                  var B = Math.sin(P / 2), F = Math.cos(P / 2), N = 0, $ = 0, k = 0;
                  return N = l.x * B, $ = l.y * B, k = l.z * B, new f.Quaternion(N, $, k, F).normalize();
                }, D = Math.PI * a / 180, I = T(D);
                if (g) {
                  var z = new f.Quaternion().copy(this.rotationGroup.quaternion).multiply(I);
                  this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, z, this.lookingAt);
                } else
                  this.rotationGroup.quaternion.multiply(I), this.show();
                return this;
              }
              surfacesFinished() {
                for (var a in this.surfaces)
                  if (!this.surfaces[a][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 a = this.modelGroup.position, l = this.rotationGroup.quaternion;
                return [
                  a.x,
                  a.y,
                  a.z,
                  this.rotationGroup.position.z,
                  l.x,
                  l.y,
                  l.z,
                  l.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(a, l) {
                return a === void 0 || !(a instanceof Array || a.length !== 8) ? this : !this.modelGroup || !this.rotationGroup ? this : (this.modelGroup.position.x = a[0], this.modelGroup.position.y = a[1], this.modelGroup.position.z = a[2], this.rotationGroup.position.z = a[3], this.rotationGroup.quaternion.x = a[4], this.rotationGroup.quaternion.y = a[5], this.rotationGroup.quaternion.z = a[6], this.rotationGroup.quaternion.w = a[7], typeof a[8] < "u" && (this.rotationGroup.position.x = a[8], this.rotationGroup.position.y = a[9]), this.show(l), this);
              }
              // apply styles, models, etc in viewer
              /**
               * Render current state of viewer, after
               * adding/removing models, applying styles, etc.
               *
               */
              render(a, l) {
                this.renderer.setViewport(), this.updateClickables();
                var g = this.getView();
                this.stateChangeCallback && this.stateChangeCallback(this.getInternalState());
                var M, L;
                for (l || (l = this.renderer.supportedExtensions()), M = 0; M < this.models.length; M++)
                  this.models[M] && this.models[M].globj(this.modelGroup, l);
                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, l) : this.shapes[M].removegl(this.modelGroup));
                for (M = 0; M < this.labels.length; M++)
                  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 T = this.surfaces[M];
                    for (L = 0; L < T.length; L++)
                      if (T.hasOwnProperty(L)) {
                        var D = T[L].geo;
                        if (!T[L].finished || l.regen) {
                          D.verticesNeedUpdate = !0, D.elementsNeedUpdate = !0, D.normalsNeedUpdate = !0, D.colorsNeedUpdate = !0, D.buffersNeedUpdate = !0, D.boundingSphere = null, T[L].done && (T[L].finished = !0), T[L].lastGL && this.modelGroup.remove(T[L].lastGL);
                          var I = null;
                          if (T[L].mat instanceof n.LineBasicMaterial ? I = new n.Line(D, T[L].mat) : I = new n.Mesh(D, T[L].mat), T[L].mat.transparent && T[L].mat.opacity == 0 ? I.visible = !1 : I.visible = !0, T[L].symmetries.length > 1 || T[L].symmetries.length == 1 && !T[L].symmetries[L].isIdentity()) {
                            var z, P = new n.Object3D();
                            for (z = 0; z < T[L].symmetries.length; z++) {
                              var B = I.clone();
                              B.matrix = T[L].symmetries[z], B.matrixAutoUpdate = !1, P.add(B);
                            }
                            T[L].lastGL = P, this.modelGroup.add(P);
                          } else
                            T[L].lastGL = I, this.modelGroup.add(I);
                        }
                      }
                  }
                return this.setView(g), typeof a == "function" && a(this), this;
              }
              /* @param {AtomSelectionSpec|any} sel
               * @return list of models specified by sel
               */
              getModelList(a) {
                let l = [];
                if (typeof a > "u" || typeof a.model > "u")
                  for (let M = 0; M < this.models.length; M++)
                    this.models[M] && l.push(this.models[M]);
                else {
                  let M = a.model;
                  Array.isArray(M) || (M = [M]);
                  for (let L = 0; L < M.length; L++)
                    if (typeof M[L] == "number") {
                      var g = M[L];
                      g < 0 && (g += this.models.length), l.push(this.models[g]);
                    } else
                      l.push(M[L]);
                }
                return l;
              }
              /**
               *
               * @param {AtomSelectionSpec}
               *            sel
               * @return {AtomSpec[]}
               */
              getAtomsFromSel(a) {
                var l = [];
                typeof a > "u" && (a = {});
                var g = this.getModelList(a);
                for (let M = 0; M < g.length; M++)
                  l = l.concat(g[M].selectedAtoms(a));
                return l;
              }
              /**
               *
               * @param {AtomSpec}
               *            atom
               * @param {AtomSelectionSpec}
               *            sel
               * @return {boolean}
               */
              atomIsSelected(a, l) {
                typeof l > "u" && (l = {});
                for (var g = this.getModelList(l), M = 0; M < g.length; M++)
                  if (g[M].atomIsSelected(a, l))
                    return !0;
                return !1;
              }
              /** return list of atoms selected by sel
               *
               * @param {AtomSelectionSpec} sel
               * @return {AtomSpec[]}
               */
              selectedAtoms(a) {
                return this.getAtomsFromSel(a);
              }
              /**
              * Returns valid values for the specified attribute in the given selection
              * @param {string} attribute
              * @param {AtomSelectionSpec} sel
              * @return {Array.<Object>}
              *
              */
              getUniqueValues(a, l) {
                typeof l > "u" && (l = {});
                var g = this.getAtomsFromSel(l), M = {};
                for (var L in g)
                  if (g[L].hasOwnProperty(a)) {
                    var T = g[L][a];
                    M[T] = !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(a) {
                for (var l = this.getAtomsFromSel(a), g = "", M = 0, L = l.length; M < L; ++M)
                  g += l[M].pdbline + `
`;
                return g;
              }
              /**
              	     * 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(a = 2, l = 0, g = !1) {
                var M = (this.CAMERA_Z - this.rotationGroup.position.z) / a, L = this.CAMERA_Z - M;
                return l > 0 ? this.animateMotion(l, g, this.modelGroup.position, this.adjustZoomToLimits(L), this.rotationGroup.quaternion, this.lookingAt) : (this.rotationGroup.position.z = this.adjustZoomToLimits(L), 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(a, l, g = 0, M = !1) {
                var L = a / this.WIDTH, T = l / this.HEIGHT, D = new f.Vector3(0, 0, -this.CAMERA_Z);
                this.projector.projectVector(D, this.camera), D.x -= L, D.y -= T, this.projector.unprojectVector(D, this.camera), D.z = 0;
                var I = this.lookingAt.clone().add(D);
                return g > 0 ? this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, I) : (this.lookingAt = I, 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(a, l, g = 0, M = !1) {
                var L = this.screenOffsetToModel(a, l), T = this.modelGroup.position.clone().add(L);
                return g > 0 ? this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = T, 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(a) {
                a = a || {};
                var l = this.getAtomsFromSel(a), g = (0, y.getExtent)(l), M = g[1][0] - g[0][0], L = g[1][1] - g[0][1], T = g[1][2] - g[0][2], D = Math.hypot(M, L, T);
                return D < 5 && (D = 5), this.slabNear = -D / 1.9, this.slabFar = D / 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(a = {}, l = 0, g = !1) {
                var M, L, T = this.getAtomsFromSel(a), D = (0, y.getExtent)(T);
                (0, y.isEmptyObject)(a) ? (this.shapes.forEach((H) => {
                  if (H && H.boundingSphere && H.boundingSphere.center) {
                    var U = H.boundingSphere.center, V = H.boundingSphere.radius;
                    V > 0 ? (T.push(new f.Vector3(U.x + V, U.y, U.z)), T.push(new f.Vector3(U.x - V, U.y, U.z)), T.push(new f.Vector3(U.x, U.y + V, U.z)), T.push(new f.Vector3(U.x, U.y - V, U.z)), T.push(new f.Vector3(U.x, U.y, U.z + V)), T.push(new f.Vector3(U.x, U.y, U.z - V))) : T.push(U);
                  }
                }), D = (0, y.getExtent)(T), M = T, L = D) : (M = this.getAtomsFromSel({}), L = (0, y.getExtent)(M));
                var I = new f.Vector3(D[2][0], D[2][1], D[2][2]), z = L[1][0] - L[0][0], P = L[1][1] - L[0][1], B = L[1][2] - L[0][2], F = Math.hypot(z, P, B);
                F < 5 && (F = 5), this.slabNear = -F / 1.9, this.slabFar = F / 2, z = D[1][0] - D[0][0], P = D[1][1] - D[0][1], B = D[1][2] - D[0][2], F = Math.hypot(z, P, B), F < 5 && (F = 5);
                for (var N = 25, $ = 0; $ < T.length; $++)
                  if (T[$]) {
                    var k = I.distanceToSquared(T[$]);
                    k > N && (N = k);
                  }
                F = Math.sqrt(N) * 2;
                var G = I.clone().multiplyScalar(-1);
                return l > 0 ? this.animateMotion(l, g, G, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = G, 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(a = {}, l = 0, g = !1) {
                let M = this.getAtomsFromSel(a), L = (0, y.getExtent)(M), T = L;
                if ((0, y.isEmptyObject)(a)) {
                  let U = M && M.length;
                  if (this.shapes.forEach((V) => {
                    if (V && V.boundingSphere) {
                      if (V.boundingSphere.box) {
                        let oe = V.boundingSphere.box;
                        M.push(new f.Vector3(oe.min.x, oe.min.y, oe.min.z)), M.push(new f.Vector3(oe.max.x, oe.max.y, oe.max.z));
                      } else if (V.boundingSphere.center) {
                        var Q = V.boundingSphere.center, ae = V.boundingSphere.radius;
                        ae > 0 ? (M.push(new f.Vector3(Q.x + ae, Q.y, Q.z)), M.push(new f.Vector3(Q.x - ae, Q.y, Q.z)), M.push(new f.Vector3(Q.x, Q.y + ae, Q.z)), M.push(new f.Vector3(Q.x, Q.y - ae, Q.z)), M.push(new f.Vector3(Q.x, Q.y, Q.z + ae)), M.push(new f.Vector3(Q.x, Q.y, Q.z - ae))) : M.push(Q);
                      }
                    }
                  }), T = (0, y.getExtent)(M), !U)
                    for (let V = 0; V < 3; V++)
                      L[2][V] = (T[0][V] + T[1][V]) / 2;
                } else {
                  let U = this.getAtomsFromSel({});
                  T = (0, y.getExtent)(U);
                }
                var D = new f.Vector3(L[2][0], L[2][1], L[2][2]), I = T[1][0] - T[0][0], z = T[1][1] - T[0][1], P = T[1][2] - T[0][2], B = Math.hypot(I, z, P);
                B < 5 && (B = 5), this.slabNear = -B / 1.9, this.slabFar = B / 2, Object.keys(a).length === 0 && (this.slabNear = Math.min(-B * 2, -50), this.slabFar = Math.max(B * 2, 50));
                var F = this.config.minimumZoomToDistance || 5;
                I = L[1][0] - L[0][0], z = L[1][1] - L[0][1], P = L[1][2] - L[0][2], B = Math.hypot(I, z, P), B < F && (B = F);
                for (var N = F * F, $ = 0; $ < M.length; $++)
                  if (M[$]) {
                    var k = D.distanceToSquared(M[$]);
                    k > N && (N = k);
                  }
                B = Math.sqrt(N) * 2;
                var G = D.clone().multiplyScalar(-1), H = -(B * 0.5 / Math.tan(Math.PI / 180 * this.camera.fov / 2) - this.CAMERA_Z);
                return H = this.adjustZoomToLimits(H), l > 0 ? this.animateMotion(l, g, G, H, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = G, this.rotationGroup.position.z = H, 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(a, l) {
                this.slabNear = a, this.slabFar = l;
              }
              /**
               * 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(a, l = {}, g, M = !1) {
                if (g) {
                  var L = (0, y.getExtent)(this.getAtomsFromSel(g));
                  l.position = { x: L[2][0], y: L[2][1], z: L[2][2] };
                }
                var T = new E.Label(a, l);
                return T.setContext(), this.modelGroup.add(T.sprite), this.labels.push(T), M || this.show(), T;
              }
              /** 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(a, l, g = !1) {
                let M = this.labels.length;
                return this.applyToModels("addResLabels", a, this, l, g), 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(a, l, g) {
                return this.applyToModels("addPropertyLabels", a, l, this, g), 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(a) {
                for (var l = 0; l < this.labels.length; l++)
                  if (this.labels[l] == a) {
                    this.labels.splice(l, 1), a.dispose(), this.modelGroup.remove(a.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 a = 0; a < this.labels.length; a++)
                  this.labels[a] && this.labels[a].sprite && this.modelGroup.remove(this.labels[a].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(a, l) {
                return this.modelGroup.remove(a.sprite), a.dispose(), a.stylespec = l, a.setContext(), this.modelGroup.add(a.sprite), this.show(), a;
              }
              // Change label text
              /**
               * Modify existing label's text
               *
               * @param {Label}  label - $3Dmol label
               * @param {String}
               *            text - Label text
               * @return {Label}
               */
              setLabelText(a, l) {
                return this.modelGroup.remove(a.sprite), a.dispose(), a.text = l, a.setContext(), this.modelGroup.add(a.sprite), this.show(), a;
              }
              /**
               * Add shape object to viewer
               * @see {GLShape}
               *
               * @param {ShapeSpec} shapeSpec - style specification for label
               * @return {GLShape}
               */
              addShape(a) {
                a = a || {};
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, this.shapes.push(l), l;
              }
              /**
               * Remove shape object from viewer
               *
               * @param {GLShape} shape - Reference to shape object to remove
               */
              removeShape(a) {
                if (!a)
                  return this;
                for (a.removegl(this.modelGroup), delete this.shapes[a.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 a = 0; a < this.shapes.length; a++) {
                  var l = this.shapes[a];
                  l && l.removegl(this.modelGroup);
                }
                return this.shapes.splice(0, this.shapes.length), this;
              }
              //gets the center of the selection
              getSelectionCenter(a) {
                if (a.hasOwnProperty("x") && a.hasOwnProperty("y") && a.hasOwnProperty("z"))
                  return a;
                var l = this.getAtomsFromSel(a);
                if (l.length == 0)
                  return { x: 0, y: 0, z: 0 };
                var g = (0, y.getExtent)(l);
                return { x: g[0][0] + (g[1][0] - g[0][0]) / 2, y: g[0][1] + (g[1][1] - g[0][1]) / 2, z: g[0][2] + (g[1][2] - g[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(a) {
                a = a || {}, a.center = this.getSelectionCenter(a.center);
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, l.addSphere(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a = {}) {
                a.corner != null && (a.corner = this.getSelectionCenter(a.corner)), a.center != null && (a.center = this.getSelectionCenter(a.center));
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, l.addBox(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a = {}) {
                a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end);
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, l.addArrow(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a = {}) {
                a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end);
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, a.dashed ? l.addDashedCylinder(a) : l.addCylinder(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a = {}) {
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, l.addCurve(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a = {}) {
                a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end), a.wireframe = !0;
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, a.dashed ? l = this.addLineDashed(a, l) : l.addLine(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a, l) {
                a = this.getModel(a), l = l || { alabel: "a", blabel: "b", clabel: "c" }, l.box = l.box || {}, l.astyle = l.astyle || { color: "red", radius: 0.1, midpos: -1 }, l.bstyle = l.bstyle || { color: "green", radius: 0.1, midpos: -1 }, l.cstyle = l.cstyle || { color: "blue", radius: 0.1, midpos: -1 }, l.alabelstyle = l.alabelstyle || { fontColor: "red", showBackground: !1, alignment: "center", inFront: !1 }, l.blabelstyle = l.blabelstyle || { fontColor: "green", showBackground: !1, alignment: "center", inFront: !1 }, l.clabelstyle = l.clabelstyle || { fontColor: "blue", showBackground: !1, alignment: "center", inFront: !1 }, a.unitCellObjects && this.removeUnitCell(a), a.unitCellObjects = { shapes: [], labels: [] };
                var g = a.getCrystData(), M = null;
                if (g) {
                  if (g.matrix)
                    M = g.matrix;
                  else {
                    var L = g.a, T = g.b, D = g.c, I = g.alpha, z = g.beta, P = g.gamma;
                    I = I * Math.PI / 180, z = z * Math.PI / 180, P = P * Math.PI / 180;
                    var B, F, N;
                    B = Math.cos(z), F = (Math.cos(I) - Math.cos(z) * Math.cos(P)) / Math.sin(P), N = Math.sqrt(Math.max(0, 1 - B * B - F * F)), M = new f.Matrix3(L, T * Math.cos(P), D * B, 0, T * Math.sin(P), D * F, 0, 0, D * N);
                  }
                  var $ = [
                    new f.Vector3(0, 0, 0),
                    new f.Vector3(1, 0, 0),
                    new f.Vector3(0, 1, 0),
                    new f.Vector3(0, 0, 1),
                    new f.Vector3(1, 1, 0),
                    new f.Vector3(0, 1, 1),
                    new f.Vector3(1, 0, 1),
                    new f.Vector3(1, 1, 1)
                  ];
                  if (g.matrix4)
                    for (let G = 0; G < $.length; G++)
                      g.size && $[G].multiplyVectors($[G], g.size), $[G] = $[G].applyMatrix4(g.matrix4);
                  else
                    for (let G = 0; G < $.length; G++)
                      $[G] = $[G].applyMatrix3(M);
                  if (l.box && !l.box.hidden) {
                    l.box.wireframe = !0;
                    var k = new c.GLShape(l.box);
                    k.shapePosition = this.shapes.length, k.addLine({ start: $[0], end: $[1] }), k.addLine({ start: $[0], end: $[2] }), k.addLine({ start: $[1], end: $[4] }), k.addLine({ start: $[2], end: $[4] }), k.addLine({ start: $[0], end: $[3] }), k.addLine({ start: $[3], end: $[5] }), k.addLine({ start: $[2], end: $[5] }), k.addLine({ start: $[1], end: $[6] }), k.addLine({ start: $[4], end: $[7] }), k.addLine({ start: $[6], end: $[7] }), k.addLine({ start: $[3], end: $[6] }), k.addLine({ start: $[5], end: $[7] }), this.shapes.push(k), a.unitCellObjects.shapes.push(k), k.finalize();
                  }
                  if (!l.astyle.hidden) {
                    l.astyle.start = $[0], l.astyle.end = $[1];
                    let G = this.addArrow(l.astyle);
                    a.unitCellObjects.shapes.push(G);
                  }
                  if (!l.bstyle.hidden) {
                    l.bstyle.start = $[0], l.bstyle.end = $[2];
                    let G = this.addArrow(l.bstyle);
                    a.unitCellObjects.shapes.push(G);
                  }
                  if (!l.cstyle.hidden) {
                    l.cstyle.start = $[0], l.cstyle.end = $[3];
                    let G = this.addArrow(l.cstyle);
                    a.unitCellObjects.shapes.push(G);
                  }
                  if (l.alabel) {
                    l.alabelstyle.position = $[1];
                    let G = this.addLabel(l.alabel, l.alabelstyle);
                    a.unitCellObjects.labels.push(G);
                  }
                  if (l.blabel) {
                    l.blabelstyle.position = $[2];
                    let G = this.addLabel(l.blabel, l.blabelstyle);
                    a.unitCellObjects.labels.push(G);
                  }
                  if (l.clabel) {
                    l.clabelstyle.position = $[3];
                    let G = this.addLabel(l.clabel, l.clabelstyle);
                    a.unitCellObjects.labels.push(G);
                  }
                }
              }
              /**
              * 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(a) {
                if (a = this.getModel(a), a.unitCellObjects) {
                  let l = this;
                  a.unitCellObjects.shapes.forEach(function(g) {
                    l.removeShape(g);
                  }), a.unitCellObjects.labels.forEach(function(g) {
                    l.removeLabel(g);
                  });
                }
                delete a.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.
                @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(a = 3, l = a, g = l, M, L) {
                M = this.getModel(M);
                let T = M.getCrystData();
                if (T) {
                  const D = M.selectedAtoms({}), I = T.matrix;
                  let z = function(P) {
                    return P % 2 == 0 ? -P / 2 : Math.ceil(P / 2);
                  };
                  for (let P = 0; P < a; P++)
                    for (let B = 0; B < l; B++)
                      for (let F = 0; F < g; F++) {
                        if (P == 0 && B == 0 && F == 0)
                          continue;
                        let N = new f.Vector3(z(P), z(B), z(F));
                        N.applyMatrix3(I);
                        let $ = [];
                        for (let k = 0; k < D.length; k++) {
                          let G = {};
                          for (let H in D[k])
                            G[H] = D[k][H];
                          G.x += N.x, G.y += N.y, G.z += N.z, $.push(G);
                        }
                        M.addAtoms($);
                      }
                  L && M.assignBonds();
                }
              }
              /** Add dashed line to shape */
              addLineDashed(a, l) {
                a.dashLength = a.dashLength || 0.5, a.gapLength = a.gapLength || 0.5;
                var g;
                a.start ? g = new f.Vector3(a.start.x || 0, a.start.y || 0, a.start.z || 0) : g = new f.Vector3(0, 0, 0);
                var M;
                a.end ? M = new f.Vector3(a.end.x, a.end.y || 0, a.end.z || 0) : M = new f.Vector3(0, 0, 0);
                var L = new f.Vector3(), T = new f.Vector3(), D = new f.Vector3(), I, z, P, B = g.clone(), F = 0;
                for (L.subVectors(M, g), I = L.length(), L.normalize(), T = L.clone(), D = L.clone(), T.multiplyScalar(a.dashLength), D.multiplyScalar(a.gapLength), z = T.length(), P = D.length(); F < I; ) {
                  if (F + z > I) {
                    a.start = g, a.end = M, l.addLine(a);
                    break;
                  }
                  B.addVectors(g, T), a.start = g, a.end = B, l.addLine(a), g = B.clone(), F += z, B.addVectors(g, D), g = B.clone(), F += P;
                }
                return l.finalize(), l;
              }
              /**
              	     * 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(a) {
                a = a || {};
                var l = new c.GLShape(a);
                return l.shapePosition = this.shapes.length, l.addCustom(a), this.shapes.push(l), l.finalize(), l;
              }
              /**
              	     * 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(a, l, g = {}) {
                var M = new C.VolumeData(a, l);
                return g.hasOwnProperty("transferfn") ? this.addVolumetricRender(M, g) : this.addIsosurface(M, g);
              }
              /**
               * 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(a, l = {}, g) {
                var M = new c.GLShape(l);
                return M.shapePosition = this.shapes.length, M.addIsosurface(a, l, g), 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(a, l) {
                l = l || {};
                var g = new A.GLVolumetricRender(a, l);
                return g.shapePosition = this.shapes.length, this.shapes.push(g), g;
              }
              /**
               * 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(a) {
                a ? this.scene.fog = new n.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(a) {
                this.viewer_frame = a;
                let l = this;
                return new Promise(function(g) {
                  var M = l.models.map(function(L) {
                    return L.setFrame(a, l);
                  });
                  Promise.all(M).then(function() {
                    g();
                  });
                });
              }
              /**
               * 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 a = 0;
                for (let l = 0; l < this.models.length; l++)
                  this.models[l].getNumFrames() > a && (a = this.models[l].getNumFrames());
                for (let l = 0; l < this.shapes.length; l++)
                  this.shapes[l].frame && this.shapes[l].frame >= a && (a = this.shapes[l].frame + 1);
                for (let l = 0; l < this.labels.length; l++)
                  this.labels[l].frame && this.labels[l].frame >= a && (a = this.labels[l].frame + 1);
                return a;
              }
              /**
               * 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(a) {
                this.incAnim();
                var l = 100, g = "forward", M = 0;
                a = a || {}, a.interval && (l = a.interval), a.loop && (g = a.loop), a.reps && (M = a.reps);
                var L = this.getNumFrames(), T = this, D = 0;
                a.startFrame && (D = a.startFrame % L);
                var I = 1;
                a.step && (I = a.step, M /= I);
                var z = 0, P = L * M, B = /* @__PURE__ */ new Date(), F, N, $ = function(k) {
                  B = /* @__PURE__ */ new Date(), k == "forward" ? T.setFrame(D).then(function() {
                    D = (D + I) % L, F();
                  }) : k == "backward" ? T.setFrame(L - 1 - D).then(function() {
                    D = (D + I) % L, F();
                  }) : T.setFrame(D).then(function() {
                    D += I, I *= D % (L - 1) == 0 ? -1 : 1, F();
                  });
                };
                return F = function() {
                  if (T.render(), !T.getCanvas().isConnected)
                    T.stopAnimate();
                  else if (++z == P || !T.isAnimated())
                    N.cancel(), T.animationTimers.delete(N), T.decAnim();
                  else {
                    var k = l - ((/* @__PURE__ */ new Date()).getTime() - B.getTime());
                    k = k > 0 ? k : 0, T.animationTimers.delete(N), N = new y.PausableTimer($, k, g), T.animationTimers.add(N);
                  }
                }, N = new y.PausableTimer($, 0, g), this.animationTimers.add(N), this;
              }
              /**
               * Stop animation of all models in viewer
               */
              stopAnimate() {
                return this.animated = 0, this.animationTimers.forEach(function(a) {
                  a.cancel();
                }), this.animationTimers = /* @__PURE__ */ new Set(), this;
              }
              /**
               * Pause animation of all models in viewer
               */
              pauseAnimate() {
                return this.animationTimers.forEach(function(a) {
                  a.pause();
                }), this;
              }
              /**
               * Resume animation of all models in viewer
               */
              resumeAnimate() {
                return this.animationTimers.forEach(function(a) {
                  a.resume();
                }), this;
              }
              /**
               * Return true if viewer is currently being animated, false otherwise
               * @return {boolean}
               */
              isAnimated() {
                return this.animated > 0;
              }
              /**
              	     * 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(a, l = "", g) {
                g && !g.defaultcolors ? (g.defaultcolors = this.defaultcolors, g.cartoonQuality = g.cartoonQuality || this.config.cartoonQuality) : typeof g > "u" && (g = { defaultcolors: this.defaultcolors, cartoonQuality: this.config.cartoonQuality });
                var M = new _.GLModel(this.models.length, g);
                return M.addMolData(a, l, g), 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(a, l, g) {
                g = g || {}, g.multimodel = !0, g.frames = !0;
                for (var M = _.GLModel.parseMolData(a, l, g), L = 0; L < M.length; L++) {
                  var T = new _.GLModel(this.models.length, this.defaultcolors);
                  T.setAtomDefaults(M[L]), T.addFrame(M[L]), T.setFrame(0), M.modelData && T.setModelData(M.modelData[L]), T.setDontDuplicateAtoms(!g.duplicateAssemblyAtoms), this.models.push(T);
                }
                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(a, l, g) {
                g = g || {}, g.multimodel = !0, g.frames = !0;
                var M = new _.GLModel(this.models.length, this.defaultcolors);
                return M.addMolData(a, l, g), 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(a, l, g) {
                g = g || {}, g.multimodel = !0, g.onemol = !0;
                var M = new _.GLModel(this.models.length, this.defaultcolors);
                return M.addMolData(a, l, g), this.models.push(M), M;
              }
              /**
               * Delete specified model from viewer
               *
               * @param {GLModel|number} model
               */
              removeModel(a) {
                if (a = this.getModel(a), !!a) {
                  for (a.removegl(this.modelGroup), delete this.models[a.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 a = 0; a < this.models.length; a++) {
                  var l = this.models[a];
                  l && l.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(a, l) {
                var g = {};
                return l === void 0 ? g.m = this.models.map(function(M) {
                  return M.toCDObject(a);
                }) : g.m = [this.models[l].toCDObject()], JSON.stringify(g);
              }
              /** return a VRML string representation of the scene.  Include VRML header information
               * @return VRML
               */
              exportVRML() {
                var a = this.modelGroup;
                this.applyToModels("removegl", this.modelGroup), this.modelGroup = new n.Object3D(), this.render(null, { supportsImposters: !1, supportsAIA: !1, regen: !0 });
                var l = `#VRML V2.0 utf8
` + this.modelGroup.vrml() + `
`;
                return this.applyToModels("removegl", this.modelGroup), this.modelGroup = a, l;
              }
              /**
               * 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(a, l = !1) {
                for (var g = new _.GLModel(this.models.length, this.defaultcolors), M = 0; M < this.models.length; M++)
                  if (this.models[M]) {
                    var L = this.models[M].selectedAtoms(a);
                    g.addAtoms(L), l && this.models[M].removeAtoms(L);
                  }
                return this.models.push(g), g;
              }
              applyToModels(a, l, g, M, L, T, D) {
                for (var I = this.getModelList(l), z = 0; z < I.length; z++)
                  I[z][a](l, g, M, L, T, D);
              }
              setStyle(a, l) {
                return typeof l > "u" && (l = a, a = {}), this.applyToModels("setStyle", a, l, !1), this;
              }
              addStyle(a, l) {
                return typeof l > "u" && (l = a, a = {}), this.applyToModels("setStyle", a, l, !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(a, l, g) {
                return this.applyToModels("setClickable", a, l, g), 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(a, l, g, M) {
                return this.applyToModels("setHoverable", a, l, g, 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(a, l) {
                return this.applyToModels("enableContextMenu", a, l), 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(a, l, g, M) {
                return this.applyToModels("vibrate", a, l, g, this, M), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {string} prop
               * @param {Gradient|string} scheme
               * @param {object} range
               */
              setColorByProperty(a, l, g, M) {
                return this.applyToModels("setColorByProperty", a, l, g, M), this;
              }
              /**
               * @param {AtomSelectionSpec} sel
               * @param {object} colors
               */
              setColorByElement(a, l) {
                return this.applyToModels("setColorByElement", a, l), this;
              }
              /**
               *
               * @param {AtomSpec[]} atomlist
               * @param {Array}
               *            extent
               * @return {Array}
               */
              static getAtomsWithin(a, l) {
                var g = [];
                for (let L = 0; L < a.length; L++) {
                  var M = a[L];
                  typeof M > "u" || M.x < l[0][0] || M.x > l[1][0] || M.y < l[0][1] || M.y > l[1][1] || M.z < l[0][2] || M.z > l[1][2] || g.push(M);
                }
                return g;
              }
              // return volume of extent
              static volume(a) {
                var l = a[1][0] - a[0][0], g = a[1][1] - a[0][1], M = a[1][2] - a[0][2];
                return l * g * 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(a, l, g) {
                let M = [], L = {};
                for (let B = 0, F = l.length; B < F; B++)
                  L[l[B].index] = B;
                let T = function(B) {
                  let F = [];
                  for (let N = 0, $ = B.length; N < $; N++)
                    B[N].index in L && F.push(L[B[N].index]);
                  return F;
                }, D = 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;
                }, I = function(B) {
                  if (s.volume(B) < s.maxVolume)
                    return [B];
                  var F = B[1][0] - B[0][0], N = B[1][1] - B[0][1], $ = B[1][2] - B[0][2], k;
                  F > N && F > $ ? k = 0 : N > F && N > $ ? k = 1 : k = 2;
                  var G = D(B), H = D(B), U = (B[1][k] - B[0][k]) / 2 + B[0][k];
                  G[1][k] = U, H[0][k] = U;
                  var V = I(G), Q = I(H);
                  return V.concat(Q);
                }, z = I(a), P = 6;
                for (let B = 0, F = z.length; B < F; B++) {
                  let N = D(z[B]);
                  N[0][0] -= P, N[0][1] -= P, N[0][2] -= P, N[1][0] += P, N[1][1] += P, N[1][2] += P;
                  let $ = s.getAtomsWithin(l, N), k = s.getAtomsWithin(g, z[B]);
                  M.push({
                    extent: z[B],
                    atoms: T($),
                    toshow: T(k)
                  });
                }
                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(a, l, g) {
                var M = new n.Geometry(!0), L = M.updateGeoGroup(0), T = [];
                for (let Me = 0, Te = a.length; Me < Te; Me++) {
                  var D = a[Me];
                  D && (typeof D.surfaceColor < "u" ? T[Me] = D.surfaceColor : D.color && (T[Me] = u.CC.color(D.color)));
                }
                var I = L.vertexArray, z = l.vertices;
                for (let Me = 0, Te = z.length; Me < Te; Me++) {
                  let se = L.vertices * 3;
                  I[se] = z[Me].x, I[se + 1] = z[Me].y, I[se + 2] = z[Me].z, L.vertices++;
                }
                var P = L.colorArray;
                if (g.voldata && g.volscheme) {
                  var B = g.volscheme, F = g.voldata, N = B.range() || [-1, 1];
                  for (let Me = 0, Te = z.length; Me < Te; Me++) {
                    let se = F.getVal(z[Me].x, z[Me].y, z[Me].z), pe = u.CC.color(B.valueToHex(se, N)), we = Me * 3;
                    P[we] = pe.r, P[we + 1] = pe.g, P[we + 2] = pe.b;
                  }
                } else if (T.length > 0)
                  for (let Me = 0, Te = z.length; Me < Te; Me++) {
                    let se = z[Me].atomid, pe = Me * 3;
                    P[pe] = T[se].r, P[pe + 1] = T[se].g, P[pe + 2] = T[se].b;
                  }
                var $ = l.faces;
                L.faceidx = $.length, M.initTypedArrays();
                var k = L.vertexArray, G = L.normalArray, H, U, V, Q;
                for (let Me = 0, Te = $.length; Me < Te; Me += 3) {
                  var ae = $[Me], oe = $[Me + 1], q = $[Me + 2], me = ae * 3, ne = oe * 3, fe = q * 3;
                  H = new f.Vector3(k[me], k[me + 1], k[me + 2]), U = new f.Vector3(k[ne], k[ne + 1], k[ne + 2]), V = new f.Vector3(k[fe], k[fe + 1], k[fe + 2]), V.subVectors(V, U), H.subVectors(H, U), V.cross(H), Q = V, Q.normalize(), G[me] += Q.x, G[ne] += Q.x, G[fe] += Q.x, G[me + 1] += Q.y, G[ne + 1] += Q.y, G[fe + 1] += Q.y, G[me + 2] += Q.z, G[ne + 2] += Q.z, G[fe + 2] += Q.z;
                }
                L.faceArray = new Uint16Array($);
                var Ce = new n.Mesh(M, g);
                return Ce;
              }
              // 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(a, l, g, M, L, T) {
                var D = new b.ProteinSurface();
                return D.initparm(l, a !== 1, T), D.fillvoxels(L, g), D.buildboundary(), (a == b.SurfaceType.SES || a == b.SurfaceType.MS) && (D.fastdistancemap(), D.boundingatom(!1), D.fillvoxelswaals(L, g)), D.marchingcube(a), D.getFacesAndVertices(M);
              }
              /*
               *
               * @param {SurfaceStyleSpec}
               *            style
               * @return {MeshLambertMaterial}
               */
              static getMatWithStyle(a) {
                var l = new n.MeshLambertMaterial();
                l.vertexColors = n.Coloring.VertexColors;
                for (var g in a)
                  g === "color" || g === "map" || a.hasOwnProperty(g) && (l[g] = a[g]);
                return a.opacity !== void 0 && (a.opacity === 1 ? l.transparent = !1 : l.transparent = !0), l;
              }
              /**
               * Adds an explicit mesh as a surface object.
               * @param {Mesh}
               *            mesh
               * @param {Object}
               *            style
               * @returns {number} surfid
               */
              addMesh(a) {
                var l = {
                  geo: a.geometry,
                  mat: a.material,
                  done: !0,
                  finished: !1
                  //the rendered finishes surfaces when they are done
                }, g = this.nextSurfID();
                return this.surfaces[g] = l, g;
              }
              //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(a) {
                var l = [];
                let g = a.length;
                for (let M = 0; M < g; M++)
                  l[M] = (0, y.extend)({}, a[M]);
                return l;
              }
              /**
               * 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(a, l = {}, g = {}, M, L, T) {
                let D = this.nextSurfID(), I = null, z = this, P = b.SurfaceType.VDW;
                typeof a == "string" ? s.surfaceTypeMap[a.toUpperCase()] !== void 0 ? P = s.surfaceTypeMap[a] : console.log("Surface type : " + a + " is not recognized") : typeof a == "number" && (P = a);
                var B = null, F = null, N = s.shallowCopy(this.getAtomsFromSel(g));
                M ? B = s.shallowCopy(this.getAtomsFromSel(M)) : B = N, (0, y.adjustVolumeStyle)(l);
                var $ = !1, k;
                for (k = 0; k < this.models.length; k++)
                  if (this.models[k]) {
                    var G = this.models[k].getSymmetries();
                    if (G.length > 1 || G.length == 1 && !G[0].isIdentity()) {
                      $ = !0;
                      break;
                    }
                  }
                var H = function(me, ne, fe) {
                  L ? F = s.shallowCopy(z.getAtomsFromSel(L)) : F = fe;
                  var Ce, Me = (0, y.getExtent)(fe, !0);
                  if (l.map && l.map.prop) {
                    var Te = l.map.prop;
                    let Se = (0, h.getGradient)(l.map.scheme || l.map.gradient || new h.Gradient.RWB()), ze = Se.range();
                    ze || (ze = (0, y.getPropertyRange)(fe, Te)), l.colorscheme = { prop: Te, gradient: Se };
                  }
                  for (let Se = 0, ze = ne.length; Se < ze; Se++)
                    Ce = ne[Se], Ce.surfaceColor = (0, y.getColorFromStyle)(Ce, l);
                  var se = s.volume(Me), pe = z.carveUpExtent(Me, ne, fe);
                  if (F && F.length && F.length > 0) {
                    var we = (0, y.getExtent)(F, !0), ke = function(Se, ze) {
                      var He = function(K, ee) {
                        var de = K.extent, ve = de[1][0] - de[0][0], Ie = de[1][1] - de[0][1], Re = de[1][2] - de[0][2], Z = ve - ee[2][0];
                        Z *= Z;
                        var ce = Ie - ee[2][1];
                        ce *= ce;
                        var Ae = Re - ee[2][2];
                        return Ae *= Ae, Z + ce + Ae;
                      }, We = He(Se, we), Y = He(ze, we);
                      return We - Y;
                    };
                    pe.sort(ke);
                  }
                  var Ue = [];
                  for (let Se = 0, ze = ne.length; Se < ze; Se++)
                    Ce = ne[Se], Ue[Se] = {
                      x: Ce.x,
                      y: Ce.y,
                      z: Ce.z,
                      serial: Se,
                      elem: Ce.elem
                    };
                  var Ne = !!b.syncSurface;
                  if (Ne) {
                    var Be = function(ze) {
                      return new Promise(function(He) {
                        for (var We = s.generateMeshSyncHelper(P, pe[ze].extent, pe[ze].atoms, pe[ze].toshow, Ue, se), Y = (0, c.splitMesh)({ vertexArr: We.vertices, faceArr: We.faces }), K = 0, ee = Y.length; K < ee; K++) {
                          We = {
                            vertices: Y[K].vertexArr,
                            faces: Y[K].faceArr
                          };
                          var de = s.generateSurfaceMesh(ne, We, I);
                          (0, y.mergeGeos)(me.geo, de);
                        }
                        z.render(), He();
                      });
                    }, ue = [];
                    for (let Se = 0; Se < pe.length; Se++)
                      ue.push(Be(Se));
                    return Promise.all(ue).then(function() {
                      return me.done = !0, Promise.resolve(D);
                    });
                  } else {
                    var ye = [];
                    P < 0 && (P = 0);
                    for (let Se = 0, ze = s.numWorkers; Se < ze; Se++) {
                      var ge = new Worker($3Dmol.SurfaceWorker);
                      ye.push(ge), ge.postMessage({
                        type: -1,
                        atoms: Ue,
                        volume: se
                      });
                    }
                    return new Promise(function(Se, ze) {
                      var He = 0, We = function() {
                        !ye || !ye.length || ye.forEach(function(de) {
                          de && de.terminate && de.terminate();
                        });
                      }, Y = function(de) {
                        for (var ve = (0, c.splitMesh)({
                          vertexArr: de.data.vertices,
                          faceArr: de.data.faces
                        }), Ie = 0, Re = ve.length; Ie < Re; Ie++) {
                          var Z = {
                            vertices: ve[Ie].vertexArr,
                            faces: ve[Ie].faceArr
                          }, ce = s.generateSurfaceMesh(ne, Z, I);
                          (0, y.mergeGeos)(me.geo, ce);
                        }
                        z.render(), He++, He == pe.length && (me.done = !0, We(), Se(D));
                      }, K = function(de) {
                        We(), console.log(de.message + " (" + de.filename + ":" + de.lineno + ")"), ze(de);
                      };
                      for (let de = 0; de < pe.length; de++) {
                        var ee = ye[de % ye.length];
                        ee.onmessage = Y, ee.onerror = K, ee.postMessage({
                          type: P,
                          expandedExtent: pe[de].extent,
                          extendedAtoms: pe[de].atoms,
                          atomsToShow: pe[de].toshow
                        });
                      }
                    });
                  }
                };
                l = l || {}, I = s.getMatWithStyle(l);
                var U = [];
                U.style = l, U.atomsel = g, U.allsel = M, U.focus = L;
                var V = null;
                if ($) {
                  var Q = {}, ae = {};
                  for (k = 0; k < this.models.length; k++)
                    Q[k] = [], ae[k] = [];
                  for (k = 0; k < B.length; k++)
                    Q[B[k].model].push(B[k]);
                  for (k = 0; k < N.length; k++)
                    ae[N[k].model].push(N[k]);
                  var oe = [];
                  for (k = 0; k < this.models.length; k++)
                    ae[k].length > 0 && (U.push({
                      geo: new n.Geometry(!0),
                      mat: I,
                      done: !1,
                      finished: !1,
                      symmetries: this.models[k].getSymmetries()
                      // also webgl initialized
                    }), oe.push(H(U[U.length - 1], Q[k], ae[k])));
                  V = Promise.all(oe);
                } else
                  U.push({
                    geo: new n.Geometry(!0),
                    mat: I,
                    done: !1,
                    finished: !1,
                    symmetries: [new f.Matrix4()]
                  }), V = H(U[U.length - 1], B, N);
                return this.surfaces[D] = U, V.surfid = D, T && typeof T == "function" ? (V.then(function(q) {
                  T(q);
                }), D) : V;
              }
              /**
               * 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(a, l) {
                if ((0, y.adjustVolumeStyle)(l), this.surfaces[a]) {
                  var g = this.surfaces[a];
                  g.style = l;
                  for (var M = 0; M < g.length; M++) {
                    var L = g[M].mat = s.getMatWithStyle(l);
                    if (g[M].mat.side = n.FrontSide, l.color) {
                      g[M].mat.color = l.color, g[M].geo.colorsNeedUpdate = !0;
                      const T = u.CC.color(l.color);
                      g[M].geo.setColors(function() {
                        return T;
                      });
                    } else if (L.voldata && L.volscheme) {
                      const T = L.volscheme, D = L.voldata, I = u.CC, z = T.range() || [-1, 1];
                      g[M].geo.setColors(function(P, B, F) {
                        let N = D.getVal(P, B, F);
                        return I.color(T.valueToHex(N, z));
                      });
                    }
                    g[M].finished = !1;
                  }
                }
                return this;
              }
              /**
               * Return surface object
               * @param {number} surf - surface id
               */
              getSurface(a) {
                return this.surfaces[a];
              }
              /**
               * Remove surface with given ID
               * @param {number} surf - surface id
               */
              removeSurface(a) {
                for (var l = this.surfaces[a], g = 0; g < l.length; g++)
                  l[g] && l[g].lastGL && (l[g].geo !== void 0 && l[g].geo.dispose(), l[g].mat !== void 0 && l[g].mat.dispose(), this.modelGroup.remove(l[g].lastGL));
                return delete this.surfaces[a], this.show(), this;
              }
              /** Remove all surfaces.
               **/
              removeAllSurfaces() {
                for (var a in this.surfaces)
                  if (this.surfaces.hasOwnProperty(a)) {
                    for (var l = this.surfaces[a], g = 0; g < l.length; g++)
                      l[g] && l[g].lastGL && (l[g].geo !== void 0 && l[g].geo.dispose(), l[g].mat !== void 0 && l[g].mat.dispose(), this.modelGroup.remove(l[g].lastGL));
                    delete this.surfaces[a];
                  }
                return this.show(), this;
              }
              /** return Jmol moveto command to position this scene */
              jmolMoveTo() {
                var a = this.modelGroup.position, l = "center { " + -a.x + " " + -a.y + " " + -a.z + " }; ", g = this.rotationGroup.quaternion;
                return l += "moveto .5 quaternion { " + g.x + " " + g.y + " " + g.z + " " + g.w + " };", l;
              }
              /** 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(a, l) {
                l = l || {};
                var g = this.getAtomsFromSel(l);
                if (typeof a == "function")
                  for (let T = 0, D = g.length; T < D; T++) {
                    let I = g[T];
                    a(I);
                  }
                else
                  for (let T = 0, D = g.length; T < D; T++) {
                    var M = g[T];
                    for (let I = 0, z = a.length; I < z; I++) {
                      let P = a[I];
                      if (P.props)
                        for (var L in P.props)
                          P.props.hasOwnProperty(L) && this.atomIsSelected(M, P) && (M.properties || (M.properties = {}), M.properties[L] = P.props[L]);
                    }
                  }
                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(a) {
                return this.linkedViewers.push(a), 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(a) {
                this.rotationGroup.position.z = this.CAMERA_Z - a;
              }
              /**
               * Used for setting an approx value of eyeSeparation. Created for calling by StereoViewer object
               * @return {number} camera x position
               */
              setAutoEyeSeparation(a, l) {
                var g = this.getPerceivedDistance();
                return l || (l = 5), a || this.camera.position.x > 0 ? this.camera.position.x = g * Math.tan(Math.PI / 180 * l) : this.camera.position.x = -g * Math.tan(Math.PI / 180 * l), this.camera.lookAt(new f.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(a) {
                this.config.cartoonQuality = a;
              }
            }
            s.numWorkers = 4, s.maxVolume = 64e3, s.surfaceTypeMap = {
              VDW: b.SurfaceType.VDW,
              MS: b.SurfaceType.MS,
              SAS: b.SurfaceType.SAS,
              SES: b.SurfaceType.SES
            };
            function o(v, a) {
              if (v = (0, y.getElement)(v), !!v) {
                a = a || {};
                try {
                  var l = new s(v, a);
                  return l;
                } catch (g) {
                  throw "error creating viewer: " + g;
                }
              }
            }
            function w(v, a = {}, l = {}) {
              if (v = (0, y.getElement)(v), !!v) {
                var g = [], M = document.createElement("canvas");
                l.rows = a.rows, l.cols = a.cols, l.control_all = a.control_all != null ? a.control_all : !1, v.appendChild(M);
                try {
                  for (var L = 0; L < a.rows; L++) {
                    for (var T = [], D = 0; D < a.cols; D++) {
                      l.row = L, l.col = D, l.canvas = M, l.viewers = g, l.control_all = a.control_all;
                      var I = o(v, (0, y.extend)({}, l));
                      T.push(I);
                    }
                    g.unshift(T);
                  }
                } catch (z) {
                  throw "error creating viewer grid: " + z;
                }
                return g;
              }
            }
            function p(v) {
              var a = this;
              if (v = (0, y.getElement)(v), !!v) {
                var l = w(v, { rows: 1, cols: 2, control_all: !0 });
                this.glviewer1 = l[0][0], this.glviewer2 = l[0][1], this.glviewer1.setAutoEyeSeparation(!1), this.glviewer2.setAutoEyeSeparation(!0), this.glviewer1.linkViewer(this.glviewer2), this.glviewer2.linkViewer(this.glviewer1);
                for (var g = Object.getOwnPropertyNames(this.glviewer1.__proto__).filter(function(L) {
                  return typeof a.glviewer1[L] == "function";
                }), M = 0; M < g.length; M++)
                  this[g[M]] = function(L) {
                    return function() {
                      var T = this.glviewer1[L].apply(this.glviewer1, arguments), D = this.glviewer2[L].apply(this.glviewer2, arguments);
                      return [T, D];
                    };
                  }(g[M]);
                this.setCoordinates = function(L, T, D) {
                  for (var I = 0; I < L.length; I++)
                    L[I].setCoordinates(T, D);
                }, this.surfacesFinished = function() {
                  return this.glviewer1.surfacesFinished() && this.glviewer2.surfacesFinished();
                }, this.isAnimated = function() {
                  return this.glviewer1.isAnimated() || this.glviewer2.isAnimated();
                }, this.render = function(L) {
                  this.glviewer1.render(), this.glviewer2.render(), L && L(this);
                }, this.getCanvas = function() {
                  return this.glviewer1.getCanvas();
                };
              }
            }
          }
        ),
        /***/
        "./src/Gradient.ts": (
          /*!*************************!*\
            !*** ./src/Gradient.ts ***!
            \*************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CustomLinear: () => (
                /* binding */
                c
              ),
              /* harmony export */
              Gradient: () => (
                /* binding */
                b
              ),
              /* harmony export */
              GradientType: () => (
                /* binding */
                f
              ),
              /* harmony export */
              ROYGB: () => (
                /* binding */
                _
              ),
              /* harmony export */
              RWB: () => (
                /* binding */
                h
              ),
              /* harmony export */
              Sinebow: () => (
                /* binding */
                E
              ),
              /* harmony export */
              builtinGradients: () => (
                /* binding */
                C
              ),
              /* harmony export */
              getGradient: () => (
                /* binding */
                y
              ),
              /* harmony export */
              normalizeValue: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./colors */
              "./src/colors.ts"
            );
            class f {
            }
            function u(A, S, s) {
              return S >= A ? (s < A && (s = A), s > S && (s = S), { lo: A, hi: S, val: s }) : (s > A && (s = A), s < S && (s = S), s = A - s + S, { lo: S, hi: A, val: s });
            }
            function y(A) {
              if (A instanceof f)
                return A;
              if (A.gradient !== void 0 && C[A.gradient]) {
                let S = A.min === void 0 ? -1 : A.min, s = A.max === void 0 ? 1 : A.max;
                return A.mid === void 0 ? A.colors === void 0 ? new C[A.gradient](S, s) : new C[A.gradient](S, s, A.colors) : new C[A.gradient](S, s, A.mid);
              }
              return A;
            }
            class h extends f {
              constructor(S, s, o) {
                super(), this.gradient = "RWB", this.mult = 1, this.mid = o, this.min = S, this.max = s, typeof s > "u" && Array.isArray(S) && S.length >= 2 ? (this.max = S[1], this.min = S[0]) : S && s && !Array.isArray(S) && (this.min = S, this.max = s);
              }
              //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(S, s) {
                var o, w;
                if (S = this.mult * S, s ? (o = s[0], w = s[1]) : (o = this.min, w = this.max), S === void 0)
                  return 16777215;
                var p = u(o, w, S);
                o = p.lo, w = p.hi, S = p.val;
                var v = (w + o) / 2;
                s && typeof s[2] < "u" ? v = s[2] : typeof this.mid < "u" ? v = this.mid : v = (o + w) / 2;
                var a, l;
                return S < v ? (a = Math.floor(255 * Math.sqrt((S - o) / (v - o))), l = 16711680 + 256 * a + a, l) : S > v ? (a = Math.floor(255 * Math.sqrt(1 - (S - v) / (w - v))), l = 65536 * a + 256 * a + 255, l) : 16777215;
              }
            }
            class _ extends f {
              constructor(S, s) {
                super(), this.gradient = "ROYGB", this.mult = 1, this.min = S, this.max = s, typeof s > "u" && Array.isArray(S) && S.length >= 2 ? (this.max = S[1], this.min = S[0]) : S && s && !Array.isArray(S) && (this.min = S, this.max = s);
              }
              //map value to hex color, range is provided
              valueToHex(S, s) {
                var o, w;
                if (S = this.mult * S, s ? (o = s[0], w = s[1]) : (o = this.min, w = this.max), typeof S > "u")
                  return 16777215;
                var p = u(o, w, S);
                o = p.lo, w = p.hi, S = p.val;
                var v = (o + w) / 2, a = (o + v) / 2, l = (v + w) / 2, g, M;
                return S < a ? (g = Math.floor(255 * Math.sqrt((S - o) / (a - o))), M = 16711680 + 256 * g + 0, M) : S < v ? (g = Math.floor(255 * Math.sqrt(1 - (S - a) / (v - a))), M = 65536 * g + 65280 + 0, M) : S < l ? (g = Math.floor(255 * Math.sqrt((S - v) / (l - v))), M = 65280 + 1 * g, M) : (g = Math.floor(255 * Math.sqrt(1 - (S - l) / (w - l))), M = 0 + 256 * g + 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 f {
              constructor(S, s) {
                super(), this.gradient = "Sinebow", this.mult = 1, this.min = S, this.max = s, typeof s > "u" && Array.isArray(S) && S.length >= 2 && (this.max = S[1], this.min = S[0]), s < S && (this.mult = -1, this.min *= -1, this.max *= -1);
              }
              //map value to hex color, range is provided
              valueToHex(S, s) {
                var o, w;
                if (S = this.mult * S, s ? (o = s[0], w = s[1]) : (o = this.min, w = this.max), typeof S > "u")
                  return 16777215;
                var p = b.normalizeValue(o, w, S);
                o = p.lo, w = p.hi, S = p.val;
                var v = (S - o) / (w - o), a = 5 * v / 6 + 0.5, l = Math.sin(Math.PI * a);
                l *= l * 255;
                var g = Math.sin(Math.PI * (a + 1 / 3));
                g *= g * 255;
                var M = Math.sin(Math.PI * (a + 2 / 3));
                return M *= M * 255, 65536 * Math.floor(l) + 256 * Math.floor(M) + 1 * Math.floor(g);
              }
              //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 c extends f {
              constructor(S, s, o) {
                super(), this.gradient = "linear", this.colors = new Array();
                var w;
                if (Array.isArray(S) && S.length >= 2 ? (this.max = S[1], this.min = S[0], w = s) : (this.min = S, this.max = s, w = o), w)
                  for (let p of w)
                    this.colors.push(n.CC.color(p));
                else
                  this.colors.push(n.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(S, s) {
                var o, w;
                if (s ? (o = s[0], w = s[1]) : (o = this.min, w = this.max), S === void 0)
                  return 16777215;
                var p = u(o, w, S);
                o = p.lo, w = p.hi, S = p.val;
                let v = this.colors.length, a = (w - o) / v, l = Math.min(Math.floor((S - o) / a), v - 1), g = Math.min(l + 1, v - 1), M = (S - o - l * a) / a, L = this.colors[l], T = this.colors[g];
                return new n.Color(L.r + M * (T.r - L.r), L.g + M * (T.g - L.g), L.b + M * (T.b - L.b)).getHex();
              }
            }
            const C = {
              rwb: h,
              RWB: h,
              roygb: _,
              ROYGB: _,
              sinebow: E,
              linear: c
            };
            class b extends f {
              valueToHex(S, s) {
                return 0;
              }
              range() {
                return null;
              }
            }
            b.RWB = h, b.ROYGB = _, b.Sinebow = E, b.CustomLinear = c, b.builtinGradients = C, b.normalizeValue = u, b.getGradient = y;
          }
        ),
        /***/
        "./src/Label.ts": (
          /*!**********************!*\
            !*** ./src/Label.ts ***!
            \**********************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Label: () => (
                /* binding */
                E
              ),
              /* harmony export */
              LabelCount: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), u = t(
              /*! ./colors */
              "./src/colors.ts"
            );
            let y = 0;
            function h(c, C, b, A, S, s, o) {
              c.beginPath(), c.moveTo(C + s, b), c.lineTo(C + A - s, b), c.quadraticCurveTo(C + A, b, C + A, b + s), c.lineTo(C + A, b + S - s), c.quadraticCurveTo(C + A, b + S, C + A - s, b + S), c.lineTo(C + s, b + S), c.quadraticCurveTo(C, b + S, C, b + S - s), c.lineTo(C, b + s), c.quadraticCurveTo(C, b, C + s, b), c.closePath(), c.fill(), o && c.stroke();
            }
            function _(c, C, b) {
              var A = b;
              return typeof c < "u" && (c instanceof u.Color ? A = c.scaled() : (A = u.CC.color(c), typeof A.scaled < "u" && (A = A.scaled()))), typeof C < "u" && (A.a = parseFloat(C)), A;
            }
            class E {
              constructor(C, b) {
                this.id = y++, this.stylespec = b || {}, this.canvas = document.createElement("canvas"), this.canvas.width = 134, this.canvas.height = 35, this.context = this.canvas.getContext("2d"), this.sprite = new n.Sprite(), this.text = C, this.frame = this.stylespec.frame;
              }
              getStyle() {
                return this.stylespec;
              }
              setContext() {
                var C = this.stylespec, b = typeof C.useScreen > "u" ? !1 : C.useScreen, A = C.showBackground;
                (A === "0" || A === "false") && (A = !1), typeof A > "u" && (A = !0);
                var S = C.font ? C.font : "sans-serif", s = parseInt(C.fontSize) ? parseInt(C.fontSize) : 18, o = _(C.fontColor, C.fontOpacity, {
                  r: 255,
                  g: 255,
                  b: 255,
                  a: 1
                }), w = C.padding ? C.padding : 4, p = C.borderThickness ? C.borderThickness : 0, v = _(C.backgroundColor, C.backgroundOpacity, {
                  r: 0,
                  g: 0,
                  b: 0,
                  a: 1
                }), a = _(C.borderColor, C.borderOpacity, v), l = C.position ? C.position : {
                  x: -10,
                  y: 1,
                  z: 1
                }, g = C.inFront !== void 0 ? C.inFront : !0;
                (g === "false" || g === "0") && (g = !1);
                var M = C.alignment || n.SpriteAlignment.topLeft;
                typeof M == "string" && M in n.SpriteAlignment && (M = n.SpriteAlignment[M]);
                var L = "";
                C.bold && (L = "bold "), this.context.font = L + s + "px  " + S;
                var T = this.context.measureText(this.text), D = T.width;
                A || (p = 0);
                var I = D + 2.5 * p + 2 * w, z = s * 1.25 + 2 * p + 2 * w;
                if (C.backgroundImage) {
                  var P = C.backgroundImage, B = C.backgroundWidth ? C.backgroundWidth : P.width, F = C.backgroundHeight ? C.backgroundHeight : P.height;
                  B > I && (I = B), F > z && (z = F);
                }
                if (this.canvas.width = I, this.canvas.height = z, this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), L = "", C.bold && (L = "bold "), this.context.font = L + s + "px  " + S, this.context.fillStyle = "rgba(" + v.r + "," + v.g + "," + v.b + "," + v.a + ")", this.context.strokeStyle = "rgba(" + a.r + "," + a.g + "," + a.b + "," + a.a + ")", C.backgroundGradient) {
                  let $ = this.context.createLinearGradient(0, z / 2, I, z / 2), k = f.Gradient.getGradient(C.backgroundGradient), G = k.range(), H = -1, U = 1;
                  G && (H = G[0], U = G[1]);
                  let V = U - H;
                  for (let Q = 0; Q < 1.01; Q += 0.1) {
                    let ae = _(k.valueToHex(H + V * Q)), oe = "rgba(" + ae.r + "," + ae.g + "," + ae.b + "," + ae.a + ")";
                    $.addColorStop(Q, oe);
                  }
                  this.context.fillStyle = $;
                }
                this.context.lineWidth = p, A && h(this.context, p, p, I - 2 * p, z - 2 * p, 6, p > 0), C.backgroundImage && this.context.drawImage(P, 0, 0, I, z), this.context.fillStyle = "rgba(" + o.r + "," + o.g + "," + o.b + "," + o.a + ")", this.context.fillText(this.text, p + w, s + p + w, D);
                var N = new n.Texture(this.canvas);
                N.needsUpdate = !0, this.sprite.material = new n.SpriteMaterial({
                  map: N,
                  useScreenCoordinates: b,
                  alignment: M,
                  depthTest: !g,
                  screenOffset: C.screenOffset || null
                }), this.sprite.scale.set(1, 1, 1), this.sprite.position.set(l.x, l.y, l.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 ***!
            \********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MarchingCube: () => (
                /* binding */
                _
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* binding */
                h
              ),
              /* harmony export */
              PointGrid: () => (
                /* binding */
                E
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* binding */
                c
              ),
              /* harmony export */
              SurfaceType: () => (
                /* binding */
                f
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* binding */
                y
              ),
              /* harmony export */
              syncSurface: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), f;
            (function(C) {
              C[C.VDW = 1] = "VDW", C[C.MS = 2] = "MS", C[C.SAS = 3] = "SAS", C[C.SES = 4] = "SES";
            })(f || (f = {}));
            var u = !1;
            function y(C) {
              u = C;
            }
            (window.navigator.userAgent.indexOf("MSIE ") >= 0 || window.navigator.userAgent.indexOf("Trident/") >= 0) && (u = !0);
            class h {
              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(b, A, S, s) {
                let o = !!s.fulltable, w = s.hasOwnProperty("origin") && s.origin.hasOwnProperty("x") ? s.origin : { x: 0, y: 0, z: 0 }, p = !!s.voxel, v = s.matrix, a = s.nX || 0, l = s.nY || 0, g = s.nZ || 0, M = s.scale || 1, L = null;
                s.unitCube ? L = s.unitCube : L = { x: M, y: M, z: M };
                let T = new Int32Array(a * l * g), D, I;
                for (D = 0, I = T.length; D < I; ++D)
                  T[D] = -1;
                let z = function(N, $, k, G, H, U) {
                  let V = { x: 0, y: 0, z: 0 }, Q = !!(G & 1 << H), ae = !!(G & 1 << U), oe = H;
                  if (!Q && ae && (oe = U), oe & 1 && k++, oe & 2 && $++, oe & 4 && N++, v) {
                    let me = new n.Vector3(N, $, k);
                    me = me.applyMatrix4(v), V = { x: me.x, y: me.y, z: me.z };
                  } else
                    V.x = w.x + L.x * N, V.y = w.y + L.y * $, V.z = w.z + L.z * k;
                  let q = (l * N + $) * g + k;
                  return p ? (A.push(V), A.length - 1) : (T[q] < 0 && (T[q] = A.length, A.push(V)), T[q]);
                }, P = new Int32Array(12), B = o ? this.edgeTable2 : this.edgeTable, F = o ? this.triTable2 : this.triTable;
                for (D = 0; D < a - 1; ++D)
                  for (let N = 0; N < l - 1; ++N)
                    for (let $ = 0; $ < g - 1; ++$) {
                      let k = 0;
                      for (let U = 0; U < 8; ++U) {
                        let V = (l * (D + ((U & 4) >> 2)) + N + ((U & 2) >> 1)) * g + $ + (U & 1), Q = !!(b[V] & this.ISDONE);
                        k |= Q << U;
                      }
                      if (k === 0 || k === 255)
                        continue;
                      let G = B[k];
                      if (G === 0)
                        continue;
                      let H = F[k];
                      G & 1 && (P[0] = z(D, N, $, k, 0, 1)), G & 2 && (P[1] = z(D, N, $, k, 1, 3)), G & 4 && (P[2] = z(D, N, $, k, 3, 2)), G & 8 && (P[3] = z(D, N, $, k, 2, 0)), G & 16 && (P[4] = z(D, N, $, k, 4, 5)), G & 32 && (P[5] = z(D, N, $, k, 5, 7)), G & 64 && (P[6] = z(D, N, $, k, 7, 6)), G & 128 && (P[7] = z(D, N, $, k, 6, 4)), G & 256 && (P[8] = z(D, N, $, k, 0, 4)), G & 512 && (P[9] = z(D, N, $, k, 1, 5)), G & 1024 && (P[10] = z(D, N, $, k, 3, 7)), G & 2048 && (P[11] = z(D, N, $, k, 2, 6));
                      for (let U = 0; U < H.length; U += 3) {
                        let V = P[H[U]], Q = P[H[U + 1]], ae = P[H[U + 2]];
                        p && U >= 3 && (A.push(A[V]), V = A.length - 1, A.push(A[Q]), Q = A.length - 1, A.push(A[ae]), ae = A.length - 1), S.push(V), S.push(Q), S.push(ae);
                      }
                    }
              }
              laplacianSmooth(b, A, S) {
                let s = new Array(A.length), o, w, p, v, a;
                for (o = 0, w = A.length; o < w; o++)
                  s[o] = {
                    x: 0,
                    y: 0,
                    z: 0
                  };
                let l = new Array(20), g;
                for (o = 0; o < 20; o++)
                  l[o] = new Array(A.length);
                for (o = 0, w = A.length; o < w; o++)
                  l[0][o] = 0;
                for (o = 0, w = S.length / 3; o < w; o++) {
                  let T = o * 3, D = o * 3 + 1, I = o * 3 + 2;
                  for (g = !0, p = 0, v = l[0][S[T]]; p < v; p++)
                    if (S[D] == l[p + 1][S[T]]) {
                      g = !1;
                      break;
                    }
                  for (g && (l[0][S[T]]++, l[l[0][S[T]]][S[T]] = S[D]), g = !0, p = 0, v = l[0][S[T]]; p < v; p++)
                    if (S[I] == l[p + 1][S[T]]) {
                      g = !1;
                      break;
                    }
                  for (g && (l[0][S[T]]++, l[l[0][S[T]]][S[T]] = S[I]), g = !0, p = 0, v = l[0][S[D]]; p < v; p++)
                    if (S[T] == l[p + 1][S[D]]) {
                      g = !1;
                      break;
                    }
                  for (g && (l[0][S[D]]++, l[l[0][S[D]]][S[D]] = S[T]), g = !0, p = 0, v = l[0][S[D]]; p < v; p++)
                    if (S[I] == l[p + 1][S[D]]) {
                      g = !1;
                      break;
                    }
                  for (g && (l[0][S[D]]++, l[l[0][S[D]]][S[D]] = S[I]), g = !0, p = 0; p < l[0][S[I]]; p++)
                    if (S[T] == l[p + 1][S[I]]) {
                      g = !1;
                      break;
                    }
                  for (g && (l[0][S[I]]++, l[l[0][S[I]]][S[I]] = S[T]), g = !0, p = 0, v = l[0][S[I]]; p < v; p++)
                    if (S[D] == l[p + 1][S[I]]) {
                      g = !1;
                      break;
                    }
                  g && (l[0][S[I]]++, l[l[0][S[I]]][S[I]] = S[D]);
                }
                let M = 1, L = 0.5;
                for (a = 0; a < b; a++) {
                  for (o = 0, w = A.length; o < w; o++)
                    if (l[0][o] < 3)
                      s[o].x = A[o].x, s[o].y = A[o].y, s[o].z = A[o].z;
                    else if (l[0][o] == 3 || l[0][o] == 4) {
                      for (s[o].x = 0, s[o].y = 0, s[o].z = 0, p = 0, v = l[0][o]; p < v; p++)
                        s[o].x += A[l[p + 1][o]].x, s[o].y += A[l[p + 1][o]].y, s[o].z += A[l[p + 1][o]].z;
                      s[o].x += L * A[o].x, s[o].y += L * A[o].y, s[o].z += L * A[o].z, s[o].x /= L + l[0][o], s[o].y /= L + l[0][o], s[o].z /= L + l[0][o];
                    } else {
                      for (s[o].x = 0, s[o].y = 0, s[o].z = 0, p = 0, v = l[0][o]; p < v; p++)
                        s[o].x += A[l[p + 1][o]].x, s[o].y += A[l[p + 1][o]].y, s[o].z += A[l[p + 1][o]].z;
                      s[o].x += M * A[o].x, s[o].y += M * A[o].y, s[o].z += M * A[o].z, s[o].x /= M + l[0][o], s[o].y /= M + l[0][o], s[o].z /= M + l[0][o];
                    }
                  for (o = 0, w = A.length; o < w; o++)
                    A[o].x = s[o].x, A[o].y = s[o].y, A[o].z = s[o].z;
                }
              }
            }
            let _ = new h();
            class E {
              constructor(b, A, S) {
                this.data = new Int32Array(b * A * S * 3), this.width = A, this.height = S;
              }
              // set position x,y,z to pt, which has ix,iy,and iz
              set(b, A, S, s) {
                let o = ((b * this.width + A) * this.height + S) * 3;
                this.data[o] = s.ix, this.data[o + 1] = s.iy, this.data[o + 2] = s.iz;
              }
              // return point at x,y,z
              get(b, A, S) {
                let s = ((b * this.width + A) * this.height + S) * 3;
                return {
                  ix: this.data[s],
                  iy: this.data[s + 1],
                  iz: this.data[s + 2]
                };
              }
            }
            class c {
              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])
                ], c.MarchingCube || (c.MarchingCube = new h());
              }
              getVDWIndex(b) {
                return !b.elem || typeof this.vdwRadii[b.elem] > "u" ? "X" : b.elem;
              }
              getFacesAndVertices(b) {
                let A = {};
                for (let o = 0, w = b.length; o < w; o++)
                  A[b[o]] = !0;
                let S = this.verts;
                for (let o = 0, w = S.length; o < w; o++)
                  S[o].x = S[o].x / this.scaleFactor - this.ptranx, S[o].y = S[o].y / this.scaleFactor - this.ptrany, S[o].z = S[o].z / this.scaleFactor - this.ptranz;
                let s = [];
                for (let o = 0, w = this.faces.length; o < w; o += 3) {
                  let p = this.faces[o], v = this.faces[o + 1], a = this.faces[o + 2], l = S[p].atomid, g = S[v].atomid, M = S[a].atomid, L = l;
                  g < L && (L = g), M < L && (L = M), A[L] && p !== v && v !== a && p !== a && (s.push(p), s.push(v), s.push(a));
                }
                return this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, {
                  vertices: S,
                  faces: s
                };
              }
              initparm(b, A, S) {
                S > 1e6 && (this.scaleFactor = this.defaultScaleFactor / 2);
                let s = 1 / this.scaleFactor * 5.5;
                this.pminx = b[0][0], this.pmaxx = b[1][0], this.pminy = b[0][1], this.pmaxy = b[1][1], this.pminz = b[0][2], this.pmaxz = b[1][2], A ? (this.pminx -= this.probeRadius + s, this.pminy -= this.probeRadius + s, this.pminz -= this.probeRadius + s, this.pmaxx += this.probeRadius + s, this.pmaxy += this.probeRadius + s, this.pmaxz += this.probeRadius + s) : (this.pminx -= s, this.pminy -= s, this.pminz -= s, this.pmaxx += s, this.pmaxy += s, this.pmaxz += s), 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(A), 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(b) {
                let A = {};
                for (const S in this.vdwRadii) {
                  let s = this.vdwRadii[S];
                  b ? A[S] = (s + this.probeRadius) * this.scaleFactor + 0.5 : A[S] = s * this.scaleFactor + 0.5;
                  let o = A[S] * A[S];
                  this.widxz[S] = Math.floor(A[S]) + 1, this.depty[S] = new Int32Array(this.widxz[S] * this.widxz[S]);
                  let w = 0;
                  for (let p = 0; p < this.widxz[S]; p++)
                    for (let v = 0; v < this.widxz[S]; v++) {
                      let a = p * p + v * v;
                      if (a > o)
                        this.depty[S][w] = -1;
                      else {
                        let l = Math.sqrt(o - a);
                        this.depty[S][w] = Math.floor(l);
                      }
                      w++;
                    }
                }
              }
              fillvoxels(b, A) {
                for (let S = 0, s = this.vpBits.length; S < s; S++)
                  this.vpBits[S] = 0, this.vpDistance[S] = -1, this.vpAtomID[S] = -1;
                for (let S in A) {
                  let s = b[A[S]];
                  s !== void 0 && this.fillAtom(s, b);
                }
                for (let S = 0, s = this.vpBits.length; S < s; S++)
                  this.vpBits[S] & this.INOUT && (this.vpBits[S] |= this.ISDONE);
              }
              fillAtom(b, A) {
                let S = Math.floor(0.5 + this.scaleFactor * (b.x + this.ptranx)), s = Math.floor(0.5 + this.scaleFactor * (b.y + this.ptrany)), o = Math.floor(0.5 + this.scaleFactor * (b.z + this.ptranz)), w = this.getVDWIndex(b), p = 0, v = this.pWidth * this.pHeight;
                for (let a = 0, l = this.widxz[w]; a < l; a++)
                  for (let g = 0; g < l; g++) {
                    if (this.depty[w][p] != -1) {
                      for (let M = -1; M < 2; M++)
                        for (let L = -1; L < 2; L++)
                          for (let T = -1; T < 2; T++)
                            if (M !== 0 && L !== 0 && T !== 0) {
                              let D = M * a, I = T * g;
                              for (let z = 0; z <= this.depty[w][p]; z++) {
                                let P = z * L, B = S + D, F = s + P, N = o + I;
                                if (B < 0 || F < 0 || N < 0 || B >= this.pLength || F >= this.pWidth || N >= this.pHeight)
                                  continue;
                                let $ = B * v + F * this.pHeight + N;
                                if (!(this.vpBits[$] & this.INOUT))
                                  this.vpBits[$] |= this.INOUT, this.vpAtomID[$] = b.serial;
                                else {
                                  let k = A[this.vpAtomID[$]];
                                  if (k.serial != b.serial) {
                                    let G = S + D - Math.floor(0.5 + this.scaleFactor * (k.x + this.ptranx)), H = s + P - Math.floor(0.5 + this.scaleFactor * (k.y + this.ptrany)), U = o + I - Math.floor(0.5 + this.scaleFactor * (k.z + this.ptranz));
                                    D * D + P * P + I * I < G * G + H * H + U * U && (this.vpAtomID[$] = b.serial);
                                  }
                                }
                              }
                            }
                    }
                    p++;
                  }
              }
              fillvoxelswaals(b, A) {
                for (let S = 0, s = this.vpBits.length; S < s; S++)
                  this.vpBits[S] &= ~this.ISDONE;
                for (let S in A) {
                  let s = b[A[S]];
                  s !== void 0 && this.fillAtomWaals(s, b);
                }
              }
              fillAtomWaals(b, A) {
                let S = 0, s = Math.floor(0.5 + this.scaleFactor * (b.x + this.ptranx)), o = Math.floor(0.5 + this.scaleFactor * (b.y + this.ptrany)), w = Math.floor(0.5 + this.scaleFactor * (b.z + this.ptranz)), p = this.getVDWIndex(b), v = this.pWidth * this.pHeight;
                for (let a = 0, l = this.widxz[p]; a < l; a++)
                  for (let g = 0; g < l; g++) {
                    if (this.depty[p][S] != -1) {
                      for (let M = -1; M < 2; M++)
                        for (let L = -1; L < 2; L++)
                          for (let T = -1; T < 2; T++)
                            if (M !== 0 && L !== 0 && T !== 0) {
                              let D = M * a, I = T * g;
                              for (let z = 0; z <= this.depty[p][S]; z++) {
                                let P = z * L, B = s + D, F = o + P, N = w + I;
                                if (B < 0 || F < 0 || N < 0 || B >= this.pLength || F >= this.pWidth || N >= this.pHeight)
                                  continue;
                                let $ = B * v + F * this.pHeight + N;
                                if (!(this.vpBits[$] & this.ISDONE))
                                  this.vpBits[$] |= this.ISDONE, this.vpAtomID[$] = b.serial;
                                else {
                                  let k = A[this.vpAtomID[$]];
                                  if (k.serial != b.serial) {
                                    let G = s + D - Math.floor(0.5 + this.scaleFactor * (k.x + this.ptranx)), H = o + P - Math.floor(0.5 + this.scaleFactor * (k.y + this.ptrany)), U = w + I - Math.floor(0.5 + this.scaleFactor * (k.z + this.ptranz));
                                    D * D + P * P + I * I < G * G + H * H + U * U && (this.vpAtomID[$] = b.serial);
                                  }
                                }
                              }
                            }
                    }
                    S++;
                  }
              }
              buildboundary() {
                let b = this.pWidth * this.pHeight;
                for (let A = 0; A < this.pLength; A++)
                  for (let S = 0; S < this.pHeight; S++)
                    for (let s = 0; s < this.pWidth; s++) {
                      let o = A * b + s * this.pHeight + S;
                      if (this.vpBits[o] & this.INOUT) {
                        let w = 0;
                        for (; w < 26; ) {
                          let p = A + this.nb[w][0], v = S + this.nb[w][2], a = s + this.nb[w][1];
                          if (p > -1 && p < this.pLength && a > -1 && a < this.pWidth && v > -1 && v < this.pHeight && !(this.vpBits[p * b + a * this.pHeight + v] & this.INOUT)) {
                            this.vpBits[o] |= this.ISBOUND;
                            break;
                          } else
                            w++;
                        }
                      }
                    }
              }
              fastdistancemap() {
                let b = new E(this.pLength, this.pWidth, this.pHeight), A = this.pWidth * this.pHeight, S = this.cutRadius * this.cutRadius, s = [], o = [], w;
                for (let a = 0; a < this.pLength; a++)
                  for (let l = 0; l < this.pWidth; l++)
                    for (let g = 0; g < this.pHeight; g++)
                      if (w = a * A + l * this.pHeight + g, this.vpBits[w] &= ~this.ISDONE, this.vpBits[w] & this.INOUT && this.vpBits[w] & this.ISBOUND) {
                        let M = {
                          ix: a,
                          iy: l,
                          iz: g
                        };
                        b.set(a, l, g, M), s.push(M), this.vpDistance[w] = 0, this.vpBits[w] |= this.ISDONE, this.vpBits[w] &= ~this.ISBOUND;
                      }
                do {
                  o = this.fastoneshell(s, b), s = [];
                  for (let a = 0, l = o.length; a < l; a++)
                    w = A * o[a].ix + this.pHeight * o[a].iy + o[a].iz, this.vpBits[w] &= ~this.ISBOUND, this.vpDistance[w] <= 1.0404 * S && s.push({
                      ix: o[a].ix,
                      iy: o[a].iy,
                      iz: o[a].iz
                    });
                } while (s.length !== 0);
                s = [], o = [], b = null;
                let p = this.scaleFactor - 0.5;
                p < 0 && (p = 0);
                let v = S - 0.5 / (0.1 + p);
                for (let a = 0; a < this.pLength; a++)
                  for (let l = 0; l < this.pWidth; l++)
                    for (let g = 0; g < this.pHeight; g++)
                      w = a * A + l * this.pHeight + g, this.vpBits[w] &= ~this.ISBOUND, this.vpBits[w] & this.INOUT && (!(this.vpBits[w] & this.ISDONE) || this.vpBits[w] & this.ISDONE && this.vpDistance[w] >= v) && (this.vpBits[w] |= this.ISBOUND);
              }
              fastoneshell(b, A) {
                let S, s, o, w, p, v, a, l, g, M = [];
                if (b.length === 0)
                  return M;
                let L = {
                  ix: -1,
                  iy: -1,
                  iz: -1
                }, T = this.pWidth * this.pHeight;
                for (let D = 0, I = b.length; D < I; D++) {
                  S = b[D].ix, s = b[D].iy, o = b[D].iz, l = A.get(S, s, o);
                  for (let z = 0; z < 6; z++)
                    L.ix = S + this.nb[z][0], L.iy = s + this.nb[z][1], L.iz = o + this.nb[z][2], L.ix < this.pLength && L.ix > -1 && L.iy < this.pWidth && L.iy > -1 && L.iz < this.pHeight && L.iz > -1 && (g = L.ix * T + this.pHeight * L.iy + L.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (A.set(L.ix, L.iy, o + this.nb[z][2], l), w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, a < this.vpDistance[g] && (A.set(L.ix, L.iy, L.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })))));
                }
                for (let D = 0, I = b.length; D < I; D++) {
                  S = b[D].ix, s = b[D].iy, o = b[D].iz, l = A.get(S, s, o);
                  for (let z = 6; z < 18; z++)
                    L.ix = S + this.nb[z][0], L.iy = s + this.nb[z][1], L.iz = o + this.nb[z][2], L.ix < this.pLength && L.ix > -1 && L.iy < this.pWidth && L.iy > -1 && L.iz < this.pHeight && L.iz > -1 && (g = L.ix * T + this.pHeight * L.iy + L.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (A.set(L.ix, L.iy, o + this.nb[z][2], l), w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, a < this.vpDistance[g] && (A.set(L.ix, L.iy, L.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })))));
                }
                for (let D = 0, I = b.length; D < I; D++) {
                  S = b[D].ix, s = b[D].iy, o = b[D].iz, l = A.get(S, s, o);
                  for (let z = 18; z < 26; z++)
                    L.ix = S + this.nb[z][0], L.iy = s + this.nb[z][1], L.iz = o + this.nb[z][2], L.ix < this.pLength && L.ix > -1 && L.iy < this.pWidth && L.iy > -1 && L.iz < this.pHeight && L.iz > -1 && (g = L.ix * T + this.pHeight * L.iy + L.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (A.set(L.ix, L.iy, o + this.nb[z][2], l), w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (w = L.ix - l.ix, p = L.iy - l.iy, v = L.iz - l.iz, a = w * w + p * p + v * v, a < this.vpDistance[g] && (A.set(L.ix, L.iy, L.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({
                      ix: L.ix,
                      iy: L.iy,
                      iz: L.iz
                    })))));
                }
                return M;
              }
              marchingcubeinit(b) {
                for (let A = 0, S = this.vpBits.length; A < S; A++)
                  b == 1 ? this.vpBits[A] &= ~this.ISBOUND : b == 4 ? (this.vpBits[A] &= ~this.ISDONE, this.vpBits[A] & this.ISBOUND && (this.vpBits[A] |= this.ISDONE), this.vpBits[A] &= ~this.ISBOUND) : b == 2 ? this.vpBits[A] & this.ISBOUND && this.vpBits[A] & this.ISDONE ? this.vpBits[A] &= ~this.ISBOUND : this.vpBits[A] & this.ISBOUND && !(this.vpBits[A] & this.ISDONE) && (this.vpBits[A] |= this.ISDONE) : b == 3 && (this.vpBits[A] &= ~this.ISBOUND);
              }
              marchingcube(b) {
                this.marchingcubeinit(b), this.verts = [], this.faces = [], c.MarchingCube.march(this.vpBits, this.verts, this.faces, {
                  smooth: 1,
                  nX: this.pLength,
                  nY: this.pWidth,
                  nZ: this.pHeight
                });
                let A = this.pWidth * this.pHeight;
                for (let S = 0, s = this.verts.length; S < s; S++)
                  this.verts[S].atomid = this.vpAtomID[this.verts[S].x * A + this.pHeight * this.verts[S].y + this.verts[S].z];
                c.MarchingCube.laplacianSmooth(1, this.verts, this.faces);
              }
            }
            c.MarchingCube = new h();
          }
        ),
        /***/
        "./src/VolumeData.ts": (
          /*!***************************!*\
            !*** ./src/VolumeData.ts ***!
            \***************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VolumeData: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), f = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), u = t(
              /*! ./parsers/VASP */
              "./src/parsers/VASP.ts"
            ), y = t(
              /*! ./parsers/CUBE */
              "./src/parsers/CUBE.ts"
            ), h = t(
              /*! pako */
              "./node_modules/pako/dist/pako.esm.mjs"
            );
            class _ {
              constructor(c, C, b) {
                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(w) {
                  var p = w / (this.size.y * this.size.z), v = w % (this.size.y * this.size.z), a = w % this.size.z;
                  return p *= this.unit.x, v *= this.unit.y, a *= this.unit.z, p += this.origin.x, v += this.origin.y, a += this.origin.z, { x: p, y: v, z: a };
                }, this.vasp = function(w) {
                  var p = w.replace(/^\s+/, "").split(/[\n\r]/), v = (0, u.VASP)(w)[0], a = v.length;
                  if (a == 0) {
                    console.log("No good formating of CHG or CHGCAR file, not atomic information provided in the file."), this.data = [];
                    return;
                  }
                  var l = 1.889725992, g = 0.036749309, M = parseFloat(p[1]), L;
                  L = p[2].replace(/^\s+/, "").split(/\s+/);
                  var T = new f.Vector3(parseFloat(L[0]), parseFloat(L[1]), parseFloat(L[2])).multiplyScalar(M * l);
                  L = p[3].replace(/^\s+/, "").split(/\s+/);
                  var D = new f.Vector3(parseFloat(L[0]), parseFloat(L[1]), parseFloat(L[2])).multiplyScalar(M * l);
                  L = p[4].replace(/^\s+/, "").split(/\s+/);
                  var I = new f.Vector3(parseFloat(L[0]), parseFloat(L[1]), parseFloat(L[2])).multiplyScalar(M * l), z = T.x * (D.y * I.z - I.y * D.z) - D.x * (T.y * I.z - I.y * T.z) + I.x * (T.y * D.z - D.y * T.z);
                  z = Math.abs(z) / Math.pow(l, 3);
                  var P = 1 / z;
                  p.splice(0, 8 + a + 1);
                  var B = p[0].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), F = Math.abs(parseFloat(B[0])), N = Math.abs(parseFloat(B[1])), $ = Math.abs(parseFloat(B[2])), k = this.origin = new f.Vector3(0, 0, 0);
                  this.size = { x: F, y: N, z: $ }, this.unit = new f.Vector3(T.x, D.y, I.z), T = T.multiplyScalar(1 / (l * F)), D = D.multiplyScalar(1 / (l * N)), I = I.multiplyScalar(1 / (l * $)), (T.y != 0 || T.z != 0 || D.x != 0 || D.z != 0 || I.x != 0 || I.y != 0) && (this.matrix = new f.Matrix4(T.x, D.x, I.x, 0, T.y, D.y, I.y, 0, T.z, D.z, I.z, 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new f.Matrix4().makeTranslation(k.x, k.y, k.z)), this.origin = new f.Vector3(0, 0, 0), this.unit = new f.Vector3(1, 1, 1)), p.splice(0, 1);
                  var G = p.join(" ");
                  G = G.replace(/^\s+/, "");
                  var H = G.split(/[\s\r]+/);
                  H.splice(F * N * $ + 1);
                  for (var U = Float32Array.from(H, parseFloat), V = 0; V < U.length; V++)
                    U[V] = U[V] * P * g;
                  this.data = U;
                }, this.dx = function(w) {
                  var p = w.split(/[\n\r]+/), v, a = /gridpositions\s+counts\s+(\d+)\s+(\d+)\s+(\d+)/, l = /^origin\s+(\S+)\s+(\S+)\s+(\S+)/, g = /^delta\s+(\S+)\s+(\S+)\s+(\S+)/, M = /data follows/, L = 0;
                  for (L = 0; L < p.length; L++) {
                    var T = p[L];
                    if (v = a.exec(T)) {
                      var D = parseInt(v[1]), I = parseInt(v[2]), z = parseInt(v[3]);
                      this.size = { x: D, y: I, z };
                    } else if (v = g.exec(T)) {
                      var P = parseFloat(v[1]);
                      if ((parseFloat(v[2]) != 0 || parseFloat(v[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), L += 1, T = p[L], v = g.exec(T), v == null) {
                        console.log("Parse error in dx delta matrix");
                        return;
                      }
                      var B = parseFloat(v[2]);
                      if ((parseFloat(v[1]) != 0 || parseFloat(v[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), L += 1, T = p[L], v = g.exec(T), v == null) {
                        console.log("Parse error in dx delta matrix");
                        return;
                      }
                      var F = parseFloat(v[3]);
                      (parseFloat(v[1]) != 0 || parseFloat(v[2]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), this.unit = new f.Vector3(P, B, F);
                    } else if (v = l.exec(T)) {
                      var N = parseFloat(v[1]), $ = parseFloat(v[2]), k = parseFloat(v[3]);
                      this.origin = new f.Vector3(N, $, k);
                    } else if (v = M.exec(T))
                      break;
                  }
                  if (L += 1, !this.size || !this.origin || !this.unit || !this.size) {
                    console.log("Error parsing dx format");
                    return;
                  }
                  var G = p.splice(L).join(" "), H = G.split(/[\s\r]+/);
                  this.data = Float32Array.from(H, parseFloat);
                }, C = C.toLowerCase(), /\.gz$/.test(C)) {
                  C = C.replace(/\.gz$/, "");
                  try {
                    this[C] && this.isbinary.has(C) ? (typeof c == "string" && (c = (0, n.base64ToArray)(c)), c = (0, h.inflate)(c)) : c = new TextDecoder("utf-8").decode((0, h.inflate)(c));
                  } catch (w) {
                    console.log(w);
                  }
                }
                if (this[C] && (this.isbinary.has(C) && typeof c == "string" && (c = (0, n.base64ToArray)(c)), this[C](c)), b) {
                  if (b.negate)
                    for (let w = 0, p = this.data.length; w < p; w++)
                      this.data[w] = -this.data[w];
                  if (b.normalize) {
                    var A = 0;
                    for (let w = 0, p = this.data.length; w < p; w++)
                      A += this.data[w];
                    var S = A / this.data.length;
                    A = 0;
                    for (let w = 0, p = this.data.length; w < p; w++) {
                      var s = this.data[w] - S;
                      A += s * s;
                    }
                    var o = A / this.data.length;
                    for (let w = 0, p = this.data.length; w < p; w++)
                      this.data[w] = (this.data[w] - S) / o;
                  }
                }
              }
              /**
               * @function $3Dmol.VolumeData.getIndex
               * @param {number} x,y,z - the coordinates
               * @returns - index into flat array closest to provided coordinate; -1 if invalid
               */
              getIndex(c, C, b) {
                if (this.matrix) {
                  this.inversematrix == null && (this.inversematrix = new f.Matrix4().getInverse(this.matrix));
                  var A = new f.Vector3(c, C, b);
                  A = A.applyMatrix4(this.inversematrix), c = A.x, C = A.y, b = A.z;
                } else
                  c -= this.origin.x, C -= this.origin.y, b -= this.origin.z, c /= this.unit.x, C /= this.unit.y, b /= this.unit.z;
                return c = Math.round(c), C = Math.round(C), b = Math.round(b), c < 0 || c >= this.size.x || C < 0 || C >= this.size.y || b < 0 || b >= this.size.z ? -1 : c * this.size.y * this.size.z + C * this.size.z + b;
              }
              /**
               * @function $3Dmol.VolumeData.getVal
               * @param {number} x,y,z - the coordinates
               * @returns - value closest to provided coordinate; zero if coordinate invalid
               */
              getVal(c, C, b) {
                let A = this.getIndex(c, C, b);
                return A < 0 ? 0 : this.data[A];
              }
              // parse cube data
              cube(c) {
                var C = c.split(/\r?\n/);
                if (!(C.length < 6)) {
                  var b = (0, y.CUBE)(c, {}).modelData[0].cryst, A = C[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), S = parseFloat(A[0]), s = Math.abs(S);
                  this.origin = b.origin, this.size = b.size, this.unit = b.unit, this.matrix = b.matrix4;
                  var o = 6;
                  S < 0 && o++;
                  var w = C.splice(s + o).join(" ");
                  w = w.replace(/^\s+/, "");
                  var p = w.split(/[\s\r]+/);
                  this.data = Float32Array.from(p, parseFloat);
                }
              }
              //parse cp4 files
              ccp4(c) {
                var C = {};
                c = new Int8Array(c);
                var b = new Int32Array(c.buffer, 0, 56), A = new Float32Array(c.buffer, 0, 56), S = new DataView(c.buffer);
                if (C.MAP = String.fromCharCode(S.getUint8(208), S.getUint8(209), S.getUint8(210), S.getUint8(211)), C.MACHST = [S.getUint8(212), S.getUint8(213)], C.MACHST[0] === 17 && C.MACHST[1] === 17)
                  for (var s = c.byteLength, o = 0; o < s; o += 4)
                    S.setFloat32(o, S.getFloat32(o), !0);
                C.NX = b[0], C.NY = b[1], C.NZ = b[2], C.MODE = b[3], C.NXSTART = b[4], C.NYSTART = b[5], C.NZSTART = b[6], C.MX = b[7], C.MY = b[8], C.MZ = b[9], C.xlen = A[10], C.ylen = A[11], C.zlen = A[12], C.alpha = A[13], C.beta = A[14], C.gamma = A[15], C.MAPC = b[16], C.MAPR = b[17], C.MAPS = b[18], C.DMIN = A[19], C.DMAX = A[20], C.DMEAN = A[21], C.ISPG = b[22], C.NSYMBT = b[23], C.LSKFLG = b[24], C.originX = A[49], C.originY = A[50], C.originZ = A[51], C.ARMS = A[54];
                var w = C, p = [
                  w.xlen,
                  0,
                  0
                ], v = [
                  w.ylen * Math.cos(Math.PI / 180 * w.gamma),
                  w.ylen * Math.sin(Math.PI / 180 * w.gamma),
                  0
                ], a = [
                  w.zlen * Math.cos(Math.PI / 180 * w.beta),
                  w.zlen * (Math.cos(Math.PI / 180 * w.alpha) - Math.cos(Math.PI / 180 * w.gamma) * Math.cos(Math.PI / 180 * w.beta)) / Math.sin(Math.PI / 180 * w.gamma),
                  0
                ];
                a[2] = Math.sqrt(w.zlen * w.zlen * Math.sin(Math.PI / 180 * w.beta) * Math.sin(Math.PI / 180 * w.beta) - a[1] * a[1]);
                var l = [0, p, v, a], g = [0, w.MX, w.MY, w.MZ], M = [0, w.MAPC, w.MAPR, w.MAPS];
                this.matrix = new f.Matrix4(), this.matrix.set(l[M[1]][0] / g[M[1]], l[M[2]][0] / g[M[2]], l[M[3]][0] / g[M[3]], 0, l[M[1]][1] / g[M[1]], l[M[2]][1] / g[M[2]], l[M[3]][1] / g[M[3]], 0, l[M[1]][2] / g[M[1]], l[M[2]][2] / g[M[2]], l[M[3]][2] / g[M[3]], 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new f.Matrix4().makeTranslation(w.NXSTART + w.originX, w.NYSTART + w.originY, w.NZSTART + w.originZ)), this.origin = new f.Vector3(0, 0, 0), this.unit = new f.Vector3(1, 1, 1), this.size = { x: C.NX, y: C.NY, z: C.NZ }, this.dimensionorder = [C.MAPC, C.MAPR, C.MAPS];
                var L = new Float32Array(c.buffer, 1024 + C.NSYMBT), T = C.NX, D = C.NY, I = C.NZ;
                this.data = new Float32Array(T * D * I);
                for (let z = 0; z < T; z++)
                  for (let P = 0; P < D; P++)
                    for (let B = 0; B < I; B++)
                      this.data[(z * D + P) * I + B] = L[(B * D + P) * T + z];
              }
            }
          }
        ),
        /***/
        "./src/VolumetricRender.ts": (
          /*!*********************************!*\
            !*** ./src/VolumetricRender.ts ***!
            \*********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GLVolumetricRender: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), f = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), u = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), y = t(
              /*! ./colors */
              "./src/colors.ts"
            ), h = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            );
            class _ {
              static interpolateArray(c, C) {
                function b(a, l, g) {
                  return a + (l - a) * g;
                }
                var A = [], S = (c.length - 1) / (C - 1);
                A[0] = c[0];
                for (var s = 1; s < C - 1; s++) {
                  var o = s * S, w = Math.floor(o), p = Math.ceil(o), v = o - w;
                  A[s] = b(c[w], c[p], v);
                }
                return A[C - 1] = c[c.length - 1], A;
              }
              constructor(c, C) {
                this.hidden = !1, this.boundingSphere = new n.Sphere(), this.renderedShapeObj = null, this.shapeObj = null, this.subsamples = 5, this.data = null, this.transferfunctionbuffer = [], this.min = 0, this.max = 0, C = C || {};
                var b = Object.assign([], C.transferfn);
                this.subsamples = C.subsamples || 5;
                let A = 256;
                b.forEach(function(T) {
                  T.value = parseFloat(T.value);
                }), b.sort(function(T, D) {
                  return T.value - D.value;
                }), this.min = b[0].value, b.length == 0 && b.push(b[0]), this.max = b[b.length - 1].value;
                var S, s, o, w, p, v, a, l, g, M;
                for (let T = 0; T < b.length - 1; T++)
                  if (o = y.CC.color(b[T].color), w = y.CC.color(b[T + 1].color), g = b[T].opacity, M = b[T + 1].opacity, S = Math.floor((b[T].value - this.min) * A / (this.max - this.min)), s = Math.floor((b[T + 1].value - this.min) * A / (this.max - this.min)), S != s) {
                    p = _.interpolateArray([o.r * 255, w.r * 255], s - S), v = _.interpolateArray([o.g * 255, w.g * 255], s - S), a = _.interpolateArray([o.b * 255, w.b * 255], s - S), l = _.interpolateArray([g * 255, M * 255], s - S);
                    for (let D = 0; D < p.length; D++)
                      this.transferfunctionbuffer.push(p[D]), this.transferfunctionbuffer.push(v[D]), this.transferfunctionbuffer.push(a[D]), this.transferfunctionbuffer.push(l[D]);
                  }
                if (this.transferfunctionbuffer = new Uint8ClampedArray(this.transferfunctionbuffer), c.matrix) {
                  let T = new f.Vector3(0, 0, 0), D = new f.Vector3(c.size.x, c.size.y, c.size.z), I = new f.Vector3(1, 1, 1);
                  T.applyMatrix4(c.matrix), D.applyMatrix4(c.matrix), I.applyMatrix4(c.matrix).sub(T), this.extent = [[T.x, T.y, T.z], [D.x, D.y, D.z]];
                  for (let F = 1; F < 7; F++)
                    D.x = F & 1 ? c.size.x : 0, D.y = F & 2 ? c.size.y : 0, D.z = F & 4 ? c.size.z : 0, D.applyMatrix4(c.matrix), this.extent[0][0] = Math.min(this.extent[0][0], D.x), this.extent[0][1] = Math.min(this.extent[0][1], D.y), this.extent[0][2] = Math.min(this.extent[0][2], D.z), this.extent[1][0] = Math.max(this.extent[1][0], D.x), this.extent[1][1] = Math.max(this.extent[1][1], D.y), this.extent[1][2] = Math.max(this.extent[1][2], D.z);
                  let z = D.x - T.x, P = D.y - T.y, B = D.z - T.z;
                  this.maxdepth = Math.sqrt(z * z + P * P + B * B), this.minunit = Math.min(Math.min(I.x, I.y), I.z), this.texmatrix = new f.Matrix4().identity().scale({ x: c.size.x, y: c.size.y, z: c.size.z }), this.texmatrix = this.texmatrix.multiplyMatrices(c.matrix, this.texmatrix), this.texmatrix = this.texmatrix.getInverse(this.texmatrix);
                } else {
                  this.texmatrix = new f.Matrix4().identity();
                  let T = c.unit.x * c.size.x, D = c.unit.y * c.size.y, I = c.unit.z * c.size.z;
                  this.texmatrix.makeTranslation(-c.origin.x / T, -c.origin.y / D, -c.origin.z / I), this.texmatrix.scale({ x: 1 / T, y: 1 / D, z: 1 / I }), this.minunit = Math.min(Math.min(c.unit.x, c.unit.y), c.unit.z), this.extent = [
                    [c.origin.x, c.origin.y, c.origin.z],
                    [c.origin.x + T, c.origin.y + D, c.origin.z + I]
                  ], this.maxdepth = Math.sqrt(T * T + D * D + I * I);
                }
                var L = new h.GLShape({});
                if (L.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 = L.finalize(), this.boundingSphere.center = new f.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, C.coords !== void 0 && C.seldist !== void 0) {
                  let T = new Uint8Array(c.data.length), D = C.seldist, I = D * D;
                  for (let z = 0, P = C.coords.length; z < P; z++) {
                    let B = C.coords[z], F = B.x - D, N = B.y - D, $ = B.z - D, k = B.x + D, G = B.y + D, H = B.z + D;
                    if (c.getIndex(F, N, $) >= 0 || c.getIndex(k, G, H) >= 0)
                      for (let U = F; U < k; U += this.minunit)
                        for (let V = N; V < G; V += this.minunit)
                          for (let Q = $; Q < H; Q += this.minunit) {
                            let ae = c.getIndex(U, V, Q);
                            ae >= 0 && !T[ae] && (U - B.x) * (U - B.x) + (V - B.y) * (V - B.y) + (Q - B.z) * (Q - B.z) < I && (T[ae] = 1);
                          }
                  }
                  for (let z = 0, P = c.data.length; z < P; z++)
                    T[z] == 0 && (c.data[z] = 1 / 0);
                }
                this.data = c;
              }
              /**
               * Initialize webgl objects for rendering
               * @param {Object3D} group
               *
               */
              globj(c) {
                if (this.renderedShapeObj && (c.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) {
                  this.shapeObj = new u.Object3D();
                  var C = null, b = new u.Texture(this.data, !0), A = new u.Texture(this.transferfunctionbuffer, !1);
                  b.needsUpdate = !0, A.needsUpdate = !0, A.flipY = !1, C = new u.VolumetricMaterial({
                    transferfn: A,
                    transfermin: this.min,
                    transfermax: this.max,
                    map: b,
                    extent: this.extent,
                    maxdepth: this.maxdepth,
                    texmatrix: this.texmatrix,
                    unit: this.minunit,
                    subsamples: this.subsamples
                  });
                  var S = new u.Mesh(this.geo, C);
                  this.shapeObj.add(S), this.renderedShapeObj = this.shapeObj.clone(), c.add(this.renderedShapeObj);
                }
              }
              removegl(c) {
                this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), c.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 ***!
            \*****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Camera: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), f = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            );
            class u extends n.Object3D {
              constructor(h = 50, _ = 1, E = 0.1, c = 2e3, C = !1) {
                super(), this.projectionMatrix = new f.Matrix4(), this.projectionMatrixInverse = new f.Matrix4(), this.matrixWorldInverse = new f.Matrix4(), this.fov = h, this.aspect = _, this.near = E, this.far = c;
                var b = this.position.z;
                this.right = b * Math.tan(Math.PI / 180 * h), this.left = -this.right, this.top = this.right / this.aspect, this.bottom = -this.top, this.ortho = !!C, this.updateProjectionMatrix();
              }
              lookAt(h) {
                this.matrix.lookAt(this.position, h, this.up), this.rotationAutoUpdate && (this.useQuaternion === !1 && this.rotation instanceof f.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 ***!
            \**************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Fog: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../colors */
              "./src/colors.ts"
            );
            class f {
              constructor(y, h = 1, _ = 1e3) {
                this.name = "", this.color = new n.Color(y), this.near = h, this.far = _;
              }
              clone() {
                return new f(this.color.getHex(), this.near, this.far);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/Renderer.ts": (
          /*!*******************************!*\
            !*** ./src/WebGL/Renderer.ts ***!
            \*******************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Renderer: () => (
                /* binding */
                A
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), f = t(
              /*! ./constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), u = t(
              /*! ./constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), y = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), h = t(
              /*! ../colors */
              "./src/colors.ts"
            ), _ = t(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), E = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), c = t(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), C = t(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), b = t(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            );
            class A {
              constructor(s) {
                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 b.SpritePlugin(), this._screenshader = null, this._vertexattribpos = null, this._screenQuadVBO = null, this._fb = null, this._targetTexture = null, this._depthTexture = null, s = s || {}, this.row = s.row, this.col = s.col, this.rows = s.rows, this.cols = s.cols, this._canvas = s.canvas !== void 0 ? s.canvas : document.createElement("canvas"), this._precision = s.precision !== void 0 ? s.precision : "highp", this._alpha = s.alpha !== void 0 ? s.alpha : !0, this._premultipliedAlpha = s.premultipliedAlpha !== void 0 ? s.premultipliedAlpha : !0, this._antialias = s.antialias !== void 0 ? s.antialias : !1, this._stencil = s.stencil !== void 0 ? s.stencil : !0, this._preserveDrawingBuffer = s.preserveDrawingBuffer !== void 0 ? s.preserveDrawingBuffer : !1, this._clearColor = s.clearColor !== void 0 ? new h.Color(s.clearColor) : new h.Color(0), this._clearAlpha = s.clearAlpha !== void 0 ? s.clearAlpha : 0, this._outlineMaterial = new _.MeshOutlineMaterial(s.outline), this._outlineSphereImposterMaterial = new _.SphereImposterOutlineMaterial(s.outline), this._outlineStickImposterMaterial = new _.StickImposterOutlineMaterial(s.outline), this._outlineEnabled = !!s.outline, this.domElement = this._canvas, this._canvas.id = s.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;
              }
              isLost() {
                return this._gl.isContextLost();
              }
              getPrecision() {
                return this._precision;
              }
              setClearColorHex(s, o) {
                this._clearColor.setHex(s), this._clearAlpha = o, this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha);
              }
              enableOutline(s) {
                this._outlineMaterial = new _.MeshOutlineMaterial(s), this._outlineSphereImposterMaterial = new _.SphereImposterOutlineMaterial(s), this._outlineStickImposterMaterial = new _.StickImposterOutlineMaterial(s), this._outlineEnabled = !0;
              }
              disableOutline() {
                this._outlineEnabled = !1;
              }
              setViewport() {
                if (this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var s = this._canvas.width / this.cols, o = this._canvas.height / this.rows;
                  this._viewportWidth = s, this._viewportHeight = o, this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(s * this.col, o * this.row, s, o), this._gl.viewport(s * this.col, o * this.row, s, o);
                }
              }
              setSize(s, o) {
                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 w = s / this.cols, p = o / this.rows;
                  this._canvas.width = s * this.devicePixelRatio, this._canvas.height = o * this.devicePixelRatio, this._viewportWidth = w * this.devicePixelRatio, this._viewportHeight = p * this.devicePixelRatio, this._canvas.style.width = s + "px", this._canvas.style.height = o + "px", this.setViewport();
                } else
                  this._viewportWidth = this._canvas.width = s * this.devicePixelRatio, this._viewportHeight = this._canvas.height = o * this.devicePixelRatio, this._canvas.style.width = s + "px", this._canvas.style.height = o + "px", this._gl.viewport(0, 0, this._gl.drawingBufferWidth, this._gl.drawingBufferHeight);
                this.initFrameBuffer();
              }
              clear(s, o, w) {
                var p = 0;
                (s === void 0 || s) && (p |= this._gl.COLOR_BUFFER_BIT), (o === void 0 || o) && (p |= this._gl.DEPTH_BUFFER_BIT), (w === void 0 || w) && (p |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(p);
              }
              clearTarget(s, o, w) {
                this.clear(s, o, w);
              }
              setMaterialFaces(s, o) {
                var w = s.side === f.DoubleSide, p = s.side === f.BackSide;
                s.imposter || (p = o ? !p : p), this._oldDoubleSided !== w && (w ? this._gl.disable(this._gl.CULL_FACE) : this._gl.enable(this._gl.CULL_FACE), this._oldDoubleSided = w), this._oldFlipSided !== p && (p ? this._gl.frontFace(this._gl.CW) : this._gl.frontFace(this._gl.CCW), this._oldFlipSided = p), this._gl.cullFace(this._gl.BACK);
              }
              setDepthTest(s) {
                this._oldDepthTest !== s && (s ? this._gl.enable(this._gl.DEPTH_TEST) : this._gl.disable(this._gl.DEPTH_TEST), this._oldDepthTest = s);
              }
              setDepthWrite(s) {
                this._oldDepthWrite !== s && (this._gl.depthMask(s), this._oldDepthWrite = s);
              }
              setBlending(s) {
                s ? (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(s, o, w, p) {
                s.addEventListener("dispose", this.onMaterialDispose.bind(this));
                var v, a;
                if (a = s.shaderID, a) {
                  var l = C.ShaderLib[a];
                  s.vertexShader = l.vertexShader, s.fragmentShader = l.fragmentShader, s.uniforms = C.ShaderUtils.clone(l.uniforms);
                }
                v = {
                  wireframe: s.wireframe,
                  fragdepth: s.imposter,
                  volumetric: s.volumetric
                }, s.program = this.buildProgram(s.fragmentShader, s.vertexShader, s.uniforms, v);
              }
              renderBuffer(s, o, w, p, v, a) {
                if (p.visible) {
                  var l, g;
                  if (l = this.setProgram(s, o, w, p, a, this), !!l) {
                    g = l.attributes;
                    var M = !1, L = p.wireframe ? 1 : 0, T = v.id * 16777215 + l.id * 2 + L;
                    T !== this._currentGeometryGroupHash && (this._currentGeometryGroupHash = T, M = !0), M && (this.disableAttributes(), g.position >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglVertexBuffer), this.enableAttribute(g.position), this._gl.vertexAttribPointer(g.position, 3, this._gl.FLOAT, !1, 0, 0)), g.color >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglColorBuffer), this.enableAttribute(g.color), this._gl.vertexAttribPointer(g.color, 3, this._gl.FLOAT, !1, 0, 0)), g.normal >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglNormalBuffer), this.enableAttribute(g.normal), this._gl.vertexAttribPointer(g.normal, 3, this._gl.FLOAT, !1, 0, 0)), g.offset >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglOffsetBuffer), this.enableAttribute(g.offset), this._gl.vertexAttribPointer(g.offset, 3, this._gl.FLOAT, !1, 0, 0)), g.radius >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglRadiusBuffer), this.enableAttribute(g.radius), this._gl.vertexAttribPointer(g.radius, 1, this._gl.FLOAT, !1, 0, 0)));
                    var D, I;
                    if (a instanceof c.Mesh) {
                      if (p.shaderID === "instanced") {
                        var z = p.sphere.geometryGroups[0];
                        M && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, z.vertexArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, z.normalArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, z.faceArray, this._gl.STATIC_DRAW)), D = z.faceidx, this._extInstanced.vertexAttribDivisorANGLE(g.offset, 1), this._extInstanced.vertexAttribDivisorANGLE(g.radius, 1), this._extInstanced.vertexAttribDivisorANGLE(g.color, 1), this._extInstanced.drawElementsInstancedANGLE(this._gl.TRIANGLES, D, this._gl.UNSIGNED_SHORT, 0, v.radiusArray.length), this._extInstanced.vertexAttribDivisorANGLE(g.offset, 0), this._extInstanced.vertexAttribDivisorANGLE(g.radius, 0), this._extInstanced.vertexAttribDivisorANGLE(g.color, 0);
                      } else
                        p.wireframe ? (I = v.lineidx, this.setLineWidth(p.wireframeLinewidth), M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglLineBuffer), this._gl.drawElements(this._gl.LINES, I, this._gl.UNSIGNED_SHORT, 0)) : (D = v.faceidx, M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglFaceBuffer), this._gl.drawElements(this._gl.TRIANGLES, D, this._gl.UNSIGNED_SHORT, 0));
                      this.info.render.calls++, this.info.render.vertices += D, this.info.render.faces += D / 3;
                    } else
                      a instanceof c.Line && (I = v.vertices, this.setLineWidth(p.linewidth), this._gl.drawArrays(this._gl.LINES, 0, I), this.info.render.calls++);
                  }
                }
              }
              render(s, o, w) {
                if (!(o instanceof n.Camera)) {
                  console.error("Renderer.render: camera is not an instance of Camera.");
                  return;
                }
                var p, v, a, l, g, M = s.__lights, L = s.fog;
                this._currentMaterialId = -1, this._lightsNeedUpdate = !0, this.autoUpdateScene && s.updateMatrixWorld(), o.parent === void 0 && o.updateMatrixWorld(), o.matrixWorldInverse.getInverse(o.matrixWorld), this._projScreenMatrix.multiplyMatrices(o.projectionMatrix, o.matrixWorldInverse), this.autoUpdateObjects && this.initWebGLObjects(s), 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 || w) && (this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha), this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil)), g = s.__webglObjects;
                var T = !1;
                for (p = 0, v = g.length; p < v; p++)
                  a = g[p], l = a.object, a.render = !1, l.visible && (this.setupMatrices(l, o), this.unrollBufferMaterial(a), a.render = !0, a.volumetric && (T = !0));
                var D = null;
                this.setBlending(!1), this.renderObjects(s.__webglObjects, !0, "opaque", o, M, L, !1, D), this.renderSprites(s, o, !1), this.renderObjects(s.__webglObjects, !0, "blank", o, M, L, !0, D), this.renderObjects(s.__webglObjects, !1, "transparent", o, M, L, !0, D), T && this._fb && (this.reinitFrameBuffer(), this.renderObjects(s.__webglObjects, !1, "volumetric", o, M, L, !0, D)), this.renderFrameBuffertoScreen(), this.setDepthTest(!0), this.setDepthWrite(!0), this.renderSprites(s, o, !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 s = this._viewportWidth, o = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, s, o), this._gl.viewport(0, 0, s, o), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, s, o, 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, s, o, 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 s = this._viewportWidth, o = this._viewportHeight;
                this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, s, o), this._gl.viewport(0, 0, s, o), this._targetTexture = this._gl.createTexture(), this._depthTexture = this._gl.createTexture(), this._fb = this._gl.createFramebuffer();
                var w = C.ShaderLib.screen;
                this._screenshader = this.buildProgram(w.fragmentShader, w.vertexShader, w.uniforms, {}), this._vertexattribpos = this._gl.getAttribLocation(this._screenshader, "vertexPosition");
                var p = [
                  // 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(p), 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(s) {
                if (s.__webglObjects || (s.__webglObjects = [], s.__webglObjectsImmediate = [], s.__webglSprites = [], s.__webglFlares = []), s.__objectsAdded.length) {
                  for (; s.__objectsAdded.length; )
                    this.addObject(s.__objectsAdded[0], s), s.__objectsAdded.splice(0, 1);
                  this._currentGeometryGroupHash = -1;
                }
                for (; s.__objectsRemoved.length; )
                  this.removeObject(s.__objectsRemoved[0], s), s.__objectsRemoved.splice(0, 1);
                for (var o = 0, w = s.__webglObjects.length; o < w; o++)
                  this.updateObject(s.__webglObjects[o].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(s, o) {
                (s == null || o == null) && (s = this._canvas.width, o = this._canvas.height);
                var w = s / o;
                if (this.rows != null && this.cols != null && this.row != null && this.col != null) {
                  var p = s / this.cols, v = o / this.rows;
                  w = p / v;
                }
                return w;
              }
              setTexture(s, o, w) {
                if (s.needsUpdate) {
                  s.__webglInit || (s.__webglInit = !0, s.addEventListener("dispose", this.onTextureDispose.bind(this)), s.__webglTexture = this._gl.createTexture(), this.info.memory.textures++), this._gl.activeTexture(this._gl.TEXTURE0 + o);
                  var p = w ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D;
                  this._gl.bindTexture(p, s.__webglTexture), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, s.flipY), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, s.premultiplyAlpha), this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, s.unpackAlignment), this._gl.pixelStorei(this._gl.PACK_ALIGNMENT, s.unpackAlignment);
                  var v = this.paramToGL(s.format), a = this.paramToGL(s.type);
                  if (w)
                    this.setTextureParameters(this._gl.TEXTURE_3D, s), this._gl.texImage3D(this._gl.TEXTURE_3D, 0, this._gl.R32F, s.image.size.z, s.image.size.y, s.image.size.x, 0, this._gl.RED, this._gl.FLOAT, s.image.data);
                  else {
                    var l = s.image, g = l.width, M = l.height;
                    typeof g > "u" && (g = l.length, v == this._gl.RGBA && (g /= 4), M = 1), this.setTextureParameters(this._gl.TEXTURE_2D, s), this.isWebGL1() ? this._gl.texImage2D(this._gl.TEXTURE_2D, 0, v, v, a, s.image) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, v, g, M, 0, v, a, s.image);
                  }
                  s.needsUpdate = !1, s.onUpdate && s.onUpdate();
                } else
                  this._gl.activeTexture(this._gl.TEXTURE0 + o), w ? this._gl.bindTexture(this._gl.TEXTURE_3D, s.__webglTexture) : this._gl.bindTexture(this._gl.TEXTURE_2D, s.__webglTexture);
              }
              supportsVolumetric() {
                return !this.isWebGL1();
              }
              enableAttribute(s) {
                this._enabledAttributes[s] || (this._gl.enableVertexAttribArray(s), this._enabledAttributes[s] = !0);
              }
              disableAttributes() {
                for (let s in this._enabledAttributes)
                  this._enabledAttributes[s] && (this._gl.disableVertexAttribArray(s), this._enabledAttributes[s] = !1);
              }
              setPolygonOffset(s, o, w) {
                this._oldPolygonOffset !== s && (s ? this._gl.enable(this._gl.POLYGON_OFFSET_FILL) : this._gl.disable(this._gl.POLYGON_OFFSET_FILL));
              }
              setLineWidth(s) {
                s !== this._oldLineWidth && (this._gl.lineWidth(s), this._oldLineWidth = s);
              }
              deallocateGeometry(s) {
                if (s.__webglInit = void 0, s.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(s.__webglVertexBuffer), s.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(s.__webglColorBuffer), s.geometryGroups !== void 0)
                  for (var o = 0, w = s.groups; o < w; o++) {
                    var p = s.geometryGroups[o];
                    p.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(p.__webglVertexBuffer), p.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(p.__webglColorBuffer), p.__webglNormalBuffer !== void 0 && this._gl.deleteBuffer(p.__webglNormalBuffer), p.__webglFaceBuffer !== void 0 && this._gl.deleteBuffer(p.__webglFaceBuffer), p.__webglLineBuffer !== void 0 && this._gl.deleteBuffer(p.__webglLineBuffer);
                  }
              }
              deallocateMaterial(s) {
                var o = s.program;
                if (o !== void 0) {
                  s.program = void 0;
                  var w, p, v, a = !1;
                  for (w = 0, p = this._programs.length; w < p; w++)
                    if (v = this._programs[w], v.program === o) {
                      v.usedTimes--, v.usedTimes === 0 && (a = !0);
                      break;
                    }
                  if (a === !0) {
                    var l = [];
                    for (w = 0, p = this._programs.length; w < p; w++)
                      v = this._programs[w], v.program !== o && l.push(v);
                    this._programs = l, this._gl.deleteProgram(o), this.info.memory.programs--;
                  }
                }
              }
              deallocateTexture(s) {
                if (s.image && s.image.__webglTextureCube)
                  this._gl.deleteTexture(s.image.__webglTextureCube);
                else {
                  if (!s.__webglInit)
                    return;
                  s.__webglInit = !1, this._gl.deleteTexture(s.__webglTexture);
                }
              }
              onGeometryDispose(s) {
                var o = s.target;
                o.removeEventListener("dispose", this.onGeometryDispose), this.deallocateGeometry(o), this.info.memory.geometries--;
              }
              onTextureDispose(s) {
                var o = s.target;
                o.removeEventListener("dispose", this.onTextureDispose), this.deallocateTexture(o), this.info.memory.textures--;
              }
              onMaterialDispose(s) {
                var o = s.target;
                o.removeEventListener("dispose", this.onMaterialDispose), this.deallocateMaterial(o);
              }
              // Compile and return shader
              getShader(s, o) {
                var w;
                return !this.isWebGL1() && !o.startsWith("#version") && (o = o.replace(/gl_FragDepthEXT/g, "gl_FragDepth"), s == "fragment" ? o = o.replace(/varying/g, "in") : o = o.replace(/varying/g, "out"), o = o.replace(/attribute/g, "in"), o = o.replace(/texture2D/g, "texture"), o = o.replace(/\/\/DEFINEFRAGCOLOR/g, "out vec4 glFragColor;"), o = o.replace(/gl_FragColor/g, "glFragColor"), o = `#version 300 es
` + o), s === "fragment" ? w = this._gl.createShader(this._gl.FRAGMENT_SHADER) : s === "vertex" && (w = this._gl.createShader(this._gl.VERTEX_SHADER)), w == null ? null : (this._gl.shaderSource(w, o), this._gl.compileShader(w), this._gl.getShaderParameter(w, this._gl.COMPILE_STATUS) ? w : (console.error(this._gl.getShaderInfoLog(w)), console.error("could not initialize shader"), null));
              }
              // Compile appropriate shaders (if necessary) from source code and attach to
              // gl program.
              buildProgram(s, o, w, p) {
                var v, a, l, g, M = [];
                M.push(s), M.push(o);
                for (v in p)
                  M.push(v), M.push(p[v]);
                for (g = M.join(), v = 0, a = this._programs.length; v < a; v++) {
                  var L = this._programs[v];
                  if (L.code === g)
                    return L.usedTimes++, L.program;
                }
                if (this.isWebGL1() && p.volumetric)
                  throw new Error("Volumetric rendering requires webgl2 which is not supported by your hardware.");
                if (l = this._gl.createProgram(), l == null)
                  return null;
                var T = this._precision, D = "precision " + T + " float;", I = [
                  p.volumetric ? "#version 300 es" : "",
                  D
                ].join(`
`), z = [
                  p.volumetric ? "#version 300 es" : "",
                  p.fragdepth && this.isWebGL1() ? "#extension GL_EXT_frag_depth: enable" : "",
                  p.wireframe ? "#define WIREFRAME 1" : "",
                  D
                ].join(`
`), P = this.getShader("fragment", z + s), B = this.getShader("vertex", I + o);
                B != null && this._gl.attachShader(l, B), P != null && this._gl.attachShader(l, P), this._gl.linkProgram(l), this._gl.getProgramParameter(l, this._gl.LINK_STATUS) || console.error("Could not initialize shader"), l.uniforms = {}, l.attributes = {};
                var F, N, $;
                F = [
                  "viewMatrix",
                  "modelViewMatrix",
                  "projectionMatrix",
                  "normalMatrix"
                ];
                for (N in w)
                  F.push(N);
                for ($ = 0; $ < F.length; $++) {
                  var k = F[$];
                  l.uniforms[k] = this._gl.getUniformLocation(l, k);
                }
                for (F = [
                  "position",
                  "normal",
                  "color",
                  "lineDistance",
                  "offset",
                  "radius"
                ], $ = 0; $ < F.length; $++) {
                  var G = F[$];
                  l.attributes[G] = this._gl.getAttribLocation(l, G);
                }
                return l.id = this._programs_counter++, this._programs.push({
                  program: l,
                  code: g,
                  usedTimes: 1
                }), this.info.memory.programs = this._programs.length, l;
              }
              setProgram(s, o, w, p, v, a) {
                if (p.needsUpdate && (p.program && this.deallocateMaterial(p), this.initMaterial(p, o, w, v), p.needsUpdate = !1), p.program == null)
                  return null;
                var l = !1, g = p.program, M = g.uniforms, L = p.uniforms;
                if (g != this._currentProgram && (this._gl.useProgram(g), this._currentProgram = g, l = !0), p.id != this._currentMaterialId && (this._currentMaterialId = p.id, l = !0), s != this._currentCamera && (this._currentCamera = s, l = !0), this._gl.uniformMatrix4fv(M.projectionMatrix, !1, s.projectionMatrix.elements), this._gl.uniformMatrix4fv(M.modelViewMatrix, !1, v._modelViewMatrix.elements), this._gl.uniformMatrix3fv(M.normalMatrix, !1, v._normalMatrix.elements), l) {
                  if (L.fogColor.value = w.color, L.fogNear.value = w.near, L.fogFar.value = w.far, p.shaderID.startsWith("lambert") || p.shaderID === "instanced" || p.shaderID.endsWith("imposter"))
                    this._gl.uniformMatrix4fv(M.viewMatrix, !1, s.matrixWorldInverse.elements), this._lightsNeedUpdate && (this.setupLights(g, o), this._lightsNeedUpdate = !1), L.directionalLightColor.value = this._lights.directional.colors, L.directionalLightDirection.value = this._lights.directional.positions;
                  else if (p.shaderID.endsWith("outline"))
                    L.outlineColor.value = p.outlineColor, L.outlineWidth.value = p.outlineWidth, L.outlinePushback.value = p.outlinePushback;
                  else if (p.shaderID === "volumetric") {
                    v._modelViewMatrix.getScale(this._direction), this._worldInverse.getInverse(v._modelViewMatrix), this._projInverse.getInverse(s.projectionMatrix), this._textureMatrix.multiplyMatrices(v.material.texmatrix, this._worldInverse), this._gl.uniformMatrix4fv(M.textmat, !1, this._textureMatrix.elements), this._gl.uniformMatrix4fv(M.projinv, !1, this._projInverse.elements);
                    let T = Math.min(Math.min(this._direction.x, this._direction.y), this._direction.z);
                    L.step.value = v.material.unit * T, L.maxdepth.value = v.material.maxdepth * T, L.transfermax.value = v.material.transfermax, L.transfermin.value = v.material.transfermin, L.subsamples.value = v.material.subsamples, a.setTexture(v.material.transferfn, 4, !1), a.setTexture(v.material.map, 3, !0), this._gl.activeTexture(this._gl.TEXTURE5), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture);
                  }
                  L.opacity.value = p.opacity, this.loadMaterialUniforms(M, L);
                }
                return g;
              }
              loadMaterialUniforms(s, o) {
                var w, p, v, a;
                for (w in o)
                  s[w] && (p = o[w].type, v = o[w].value, a = s[w], p === "f" ? this._gl.uniform1f(a, v) : p === "i" ? this._gl.uniform1i(a, v) : p === "fv" ? this._gl.uniform3fv(a, v) : p === "c" ? this._gl.uniform3f(a, v.r, v.g, v.b) : p === "f4" && this._gl.uniform4f(a, v[0], v[1], v[2], v[3]));
              }
              // Objects adding
              addObject(s, o) {
                var w, p, v, a;
                if (!s.__webglInit && (s.__webglInit = !0, s._modelViewMatrix = new E.Matrix4(), s._normalMatrix = new E.Matrix3(), s.geometry !== void 0 && s.geometry.__webglInit === void 0 && (s.geometry.__webglInit = !0, s.geometry.addEventListener("dispose", this.onGeometryDispose.bind(this))), s instanceof c.Mesh || s instanceof c.Line))
                  for (v = s.geometry, w = 0, p = v.geometryGroups.length; w < p; w++)
                    a = v.geometryGroups[w], a.id = this._geometryGroupCounter++, a.__webglVertexBuffer || (s instanceof c.Mesh ? (this.createMeshBuffers(a), v.elementsNeedUpdate = !0, v.normalsNeedUpdate = !0) : s instanceof c.Line && this.createLineBuffers(a), v.verticesNeedUpdate = !0, v.colorsNeedUpdate = !0);
                if (!s.__webglActive) {
                  if (s instanceof c.Mesh || s instanceof c.Line)
                    for (v = s.geometry, w = 0, p = v.geometryGroups.length; w < p; w++)
                      a = v.geometryGroups[w], this.addBuffer(o.__webglObjects, a, s);
                  else
                    s instanceof c.Sprite && o.__webglSprites.push(s);
                  s.__webglActive = !0;
                }
              }
              updateObject(s) {
                var o = s.geometry, w;
                if (s instanceof c.Mesh || s instanceof c.Line) {
                  for (var p = 0, v = o.geometryGroups.length; p < v; p++)
                    w = o.geometryGroups[p], (o.verticesNeedUpdate || o.elementsNeedUpdate || o.colorsNeedUpdate || o.normalsNeedUpdate) && this.setBuffers(w, this._gl.STATIC_DRAW);
                  o.verticesNeedUpdate = !1, o.elementsNeedUpdate = !1, o.normalsNeedUpdate = !1, o.colorsNeedUpdate = !1, o.buffersNeedUpdate = !1;
                }
              }
              removeObject(s, o) {
                s instanceof c.Mesh || s instanceof c.Line ? this.removeInstances(o.__webglObjects, s) : s instanceof c.Sprite && this.removeInstancesDirect(o.__webglSprites, s), s.__webglActive = !1;
              }
              removeInstances(s, o) {
                for (var w = s.length - 1; w >= 0; --w)
                  s[w].object === o && s.splice(w, 1);
              }
              removeInstancesDirect(s, o) {
                for (var w = s.length - 1; w >= 0; --w)
                  s[w] === o && s.splice(w, 1);
              }
              unrollBufferMaterial(s) {
                var o = s.object, w = o.material;
                if (w.volumetric)
                  s.opaque = null, s.transparent = null, s.volumetric = w;
                else if (w.transparent) {
                  if (s.opaque = null, s.volumetric = null, s.transparent = w, !w.wireframe) {
                    var p = w.clone();
                    p.opacity = 0, s.blank = p;
                  }
                } else
                  s.opaque = w, s.transparent = null, s.volumetric = null;
              }
              setBuffers(s, o) {
                var w = s.vertexArray, p = s.colorArray;
                if (s.__webglOffsetBuffer !== void 0 ? (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglOffsetBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, w, o)) : (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, w, o)), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglColorBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, p, o), s.normalArray && s.__webglNormalBuffer !== void 0) {
                  var v = s.normalArray;
                  this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, v, o);
                }
                if (s.radiusArray && s.__webglRadiusBuffer !== void 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglRadiusBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, s.radiusArray, o)), s.faceArray && s.__webglFaceBuffer !== void 0) {
                  var a = s.faceArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, s.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, a, o);
                }
                if (s.lineArray && s.__webglLineBuffer !== void 0) {
                  var l = s.lineArray;
                  this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, s.__webglLineBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, l, o);
                }
              }
              // Creates appropriate gl buffers for geometry chunk
              // TODO: do we need line buffer for mesh objects?
              // Also, can we integrate this with createLineBuffers?
              createMeshBuffers(s) {
                s.radiusArray && (s.__webglRadiusBuffer = this._gl.createBuffer()), s.useOffset && (s.__webglOffsetBuffer = this._gl.createBuffer()), s.__webglVertexBuffer = this._gl.createBuffer(), s.__webglNormalBuffer = this._gl.createBuffer(), s.__webglColorBuffer = this._gl.createBuffer(), s.__webglFaceBuffer = this._gl.createBuffer(), s.__webglLineBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              createLineBuffers(s) {
                s.__webglVertexBuffer = this._gl.createBuffer(), s.__webglColorBuffer = this._gl.createBuffer(), this.info.memory.geometries++;
              }
              addBuffer(s, o, w) {
                s.push({
                  buffer: o,
                  object: w,
                  opaque: null,
                  transparent: null
                });
              }
              setupMatrices(s, o) {
                s._modelViewMatrix.multiplyMatrices(o.matrixWorldInverse, s.matrixWorld), s._normalMatrix.getInverse(s._modelViewMatrix), s._normalMatrix.transpose();
              }
              // Fallback filters for non-power-of-2 textures
              filterFallback(s) {
                return this._gl.LINEAR;
              }
              setTextureParameters(s, o) {
                s == this._gl.TEXTURE_2D ? (this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this.filterFallback(o.magFilter)), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this.filterFallback(o.minFilter))) : (this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_R, this._gl.CLAMP_TO_EDGE), this._extColorBufferFloat && this._extFloatLinear ? (this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR)) : (this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST)));
              }
              // Map constants to WebGL constants
              paramToGL(s) {
                return s === u.UnsignedByteType ? this._gl.UNSIGNED_BYTE : s === u.RGBAFormat ? this._gl.RGBA : s === u.NearestFilter ? this._gl.NEAREST : 0;
              }
              setupLights(s, o) {
                var w, p, v, a = 0, l = 0, g = 0, M, L, T = this._lights, D = T.directional.colors, I = T.directional.positions, z = 0, P = 0;
                for (w = 0, p = o.length; w < p; w++)
                  if (v = o[w], M = v.color, L = v.intensity, v instanceof y.Light) {
                    if (this._direction.getPositionFromMatrix(v.matrixWorld), this._vector3.getPositionFromMatrix(v.target.matrixWorld), this._direction.sub(this._vector3), this._direction.normalize(), this._direction.x === 0 && this._direction.y === 0 && this._direction.z === 0)
                      continue;
                    I[P] = this._direction.x, I[P + 1] = this._direction.y, I[P + 2] = this._direction.z, D[P] = M.r * L, D[P + 1] = M.g * L, D[P + 2] = M.b * L, P += 3, z++;
                  }
                T.ambient[0] = a, T.ambient[1] = l, T.ambient[2] = g, T.directional.length = z;
              }
              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 s = this._gl.getParameter(this._gl.VERSION);
                  this._webglversion = parseInt(s[6]);
                } catch (o) {
                  console.error(o);
                }
              }
              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(s, o, w, p, v, a, l, D) {
                var M, L, T, D, I, z, P;
                o ? (I = s.length - 1, z = -1, P = -1) : (I = 0, z = s.length, P = 1);
                for (var B = I; B !== z; B += P)
                  if (M = s[B], M.render) {
                    if (L = M.object, T = M.buffer, D = M[w], !D)
                      continue;
                    l && this.setBlending(!0), this.setDepthTest(D.depthTest), this.setDepthWrite(D.depthWrite), this.setPolygonOffset(D.polygonOffset, D.polygonOffsetFactor, D.polygonOffsetUnits);
                    var F = L._modelViewMatrix.isReflected();
                    this.setMaterialFaces(D, F), this.renderBuffer(p, v, a, D, T, L), (this._outlineEnabled || D.outline) && (D.shaderID == "sphereimposter" ? this.renderBuffer(p, v, a, this._outlineSphereImposterMaterial, T, L) : D.shaderID == "stickimposter" ? this.renderBuffer(p, v, a, this._outlineStickImposterMaterial, T, L) : !D.wireframe && D.shaderID !== "basic" && D.opacity !== 0 && this.renderBuffer(p, v, a, this._outlineMaterial, T, L));
                  }
              }
              renderSprites(s, o, w) {
                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(s, o, this._currentWidth, this._currentHeight, w), 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 ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpritePlugin: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./shaders/index */
              "./src/WebGL/shaders/index.ts"
            );
            class f {
              constructor() {
                this.sprite = {
                  vertices: null,
                  faces: null,
                  vertexBuffer: null,
                  elementBuffer: null,
                  program: null,
                  attributes: {},
                  uniforms: null
                };
              }
              init(h) {
                this.gl = h.context, this.renderer = h, this.precision = h.getPrecision(), this.sprite.vertices = new Float32Array(16), this.sprite.faces = new Uint16Array(6);
                var _ = 0;
                this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, _ = 0, this.sprite.faces[_++] = 0, this.sprite.faces[_++] = 1, this.sprite.faces[_++] = 2, this.sprite.faces[_++] = 0, this.sprite.faces[_++] = 2, this.sprite.faces[_++] = 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(
                  n.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(h, _, E, c, C) {
                var b, A, S, s, o, w, p, v, a, l;
                if (!this.gl)
                  throw new Error("WebGLRenderer not initialized");
                let g = [];
                (b = h == null ? void 0 : h.__webglSprites) === null || b === void 0 || b.forEach((Q) => {
                  (C && Q.material.depthTest == !1 || !C && Q.material.depthTest) && g.push(Q);
                });
                let M = g.length;
                if (!M)
                  return;
                const L = this.sprite.attributes, T = this.sprite.uniforms;
                if (!T)
                  throw new Error("Uniforms not defined");
                var D = E * 0.5, I = c * 0.5;
                this.gl.useProgram(this.sprite.program), this.gl.enableVertexAttribArray(L.position), this.gl.enableVertexAttribArray(L.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(L.position, 2, this.gl.FLOAT, !1, 16, 0), this.gl.vertexAttribPointer(L.uv, 2, this.gl.FLOAT, !1, 16, 8), this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.elementBuffer), this.gl.uniformMatrix4fv(T.projectionMatrix, !1, _.projectionMatrix.elements), this.gl.activeTexture(this.gl.TEXTURE0), this.gl.uniform1i(T.map, 0);
                var z = 0, P = 0, B = h.fog;
                B ? (this.gl.uniform3f(T.fogColor, B.color.r, B.color.g, B.color.b), this.gl.uniform1f(T.fogNear, B.near), this.gl.uniform1f(T.fogFar, B.far), this.gl.uniform1i(T.fogType, 1), z = 1, P = 1) : (this.gl.uniform1i(T.fogType, 0), z = 0, P = 0);
                var F;
                let N, $, k, G, H = [];
                for (F = 0; F < M; F++)
                  N = g[F], $ = N.material, $ && ($.depthTest == !1 && !C || !N.visible || $.opacity === 0 || ($.useScreenCoordinates ? N.z = -N.position.z : (N._modelViewMatrix.multiplyMatrices(_.matrixWorldInverse, N.matrixWorld), N.z = -N._modelViewMatrix.elements[14])));
                for (g.sort(u), F = 0; F < M; F++)
                  if (N = g[F], $ = N.material, !!$ && !(!N.visible || $.opacity === 0) && $.map && $.map.image && $.map.image.width) {
                    this.gl.uniform1f((T == null ? void 0 : T.alphaTest) || null, $.alphaTest);
                    var U = $.map.image.width, V = $.map.image.height;
                    H[0] = U * this.renderer.devicePixelRatio / E, H[1] = V * this.renderer.devicePixelRatio / c, $.useScreenCoordinates === !0 ? (this.gl.uniform1i(T.useScreenCoordinates, 1), this.gl.uniform3f(T.screenPosition, (N.position.x * this.renderer.devicePixelRatio - D) / D, (I - N.position.y * this.renderer.devicePixelRatio) / I, Math.max(0, Math.min(1, N.position.z)))) : (this.gl.uniform1i(T.useScreenCoordinates, 0), this.gl.uniformMatrix4fv(T.modelViewMatrix, !1, N._modelViewMatrix.elements)), h.fog && $.fog ? G = P : G = 0, z !== G && (this.gl.uniform1i(T.fogType, G), z = G), k = 1 / ($.scaleByViewport ? c : 1), H[0] *= k * N.scale.x, H[1] *= k * N.scale.y;
                    let Q = (A = $ == null ? void 0 : $.alignment) === null || A === void 0 ? void 0 : A.x, ae = (S = $ == null ? void 0 : $.alignment) === null || S === void 0 ? void 0 : S.y;
                    $.screenOffset && (Q = (Q || 0) + 2 * $.screenOffset.x / U, ae = (ae || 0) + 2 * $.screenOffset.y / V), this.gl.uniform2f(T.uvScale, ((s = $ == null ? void 0 : $.uvScale) === null || s === void 0 ? void 0 : s.x) || 1, ((o = $ == null ? void 0 : $.uvScale) === null || o === void 0 ? void 0 : o.y) || 1), this.gl.uniform2f(T.uvOffset, ((w = $ == null ? void 0 : $.uvOffset) === null || w === void 0 ? void 0 : w.x) || 0, ((p = $ == null ? void 0 : $.uvOffset) === null || p === void 0 ? void 0 : p.y) || 0), this.gl.uniform2f(T.alignment, Q || 0, ae || 0), this.gl.uniform1f(T.opacity, $.opacity), this.gl.uniform3f(T.color, ((v = $ == null ? void 0 : $.color) === null || v === void 0 ? void 0 : v.r) || 0, ((a = $ == null ? void 0 : $.color) === null || a === void 0 ? void 0 : a.g) || 0, ((l = $ == null ? void 0 : $.color) === null || l === void 0 ? void 0 : l.b) || 0), this.gl.uniform1f(T.rotation, N.rotation), this.gl.uniform2fv(T.scale, H), this.renderer.setDepthTest($.depthTest), this.renderer.setDepthWrite($.depthWrite), this.renderer.setTexture($.map, 0), this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);
                  }
                this.gl.enable(this.gl.CULL_FACE);
              }
              createProgram(h, _) {
                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 c = this.gl.createShader(this.gl.FRAGMENT_SHADER), C = this.gl.createShader(this.gl.VERTEX_SHADER);
                if (!c)
                  throw new Error("Unable to create fragment shader SpritePlugin.createProgram");
                if (!C)
                  throw new Error("Unable to create vertex shader SpritePlugin.createProgram");
                var b = "precision " + _ + ` float;
`;
                if (this.gl.shaderSource(c, b + h.fragmentShader), this.gl.shaderSource(C, b + h.vertexShader), this.gl.compileShader(c), this.gl.compileShader(C), !this.gl.getShaderParameter(c, this.gl.COMPILE_STATUS) || !this.gl.getShaderParameter(C, this.gl.COMPILE_STATUS))
                  throw new Error(`Error compiling shader: 
      ${this.gl.getShaderInfoLog(c)} 
      ${this.gl.getShaderInfoLog(C)}`);
                return this.gl.attachShader(E, c), this.gl.attachShader(E, C), this.gl.linkProgram(E), this.gl.getProgramParameter(E, this.gl.LINK_STATUS) || console.error("Could not initialize shader"), E;
              }
            }
            function u(y, h) {
              return y.z !== h.z ? h.z - y.z : h.id - y.id;
            }
          }
        ),
        /***/
        "./src/WebGL/constants/Coloring.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/constants/Coloring.ts ***!
            \*****************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Coloring: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            var n;
            (function(f) {
              f[f.NoColors = 0] = "NoColors", f[f.FaceColors = 1] = "FaceColors", f[f.VertexColors = 2] = "VertexColors";
            })(n || (n = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Shading.ts": (
          /*!****************************************!*\
            !*** ./src/WebGL/constants/Shading.ts ***!
            \****************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Shading: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            var n;
            (function(f) {
              f[f.NoShading = 0] = "NoShading", f[f.FlatShading = 1] = "FlatShading", f[f.SmoothShading = 2] = "SmoothShading";
            })(n || (n = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/Sides.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/Sides.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* binding */
                f
              ),
              /* harmony export */
              DoubleSide: () => (
                /* binding */
                u
              ),
              /* harmony export */
              FrontSide: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = 0, f = 1, u = 2;
          }
        ),
        /***/
        "./src/WebGL/constants/SpriteAlignment.ts": (
          /*!************************************************!*\
            !*** ./src/WebGL/constants/SpriteAlignment.ts ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpriteAlignment: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const f = {
              topLeft: new n.Vector2(1, -1),
              topCenter: new n.Vector2(0, -1),
              topRight: new n.Vector2(-1, -1),
              centerLeft: new n.Vector2(1, 0),
              center: new n.Vector2(0, 0),
              centerRight: new n.Vector2(-1, 0),
              bottomLeft: new n.Vector2(1, 1),
              bottomCenter: new n.Vector2(0, 1),
              bottomRight: new n.Vector2(-1, 1)
            };
          }
        ),
        /***/
        "./src/WebGL/constants/TextureConstants.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/constants/TextureConstants.ts ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* binding */
                n
              ),
              /* harmony export */
              FloatType: () => (
                /* binding */
                _
              ),
              /* harmony export */
              LinearFilter: () => (
                /* binding */
                f
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* binding */
                y
              ),
              /* harmony export */
              NearestFilter: () => (
                /* binding */
                u
              ),
              /* harmony export */
              R32Format: () => (
                /* binding */
                C
              ),
              /* harmony export */
              RFormat: () => (
                /* binding */
                c
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* binding */
                E
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            const n = 1001, f = 1006, u = 1007, y = 1008, h = 1009, _ = 1010, E = 1021, c = 1022, C = 1023;
          }
        ),
        /***/
        "./src/WebGL/constants/TextureOperations.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/constants/TextureOperations.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              TextureOperations: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            var n;
            (function(f) {
              f[f.MultiplyOperation = 0] = "MultiplyOperation", f[f.MixOperation = 1] = "MixOperation", f[f.AddOperation = 2] = "AddOperation";
            })(n || (n = {}));
          }
        ),
        /***/
        "./src/WebGL/constants/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/constants/index.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                f.BackSide
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                h.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                n.Coloring
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                f.DoubleSide
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                h.FloatType
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                f.FrontSide
              ),
              /* harmony export */
              LinearFilter: () => (
                /* reexport safe */
                h.LinearFilter
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* reexport safe */
                h.LinearMipMapLinearFilter
              ),
              /* harmony export */
              NearestFilter: () => (
                /* reexport safe */
                h.NearestFilter
              ),
              /* harmony export */
              R32Format: () => (
                /* reexport safe */
                h.R32Format
              ),
              /* harmony export */
              RFormat: () => (
                /* reexport safe */
                h.RFormat
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* reexport safe */
                h.RGBAFormat
              ),
              /* harmony export */
              Shading: () => (
                /* reexport safe */
                u.Shading
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                y.SpriteAlignment
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                _.TextureOperations
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                h.UnsignedByteType
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), f = t(
              /*! ./Sides */
              "./src/WebGL/constants/Sides.ts"
            ), u = t(
              /*! ./Shading */
              "./src/WebGL/constants/Shading.ts"
            ), y = t(
              /*! ./SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), h = t(
              /*! ./TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), _ = t(
              /*! ./TextureOperations */
              "./src/WebGL/constants/TextureOperations.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/core/EventDispatcher.ts": (
          /*!*******************************************!*\
            !*** ./src/WebGL/core/EventDispatcher.ts ***!
            \*******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              EventDispatcher: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            class n {
              constructor() {
                this.listeners = {};
              }
              dispatchEvent(u) {
                var y = this.listeners[u.type];
                if (y !== void 0) {
                  u.target = this;
                  for (var h = 0, _ = y.length; h < _; h++)
                    y[h].call(this, u);
                }
              }
              removeEventListener(u, y) {
                if (!y)
                  this.listeners[u] = [];
                else {
                  var h = this.listeners[u].indexOf(y);
                  h !== -1 && this.listeners[u].splice(h, 1);
                }
              }
              addEventListener(u, y) {
                this.listeners[u] === void 0 && (this.listeners[u] = []), this.listeners[u].indexOf(y) === -1 && this.listeners[u].push(y);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Geometry.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Geometry.ts ***!
            \************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Geometry: () => (
                /* binding */
                E
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* binding */
                _
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* binding */
                c
              )
              /* harmony export */
            });
            var n = t(
              /*! ../materials/LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), f = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), u = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), y = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            const h = 65535;
            class _ {
              constructor(b = 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 = b;
              }
              setColors(b) {
                var A = this.vertexArray, S = this.colorArray;
                if (!A)
                  throw new Error("vertex array not initialized");
                if (!S)
                  throw new Error("color array not initialized");
                if (A.length != S.length) {
                  console.log("Cannot re-color geometry group due to mismatched lengths.");
                  return;
                }
                for (var s = 0; s < A.length; s += 3) {
                  var o = b(A[s], A[s + 1], A[s + 2]);
                  o instanceof y.Color || (o = y.CC.color(o)), S[s] = o.r, S[s + 1] = o.g, S[s + 2] = o.b;
                }
              }
              getNumVertices() {
                return this.vertices;
              }
              getVertices() {
                return this.vertexArray;
              }
              getCentroid() {
                if (!this.vertexArray)
                  throw new Error("vertex array not initialized");
                for (var b = new u.Vector3(), A, S, s, o, w = 0; w < this.vertices; ++w)
                  A = w * 3, S = this.vertexArray[A], s = this.vertexArray[A + 1], o = this.vertexArray[A + 2], b.x += S, b.y += s, b.z += o;
                return b.divideScalar(this.vertices), b;
              }
              //setup normals - vertex and face array must exist
              setNormals() {
                var b = this.faceArray, A = this.vertexArray, S = this.normalArray;
                if (!(!this.vertices || !this.faceidx)) {
                  if (!b)
                    throw new Error("face array not initialized");
                  if (!A)
                    throw new Error("vertex array not initialized");
                  if (!S)
                    throw new Error("normal array not initialized");
                  for (var s, o, w, p, v, a, l, g = 0; g < b.length / 3; ++g)
                    s = b[g * 3] * 3, o = b[g * 3 + 1] * 3, w = b[g * 3 + 2] * 3, p = new u.Vector3(A[s], A[s + 1], A[s + 2]), v = new u.Vector3(A[o], A[o + 1], A[o + 2]), a = new u.Vector3(A[w], A[w + 1], A[w + 2]), p.subVectors(p, v), a.subVectors(a, v), a.cross(p), l = a, l.normalize(), S[s] += l.x, S[o] += l.x, S[w] += l.x, S[s + 1] += l.y, S[o + 1] += l.y, S[w + 1] += l.y, S[s + 2] += l.z, S[o + 2] += l.z, S[w + 2] += l.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 b = this.faceArray, A = this.lineArray = new Uint16Array(this.faceidx * 2);
                  if (this.lineidx = this.faceidx * 2, !b)
                    throw new Error("face array not initialized");
                  for (var S = 0; S < this.faceidx / 3; ++S) {
                    var s = S * 3, o = s * 2, w = b[s], p = b[s + 1], v = b[s + 2];
                    A[o] = w, A[o + 1] = p, A[o + 2] = w, A[o + 3] = v, A[o + 4] = p, A[o + 5] = v;
                  }
                }
              }
              vrml(b, A) {
                var S, s, o, w, p, v, a, l, g, M, L, T, D, I, z, P = "";
                P += b + `Shape {
` + b + ` appearance Appearance {
` + b + `  material Material {
` + b + "   diffuseColor " + ((S = A == null ? void 0 : A.color) === null || S === void 0 ? void 0 : S.r) + " " + ((s = A == null ? void 0 : A.color) === null || s === void 0 ? void 0 : s.g) + " " + ((o = A == null ? void 0 : A.color) === null || o === void 0 ? void 0 : o.b) + `
`, A != null && A.transparent && (P += b + "   transparency " + (1 - A.opacity) + `
`), P += b + `  }
`, P += b + ` }
`;
                var B = b;
                if (b += " ", A instanceof n.LineBasicMaterial) {
                  P += b + `geometry IndexedLineSet {
` + b + ` colorPerVertex TRUE
` + b + ` coord Coordinate {
` + b + `  point [
`;
                  let N, $, k;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    N = (w = this.vertexArray) === null || w === void 0 ? void 0 : w[H], $ = (p = this.vertexArray) === null || p === void 0 ? void 0 : p[H + 1], k = (v = this.vertexArray) === null || v === void 0 ? void 0 : v[H + 2], P += b + "   " + N + " " + $ + " " + k + `,
`;
                  }
                  if (P += b + `  ]
`, P += b + ` }
`, this.colorArray) {
                    P += b + ` color Color {
` + b + `  color [
`;
                    for (let G = 0; G < this.vertices; ++G) {
                      let H = G * 3;
                      N = this.colorArray[H], $ = this.colorArray[H + 1], k = this.colorArray[H + 2], P += b + "   " + N + " " + $ + " " + k + `,
`;
                    }
                    P += b + `  ]
`, P += b + ` }
`;
                  }
                  P += b + ` coordIndex [
`;
                  for (let G = 0; G < this.vertices; G += 2)
                    P += b + "  " + G + ", " + (G + 1) + `, -1,
`;
                  P += b + ` ]
`, P += b + `}
`;
                } else {
                  P += b + `geometry IndexedFaceSet {
` + b + ` colorPerVertex TRUE
` + b + ` normalPerVertex TRUE
` + b + ` solid FALSE
`, P += b + ` coord Coordinate {
` + b + `  point [
`;
                  let N, $, k;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    N = (a = this.vertexArray) === null || a === void 0 ? void 0 : a[H], $ = (l = this.vertexArray) === null || l === void 0 ? void 0 : l[H + 1], k = (g = this.vertexArray) === null || g === void 0 ? void 0 : g[H + 2], P += b + "   " + N + " " + $ + " " + k + `,
`;
                  }
                  P += b + `  ]
`, P += b + ` }
`, P += b + ` normal Normal {
` + b + `  vector [
`;
                  for (let G = 0; G < this.vertices; ++G) {
                    let H = G * 3;
                    N = (M = this.normalArray) === null || M === void 0 ? void 0 : M[H], $ = (L = this.normalArray) === null || L === void 0 ? void 0 : L[H + 1], k = (T = this.normalArray) === null || T === void 0 ? void 0 : T[H + 2], P += b + "   " + N + " " + $ + " " + k + `,
`;
                  }
                  if (P += b + `  ]
`, P += b + ` }
`, this.colorArray) {
                    P += b + ` color Color {
` + b + `  color [
`;
                    for (let G = 0; G < this.vertices; ++G) {
                      let H = G * 3;
                      N = this.colorArray[H], $ = this.colorArray[H + 1], k = this.colorArray[H + 2], P += b + "   " + N + " " + $ + " " + k + `,
`;
                    }
                    P += b + `  ]
`, P += b + ` }
`;
                  }
                  P += b + ` coordIndex [
`;
                  for (var F = 0; F < this.faceidx; F += 3)
                    N = (D = this.faceArray) === null || D === void 0 ? void 0 : D[F], $ = (I = this.faceArray) === null || I === void 0 ? void 0 : I[F + 1], k = (z = this.faceArray) === null || z === void 0 ? void 0 : z[F + 2], P += b + "  " + N + ", " + $ + ", " + k + `, -1,
`;
                  P += b + ` ]
`, P += b + `}
`;
                }
                return P += B + "}", P;
              }
              truncateArrayBuffers(b = !0, A = !1) {
                var S = this.vertexArray, s = this.colorArray, o = this.normalArray, w = this.faceArray, p = this.lineArray, v = this.radiusArray;
                this.vertexArray = (S == null ? void 0 : S.subarray(0, this.vertices * 3)) || null, this.colorArray = (s == null ? void 0 : s.subarray(0, this.vertices * 3)) || null, b ? (this.normalArray = (o == null ? void 0 : o.subarray(0, this.vertices * 3)) || null, this.faceArray = (w == null ? void 0 : w.subarray(0, this.faceidx)) || null, this.lineidx > 0 ? this.lineArray = (p == null ? void 0 : p.subarray(0, this.lineidx)) || null : this.lineArray = new Uint16Array(0)) : (this.normalArray = new Float32Array(0), this.faceArray = new Uint16Array(0), this.lineArray = new Uint16Array(0)), v && (this.radiusArray = v.subarray(0, this.vertices)), A && (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 f.EventDispatcher {
              constructor(b = !1, A = !1, S = !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 = c++, this.mesh = b, this.radii = A, this.offset = S;
              }
              //Get geometry group to accomodate addVertices new vertices - create
              // new group if necessary
              updateGeoGroup(b = 0) {
                var A, S = this.groups > 0 ? this.geometryGroups[this.groups - 1] : null;
                return (!S || S.vertices + b > (((A = S == null ? void 0 : S.vertexArray) === null || A === void 0 ? void 0 : A.length) || 0) / 3) && (S = this.addGeoGroup()), S;
              }
              //return comma separated list of IndexedFace (or Line) sets from geometry groups
              vrml(b, A) {
                for (var S = "", s = this.geometryGroups.length, o = 0; o < s; o++) {
                  var w = this.geometryGroups[o];
                  S += w.vrml(b, A) + `,
`;
                }
                return S;
              }
              addGeoGroup() {
                var b = new _(this.geometryGroups.length);
                return this.geometryGroups.push(b), this.groups = this.geometryGroups.length, b.vertexArray = new Float32Array(h * 3), b.colorArray = new Float32Array(h * 3), this.mesh && (b.normalArray = new Float32Array(h * 3), b.faceArray = new Uint16Array(h * 6), b.lineArray = new Uint16Array(h * 6)), this.radii && (b.radiusArray = new Float32Array(h)), b.useOffset = this.offset, b;
              }
              setUpNormals(...b) {
                for (var A = 0; A < this.groups; A++) {
                  var S = this.geometryGroups[A];
                  S.setNormals(...b);
                }
              }
              setColors(...b) {
                for (var A = this.geometryGroups.length, S = 0; S < A; S++) {
                  var s = this.geometryGroups[S];
                  s.setColors(...b);
                }
              }
              setUpWireframe(...b) {
                for (var A = 0; A < this.groups; A++) {
                  var S = this.geometryGroups[A];
                  S.setLineIndices(...b);
                }
              }
              //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 b = 0; b < this.groups; b++) {
                  var A = this.geometryGroups[b];
                  A.__inittedArrays !== !0 && A.truncateArrayBuffers(this.mesh, !1);
                }
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
              get vertices() {
                for (var b = 0, A = 0; A < this.groups; A++)
                  b += this.geometryGroups[A].vertices;
                return b;
              }
            }
            let c = 0;
          }
        ),
        /***/
        "./src/WebGL/core/Object3D.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/core/Object3D.ts ***!
            \************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Light: () => (
                /* binding */
                _
              ),
              /* harmony export */
              Object3D: () => (
                /* binding */
                y
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* binding */
                u
              ),
              /* harmony export */
              Scene: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), f = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            let u = 0;
            class y {
              constructor() {
                this.id = u++, this.name = "", this.children = [], this.position = new n.Vector3(), this.rotation = new n.Vector3(), this.matrix = new n.Matrix4(), this.matrixWorld = new n.Matrix4(), this.quaternion = new n.Quaternion(), this.eulerOrder = "XYZ", this.up = new n.Vector3(0, 1, 0), this.scale = new n.Vector3(1, 1, 1), this.matrixAutoUpdate = !0, this.matrixWorldNeedsUpdate = !0, this.rotationAutoUpdate = !0, this.useQuaternion = !1, this.visible = !0;
              }
              lookAt(c) {
                this.matrix.lookAt(c, this.position, this.up), this.rotationAutoUpdate && (this.useQuaternion === !0 ? console.error("Unimplemented math operation.") : this.rotation instanceof n.Vector3 && this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder));
              }
              //add child object
              add(c) {
                if (c === this) {
                  console.error("Can't add $3Dmol.Object3D to itself");
                  return;
                }
                c.parent = this, this.children.push(c);
                for (var C = this; C.parent !== void 0; )
                  C = C.parent;
                C !== void 0 && C instanceof h && C.__addObject(c);
              }
              remove(c) {
                var C = this.children.indexOf(c);
                if (C !== -1) {
                  c.parent = void 0, this.children.splice(C, 1);
                  for (var b = this; b.parent !== void 0; )
                    b = b.parent;
                  b !== void 0 && b instanceof h && b.__removeObject(c);
                }
              }
              //convert to vrml
              vrml(c) {
                c || (c = " ");
                var C = 2 * Math.atan2(this.quaternion.lengthxyz(), this.quaternion.w), b = 0, A = 0, S = 0;
                if (C != 0) {
                  let w = Math.sin(C / 2);
                  b = this.quaternion.x / w, A = this.quaternion.y / w, S = this.quaternion.z / w;
                }
                var s = c + `Transform {
` + c + " center " + this.position.x + " " + this.position.y + " " + this.position.z + `
` + c + " rotation " + b + " " + A + " " + S + " " + C + `
` + c + ` children [
`;
                this.geometry && (s += this.geometry.vrml(c, this.material));
                for (var o = 0; o < this.children.length; o++)
                  s += this.children[o].vrml(c + " ") + `,
`;
                return s += ` ]
`, s += "}", s;
              }
              updateMatrix() {
                this.matrix.setPosition(this.position), this.useQuaternion === !1 && this.rotation instanceof n.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(c) {
                this.matrixAutoUpdate === !0 && this.updateMatrix(), (this.matrixWorldNeedsUpdate === !0 || c === !0) && (this.parent === void 0 ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1;
                for (var C = 0; C < this.children.length; C++)
                  this.children[C].updateMatrixWorld(!0);
              }
              clone(c) {
                c === void 0 && (c = new y()), c.name = this.name, c.up.copy(this.up), c.position.copy(this.position), c.rotation instanceof n.Vector3 && this.rotation instanceof n.Vector3 ? c.rotation.copy(this.rotation) : c.rotation = this.rotation, c.eulerOrder = this.eulerOrder, c.scale.copy(this.scale), c.rotationAutoUpdate = this.rotationAutoUpdate, c.matrix.copy(this.matrix), c.matrixWorld.copy(this.matrixWorld), c.quaternion.copy(this.quaternion), c.matrixAutoUpdate = this.matrixAutoUpdate, c.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate, c.useQuaternion = this.useQuaternion, c.visible = this.visible;
                for (var C = 0; C < this.children.length; C++) {
                  var b = this.children[C];
                  c.add(b.clone());
                }
                return c;
              }
              setVisible(c) {
                this.visible = c;
                for (var C = 0; C < this.children.length; C++) {
                  var b = this.children[C];
                  b.setVisible(c);
                }
              }
            }
            class h extends y {
              constructor() {
                super(...arguments), this.fog = null, this.overrideMaterial = null, this.matrixAutoUpdate = !1, this.__objects = [], this.__lights = [], this.__objectsAdded = [], this.__objectsRemoved = [];
              }
              __addObject(c) {
                if (c instanceof _)
                  this.__lights.indexOf(c) === -1 && this.__lights.push(c), c.target && c.target.parent === void 0 && this.add(c.target);
                else if (this.__objects.indexOf(c) === -1) {
                  this.__objects.push(c), this.__objectsAdded.push(c);
                  var C = this.__objectsRemoved.indexOf(c);
                  C !== -1 && this.__objectsRemoved.splice(C, 1);
                }
                for (var b = 0; b < c.children.length; b++)
                  this.__addObject(c.children[b]);
              }
              __removeObject(c) {
                var C;
                if (c instanceof _)
                  C = this.__lights.indexOf(c), C !== -1 && this.__lights.splice(C, 1);
                else if (C = this.__objects.indexOf(c), C !== -1) {
                  this.__objects.splice(C, 1), this.__objectsRemoved.push(c);
                  var b = this.__objectsAdded.indexOf(c);
                  b !== -1 && this.__objectsAdded.splice(C, 1);
                }
                for (var A = 0; A < c.children.length; A++)
                  this.__removeObject(c.children[A]);
              }
            }
            class _ extends y {
              constructor(c, C = 1) {
                super(), this.position = new n.Vector3(0, 1, 0), this.target = new y(), this.castShadow = !1, this.onlyShadow = !1, this.color = new f.Color(c), this.intensity = C;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Projector.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Projector.ts ***!
            \*************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Projector: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const f = new n.Matrix4();
            class u {
              static unprojectVector(h, _) {
                return _.projectionMatrixInverse.getInverse(_.projectionMatrix), f.multiplyMatrices(_.matrixWorld, _.projectionMatrixInverse), h.applyProjection(f);
              }
              static projectVector(h, _) {
                return _.matrixWorldInverse.getInverse(_.matrixWorld), f.multiplyMatrices(_.projectionMatrix, _.matrixWorldInverse), h.applyProjection(f);
              }
              projectVector(h, _) {
                return u.projectVector(h, _);
              }
              unprojectVector(h, _) {
                return u.unprojectVector(h, _);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/core/Raycaster.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/Raycaster.ts ***!
            \*************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Raycaster: () => (
                /* binding */
                h
              ),
              /* harmony export */
              intersectObject: () => (
                /* binding */
                w
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), f = t(
              /*! ../shapes */
              "./src/WebGL/shapes/index.ts"
            );
            const u = (p, v) => p.distance - v.distance, y = new n.Matrix4();
            class h {
              constructor(v, a, l, g) {
                this.precision = 1e-4, this.linePrecision = 0.2, this.ray = new n.Ray(v, a), this.ray.direction.lengthSq() > 0 && this.ray.direction.normalize(), this.near = g || 0, this.far = l || 1 / 0;
              }
              set(v, a) {
                this.ray.set(v, a);
              }
              setFromCamera(v, a) {
                a.ortho ? (this.ray.origin.set(v.x, v.y, (a.near + a.far) / (a.near - a.far)).unproject(a), this.ray.direction.set(0, 0, -1).transformDirection(a.matrixWorld)) : (this.ray.origin.setFromMatrixPosition(a.matrixWorld), this.ray.direction.set(v.x, v.y, v.z), a.projectionMatrixInverse.getInverse(a.projectionMatrix), y.multiplyMatrices(a.matrixWorld, a.projectionMatrixInverse), this.ray.direction.applyProjection(y), this.ray.direction.sub(this.ray.origin).normalize());
              }
              intersectObjects(v, a) {
                for (var l = [], g = 0, M = a.length; g < M; g++)
                  w(v, a[g], this, l);
                return l.sort(u), l;
              }
            }
            const _ = (p) => Math.min(Math.max(p, -1), 1);
            var E = new f.Sphere(), c = new f.Cylinder(), C = new f.Triangle(), b = new n.Vector3(), A = new n.Vector3(), S = new n.Vector3(), s = new n.Vector3(), o = new n.Vector3();
            function w(p, v, a, l) {
              if (o.getPositionFromMatrix(p.matrixWorld), v.intersectionShape === void 0)
                return l;
              var g = v.intersectionShape, M = a.linePrecision;
              M *= p.matrixWorld.getMaxScaleOnAxis();
              var L = M * M;
              if (v.boundingSphere !== void 0 && v.boundingSphere instanceof f.Sphere && (E.copy(v.boundingSphere), E.applyMatrix4(p.matrixWorld), !a.ray.isIntersectionSphere(E)))
                return l;
              var T, D, I, z, P, B, F, N, $, k, G, H, U, V;
              for (T = 0, D = g.triangle.length; T < D; T++)
                if (g.triangle[T] instanceof f.Triangle) {
                  if (C.copy(g.triangle[T]), C.applyMatrix4(p.matrixWorld), I = C.getNormal(), z = a.ray.direction.dot(I), z >= 0 || (b.subVectors(C.a, a.ray.origin), F = I.dot(b) / z, F < 0))
                    continue;
                  A.copy(a.ray.direction).multiplyScalar(F).add(a.ray.origin), A.sub(C.a), S.copy(C.b).sub(C.a), s.copy(C.c).sub(C.a);
                  var Q = S.dot(s), ae = S.lengthSq(), oe = s.lengthSq();
                  if (H = (ae * A.dot(s) - Q * A.dot(S)) / (ae * oe - Q * Q), H < 0 || H > 1 || (G = (A.dot(S) - H * Q) / ae, G < 0 || G > 1 || G + H > 1))
                    continue;
                  l.push({ clickable: v, distance: F });
                }
              for (T = 0, D = g.cylinder.length; T < D; T++)
                if (g.cylinder[T] instanceof f.Cylinder) {
                  if (c.copy(g.cylinder[T]), c.applyMatrix4(p.matrixWorld), b.subVectors(c.c1, a.ray.origin), P = b.dot(c.direction), B = b.dot(a.ray.direction), z = _(a.ray.direction.dot(c.direction)), $ = 1 - z * z, $ === 0)
                    continue;
                  U = (z * B - P) / $, V = (B - z * P) / $, A.copy(c.direction).multiplyScalar(U).add(c.c1), S.copy(a.ray.direction).multiplyScalar(V).add(a.ray.origin), N = s.subVectors(A, S).lengthSq();
                  var q = c.radius * c.radius;
                  if (N <= q) {
                    if (k = (z * P - B) * (z * P - B) - $ * (b.lengthSq() - P * P - q), k <= 0 ? H = F = Math.sqrt(N) : H = F = (B - z * P - Math.sqrt(k)) / $, G = z * H - P, G < 0 || G * G > c.lengthSq() || H < 0)
                      continue;
                    l.push({ clickable: v, distance: F });
                  }
                }
              for (T = 0, D = g.line.length; T < D; T += 2) {
                A.copy(g.line[T]), A.applyMatrix4(p.matrixWorld), S.copy(g.line[T + 1]), S.applyMatrix4(p.matrixWorld), s.subVectors(S, A);
                var me = s.lengthSq();
                s.normalize(), b.subVectors(A, a.ray.origin);
                var ne = b.dot(s);
                B = b.dot(a.ray.direction), z = _(a.ray.direction.dot(s)), $ = 1 - z * z, $ !== 0 && (U = (z * B - ne) / $, V = (B - z * ne) / $, A.add(s.multiplyScalar(U)), S.copy(a.ray.direction).multiplyScalar(V).add(a.ray.origin), N = s.subVectors(S, A).lengthSq(), N < L && U * U < me && l.push({ clickable: v, distance: V }));
              }
              for (T = 0, D = g.sphere.length; T < D; T++)
                if (g.sphere[T] instanceof f.Sphere && (E.copy(g.sphere[T]), E.applyMatrix4(p.matrixWorld), a.ray.isIntersectionSphere(E))) {
                  A.subVectors(E.center, a.ray.origin);
                  var fe = A.dot(a.ray.direction);
                  if (k = fe * fe - (A.lengthSq() - E.radius * E.radius), fe < 0)
                    return l;
                  k <= 0 ? F = fe : F = fe - Math.sqrt(k), l.push({ clickable: v, distance: F });
                }
              return l;
            }
          }
        ),
        /***/
        "./src/WebGL/core/Texture.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/core/Texture.ts ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Texture: () => (
                /* binding */
                h
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ../constants/TextureConstants */
              "./src/WebGL/constants/TextureConstants.ts"
            ), f = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), u = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), y = t(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
            class h extends u.EventDispatcher {
              constructor(c, C) {
                super(), this.id = _++, this.name = "", this.image = c, this.mapping = new y.UVMapping(), this.wrapS = n.ClampToEdgeWrapping, this.wrapT = n.ClampToEdgeWrapping, this.anisotropy = 1, C ? (this.format = n.RFormat, this.type = n.FloatType, this.premultiplyAlpha = !1, this.flipY = !1, this.unpackAlignment = 1, this.magFilter = n.NearestFilter, this.minFilter = n.NearestFilter) : (this.format = n.RGBAFormat, this.type = n.UnsignedByteType, this.offset = new f.Vector2(0, 0), this.repeat = new f.Vector2(1, 1), this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.magFilter = n.LinearFilter, this.minFilter = n.LinearMipMapLinearFilter), this.needsUpdate = !1, this.onUpdate = null;
              }
              clone(c = new h()) {
                return c.image = this.image, c.mapping = this.mapping, c.wrapS = this.wrapS, c.wrapT = this.wrapT, c.magFilter = this.magFilter, c.minFilter = this.minFilter, c.anisotropy = this.anisotropy, c.format = this.format, c.type = this.type, c.offset.copy(this.offset), c.repeat.copy(this.repeat), c.premultiplyAlpha = this.premultiplyAlpha, c.flipY = this.flipY, c.unpackAlignment = this.unpackAlignment, c;
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let _ = 0;
          }
        ),
        /***/
        "./src/WebGL/core/UVMapping.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/core/UVMapping.ts ***!
            \*************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              UVMapping: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            class n {
            }
          }
        ),
        /***/
        "./src/WebGL/core/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/core/index.ts ***!
            \*********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                n.EventDispatcher
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                f.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                f.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                f.GeometryIDCount
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                u.Light
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                u.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                u.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                y.Projector
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                h.Raycaster
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                u.Scene
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                _.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                _.TextureIdCount
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                E.UVMapping
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                h.intersectObject
              )
              /* harmony export */
            });
            var n = t(
              /*! ./EventDispatcher */
              "./src/WebGL/core/EventDispatcher.ts"
            ), f = t(
              /*! ./Geometry */
              "./src/WebGL/core/Geometry.ts"
            ), u = t(
              /*! ./Object3D */
              "./src/WebGL/core/Object3D.ts"
            ), y = t(
              /*! ./Projector */
              "./src/WebGL/core/Projector.ts"
            ), h = t(
              /*! ./Raycaster */
              "./src/WebGL/core/Raycaster.ts"
            ), _ = t(
              /*! ./Texture */
              "./src/WebGL/core/Texture.ts"
            ), E = t(
              /*! ./UVMapping */
              "./src/WebGL/core/UVMapping.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/index.ts": (
          /*!****************************!*\
            !*** ./src/WebGL/index.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              BackSide: () => (
                /* reexport safe */
                n.BackSide
              ),
              /* harmony export */
              Camera: () => (
                /* reexport safe */
                c.Camera
              ),
              /* harmony export */
              ClampToEdgeWrapping: () => (
                /* reexport safe */
                n.ClampToEdgeWrapping
              ),
              /* harmony export */
              Coloring: () => (
                /* reexport safe */
                n.Coloring
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                E.Cylinder
              ),
              /* harmony export */
              DoubleSide: () => (
                /* reexport safe */
                n.DoubleSide
              ),
              /* harmony export */
              EventDispatcher: () => (
                /* reexport safe */
                f.EventDispatcher
              ),
              /* harmony export */
              FloatType: () => (
                /* reexport safe */
                n.FloatType
              ),
              /* harmony export */
              Fog: () => (
                /* reexport safe */
                C.Fog
              ),
              /* harmony export */
              FrontSide: () => (
                /* reexport safe */
                n.FrontSide
              ),
              /* harmony export */
              Geometry: () => (
                /* reexport safe */
                f.Geometry
              ),
              /* harmony export */
              GeometryGroup: () => (
                /* reexport safe */
                f.GeometryGroup
              ),
              /* harmony export */
              GeometryIDCount: () => (
                /* reexport safe */
                f.GeometryIDCount
              ),
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                u.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                u.InstancedMaterial
              ),
              /* harmony export */
              Light: () => (
                /* reexport safe */
                f.Light
              ),
              /* harmony export */
              Line: () => (
                /* reexport safe */
                h.Line
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                u.LineBasicMaterial
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                h.LineStyle
              ),
              /* harmony export */
              LinearFilter: () => (
                /* reexport safe */
                n.LinearFilter
              ),
              /* harmony export */
              LinearMipMapLinearFilter: () => (
                /* reexport safe */
                n.LinearMipMapLinearFilter
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                u.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                u.MaterialIdCount
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                y.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                y.Matrix4
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                h.Mesh
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                u.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                u.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                u.MeshOutlineMaterial
              ),
              /* harmony export */
              NearestFilter: () => (
                /* reexport safe */
                n.NearestFilter
              ),
              /* harmony export */
              Object3D: () => (
                /* reexport safe */
                f.Object3D
              ),
              /* harmony export */
              Object3DIDCount: () => (
                /* reexport safe */
                f.Object3DIDCount
              ),
              /* harmony export */
              Projector: () => (
                /* reexport safe */
                f.Projector
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                y.Quaternion
              ),
              /* harmony export */
              R32Format: () => (
                /* reexport safe */
                n.R32Format
              ),
              /* harmony export */
              RFormat: () => (
                /* reexport safe */
                n.RFormat
              ),
              /* harmony export */
              RGBAFormat: () => (
                /* reexport safe */
                n.RGBAFormat
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                y.Ray
              ),
              /* harmony export */
              Raycaster: () => (
                /* reexport safe */
                f.Raycaster
              ),
              /* harmony export */
              Renderer: () => (
                /* reexport safe */
                b.Renderer
              ),
              /* harmony export */
              Scene: () => (
                /* reexport safe */
                f.Scene
              ),
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                _.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                _.ShaderUtils
              ),
              /* harmony export */
              Shading: () => (
                /* reexport safe */
                n.Shading
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                E.Sphere
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                u.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                u.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                h.Sprite
              ),
              /* harmony export */
              SpriteAlignment: () => (
                /* reexport safe */
                n.SpriteAlignment
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                u.SpriteMaterial
              ),
              /* harmony export */
              SpritePlugin: () => (
                /* reexport safe */
                A.SpritePlugin
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                u.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                u.StickImposterOutlineMaterial
              ),
              /* harmony export */
              Texture: () => (
                /* reexport safe */
                f.Texture
              ),
              /* harmony export */
              TextureIdCount: () => (
                /* reexport safe */
                f.TextureIdCount
              ),
              /* harmony export */
              TextureOperations: () => (
                /* reexport safe */
                n.TextureOperations
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                E.Triangle
              ),
              /* harmony export */
              UVMapping: () => (
                /* reexport safe */
                f.UVMapping
              ),
              /* harmony export */
              UnsignedByteType: () => (
                /* reexport safe */
                n.UnsignedByteType
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                y.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                y.Vector3
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                u.VolumetricMaterial
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                _.basic
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                y.clamp
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                _.clone
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                y.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                y.degToRad
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                _.instanced
              ),
              /* harmony export */
              intersectObject: () => (
                /* reexport safe */
                f.intersectObject
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                _.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                _.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                _.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                _.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                _.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                _.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                _.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                _.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                _.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                _.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                _.volumetric
              )
              /* harmony export */
            });
            var n = t(
              /*! ./constants */
              "./src/WebGL/constants/index.ts"
            ), f = t(
              /*! ./core */
              "./src/WebGL/core/index.ts"
            ), u = t(
              /*! ./materials */
              "./src/WebGL/materials/index.ts"
            ), y = t(
              /*! ./math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./objects */
              "./src/WebGL/objects/index.ts"
            ), _ = t(
              /*! ./shaders */
              "./src/WebGL/shaders/index.ts"
            ), E = t(
              /*! ./shapes */
              "./src/WebGL/shapes/index.ts"
            ), c = t(
              /*! ./Camera */
              "./src/WebGL/Camera.ts"
            ), C = t(
              /*! ./Fog */
              "./src/WebGL/Fog.ts"
            ), b = t(
              /*! ./Renderer */
              "./src/WebGL/Renderer.ts"
            ), A = t(
              /*! ./SpritePlugin */
              "./src/WebGL/SpritePlugin.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/materials/ImposterMaterial.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/materials/ImposterMaterial.ts ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ImposterMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), f = t(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), u = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), y = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class _ extends h.Material {
              constructor(c) {
                super(), this.color = new u.Color(16777215), this.ambient = new u.Color(1048575), this.emissive = new u.Color(0), this.imposter = !0, this.wrapAround = !1, this.wrapRGB = new y.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 = f.Shading.SmoothShading, this.shaderID = null, this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.setValues(c);
              }
              clone(c = new _()) {
                return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/InstancedMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/InstancedMaterial.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              InstancedMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), f = t(
              /*! ../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), u = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), y = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class _ extends h.Material {
              constructor(c) {
                super(), this.color = new u.Color(16777215), this.ambient = new u.Color(1048575), this.emissive = new u.Color(0), this.wrapAround = !1, this.wrapRGB = new y.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 = f.Shading.SmoothShading, this.shaderID = "instanced", this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.sphere = null, this.setValues(c);
              }
              clone(c = new _()) {
                return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c.sphere = this.sphere, c;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/LineBasicMaterial.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/materials/LineBasicMaterial.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              LineBasicMaterial: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), f = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class u extends f.Material {
              constructor(h) {
                super(), this.color = new n.Color(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.vertexColors = !1, this.fog = !0, this.shaderID = "basic", this.setValues(h);
              }
              clone(h = new u()) {
                return super.clone.call(this, h), h.color.copy(this.color), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/Material.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/materials/Material.ts ***!
            \*****************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Material: () => (
                /* binding */
                h
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), f = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), u = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), y = t(
              /*! ../../colors */
              "./src/colors.ts"
            );
            class h extends f.EventDispatcher {
              constructor() {
                super(...arguments), this.id = _++, this.name = "", this.side = n.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;
              }
              setValues(c = {}) {
                if (c !== void 0)
                  for (var C in c) {
                    var b = c[C];
                    if (b === void 0) {
                      console.warn("$3Dmol.Material: '" + C + "' parameter is undefined.");
                      continue;
                    }
                    if (C in this) {
                      var A = this[C];
                      A instanceof y.Color && b instanceof y.Color ? A.copy(b) : A instanceof y.Color ? A.set(b) : A instanceof u.Vector3 && b instanceof u.Vector3 ? A.copy(b) : this[C] = b;
                    }
                  }
              }
              //TODO: might want to look into blending equations
              clone(c = new h()) {
                return c.name = this.name, c.side = this.side, c.opacity = this.opacity, c.transparent = this.transparent, c.depthTest = this.depthTest, c.depthWrite = this.depthWrite, c.stencilTest = this.stencilTest, c.polygonOffset = this.polygonOffset, c.polygonOffsetFactor = this.polygonOffsetFactor, c.polygonOffsetUnits = this.polygonOffsetUnits, c.alphaTest = this.alphaTest, c.overdraw = this.overdraw, c.visible = this.visible, c;
              }
              dispose() {
                this.dispatchEvent({ type: "dispose" });
              }
            }
            let _ = 0;
          }
        ),
        /***/
        "./src/WebGL/materials/MeshDoubleLambertMaterial.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/materials/MeshDoubleLambertMaterial.ts ***!
            \**********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), f = t(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            );
            class u extends f.MeshLambertMaterial {
              constructor(h) {
                super(h), this.shaderID = "lambertdouble", this.side = n.DoubleSide, this.outline = !1;
              }
              clone(h = new u()) {
                return super.clone.call(this, h), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshLambertMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshLambertMaterial.ts ***!
            \****************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshLambertMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ./../constants/Coloring */
              "./src/WebGL/constants/Coloring.ts"
            ), f = t(
              /*! ./../constants/Shading */
              "./src/WebGL/constants/Shading.ts"
            ), u = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), y = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), h = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class _ extends u.Material {
              constructor(c) {
                super(), this.color = new y.Color(16777215), this.ambient = new y.Color(1048575), this.emissive = new y.Color(0), this.wrapAround = !1, this.wrapRGB = new h.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = f.Shading.SmoothShading, this.shaderID = "lambert", this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.setValues(c);
              }
              clone(c = new _()) {
                return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/MeshOutlineMaterial.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/materials/MeshOutlineMaterial.ts ***!
            \****************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), f = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class u extends f.Material {
              constructor(h) {
                super(), h = h || {}, this.fog = !0, this.shaderID = "outline", this.wireframe = !1, this.outlineColor = h.color || new n.Color(0, 0, 0), this.outlineWidth = h.width || 0.1, this.outlinePushback = h.pushback || 1;
              }
              clone(h = new u()) {
                return super.clone.call(this, h), h.fog = this.fog, h.shaderID = this.shaderID, h.wireframe = this.wireframe, h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterMaterial.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterMaterial.ts ***!
            \*******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SphereImposterMaterial: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class f extends n.ImposterMaterial {
              constructor(y) {
                super(y), this.shaderID = "sphereimposter", this.setValues(y);
              }
              clone(y = new f()) {
                return super.clone.call(this, y), y;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SphereImposterOutlineMaterial.ts": (
          /*!**************************************************************!*\
            !*** ./src/WebGL/materials/SphereImposterOutlineMaterial.ts ***!
            \**************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), f = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class u extends f.ImposterMaterial {
              constructor(h) {
                super(h), h = h || {}, this.shaderID = "sphereimposteroutline", this.outlineColor = h.color || new n.Color(0, 0, 0), this.outlineWidth = h.width || 0.1, this.outlinePushback = h.pushback || 1, this.setValues(h);
              }
              clone(h = new u()) {
                return super.clone.call(this, h), h.outlineColor = this.outlineColor, h.outlineWidth = this.outlineWidth, h.outlinePushback = this.outlinePushback, h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/SpriteMaterial.ts": (
          /*!***********************************************!*\
            !*** ./src/WebGL/materials/SpriteMaterial.ts ***!
            \***********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SpriteMaterial: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ../constants/SpriteAlignment */
              "./src/WebGL/constants/SpriteAlignment.ts"
            ), f = t(
              /*! ../core/Texture */
              "./src/WebGL/core/Texture.ts"
            ), u = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), y = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            ), h = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class _ extends h.Material {
              constructor(c) {
                super(), this.color = new u.Color(16777215), this.map = new f.Texture(), this.useScreenCoordinates = !0, this.fog = !1, this.uvOffset = new y.Vector2(0, 0), this.uvScale = new y.Vector2(1, 1), this.depthTest = !this.useScreenCoordinates, this.sizeAttenuation = !this.useScreenCoordinates, this.screenOffset = this.screenOffset, this.scaleByViewPort = !this.sizeAttenuation, this.alignment = n.SpriteAlignment.center.clone(), this.setValues(c), c = c || {}, c.depthTest === void 0 && (this.depthTest = !this.useScreenCoordinates), c.sizeAttenuation === void 0 && (this.sizeAttenuation = !this.useScreenCoordinates), c.scaleByViewPort === void 0 && (this.scaleByViewPort = !this.sizeAttenuation);
              }
              clone(c = new _()) {
                return super.clone.call(this, c), c.color.copy(this.color), c.map = this.map, c.useScreenCoordinates = this.useScreenCoordinates, c.screenOffset = this.screenOffset, c.sizeAttenuation = this.sizeAttenuation, c.scaleByViewport = this.scaleByViewPort, c.alignment.copy(this.alignment), c.uvOffset.copy(this.uvOffset), c;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterMaterial.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/materials/StickImposterMaterial.ts ***!
            \******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              StickImposterMaterial: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class f extends n.ImposterMaterial {
              constructor(y) {
                super(y), this.shaderID = "stickimposter", this.setValues(y);
              }
              clone(y = new f()) {
                return super.clone.call(this, y), y;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/StickImposterOutlineMaterial.ts": (
          /*!*************************************************************!*\
            !*** ./src/WebGL/materials/StickImposterOutlineMaterial.ts ***!
            \*************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), f = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            );
            class u extends f.ImposterMaterial {
              constructor(h = {}) {
                super(h), this.shaderID = "stickimposteroutline", this.outlineColor = new n.Color(0, 0, 0), this.outlineWidth = 0.1, this.outlinePushback = 1, h.color && (this.outlineColor = h.color), h.width && (this.outlineWidth = h.width), h.pushback && (this.outlinePushback = h.pushback), this.setValues(h);
              }
              clone(h = new u()) {
                return super.clone.call(this, h), h.outlineColor = this.outlineColor, h.outlineWidth = this.outlineWidth, h.outlinePushback = this.outlinePushback, h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/VolumetricMaterial.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/materials/VolumetricMaterial.ts ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VolumetricMaterial: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ../constants/Sides */
              "./src/WebGL/constants/Sides.ts"
            ), f = t(
              /*! ../../colors */
              "./src/colors.ts"
            ), u = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            );
            class y extends u.Material {
              constructor(_) {
                super(), this.transparent = !1, this.volumetric = !0, this.color = new f.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 = n.FrontSide, this.setValues(_);
              }
              clone(_ = new y()) {
                return super.clone.call(this, _), _.transparent = this.transparent, _.volumetric = this.volumetric, _.color = this.color, _.transferfn = this.transferfn, _.map = this.map, _.extent = this.extent, _.maxdepth = this.maxdepth, _.unit = this.unit, _.texmatrix = this.texmatrix, _.transfermin = this.transfermin, _.transfermax = this.transfermax, _.subsamples = this.subsamples, _.shaderID = this.shaderID, _.side = this.side, _;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/materials/index.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/materials/index.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ImposterMaterial: () => (
                /* reexport safe */
                n.ImposterMaterial
              ),
              /* harmony export */
              InstancedMaterial: () => (
                /* reexport safe */
                f.InstancedMaterial
              ),
              /* harmony export */
              LineBasicMaterial: () => (
                /* reexport safe */
                u.LineBasicMaterial
              ),
              /* harmony export */
              Material: () => (
                /* reexport safe */
                y.Material
              ),
              /* harmony export */
              MaterialIdCount: () => (
                /* reexport safe */
                y.MaterialIdCount
              ),
              /* harmony export */
              MeshDoubleLambertMaterial: () => (
                /* reexport safe */
                h.MeshDoubleLambertMaterial
              ),
              /* harmony export */
              MeshLambertMaterial: () => (
                /* reexport safe */
                _.MeshLambertMaterial
              ),
              /* harmony export */
              MeshOutlineMaterial: () => (
                /* reexport safe */
                E.MeshOutlineMaterial
              ),
              /* harmony export */
              SphereImposterMaterial: () => (
                /* reexport safe */
                c.SphereImposterMaterial
              ),
              /* harmony export */
              SphereImposterOutlineMaterial: () => (
                /* reexport safe */
                C.SphereImposterOutlineMaterial
              ),
              /* harmony export */
              SpriteMaterial: () => (
                /* reexport safe */
                b.SpriteMaterial
              ),
              /* harmony export */
              StickImposterMaterial: () => (
                /* reexport safe */
                A.StickImposterMaterial
              ),
              /* harmony export */
              StickImposterOutlineMaterial: () => (
                /* reexport safe */
                S.StickImposterOutlineMaterial
              ),
              /* harmony export */
              VolumetricMaterial: () => (
                /* reexport safe */
                s.VolumetricMaterial
              )
              /* harmony export */
            });
            var n = t(
              /*! ./ImposterMaterial */
              "./src/WebGL/materials/ImposterMaterial.ts"
            ), f = t(
              /*! ./InstancedMaterial */
              "./src/WebGL/materials/InstancedMaterial.ts"
            ), u = t(
              /*! ./LineBasicMaterial */
              "./src/WebGL/materials/LineBasicMaterial.ts"
            ), y = t(
              /*! ./Material */
              "./src/WebGL/materials/Material.ts"
            ), h = t(
              /*! ./MeshDoubleLambertMaterial */
              "./src/WebGL/materials/MeshDoubleLambertMaterial.ts"
            ), _ = t(
              /*! ./MeshLambertMaterial */
              "./src/WebGL/materials/MeshLambertMaterial.ts"
            ), E = t(
              /*! ./MeshOutlineMaterial */
              "./src/WebGL/materials/MeshOutlineMaterial.ts"
            ), c = t(
              /*! ./SphereImposterMaterial */
              "./src/WebGL/materials/SphereImposterMaterial.ts"
            ), C = t(
              /*! ./SphereImposterOutlineMaterial */
              "./src/WebGL/materials/SphereImposterOutlineMaterial.ts"
            ), b = t(
              /*! ./SpriteMaterial */
              "./src/WebGL/materials/SpriteMaterial.ts"
            ), A = t(
              /*! ./StickImposterMaterial */
              "./src/WebGL/materials/StickImposterMaterial.ts"
            ), S = t(
              /*! ./StickImposterOutlineMaterial */
              "./src/WebGL/materials/StickImposterOutlineMaterial.ts"
            ), s = t(
              /*! ./VolumetricMaterial */
              "./src/WebGL/materials/VolumetricMaterial.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/Quaternion.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/math/Quaternion.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Quaternion: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            class n {
              constructor(u, y, h, _) {
                this.x = u || 0, this.y = y || 0, this.z = h || 0, this.w = _ !== void 0 ? _ : 1;
              }
              set(u, y, h, _) {
                return this.x = u, this.y = y, this.z = h, this.w = _, this;
              }
              copy(u) {
                return this.x = u.x, this.y = u.y, this.z = u.z, this.w = u.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 u = this.length();
                return u === 0 ? (this.x = 0, this.y = 0, this.z = 0, this.w = 1) : (u = 1 / u, this.x *= u, this.y *= u, this.z *= u, this.w *= u), this;
              }
              multiply(u) {
                return this.multiplyQuaternions(this, u);
              }
              multiplyScalar(u) {
                return this.x *= u, this.y *= u, this.z *= u, this.w *= u, this;
              }
              multiplyQuaternions(u, y) {
                const h = u.x, _ = u.y, E = u.z, c = u.w, C = y.x, b = y.y, A = y.z, S = y.w;
                return this.x = h * S + c * C + _ * A - E * b, this.y = _ * S + c * b + E * C - h * A, this.z = E * S + c * A + h * b - _ * C, this.w = c * S - h * C - _ * b - E * A, this;
              }
              sub(u) {
                return this.x -= u.x, this.y -= u.y, this.z -= u.z, this.w -= u.w, this;
              }
              clone() {
                return new n(this.x, this.y, this.z, this.w);
              }
              setFromEuler(u) {
                const y = Math.cos(u.x / 2), h = Math.cos(u.y / 2), _ = Math.cos(u.z / 2), E = Math.sin(u.x / 2), c = Math.sin(u.y / 2), C = Math.sin(u.z / 2);
                return this.x = E * h * _ + y * c * C, this.y = y * c * _ - E * h * C, this.z = y * h * C + E * c * _, this.w = y * h * _ - E * c * C, this;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/Vector2.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/math/Vector2.ts ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Vector2: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            class n {
              constructor(u, y) {
                this.x = u || 0, this.y = y || 0;
              }
              set(u, y) {
                return this.x = u, this.y = y, this;
              }
              subVectors(u, y) {
                return this.x = u.x - y.x, this.y = u.y - y.y, this;
              }
              copy(u) {
                return this.x = u.x, this.y = u.y, this;
              }
              clone() {
                return new n(this.x, this.y);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/index.ts": (
          /*!*********************************!*\
            !*** ./src/WebGL/math/index.ts ***!
            \*********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                _.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                _.Matrix4
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                n.Quaternion
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                _.Ray
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                f.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                _.Vector3
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                u.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                y.conversionMatrix3
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                h.degToRad
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Quaternion */
              "./src/WebGL/math/Quaternion.ts"
            ), f = t(
              /*! ./Vector2 */
              "./src/WebGL/math/Vector2.ts"
            ), u = t(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), y = t(
              /*! ./utils/conversionMatrix3 */
              "./src/WebGL/math/utils/conversionMatrix3.ts"
            ), h = t(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), _ = t(
              /*! ./math */
              "./src/WebGL/math/math.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/math/math.ts": (
          /*!********************************!*\
            !*** ./src/WebGL/math/math.ts ***!
            \********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Matrix3: () => (
                /* binding */
                b
              ),
              /* harmony export */
              Matrix4: () => (
                /* binding */
                c
              ),
              /* harmony export */
              Ray: () => (
                /* binding */
                A
              ),
              /* harmony export */
              Vector3: () => (
                /* binding */
                C
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/degToRad */
              "./src/WebGL/math/utils/degToRad.ts"
            ), f = t(
              /*! ./utils/clamp */
              "./src/WebGL/math/utils/clamp.ts"
            ), u, y, h, _, E;
            class c {
              constructor(s = 1, o = 0, w = 0, p = 0, v = 0, a = 1, l = 0, g = 0, M = 0, L = 0, T = 1, D = 0, I = 0, z = 0, P = 0, B = 1) {
                typeof s < "u" && typeof s != "number" ? this.elements = new Float32Array(s) : (this.elements = new Float32Array(16), this.elements[0] = s, this.elements[4] = o, this.elements[8] = w, this.elements[12] = p, this.elements[1] = v, this.elements[5] = a, this.elements[9] = l, this.elements[13] = g, this.elements[2] = M, this.elements[6] = L, this.elements[10] = T, this.elements[14] = D, this.elements[3] = I, this.elements[7] = z, this.elements[11] = P, this.elements[15] = B);
              }
              // eslint-disable-next-line no-unused-vars, class-methods-use-this
              makeScale(s, o, w) {
                throw new Error("Method not implemented.");
              }
              set(s, o, w, p, v, a, l, g, M, L, T, D, I, z, P, B) {
                const F = this.elements;
                return F[0] = s, F[4] = o, F[8] = w, F[12] = p, F[1] = v, F[5] = a, F[9] = l, F[13] = g, F[2] = M, F[6] = L, F[10] = T, F[14] = D, F[3] = I, F[7] = z, 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(s) {
                const o = s.elements;
                return this.set(o[0], o[4], o[8], o[12], o[1], o[5], o[9], o[13], o[2], o[6], o[10], o[14], o[3], o[7], o[11], o[15]), this;
              }
              matrix3FromTopLeft() {
                const s = this.elements;
                return new b(s[0], s[4], s[8], s[1], s[5], s[9], s[2], s[6], s[10]);
              }
              setRotationFromEuler(s, o) {
                const w = this.elements, { x: p, y: v, z: a } = s, l = Math.cos(p), g = Math.sin(p), M = Math.cos(v), L = Math.sin(v), T = Math.cos(a), D = Math.sin(a);
                if (o === void 0 || o === "XYZ") {
                  const I = l * T, z = l * D, P = g * T, B = g * D;
                  w[0] = M * T, w[4] = -M * D, w[8] = L, w[1] = z + P * L, w[5] = I - B * L, w[9] = -g * M, w[2] = B - I * L, w[6] = P + z * L, w[10] = l * M;
                } else
                  console.error(`Error with matrix4 setRotationFromEuler. Order: ${o}`);
                return this;
              }
              setRotationFromQuaternion(s) {
                const o = this.elements, { x: w, y: p, z: v, w: a } = s, l = w + w, g = p + p, M = v + v, L = w * l, T = w * g, D = w * M, I = p * g, z = p * M, P = v * M, B = a * l, F = a * g, N = a * M;
                return o[0] = 1 - (I + P), o[4] = T - N, o[8] = D + F, o[1] = T + N, o[5] = 1 - (L + P), o[9] = z - B, o[2] = D - F, o[6] = z + B, o[10] = 1 - (L + I), this;
              }
              multiplyMatrices(s, o) {
                const w = s.elements, p = o.elements, v = this.elements, a = w[0], l = w[4], g = w[8], M = w[12], L = w[1], T = w[5], D = w[9], I = w[13], z = w[2], P = w[6], B = w[10], F = w[14], N = w[3], $ = w[7], k = w[11], G = w[15], H = p[0], U = p[4], V = p[8], Q = p[12], ae = p[1], oe = p[5], q = p[9], me = p[13], ne = p[2], fe = p[6], Ce = p[10], Me = p[14], Te = p[3], se = p[7], pe = p[11], we = p[15];
                return v[0] = a * H + l * ae + g * ne + M * Te, v[4] = a * U + l * oe + g * fe + M * se, v[8] = a * V + l * q + g * Ce + M * pe, v[12] = a * Q + l * me + g * Me + M * we, v[1] = L * H + T * ae + D * ne + I * Te, v[5] = L * U + T * oe + D * fe + I * se, v[9] = L * V + T * q + D * Ce + I * pe, v[13] = L * Q + T * me + D * Me + I * we, v[2] = z * H + P * ae + B * ne + F * Te, v[6] = z * U + P * oe + B * fe + F * se, v[10] = z * V + P * q + B * Ce + F * pe, v[14] = z * Q + P * me + B * Me + F * we, v[3] = N * H + $ * ae + k * ne + G * Te, v[7] = N * U + $ * oe + k * fe + G * se, v[11] = N * V + $ * q + k * Ce + G * pe, v[15] = N * Q + $ * me + k * Me + G * we, this;
              }
              multiplyScalar(s) {
                const o = this.elements;
                return o[0] *= s, o[4] *= s, o[8] *= s, o[12] *= s, o[1] *= s, o[5] *= s, o[9] *= s, o[13] *= s, o[2] *= s, o[6] *= s, o[10] *= s, o[14] *= s, o[3] *= s, o[7] *= s, o[11] *= s, o[15] *= s, this;
              }
              makeTranslation(s, o, w) {
                return this.set(1, 0, 0, s, 0, 1, 0, o, 0, 0, 1, w, 0, 0, 0, 1), this;
              }
              // snap values close to integers to their integer value
              // useful and identifying identity matrices
              snap(s) {
                const o = Math.pow(10, 4), w = this.elements;
                for (let p = 0; p < 16; p++) {
                  const v = Math.round(w[p]);
                  v === Math.round(w[p] * o) / o && (w[p] = v);
                }
                return this;
              }
              transpose() {
                const s = this.elements;
                let o;
                return o = s[1], s[1] = s[4], s[4] = o, o = s[2], s[2] = s[8], s[8] = o, o = s[6], s[6] = s[9], s[9] = o, o = s[3], s[3] = s[12], s[12] = o, o = s[7], s[7] = s[13], s[13] = o, o = s[11], s[11] = s[14], s[14] = o, this;
              }
              setPosition(s) {
                const o = this.elements;
                return o[12] = s.x, o[13] = s.y, o[14] = s.z, this;
              }
              translate(s) {
                const o = this.elements;
                return o[12] += s.x, o[13] += s.y, o[14] += s.z, this;
              }
              getInverse(s, o) {
                const w = this.elements, p = s.elements, v = p[0], a = p[4], l = p[8], g = p[12], M = p[1], L = p[5], T = p[9], D = p[13], I = p[2], z = p[6], P = p[10], B = p[14], F = p[3], N = p[7], $ = p[11], k = p[15];
                w[0] = T * B * N - D * P * N + D * z * $ - L * B * $ - T * z * k + L * P * k, w[4] = g * P * N - l * B * N - g * z * $ + a * B * $ + l * z * k - a * P * k, w[8] = l * D * N - g * T * N + g * L * $ - a * D * $ - l * L * k + a * T * k, w[12] = g * T * z - l * D * z - g * L * P + a * D * P + l * L * B - a * T * B, w[1] = D * P * F - T * B * F - D * I * $ + M * B * $ + T * I * k - M * P * k, w[5] = l * B * F - g * P * F + g * I * $ - v * B * $ - l * I * k + v * P * k, w[9] = g * T * F - l * D * F - g * M * $ + v * D * $ + l * M * k - v * T * k, w[13] = l * D * I - g * T * I + g * M * P - v * D * P - l * M * B + v * T * B, w[2] = L * B * F - D * z * F + D * I * N - M * B * N - L * I * k + M * z * k, w[6] = g * z * F - a * B * F - g * I * N + v * B * N + a * I * k - v * z * k, w[10] = a * D * F - g * L * F + g * M * N - v * D * N - a * M * k + v * L * k, w[14] = g * L * I - a * D * I - g * M * z + v * D * z + a * M * B - v * L * B, w[3] = T * z * F - L * P * F - T * I * N + M * P * N + L * I * $ - M * z * $, w[7] = a * P * F - l * z * F + l * I * N - v * P * N - a * I * $ + v * z * $, w[11] = l * L * F - a * T * F - l * M * N + v * T * N + a * M * $ - v * L * $, w[15] = a * T * I - l * L * I + l * M * z - v * T * z - a * M * P + v * L * P;
                const G = v * w[0] + M * w[4] + I * w[8] + F * w[12];
                if (G === 0) {
                  const H = "Matrix4.getInverse(): can't invert matrix, determinant is 0";
                  if (o)
                    throw new Error(H);
                  return console.warn(H), this.identity(), this;
                }
                return this.multiplyScalar(1 / G), this;
              }
              isReflected() {
                const s = this.elements, o = s[0], w = s[4], p = s[8], v = s[1], a = s[5], l = s[9], g = s[2], M = s[6], L = s[10];
                return o * a * L + // +aei
                v * M * p + // +bfg
                g * w * l - // +cdh
                g * a * p - // -ceg
                v * w * L - // -bdi
                o * M * l < 0;
              }
              scale(s) {
                const o = this.elements, { x: w } = s, { y: p } = s, { z: v } = s;
                return o[0] *= w, o[4] *= p, o[8] *= v, o[1] *= w, o[5] *= p, o[9] *= v, o[2] *= w, o[6] *= p, o[10] *= v, o[3] *= w, o[7] *= p, o[11] *= v, this;
              }
              getMaxScaleOnAxis() {
                const s = this.elements, o = s[0] * s[0] + s[1] * s[1] + s[2] * s[2], w = s[4] * s[4] + s[5] * s[5] + s[6] * s[6], p = s[8] * s[8] + s[9] * s[9] + s[10] * s[10];
                return Math.sqrt(Math.max(o, Math.max(w, p)));
              }
              makeFrustum(s, o, w, p, v, a) {
                const l = this.elements, g = 2 * v / (o - s), M = 2 * v / (p - w), L = (o + s) / (o - s), T = (p + w) / (p - w), D = -(a + v) / (a - v), I = -2 * a * v / (a - v);
                return l[0] = g, l[4] = 0, l[8] = L, l[12] = 0, l[1] = 0, l[5] = M, l[9] = T, l[13] = 0, l[2] = 0, l[6] = 0, l[10] = D, l[14] = I, l[3] = 0, l[7] = 0, l[11] = -1, l[15] = 0, this;
              }
              makePerspective(s, o, w, p) {
                const v = w * Math.tan((0, n.degToRad)(s * 0.5)), a = -v, l = a * o, g = v * o;
                return this.makeFrustum(l, g, a, v, w, p);
              }
              makeOrthographic(s, o, w, p, v, a) {
                const l = this.elements, g = 1 / (o - s), M = 1 / (w - p), L = 1 / (a - v), T = (o + s) * g, D = (w + p) * M, I = (a + v) * L;
                return l[0] = 2 * g, l[4] = 0, l[8] = 0, l[12] = -T, l[1] = 0, l[5] = 2 * M, l[9] = 0, l[13] = -D, l[2] = 0, l[6] = 0, l[10] = -2 * L, l[14] = -I, l[3] = 0, l[7] = 0, l[11] = 0, l[15] = 1, this;
              }
              isEqual(s) {
                const o = s.elements, w = this.elements;
                return w[0] === o[0] && w[4] === o[4] && w[8] === o[8] && w[12] === o[12] && w[1] === o[1] && w[5] === o[5] && w[9] === o[9] && w[13] === o[13] && w[2] === o[2] && w[6] === o[6] && w[10] === o[10] && w[14] === o[14] && w[3] === o[3] && w[7] === o[7] && w[11] === o[11] && w[15] === o[15];
              }
              clone() {
                const s = this.elements;
                return new c(s[0], s[4], s[8], s[12], s[1], s[5], s[9], s[13], s[2], s[6], s[10], s[14], s[3], s[7], s[11], s[15]);
              }
              isIdentity() {
                const s = this.elements;
                return s[0] === 1 && s[4] === 0 && s[8] === 0 && s[12] === 0 && s[1] === 0 && s[5] === 1 && s[9] === 0 && s[13] === 0 && s[2] === 0 && s[6] === 0 && s[10] === 1 && s[14] === 0 && s[3] === 0 && s[7] === 0 && s[11] === 0 && s[15] === 1;
              }
              // return true if elements are with digits of identity
              isNearlyIdentity(s) {
                return this.clone().snap(s).isIdentity();
              }
              getScale(s) {
                const o = this.elements;
                return s = s || new C(), h.set(o[0], o[1], o[2]), _.set(o[4], o[5], o[6]), E.set(o[8], o[9], o[10]), s.x = h.length(), s.y = _.length(), s.z = E.length(), s;
              }
              lookAt(s, o, w) {
                const p = this.elements;
                return E.subVectors(s, o).normalize(), E.length() === 0 && (E.z = 1), h.crossVectors(w, E).normalize(), h.length() === 0 && (E.x += 1e-4, h.crossVectors(w, E).normalize()), _.crossVectors(E, h), p[0] = h.x, p[4] = _.x, p[8] = E.x, p[1] = h.y, p[5] = _.y, p[9] = E.y, p[2] = h.z, p[6] = _.z, p[10] = E.z, this;
              }
              compose(s, o, w) {
                const p = this.elements;
                return u.identity(), u.setRotationFromQuaternion(o), y.makeScale(w.x, w.y, w.z), this.multiplyMatrices(u, y), p[12] = s.x, p[13] = s.y, p[14] = s.z, this;
              }
            }
            u = new c(), y = new c();
            class C {
              constructor(s, o, w) {
                this.x = s || 0, this.y = o || 0, this.z = w || 0, this.atomid = void 0;
              }
              set(s, o, w) {
                return this.x = s, this.y = o, this.z = w, this;
              }
              copy(s) {
                return this.x = s.x, this.y = s.y, this.z = s.z, this;
              }
              add(s) {
                return this.x += s.x, this.y += s.y, this.z += s.z, this;
              }
              addVectors(s, o) {
                return this.x = s.x + o.x, this.y = s.y + o.y, this.z = s.z + o.z, this;
              }
              multiplyVectors(s, o) {
                return this.x = s.x * o.x, this.y = s.y * o.y, this.z = s.z * o.z, this;
              }
              sub(s) {
                return this.x -= s.x, this.y -= s.y, this.z -= s.z, this;
              }
              subVectors(s, o) {
                return this.x = s.x - o.x, this.y = s.y - o.y, this.z = s.z - o.z, this;
              }
              multiplyScalar(s) {
                return this.x *= s, this.y *= s, this.z *= s, this;
              }
              divideScalar(s) {
                return s !== 0 ? (this.x /= s, this.y /= s, this.z /= s) : (this.x = 0, this.y = 0, this.z = 0), this;
              }
              // accumulate maximum
              max(s) {
                return this.x = Math.max(this.x, s.x), this.y = Math.max(this.y, s.y), this.z = Math.max(this.z, s.z), this;
              }
              // accumulate min
              min(s) {
                return this.x = Math.min(this.x, s.x), this.y = Math.min(this.y, s.y), this.z = Math.min(this.z, s.z), this;
              }
              distanceTo(s) {
                return Math.sqrt(this.distanceToSquared(s));
              }
              distanceToSquared(s) {
                const o = this.x - s.x, w = this.y - s.y, p = this.z - s.z;
                return o * o + w * w + p * p;
              }
              applyMatrix3(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this, v = s.elements;
                return this.x = v[0] * o + v[3] * w + v[6] * p, this.y = v[1] * o + v[4] * w + v[7] * p, this.z = v[2] * o + v[5] * w + v[8] * p, this;
              }
              applyMatrix4(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this, v = s.elements;
                return this.x = v[0] * o + v[4] * w + v[8] * p + v[12], this.y = v[1] * o + v[5] * w + v[9] * p + v[13], this.z = v[2] * o + v[6] * w + v[10] * p + v[14], this;
              }
              applyProjection(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this, v = s.elements, a = v[3] * o + v[7] * w + v[11] * p + v[15];
                return this.x = (v[0] * o + v[4] * w + v[8] * p + v[12]) / a, this.y = (v[1] * o + v[5] * w + v[9] * p + v[13]) / a, this.z = (v[2] * o + v[6] * w + v[10] * p + v[14]) / a, this;
              }
              applyQuaternion(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this, v = s.x, a = s.y, l = s.z, g = s.w, M = {};
                M.x = 2 * (w * l - p * a), M.y = 2 * (p * v - o * l), M.z = 2 * (o * a - w * v);
                const L = {};
                return L.x = M.y * l - M.z * a, L.y = M.z * v - M.x * l, L.z = M.x * a - M.y * v, this.x = o + g * M.x + L.x, this.y = w + g * M.y + L.y, this.z = p + g * M.z + L.z, this;
              }
              negate() {
                return this.multiplyScalar(-1);
              }
              dot(s) {
                return this.x * s.x + this.y * s.y + this.z * s.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(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this;
                return this.x = w * s.z - p * s.y, this.y = p * s.x - o * s.z, this.z = o * s.y - w * s.x, this;
              }
              crossVectors(s, o) {
                return this.x = s.y * o.z - s.z * o.y, this.y = s.z * o.x - s.x * o.z, this.z = s.x * o.y - s.y * o.x, this;
              }
              equals(s) {
                return this.x == s.x && this.y == s.y && this.z == s.z;
              }
              getPositionFromMatrix(s) {
                return this.x = s.elements[12], this.y = s.elements[13], this.z = s.elements[14], this;
              }
              setEulerFromRotationMatrix(s, o) {
                const w = s.elements, p = w[0], v = w[4], a = w[8], l = w[5], g = w[9], M = w[6], L = w[10];
                return o === void 0 || o === "XYZ" ? (this.y = Math.asin((0, f.clamp)(a, -1, 1)), Math.abs(a) < 0.99999 ? (this.x = Math.atan2(-g, L), this.z = Math.atan2(-v, p)) : (this.x = Math.atan2(M, l), this.z = 0)) : console.error(`Error with vector's setEulerFromRotationMatrix: Unknown order: ${o}`), this;
              }
              rotateAboutVector(s, o) {
                s.normalize();
                const w = Math.cos(o), p = Math.sin(o), v = this.clone().multiplyScalar(w), a = s.clone().cross(this).multiplyScalar(p), l = s.clone().multiplyScalar(s.clone().dot(this)).multiplyScalar(1 - w), g = v.add(a).add(l);
                return this.x = g.x, this.y = g.y, this.z = g.z, this;
              }
              setFromMatrixPosition(s) {
                const o = s.elements;
                return this.x = o[12], this.y = o[13], this.z = o[14], this;
              }
              // unproject is defined after Matrix4
              transformDirection(s) {
                const { x: o } = this, { y: w } = this, { z: p } = this, v = s.elements;
                return this.x = v[0] * o + v[4] * w + v[8] * p, this.y = v[1] * o + v[5] * w + v[9] * p, this.z = v[2] * o + v[6] * w + v[10] * p, this.normalize();
              }
              clone() {
                return new C(this.x, this.y, this.z);
              }
              unproject(s) {
                const o = u;
                return o.multiplyMatrices(s.matrixWorld, o.getInverse(s.projectionMatrix)), this.applyMatrix4(o);
              }
            }
            h = new C(), _ = new C(), E = new C();
            class b {
              constructor(s = 1, o = 0, w = 0, p = 0, v = 1, a = 0, l = 0, g = 0, M = 1) {
                this.elements = new Float32Array(9), this.set(s, o, w, p, v, a, l, g, M);
              }
              set(s, o, w, p, v, a, l, g, M) {
                const L = this.elements;
                return L[0] = s, L[3] = o, L[6] = w, L[1] = p, L[4] = v, L[7] = a, L[2] = l, L[5] = g, L[8] = M, this;
              }
              identity() {
                return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
              }
              copy(s) {
                const o = s.elements;
                this.set(o[0], o[3], o[6], o[1], o[4], o[7], o[2], o[5], o[8]);
              }
              multiplyScalar(s) {
                const o = this.elements;
                return o[0] *= s, o[3] *= s, o[6] *= s, o[1] *= s, o[4] *= s, o[7] *= s, o[2] *= s, o[5] *= s, o[8] *= s, this;
              }
              getInverse3(s) {
                const o = s.elements, w = this.elements;
                w[0] = o[4] * o[8] - o[5] * o[7], w[3] = o[6] * o[5] - o[3] * o[8], w[6] = o[3] * o[7] - o[6] * o[4], w[1] = o[7] * o[2] - o[1] * o[8], w[4] = o[0] * o[8] - o[6] * o[2], w[7] = o[1] * o[6] - o[0] * o[7], w[2] = o[1] * o[5] - o[2] * o[4], w[5] = o[2] * o[3] - o[0] * o[5], w[8] = o[0] * o[4] - o[1] * o[3];
                const p = o[0] * w[0] + o[3] * w[1] + o[6] * w[2];
                return this.multiplyScalar(1 / p), this;
              }
              getInverse(s, o) {
                const w = s.elements, p = this.elements;
                p[0] = w[10] * w[5] - w[6] * w[9], p[1] = -w[10] * w[1] + w[2] * w[9], p[2] = w[6] * w[1] - w[2] * w[5], p[3] = -w[10] * w[4] + w[6] * w[8], p[4] = w[10] * w[0] - w[2] * w[8], p[5] = -w[6] * w[0] + w[2] * w[4], p[6] = w[9] * w[4] - w[5] * w[8], p[7] = -w[9] * w[0] + w[1] * w[8], p[8] = w[5] * w[0] - w[1] * w[4];
                const v = w[0] * p[0] + w[1] * p[3] + w[2] * p[6];
                if (v === 0) {
                  const a = "Matrix3.getInverse(): can't invert matrix, determinant is 0";
                  if (o)
                    throw new Error(a);
                  return console.warn(a), this.identity(), this;
                }
                return this.multiplyScalar(1 / v), this;
              }
              // https://en.wikipedia.org/wiki/Determinant
              getDeterminant() {
                const s = this.elements;
                return s[0] * s[4] * s[8] + // +aei
                s[1] * s[5] * s[6] + // +bfg
                s[2] * s[3] * s[7] - // +cdh
                s[2] * s[4] * s[6] - // -ceg
                s[1] * s[3] * s[8] - // -bdi
                s[0] * s[5] * s[7];
              }
              transpose() {
                let s;
                const o = this.elements;
                return s = o[1], o[1] = o[3], o[3] = s, s = o[2], o[2] = o[6], o[6] = s, s = o[5], o[5] = o[7], o[7] = s, this;
              }
              clone() {
                const s = this.elements;
                return new b(s[0], s[3], s[6], s[1], s[4], s[7], s[2], s[5], s[8]);
              }
              getMatrix4() {
                const s = this.elements;
                return new c(s[0], s[3], s[6], 0, s[1], s[4], s[7], 0, s[2], s[5], s[8], 0);
              }
            }
            class A {
              constructor(s, o) {
                this.origin = s !== void 0 ? s : new C(), this.direction = o !== void 0 ? o : new C();
              }
              set(s, o) {
                return this.origin.copy(s), this.direction.copy(o), this;
              }
              copy(s) {
                return this.origin.copy(s.origin), this.direction.copy(s.direction), this;
              }
              at(s, o) {
                return (o || new C()).copy(this.direction).multiplyScalar(s).add(this.origin);
              }
              recast(s) {
                const o = h;
                return this.origin.copy(this.at(s, o)), this;
              }
              closestPointToPoint(s, o) {
                const w = o || new C();
                w.subVectors(s, this.origin);
                const p = w.dot(this.direction);
                return w.copy(this.direction).multiplyScalar(p).add(this.origin);
              }
              distanceToPoint(s) {
                const o = h, w = o.subVectors(s, this.origin).dot(this.direction);
                return o.copy(this.direction).multiplyScalar(w).add(this.origin), o.distanceTo(s);
              }
              // eslint-disable-next-line class-methods-use-this
              isIntersectionCylinder() {
              }
              isIntersectionSphere(s) {
                return this.distanceToPoint(s.center) <= s.radius;
              }
              isIntersectionPlane(s) {
                return s.normal.dot(this.direction) !== 0 || s.distanceToPoint(this.origin) === 0;
              }
              distanceToPlane(s) {
                const o = s.normal.dot(this.direction);
                return o === 0 ? s.distanceToPoint(this.origin) === 0 ? 0 : void 0 : -(this.origin.dot(s.normal) + s.constant) / o;
              }
              intersectPlane(s, o) {
                const w = this.distanceToPlane(s);
                if (w !== void 0)
                  return this.at(w, o);
              }
              applyMatrix4(s) {
                return this.direction.add(this.origin).applyMatrix4(s), this.origin.applyMatrix4(s), this.direction.sub(this.origin), this;
              }
              clone() {
                return new A().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/clamp.ts": (
          /*!***************************************!*\
            !*** ./src/WebGL/math/utils/clamp.ts ***!
            \***************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              clamp: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f, u, y) {
              return Math.min(Math.max(f, u), y);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/conversionMatrix3.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/math/utils/conversionMatrix3.ts ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              conversionMatrix3: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/math.ts"
            );
            function f(u, y, h, _, E, c) {
              _ = _ * Math.PI / 180, E = E * Math.PI / 180, c = c * Math.PI / 180;
              const C = (w) => w * w, b = Math.cos(_), A = Math.cos(E), S = Math.cos(c), s = Math.sin(c);
              return new n.Matrix3(u, y * S, h * A, 0, y * s, h * (b - A * S) / s, 0, 0, h * Math.sqrt(1 - C(b) - C(A) - C(S) + 2 * b * A * S) / s);
            }
          }
        ),
        /***/
        "./src/WebGL/math/utils/degToRad.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/math/utils/degToRad.ts ***!
            \******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              degToRad: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            const n = Math.PI / 180;
            function f(u) {
              return u * n;
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Line.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Line.ts ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Line: () => (
                /* binding */
                y
              ),
              /* harmony export */
              LineStyle: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), f = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            ), u;
            (function(h) {
              h[h.LineStrip = 0] = "LineStrip", h[h.LinePieces = 1] = "LinePieces";
            })(u || (u = {}));
            class y extends f.Object3D {
              constructor(_, E = new n.LineBasicMaterial({
                color: Math.random() * 16777215
              }), c = u.LineStrip) {
                super(), this.geometry = _, this.material = E, this.type = c;
              }
              clone(_ = new y(this.geometry, this.material, this.type)) {
                return super.clone.call(this, _), _;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Mesh.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/objects/Mesh.ts ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Mesh: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class f extends n.Object3D {
              constructor(y, h) {
                super(), this.geometry = y, this.material = h;
              }
              clone(y) {
                return y === void 0 && (y = new f(this.geometry, this.material)), super.clone.call(this, y), y;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/Sprite.ts": (
          /*!*************************************!*\
            !*** ./src/WebGL/objects/Sprite.ts ***!
            \*************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Sprite: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../materials */
              "./src/WebGL/materials/index.ts"
            ), f = t(
              /*! ../core */
              "./src/WebGL/core/index.ts"
            );
            class u extends f.Object3D {
              constructor(h = new n.SpriteMaterial()) {
                super(), this.material = h, 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(h = new u(this.material)) {
                return f.Object3D.prototype.clone.call(this, h), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/objects/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/objects/index.ts ***!
            \************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Line: () => (
                /* reexport safe */
                n.Line
              ),
              /* harmony export */
              LineStyle: () => (
                /* reexport safe */
                n.LineStyle
              ),
              /* harmony export */
              Mesh: () => (
                /* reexport safe */
                f.Mesh
              ),
              /* harmony export */
              Sprite: () => (
                /* reexport safe */
                u.Sprite
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Line */
              "./src/WebGL/objects/Line.ts"
            ), f = t(
              /*! ./Mesh */
              "./src/WebGL/objects/Mesh.ts"
            ), u = t(
              /*! ./Sprite */
              "./src/WebGL/objects/Sprite.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/ShaderType.ts": (
          /*!*****************************************!*\
            !*** ./src/WebGL/shaders/ShaderType.ts ***!
            \*****************************************/
          /***/
          (r, e, t) => {
            t.r(e);
          }
        ),
        /***/
        "./src/WebGL/shaders/index.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/shaders/index.ts ***!
            \************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderLib: () => (
                /* reexport safe */
                n.ShaderLib
              ),
              /* harmony export */
              ShaderUtils: () => (
                /* reexport safe */
                f.ShaderUtils
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                n.basic
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                f.clone
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                n.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                n.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                n.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                n.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                n.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                n.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                n.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                n.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                n.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                n.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                n.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                n.volumetric
              )
              /* harmony export */
            });
            var n = t(
              /*! ./lib */
              "./src/WebGL/shaders/lib/index.ts"
            ), f = t(
              /*! ./utils */
              "./src/WebGL/shaders/utils/index.ts"
            );
            t(
              /*! ./ShaderType */
              "./src/WebGL/shaders/ShaderType.ts"
            );
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/index.ts": (
          /*!**********************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/index.ts ***!
            \**********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              basic: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/basic/uniforms.ts"
            ), f = t(
              /*! ./basic.frag */
              "./src/WebGL/shaders/lib/basic/basic.frag"
            ), u = t(
              /*! ./basic.vert */
              "./src/WebGL/shaders/lib/basic/basic.vert"
            );
            const y = {
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/basic/uniforms.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/basic/uniforms.ts ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \****************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderLib: () => (
                /* binding */
                o
              ),
              /* harmony export */
              basic: () => (
                /* reexport safe */
                n.basic
              ),
              /* harmony export */
              instanced: () => (
                /* reexport safe */
                f.instanced
              ),
              /* harmony export */
              lambert: () => (
                /* reexport safe */
                u.lambert
              ),
              /* harmony export */
              lambertdouble: () => (
                /* reexport safe */
                y.lambertdouble
              ),
              /* harmony export */
              outline: () => (
                /* reexport safe */
                h.outline
              ),
              /* harmony export */
              screen: () => (
                /* reexport safe */
                _.screen
              ),
              /* harmony export */
              screenaa: () => (
                /* reexport safe */
                E.screenaa
              ),
              /* harmony export */
              sphereimposter: () => (
                /* reexport safe */
                c.sphereimposter
              ),
              /* harmony export */
              sphereimposteroutline: () => (
                /* reexport safe */
                C.sphereimposteroutline
              ),
              /* harmony export */
              sprite: () => (
                /* reexport safe */
                b.sprite
              ),
              /* harmony export */
              stickimposter: () => (
                /* reexport safe */
                A.stickimposter
              ),
              /* harmony export */
              stickimposteroutline: () => (
                /* reexport safe */
                S.stickimposteroutline
              ),
              /* harmony export */
              volumetric: () => (
                /* reexport safe */
                s.volumetric
              )
              /* harmony export */
            });
            var n = t(
              /*! ./basic */
              "./src/WebGL/shaders/lib/basic/index.ts"
            ), f = t(
              /*! ./instanced */
              "./src/WebGL/shaders/lib/instanced/index.ts"
            ), u = t(
              /*! ./lambert */
              "./src/WebGL/shaders/lib/lambert/index.ts"
            ), y = t(
              /*! ./lambertdouble */
              "./src/WebGL/shaders/lib/lambertdouble/index.ts"
            ), h = t(
              /*! ./outline */
              "./src/WebGL/shaders/lib/outline/index.ts"
            ), _ = t(
              /*! ./screen */
              "./src/WebGL/shaders/lib/screen/index.ts"
            ), E = t(
              /*! ./screenaa */
              "./src/WebGL/shaders/lib/screenaa/index.ts"
            ), c = t(
              /*! ./sphereimposter */
              "./src/WebGL/shaders/lib/sphereimposter/index.ts"
            ), C = t(
              /*! ./sphereimposteroutline */
              "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts"
            ), b = t(
              /*! ./sprite */
              "./src/WebGL/shaders/lib/sprite/index.ts"
            ), A = t(
              /*! ./stickimposter */
              "./src/WebGL/shaders/lib/stickimposter/index.ts"
            ), S = t(
              /*! ./stickimposteroutline */
              "./src/WebGL/shaders/lib/stickimposteroutline/index.ts"
            ), s = t(
              /*! ./volumetric */
              "./src/WebGL/shaders/lib/volumetric/index.ts"
            );
            const o = {
              basic: n.basic,
              instanced: f.instanced,
              lambert: u.lambert,
              lambertdouble: y.lambertdouble,
              outline: h.outline,
              screen: _.screen,
              screenaa: E.screenaa,
              sphereimposter: c.sphereimposter,
              sphereimposteroutline: C.sphereimposteroutline,
              sprite: b.sprite,
              stickimposter: A.stickimposter,
              stickimposteroutline: S.stickimposteroutline,
              volumetric: s.volumetric
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/index.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/index.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              instanced: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/instanced/uniforms.ts"
            ), f = t(
              /*! ./instanced.frag */
              "./src/WebGL/shaders/lib/instanced/instanced.frag"
            ), u = t(
              /*! ./instanced.vert */
              "./src/WebGL/shaders/lib/instanced/instanced.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/instanced/uniforms.ts": (
          /*!*****************************************************!*\
            !*** ./src/WebGL/shaders/lib/instanced/uniforms.ts ***!
            \*****************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              lambert: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambert/uniforms.ts"
            ), f = t(
              /*! ./lambert.frag */
              "./src/WebGL/shaders/lib/lambert/lambert.frag"
            ), u = t(
              /*! ./lambert.vert */
              "./src/WebGL/shaders/lib/lambert/lambert.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambert/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambert/uniforms.ts ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              lambertdouble: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts"
            ), f = t(
              /*! ./lambertdouble.frag */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag"
            ), u = t(
              /*! ./lambertdouble.vert */
              "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/lambertdouble/uniforms.ts ***!
            \*********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              outline: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/outline/uniforms.ts"
            ), f = t(
              /*! ./outline.frag */
              "./src/WebGL/shaders/lib/outline/outline.frag"
            ), u = t(
              /*! ./outline.vert */
              "./src/WebGL/shaders/lib/outline/outline.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/outline/uniforms.ts": (
          /*!***************************************************!*\
            !*** ./src/WebGL/shaders/lib/outline/uniforms.ts ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new n.Color(0, 0, 0) },
              fogColor: { type: "c", value: new n.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 ***!
            \***********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              screen: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screen/uniforms.ts"
            ), f = t(
              /*! ./screen.frag */
              "./src/WebGL/shaders/lib/screen/screen.frag"
            ), u = t(
              /*! ./screen.vert */
              "./src/WebGL/shaders/lib/screen/screen.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screen/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/screen/uniforms.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/index.ts": (
          /*!*************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/index.ts ***!
            \*************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              screenaa: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/screenaa/uniforms.ts"
            ), f = t(
              /*! ./screenaa.frag */
              "./src/WebGL/shaders/lib/screenaa/screenaa.frag"
            ), u = t(
              /*! ./screenaa.vert */
              "./src/WebGL/shaders/lib/screenaa/screenaa.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/screenaa/uniforms.ts": (
          /*!****************************************************!*\
            !*** ./src/WebGL/shaders/lib/screenaa/uniforms.ts ***!
            \****************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/index.ts": (
          /*!*******************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/index.ts ***!
            \*******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sphereimposter: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts"
            ), f = t(
              /*! ./sphereimposter.frag */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag"
            ), u = t(
              /*! ./sphereimposter.vert */
              "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert"
            );
            const y = {
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts": (
          /*!**********************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposter/uniforms.ts ***!
            \**********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \**************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sphereimposteroutline: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts"
            ), f = t(
              /*! ./sphereimposteroutline.frag */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag"
            ), u = t(
              /*! ./sphereimposteroutline.vert */
              "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts": (
          /*!*****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts ***!
            \*****************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              outlineColor: { type: "c", value: new n.Color(0, 0, 0) },
              fogColor: { type: "c", value: new n.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 ***!
            \***********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              sprite: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/sprite/uniforms.ts"
            ), f = t(
              /*! ./sprite.frag */
              "./src/WebGL/shaders/lib/sprite/sprite.frag"
            ), u = t(
              /*! ./sprite.vert */
              "./src/WebGL/shaders/lib/sprite/sprite.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/sprite/uniforms.ts": (
          /*!**************************************************!*\
            !*** ./src/WebGL/shaders/lib/sprite/uniforms.ts ***!
            \**************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = {};
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/index.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/index.ts ***!
            \******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              stickimposter: () => (
                /* binding */
                _
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposter/uniforms.ts"
            ), f = t(
              /*! ../../utils/stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            ), u = t(
              /*! ./stickimposter.partial.frag */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag"
            ), y = t(
              /*! ./stickimposter.vert */
              "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert"
            );
            const _ = {
              fragmentShader: [f.default, u.default].join(`
`).replace("#define GLSLIFY 1", ""),
              vertexShader: y.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposter/uniforms.ts": (
          /*!*********************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposter/uniforms.ts ***!
            \*********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \*************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              stickimposteroutline: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts"
            ), f = t(
              /*! ../../utils/stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            ), u = t(
              /*! ./stickimposteroutline.vert */
              "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert"
            );
            const h = {
              fragmentShader: (f.default + "gl_FragColor = vec4(color,1.0);}").replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts": (
          /*!****************************************************************!*\
            !*** ./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts ***!
            \****************************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.Color(1, 1, 1) },
              fogNear: { type: "f", value: 1 },
              fogFar: { type: "f", value: 2e3 },
              outlineColor: { type: "c", value: new n.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 ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              volumetric: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./uniforms */
              "./src/WebGL/shaders/lib/volumetric/uniforms.ts"
            ), f = t(
              /*! ./volumetric.frag */
              "./src/WebGL/shaders/lib/volumetric/volumetric.frag"
            ), u = t(
              /*! ./volumetric.vert */
              "./src/WebGL/shaders/lib/volumetric/volumetric.vert"
            );
            const y = {
              fragmentShader: f.default.replace("#define GLSLIFY 1", ""),
              vertexShader: u.default.replace("#define GLSLIFY 1", ""),
              uniforms: n.uniforms
            };
          }
        ),
        /***/
        "./src/WebGL/shaders/lib/volumetric/uniforms.ts": (
          /*!******************************************************!*\
            !*** ./src/WebGL/shaders/lib/volumetric/uniforms.ts ***!
            \******************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              uniforms: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../../colors */
              "./src/colors.ts"
            );
            const f = {
              opacity: { type: "f", value: 1 },
              fogColor: { type: "c", value: new n.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 ***!
            \******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              clone: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../../colors */
              "./src/colors.ts"
            );
            function f(u) {
              let y = {};
              for (const _ in u) {
                y[_] = {}, y[_].type = u[_].type;
                var h = u[_].value;
                h instanceof n.Color ? y[_].value = h.clone() : typeof h == "number" ? y[_].value = h : h instanceof Array ? y[_].value = [] : console.error("Error copying shader uniforms from ShaderLib: unknown type for uniform");
              }
              return y;
            }
          }
        ),
        /***/
        "./src/WebGL/shaders/utils/index.ts": (
          /*!******************************************!*\
            !*** ./src/WebGL/shaders/utils/index.ts ***!
            \******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              ShaderUtils: () => (
                /* binding */
                u
              ),
              /* harmony export */
              clone: () => (
                /* reexport safe */
                n.clone
              )
              /* harmony export */
            });
            var n = t(
              /*! ./clone */
              "./src/WebGL/shaders/utils/clone.ts"
            ), f = t(
              /*! ./stickimposterFragmentShader.partial.frag */
              "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag"
            );
            const u = {
              clone: n.clone,
              stickimposterFragmentShader: f.default
            };
          }
        ),
        /***/
        "./src/WebGL/shapes/Cylinder.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Cylinder.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Cylinder: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            let f = new n.Vector3();
            class u {
              constructor(h = new n.Vector3(), _ = new n.Vector3(), E = 0) {
                this.c1 = h, this.c2 = _, this.radius = E, this.direction = new n.Vector3().subVectors(this.c2, this.c1).normalize();
              }
              copy(h) {
                return this.c1.copy(h.c1), this.c2.copy(h.c2), this.direction.copy(h.direction), this.radius = h.radius, this;
              }
              lengthSq() {
                return f.subVectors(this.c2, this.c1).lengthSq();
              }
              applyMatrix4(h) {
                return this.direction.add(this.c1).applyMatrix4(h), this.c1.applyMatrix4(h), this.c2.applyMatrix4(h), this.direction.sub(this.c1).normalize(), this.radius = this.radius * h.getMaxScaleOnAxis(), this;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/Sphere.ts": (
          /*!************************************!*\
            !*** ./src/WebGL/shapes/Sphere.ts ***!
            \************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Sphere: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            class f {
              constructor(y = { x: 0, y: 0, z: 0 }, h = 0) {
                this.center = new n.Vector3(y.x, y.y, y.z), this.radius = h;
              }
              set(y, h) {
                return this.center.copy(y), this.radius = h, this;
              }
              copy(y) {
                return this.center.copy(y.center), this.radius = y.radius, this;
              }
              applyMatrix4(y) {
                return this.center.applyMatrix4(y), this.radius = this.radius * y.getMaxScaleOnAxis(), this;
              }
              translate(y) {
                return this.center.add(y), this;
              }
              equals(y) {
                return y.center.equals(this.center) && y.radius === this.radius;
              }
              clone() {
                return new f().copy(this);
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/Triangle.ts": (
          /*!**************************************!*\
            !*** ./src/WebGL/shapes/Triangle.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Triangle: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../math */
              "./src/WebGL/math/index.ts"
            );
            const f = new n.Vector3();
            class u {
              constructor(h = new n.Vector3(), _ = new n.Vector3(), E = new n.Vector3()) {
                this.a = h, this.b = _, this.c = E;
              }
              copy(h) {
                return this.a.copy(h.a), this.b.copy(h.b), this.c.copy(h.c), this;
              }
              applyMatrix4(h) {
                return this.a.applyMatrix4(h), this.b.applyMatrix4(h), this.c.applyMatrix4(h), this;
              }
              getNormal() {
                var h = this.a.clone();
                return h.sub(this.b), f.subVectors(this.c, this.b), h.cross(f), h.normalize(), h;
              }
            }
          }
        ),
        /***/
        "./src/WebGL/shapes/index.ts": (
          /*!***********************************!*\
            !*** ./src/WebGL/shapes/index.ts ***!
            \***********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                f.Cylinder
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                n.Sphere
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                u.Triangle
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Sphere */
              "./src/WebGL/shapes/Sphere.ts"
            ), f = t(
              /*! ./Cylinder */
              "./src/WebGL/shapes/Cylinder.ts"
            ), u = t(
              /*! ./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(r) {
                    for (r.setStyle(select, style), UI && UI.createSelectionAndStyle(select, style), i = 0; i < selectstylelist.length; i++) {
                      let e = selectstylelist[i][0] || {}, t = selectstylelist[i][1] || { line: {} };
                      r.setStyle(e, t), UI && UI.createSelectionAndStyle(select, style);
                    }
                    for (i = 0; i < surfaces.length; i++) {
                      let e = surfaces[i][0] || {}, t = surfaces[i][1] || {};
                      UI ? r.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, t, e, e).then((f) => {
                        UI.loadSurface("VDW", e, t, f);
                      }) : r.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, t, e, e);
                    }
                    for (i = 0; i < labels.length; i++) {
                      let e = labels[i][0] || {}, t = labels[i][1] || {};
                      r.addResLabels(e, t);
                    }
                    r.render(), r.zoomTo(zoomto), spin && r.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 (r) {
                    console.log(r), 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 ***!
            \***********************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CC: () => (
                /* binding */
                f
              ),
              /* harmony export */
              Color: () => (
                /* binding */
                n
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* binding */
                C
              ),
              /* harmony export */
              chains: () => (
                /* binding */
                c
              ),
              /* harmony export */
              elementColors: () => (
                /* binding */
                _
              ),
              /* harmony export */
              htmlColors: () => (
                /* binding */
                u
              ),
              /* harmony export */
              residues: () => (
                /* binding */
                E
              ),
              /* harmony export */
              ssColors: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            class n {
              constructor(A, S, s) {
                return this.r = 0, this.g = 0, this.b = 0, arguments.length > 1 && typeof A == "number" ? (this.r = A || 0, this.g = S || 0, this.b = s || 0, this) : this.set(A || 0);
              }
              set(A) {
                return A instanceof n ? A.clone() : (typeof A == "number" ? this.setHex(A) : typeof A == "object" && (this.r = (A == null ? void 0 : A.r) || 0, this.g = (A == null ? void 0 : A.g) || 0, this.b = (A == null ? void 0 : A.b) || 0), this);
              }
              setHex(A) {
                return A = Math.floor(A), this.r = (A >> 16 & 255) / 255, this.g = (A >> 8 & 255) / 255, this.b = (A & 255) / 255, this;
              }
              getHex() {
                var A = Math.round(this.r * 255), S = Math.round(this.g * 255), s = Math.round(this.b * 255);
                return A << 16 | S << 8 | s;
              }
              clone() {
                return new n(this.r, this.g, this.b);
              }
              copy(A) {
                return this.r = A.r, this.g = A.g, this.b = A.b, this;
              }
              //return object that represents color components from 0 to 255
              scaled() {
                var A = {};
                return A.r = Math.round(this.r * 255), A.g = Math.round(this.g * 255), A.b = Math.round(this.b * 255), A.a = 1, A;
              }
            }
            class f {
              static color(A) {
                if (!A)
                  return f.cache[0];
                if (A instanceof n)
                  return A;
                if (typeof A == "number" && typeof f.cache[A] < "u")
                  return f.cache[A];
                if (A && Array.isArray(A))
                  return A.map(f.color);
                let S = f.getHex(A), s = new n(S);
                return f.cache[S] = s, s;
              }
              static getHex(A) {
                var S;
                if (Array.isArray(A))
                  return A.map(f.getHex);
                if (typeof A == "string") {
                  let s = A;
                  if (!isNaN(parseInt(s)))
                    return parseInt(s);
                  if (s = s.trim(), s.length == 4 && s[0] == "#" && (s = "#" + s[1] + s[1] + s[2] + s[2] + s[3] + s[3]), s.length == 7 && s[0] == "#")
                    return parseInt(s.substring(1), 16);
                  let o = f.rgbRegEx.exec(s);
                  if (o) {
                    o[1] != "" && console.log("WARNING: Opacity value in rgba ignored.  Specify separately as opacity attribute.");
                    let w = 0;
                    for (let p = 2; p < 5; p++) {
                      w *= 256;
                      let v = o[p].endsWith("%") ? 255 * parseFloat(o[p]) / 100 : parseFloat(o[p]);
                      w += Math.round(v);
                    }
                    return w;
                  }
                  return ((S = window == null ? void 0 : window.$3Dmol) === null || S === void 0 ? void 0 : S.htmlColors[A.toLowerCase()]) || 0;
                }
                return A;
              }
            }
            f.rgbRegEx = /rgb(a?)\(\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)/i, f.cache = { 0: new n(0) };
            const u = {
              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
            }, y = {
              //names are in helix-sheet-coil order
              pyMol: { h: 16711680, s: 16776960, c: 65280 },
              Jmol: { h: 16711808, s: 16762880, c: 16777215 }
            }, h = {
              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
            }, _ = {
              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: h,
              defaultColors: Object.assign({}, h),
              greenCarbon: Object.assign(Object.assign({}, h), { C: 65280 }),
              cyanCarbon: Object.assign(Object.assign({}, h), { C: 65535 }),
              magentaCarbon: Object.assign(Object.assign({}, h), { C: 16711935 }),
              yellowCarbon: Object.assign(Object.assign({}, h), { C: 16776960 }),
              whiteCarbon: Object.assign(Object.assign({}, h), { C: 16777215 }),
              orangeCarbon: Object.assign(Object.assign({}, h), { C: 16753920 }),
              purpleCarbon: Object.assign(Object.assign({}, h), { C: 8388736 }),
              blueCarbon: Object.assign(Object.assign({}, h), { 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
              }
            }, c = {
              /** @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
              }
            }, C = {
              /** secondary structure pymol */
              ssPyMol: { prop: "ss", map: y.pyMol },
              ssJmol: { prop: "ss", map: y.Jmol },
              Jmol: { prop: "elem", map: _.Jmol },
              amino: { prop: "resn", map: E.amino },
              shapely: { prop: "resn", map: E.shapely },
              nucleic: { prop: "resn", map: E.nucleic },
              chain: { prop: "chain", map: c.atom },
              rasmol: { prop: "elem", map: _.rasmol },
              default: { prop: "elem", map: _.defaultColors },
              greenCarbon: { prop: "elem", map: _.greenCarbon },
              chainHetatm: { prop: "chain", map: c.hetatm },
              cyanCarbon: { prop: "elem", map: _.cyanCarbon },
              magentaCarbon: { prop: "elem", map: _.magentaCarbon },
              purpleCarbon: { prop: "elem", map: _.purpleCarbon },
              whiteCarbon: { prop: "elem", map: _.whiteCarbon },
              orangeCarbon: { prop: "elem", map: _.orangeCarbon },
              yellowCarbon: { prop: "elem", map: _.yellowCarbon },
              blueCarbon: { prop: "elem", map: _.blueCarbon }
            };
          }
        ),
        /***/
        "./src/glcartoon.ts": (
          /*!**************************!*\
            !*** ./src/glcartoon.ts ***!
            \**************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              drawCartoon: () => (
                /* binding */
                z
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* binding */
                c
              )
              /* harmony export */
            });
            var n = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), f = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), u = t(
              /*! ./WebGL */
              "./src/WebGL/index.ts"
            ), y = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), h = t(
              /*! ./colors */
              "./src/colors.ts"
            ), _ = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), E = t(
              /*! ./utilities */
              "./src/utilities.ts"
            );
            function c(P, B) {
              var F = [], N = P;
              N = [], N.push(P[0]);
              var $, k, G, H, U, V, Q, ae, oe;
              for ($ = 1, k = P.length - 1; $ < k; $++)
                if (U = P[$], V = P[$ + 1], U.smoothen) {
                  var q = new n.Vector3((U.x + V.x) / 2, (U.y + V.y) / 2, (U.z + V.z) / 2);
                  q.atom = U.atom, N.push(q);
                } else
                  N.push(U);
              for (N.push(P[P.length - 1]), $ = -1, G = N.length; $ <= G - 3; $++)
                if (H = N[$ === -1 ? 0 : $], U = N[$ + 1], V = N[$ + 2], Q = N[$ === G - 3 ? G - 1 : $ + 3], ae = new n.Vector3().subVectors(V, H).multiplyScalar(0.5), oe = new n.Vector3().subVectors(Q, U).multiplyScalar(0.5), !V.skip)
                  for (var me = 0; me < B; me++) {
                    var ne = 1 / B * me, fe = U.x + ne * ae.x + ne * ne * (-3 * U.x + 3 * V.x - 2 * ae.x - oe.x) + ne * ne * ne * (2 * U.x - 2 * V.x + ae.x + oe.x), Ce = U.y + ne * ae.y + ne * ne * (-3 * U.y + 3 * V.y - 2 * ae.y - oe.y) + ne * ne * ne * (2 * U.y - 2 * V.y + ae.y + oe.y), Me = U.z + ne * ae.z + ne * ne * (-3 * U.z + 3 * V.z - 2 * ae.z - oe.z) + ne * ne * ne * (2 * U.z - 2 * V.z + ae.z + oe.z), Te = new n.Vector3(fe, Ce, Me);
                    me < B / 2 ? Te.atom = U.atom : Te.atom = V.atom, F.push(Te);
                  }
              return F.push(N[N.length - 1]), F;
            }
            const C = 0.5, b = 1.3, A = 0.8, S = 0.4, s = 0.4;
            function o(P, B, F, N) {
              for (var $, k, G, H, U = 0, V = B.length; U < V; U++) {
                H = Math.round(U * (N.length - 1) / V), G = h.CC.color(N[H]);
                var Q = P.updateGeoGroup(2), ae = Q.vertexArray, oe = Q.colorArray, q = Q.faceArray;
                $ = Q.vertices, k = $ * 3, ae[k] = B[U].x, ae[k + 1] = B[U].y, ae[k + 2] = B[U].z, ae[k + 3] = F[U].x, ae[k + 4] = F[U].y, ae[k + 5] = F[U].z;
                for (var me = 0; me < 6; ++me)
                  oe[k + 3 * me] = G.r, oe[k + 1 + 3 * me] = G.g, oe[k + 2 + 3 * me] = G.b;
                if (U > 0) {
                  var ne = [$, $ + 1, $ - 1, $ - 2], fe = Q.faceidx;
                  q[fe] = ne[0], q[fe + 1] = ne[1], q[fe + 2] = ne[3], q[fe + 3] = ne[1], q[fe + 4] = ne[2], q[fe + 5] = ne[3], Q.faceidx += 6;
                }
                Q.vertices += 2;
              }
            }
            function w(P, B, F, N, $, k, G) {
              var H, U, V, Q;
              if (V = B.length, V < 2 || B[0].length < 2)
                return;
              for (H = 0; H < V; H++)
                B[H] = c(B[H], N);
              if (Q = B[0].length, !$)
                return o(P, B[0], B[V - 1], F);
              var ae, oe, q, me, ne, fe, Ce = [], Me = [], Te = [];
              for (U = 0; U < V; U++)
                Ce.push(0.25 + 1.5 * Math.sqrt((V - 1) * U - Math.pow(U, 2)) / (V - 1)), Me.push(0.5), Te.push(2 * (Math.pow(U / V, 2) - U / V) + 0.6);
              var se = [];
              for (U = 0; U < V * 2 - 1; U++)
                se[U] = [U, U + 1, U + 1 - 2 * V, U - 2 * V];
              se[V * 2 - 1] = [
                U,
                U + 1 - 2 * V,
                U + 1 - 4 * V,
                U - 2 * V
              ];
              var pe, we, ke, Ue, Ne, Be, ue, ye, ge, Se;
              let ze = P.updateGeoGroup();
              for (H = 0; H < Q; H++) {
                let K = P.groups, ee = !1;
                ze = P.updateGeoGroup(2 * V), K != P.groups && H > 0 && (H = H - 1, ee = !0), Be = Math.round(H * (F.length - 1) / Q), Ne = h.CC.color(F[Be]), ne = q, fe = me, q = [], me = [], ae = [], B[0][H].atom !== void 0 && (Ue = B[0][H].atom, G === "oval" ? oe = Ce : G === "rectangle" ? oe = Me : G === "parabola" && (oe = Te)), oe || (oe = Me);
                var He, We;
                for (U = 0; U < V; U++)
                  H < Q - 1 ? He = B[U][H + 1].clone().sub(B[U][H]) : He = B[U][H - 1].clone().sub(B[U][H]).negate(), U < V - 1 ? We = B[U + 1][H].clone().sub(B[U][H]) : We = B[U - 1][H].clone().sub(B[U][H]).negate(), ae[U] = We.cross(He).normalize().multiplyScalar($ * oe[U]);
                for (U = 0; U < V; U++)
                  q[U] = B[U][H].clone().add(ae[U].clone().negate());
                for (U = 0; U < V; U++)
                  me[U] = B[U][H].clone().add(ae[U]);
                for (ue = ze.vertexArray, ye = ze.colorArray, ge = ze.faceArray, pe = ze.vertices, we = pe * 3, U = 0; U < V; U++)
                  ue[we + 3 * U + 0] = q[U].x, ue[we + 3 * U + 1] = q[U].y, ue[we + 3 * U + 2] = q[U].z;
                for (U = 0; U < V; U++)
                  ue[we + 3 * U + 0 + 3 * V] = me[V - 1 - U].x, ue[we + 3 * U + 1 + 3 * V] = me[V - 1 - U].y, ue[we + 3 * U + 2 + 3 * V] = me[V - 1 - U].z;
                for (U = 0; U < 2 * V; ++U)
                  ye[we + 3 * U + 0] = Ne.r, ye[we + 3 * U + 1] = Ne.g, ye[we + 3 * U + 2] = Ne.b;
                if (H > 0 && !ee) {
                  for (U = 0; U < V * 2; U++)
                    Se = [
                      pe + se[U][0],
                      pe + se[U][1],
                      pe + se[U][2],
                      pe + se[U][3]
                    ], ke = ze.faceidx, ge[ke] = Se[0], ge[ke + 1] = Se[1], ge[ke + 2] = Se[3], ge[ke + 3] = Se[1], ge[ke + 4] = Se[2], ge[ke + 5] = Se[3], ze.faceidx += 6;
                  if (Ue.clickable || Ue.hoverable) {
                    var Y = [];
                    Y.push(new f.Triangle(ne[0], q[0], q[V - 1])), Y.push(new f.Triangle(ne[0], q[V - 1], ne[V - 1])), Y.push(new f.Triangle(ne[V - 1], q[V - 1], me[V - 1])), Y.push(new f.Triangle(ne[V - 1], me[V - 1], fe[V - 1])), Y.push(new f.Triangle(me[0], fe[0], fe[V - 1])), Y.push(new f.Triangle(me[V - 1], me[0], fe[V - 1])), Y.push(new f.Triangle(q[0], ne[0], fe[0])), Y.push(new f.Triangle(me[0], q[0], fe[0]));
                    for (U in Y)
                      Ue.intersectionShape.triangle.push(Y[U]);
                  }
                }
                ze.vertices += 2 * V;
              }
              for (ue = ze.vertexArray, ye = ze.colorArray, ge = ze.faceArray, pe = ze.vertices, we = pe * 3, ke = ze.faceidx, H = 0; H < V - 1; H++)
                Se = [H, H + 1, 2 * V - 2 - H, 2 * V - 1 - H], ke = ze.faceidx, ge[ke] = Se[0], ge[ke + 1] = Se[1], ge[ke + 2] = Se[3], ge[ke + 3] = Se[1], ge[ke + 4] = Se[2], ge[ke + 5] = Se[3], ze.faceidx += 6;
              for (H = 0; H < V - 1; H++)
                Se = [
                  pe - 1 - H,
                  pe - 2 - H,
                  pe - 2 * V + H + 1,
                  pe - 2 * V + H
                ], ke = ze.faceidx, ge[ke] = Se[0], ge[ke + 1] = Se[1], ge[ke + 2] = Se[3], ge[ke + 3] = Se[1], ge[ke + 4] = Se[2], ge[ke + 5] = Se[3], ze.faceidx += 6;
            }
            function p(P, B, F, N, $, k) {
              if (!(B.length < 2)) {
                var G, H;
                if (G = B[0], H = B[B.length - 1], G = c(G, N), H = c(H, N), !$)
                  return o(P, G, H, F);
                var U = [], V, Q, ae, oe, q, me = [
                  [0, 2, -6, -8],
                  [-4, -2, 6, 4],
                  [7, -1, -5, 3],
                  [-3, 5, 1, -7]
                ], ne, fe, Ce, Me, Te, se, pe, we, ke, Ue, Ne, Be, ue, ye, ge, Se, ze;
                for (we = 0, ke = G.length; we < ke; we++) {
                  if (Te = Math.round(we * (F.length - 1) / ke), Me = h.CC.color(F[Te]), U.push(Q = G[we]), U.push(Q), U.push(ae = H[we]), U.push(ae), we < ke - 1) {
                    var He = G[we + 1].clone().sub(G[we]), We = H[we].clone().sub(G[we]);
                    V = We.cross(He).normalize().multiplyScalar($);
                  }
                  for (U.push(oe = G[we].clone().add(V)), U.push(oe), U.push(q = H[we].clone().add(V)), U.push(q), Q.atom !== void 0 && (se = Q.atom), ye = P.updateGeoGroup(8), ge = ye.vertexArray, Se = ye.colorArray, ze = ye.faceArray, ne = ye.vertices, fe = ne * 3, ge[fe] = Q.x, ge[fe + 1] = Q.y, ge[fe + 2] = Q.z, ge[fe + 3] = Q.x, ge[fe + 4] = Q.y, ge[fe + 5] = Q.z, ge[fe + 6] = ae.x, ge[fe + 7] = ae.y, ge[fe + 8] = ae.z, ge[fe + 9] = ae.x, ge[fe + 10] = ae.y, ge[fe + 11] = ae.z, ge[fe + 12] = oe.x, ge[fe + 13] = oe.y, ge[fe + 14] = oe.z, ge[fe + 15] = oe.x, ge[fe + 16] = oe.y, ge[fe + 17] = oe.z, ge[fe + 18] = q.x, ge[fe + 19] = q.y, ge[fe + 20] = q.z, ge[fe + 21] = q.x, ge[fe + 22] = q.y, ge[fe + 23] = q.z, Ue = 0; Ue < 8; ++Ue)
                    Se[fe + 3 * Ue] = Me.r, Se[fe + 1 + 3 * Ue] = Me.g, Se[fe + 2 + 3 * Ue] = Me.b;
                  if (we > 0) {
                    var Y = pe !== void 0 && se !== void 0 && pe.serial !== se.serial;
                    for (Ue = 0; Ue < 4; Ue++) {
                      var K = [
                        ne + me[Ue][0],
                        ne + me[Ue][1],
                        ne + me[Ue][2],
                        ne + me[Ue][3]
                      ];
                      if (Ce = ye.faceidx, ze[Ce] = K[0], ze[Ce + 1] = K[1], ze[Ce + 2] = K[3], ze[Ce + 3] = K[1], ze[Ce + 4] = K[2], ze[Ce + 5] = K[3], ye.faceidx += 6, se.clickable || pe.clickable || se.hoverable || pe.hoverable) {
                        var ee = U[K[3]].clone(), de = U[K[0]].clone(), ve = U[K[2]].clone(), Ie = U[K[1]].clone();
                        if (ee.atom = U[K[3]].atom || null, ve.atom = U[K[2]].atom || null, de.atom = U[K[0]].atom || null, Ie.atom = U[K[1]].atom || null, Y) {
                          var Re = ee.clone().add(de).multiplyScalar(0.5), Z = ve.clone().add(Ie).multiplyScalar(0.5), ce = ee.clone().add(Ie).multiplyScalar(0.5);
                          Ue % 2 === 0 ? ((pe.clickable || pe.hoverable) && (Ne = new f.Triangle(Re, ce, ee), Be = new f.Triangle(Z, ve, ce), ue = new f.Triangle(ce, ve, ee), pe.intersectionShape.triangle.push(Ne), pe.intersectionShape.triangle.push(Be), pe.intersectionShape.triangle.push(ue)), (se.clickable || se.hoverable) && (Ne = new f.Triangle(de, Ie, ce), Be = new f.Triangle(Ie, Z, ce), ue = new f.Triangle(de, ce, Re), se.intersectionShape.triangle.push(Ne), se.intersectionShape.triangle.push(Be), se.intersectionShape.triangle.push(ue))) : ((se.clickable || se.hoverable) && (Ne = new f.Triangle(Re, ce, ee), Be = new f.Triangle(Z, ve, ce), ue = new f.Triangle(ce, ve, ee), se.intersectionShape.triangle.push(Ne), se.intersectionShape.triangle.push(Be), se.intersectionShape.triangle.push(ue)), (pe.clickable || pe.hoverable) && (Ne = new f.Triangle(de, Ie, ce), Be = new f.Triangle(Ie, Z, ce), ue = new f.Triangle(de, ce, Re), pe.intersectionShape.triangle.push(Ne), pe.intersectionShape.triangle.push(Be), pe.intersectionShape.triangle.push(ue)));
                        } else
                          (se.clickable || se.hoverable) && (Ne = new f.Triangle(de, Ie, ee), Be = new f.Triangle(Ie, ve, ee), se.intersectionShape.triangle.push(Ne), se.intersectionShape.triangle.push(Be));
                      }
                    }
                  }
                  ye.vertices += 8, pe = se;
                }
                var Ae = U.length - 8;
                for (ye = P.updateGeoGroup(8), ge = ye.vertexArray, Se = ye.colorArray, ze = ye.faceArray, ne = ye.vertices, fe = ne * 3, Ce = ye.faceidx, we = 0; we < 4; we++) {
                  U.push(U[we * 2]), U.push(U[Ae + we * 2]);
                  var Fe = U[we * 2], he = U[Ae + we * 2];
                  ge[fe + 6 * we] = Fe.x, ge[fe + 1 + 6 * we] = Fe.y, ge[fe + 2 + 6 * we] = Fe.z, ge[fe + 3 + 6 * we] = he.x, ge[fe + 4 + 6 * we] = he.y, ge[fe + 5 + 6 * we] = he.z, Se[fe + 6 * we] = Me.r, Se[fe + 1 + 6 * we] = Me.g, Se[fe + 2 + 6 * we] = Me.b, Se[fe + 3 + 6 * we] = Me.r, Se[fe + 4 + 6 * we] = Me.g, Se[fe + 5 + 6 * we] = Me.b;
                }
                Ae += 8, Ne = [ne, ne + 2, ne + 6, ne + 4], Be = [ne + 1, ne + 5, ne + 7, ne + 3], ze[Ce] = Ne[0], ze[Ce + 1] = Ne[1], ze[Ce + 2] = Ne[3], ze[Ce + 3] = Ne[1], ze[Ce + 4] = Ne[2], ze[Ce + 5] = Ne[3], ze[Ce + 6] = Be[0], ze[Ce + 7] = Be[1], ze[Ce + 8] = Be[3], ze[Ce + 9] = Be[1], ze[Ce + 10] = Be[2], ze[Ce + 11] = Be[3], ye.faceidx += 12, ye.vertices += 8;
              }
            }
            function v(P, B, F, N, $, k, G) {
              (!G || G === "default") && (G = "rectangle"), G === "edged" ? p(P, B, F, N, $) : (G === "rectangle" || G === "oval" || G === "parabola") && w(P, B, F, N, $, k, G);
            }
            function a(P) {
              return P && P.elem === "C" && P.atom === "CA";
            }
            function l(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, N = P.y - B.y, $ = P.z - B.z, k = F * F + N * N + $ * $;
                  if (P.atom == "CA" && B.atom == "CA" && k < 16)
                    return !0;
                  if ((P.atom == "P" || B.atom == "P") && k < 64)
                    return !0;
                }
              }
              return !1;
            }
            function g(P, B, F, N, $) {
              if (!(B == null || B.vertices == 0)) {
                $ && (B.initTypedArrays(), B.setUpNormals());
                var k = new u.MeshDoubleLambertMaterial();
                k.vertexColors = u.Coloring.FaceColors, typeof F == "number" && F >= 0 && F < 1 && (k.transparent = !0, k.opacity = F), k.outline = N;
                var G = new u.Mesh(B, k);
                P.add(G);
              }
            }
            function M(P, B, F, N, $, k, G, H, U) {
              var V, Q, ae, oe, q, me;
              if (!(!N || !$ || !G)) {
                var ne = $.sub(N);
                ne.normalize();
                var fe = H[U];
                for (Q = U + 1; Q < H.length && (fe = H[Q], fe.atom != G.atom); Q++)
                  ;
                if (fe = fe ? new n.Vector3(fe.x, fe.y, fe.z) : new n.Vector3(0, 0, 0), fe.sub(N), G.ss === "arrow start") {
                  var Ce = fe.clone().multiplyScalar(0.3).cross($);
                  N.add(Ce);
                  var Me = fe.clone().cross(ne).normalize();
                  ne.rotateAboutVector(Me, 0.43);
                }
                for (G.style.cartoon.ribbon ? V = G.style.cartoon.thickness || S : G.style.cartoon.width ? V = G.style.cartoon.width : G.ss === "c" ? G.atom === "P" ? V = A : V = C : G.ss === "arrow start" ? (V = b, q = !0) : G.ss === "arrow end" || G.ss === "h" && G.style.cartoon.tubes || G.ss === "tube start" ? V = C : V = b, k != null && ne.dot(k) < 0 && ne.negate(), ne.multiplyScalar(V), Q = 0; Q < B; Q++)
                  ae = -1 + Q * 2 / (B - 1), oe = new n.Vector3(N.x + ae * ne.x, N.y + ae * ne.y, N.z + ae * ne.z), oe.atom = G, F && G.ss === "s" && (oe.smoothen = !0), P[Q].push(oe);
                if (q)
                  for (ne.multiplyScalar(2), Q = 0; Q < B; Q++)
                    ae = -1 + Q * 2 / (B - 1), oe = new n.Vector3(N.x + ae * ne.x, N.y + ae * ne.y, N.z + ae * ne.z), oe.atom = G, oe.smoothen = !1, oe.skip = !0, P[Q].push(oe);
                return me = G.style.cartoon.style || "default", P.style ? P.style != me && (console.log("Warning: a cartoon chain's strand-style is ambiguous"), P.style = "default") : P.style = me, (G.ss === "arrow start" || G.ss === "arrow end") && (G.ss = "s"), q;
              }
            }
            const L = {
              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
            }, T = { DA: !0, DG: !0, A: !0, G: !0 }, D = { DT: !0, DC: !0, U: !0, C: !0, T: !0 }, I = { DA: !0, DG: !0, A: !0, G: !0, DT: !0, DC: !0, U: !0, C: !0, T: !0 };
            function z(P, B, F, N = 10) {
              let $ = N, k = N;
              var G, H, U, V, Q, ae, oe, q, me, ne, fe, Ce, Me, Te, se, pe, we, ke, Ue = new u.Geometry(!0), Ne = new u.Geometry(!0), Be = [], ue = [], ye = 1, ge = !1, Se = {};
              for (var ze in y.Gradient.builtinGradients)
                y.Gradient.builtinGradients.hasOwnProperty(ze) && (Se[ze] = new y.Gradient.builtinGradients[ze](F[1], F[0]));
              var He = function(j, $e) {
                return F && $e.color === "spectrum" ? $e.colorscheme in Se ? Se[$e.colorscheme].valueToHex(j.resi) : Se.sinebow.valueToHex(j.resi) : (0, E.getColorFromStyle)(j, $e).getHex();
              };
              for (q = 0; q < $; q++)
                ue[q] = [];
              var We = !1, Y = !1, K = [];
              for (q in B) {
                if (V = B[q], V.elem === "C" && V.atom === "CA") {
                  var ee = l(U, V);
                  ee && V.ss === "s" ? We = !0 : We && (U && H && U.style.cartoon.arrows && H.style.cartoon.arrows && (U.ss = "arrow end", H.ss = "arrow start"), We = !1), ee && (U.ss === "h" || U.ss == "tube start") && U.style.cartoon.tubes ? !Y && U.ss != "tube start" && V.style.cartoon.tubes && (V.ss = "tube start", Y = !0) : Y && (U.ss === "tube start" ? U.ss = "tube end" : H && H.style.cartoon.tubes && (H.ss = "tube end"), Y = !1), H = U, U = V;
                }
                V && V.atom in L && K.push(V);
              }
              Y && U.style.cartoon.tubes && (U.ss = "tube end", Y = !1);
              var de = function(j) {
                ue[0].length > 0 && v(Ne, ue, Be, k, oe, ye, ue.style);
                var $e = [], Ve = null;
                if (j) {
                  for (q = 0; q < $; q++)
                    $e[q] = ue[q][ue[q].length - 1];
                  Ve = Be[Be.length - 1];
                }
                for (ue = [], q = 0; q < $; q++)
                  ue[q] = [];
                if (Be = [], j) {
                  for (q = 0; q < $; q++)
                    ue[q].push($e[q]);
                  Be.push(Ve);
                }
                g(P, Ne, ye, ge, !0), g(P, Ue, ye, ge, !1), Ne = new u.Geometry(!0), Ue = new u.Geometry(!0);
              };
              U = void 0;
              for (var ve = 0; ve < K.length; ve++) {
                V = K[ve];
                var Ie = V.resn.trim(), Re = Ie in I;
                if (ye = 1, G = V.style.cartoon, U && U.style.cartoon && (ye = U.style.cartoon.opacity), U && U.style.cartoon && U.style.cartoon.outline && (ge = U.style.cartoon.outline), U && U.style.cartoon && (!V.style.cartoon || U.style.cartoon.opacity != V.style.cartoon.opacity) && de(U.chain == V.chain), G.style === "trace") {
                  if (!V.hetflag) {
                    if (V.elem === "C" && V.atom === "CA" || Re && V.atom === "P" || V.atom === "BB") {
                      if (ae = He(V, G), (0, E.isNumeric)(G.thickness) ? oe = G.thickness : oe = S, l(U, V))
                        if (ae == Q) {
                          var Z = h.CC.color(ae);
                          _.GLDraw.drawCylinder(Ue, U, V, oe, Z, 2, 2);
                        } else {
                          var ce = new n.Vector3().addVectors(U, V).multiplyScalar(0.5), Ae = h.CC.color(Q), Fe = h.CC.color(ae);
                          _.GLDraw.drawCylinder(Ue, U, ce, oe, Ae, 2, 0), _.GLDraw.drawCylinder(Ue, ce, V, oe, Fe, 0, 2);
                        }
                      if ((V.clickable === !0 || V.hoverable) && V.intersectionShape !== void 0) {
                        var he = new n.Vector3(V.x, V.y, V.z);
                        V.intersectionShape.sphere.push(new f.Sphere(he, oe));
                      }
                      U = V, Q = ae;
                    }
                  }
                } else {
                  if (a(V) || Re && (V.atom === "P" || V.atom.indexOf("O5") == 0)) {
                    if (ke)
                      if (V.ss === "tube end")
                        ke = !1, we = new n.Vector3(V.x, V.y, V.z), _.GLDraw.drawCylinder(Ue, pe, we, 2, h.CC.color(Q), 1, 1), V.ss = "h";
                      else if (U.chain != V.chain || U.ss === "tube end")
                        ke = !1, U.ss = "h", we = new n.Vector3(U.x, U.y, U.z), _.GLDraw.drawCylinder(Ue, pe, we, 2, h.CC.color(Q), 1, 1);
                      else
                        continue;
                    if (U && (!l(U, V) || U.ss === "tube start")) {
                      for (U.ss === "tube start" && (ke = !0, pe = new n.Vector3(U.x, U.y, U.z), U.ss = "h"), se && (Ce ? Te = new n.Vector3().addVectors(U, Ce).multiplyScalar(0.5) : Te = new n.Vector3(U.x, U.y, U.z), _.GLDraw.drawCylinder(Ue, Te, se, s, h.CC.color(se.color), 0, 2), M(ue, $, !0, Ce, Me, fe, U, K, ve), Be.push(ae), Te = null, se = null), ue[0].length > 0 && v(Ne, ue, Be, k, oe, ye, ue.style), ue = [], q = 0; q < $; q++)
                        ue[q] = [];
                      Be = [];
                    }
                    if (U === void 0 || U.rescode != V.rescode || U.resi != V.resi) {
                      if (se) {
                        Te = new n.Vector3().addVectors(U, V).multiplyScalar(0.5);
                        var Oe = Te.clone().sub(se).multiplyScalar(0.02);
                        Te.add(Oe), _.GLDraw.drawCylinder(Ue, Te, se, s, h.CC.color(se.color), 0, 2), Te = null, se = null;
                      }
                      ae = He(V, G), Be.push(ae), (0, E.isNumeric)(G.thickness) ? oe = G.thickness : oe = S, U = V, me = new n.Vector3(U.x, U.y, U.z), me.resi = U.resi, Q = ae;
                    }
                    (V.clickable === !0 || V.hoverable === !0) && (V.intersectionShape === void 0 || V.intersectionShape.triangle === void 0) && (V.intersectionShape = {
                      sphere: null,
                      cylinder: [],
                      line: [],
                      triangle: []
                    });
                  } else
                    a(U) && V.atom === "O" || Re && U.atom === "P" && (V.atom === "OP2" || V.atom === "O2P") || Re && U.atom.indexOf("O5") == 0 && V.atom.indexOf("C5") == 0 ? (ne = new n.Vector3(V.x, V.y, V.z), ne.resi = V.resi, (V.atom === "OP2" || V.atom === "O2P") && (Me = new n.Vector3(V.x, V.y, V.z))) : Re && V.atom.indexOf("O3") == 0 ? Ce = new n.Vector3(V.x, V.y, V.z) : (V.atom === "N1" && Ie in T || V.atom === "N3" && Ie in D) && (se = new n.Vector3(V.x, V.y, V.z), se.color = (0, E.getColorFromStyle)(V, G).getHex());
                  ne && me && ne.resi === me.resi && (M(ue, $, !0, me, ne, fe, U, K, ve), fe = ne, me = null, ne = null, Be.push(ae));
                }
              }
              se && (Ce ? Te = new n.Vector3().addVectors(U, Ce).multiplyScalar(0.5) : Te = new n.Vector3(U.x, U.y, U.z), _.GLDraw.drawCylinder(Ue, Te, se, s, h.CC.color(se.color), 0, 2), M(ue, $, !0, Ce, Me, fe, U, K, ve), Be.push(ae)), de(!1);
            }
          }
        ),
        /***/
        "./src/index.ts": (
          /*!**********************!*\
            !*** ./src/index.ts ***!
            \**********************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CAP: () => (
                /* reexport safe */
                s.CAP
              ),
              /* harmony export */
              CC: () => (
                /* reexport safe */
                f.CC
              ),
              /* harmony export */
              Color: () => (
                /* reexport safe */
                f.Color
              ),
              /* harmony export */
              CustomLinear: () => (
                /* reexport safe */
                n.CustomLinear
              ),
              /* harmony export */
              Cylinder: () => (
                /* reexport safe */
                E.Cylinder
              ),
              /* harmony export */
              GLDraw: () => (
                /* reexport safe */
                s.GLDraw
              ),
              /* harmony export */
              GLModel: () => (
                /* reexport safe */
                w.GLModel
              ),
              /* harmony export */
              GLShape: () => (
                /* reexport safe */
                S.GLShape
              ),
              /* harmony export */
              GLViewer: () => (
                /* reexport safe */
                p.GLViewer
              ),
              /* harmony export */
              GLVolumetricRender: () => (
                /* reexport safe */
                A.GLVolumetricRender
              ),
              /* harmony export */
              Gradient: () => (
                /* reexport safe */
                n.Gradient
              ),
              /* harmony export */
              GradientType: () => (
                /* reexport safe */
                n.GradientType
              ),
              /* harmony export */
              Label: () => (
                /* reexport safe */
                u.Label
              ),
              /* harmony export */
              LabelCount: () => (
                /* reexport safe */
                u.LabelCount
              ),
              /* harmony export */
              MarchingCube: () => (
                /* reexport safe */
                C.MarchingCube
              ),
              /* harmony export */
              MarchingCubeInitializer: () => (
                /* reexport safe */
                C.MarchingCubeInitializer
              ),
              /* harmony export */
              Matrix3: () => (
                /* reexport safe */
                _.Matrix3
              ),
              /* harmony export */
              Matrix4: () => (
                /* reexport safe */
                _.Matrix4
              ),
              /* harmony export */
              Parsers: () => (
                /* reexport safe */
                h.Parsers
              ),
              /* harmony export */
              PausableTimer: () => (
                /* reexport safe */
                c.PausableTimer
              ),
              /* harmony export */
              PointGrid: () => (
                /* reexport safe */
                C.PointGrid
              ),
              /* harmony export */
              ProteinSurface: () => (
                /* reexport safe */
                C.ProteinSurface
              ),
              /* harmony export */
              Quaternion: () => (
                /* reexport safe */
                _.Quaternion
              ),
              /* harmony export */
              ROYGB: () => (
                /* reexport safe */
                n.ROYGB
              ),
              /* harmony export */
              RWB: () => (
                /* reexport safe */
                n.RWB
              ),
              /* harmony export */
              Ray: () => (
                /* reexport safe */
                _.Ray
              ),
              /* harmony export */
              Sinebow: () => (
                /* reexport safe */
                n.Sinebow
              ),
              /* harmony export */
              Sphere: () => (
                /* reexport safe */
                E.Sphere
              ),
              /* harmony export */
              SurfaceType: () => (
                /* reexport safe */
                C.SurfaceType
              ),
              /* harmony export */
              Triangle: () => (
                /* reexport safe */
                E.Triangle
              ),
              /* harmony export */
              Vector2: () => (
                /* reexport safe */
                _.Vector2
              ),
              /* harmony export */
              Vector3: () => (
                /* reexport safe */
                _.Vector3
              ),
              /* harmony export */
              VolumeData: () => (
                /* reexport safe */
                b.VolumeData
              ),
              /* harmony export */
              adjustVolumeStyle: () => (
                /* reexport safe */
                c.adjustVolumeStyle
              ),
              /* harmony export */
              applyPartialCharges: () => (
                /* reexport safe */
                y.applyPartialCharges
              ),
              /* harmony export */
              autoinit: () => (
                /* reexport safe */
                v.autoinit
              ),
              /* harmony export */
              autoload: () => (
                /* reexport safe */
                v.autoload
              ),
              /* harmony export */
              base64ToArray: () => (
                /* reexport safe */
                c.base64ToArray
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                h.bondLength
              ),
              /* harmony export */
              builtinColorSchemes: () => (
                /* reexport safe */
                f.builtinColorSchemes
              ),
              /* harmony export */
              builtinGradients: () => (
                /* reexport safe */
                n.builtinGradients
              ),
              /* harmony export */
              chains: () => (
                /* reexport safe */
                f.chains
              ),
              /* harmony export */
              clamp: () => (
                /* reexport safe */
                _.clamp
              ),
              /* harmony export */
              conversionMatrix3: () => (
                /* reexport safe */
                _.conversionMatrix3
              ),
              /* harmony export */
              createStereoViewer: () => (
                /* reexport safe */
                p.createStereoViewer
              ),
              /* harmony export */
              createViewer: () => (
                /* reexport safe */
                p.createViewer
              ),
              /* harmony export */
              createViewerGrid: () => (
                /* reexport safe */
                p.createViewerGrid
              ),
              /* harmony export */
              deepCopy: () => (
                /* reexport safe */
                c.deepCopy
              ),
              /* harmony export */
              degToRad: () => (
                /* reexport safe */
                _.degToRad
              ),
              /* harmony export */
              download: () => (
                /* reexport safe */
                c.download
              ),
              /* harmony export */
              drawCartoon: () => (
                /* reexport safe */
                o.drawCartoon
              ),
              /* harmony export */
              elementColors: () => (
                /* reexport safe */
                f.elementColors
              ),
              /* harmony export */
              extend: () => (
                /* reexport safe */
                c.extend
              ),
              /* harmony export */
              get: () => (
                /* reexport safe */
                c.get
              ),
              /* harmony export */
              getAtomProperty: () => (
                /* reexport safe */
                c.getAtomProperty
              ),
              /* harmony export */
              getColorFromStyle: () => (
                /* reexport safe */
                c.getColorFromStyle
              ),
              /* harmony export */
              getElement: () => (
                /* reexport safe */
                c.getElement
              ),
              /* harmony export */
              getExtent: () => (
                /* reexport safe */
                c.getExtent
              ),
              /* harmony export */
              getGradient: () => (
                /* reexport safe */
                n.getGradient
              ),
              /* harmony export */
              getPropertyRange: () => (
                /* reexport safe */
                c.getPropertyRange
              ),
              /* harmony export */
              getbin: () => (
                /* reexport safe */
                c.getbin
              ),
              /* harmony export */
              htmlColors: () => (
                /* reexport safe */
                f.htmlColors
              ),
              /* harmony export */
              isEmptyObject: () => (
                /* reexport safe */
                c.isEmptyObject
              ),
              /* harmony export */
              isNumeric: () => (
                /* reexport safe */
                c.isNumeric
              ),
              /* harmony export */
              makeFunction: () => (
                /* reexport safe */
                c.makeFunction
              ),
              /* harmony export */
              mergeGeos: () => (
                /* reexport safe */
                c.mergeGeos
              ),
              /* harmony export */
              normalizeValue: () => (
                /* reexport safe */
                n.normalizeValue
              ),
              /* harmony export */
              partialCharges: () => (
                /* reexport safe */
                y.partialCharges
              ),
              /* harmony export */
              processing_autoinit: () => (
                /* reexport safe */
                v.processing_autoinit
              ),
              /* harmony export */
              residues: () => (
                /* reexport safe */
                f.residues
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                h.setBondLength
              ),
              /* harmony export */
              setSyncSurface: () => (
                /* reexport safe */
                C.setSyncSurface
              ),
              /* harmony export */
              specStringToObject: () => (
                /* reexport safe */
                c.specStringToObject
              ),
              /* harmony export */
              splitMesh: () => (
                /* reexport safe */
                S.splitMesh
              ),
              /* harmony export */
              ssColors: () => (
                /* reexport safe */
                f.ssColors
              ),
              /* harmony export */
              subdivide_spline: () => (
                /* reexport safe */
                o.subdivide_spline
              ),
              /* harmony export */
              syncSurface: () => (
                /* reexport safe */
                C.syncSurface
              ),
              /* harmony export */
              viewers: () => (
                /* reexport safe */
                v.viewers
              )
              /* harmony export */
            });
            var n = t(
              /*! ./Gradient */
              "./src/Gradient.ts"
            ), f = t(
              /*! ./colors */
              "./src/colors.ts"
            ), u = t(
              /*! ./Label */
              "./src/Label.ts"
            ), y = t(
              /*! ./partialCharges */
              "./src/partialCharges.ts"
            ), h = t(
              /*! ./parsers */
              "./src/parsers/index.ts"
            ), _ = t(
              /*! ./WebGL/math */
              "./src/WebGL/math/index.ts"
            ), E = t(
              /*! ./WebGL/shapes */
              "./src/WebGL/shapes/index.ts"
            ), c = t(
              /*! ./utilities */
              "./src/utilities.ts"
            ), C = t(
              /*! ./ProteinSurface4 */
              "./src/ProteinSurface4.ts"
            ), b = t(
              /*! ./VolumeData */
              "./src/VolumeData.ts"
            ), A = t(
              /*! ./VolumetricRender */
              "./src/VolumetricRender.ts"
            ), S = t(
              /*! ./GLShape */
              "./src/GLShape.ts"
            ), s = t(
              /*! ./GLDraw */
              "./src/GLDraw.ts"
            ), o = t(
              /*! ./glcartoon */
              "./src/glcartoon.ts"
            ), w = t(
              /*! ./GLModel */
              "./src/GLModel.ts"
            ), p = t(
              /*! ./GLViewer */
              "./src/GLViewer.ts"
            ), v = t(
              /*! ./autoload */
              "./src/autoload.ts"
            );
            t(
              /*! ./specs */
              "./src/specs.ts"
            ), window && (window.$3Dmol = e);
          }
        ),
        /***/
        "./src/parsers/CDJSON.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/CDJSON.ts ***!
            \*******************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CDJSON: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f, u) {
              var y = [[]];
              typeof f == "string" && (f = JSON.parse(f));
              for (var h = f.m, _ = h[0].a, E = h[0].b, c = h[0].s, C = u !== void 0 && u.parseStyle !== void 0 ? u.parseStyle : c !== void 0, b = y[y.length - 1].length, A = 0; A < _.length; A++) {
                var S = _[A], s = {};
                s.id = S.i, s.x = S.x, s.y = S.y, s.z = S.z || 0, s.bonds = [], s.bondOrder = [];
                var o = S.l || "C";
                s.elem = o[0].toUpperCase() + o.substring(1).toLowerCase(), s.serial = y[y.length - 1].length, C && (s.style = c[S.s || 0]), y[y.length - 1].push(s);
              }
              for (let w = 0; w < E.length; w++) {
                let p = E[w], v = p.b + b, a = p.e + b, l = p.o || 1, g = y[y.length - 1][v], M = y[y.length - 1][a];
                g.bonds.push(a), g.bondOrder.push(l), M.bonds.push(v), M.bondOrder.push(l);
              }
              return y;
            }
          }
        ),
        /***/
        "./src/parsers/CIF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/CIF.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CIF: () => (
                /* binding */
                h
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), f = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), u = t(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), y = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            );
            function h(_, E = {}) {
              var c = [], C = !E.doAssembly, b = c.modelData = [], A = E.assignBonds === void 0 ? !0 : E.assignBonds, S = function(K, ee, de, ve) {
                return new y.Vector3(ee, de, ve).applyMatrix3(K);
              };
              function s(K, ee) {
                for (var de = [], ve = 0, Ie = 0; Ie < K.length; ) {
                  for (; K.substring(Ie, Ie + ee.length) !== ee && Ie < K.length; ) {
                    if (K[Ie] === "'")
                      for (Ie++; Ie < K.length && K[Ie] !== "'"; )
                        Ie++;
                    else if (K[Ie] === '"')
                      for (Ie++; Ie < K.length && K[Ie] !== '"'; )
                        Ie++;
                    Ie++;
                  }
                  de.push(K.substring(ve, Ie)), ve = Ie = Ie + ee.length;
                }
                return de;
              }
              var o = _.split(/\r?\n|\r/), w = [], p = !1;
              for (let K = 0; K < o.length; K++) {
                var v = o[K].split("#")[0];
                if (p ? v[0] === ";" && (p = !1) : v[0] === ";" && (p = !0), p || v !== "") {
                  if (!p && (v = v.trim(), v[0] === "_")) {
                    var a = v.split(/\s/)[0].indexOf(".");
                    if (a > -1) {
                      let ee = v.split("");
                      ee[a] = "_", v = ee.join(""), v = v.substring(0, a) + "_" + v.substring(a + 1);
                    }
                  }
                  w.push(v);
                }
              }
              for (var l = 0; l < w.length; ) {
                for (; !w[l].startsWith("data_") || w[l] === "data_global"; )
                  l++;
                l++;
                for (var g = {}; l < w.length && !w[l].startsWith("data_"); )
                  if (w[l][0] === void 0)
                    l++;
                  else if (w[l][0] === "_") {
                    var M = w[l].split(/\s/)[0].toLowerCase(), L = g[M] = g[M] || [], T = w[l].substring(w[l].indexOf(M) + M.length);
                    if (T === "")
                      if (l++, w[l][0] === ";") {
                        var D = w[l].substring(1);
                        for (l++; w[l] !== ";"; )
                          D = D + `
` + w[l], l++;
                        L.push(D);
                      } else
                        L.push(w[l]);
                    else
                      L.push(T.trim());
                    l++;
                  } else if (w[l].substring(0, 5) === "loop_") {
                    l++;
                    for (var I = []; w[l] === "" || w[l][0] === "_"; ) {
                      if (w[l] !== "") {
                        let K = w[l].split(/\s/)[0].toLowerCase(), ee = g[K] = g[K] || [];
                        I.push(ee);
                      }
                      l++;
                    }
                    for (var z = 0; l < w.length && w[l][0] !== "_" && !w[l].startsWith("loop_") && !w[l].startsWith("data_"); ) {
                      let K = s(w[l], " ");
                      for (var P = 0; P < K.length; P++)
                        K[P] !== "" && (I[z].push(K[P]), z = (z + 1) % I.length);
                      l++;
                    }
                  } else
                    l++;
                b.push({ symmetries: [] }), c.push([]);
                var B = g._atom_site_id !== void 0 ? g._atom_site_id.length : g._atom_site_label.length, F;
                if (g._cell_length_a !== void 0) {
                  var N = parseFloat(g._cell_length_a), $ = parseFloat(g._cell_length_b), k = parseFloat(g._cell_length_c), G = parseFloat(g._cell_angle_alpha) || 90, H = parseFloat(g._cell_angle_beta) || 90, U = parseFloat(g._cell_angle_gamma) || 90;
                  F = (0, y.conversionMatrix3)(N, $, k, G, H, U), b[b.length - 1].cryst = {
                    a: N,
                    b: $,
                    c: k,
                    alpha: G,
                    beta: H,
                    gamma: U
                  };
                }
                for (var V = 0; V < B; V++)
                  if (!(g._atom_site_group_pdb !== void 0 && g._atom_site_group_pdb[V] === "TER")) {
                    var Q = {};
                    if (g._atom_site_cartn_x !== void 0)
                      Q.x = parseFloat(g._atom_site_cartn_x[V]), Q.y = parseFloat(g._atom_site_cartn_y[V]), Q.z = parseFloat(g._atom_site_cartn_z[V]);
                    else {
                      var ae = S(F, parseFloat(g._atom_site_fract_x[V]), parseFloat(g._atom_site_fract_y[V]), parseFloat(g._atom_site_fract_z[V]));
                      Q.x = ae.x, Q.y = ae.y, Q.z = ae.z;
                    }
                    Q.chain = g._atom_site_auth_asym_id ? g._atom_site_auth_asym_id[V] : void 0, Q.resi = g._atom_site_auth_seq_id ? parseInt(g._atom_site_auth_seq_id[V]) : void 0, Q.resn = g._atom_site_auth_comp_id ? g._atom_site_auth_comp_id[V].trim() : void 0, Q.atom = g._atom_site_auth_atom_id ? g._atom_site_auth_atom_id[V].replace(/"/gm, "") : void 0, Q.hetflag = !g._atom_site_group_pdb || g._atom_site_group_pdb[V] === "HETA" || g._atom_site_group_pdb[V] === "HETATM";
                    var oe = "X";
                    g._atom_site_type_symbol ? oe = g._atom_site_type_symbol[V].replace(/\(?\+?\d+.*/, "") : g._atom_site_label && (oe = g._atom_site_label[V].split("_")[0].replace(/\(?\d+.*/, "")), Q.elem = oe[0].toUpperCase() + oe.substring(1, 2).toLowerCase(), Q.bonds = [], Q.ss = "c", Q.serial = V, Q.bondOrder = [], Q.properties = {}, c[c.length - 1].push(Q);
                  }
                if (g._pdbx_struct_oper_list_id !== void 0 && !C)
                  for (let K = 0; K < g._pdbx_struct_oper_list_id.length; K++) {
                    var q = parseFloat(g["_pdbx_struct_oper_list_matrix[1][1]"][K]), me = parseFloat(g["_pdbx_struct_oper_list_matrix[1][2]"][K]), ne = parseFloat(g["_pdbx_struct_oper_list_matrix[1][3]"][K]), fe = parseFloat(g["_pdbx_struct_oper_list_vector[1]"][K]), Ce = parseFloat(g["_pdbx_struct_oper_list_matrix[2][1]"][K]), Me = parseFloat(g["_pdbx_struct_oper_list_matrix[2][2]"][K]), Te = parseFloat(g["_pdbx_struct_oper_list_matrix[2][3]"][K]), se = parseFloat(g["_pdbx_struct_oper_list_vector[2]"][K]), pe = parseFloat(g["_pdbx_struct_oper_list_matrix[3][1]"][K]), we = parseFloat(g["_pdbx_struct_oper_list_matrix[3][2]"][K]), ke = parseFloat(g["_pdbx_struct_oper_list_matrix[3][3]"][K]), Ue = parseFloat(g["_pdbx_struct_oper_list_vector[3]"][K]), Ne = new y.Matrix4(q, me, ne, fe, Ce, Me, Te, se, pe, we, ke, Ue);
                    b[b.length - 1].symmetries.push(Ne);
                  }
                var Be = function(K) {
                  var ee = K.match("-");
                  K = K.replace(/[-xyz]/g, "");
                  var de = K.split("/"), ve, Ie;
                  return de[1] === void 0 ? Ie = 1 : Ie = parseInt(de[1]), de[0] === "" ? ve = 1 : ve = parseInt(de[0]), ve / Ie * (ee ? -1 : 1);
                };
                if (g._symmetry_equiv_pos_as_xyz !== void 0 && !C)
                  for (var ue = 0; ue < g._symmetry_equiv_pos_as_xyz.length; ue++) {
                    var ye = g._symmetry_equiv_pos_as_xyz[ue].replace(/["' ]/g, ""), ge = ye.split(",").map(function(ee) {
                      return ee.replace(/-/g, "+-");
                    });
                    let K = new y.Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
                    for (let ee = 0; ee < 3; ee++) {
                      var Se = ge[ee].split("+");
                      for (let de = 0; de < Se.length; de++) {
                        var ze = Se[de];
                        if (ze !== "") {
                          var He = Be(ze);
                          ze.match("x") ? K.elements[ee + 0] = He : ze.match("y") ? K.elements[ee + 4] = He : ze.match("z") ? K.elements[ee + 8] = He : K.elements[ee + 12] = He;
                        }
                      }
                    }
                    var We = F.getMatrix4(), Y = new y.Matrix4().getInverse(We, !0);
                    K = new y.Matrix4().multiplyMatrices(K, Y), K = new y.Matrix4().multiplyMatrices(We, K), b[b.length - 1].symmetries.push(K);
                  }
              }
              for (let K = 0; K < c.length; K++)
                A && (0, n.assignBonds)(c[K]), (0, f.computeSecondaryStructure)(c[K], E.hbondCutoff), (0, u.processSymmetries)(b[K].symmetries, c[K], E, b[K].cryst), E.duplicateAssemblyAtoms && !E.dontConnectDuplicatedAtoms && A && (0, n.assignBonds)(c[K]);
              return c;
            }
          }
        ),
        /***/
        "./src/parsers/CUBE.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/CUBE.ts ***!
            \*****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              CUBE: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), u = t(
              /*! ./utils/anumToSymbol */
              "./src/parsers/utils/anumToSymbol.ts"
            );
            function y(h, _) {
              _ = _ || {};
              var E = [[]], c = h.split(/\r?\n/), C = _.assignBonds === void 0 ? !0 : _.assignBonds;
              if (c.length < 6)
                return E;
              var b = c[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), A = Math.abs(parseFloat(b[0]));
              let S = {};
              var s = S.origin = new n.Vector3(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3]));
              b = c[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), b = c[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var o = b[0] > 0 ? 0.529177 : 1;
              s.multiplyScalar(o);
              var w = Math.abs(b[0]), p = new n.Vector3(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])).multiplyScalar(o);
              b = c[4].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var v = Math.abs(b[0]), a = new n.Vector3(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])).multiplyScalar(o);
              b = c[5].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
              var l = Math.abs(b[0]), g = new n.Vector3(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])).multiplyScalar(o);
              if (S.size = { x: w, y: v, z: l }, S.unit = new n.Vector3(p.x, a.y, g.z), p.y != 0 || p.z != 0 || a.x != 0 || a.z != 0 || g.x != 0 || g.y != 0) {
                S.matrix4 = new n.Matrix4(p.x, a.x, g.x, 0, p.y, a.y, g.y, 0, p.z, a.z, g.z, 0, 0, 0, 0, 1);
                let P = new n.Matrix4().makeTranslation(s.x, s.y, s.z);
                S.matrix4 = S.matrix4.multiplyMatrices(P, S.matrix4), S.matrix = S.matrix4.matrix3FromTopLeft(), S.origin = new n.Vector3(0, 0, 0), S.unit = new n.Vector3(1, 1, 1);
              }
              E.modelData = [{ cryst: S }], c = c.splice(6, A);
              for (var M = E[E.length - 1].length, L = M + c.length, T = M; T < L; ++T) {
                var D = {};
                D.serial = T;
                var I = c[T - M], z = I.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                D.elem = u.anumToSymbol[z[0]], D.x = parseFloat(z[2]) * o, D.y = parseFloat(z[3]) * o, D.z = parseFloat(z[4]) * o, D.hetflag = !0, D.bonds = [], D.bondOrder = [], D.properties = {}, E[E.length - 1].push(D);
              }
              if (C)
                for (let P = 0; P < E.length; P++)
                  (0, f.assignBonds)(E[P]);
              return E;
            }
          }
        ),
        /***/
        "./src/parsers/GRO.ts": (
          /*!****************************!*\
            !*** ./src/parsers/GRO.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              GRO: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), f = t(
              /*! ./utils/atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            );
            function u(y) {
              for (var h = [], _ = y.split(/\r?\n|\r/); _.length > 0 && !(_.length < 3); ) {
                var E = parseInt(_[1]);
                if (isNaN(E) || E <= 0 || _.length < E + 3)
                  break;
                var c = [];
                h.push(c);
                for (var C = 2, b = c.length, A = b + E, S = b; S < A; S++) {
                  var s = _[C++], o = {};
                  o.serial = S, o.atom = s.slice(10, 15).trim(), o.elem = (0, f.atomNameToElem)(o.atom, !0), o.x = 10 * parseFloat(s.slice(20, 28)), o.y = 10 * parseFloat(s.slice(28, 36)), o.z = 10 * parseFloat(s.slice(36, 44)), o.resi = parseInt(s.slice(0, 5)), o.resn = s.slice(5, 10).trim(), o.bonds = [], o.bondOrder = [], o.properties = {}, s.length > 44 && (o.dx = 10 * parseFloat(s.slice(44, 52)), o.dy = 10 * parseFloat(s.slice(52, 60)), o.dz = 10 * parseFloat(s.slice(60, 68))), c[S] = o;
                }
                if (_.length <= C + 3) {
                  var w = _[C++], p = w.trim().split(/\s+/);
                  if (p.length == 3) {
                    for (var v = 0; v < 3; v++)
                      p[v] = parseFloat(p[v]) * 10;
                    h.box = p;
                  }
                }
                _.splice(0, ++C);
              }
              for (let a = 0; a < h.length; a++)
                (0, n.assignPDBBonds)(h[a]);
              return h;
            }
          }
        ),
        /***/
        "./src/parsers/LAMMPSTRJ.ts": (
          /*!**********************************!*\
            !*** ./src/parsers/LAMMPSTRJ.ts ***!
            \**********************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              LAMMPSTRJ: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function f(u, y) {
              for (var h = [], _ = {
                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 = u.split(/\r?\n|\r/), c = 0, C = 0, b = 0; b < E.length - 9; ) {
                for (var A = b; A < E.length; A++)
                  if (E[A].match(/ITEM: NUMBER OF ATOMS/) && (C = parseInt(E[A + 1])), E[A].match(/ITEM: ATOMS/)) {
                    c = A + 1;
                    break;
                  }
                var S = E[c - 1].replace("ITEM: ATOMS ", "").split(" ");
                h.push([]);
                for (let l = c; l < c + C; l++) {
                  for (var s = {}, o = {}, w = E[l].split(" "), p = 0; p < w.length; p++) {
                    var v = _[S[p]];
                    v != null && (v == "serial" ? s[v] = parseInt(w[p]) : v == "x" || v == "y" || v === "z" ? s[v] = parseFloat(w[p]) : v == "charge" || v == "radius" ? o[v] = parseFloat(w[p]) : s[v] = w[p]), s.properties = o, s.bonds = [], s.bondOrder = [];
                  }
                  h[h.length - 1][l - c] = s;
                }
                b = c + C - 1;
              }
              if (y.assignBonds)
                for (var a = 0; a < h.length; a++)
                  (0, n.assignBonds)(h[a]);
              return h;
            }
          }
        ),
        /***/
        "./src/parsers/MMTF.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MMTF.ts ***!
            \*****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MMTFparser: () => (
                /* binding */
                C
              )
              /* harmony export */
            });
            var n = t(
              /*! ../utilities */
              "./src/utilities.ts"
            ), f = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), u = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), y = t(
              /*! ./utils/processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), h = t(
              /*! ./src/vendor/mmtf.js */
              "./src/vendor/mmtf.js"
            ), _ = function(b) {
              return String.fromCharCode.apply(null, b).replace(/\0/g, "");
            }, E = function(b) {
              return b == 0 || b == 2 || b == 4 ? "h" : b == 3 ? "s" : "c";
            };
            let c = /* @__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 C(b, A) {
              var S = !A.keepH, s = A.altLoc ? A.altLoc : "A", o = !!A.noSecondaryStructure, w = !A.noComputeSecondaryStructure, p = !A.doAssembly, v = A.assemblyIndex ? A.assemblyIndex : 0;
              typeof b == "string" ? b = (0, n.base64ToArray)(b) : b = new Uint8Array(b);
              var a = h.decode(b), l = [[]], g = l.modelData = [], M = 0, L = 0, T = 0, D = a.secStructList, I = a.bFactorList, z = a.altLocList, P = a.occupancyList, B = a.bondAtomList, F = a.bondOrderList, N = a.numModels;
              if (N == 0)
                return l;
              A.multimodel || (N = 1);
              var $, k, G, H, U, V, Q = [];
              if (!p && a.bioAssemblyList && a.bioAssemblyList.length > 0) {
                var ae = a.bioAssemblyList[v].transformList;
                for ($ = 0, V = ae.length; $ < V; $++) {
                  var oe = new f.Matrix4(ae[$].matrix);
                  oe.transpose(), Q.push(oe);
                }
              }
              var q = null;
              if (a.unitCell) {
                var me = a.unitCell;
                q = { a: me[0], b: me[1], c: me[2], alpha: me[3], beta: me[4], gamma: me[5] };
              }
              let ne = [];
              a.entityList.forEach((Ee) => {
                Ee.chainIndexList.forEach((X) => {
                  ne[X] = Ee.type == "polymer";
                });
              });
              var fe = 0;
              for (U = 0; U < N; U++) {
                var Ce = a.chainsPerModel[U], Me = l[l.length - 1], Te = [];
                for (g.push({ symmetries: Q, cryst: q }), $ = 0; $ < Ce; ++$) {
                  var se = a.groupsPerChain[M], pe = _(a.chainIdList.subarray(M * 4, M * 4 + 4));
                  a.chainNameList && (pe = _(a.chainNameList.subarray(M * 4, M * 4 + 4)));
                  var we = L, ke = "";
                  for (k = 0; k < se; ++k) {
                    var Ue = a.groupList[a.groupTypeList[L]], Ne = Ue.atomNameList.length, Be = 0, ue = !1, ye = !1;
                    if (D) {
                      Be = D[L];
                      var ge = E(Be);
                      (L == 0 || ge != ke) && (ue = !0), ke = ge;
                      var Se = L + 1;
                      (Se >= D.length || E(D[Se] != ge)) && (ye = !0);
                    }
                    var ze = a.groupIdList[L], He = Ue.groupName;
                    let Ee = Ue.chemCompType;
                    var We = T;
                    let X = c.has(Ee) || !ne[M];
                    for (G = 0; G < Ne; ++G) {
                      var Y = Ue.elementList[G];
                      if (S && Y == "H") {
                        T += 1;
                        continue;
                      }
                      var K = "";
                      I && (K = I[T]);
                      var ee = "";
                      z && z[T] && (ee = String.fromCharCode(z[T]));
                      var de = "";
                      if (P && (de = P[T]), ee != "" && ee != s && s != "*") {
                        T += 1;
                        continue;
                      }
                      var ve = a.atomIdList[T], Ie = Ue.atomNameList[G], Re = 0;
                      Ue.atomChargeList && (Re = Ue.atomChargeList[G]);
                      var Z = a.xCoordList[T], ce = a.yCoordList[T], Ae = a.zCoordList[T];
                      Te[T] = Me.length, Me.push({
                        resn: He,
                        x: Z,
                        y: ce,
                        z: Ae,
                        elem: Y,
                        hetflag: X,
                        chain: pe,
                        resi: ze,
                        icode: ee,
                        rescode: ze + (ee != " " ? "^" + ee : ""),
                        // resi
                        // and
                        // icode
                        serial: ve,
                        altLoc: ee,
                        index: T,
                        atom: Ie,
                        bonds: [],
                        ss: E(Be),
                        ssbegin: ue,
                        ssend: ye,
                        bondOrder: [],
                        properties: { charge: Re, occupancy: de },
                        b: K
                      }), T += 1;
                    }
                    var Fe = Ue.bondAtomList;
                    for (G = 0, H = Ue.bondOrderList.length; G < H; ++G) {
                      var he = We + Fe[G * 2], Oe = We + Fe[G * 2 + 1], j = Ue.bondOrderList[G], $e = Te[he], Ve = Te[Oe], R = Me[$e], be = Me[Ve];
                      R && be && (R.bonds.push(Ve), R.bondOrder.push(j), be.bonds.push($e), be.bondOrder.push(j));
                    }
                    L += 1;
                  }
                  for (L = we, k = 0; k < se; ++k)
                    L += 1;
                  M += 1;
                }
                if (B)
                  for (let Ee = fe, X = B.length; Ee < X; Ee += 2) {
                    let le = B[Ee], Le = B[Ee + 1], Ze = F ? F[Ee / 2] : 1;
                    if (le >= T) {
                      fe = Ee;
                      break;
                    }
                    let Ke = Te[le], je = Te[Le], Je = Me[Ke], Lt = Me[je];
                    Je && Lt && (Je.bonds.push(je), Je.bondOrder.push(Ze), Lt.bonds.push(Ke), Lt.bondOrder.push(Ze));
                  }
                A.multimodel && (A.onemol || l.push([]));
              }
              if (!p)
                for (let Ee = 0; Ee < l.length; Ee++)
                  (0, y.processSymmetries)(g[Ee].symmetries, l[Ee], A, g[Ee].cryst);
              return w && !o && (0, u.computeSecondaryStructure)(l, A.hbondCutoff), l;
            }
          }
        ),
        /***/
        "./src/parsers/MOL2.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/MOL2.ts ***!
            \*****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              MOL2: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            let n = {
              "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 f(u, y) {
              var h = [[]], _ = !1;
              typeof y.keepH < "u" && (_ = !y.keepH);
              var E = u.search(/@<TRIPOS>MOLECULE/), c = u.search(/@<TRIPOS>ATOM/);
              if (E == -1 || c == -1)
                return h;
              for (var C = u.substring(E).split(/\r?\n|\r/); C.length > 0; ) {
                var b = [], A = C[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), S = parseInt(A[0]), s = 0;
                A.length > 1 && (s = parseInt(A[1]));
                var o = 4, w;
                for (w = 3; w < C.length; w++)
                  if (C[w] == "@<TRIPOS>ATOM") {
                    o = w + 1;
                    break;
                  }
                var p = h[h.length - 1].length, v = p + S, a;
                for (w = p; w < v; w++) {
                  a = C[o++], A = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                  var l = {}, g = A[5];
                  if (n[g] !== void 0 ? g = n[g] : (g = g.split(".")[0], g = g[0].toUpperCase() + g.substring(1).toLowerCase()), l.atom = A[1], l.elem = g, !(l.elem == "H" && _)) {
                    var M = h[h.length - 1].length, L = parseInt(A[0]);
                    l.serial = L, l.x = parseFloat(A[2]), l.y = parseFloat(A[3]), l.z = parseFloat(A[4]), l.atom = A[5];
                    var T = parseFloat(A[8]);
                    l.index = M, l.bonds = [], l.bondOrder = [], l.properties = {
                      charge: T,
                      partialCharge: T
                    }, b[L] = M, h[h.length - 1].push(l);
                  }
                }
                for (var D = !1; o < C.length; )
                  if (C[o++] == "@<TRIPOS>BOND") {
                    D = !0;
                    break;
                  }
                if (D && s)
                  for (w = 0; w < s; w++) {
                    a = C[o++], A = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
                    var I = parseInt(A[1]), z = h[h.length - 1][b[I]], P = parseInt(A[2]), B = h[h.length - 1][b[P]], F = parseInt(A[3]);
                    isNaN(F) && (F = 1), z !== void 0 && B !== void 0 && (z.bonds.push(b[P]), z.bondOrder.push(F), B.bonds.push(b[I]), B.bondOrder.push(F));
                  }
                if (y.multimodel) {
                  y.onemol || h.push([]), C.splice(0, o), u = C.join(`
`);
                  continue;
                } else
                  break;
              }
              return h;
            }
          }
        ),
        /***/
        "./src/parsers/PDB.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PDB.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PDB: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/getSinglePDB */
              "./src/parsers/utils/getSinglePDB.ts"
            );
            function f(u, y) {
              y = y || {};
              var h = [], _ = {};
              h.modelData = [];
              for (var E = u.split(/\r?\n|\r/); E.length > 0; ) {
                var c = (0, n.getSinglePDB)(E, y, _), C = c[0], b = c[1];
                if (E = c[2], C.length != 0) {
                  if (y.multimodel && y.onemol && h.length > 0)
                    for (var A = h[0].length, S = 0; S < C.length; S++) {
                      var s = C[S];
                      s.index = S;
                      for (var o = 0; o < s.bonds.length; o++)
                        s.bonds[o] += A;
                      h[0].push(s);
                    }
                  else
                    h.modelData.push(b), h.push(C);
                  if (!y.multimodel)
                    break;
                }
              }
              return h;
            }
          }
        ),
        /***/
        "./src/parsers/PQR.ts": (
          /*!****************************!*\
            !*** ./src/parsers/PQR.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PQR: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ./utils/assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), f = t(
              /*! ./utils/computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            );
            function u(y, h) {
              var _ = [[]], E = !h.noSecondaryStructure;
              _.modelData = [{ symmetries: [] }];
              var c = [], C = y.split(/\r?\n|\r/), b;
              for (let D = 0; D < C.length; D++) {
                b = C[D].replace(/^\s*/, "");
                var A = b.substring(0, 6);
                if (A.indexOf("END") == 0)
                  if (h.multimodel) {
                    h.onemol || _.push([]);
                    continue;
                  } else
                    break;
                else if (A == "ATOM  " || A == "HETATM") {
                  var S;
                  let I = parseInt(b.substring(6, 11)), z = b.substring(12, 16).replace(/ /g, ""), P = b.substring(17, 20).trim(), B = b.substring(21, 22), F = parseInt(b.substring(22, 26));
                  var s = b.substring(30).trim().split(/\s+/), o = parseFloat(s[0]), w = parseFloat(s[1]), p = parseFloat(s[2]), v = parseFloat(s[3]), a = parseFloat(s[4]), l = z[0];
                  z.length > 1 && z[1].toUpperCase() != z[1] && (l = z.substring(0, 2)), b[0] == "H" ? S = !0 : S = !1, c[I] = _[_.length - 1].length, _[_.length - 1].push({
                    resn: P,
                    x: o,
                    y: w,
                    z: p,
                    elem: l,
                    hetflag: S,
                    chain: B,
                    resi: F,
                    serial: I,
                    atom: z,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {
                      charge: v,
                      partialCharge: v,
                      radius: a
                    },
                    pdbline: b
                  });
                } else if (A == "CONECT") {
                  var g = parseInt(b.substring(6, 11)), M = _[_.length - 1][c[g]];
                  for (let I = 0; I < 4; I++) {
                    var L = parseInt(b.substring([11, 16, 21, 26][I], [11, 16, 21, 26][I] + 5)), T = _[_.length - 1][c[L]];
                    M !== void 0 && T !== void 0 && (M.bonds.push(c[L]), M.bondOrder.push(1));
                  }
                }
              }
              for (let D = 0; D < _.length; D++)
                (0, n.assignPDBBonds)(_[D]), E && (0, f.computeSecondaryStructure)(_[D], h.hbondCutoff);
              return _;
            }
          }
        ),
        /***/
        "./src/parsers/PRMTOP.ts": (
          /*!*******************************!*\
            !*** ./src/parsers/PRMTOP.ts ***!
            \*******************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              PRMTOP: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f) {
              var u = [], y, h = 0, _ = f.split(/\r?\n|\r/);
              if (_.length > 0 && _[0].includes("VERSION")) {
                var E = _.filter(function(o) {
                  return o.includes("POINTERS") || o.includes("ATOM_NAME") || o.includes("CHARGE") || o.includes("RADII") || o.includes("BONDS_INC_HYDROGEN") || o.includes("BONDS_WITHOUT_HYDROGEN");
                }), c = S("POINTERS");
                if (c == -1)
                  return [];
                var C = s(c), b = parseInt(_[c + 1].slice(0, C[1]));
                if (isNaN(b) || b <= 0)
                  return [];
                if (c = S("ATOM_NAME"), c == -1)
                  return [];
                C = s(c);
                var A = C[0];
                for (let o = 0; o < b / C[0]; o++) {
                  o == parseInt(b / C[0]) && (A = b % C[0]);
                  for (let w = 0; w < A; w++) {
                    let p = {}, v = { charge: "", radii: "" };
                    p.serial = h, p.x = 0, p.y = 0, p.z = 0, p.atom = _[c + 1].slice(C[1] * w, C[1] * (w + 1)), p.elem = _[c + 1].slice(C[1] * w, C[1] * w + 1), p.properties = v, p.bonds = [], p.bondOrder = [], u.push(p), h++;
                  }
                  c++;
                }
                if (c = S("CHARGE"), c != -1) {
                  C = s(c), h = 0, A = C[0];
                  for (let o = 0; o < b / C[0]; o++) {
                    o == parseInt(b / C[0]) && (A = b % C[0]);
                    for (let w = 0; w < A; w++)
                      u[h].properties.charge = parseFloat(_[c + 1].slice(C[1] * w, C[1] * (w + 1))), h++;
                    c++;
                  }
                }
                if (c = S("RADII"), c != -1) {
                  C = s(c), h = 0, A = C[0];
                  for (let o = 0; o < b / C[0]; o++) {
                    o == parseInt(b / C[0]) && (A = b % C[0]);
                    for (let w = 0; w < A; w++)
                      u[h].properties.radii = parseFloat(_[c + 1].slice(C[1] * w, C[1] * (w + 1))), h++;
                    c++;
                  }
                }
                if (c = S("BONDS_WITHOUT_HYDROGEN"), c != -1)
                  for (C = s(c), h = 0, A = C[0], c = c + 1; !_[c].match(/^%FLAG/); ) {
                    _[c + 1].match(/^%FLAG/) && (A = b % C[0]);
                    for (let o = 0; o < A; o++)
                      h % 3 == 0 ? y = parseInt(_[c].slice(C[1] * o, C[1] * (o + 1)) / 3) : h % 3 == 1 && u[y].bonds.push(parseInt(_[c].slice(C[1] * o, C[1] * (o + 1)) / 3)), h++;
                    c++;
                  }
                if (c = S("BONDS_INC_HYDROGEN"), c != -1)
                  for (C = s(c), h = 0, A = C[0], c = c + 1; !_[c].match(/^%FLAG/); ) {
                    _[c + 1].match(/^%FLAG/) && (A = b % C[0]);
                    for (let o = 0; o < A; o++)
                      h % 3 == 0 ? y = parseInt(_[c].slice(C[1] * o, C[1] * (o + 1)) / 3) : h % 3 == 1 && u[y].bonds.push(parseInt(_[c].slice(C[1] * o, C[1] * (o + 1)) / 3)), h++;
                    c++;
                  }
              } else
                return [];
              function S(o) {
                var w = _.indexOf(E.filter(function(p) {
                  return p.includes(o);
                })[0]);
                if (Number.isInteger(w) && w > 0) {
                  for (; !_[w].includes("FORMAT"); )
                    w++;
                  return w;
                } else
                  return -1;
              }
              function s(o) {
                var w = _[o].match(/\((\d*)\S*/), p = _[o].match(/[a-zA-Z](\d*)\)\s*/);
                return p == null && (p = _[o].match(/[a-zA-Z](\d*)\.\d*\)\s*/)), [w[1], p[1]];
              }
              return [u];
            }
          }
        ),
        /***/
        "./src/parsers/SDF.ts": (
          /*!****************************!*\
            !*** ./src/parsers/SDF.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              SDF: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = function(y, h) {
              var _ = [[]], E = !1;
              for (typeof h.keepH < "u" && (E = !h.keepH); y.length > 0 && !(y.length < 4); ) {
                var c = parseInt(y[3].substring(0, 3));
                if (isNaN(c) || c <= 0)
                  break;
                var C = parseInt(y[3].substring(3, 6)), b = 4;
                if (y.length < 4 + c + C)
                  break;
                var A = [], S = _[_.length - 1].length, s = S + c, o, w;
                for (o = S; o < s; o++, b++) {
                  w = y[b];
                  var p = {}, v = w.substring(31, 34).replace(/ /g, "");
                  p.atom = p.elem = v[0].toUpperCase() + v.substring(1).toLowerCase(), (p.elem !== "H" || !E) && (p.serial = o, A[o] = _[_.length - 1].length, p.x = parseFloat(w.substring(0, 10)), p.y = parseFloat(w.substring(10, 20)), p.z = parseFloat(w.substring(20, 30)), p.hetflag = !0, p.bonds = [], p.bondOrder = [], p.properties = {}, p.index = _[_.length - 1].length, _[_.length - 1].push(p));
                }
                for (o = 0; o < C; o++, b++) {
                  w = y[b];
                  var a = A[parseInt(w.substring(0, 3)) - 1 + S], l = A[parseInt(w.substring(3, 6)) - 1 + S], g = parseFloat(w.substring(6));
                  typeof a < "u" && typeof l < "u" && (_[_.length - 1][a].bonds.push(l), _[_.length - 1][a].bondOrder.push(g), _[_.length - 1][l].bonds.push(a), _[_.length - 1][l].bondOrder.push(g));
                }
                if (h.multimodel) {
                  for (h.onemol || _.push([]); y[b] !== "$$$$" && b < y.length; )
                    b++;
                  y.splice(0, ++b);
                } else
                  break;
              }
              return _;
            }, f = function(y, h) {
              var _ = [[]], E = !1;
              for (typeof h.keepH < "u" && (E = !h.keepH); y.length > 0 && !(y.length < 8 || !y[4].startsWith("M  V30 BEGIN CTAB") || !y[5].startsWith("M  V30 COUNTS") || y[5].length < 14); ) {
                var c = y[5].substring(13).match(/\S+/g);
                if (c.length < 2)
                  break;
                var C = parseInt(c[0]);
                if (isNaN(C) || C <= 0)
                  break;
                var b = parseInt(c[1]), A = 7;
                if (y.length < 8 + C + b)
                  break;
                var S = [], s = _[_.length - 1].length, o = s + C, w, p;
                for (w = s; w < o; w++, A++) {
                  p = y[A];
                  var v = p.substring(6).match(/\S+/g);
                  if (v.length > 4) {
                    var a = {}, l = v[1].replace(/ /g, "");
                    a.atom = a.elem = l[0].toUpperCase() + l.substring(1).toLowerCase(), (a.elem !== "H" || !E) && (a.serial = w, S[w] = _[_.length - 1].length, a.x = parseFloat(v[2]), a.y = parseFloat(v[3]), a.z = parseFloat(v[4]), a.hetflag = !0, a.bonds = [], a.bondOrder = [], a.properties = {}, a.index = _[_.length - 1].length, _[_.length - 1].push(a));
                  }
                }
                if (y[A] === "M  V30 END ATOM")
                  A++;
                else
                  break;
                if (b !== 0 && y[A] === "M  V30 BEGIN BOND")
                  A++;
                else
                  break;
                for (w = 0; w < b; w++, A++) {
                  p = y[A];
                  var g = p.substring(6).match(/\S+/g);
                  if (g.length > 3) {
                    var M = S[parseInt(g[2]) - 1 + s], L = S[parseInt(g[3]) - 1 + s], T = parseFloat(g[1]);
                    typeof M < "u" && typeof L < "u" && (_[_.length - 1][M].bonds.push(L), _[_.length - 1][M].bondOrder.push(T), _[_.length - 1][L].bonds.push(M), _[_.length - 1][L].bondOrder.push(T));
                  }
                }
                if (h.multimodel) {
                  for (h.onemol || _.push([]); y[A] !== "$$$$" && A < y.length; )
                    A++;
                  y.splice(0, ++A);
                } else
                  break;
              }
              return _;
            };
            function u(y, h) {
              var _ = "V2000", E = y.split(/\r?\n|\r/);
              return E.length > 3 && E[3].length > 38 && (_ = E[3].substring(34, 39)), _ === "V2000" ? n(E, h) : _ === "V3000" ? f(E, h) : [[""]];
            }
          }
        ),
        /***/
        "./src/parsers/VASP.ts": (
          /*!*****************************!*\
            !*** ./src/parsers/VASP.ts ***!
            \*****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              VASP: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            );
            function f(u) {
              var y = [[]], h = {}, _ = u.replace(/^\s+/, "").split(/\r?\n/);
              if (_.length < 3)
                return y;
              if (_[1].match(/\d+/))
                h.length = parseFloat(_[1]);
              else
                return console.log("Warning: second line of the vasp structure file must be a number"), y;
              if (h.length < 0)
                return console.log("Warning: Vasp implementation for negative lattice lengths is not yet available"), y;
              h.xVec = new Float32Array(_[2].replace(/^\s+/, "").split(/\s+/)), h.yVec = new Float32Array(_[3].replace(/^\s+/, "").split(/\s+/)), h.zVec = new Float32Array(_[4].replace(/^\s+/, "").split(/\s+/));
              var E = new n.Matrix3(h.xVec[0], h.xVec[1], h.xVec[2], h.yVec[0], h.yVec[1], h.yVec[2], h.zVec[0], h.zVec[1], h.zVec[2]);
              E.multiplyScalar(h.length), y.modelData = [{ symmetries: [], cryst: { matrix: E } }];
              var c = _[5].replace(/\s+/, "").replace(/\s+$/, "").split(/\s+/), C = new Int16Array(_[6].replace(/^\s+/, "").split(/\s+/)), b = _[7].replace(/\s+/, "");
              if (b.match(/C/))
                b = "cartesian";
              else if (b.match(/D/))
                b = "direct";
              else
                return console.log("Warning: Unknown vasp mode in POSCAR file: mode must be either C(artesian) or D(irect)"), y;
              if (c.length != C.length)
                return console.log("Warning: declaration of atomary species wrong:"), console.log(c), console.log(C), y;
              _.splice(0, 8);
              for (var A = 0, S = 0, s = c.length; S < s; S++) {
                for (var o = c[S], w = 0, p = C[S]; w < p; w++) {
                  var v = new Float32Array(_[A + w].replace(/^\s+/, "").split(/\s+/)), a = {};
                  a.elem = o, b == "cartesian" ? (a.x = h.length * v[0], a.y = h.length * v[1], a.z = h.length * v[2]) : (a.x = h.length * (v[0] * h.xVec[0] + v[1] * h.yVec[0] + v[2] * h.zVec[0]), a.y = h.length * (v[0] * h.xVec[1] + v[1] * h.yVec[1] + v[2] * h.zVec[1]), a.z = h.length * (v[0] * h.xVec[2] + v[1] * h.yVec[2] + v[2] * h.zVec[2])), a.bonds = [], y[0].push(a);
                }
                A += C[S];
              }
              return y;
            }
          }
        ),
        /***/
        "./src/parsers/XYZ.ts": (
          /*!****************************!*\
            !*** ./src/parsers/XYZ.ts ***!
            \****************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              XYZ: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            var n = t(
              /*! ../WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./utils/assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            );
            function u(y, h) {
              h = h || {};
              for (var _ = [[]], E = h.assignBonds === void 0 ? !0 : h.assignBonds, c = y.split(/\r?\n|\r/); c.length > 0 && !(c.length < 3); ) {
                var C = parseInt(c[0]);
                if (isNaN(C) || C <= 0 || c.length < C + 2)
                  break;
                var b = /Lattice\s*=\s*["\{\}]([^"\{\}]+)["\{\}]\s*/gi, A = b.exec(c[1]);
                if (A != null && A.length > 1) {
                  var S = new Float32Array(A[1].split(/\s+/)), s = new n.Matrix3(S[0], S[3], S[6], S[1], S[4], S[7], S[2], S[5], S[8]);
                  _.modelData = [{ cryst: { matrix: s } }];
                }
                for (var o = 2, w = _[_.length - 1].length, p = w + C, v = w; v < p; v++) {
                  var a = c[o++], l = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), g = {};
                  g.serial = v;
                  var M = l[0];
                  g.atom = g.elem = M[0].toUpperCase() + M.substring(1, 2).toLowerCase(), g.x = parseFloat(l[1]), g.y = parseFloat(l[2]), g.z = parseFloat(l[3]), g.hetflag = !0, g.bonds = [], g.bondOrder = [], g.properties = {}, _[_.length - 1][v] = g, l.length >= 7 && (g.dx = parseFloat(l[4]), g.dy = parseFloat(l[5]), g.dz = parseFloat(l[6]));
                }
                if (h.multimodel)
                  _.push([]), c.splice(0, o);
                else
                  break;
              }
              if (E)
                for (let T = 0; T < _.length; T++)
                  (0, f.assignBonds)(_[T]);
              if (h.onemol) {
                var L = _;
                _ = [], _.push(L[0]);
                for (let T = 1; T < L.length; T++) {
                  let D = _[0].length;
                  for (let I = 0; I < L[T].length; I++) {
                    let z = L[T][I];
                    for (let P = 0; P < z.bonds.length; P++)
                      z.bonds[P] = z.bonds[P] + D;
                    z.index = _[0].length, z.serial = _[0].length, _[0].push(z);
                  }
                }
              }
              return _;
            }
          }
        ),
        /***/
        "./src/parsers/index.ts": (
          /*!******************************!*\
            !*** ./src/parsers/index.ts ***!
            \******************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Parsers: () => (
                /* binding */
                w
              ),
              /* harmony export */
              bondLength: () => (
                /* reexport safe */
                o.bondLength
              ),
              /* harmony export */
              setBondLength: () => (
                /* reexport safe */
                o.setBondLength
              )
              /* harmony export */
            });
            var n = t(
              /*! ./VASP */
              "./src/parsers/VASP.ts"
            ), f = t(
              /*! ./CUBE */
              "./src/parsers/CUBE.ts"
            ), u = t(
              /*! ./XYZ */
              "./src/parsers/XYZ.ts"
            ), y = t(
              /*! ./SDF */
              "./src/parsers/SDF.ts"
            ), h = t(
              /*! ./CDJSON */
              "./src/parsers/CDJSON.ts"
            ), _ = t(
              /*! ./CIF */
              "./src/parsers/CIF.ts"
            ), E = t(
              /*! ./MOL2 */
              "./src/parsers/MOL2.ts"
            ), c = t(
              /*! ./PDB */
              "./src/parsers/PDB.ts"
            ), C = t(
              /*! ./PQR */
              "./src/parsers/PQR.ts"
            ), b = t(
              /*! ./MMTF */
              "./src/parsers/MMTF.ts"
            ), A = t(
              /*! ./PRMTOP */
              "./src/parsers/PRMTOP.ts"
            ), S = t(
              /*! ./GRO */
              "./src/parsers/GRO.ts"
            ), s = t(
              /*! ./LAMMPSTRJ */
              "./src/parsers/LAMMPSTRJ.ts"
            ), o = t(
              /*! ./utils/bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            const w = {
              vasp: n.VASP,
              VASP: n.VASP,
              cube: f.CUBE,
              CUBE: f.CUBE,
              xyz: u.XYZ,
              XYZ: u.XYZ,
              sdf: y.SDF,
              SDF: y.SDF,
              json: h.CDJSON,
              cdjson: h.CDJSON,
              CDJSON: h.CDJSON,
              mcif: _.CIF,
              cif: _.CIF,
              CIF: _.CIF,
              mol2: E.MOL2,
              MOL2: E.MOL2,
              pdb: c.PDB,
              PDB: c.PDB,
              pdbqt: c.PDB,
              PDBQT: c.PDB,
              pqr: C.PQR,
              PQR: C.PQR,
              mmtf: b.MMTFparser,
              MMTF: b.MMTFparser,
              prmtop: A.PRMTOP,
              PRMTOP: A.PRMTOP,
              gro: S.GRO,
              GRO: S.GRO,
              lammpstrj: s.LAMMPSTRJ,
              LAMMPSTRJ: s.LAMMPSTRJ
            };
          }
        ),
        /***/
        "./src/parsers/utils/anumToSymbol.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/anumToSymbol.ts ***!
            \*******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              anumToSymbol: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = {
              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 ***!
            \*******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              areConnected: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            function f(u, y) {
              var h = (0, n.bondLength)(u.elem) + (0, n.bondLength)(y.elem);
              h += 0.25, h *= h;
              var _ = u.x - y.x;
              if (_ *= _, _ > h)
                return !1;
              var E = u.y - y.y;
              if (E *= E, E > h)
                return !1;
              var c = u.z - y.z;
              if (c *= c, c > h)
                return !1;
              var C = _ + E + c;
              return isNaN(C) || C < 0.5 || C > h ? !1 : !(u.altLoc != y.altLoc && u.altLoc != " " && y.altLoc != " ");
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBackboneHBonds.ts": (
          /*!***************************************************!*\
            !*** ./src/parsers/utils/assignBackboneHBonds.ts ***!
            \***************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignBackboneHBonds: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f, u) {
              let y = u || 3.2, h = y * y, _ = [];
              for (let o = 0, w = f.length; o < w; o++) {
                f[o].index = o;
                var E = f[o];
                !E.hetflag && (E.atom === "N" || E.atom === "O") && (_.push(E), E.hbondOther = null, E.hbondDistanceSq = Number.POSITIVE_INFINITY);
              }
              _.sort(function(o, w) {
                return o.z - w.z;
              });
              for (let o = 0, w = _.length; o < w; o++) {
                var c = _[o];
                for (let p = o + 1; p < w; p++) {
                  var C = _[p], b = C.z - c.z;
                  if (b > y)
                    break;
                  if (C.atom != c.atom) {
                    var A = Math.abs(C.y - c.y);
                    if (!(A > y)) {
                      var S = Math.abs(C.x - c.x);
                      if (!(S > y)) {
                        var s = S * S + A * A + b * b;
                        s > h || C.chain == c.chain && Math.abs(C.resi - c.resi) < 4 || (s < c.hbondDistanceSq && (c.hbondOther = C, c.hbondDistanceSq = s), s < C.hbondDistanceSq && (C.hbondOther = c, C.hbondDistanceSq = s));
                      }
                    }
                  }
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignBonds.ts": (
          /*!******************************************!*\
            !*** ./src/parsers/utils/assignBonds.ts ***!
            \******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignBonds: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            );
            function f(u) {
              for (var y = 0, h = u.length; y < h; y++)
                u[y].index || (u[y].index = y);
              for (var _ = {}, E = 4.95, c = 0; c < u.length; c++) {
                var C = u[c], b = Math.floor(C.x / E), A = Math.floor(C.y / E), S = Math.floor(C.z / E);
                _[b] || (_[b] = {}), _[b][A] || (_[b][A] = {}), _[b][A][S] || (_[b][A][S] = []), _[b][A][S].push(C);
              }
              var s = function(w, p) {
                for (var v = 0; v < w.length; v++)
                  for (var a = w[v], l = 0; l < p.length; l++) {
                    var g = p[l];
                    if ((0, n.areConnected)(a, g)) {
                      var M = a.bonds.indexOf(g.index), L = g.bonds.indexOf(a.index);
                      M == -1 && L == -1 ? (a.bonds.push(g.index), a.bondOrder.push(1), g.bonds.push(a.index), g.bondOrder.push(1)) : M == -1 ? (a.bonds.push(g.index), a.bondOrder.push(g.bondOrder[L])) : L == -1 && (g.bonds.push(a.index), g.bondOrder.push(a.bondOrder[M]));
                    }
                  }
              }, o = [
                { 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 }
              ];
              for (let w in _) {
                let p = parseInt(w);
                for (let v in _[p]) {
                  let a = parseInt(v);
                  for (let l in _[p][a]) {
                    let g = parseInt(l), M = _[p][a][g];
                    for (let L = 0; L < M.length; L++) {
                      let T = M[L];
                      for (let D = L + 1; D < M.length; D++) {
                        let I = M[D];
                        (0, n.areConnected)(T, I) && T.bonds.indexOf(I.index) == -1 && (T.bonds.push(I.index), T.bondOrder.push(1), I.bonds.push(T.index), I.bondOrder.push(1));
                      }
                    }
                    for (let L = 0; L < o.length; L++) {
                      let T = o[L];
                      if (!_[p + T.x] || !_[p + T.x][a + T.y] || !_[p + T.x][a + T.y][g + T.z])
                        continue;
                      let D = _[p + T.x][a + T.y][g + T.z];
                      s(M, D);
                    }
                  }
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/assignPDBBonds.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/assignPDBBonds.ts ***!
            \*********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              assignPDBBonds: () => (
                /* binding */
                y
              )
              /* harmony export */
            });
            var n = t(
              /*! ./areConnected */
              "./src/parsers/utils/areConnected.ts"
            ), f = t(
              /*! ./assignBonds */
              "./src/parsers/utils/assignBonds.ts"
            ), u = t(
              /*! ./standardResidues */
              "./src/parsers/utils/standardResidues.ts"
            );
            function y(h) {
              var _ = [], E = [], c, C;
              for (c = 0, C = h.length; c < C; c++) {
                var b = h[c];
                b.index = c, b.hetflag || !u.standardResidues.has(b.resn) ? E.push(b) : _.push(b);
              }
              (0, f.assignBonds)(E), _.sort(function(v, a) {
                return v.chain != a.chain ? v.chain < a.chain ? -1 : 1 : v.resi - a.resi;
              });
              var A = -1, S = -1, s;
              for (c = 0, C = _.length; c < C; c++) {
                var o = _[c];
                o.resi !== A && (A = o.resi, s || S++, s = !1), o.reschain = S;
                for (var w = c + 1; w < _.length; w++) {
                  var p = _[w];
                  if (p.chain != o.chain || p.resi - o.resi > 1)
                    break;
                  (0, n.areConnected)(o, p) && (o.bonds.indexOf(p.index) === -1 && (o.bonds.push(p.index), o.bondOrder.push(1), p.bonds.push(o.index), p.bondOrder.push(1)), o.resi !== p.resi && (s = !0));
                }
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/atomNameToElem.ts": (
          /*!*********************************************!*\
            !*** ./src/parsers/utils/atomNameToElem.ts ***!
            \*********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              atomNameToElem: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            );
            function f(u, y) {
              var h = u.replace(/ /g, "");
              return h.length > 0 && h[0] == "H" && h != "Hg" && h != "He" && h != "Hf" && h != "Hs" && h != "Ho" && (h = "H"), h.length > 1 && (h = h[0].toUpperCase() + h.substring(1).toLowerCase(), typeof n.bondTable[h] > "u" ? h = h[0] : y && (h == "Ca" || h == "Cd") && (h = "C")), h;
            }
          }
        ),
        /***/
        "./src/parsers/utils/bondLength.ts": (
          /*!*****************************************!*\
            !*** ./src/parsers/utils/bondLength.ts ***!
            \*****************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              bondLength: () => (
                /* binding */
                f
              ),
              /* harmony export */
              bondTable: () => (
                /* binding */
                n
              ),
              /* harmony export */
              setBondLength: () => (
                /* binding */
                u
              )
              /* harmony export */
            });
            let n = {
              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 f(y) {
              return n[y] || 1.6;
            }
            function u(y, h) {
              h < 0 && (h = 0), n[y] = h;
            }
          }
        ),
        /***/
        "./src/parsers/utils/computeSecondaryStructure.ts": (
          /*!********************************************************!*\
            !*** ./src/parsers/utils/computeSecondaryStructure.ts ***!
            \********************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              computeSecondaryStructure: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ./assignBackboneHBonds */
              "./src/parsers/utils/assignBackboneHBonds.ts"
            );
            function f(u, y) {
              (0, n.assignBackboneHBonds)(u, y);
              var h = {}, _, E, c, C, b, A;
              for (_ = 0, E = u.length; _ < E; _++)
                if (b = u[_], typeof h[b.chain] > "u" && (h[b.chain] = []), isFinite(b.hbondDistanceSq)) {
                  var S = b.hbondOther;
                  typeof h[S.chain] > "u" && (h[S.chain] = []), Math.abs(S.resi - b.resi) === 4 && (h[b.chain][b.resi] = "h");
                }
              for (c in h)
                for (C = 1; C < h[c].length - 1; C++) {
                  var s = h[c][C - 1], o = h[c][C + 1];
                  A = h[c][C], s == "h" && s == o && A != s && (h[c][C] = s);
                }
              for (_ = 0, E = u.length; _ < E; _++)
                b = u[_], isFinite(b.hbondDistanceSq) && h[b.chain][b.resi] != "h" && b.ss != "h" && (h[b.chain][b.resi] = "maybesheet");
              for (let w = 0, p = u.length; w < p; w++)
                if (b = u[w], isFinite(b.hbondDistanceSq) && h[b.chain][b.resi] == "maybesheet") {
                  let v = b.hbondOther, a = h[v.chain][v.resi];
                  (a == "maybesheet" || a == "s") && (h[b.chain][b.resi] = "s", h[v.chain][v.resi] = "s");
                }
              for (let w in h) {
                for (let p = 1; p < h[w].length - 1; p++) {
                  let v = h[w][p - 1], a = h[w][p + 1];
                  A = h[w][p], v == "s" && v == a && A != v && (h[w][p] = v);
                }
                for (let p = 0; p < h[w].length; p++) {
                  let v = h[w][p];
                  (v == "h" || v == "s") && h[w][p - 1] != v && h[w][p + 1] != v && delete h[w][p];
                }
              }
              for (_ = 0, E = u.length; _ < E; _++)
                b = u[_], A = h[b.chain][b.resi], delete b.hbondOther, delete b.hbondDistanceSq, !(typeof A > "u" || A == "maybesheet") && (b.ss = A, h[b.chain][b.resi - 1] != A && (b.ssbegin = !0), h[b.chain][b.resi + 1] != A && (b.ssend = !0));
            }
          }
        ),
        /***/
        "./src/parsers/utils/getSinglePDB.ts": (
          /*!*******************************************!*\
            !*** ./src/parsers/utils/getSinglePDB.ts ***!
            \*******************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              getSinglePDB: () => (
                /* binding */
                C
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            ), f = t(
              /*! ./atomNameToElem */
              "./src/parsers/utils/atomNameToElem.ts"
            ), u = t(
              /*! ./bondLength */
              "./src/parsers/utils/bondLength.ts"
            ), y = t(
              /*! ./computeSecondaryStructure */
              "./src/parsers/utils/computeSecondaryStructure.ts"
            ), h = t(
              /*! ./isEmpty */
              "./src/parsers/utils/isEmpty.ts"
            ), _ = t(
              /*! ./processSymmetries */
              "./src/parsers/utils/processSymmetries.ts"
            ), E = t(
              /*! ./assignPDBBonds */
              "./src/parsers/utils/assignPDBBonds.ts"
            ), c = t(
              /*! ./validateBonds */
              "./src/parsers/utils/validateBonds.ts"
            );
            function C(b, A, S) {
              var s = [], o = A.assignBonds === void 0 ? !0 : A.assignBonds, w = !A.keepH, p = !!A.noSecondaryStructure, v = !A.noComputeSecondaryStructure, a = !A.doAssembly, l = A.altLoc ? A.altLoc : "A", g = { symmetries: [] }, M, L = [], T = [], D, I = {};
              for (let He = 0; He < b.length; He++) {
                D = b[He].replace(/^\s*/, "");
                var z = D.substring(0, 6), P, B, F;
                if (z.indexOf("END") == 0) {
                  if (L = b.slice(He + 1), z == "END")
                    for (var N in S)
                      S.hasOwnProperty(N) && delete S[N];
                  break;
                } else if (z == "ATOM  " || z == "HETATM") {
                  var $, k, G, H, U, V, Q, ae, oe, q, me, ne;
                  if (me = D.substring(16, 17), me != " " && me != l && l != "*" || (q = parseInt(D.substring(6, 11)), M = D.substring(12, 16).replace(/ /g, ""), $ = D.substring(17, 20).replace(/ /g, ""), k = D.substring(21, 22), G = parseInt(D.substring(22, 26)), H = D.substring(26, 27), U = parseFloat(D.substring(30, 38)), V = parseFloat(D.substring(38, 46)), Q = parseFloat(D.substring(46, 54)), ne = parseFloat(D.substring(60, 68)), oe = D.substring(76, 78).replace(/ /g, ""), oe === "" || typeof u.bondTable[oe] > "u" ? oe = (0, f.atomNameToElem)(D.substring(12, 14), D[0] == "A") : oe = oe[0].toUpperCase() + oe.substring(1).toLowerCase(), oe == "H" && w))
                    continue;
                  z[0] == "H" ? ae = !0 : ae = !1, T[q] = s.length, s.push({
                    resn: $,
                    x: U,
                    y: V,
                    z: Q,
                    elem: oe,
                    hetflag: ae,
                    altLoc: me,
                    chain: k,
                    resi: G,
                    icode: H,
                    rescode: G + (H != " " ? "^" + H : ""),
                    // resi
                    // and
                    // icode
                    serial: q,
                    atom: M,
                    bonds: [],
                    ss: "c",
                    bondOrder: [],
                    properties: {},
                    b: ne,
                    pdbline: D
                  });
                } else if (z == "SHEET ") {
                  P = D.substring(21, 22), B = parseInt(D.substring(22, 26)), F = parseInt(D.substring(33, 37)), P in S || (S[P] = {}), S[P][B] = "s1";
                  for (var fe = B + 1; fe < F; fe++)
                    S[P][fe] = "s";
                  S[P][F] = "s2";
                } else if (z == "CONECT") {
                  var Ce = parseInt(D.substring(6, 11)), Me = T[Ce], Te = s[Me], se = [11, 16, 21, 26];
                  for (let We = 0; We < 4; We++) {
                    var pe = parseInt(D.substring(se[We], se[We] + 5)), we = T[pe];
                    let Y = Me + ":" + we;
                    var ke = s[we];
                    if (Te !== void 0 && ke !== void 0)
                      if (!I[Y])
                        I[Y] = 1, (Te.bonds.length == 0 || Te.bonds[Te.bonds.length - 1] != we) && (Te.bonds.push(we), Te.bondOrder.push(1));
                      else {
                        I[Y] += 1;
                        for (let K = 0; K < Te.bonds.length; K++)
                          if (Te.bonds[K] == we) {
                            var Ue = I[Y];
                            Ue >= 4 ? Te.bondOrder[K] = 1 : Te.bondOrder[K] = Ue;
                          }
                      }
                  }
                } else if (z == "HELIX ") {
                  P = D.substring(19, 20), B = parseInt(D.substring(21, 25)), F = parseInt(D.substring(33, 37)), P in S || (S[P] = {}), S[P][B] = "h1";
                  for (let We = B + 1; We < F; We++)
                    S[P][We] = "h";
                  S[P][F] = "h2";
                } else if (!a && z == "REMARK" && D.substring(13, 18) == "BIOMT") {
                  var Ne, Be = new n.Matrix4();
                  for (Ne = 1; Ne <= 3; Ne++)
                    if (D = b[He].replace(/^\s*/, ""), parseInt(D.substring(18, 19)) == Ne)
                      Be.elements[Ne - 1] = parseFloat(D.substring(23, 33)), Be.elements[Ne - 1 + 4] = parseFloat(D.substring(33, 43)), Be.elements[Ne - 1 + 8] = parseFloat(D.substring(43, 53)), Be.elements[Ne - 1 + 12] = parseFloat(D.substring(53)), He++;
                    else
                      for (; D.substring(13, 18) == "BIOMT"; )
                        He++, D = b[He].replace(/^\s*/, "");
                  Be.elements[3] = 0, Be.elements[7] = 0, Be.elements[11] = 0, Be.elements[15] = 1, g.symmetries.push(Be), He--;
                } else if (z == "CRYST1") {
                  let We, Y, K, ee, de, ve;
                  We = parseFloat(D.substring(7, 15)), Y = parseFloat(D.substring(16, 24)), K = parseFloat(D.substring(25, 33)), ee = parseFloat(D.substring(34, 40)), de = parseFloat(D.substring(41, 47)), ve = parseFloat(D.substring(48, 54)), g.cryst = {
                    a: We,
                    b: Y,
                    c: K,
                    alpha: ee,
                    beta: de,
                    gamma: ve
                  };
                } else if (z == "ANISOU") {
                  let We = parseInt(D.substring(6, 11));
                  var ue = T[We], ye = s[ue];
                  if (ye) {
                    var ge = D.substring(30).trim().split(/\s+/), Se = {
                      u11: parseInt(ge[0]),
                      u22: parseInt(ge[1]),
                      u33: parseInt(ge[2]),
                      u12: parseInt(ge[3]),
                      u13: parseInt(ge[4]),
                      u23: parseInt(ge[5])
                    };
                    ye.uMat = Se;
                  }
                }
              }
              if ((0, c.validateBonds)(s, T), o && (0, E.assignPDBBonds)(s), a || (0, _.processSymmetries)(g.symmetries, s, A, g.cryst), v && !p && (0, y.computeSecondaryStructure)(s, A.hbondCutoff), !(0, h.isEmpty)(S)) {
                for (let He = 0; He < s.length; He++)
                  if (M = s[He], M !== void 0 && M.chain in S && M.resi in S[M.chain]) {
                    var ze = S[M.chain][M.resi];
                    M.ss = ze[0], ze.length > 1 && (ze[1] == "1" ? M.ssbegin = !0 : ze[1] == "2" && (M.ssend = !0));
                  }
              }
              return [s, g, L];
            }
          }
        ),
        /***/
        "./src/parsers/utils/isEmpty.ts": (
          /*!**************************************!*\
            !*** ./src/parsers/utils/isEmpty.ts ***!
            \**************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              isEmpty: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f) {
              var u;
              for (u in f)
                return !1;
              return !0;
            }
          }
        ),
        /***/
        "./src/parsers/utils/processSymmetries.ts": (
          /*!************************************************!*\
            !*** ./src/parsers/utils/processSymmetries.ts ***!
            \************************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              processSymmetries: () => (
                /* binding */
                f
              )
              /* harmony export */
            });
            var n = t(
              /*! ../../WebGL */
              "./src/WebGL/index.ts"
            );
            function f(u, y, h, _) {
              var E = !h.duplicateAssemblyAtoms, c = y.length, C = c, b, A, S;
              let s = -1;
              if (h.normalizeAssembly && _) {
                let l = (0, n.conversionMatrix3)(_.a, _.b, _.c, _.alpha, _.beta, _.gamma), g = new n.Matrix3();
                for (g.getInverse3(l), b = 0; b < u.length; b++) {
                  let M = new n.Vector3(0, 0, 0);
                  for (S = 0; S < c; S++) {
                    let I = new n.Vector3(y[S].x, y[S].y, y[S].z);
                    I.applyMatrix4(u[b]), I.applyMatrix3(g), M.add(I);
                  }
                  M.divideScalar(c);
                  const L = [M.x, M.y, M.z];
                  let T = [0, 0, 0];
                  for (let I = 0; I < 3; I++) {
                    for (; L[I] < -1e-3; )
                      L[I] += 1, T[I] += 1;
                    for (; L[I] > 1.001; )
                      L[I] -= 1, T[I] -= 1;
                  }
                  const D = new n.Vector3(T[0], T[1], T[2]);
                  D.applyMatrix3(l), u[b].isNearlyIdentity() && D.lengthSq() > 1e-3 && (s = b), u[b].translate(D);
                }
              }
              if (E) {
                if (u.length > 1)
                  for (b = 0; b < y.length; b++) {
                    var v = [];
                    for (A = 0; A < u.length; A++)
                      if (!u[A].isNearlyIdentity()) {
                        var a = new n.Vector3();
                        a.set(y[b].x, y[b].y, y[b].z), a.applyMatrix4(u[A]), v.push(a);
                      }
                    y[b].symmetries = v;
                  }
              } else {
                for (S = 0; S < c; S++)
                  y[S].sym = -1;
                for (b = 0; b < u.length; b++)
                  if (!u[b].isNearlyIdentity() && s != b) {
                    let l = new n.Vector3();
                    for (S = 0; S < c; S++) {
                      var o = [];
                      for (A = 0; A < y[S].bonds.length; A++)
                        o.push(y[S].bonds[A] + C);
                      l.set(y[S].x, y[S].y, y[S].z), l.applyMatrix4(u[b]);
                      var w = {};
                      for (var p in y[S])
                        w[p] = y[S][p];
                      w.x = l.x, w.y = l.y, w.z = l.z, w.bonds = o, w.sym = b, w.index = y.length, y.push(w);
                    }
                    C = y.length;
                  } else
                    for (S = 0; S < c; S++)
                      y[S].sym = b;
                if (s >= 0) {
                  let l = new n.Vector3();
                  for (S = 0; S < c; S++)
                    l.set(y[S].x, y[S].y, y[S].z), l.applyMatrix4(u[s]), y[S].x = l.x, y[S].y = l.y, y[S].z = l.z;
                }
                u.length = 0;
              }
            }
          }
        ),
        /***/
        "./src/parsers/utils/standardResidues.ts": (
          /*!***********************************************!*\
            !*** ./src/parsers/utils/standardResidues.ts ***!
            \***********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              standardResidues: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = /* @__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 ***!
            \********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              validateBonds: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            function n(f, u) {
              for (var y = 0, h = f.length; y < h; y++)
                for (var _ = f[y], E = 0; E < _.bonds.length; E++) {
                  var c = _.bonds[E], C = f[c], b = u[_.serial];
                  if (C && b) {
                    var A = C.bonds.indexOf(b);
                    A < 0 && (C.bonds.push(b), C.bondOrder.push(_.bondOrder[E]));
                  }
                }
            }
          }
        ),
        /***/
        "./src/partialCharges.ts": (
          /*!*******************************!*\
            !*** ./src/partialCharges.ts ***!
            \*******************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              applyPartialCharges: () => (
                /* binding */
                f
              ),
              /* harmony export */
              partialCharges: () => (
                /* binding */
                n
              )
              /* harmony export */
            });
            const n = {
              "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 f(u, y) {
              if ((!y || typeof u.partialCharge > "u") && u.resn && u.atom) {
                var h = u.resn + ":" + u.atom;
                u.properties.partialCharge = n[h];
              }
            }
          }
        ),
        /***/
        "./src/specs.ts": (
          /*!**********************!*\
            !*** ./src/specs.ts ***!
            \**********************/
          /***/
          (r, e, t) => {
            t.r(e);
          }
        ),
        /***/
        "./src/utilities.ts": (
          /*!**************************!*\
            !*** ./src/utilities.ts ***!
            \**************************/
          /***/
          (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
            __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
              /* harmony export */
              PausableTimer: () => (
                /* binding */
                PausableTimer
              ),
              /* harmony export */
              adjustVolumeStyle: () => (
                /* binding */
                adjustVolumeStyle
              ),
              /* harmony export */
              base64ToArray: () => (
                /* binding */
                base64ToArray
              ),
              /* harmony export */
              deepCopy: () => (
                /* binding */
                deepCopy
              ),
              /* harmony export */
              download: () => (
                /* binding */
                download
              ),
              /* harmony export */
              extend: () => (
                /* binding */
                extend
              ),
              /* harmony export */
              get: () => (
                /* binding */
                get
              ),
              /* harmony export */
              getAtomProperty: () => (
                /* binding */
                getAtomProperty
              ),
              /* harmony export */
              getColorFromStyle: () => (
                /* binding */
                getColorFromStyle
              ),
              /* harmony export */
              getElement: () => (
                /* binding */
                getElement
              ),
              /* harmony export */
              getExtent: () => (
                /* binding */
                getExtent
              ),
              /* harmony export */
              getPropertyRange: () => (
                /* binding */
                getPropertyRange
              ),
              /* harmony export */
              getbin: () => (
                /* binding */
                getbin
              ),
              /* harmony export */
              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(r, e) {
              for (var t in e)
                e.hasOwnProperty(t) && e[t] !== void 0 && (r[t] = e[t]);
              return r;
            }
            function deepCopy(r) {
              let e, t, n;
              if (r == null)
                return {};
              if (typeof r != "object" || r === null)
                return r;
              e = Array.isArray(r) ? [] : {};
              for (n in r)
                t = r[n], e[n] = deepCopy(t);
              return e;
            }
            function isNumeric(r) {
              var e = typeof r;
              return (e === "number" || e === "string") && !isNaN(r - parseFloat(r));
            }
            function isEmptyObject(r) {
              var e;
              for (e in r)
                return !1;
              return !0;
            }
            function makeFunction(callback) {
              return callback && typeof callback == "string" && (callback = eval("(" + callback + ")")), callback && typeof callback != "function" ? null : callback;
            }
            function adjustVolumeStyle(r) {
              r && (r.volformat && !(r.voldata instanceof _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData) && (r.voldata = new _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData(r.voldata, r.volformat)), r.volscheme && (r.volscheme = _Gradient__WEBPACK_IMPORTED_MODULE_0__.Gradient.getGradient(r.volscheme)));
            }
            function getExtent(r, e) {
              var t, n, f, u, y, h, _, E, c, C, b = !e;
              if (t = n = f = 9999, u = y = h = -9999, _ = E = c = C = 0, r.length === 0)
                return [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
              for (var A = 0; A < r.length; A++) {
                var S = r[A];
                if (!(typeof S > "u" || !isFinite(S.x) || !isFinite(S.y) || !isFinite(S.z)) && (C++, _ += S.x, E += S.y, c += S.z, t = t < S.x ? t : S.x, n = n < S.y ? n : S.y, f = f < S.z ? f : S.z, u = u > S.x ? u : S.x, y = y > S.y ? y : S.y, h = h > S.z ? h : S.z, S.symmetries && b))
                  for (var s = 0; s < S.symmetries.length; s++)
                    C++, _ += S.symmetries[s].x, E += S.symmetries[s].y, c += S.symmetries[s].z, t = t < S.symmetries[s].x ? t : S.symmetries[s].x, n = n < S.symmetries[s].y ? n : S.symmetries[s].y, f = f < S.symmetries[s].z ? f : S.symmetries[s].z, u = u > S.symmetries[s].x ? u : S.symmetries[s].x, y = y > S.symmetries[s].y ? y : S.symmetries[s].y, h = h > S.symmetries[s].z ? h : S.symmetries[s].z;
              }
              return [
                [t, n, f],
                [u, y, h],
                [_ / C, E / C, c / C]
              ];
            }
            function getPropertyRange(r, e) {
              for (var t = Number.POSITIVE_INFINITY, n = Number.NEGATIVE_INFINITY, f = 0, u = r.length; f < u; f++) {
                var y = r[f], h = getAtomProperty(y, e);
                h != null && (h < t && (t = h), h > n && (n = h));
              }
              return !isFinite(t) && !isFinite(n) ? t = n = 0 : isFinite(t) ? isFinite(n) || (n = t) : t = n, [t, n];
            }
            class PausableTimer {
              constructor(e, t, n) {
                this.total_time_run = 0, this.fn = e, this.arg = n, this.countdown = t, this.start_time = (/* @__PURE__ */ new Date()).getTime(), this.ident = setTimeout(e, t, n);
              }
              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(r) {
              for (var e = window.atob(r), t = e.length, n = new Uint8Array(t), f = 0; f < t; f++)
                n[f] = e.charCodeAt(f);
              return n;
            }
            function getAtomProperty(r, e) {
              var t = null;
              return r.properties && typeof r.properties[e] < "u" ? t = r.properties[e] : typeof r[e] < "u" && (t = r[e]), t;
            }
            function mergeGeos(r, e) {
              var t = e.geometry;
              t !== void 0 && r.geometryGroups.push(t.geometryGroups[0]);
            }
            function specStringToObject(r) {
              if (typeof r == "object")
                return r;
              if (typeof r > "u" || r == null)
                return r;
              try {
                return JSON.parse(r);
              } catch {
              }
              r = r.replace(/%7E/g, "~");
              var e = function(b) {
                return isNumeric(b) ? Math.floor(parseFloat(b)) == parseInt(b) || b.indexOf(".") >= 0 ? parseFloat(b) : parseInt(b) : b === "true" ? !0 : b === "false" ? !1 : b;
              }, t = {};
              if (r === "all")
                return t;
              for (var n = r.split(";"), f = 0; f < n.length; f++) {
                var u = n[f].split(":"), y = u[0], h = {}, _ = u[1];
                if (_)
                  if (_ = _.replace(/~/g, "="), _.indexOf("=") !== -1)
                    for (var E = _.split(","), c = 0; c < E.length; c++) {
                      var C = E[c].split("=", 2);
                      h[C[0]] = e(C[1]);
                    }
                  else
                    _.indexOf(",") !== -1 ? h = _.split(",") : h = e(_);
                t[y] = h;
              }
              return t;
            }
            function checkStatus(r) {
              if (!r.ok)
                throw new Error(`HTTP ${r.status} - ${r.statusText}`);
              return r;
            }
            function get(r, e) {
              var t = fetch(r).then(checkStatus).then((n) => n.text());
              return e ? t.then(e) : t;
            }
            function getbin(r, e, t, n) {
              var f;
              return t == "POST" ? f = fetch(r, { method: "POST", body: n }).then((u) => checkStatus(u)).then((u) => u.arrayBuffer()) : f = fetch(r).then((u) => checkStatus(u)).then((u) => u.arrayBuffer()), e ? f.then(e) : f;
            }
            function download(r, e, t, n) {
              var f = "", u = "", y = "", h = "", _ = null, E = e.addModel();
              if (r.indexOf(":") < 0 && (r.length == 4 ? r = "pdb:" + r : isNaN(r) ? r = "url:" + r : r = "cid:" + r), r.substring(0, 5) === "mmtf:")
                u = t && t.pdbUri ? t.pdbUri : "https://mmtf.rcsb.org/v1.0/full/", r = r.substring(5).toUpperCase(), h = u + r, t && typeof t.noComputeSecondaryStructure > "u" && (t.noComputeSecondaryStructure = !0), _ = new Promise(function(C) {
                  getbin(h).then(function(b) {
                    E.addMolData(b, "mmtf", t), e.zoomTo(), e.render(), C(E);
                  }, function() {
                    console.log("fetch of " + h + " failed.");
                  });
                });
              else {
                if (r.substring(0, 4) === "pdb:") {
                  if (f = "mmtf", t && t.format && (f = t.format), t && typeof t.noComputeSecondaryStructure > "u" && (t.noComputeSecondaryStructure = !0), r = r.substring(4).toUpperCase(), !r.match(/^[1-9][A-Za-z0-9]{3}$/)) {
                    alert("Wrong PDB ID");
                    return;
                  }
                  f == "mmtf" ? (y = t && t.mmtfUri ? t.mmtfUri : "https://mmtf.rcsb.org/v1.0/full/", h = y + r.toUpperCase()) : (u = t && t.pdbUri ? t.pdbUri : "https://files.rcsb.org/view/", h = u + r + "." + f);
                } else if (r.substring(0, 4) == "cid:") {
                  if (f = "sdf", r = r.substring(4), !r.match(/^[0-9]+$/)) {
                    alert("Wrong Compound ID");
                    return;
                  }
                  h = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + r + "/SDF?record_type=3d";
                } else
                  r.substring(0, 4) == "url:" && (h = r.substring(4), f = h);
                var c = function(C) {
                  E.addMolData(C, f, t), e.zoomTo(), e.render();
                };
                _ = new Promise(function(C) {
                  f == "mmtf" ? getbin(h).then(function(b) {
                    c(b), C(E);
                  }).catch(function() {
                    u = t && t.pdbUri ? t.pdbUri : "https://files.rcsb.org/view/", h = u + r + ".pdb", f = "pdb", console.log("falling back to pdb format"), get(h).then(function(b) {
                      c(b), C(E);
                    }).catch(function(b) {
                      c(""), C(E), console.log("fetch of " + h + " failed: " + b.statusText);
                    });
                  }) : get(h).then(function(b) {
                    c(b), C(E);
                  }).catch(function(b) {
                    c(""), C(E), console.log("fetch of " + h + " failed: " + b.statusText);
                  });
                });
              }
              return n ? (_.then(function(C) {
                n(C);
              }), E) : _;
            }
            function getColorFromStyle(r, e) {
              let t = e.colorscheme;
              if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t] < "u")
                t = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t];
              else if (typeof t == "string" && t.endsWith("Carbon")) {
                let y = t.substring(0, t.lastIndexOf("Carbon")).toLowerCase();
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[y] < "u") {
                  let h = Object.assign({}, _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors.defaultColors);
                  h.C = _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[y], _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t] = { prop: "elem", map: h }, t = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[t];
                }
              }
              let n = r.color;
              if (typeof e.color < "u" && e.color != "spectrum" && (n = e.color), typeof t < "u") {
                let y, h;
                if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[t] < "u")
                  t = _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[t], typeof t[r[t.prop]] < "u" && (n = t.map[r[t.prop]]);
                else if (typeof t[r[t.prop]] < "u")
                  n = t.map[r[t.prop]];
                else if (typeof t.prop < "u" && typeof t.gradient < "u") {
                  y = t.prop;
                  var f = t.gradient;
                  typeof _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[f] < "u" && (f = new _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[f](t.min, t.max, t.mid ? t.mid : t.colors));
                  let _ = f.range() || [-1, 1];
                  h = getAtomProperty(r, y), h != null && (n = f.valueToHex(h, _));
                } else
                  typeof t.prop < "u" && typeof t.map < "u" ? (y = t.prop, h = getAtomProperty(r, y), typeof t.map[h] < "u" && (n = t.map[h])) : typeof e.colorscheme[r.elem] < "u" ? n = e.colorscheme[r.elem] : console.log("Could not interpret colorscheme " + t);
              } else
                typeof e.colorfunc < "u" && (n = e.colorfunc(r));
              return _colors__WEBPACK_IMPORTED_MODULE_2__.CC.color(n);
            }
            function getElement(r) {
              let e = r;
              return typeof r == "string" ? e = document.querySelector("#" + r) : typeof r == "object" && r.get && (e = r.get(0)), e;
            }
          }
        ),
        /***/
        "./node_modules/upng-js/UPNG.js": (
          /*!**************************************!*\
            !*** ./node_modules/upng-js/UPNG.js ***!
            \**************************************/
          /***/
          (r, e, t) => {
            (function() {
              var n = {}, f;
              r.exports = n, f = t(
                /*! pako */
                "./node_modules/upng-js/node_modules/pako/index.js"
              ), function(u, y) {
                u.toRGBA8 = function(h) {
                  var _ = h.width, E = h.height;
                  if (h.tabs.acTL == null)
                    return [u.toRGBA8.decodeImage(h.data, _, E, h).buffer];
                  var c = [];
                  h.frames[0].data == null && (h.frames[0].data = h.data);
                  for (var C, b = new Uint8Array(_ * E * 4), A = 0; A < h.frames.length; A++) {
                    var S = h.frames[A], s = S.rect.x, o = S.rect.y, w = S.rect.width, p = S.rect.height, v = u.toRGBA8.decodeImage(S.data, w, p, h);
                    if (A == 0 ? C = v : S.blend == 0 ? u._copyTile(v, w, p, C, _, E, s, o, 0) : S.blend == 1 && u._copyTile(v, w, p, C, _, E, s, o, 1), c.push(C.buffer), C = C.slice(0), S.dispose != 0) {
                      if (S.dispose == 1)
                        u._copyTile(b, w, p, C, _, E, s, o, 0);
                      else if (S.dispose == 2) {
                        for (var a = A - 1; h.frames[a].dispose == 2; )
                          a--;
                        C = new Uint8Array(c[a]).slice(0);
                      }
                    }
                  }
                  return c;
                }, u.toRGBA8.decodeImage = function(h, _, E, c) {
                  var C = _ * E, b = u.decode._getBPP(c), A = Math.ceil(_ * b / 8), S = new Uint8Array(C * 4), s = new Uint32Array(S.buffer), o = c.ctype, w = c.depth, p = u._bin.readUshort;
                  if (o == 6) {
                    var v = C << 2;
                    if (w == 8)
                      for (var a = 0; a < v; a++)
                        S[a] = h[a];
                    if (w == 16)
                      for (var a = 0; a < v; a++)
                        S[a] = h[a << 1];
                  } else if (o == 2) {
                    var l = c.tabs.tRNS, g = -1, M = -1, L = -1;
                    if (l && (g = l[0], M = l[1], L = l[2]), w == 8)
                      for (var a = 0; a < C; a++) {
                        var T = a << 2, D = a * 3;
                        S[T] = h[D], S[T + 1] = h[D + 1], S[T + 2] = h[D + 2], S[T + 3] = 255, g != -1 && h[D] == g && h[D + 1] == M && h[D + 2] == L && (S[T + 3] = 0);
                      }
                    if (w == 16)
                      for (var a = 0; a < C; a++) {
                        var T = a << 2, D = a * 6;
                        S[T] = h[D], S[T + 1] = h[D + 2], S[T + 2] = h[D + 4], S[T + 3] = 255, g != -1 && p(h, D) == g && p(h, D + 2) == M && p(h, D + 4) == L && (S[T + 3] = 0);
                      }
                  } else if (o == 3) {
                    var I = c.tabs.PLTE, z = c.tabs.tRNS, P = z ? z.length : 0;
                    if (w == 1)
                      for (var B = 0; B < E; B++)
                        for (var F = B * A, N = B * _, a = 0; a < _; a++) {
                          var T = N + a << 2, $ = h[F + (a >> 3)] >> 7 - ((a & 7) << 0) & 1, k = 3 * $;
                          S[T] = I[k], S[T + 1] = I[k + 1], S[T + 2] = I[k + 2], S[T + 3] = $ < P ? z[$] : 255;
                        }
                    if (w == 2)
                      for (var B = 0; B < E; B++)
                        for (var F = B * A, N = B * _, a = 0; a < _; a++) {
                          var T = N + a << 2, $ = h[F + (a >> 2)] >> 6 - ((a & 3) << 1) & 3, k = 3 * $;
                          S[T] = I[k], S[T + 1] = I[k + 1], S[T + 2] = I[k + 2], S[T + 3] = $ < P ? z[$] : 255;
                        }
                    if (w == 4)
                      for (var B = 0; B < E; B++)
                        for (var F = B * A, N = B * _, a = 0; a < _; a++) {
                          var T = N + a << 2, $ = h[F + (a >> 1)] >> 4 - ((a & 1) << 2) & 15, k = 3 * $;
                          S[T] = I[k], S[T + 1] = I[k + 1], S[T + 2] = I[k + 2], S[T + 3] = $ < P ? z[$] : 255;
                        }
                    if (w == 8)
                      for (var a = 0; a < C; a++) {
                        var T = a << 2, $ = h[a], k = 3 * $;
                        S[T] = I[k], S[T + 1] = I[k + 1], S[T + 2] = I[k + 2], S[T + 3] = $ < P ? z[$] : 255;
                      }
                  } else if (o == 4) {
                    if (w == 8)
                      for (var a = 0; a < C; a++) {
                        var T = a << 2, G = a << 1, H = h[G];
                        S[T] = H, S[T + 1] = H, S[T + 2] = H, S[T + 3] = h[G + 1];
                      }
                    if (w == 16)
                      for (var a = 0; a < C; a++) {
                        var T = a << 2, G = a << 2, H = h[G];
                        S[T] = H, S[T + 1] = H, S[T + 2] = H, S[T + 3] = h[G + 2];
                      }
                  } else if (o == 0) {
                    var g = c.tabs.tRNS ? c.tabs.tRNS : -1;
                    if (w == 1)
                      for (var a = 0; a < C; a++) {
                        var H = 255 * (h[a >> 3] >> 7 - (a & 7) & 1), U = H == g * 255 ? 0 : 255;
                        s[a] = U << 24 | H << 16 | H << 8 | H;
                      }
                    if (w == 2)
                      for (var a = 0; a < C; a++) {
                        var H = 85 * (h[a >> 2] >> 6 - ((a & 3) << 1) & 3), U = H == g * 85 ? 0 : 255;
                        s[a] = U << 24 | H << 16 | H << 8 | H;
                      }
                    if (w == 4)
                      for (var a = 0; a < C; a++) {
                        var H = 17 * (h[a >> 1] >> 4 - ((a & 1) << 2) & 15), U = H == g * 17 ? 0 : 255;
                        s[a] = U << 24 | H << 16 | H << 8 | H;
                      }
                    if (w == 8)
                      for (var a = 0; a < C; a++) {
                        var H = h[a], U = H == g ? 0 : 255;
                        s[a] = U << 24 | H << 16 | H << 8 | H;
                      }
                    if (w == 16)
                      for (var a = 0; a < C; a++) {
                        var H = h[a << 1], U = p(h, a << 1) == g ? 0 : 255;
                        s[a] = U << 24 | H << 16 | H << 8 | H;
                      }
                  }
                  return S;
                }, u.decode = function(h) {
                  for (var _ = new Uint8Array(h), E = 8, c = u._bin, C = c.readUshort, b = c.readUint, A = { tabs: {}, frames: [] }, S = new Uint8Array(_.length), s = 0, o, w = 0, p = [137, 80, 78, 71, 13, 10, 26, 10], v = 0; v < 8; v++)
                    if (_[v] != p[v])
                      throw "The input is not a PNG file!";
                  for (; E < _.length; ) {
                    var a = c.readUint(_, E);
                    E += 4;
                    var l = c.readASCII(_, E, 4);
                    if (E += 4, l == "IHDR")
                      u.decode._IHDR(_, E, A);
                    else if (l == "IDAT") {
                      for (var v = 0; v < a; v++)
                        S[s + v] = _[E + v];
                      s += a;
                    } else if (l == "acTL")
                      A.tabs[l] = { num_frames: b(_, E), num_plays: b(_, E + 4) }, o = new Uint8Array(_.length);
                    else if (l == "fcTL") {
                      if (w != 0) {
                        var g = A.frames[A.frames.length - 1];
                        g.data = u.decode._decompress(A, o.slice(0, w), g.rect.width, g.rect.height), w = 0;
                      }
                      var M = { x: b(_, E + 12), y: b(_, E + 16), width: b(_, E + 4), height: b(_, E + 8) }, L = C(_, E + 22);
                      L = C(_, E + 20) / (L == 0 ? 100 : L);
                      var T = { rect: M, delay: Math.round(L * 1e3), dispose: _[E + 24], blend: _[E + 25] };
                      A.frames.push(T);
                    } else if (l == "fdAT") {
                      for (var v = 0; v < a - 4; v++)
                        o[w + v] = _[E + v + 4];
                      w += a - 4;
                    } else if (l == "pHYs")
                      A.tabs[l] = [c.readUint(_, E), c.readUint(_, E + 4), _[E + 8]];
                    else if (l == "cHRM") {
                      A.tabs[l] = [];
                      for (var v = 0; v < 8; v++)
                        A.tabs[l].push(c.readUint(_, E + v * 4));
                    } else if (l == "tEXt") {
                      A.tabs[l] == null && (A.tabs[l] = {});
                      var D = c.nextZero(_, E), I = c.readASCII(_, E, D - E), z = c.readASCII(_, D + 1, E + a - D - 1);
                      A.tabs[l][I] = z;
                    } else if (l == "iTXt") {
                      A.tabs[l] == null && (A.tabs[l] = {});
                      var D = 0, P = E;
                      D = c.nextZero(_, P);
                      var I = c.readASCII(_, P, D - P);
                      P = D + 1, _[P], _[P + 1], P += 2, D = c.nextZero(_, P), c.readASCII(_, P, D - P), P = D + 1, D = c.nextZero(_, P), c.readUTF8(_, P, D - P), P = D + 1;
                      var z = c.readUTF8(_, P, a - (P - E));
                      A.tabs[l][I] = z;
                    } else if (l == "PLTE")
                      A.tabs[l] = c.readBytes(_, E, a);
                    else if (l == "hIST") {
                      var B = A.tabs.PLTE.length / 3;
                      A.tabs[l] = [];
                      for (var v = 0; v < B; v++)
                        A.tabs[l].push(C(_, E + v * 2));
                    } else if (l == "tRNS")
                      A.ctype == 3 ? A.tabs[l] = c.readBytes(_, E, a) : A.ctype == 0 ? A.tabs[l] = C(_, E) : A.ctype == 2 && (A.tabs[l] = [C(_, E), C(_, E + 2), C(_, E + 4)]);
                    else if (l == "gAMA")
                      A.tabs[l] = c.readUint(_, E) / 1e5;
                    else if (l == "sRGB")
                      A.tabs[l] = _[E];
                    else if (l == "bKGD")
                      A.ctype == 0 || A.ctype == 4 ? A.tabs[l] = [C(_, E)] : A.ctype == 2 || A.ctype == 6 ? A.tabs[l] = [C(_, E), C(_, E + 2), C(_, E + 4)] : A.ctype == 3 && (A.tabs[l] = _[E]);
                    else if (l == "IEND") {
                      if (w != 0) {
                        var g = A.frames[A.frames.length - 1];
                        g.data = u.decode._decompress(A, o.slice(0, w), g.rect.width, g.rect.height), w = 0;
                      }
                      A.data = u.decode._decompress(A, S, A.width, A.height);
                      break;
                    }
                    E += a, c.readUint(_, E), E += 4;
                  }
                  return delete A.compress, delete A.interlace, delete A.filter, A;
                }, u.decode._decompress = function(h, _, E, c) {
                  return h.compress == 0 && (_ = u.decode._inflate(_)), h.interlace == 0 ? _ = u.decode._filterZero(_, h, 0, E, c) : h.interlace == 1 && (_ = u.decode._readInterlace(_, h)), _;
                }, u.decode._inflate = function(h) {
                  return y.inflate(h);
                }, u.decode._readInterlace = function(h, _) {
                  for (var E = _.width, c = _.height, C = u.decode._getBPP(_), b = C >> 3, A = Math.ceil(E * C / 8), S = new Uint8Array(c * A), s = 0, o = [0, 0, 4, 0, 2, 0, 1], w = [0, 4, 0, 2, 0, 1, 0], p = [8, 8, 8, 4, 4, 2, 2], v = [8, 8, 4, 4, 2, 2, 1], a = 0; a < 7; ) {
                    for (var l = p[a], g = v[a], M = 0, L = 0, T = o[a]; T < c; )
                      T += l, L++;
                    for (var D = w[a]; D < E; )
                      D += g, M++;
                    var I = Math.ceil(M * C / 8);
                    u.decode._filterZero(h, _, s, M, L);
                    for (var z = 0, P = o[a]; P < c; ) {
                      for (var B = w[a], F = s + z * I << 3; B < E; ) {
                        if (C == 1) {
                          var N = h[F >> 3];
                          N = N >> 7 - (F & 7) & 1, S[P * A + (B >> 3)] |= N << 7 - ((B & 3) << 0);
                        }
                        if (C == 2) {
                          var N = h[F >> 3];
                          N = N >> 6 - (F & 7) & 3, S[P * A + (B >> 2)] |= N << 6 - ((B & 3) << 1);
                        }
                        if (C == 4) {
                          var N = h[F >> 3];
                          N = N >> 4 - (F & 7) & 15, S[P * A + (B >> 1)] |= N << 4 - ((B & 1) << 2);
                        }
                        if (C >= 8)
                          for (var $ = P * A + B * b, k = 0; k < b; k++)
                            S[$ + k] = h[(F >> 3) + k];
                        F += C, B += g;
                      }
                      z++, P += l;
                    }
                    M * L != 0 && (s += L * (1 + I)), a = a + 1;
                  }
                  return S;
                }, u.decode._getBPP = function(h) {
                  var _ = [1, null, 3, 1, 2, null, 4][h.ctype];
                  return _ * h.depth;
                }, u.decode._filterZero = function(h, _, E, c, C) {
                  var b = u.decode._getBPP(_), A = Math.ceil(c * b / 8), S = u.decode._paeth;
                  b = Math.ceil(b / 8);
                  for (var s = 0; s < C; s++) {
                    var o = E + s * A, w = o + s + 1, p = h[w - 1];
                    if (p == 0)
                      for (var v = 0; v < A; v++)
                        h[o + v] = h[w + v];
                    else if (p == 1) {
                      for (var v = 0; v < b; v++)
                        h[o + v] = h[w + v];
                      for (var v = b; v < A; v++)
                        h[o + v] = h[w + v] + h[o + v - b] & 255;
                    } else if (s == 0) {
                      for (var v = 0; v < b; v++)
                        h[o + v] = h[w + v];
                      if (p == 2)
                        for (var v = b; v < A; v++)
                          h[o + v] = h[w + v] & 255;
                      if (p == 3)
                        for (var v = b; v < A; v++)
                          h[o + v] = h[w + v] + (h[o + v - b] >> 1) & 255;
                      if (p == 4)
                        for (var v = b; v < A; v++)
                          h[o + v] = h[w + v] + S(h[o + v - b], 0, 0) & 255;
                    } else {
                      if (p == 2)
                        for (var v = 0; v < A; v++)
                          h[o + v] = h[w + v] + h[o + v - A] & 255;
                      if (p == 3) {
                        for (var v = 0; v < b; v++)
                          h[o + v] = h[w + v] + (h[o + v - A] >> 1) & 255;
                        for (var v = b; v < A; v++)
                          h[o + v] = h[w + v] + (h[o + v - A] + h[o + v - b] >> 1) & 255;
                      }
                      if (p == 4) {
                        for (var v = 0; v < b; v++)
                          h[o + v] = h[w + v] + S(0, h[o + v - A], 0) & 255;
                        for (var v = b; v < A; v++)
                          h[o + v] = h[w + v] + S(h[o + v - b], h[o + v - A], h[o + v - b - A]) & 255;
                      }
                    }
                  }
                  return h;
                }, u.decode._paeth = function(h, _, E) {
                  var c = h + _ - E, C = Math.abs(c - h), b = Math.abs(c - _), A = Math.abs(c - E);
                  return C <= b && C <= A ? h : b <= A ? _ : E;
                }, u.decode._IHDR = function(h, _, E) {
                  var c = u._bin;
                  E.width = c.readUint(h, _), _ += 4, E.height = c.readUint(h, _), _ += 4, E.depth = h[_], _++, E.ctype = h[_], _++, E.compress = h[_], _++, E.filter = h[_], _++, E.interlace = h[_], _++;
                }, u._bin = {
                  nextZero: function(h, _) {
                    for (; h[_] != 0; )
                      _++;
                    return _;
                  },
                  readUshort: function(h, _) {
                    return h[_] << 8 | h[_ + 1];
                  },
                  writeUshort: function(h, _, E) {
                    h[_] = E >> 8 & 255, h[_ + 1] = E & 255;
                  },
                  readUint: function(h, _) {
                    return h[_] * 16777216 + (h[_ + 1] << 16 | h[_ + 2] << 8 | h[_ + 3]);
                  },
                  writeUint: function(h, _, E) {
                    h[_] = E >> 24 & 255, h[_ + 1] = E >> 16 & 255, h[_ + 2] = E >> 8 & 255, h[_ + 3] = E & 255;
                  },
                  readASCII: function(h, _, E) {
                    for (var c = "", C = 0; C < E; C++)
                      c += String.fromCharCode(h[_ + C]);
                    return c;
                  },
                  writeASCII: function(h, _, E) {
                    for (var c = 0; c < E.length; c++)
                      h[_ + c] = E.charCodeAt(c);
                  },
                  readBytes: function(h, _, E) {
                    for (var c = [], C = 0; C < E; C++)
                      c.push(h[_ + C]);
                    return c;
                  },
                  pad: function(h) {
                    return h.length < 2 ? "0" + h : h;
                  },
                  readUTF8: function(h, _, E) {
                    for (var c = "", C, b = 0; b < E; b++)
                      c += "%" + u._bin.pad(h[_ + b].toString(16));
                    try {
                      C = decodeURIComponent(c);
                    } catch {
                      return u._bin.readASCII(h, _, E);
                    }
                    return C;
                  }
                }, u._copyTile = function(h, _, E, c, C, b, A, S, s) {
                  for (var o = Math.min(_, C), w = Math.min(E, b), p = 0, v = 0, a = 0; a < w; a++)
                    for (var l = 0; l < o; l++)
                      if (A >= 0 && S >= 0 ? (p = a * _ + l << 2, v = (S + a) * C + A + l << 2) : (p = (-S + a) * _ - A + l << 2, v = a * C + l << 2), s == 0)
                        c[v] = h[p], c[v + 1] = h[p + 1], c[v + 2] = h[p + 2], c[v + 3] = h[p + 3];
                      else if (s == 1) {
                        var g = h[p + 3] * 0.00392156862745098, M = h[p] * g, L = h[p + 1] * g, T = h[p + 2] * g, D = c[v + 3] * (1 / 255), I = c[v] * D, z = c[v + 1] * D, P = c[v + 2] * D, B = 1 - g, F = g + D * B, N = F == 0 ? 0 : 1 / F;
                        c[v + 3] = 255 * F, c[v + 0] = (M + I * B) * N, c[v + 1] = (L + z * B) * N, c[v + 2] = (T + P * B) * N;
                      } else if (s == 2) {
                        var g = h[p + 3], M = h[p], L = h[p + 1], T = h[p + 2], D = c[v + 3], I = c[v], z = c[v + 1], P = c[v + 2];
                        g == D && M == I && L == z && T == P ? (c[v] = 0, c[v + 1] = 0, c[v + 2] = 0, c[v + 3] = 0) : (c[v] = M, c[v + 1] = L, c[v + 2] = T, c[v + 3] = g);
                      } else if (s == 3) {
                        var g = h[p + 3], M = h[p], L = h[p + 1], T = h[p + 2], D = c[v + 3], I = c[v], z = c[v + 1], P = c[v + 2];
                        if (g == D && M == I && L == z && T == P)
                          continue;
                        if (g < 220 && D > 20)
                          return !1;
                      }
                  return !0;
                }, u.encode = function(h, _, E, c, C, b) {
                  c == null && (c = 0), b == null && (b = !1);
                  for (var A = new Uint8Array(h[0].byteLength * h.length + 100), S = [137, 80, 78, 71, 13, 10, 26, 10], s = 0; s < 8; s++)
                    A[s] = S[s];
                  var o = 8, w = u._bin, p = u.crc.crc, v = w.writeUint, a = w.writeUshort, l = w.writeASCII, g = u.encode.compressPNG(h, _, E, c, b);
                  v(A, o, 13), o += 4, l(A, o, "IHDR"), o += 4, v(A, o, _), o += 4, v(A, o, E), o += 4, A[o] = g.depth, o++, A[o] = g.ctype, o++, A[o] = 0, o++, A[o] = 0, o++, A[o] = 0, o++, v(A, o, p(A, o - 17, 17)), o += 4, v(A, o, 1), o += 4, l(A, o, "sRGB"), o += 4, A[o] = 1, o++, v(A, o, p(A, o - 5, 5)), o += 4;
                  var M = h.length > 1;
                  if (M && (v(A, o, 8), o += 4, l(A, o, "acTL"), o += 4, v(A, o, h.length), o += 4, v(A, o, 0), o += 4, v(A, o, p(A, o - 12, 12)), o += 4), g.ctype == 3) {
                    var L = g.plte.length;
                    v(A, o, L * 3), o += 4, l(A, o, "PLTE"), o += 4;
                    for (var s = 0; s < L; s++) {
                      var T = s * 3, D = g.plte[s], I = D & 255, z = D >> 8 & 255, P = D >> 16 & 255;
                      A[o + T + 0] = I, A[o + T + 1] = z, A[o + T + 2] = P;
                    }
                    if (o += L * 3, v(A, o, p(A, o - L * 3 - 4, L * 3 + 4)), o += 4, g.gotAlpha) {
                      v(A, o, L), o += 4, l(A, o, "tRNS"), o += 4;
                      for (var s = 0; s < L; s++)
                        A[o + s] = g.plte[s] >> 24 & 255;
                      o += L, v(A, o, p(A, o - L - 4, L + 4)), o += 4;
                    }
                  }
                  for (var B = 0, F = 0; F < g.frames.length; F++) {
                    var N = g.frames[F];
                    M && (v(A, o, 26), o += 4, l(A, o, "fcTL"), o += 4, v(A, o, B++), o += 4, v(A, o, N.rect.width), o += 4, v(A, o, N.rect.height), o += 4, v(A, o, N.rect.x), o += 4, v(A, o, N.rect.y), o += 4, a(A, o, C[F]), o += 2, a(A, o, 1e3), o += 2, A[o] = N.dispose, o++, A[o] = N.blend, o++, v(A, o, p(A, o - 30, 30)), o += 4);
                    var $ = N.cimg, L = $.length;
                    v(A, o, L + (F == 0 ? 0 : 4)), o += 4;
                    var k = o;
                    l(A, o, F == 0 ? "IDAT" : "fdAT"), o += 4, F != 0 && (v(A, o, B++), o += 4);
                    for (var s = 0; s < L; s++)
                      A[o + s] = $[s];
                    o += L, v(A, o, p(A, k, o - k)), o += 4;
                  }
                  return v(A, o, 0), o += 4, l(A, o, "IEND"), o += 4, v(A, o, p(A, o - 4, 4)), o += 4, A.buffer.slice(0, o);
                }, u.encode.compressPNG = function(h, _, E, c, C) {
                  for (var b = u.encode.compress(h, _, E, c, !1, C), A = 0; A < h.length; A++) {
                    var S = b.frames[A];
                    S.rect.width;
                    var s = S.rect.height, o = S.bpl, w = S.bpp, p = new Uint8Array(s * o + s);
                    S.cimg = u.encode._filterZero(S.img, s, w, o, p);
                  }
                  return b;
                }, u.encode.compress = function(h, _, E, c, C, b) {
                  b == null && (b = !1);
                  for (var A = 6, S = 8, s = 4, o = 255, w = 0; w < h.length; w++)
                    for (var p = new Uint8Array(h[w]), v = p.length, a = 0; a < v; a += 4)
                      o &= p[a + 3];
                  var l = o != 255, g = {}, M = [];
                  if (h.length != 0 && (g[0] = 0, M.push(0), c != 0 && c--), c != 0) {
                    var L = u.quantize(h, c, C);
                    h = L.bufs;
                    for (var a = 0; a < L.plte.length; a++) {
                      var T = L.plte[a].est.rgba;
                      g[T] == null && (g[T] = M.length, M.push(T));
                    }
                  } else
                    for (var w = 0; w < h.length; w++)
                      for (var D = new Uint32Array(h[w]), v = D.length, a = 0; a < v; a++) {
                        var T = D[a];
                        if ((a < _ || T != D[a - 1] && T != D[a - _]) && g[T] == null && (g[T] = M.length, M.push(T), M.length >= 300))
                          break;
                      }
                  var I = l ? C : !1, z = M.length;
                  z <= 256 && b == !1 && (z <= 2 ? S = 1 : z <= 4 ? S = 2 : z <= 16 ? S = 4 : S = 8, C && (S = 8), l = !0);
                  for (var P = [], w = 0; w < h.length; w++) {
                    var B = new Uint8Array(h[w]), F = new Uint32Array(B.buffer), N = 0, $ = 0, k = _, G = E, H = 0;
                    if (w != 0 && !I) {
                      for (var U = C || w == 1 || P[P.length - 2].dispose == 2 ? 1 : 2, V = 0, Q = 1e9, ae = 0; ae < U; ae++) {
                        for (var se = new Uint8Array(h[w - 1 - ae]), oe = new Uint32Array(h[w - 1 - ae]), q = _, me = E, ne = -1, fe = -1, Ce = 0; Ce < E; Ce++)
                          for (var Me = 0; Me < _; Me++) {
                            var a = Ce * _ + Me;
                            F[a] != oe[a] && (Me < q && (q = Me), Me > ne && (ne = Me), Ce < me && (me = Ce), Ce > fe && (fe = Ce));
                          }
                        var Te = ne == -1 ? 1 : (ne - q + 1) * (fe - me + 1);
                        Te < Q && (Q = Te, V = ae, ne == -1 ? (N = $ = 0, k = G = 1) : (N = q, $ = me, k = ne - q + 1, G = fe - me + 1));
                      }
                      var se = new Uint8Array(h[w - 1 - V]);
                      V == 1 && (P[P.length - 1].dispose = 2);
                      var pe = new Uint8Array(k * G * 4);
                      new Uint32Array(pe.buffer), u._copyTile(se, _, E, pe, k, G, -N, -$, 0), u._copyTile(B, _, E, pe, k, G, -N, -$, 3) ? (u._copyTile(B, _, E, pe, k, G, -N, -$, 2), H = 1) : (u._copyTile(B, _, E, pe, k, G, -N, -$, 0), H = 0), B = pe, F = new Uint32Array(B.buffer);
                    }
                    var we = 4 * k;
                    if (z <= 256 && b == !1) {
                      we = Math.ceil(S * k / 8);
                      for (var pe = new Uint8Array(we * G), Ce = 0; Ce < G; Ce++) {
                        var a = Ce * we, ke = Ce * k;
                        if (S == 8)
                          for (var Me = 0; Me < k; Me++)
                            pe[a + Me] = g[F[ke + Me]];
                        else if (S == 4)
                          for (var Me = 0; Me < k; Me++)
                            pe[a + (Me >> 1)] |= g[F[ke + Me]] << 4 - (Me & 1) * 4;
                        else if (S == 2)
                          for (var Me = 0; Me < k; Me++)
                            pe[a + (Me >> 2)] |= g[F[ke + Me]] << 6 - (Me & 3) * 2;
                        else if (S == 1)
                          for (var Me = 0; Me < k; Me++)
                            pe[a + (Me >> 3)] |= g[F[ke + Me]] << 7 - (Me & 7) * 1;
                      }
                      B = pe, A = 3, s = 1;
                    } else if (l == !1 && h.length == 1) {
                      for (var pe = new Uint8Array(k * G * 3), Ue = k * G, a = 0; a < Ue; a++) {
                        var Ne = a * 3, Be = a * 4;
                        pe[Ne] = B[Be], pe[Ne + 1] = B[Be + 1], pe[Ne + 2] = B[Be + 2];
                      }
                      B = pe, A = 2, s = 3, we = 3 * k;
                    }
                    P.push({ rect: { x: N, y: $, width: k, height: G }, img: B, bpl: we, bpp: s, blend: H, dispose: I ? 1 : 0 });
                  }
                  return { ctype: A, depth: S, plte: M, gotAlpha: l, frames: P };
                }, u.encode._filterZero = function(h, _, E, c, C) {
                  for (var b = [], A = 0; A < 5; A++)
                    if (!(_ * c > 5e5 && (A == 2 || A == 3 || A == 4))) {
                      for (var S = 0; S < _; S++)
                        u.encode._filterLine(C, h, S, c, E, A);
                      if (b.push(y.deflate(C)), E == 1)
                        break;
                    }
                  for (var s, o = 1e9, w = 0; w < b.length; w++)
                    b[w].length < o && (s = w, o = b[w].length);
                  return b[s];
                }, u.encode._filterLine = function(h, _, E, c, C, b) {
                  var A = E * c, S = A + E, s = u.decode._paeth;
                  if (h[S] = b, S++, b == 0)
                    for (var o = 0; o < c; o++)
                      h[S + o] = _[A + o];
                  else if (b == 1) {
                    for (var o = 0; o < C; o++)
                      h[S + o] = _[A + o];
                    for (var o = C; o < c; o++)
                      h[S + o] = _[A + o] - _[A + o - C] + 256 & 255;
                  } else if (E == 0) {
                    for (var o = 0; o < C; o++)
                      h[S + o] = _[A + o];
                    if (b == 2)
                      for (var o = C; o < c; o++)
                        h[S + o] = _[A + o];
                    if (b == 3)
                      for (var o = C; o < c; o++)
                        h[S + o] = _[A + o] - (_[A + o - C] >> 1) + 256 & 255;
                    if (b == 4)
                      for (var o = C; o < c; o++)
                        h[S + o] = _[A + o] - s(_[A + o - C], 0, 0) + 256 & 255;
                  } else {
                    if (b == 2)
                      for (var o = 0; o < c; o++)
                        h[S + o] = _[A + o] + 256 - _[A + o - c] & 255;
                    if (b == 3) {
                      for (var o = 0; o < C; o++)
                        h[S + o] = _[A + o] + 256 - (_[A + o - c] >> 1) & 255;
                      for (var o = C; o < c; o++)
                        h[S + o] = _[A + o] + 256 - (_[A + o - c] + _[A + o - C] >> 1) & 255;
                    }
                    if (b == 4) {
                      for (var o = 0; o < C; o++)
                        h[S + o] = _[A + o] + 256 - s(0, _[A + o - c], 0) & 255;
                      for (var o = C; o < c; o++)
                        h[S + o] = _[A + o] + 256 - s(_[A + o - C], _[A + o - c], _[A + o - C - c]) & 255;
                    }
                  }
                }, u.crc = {
                  table: function() {
                    for (var h = new Uint32Array(256), _ = 0; _ < 256; _++) {
                      for (var E = _, c = 0; c < 8; c++)
                        E & 1 ? E = 3988292384 ^ E >>> 1 : E = E >>> 1;
                      h[_] = E;
                    }
                    return h;
                  }(),
                  update: function(h, _, E, c) {
                    for (var C = 0; C < c; C++)
                      h = u.crc.table[(h ^ _[E + C]) & 255] ^ h >>> 8;
                    return h;
                  },
                  crc: function(h, _, E) {
                    return u.crc.update(4294967295, h, _, E) ^ 4294967295;
                  }
                }, u.quantize = function(h, _, E) {
                  for (var c = [], C = 0, b = 0; b < h.length; b++)
                    c.push(u.encode.alphaMul(new Uint8Array(h[b]), E)), C += h[b].byteLength;
                  for (var A = new Uint8Array(C), S = new Uint32Array(A.buffer), s = 0, b = 0; b < c.length; b++) {
                    for (var o = c[b], w = o.length, p = 0; p < w; p++)
                      A[s + p] = o[p];
                    s += w;
                  }
                  var v = { i0: 0, i1: A.length, bst: null, est: null, tdst: 0, left: null, right: null };
                  v.bst = u.quantize.stats(A, v.i0, v.i1), v.est = u.quantize.estats(v.bst);
                  for (var a = [v]; a.length < _; ) {
                    for (var l = 0, g = 0, b = 0; b < a.length; b++)
                      a[b].est.L > l && (l = a[b].est.L, g = b);
                    if (l < 1e-3)
                      break;
                    var M = a[g], L = u.quantize.splitPixels(A, S, M.i0, M.i1, M.est.e, M.est.eMq255), T = { i0: M.i0, i1: L, bst: null, est: null, tdst: 0, left: null, right: null };
                    T.bst = u.quantize.stats(A, T.i0, T.i1), T.est = u.quantize.estats(T.bst);
                    var D = { i0: L, i1: M.i1, bst: null, est: null, tdst: 0, left: null, right: null };
                    D.bst = { R: [], m: [], N: M.bst.N - T.bst.N };
                    for (var b = 0; b < 16; b++)
                      D.bst.R[b] = M.bst.R[b] - T.bst.R[b];
                    for (var b = 0; b < 4; b++)
                      D.bst.m[b] = M.bst.m[b] - T.bst.m[b];
                    D.est = u.quantize.estats(D.bst), M.left = T, M.right = D, a[g] = T, a.push(D);
                  }
                  a.sort(function(U, V) {
                    return V.bst.N - U.bst.N;
                  });
                  for (var I = 0; I < c.length; I++) {
                    for (var z = u.quantize.planeDst, P = new Uint8Array(c[I].buffer), B = new Uint32Array(c[I].buffer), F = P.length, b = 0; b < F; b += 4) {
                      for (var N = P[b] * 0.00392156862745098, $ = P[b + 1] * (1 / 255), k = P[b + 2] * (1 / 255), G = P[b + 3] * (1 / 255), H = v; H.left; )
                        H = z(H.est, N, $, k, G) <= 0 ? H.left : H.right;
                      B[b >> 2] = H.est.rgba;
                    }
                    c[I] = B.buffer;
                  }
                  return { bufs: c, plte: a };
                }, u.quantize.getNearest = function(h, _, E, c, C) {
                  if (h.left == null)
                    return h.tdst = u.quantize.dist(h.est.q, _, E, c, C), h;
                  var b = u.quantize.planeDst(h.est, _, E, c, C), A = h.left, S = h.right;
                  b > 0 && (A = h.right, S = h.left);
                  var s = u.quantize.getNearest(A, _, E, c, C);
                  if (s.tdst <= b * b)
                    return s;
                  var o = u.quantize.getNearest(S, _, E, c, C);
                  return o.tdst < s.tdst ? o : s;
                }, u.quantize.planeDst = function(h, _, E, c, C) {
                  var b = h.e;
                  return b[0] * _ + b[1] * E + b[2] * c + b[3] * C - h.eMq;
                }, u.quantize.dist = function(h, _, E, c, C) {
                  var b = _ - h[0], A = E - h[1], S = c - h[2], s = C - h[3];
                  return b * b + A * A + S * S + s * s;
                }, u.quantize.splitPixels = function(h, _, E, c, C, b) {
                  var A = u.quantize.vecDot;
                  for (c -= 4; E < c; ) {
                    for (; A(h, E, C) <= b; )
                      E += 4;
                    for (; A(h, c, C) > b; )
                      c -= 4;
                    if (E >= c)
                      break;
                    var S = _[E >> 2];
                    _[E >> 2] = _[c >> 2], _[c >> 2] = S, E += 4, c -= 4;
                  }
                  for (; A(h, E, C) > b; )
                    E -= 4;
                  return E + 4;
                }, u.quantize.vecDot = function(h, _, E) {
                  return h[_] * E[0] + h[_ + 1] * E[1] + h[_ + 2] * E[2] + h[_ + 3] * E[3];
                }, u.quantize.stats = function(h, _, E) {
                  for (var c = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], C = [0, 0, 0, 0], b = E - _ >> 2, A = _; A < E; A += 4) {
                    var S = h[A] * 0.00392156862745098, s = h[A + 1] * (1 / 255), o = h[A + 2] * (1 / 255), w = h[A + 3] * (1 / 255);
                    C[0] += S, C[1] += s, C[2] += o, C[3] += w, c[0] += S * S, c[1] += S * s, c[2] += S * o, c[3] += S * w, c[5] += s * s, c[6] += s * o, c[7] += s * w, c[10] += o * o, c[11] += o * w, c[15] += w * w;
                  }
                  return c[4] = c[1], c[8] = c[2], c[12] = c[3], c[9] = c[6], c[13] = c[7], c[14] = c[11], { R: c, m: C, N: b };
                }, u.quantize.estats = function(h) {
                  var _ = h.R, E = h.m, c = h.N, C = E[0], b = E[1], A = E[2], S = E[3], s = c == 0 ? 0 : 1 / c, o = [
                    _[0] - C * C * s,
                    _[1] - C * b * s,
                    _[2] - C * A * s,
                    _[3] - C * S * s,
                    _[4] - b * C * s,
                    _[5] - b * b * s,
                    _[6] - b * A * s,
                    _[7] - b * S * s,
                    _[8] - A * C * s,
                    _[9] - A * b * s,
                    _[10] - A * A * s,
                    _[11] - A * S * s,
                    _[12] - S * C * s,
                    _[13] - S * b * s,
                    _[14] - S * A * s,
                    _[15] - S * S * s
                  ], w = o, p = u.M4, v = [0.5, 0.5, 0.5, 0.5], a = 0, l = 0;
                  if (c != 0)
                    for (var g = 0; g < 10 && (v = p.multVec(w, v), l = Math.sqrt(p.dot(v, v)), v = p.sml(1 / l, v), !(Math.abs(l - a) < 1e-9)); g++)
                      a = l;
                  var M = [C * s, b * s, A * s, S * s], L = p.dot(p.sml(255, M), v), T = M[3] < 1e-3 ? 0 : 1 / M[3];
                  return {
                    Cov: o,
                    q: M,
                    e: v,
                    L: a,
                    eMq255: L,
                    eMq: p.dot(v, M),
                    rgba: (Math.round(255 * M[3]) << 24 | Math.round(255 * M[2] * T) << 16 | Math.round(255 * M[1] * T) << 8 | Math.round(255 * M[0] * T) << 0) >>> 0
                  };
                }, u.M4 = {
                  multVec: function(h, _) {
                    return [
                      h[0] * _[0] + h[1] * _[1] + h[2] * _[2] + h[3] * _[3],
                      h[4] * _[0] + h[5] * _[1] + h[6] * _[2] + h[7] * _[3],
                      h[8] * _[0] + h[9] * _[1] + h[10] * _[2] + h[11] * _[3],
                      h[12] * _[0] + h[13] * _[1] + h[14] * _[2] + h[15] * _[3]
                    ];
                  },
                  dot: function(h, _) {
                    return h[0] * _[0] + h[1] * _[1] + h[2] * _[2] + h[3] * _[3];
                  },
                  sml: function(h, _) {
                    return [h * _[0], h * _[1], h * _[2], h * _[3]];
                  }
                }, u.encode.alphaMul = function(h, _) {
                  for (var E = new Uint8Array(h.length), c = h.length >> 2, C = 0; C < c; C++) {
                    var b = C << 2, A = h[b + 3];
                    _ && (A = A < 128 ? 0 : 255);
                    var S = A * (1 / 255);
                    E[b + 0] = h[b + 0] * S, E[b + 1] = h[b + 1] * S, E[b + 2] = h[b + 2] * S, E[b + 3] = A;
                  }
                  return E;
                };
              }(n, f);
            })();
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/index.js": (
          /*!*********************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/index.js ***!
            \*********************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ./lib/utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ).assign, f = t(
              /*! ./lib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/deflate.js"
            ), u = t(
              /*! ./lib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/inflate.js"
            ), y = t(
              /*! ./lib/zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), h = {};
            n(h, f, u, y), r.exports = h;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/deflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/deflate.js ***!
            \***************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ./zlib/deflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js"
            ), f = t(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), u = t(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), y = t(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), h = t(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), _ = Object.prototype.toString, E = 0, c = 4, C = 0, b = 1, A = 2, S = -1, s = 0, o = 8;
            function w(l) {
              if (!(this instanceof w))
                return new w(l);
              this.options = f.assign({
                level: S,
                method: o,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: s,
                to: ""
              }, l || {});
              var g = this.options;
              g.raw && g.windowBits > 0 ? g.windowBits = -g.windowBits : g.gzip && g.windowBits > 0 && g.windowBits < 16 && (g.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new h(), this.strm.avail_out = 0;
              var M = n.deflateInit2(
                this.strm,
                g.level,
                g.method,
                g.windowBits,
                g.memLevel,
                g.strategy
              );
              if (M !== C)
                throw new Error(y[M]);
              if (g.header && n.deflateSetHeader(this.strm, g.header), g.dictionary) {
                var L;
                if (typeof g.dictionary == "string" ? L = u.string2buf(g.dictionary) : _.call(g.dictionary) === "[object ArrayBuffer]" ? L = new Uint8Array(g.dictionary) : L = g.dictionary, M = n.deflateSetDictionary(this.strm, L), M !== C)
                  throw new Error(y[M]);
                this._dict_set = !0;
              }
            }
            w.prototype.push = function(l, g) {
              var M = this.strm, L = this.options.chunkSize, T, D;
              if (this.ended)
                return !1;
              D = g === ~~g ? g : g === !0 ? c : E, typeof l == "string" ? M.input = u.string2buf(l) : _.call(l) === "[object ArrayBuffer]" ? M.input = new Uint8Array(l) : M.input = l, M.next_in = 0, M.avail_in = M.input.length;
              do {
                if (M.avail_out === 0 && (M.output = new f.Buf8(L), M.next_out = 0, M.avail_out = L), T = n.deflate(M, D), T !== b && T !== C)
                  return this.onEnd(T), this.ended = !0, !1;
                (M.avail_out === 0 || M.avail_in === 0 && (D === c || D === A)) && (this.options.to === "string" ? this.onData(u.buf2binstring(f.shrinkBuf(M.output, M.next_out))) : this.onData(f.shrinkBuf(M.output, M.next_out)));
              } while ((M.avail_in > 0 || M.avail_out === 0) && T !== b);
              return D === c ? (T = n.deflateEnd(this.strm), this.onEnd(T), this.ended = !0, T === C) : (D === A && (this.onEnd(C), M.avail_out = 0), !0);
            }, w.prototype.onData = function(l) {
              this.chunks.push(l);
            }, w.prototype.onEnd = function(l) {
              l === C && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = f.flattenChunks(this.chunks)), this.chunks = [], this.err = l, this.msg = this.strm.msg;
            };
            function p(l, g) {
              var M = new w(g);
              if (M.push(l, !0), M.err)
                throw M.msg || y[M.err];
              return M.result;
            }
            function v(l, g) {
              return g = g || {}, g.raw = !0, p(l, g);
            }
            function a(l, g) {
              return g = g || {}, g.gzip = !0, p(l, g);
            }
            e.Deflate = w, e.deflate = p, e.deflateRaw = v, e.gzip = a;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/inflate.js": (
          /*!***************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/inflate.js ***!
            \***************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ./zlib/inflate */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js"
            ), f = t(
              /*! ./utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), u = t(
              /*! ./utils/strings */
              "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js"
            ), y = t(
              /*! ./zlib/constants */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js"
            ), h = t(
              /*! ./zlib/messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), _ = t(
              /*! ./zlib/zstream */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js"
            ), E = t(
              /*! ./zlib/gzheader */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js"
            ), c = Object.prototype.toString;
            function C(S) {
              if (!(this instanceof C))
                return new C(S);
              this.options = f.assign({
                chunkSize: 16384,
                windowBits: 0,
                to: ""
              }, S || {});
              var s = this.options;
              s.raw && s.windowBits >= 0 && s.windowBits < 16 && (s.windowBits = -s.windowBits, s.windowBits === 0 && (s.windowBits = -15)), s.windowBits >= 0 && s.windowBits < 16 && !(S && S.windowBits) && (s.windowBits += 32), s.windowBits > 15 && s.windowBits < 48 && (s.windowBits & 15 || (s.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new _(), this.strm.avail_out = 0;
              var o = n.inflateInit2(
                this.strm,
                s.windowBits
              );
              if (o !== y.Z_OK)
                throw new Error(h[o]);
              if (this.header = new E(), n.inflateGetHeader(this.strm, this.header), s.dictionary && (typeof s.dictionary == "string" ? s.dictionary = u.string2buf(s.dictionary) : c.call(s.dictionary) === "[object ArrayBuffer]" && (s.dictionary = new Uint8Array(s.dictionary)), s.raw && (o = n.inflateSetDictionary(this.strm, s.dictionary), o !== y.Z_OK)))
                throw new Error(h[o]);
            }
            C.prototype.push = function(S, s) {
              var o = this.strm, w = this.options.chunkSize, p = this.options.dictionary, v, a, l, g, M, L = !1;
              if (this.ended)
                return !1;
              a = s === ~~s ? s : s === !0 ? y.Z_FINISH : y.Z_NO_FLUSH, typeof S == "string" ? o.input = u.binstring2buf(S) : c.call(S) === "[object ArrayBuffer]" ? o.input = new Uint8Array(S) : o.input = S, o.next_in = 0, o.avail_in = o.input.length;
              do {
                if (o.avail_out === 0 && (o.output = new f.Buf8(w), o.next_out = 0, o.avail_out = w), v = n.inflate(o, y.Z_NO_FLUSH), v === y.Z_NEED_DICT && p && (v = n.inflateSetDictionary(this.strm, p)), v === y.Z_BUF_ERROR && L === !0 && (v = y.Z_OK, L = !1), v !== y.Z_STREAM_END && v !== y.Z_OK)
                  return this.onEnd(v), this.ended = !0, !1;
                o.next_out && (o.avail_out === 0 || v === y.Z_STREAM_END || o.avail_in === 0 && (a === y.Z_FINISH || a === y.Z_SYNC_FLUSH)) && (this.options.to === "string" ? (l = u.utf8border(o.output, o.next_out), g = o.next_out - l, M = u.buf2string(o.output, l), o.next_out = g, o.avail_out = w - g, g && f.arraySet(o.output, o.output, l, g, 0), this.onData(M)) : this.onData(f.shrinkBuf(o.output, o.next_out))), o.avail_in === 0 && o.avail_out === 0 && (L = !0);
              } while ((o.avail_in > 0 || o.avail_out === 0) && v !== y.Z_STREAM_END);
              return v === y.Z_STREAM_END && (a = y.Z_FINISH), a === y.Z_FINISH ? (v = n.inflateEnd(this.strm), this.onEnd(v), this.ended = !0, v === y.Z_OK) : (a === y.Z_SYNC_FLUSH && (this.onEnd(y.Z_OK), o.avail_out = 0), !0);
            }, C.prototype.onData = function(S) {
              this.chunks.push(S);
            }, C.prototype.onEnd = function(S) {
              S === y.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = f.flattenChunks(this.chunks)), this.chunks = [], this.err = S, this.msg = this.strm.msg;
            };
            function b(S, s) {
              var o = new C(s);
              if (o.push(S, !0), o.err)
                throw o.msg || h[o.err];
              return o.result;
            }
            function A(S, s) {
              return s = s || {}, s.raw = !0, b(S, s);
            }
            e.Inflate = C, e.inflate = b, e.inflateRaw = A, e.ungzip = b;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/common.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/common.js ***!
            \********************************************************************/
          /***/
          (r, e) => {
            var t = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
            function n(y, h) {
              return Object.prototype.hasOwnProperty.call(y, h);
            }
            e.assign = function(y) {
              for (var h = Array.prototype.slice.call(arguments, 1); h.length; ) {
                var _ = h.shift();
                if (_) {
                  if (typeof _ != "object")
                    throw new TypeError(_ + "must be non-object");
                  for (var E in _)
                    n(_, E) && (y[E] = _[E]);
                }
              }
              return y;
            }, e.shrinkBuf = function(y, h) {
              return y.length === h ? y : y.subarray ? y.subarray(0, h) : (y.length = h, y);
            };
            var f = {
              arraySet: function(y, h, _, E, c) {
                if (h.subarray && y.subarray) {
                  y.set(h.subarray(_, _ + E), c);
                  return;
                }
                for (var C = 0; C < E; C++)
                  y[c + C] = h[_ + C];
              },
              // Join array of chunks to single array.
              flattenChunks: function(y) {
                var h, _, E, c, C, b;
                for (E = 0, h = 0, _ = y.length; h < _; h++)
                  E += y[h].length;
                for (b = new Uint8Array(E), c = 0, h = 0, _ = y.length; h < _; h++)
                  C = y[h], b.set(C, c), c += C.length;
                return b;
              }
            }, u = {
              arraySet: function(y, h, _, E, c) {
                for (var C = 0; C < E; C++)
                  y[c + C] = h[_ + C];
              },
              // Join array of chunks to single array.
              flattenChunks: function(y) {
                return [].concat.apply([], y);
              }
            };
            e.setTyped = function(y) {
              y ? (e.Buf8 = Uint8Array, e.Buf16 = Uint16Array, e.Buf32 = Int32Array, e.assign(e, f)) : (e.Buf8 = Array, e.Buf16 = Array, e.Buf32 = Array, e.assign(e, u));
            }, e.setTyped(t);
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/utils/strings.js ***!
            \*********************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ./common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), f = !0, u = !0;
            try {
              String.fromCharCode.apply(null, [0]);
            } catch {
              f = !1;
            }
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              u = !1;
            }
            for (var y = new n.Buf8(256), h = 0; h < 256; h++)
              y[h] = h >= 252 ? 6 : h >= 248 ? 5 : h >= 240 ? 4 : h >= 224 ? 3 : h >= 192 ? 2 : 1;
            y[254] = y[254] = 1, e.string2buf = function(E) {
              var c, C, b, A, S, s = E.length, o = 0;
              for (A = 0; A < s; A++)
                C = E.charCodeAt(A), (C & 64512) === 55296 && A + 1 < s && (b = E.charCodeAt(A + 1), (b & 64512) === 56320 && (C = 65536 + (C - 55296 << 10) + (b - 56320), A++)), o += C < 128 ? 1 : C < 2048 ? 2 : C < 65536 ? 3 : 4;
              for (c = new n.Buf8(o), S = 0, A = 0; S < o; A++)
                C = E.charCodeAt(A), (C & 64512) === 55296 && A + 1 < s && (b = E.charCodeAt(A + 1), (b & 64512) === 56320 && (C = 65536 + (C - 55296 << 10) + (b - 56320), A++)), C < 128 ? c[S++] = C : C < 2048 ? (c[S++] = 192 | C >>> 6, c[S++] = 128 | C & 63) : C < 65536 ? (c[S++] = 224 | C >>> 12, c[S++] = 128 | C >>> 6 & 63, c[S++] = 128 | C & 63) : (c[S++] = 240 | C >>> 18, c[S++] = 128 | C >>> 12 & 63, c[S++] = 128 | C >>> 6 & 63, c[S++] = 128 | C & 63);
              return c;
            };
            function _(E, c) {
              if (c < 65534 && (E.subarray && u || !E.subarray && f))
                return String.fromCharCode.apply(null, n.shrinkBuf(E, c));
              for (var C = "", b = 0; b < c; b++)
                C += String.fromCharCode(E[b]);
              return C;
            }
            e.buf2binstring = function(E) {
              return _(E, E.length);
            }, e.binstring2buf = function(E) {
              for (var c = new n.Buf8(E.length), C = 0, b = c.length; C < b; C++)
                c[C] = E.charCodeAt(C);
              return c;
            }, e.buf2string = function(E, c) {
              var C, b, A, S, s = c || E.length, o = new Array(s * 2);
              for (b = 0, C = 0; C < s; ) {
                if (A = E[C++], A < 128) {
                  o[b++] = A;
                  continue;
                }
                if (S = y[A], S > 4) {
                  o[b++] = 65533, C += S - 1;
                  continue;
                }
                for (A &= S === 2 ? 31 : S === 3 ? 15 : 7; S > 1 && C < s; )
                  A = A << 6 | E[C++] & 63, S--;
                if (S > 1) {
                  o[b++] = 65533;
                  continue;
                }
                A < 65536 ? o[b++] = A : (A -= 65536, o[b++] = 55296 | A >> 10 & 1023, o[b++] = 56320 | A & 1023);
              }
              return _(o, b);
            }, e.utf8border = function(E, c) {
              var C;
              for (c = c || E.length, c > E.length && (c = E.length), C = c - 1; C >= 0 && (E[C] & 192) === 128; )
                C--;
              return C < 0 || C === 0 ? c : C + y[E[C]] > c ? C : c;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js ***!
            \********************************************************************/
          /***/
          (r) => {
            function e(t, n, f, u) {
              for (var y = t & 65535 | 0, h = t >>> 16 & 65535 | 0, _ = 0; f !== 0; ) {
                _ = f > 2e3 ? 2e3 : f, f -= _;
                do
                  y = y + n[u++] | 0, h = h + y | 0;
                while (--_);
                y %= 65521, h %= 65521;
              }
              return y | h << 16 | 0;
            }
            r.exports = e;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js": (
          /*!**********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js ***!
            \**********************************************************************/
          /***/
          (r) => {
            r.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 ***!
            \******************************************************************/
          /***/
          (r) => {
            function e() {
              for (var f, u = [], y = 0; y < 256; y++) {
                f = y;
                for (var h = 0; h < 8; h++)
                  f = f & 1 ? 3988292384 ^ f >>> 1 : f >>> 1;
                u[y] = f;
              }
              return u;
            }
            var t = e();
            function n(f, u, y, h) {
              var _ = t, E = h + y;
              f ^= -1;
              for (var c = h; c < E; c++)
                f = f >>> 8 ^ _[(f ^ u[c]) & 255];
              return f ^ -1;
            }
            r.exports = n;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js ***!
            \********************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), f = t(
              /*! ./trees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js"
            ), u = t(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), y = t(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), h = t(
              /*! ./messages */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js"
            ), _ = 0, E = 1, c = 3, C = 4, b = 5, A = 0, S = 1, s = -2, o = -3, w = -5, p = -1, v = 1, a = 2, l = 3, g = 4, M = 0, L = 2, T = 8, D = 9, I = 15, z = 8, P = 29, B = 256, F = B + 1 + P, N = 30, $ = 19, k = 2 * F + 1, G = 15, H = 3, U = 258, V = U + H + 1, Q = 32, ae = 42, oe = 69, q = 73, me = 91, ne = 103, fe = 113, Ce = 666, Me = 1, Te = 2, se = 3, pe = 4, we = 3;
            function ke(R, be) {
              return R.msg = h[be], be;
            }
            function Ue(R) {
              return (R << 1) - (R > 4 ? 9 : 0);
            }
            function Ne(R) {
              for (var be = R.length; --be >= 0; )
                R[be] = 0;
            }
            function Be(R) {
              var be = R.state, Ee = be.pending;
              Ee > R.avail_out && (Ee = R.avail_out), Ee !== 0 && (n.arraySet(R.output, be.pending_buf, be.pending_out, Ee, R.next_out), R.next_out += Ee, be.pending_out += Ee, R.total_out += Ee, R.avail_out -= Ee, be.pending -= Ee, be.pending === 0 && (be.pending_out = 0));
            }
            function ue(R, be) {
              f._tr_flush_block(R, R.block_start >= 0 ? R.block_start : -1, R.strstart - R.block_start, be), R.block_start = R.strstart, Be(R.strm);
            }
            function ye(R, be) {
              R.pending_buf[R.pending++] = be;
            }
            function ge(R, be) {
              R.pending_buf[R.pending++] = be >>> 8 & 255, R.pending_buf[R.pending++] = be & 255;
            }
            function Se(R, be, Ee, X) {
              var le = R.avail_in;
              return le > X && (le = X), le === 0 ? 0 : (R.avail_in -= le, n.arraySet(be, R.input, R.next_in, le, Ee), R.state.wrap === 1 ? R.adler = u(R.adler, be, le, Ee) : R.state.wrap === 2 && (R.adler = y(R.adler, be, le, Ee)), R.next_in += le, R.total_in += le, le);
            }
            function ze(R, be) {
              var Ee = R.max_chain_length, X = R.strstart, le, Le, Ze = R.prev_length, Ke = R.nice_match, je = R.strstart > R.w_size - V ? R.strstart - (R.w_size - V) : 0, Je = R.window, Lt = R.w_mask, rt = R.prev, it = R.strstart + U, tt = Je[X + Ze - 1], Et = Je[X + Ze];
              R.prev_length >= R.good_match && (Ee >>= 2), Ke > R.lookahead && (Ke = R.lookahead);
              do
                if (le = be, !(Je[le + Ze] !== Et || Je[le + Ze - 1] !== tt || Je[le] !== Je[X] || Je[++le] !== Je[X + 1])) {
                  X += 2, le++;
                  do
                    ;
                  while (Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && Je[++X] === Je[++le] && X < it);
                  if (Le = U - (it - X), X = it - U, Le > Ze) {
                    if (R.match_start = be, Ze = Le, Le >= Ke)
                      break;
                    tt = Je[X + Ze - 1], Et = Je[X + Ze];
                  }
                }
              while ((be = rt[be & Lt]) > je && --Ee !== 0);
              return Ze <= R.lookahead ? Ze : R.lookahead;
            }
            function He(R) {
              var be = R.w_size, Ee, X, le, Le, Ze;
              do {
                if (Le = R.window_size - R.lookahead - R.strstart, R.strstart >= be + (be - V)) {
                  n.arraySet(R.window, R.window, be, be, 0), R.match_start -= be, R.strstart -= be, R.block_start -= be, X = R.hash_size, Ee = X;
                  do
                    le = R.head[--Ee], R.head[Ee] = le >= be ? le - be : 0;
                  while (--X);
                  X = be, Ee = X;
                  do
                    le = R.prev[--Ee], R.prev[Ee] = le >= be ? le - be : 0;
                  while (--X);
                  Le += be;
                }
                if (R.strm.avail_in === 0)
                  break;
                if (X = Se(R.strm, R.window, R.strstart + R.lookahead, Le), R.lookahead += X, R.lookahead + R.insert >= H)
                  for (Ze = R.strstart - R.insert, R.ins_h = R.window[Ze], R.ins_h = (R.ins_h << R.hash_shift ^ R.window[Ze + 1]) & R.hash_mask; R.insert && (R.ins_h = (R.ins_h << R.hash_shift ^ R.window[Ze + H - 1]) & R.hash_mask, R.prev[Ze & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = Ze, Ze++, R.insert--, !(R.lookahead + R.insert < H)); )
                    ;
              } while (R.lookahead < V && R.strm.avail_in !== 0);
            }
            function We(R, be) {
              var Ee = 65535;
              for (Ee > R.pending_buf_size - 5 && (Ee = R.pending_buf_size - 5); ; ) {
                if (R.lookahead <= 1) {
                  if (He(R), R.lookahead === 0 && be === _)
                    return Me;
                  if (R.lookahead === 0)
                    break;
                }
                R.strstart += R.lookahead, R.lookahead = 0;
                var X = R.block_start + Ee;
                if ((R.strstart === 0 || R.strstart >= X) && (R.lookahead = R.strstart - X, R.strstart = X, ue(R, !1), R.strm.avail_out === 0) || R.strstart - R.block_start >= R.w_size - V && (ue(R, !1), R.strm.avail_out === 0))
                  return Me;
              }
              return R.insert = 0, be === C ? (ue(R, !0), R.strm.avail_out === 0 ? se : pe) : (R.strstart > R.block_start && (ue(R, !1), R.strm.avail_out === 0), Me);
            }
            function Y(R, be) {
              for (var Ee, X; ; ) {
                if (R.lookahead < V) {
                  if (He(R), R.lookahead < V && be === _)
                    return Me;
                  if (R.lookahead === 0)
                    break;
                }
                if (Ee = 0, R.lookahead >= H && (R.ins_h = (R.ins_h << R.hash_shift ^ R.window[R.strstart + H - 1]) & R.hash_mask, Ee = R.prev[R.strstart & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = R.strstart), Ee !== 0 && R.strstart - Ee <= R.w_size - V && (R.match_length = ze(R, Ee)), R.match_length >= H)
                  if (X = f._tr_tally(R, R.strstart - R.match_start, R.match_length - H), R.lookahead -= R.match_length, R.match_length <= R.max_lazy_match && R.lookahead >= H) {
                    R.match_length--;
                    do
                      R.strstart++, R.ins_h = (R.ins_h << R.hash_shift ^ R.window[R.strstart + H - 1]) & R.hash_mask, Ee = R.prev[R.strstart & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = R.strstart;
                    while (--R.match_length !== 0);
                    R.strstart++;
                  } else
                    R.strstart += R.match_length, R.match_length = 0, R.ins_h = R.window[R.strstart], R.ins_h = (R.ins_h << R.hash_shift ^ R.window[R.strstart + 1]) & R.hash_mask;
                else
                  X = f._tr_tally(R, 0, R.window[R.strstart]), R.lookahead--, R.strstart++;
                if (X && (ue(R, !1), R.strm.avail_out === 0))
                  return Me;
              }
              return R.insert = R.strstart < H - 1 ? R.strstart : H - 1, be === C ? (ue(R, !0), R.strm.avail_out === 0 ? se : pe) : R.last_lit && (ue(R, !1), R.strm.avail_out === 0) ? Me : Te;
            }
            function K(R, be) {
              for (var Ee, X, le; ; ) {
                if (R.lookahead < V) {
                  if (He(R), R.lookahead < V && be === _)
                    return Me;
                  if (R.lookahead === 0)
                    break;
                }
                if (Ee = 0, R.lookahead >= H && (R.ins_h = (R.ins_h << R.hash_shift ^ R.window[R.strstart + H - 1]) & R.hash_mask, Ee = R.prev[R.strstart & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = R.strstart), R.prev_length = R.match_length, R.prev_match = R.match_start, R.match_length = H - 1, Ee !== 0 && R.prev_length < R.max_lazy_match && R.strstart - Ee <= R.w_size - V && (R.match_length = ze(R, Ee), R.match_length <= 5 && (R.strategy === v || R.match_length === H && R.strstart - R.match_start > 4096) && (R.match_length = H - 1)), R.prev_length >= H && R.match_length <= R.prev_length) {
                  le = R.strstart + R.lookahead - H, X = f._tr_tally(R, R.strstart - 1 - R.prev_match, R.prev_length - H), R.lookahead -= R.prev_length - 1, R.prev_length -= 2;
                  do
                    ++R.strstart <= le && (R.ins_h = (R.ins_h << R.hash_shift ^ R.window[R.strstart + H - 1]) & R.hash_mask, Ee = R.prev[R.strstart & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = R.strstart);
                  while (--R.prev_length !== 0);
                  if (R.match_available = 0, R.match_length = H - 1, R.strstart++, X && (ue(R, !1), R.strm.avail_out === 0))
                    return Me;
                } else if (R.match_available) {
                  if (X = f._tr_tally(R, 0, R.window[R.strstart - 1]), X && ue(R, !1), R.strstart++, R.lookahead--, R.strm.avail_out === 0)
                    return Me;
                } else
                  R.match_available = 1, R.strstart++, R.lookahead--;
              }
              return R.match_available && (X = f._tr_tally(R, 0, R.window[R.strstart - 1]), R.match_available = 0), R.insert = R.strstart < H - 1 ? R.strstart : H - 1, be === C ? (ue(R, !0), R.strm.avail_out === 0 ? se : pe) : R.last_lit && (ue(R, !1), R.strm.avail_out === 0) ? Me : Te;
            }
            function ee(R, be) {
              for (var Ee, X, le, Le, Ze = R.window; ; ) {
                if (R.lookahead <= U) {
                  if (He(R), R.lookahead <= U && be === _)
                    return Me;
                  if (R.lookahead === 0)
                    break;
                }
                if (R.match_length = 0, R.lookahead >= H && R.strstart > 0 && (le = R.strstart - 1, X = Ze[le], X === Ze[++le] && X === Ze[++le] && X === Ze[++le])) {
                  Le = R.strstart + U;
                  do
                    ;
                  while (X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && X === Ze[++le] && le < Le);
                  R.match_length = U - (Le - le), R.match_length > R.lookahead && (R.match_length = R.lookahead);
                }
                if (R.match_length >= H ? (Ee = f._tr_tally(R, 1, R.match_length - H), R.lookahead -= R.match_length, R.strstart += R.match_length, R.match_length = 0) : (Ee = f._tr_tally(R, 0, R.window[R.strstart]), R.lookahead--, R.strstart++), Ee && (ue(R, !1), R.strm.avail_out === 0))
                  return Me;
              }
              return R.insert = 0, be === C ? (ue(R, !0), R.strm.avail_out === 0 ? se : pe) : R.last_lit && (ue(R, !1), R.strm.avail_out === 0) ? Me : Te;
            }
            function de(R, be) {
              for (var Ee; ; ) {
                if (R.lookahead === 0 && (He(R), R.lookahead === 0)) {
                  if (be === _)
                    return Me;
                  break;
                }
                if (R.match_length = 0, Ee = f._tr_tally(R, 0, R.window[R.strstart]), R.lookahead--, R.strstart++, Ee && (ue(R, !1), R.strm.avail_out === 0))
                  return Me;
              }
              return R.insert = 0, be === C ? (ue(R, !0), R.strm.avail_out === 0 ? se : pe) : R.last_lit && (ue(R, !1), R.strm.avail_out === 0) ? Me : Te;
            }
            function ve(R, be, Ee, X, le) {
              this.good_length = R, this.max_lazy = be, this.nice_length = Ee, this.max_chain = X, this.func = le;
            }
            var Ie;
            Ie = [
              /*      good lazy nice chain */
              new ve(0, 0, 0, 0, We),
              /* 0 store only */
              new ve(4, 4, 8, 4, Y),
              /* 1 max speed, no lazy matches */
              new ve(4, 5, 16, 8, Y),
              /* 2 */
              new ve(4, 6, 32, 32, Y),
              /* 3 */
              new ve(4, 4, 16, 16, K),
              /* 4 lazy matches */
              new ve(8, 16, 32, 32, K),
              /* 5 */
              new ve(8, 16, 128, 128, K),
              /* 6 */
              new ve(8, 32, 128, 256, K),
              /* 7 */
              new ve(32, 128, 258, 1024, K),
              /* 8 */
              new ve(32, 258, 258, 4096, K)
              /* 9 max compression */
            ];
            function Re(R) {
              R.window_size = 2 * R.w_size, Ne(R.head), R.max_lazy_match = Ie[R.level].max_lazy, R.good_match = Ie[R.level].good_length, R.nice_match = Ie[R.level].nice_length, R.max_chain_length = Ie[R.level].max_chain, R.strstart = 0, R.block_start = 0, R.lookahead = 0, R.insert = 0, R.match_length = R.prev_length = H - 1, R.match_available = 0, R.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 = T, 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 n.Buf16(k * 2), this.dyn_dtree = new n.Buf16((2 * N + 1) * 2), this.bl_tree = new n.Buf16((2 * $ + 1) * 2), Ne(this.dyn_ltree), Ne(this.dyn_dtree), Ne(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new n.Buf16(G + 1), this.heap = new n.Buf16(2 * F + 1), Ne(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new n.Buf16(2 * F + 1), Ne(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 ce(R) {
              var be;
              return !R || !R.state ? ke(R, s) : (R.total_in = R.total_out = 0, R.data_type = L, be = R.state, be.pending = 0, be.pending_out = 0, be.wrap < 0 && (be.wrap = -be.wrap), be.status = be.wrap ? ae : fe, R.adler = be.wrap === 2 ? 0 : 1, be.last_flush = _, f._tr_init(be), A);
            }
            function Ae(R) {
              var be = ce(R);
              return be === A && Re(R.state), be;
            }
            function Fe(R, be) {
              return !R || !R.state || R.state.wrap !== 2 ? s : (R.state.gzhead = be, A);
            }
            function he(R, be, Ee, X, le, Le) {
              if (!R)
                return s;
              var Ze = 1;
              if (be === p && (be = 6), X < 0 ? (Ze = 0, X = -X) : X > 15 && (Ze = 2, X -= 16), le < 1 || le > D || Ee !== T || X < 8 || X > 15 || be < 0 || be > 9 || Le < 0 || Le > g)
                return ke(R, s);
              X === 8 && (X = 9);
              var Ke = new Z();
              return R.state = Ke, Ke.strm = R, Ke.wrap = Ze, Ke.gzhead = null, Ke.w_bits = X, Ke.w_size = 1 << Ke.w_bits, Ke.w_mask = Ke.w_size - 1, Ke.hash_bits = le + 7, Ke.hash_size = 1 << Ke.hash_bits, Ke.hash_mask = Ke.hash_size - 1, Ke.hash_shift = ~~((Ke.hash_bits + H - 1) / H), Ke.window = new n.Buf8(Ke.w_size * 2), Ke.head = new n.Buf16(Ke.hash_size), Ke.prev = new n.Buf16(Ke.w_size), Ke.lit_bufsize = 1 << le + 6, Ke.pending_buf_size = Ke.lit_bufsize * 4, Ke.pending_buf = new n.Buf8(Ke.pending_buf_size), Ke.d_buf = 1 * Ke.lit_bufsize, Ke.l_buf = 3 * Ke.lit_bufsize, Ke.level = be, Ke.strategy = Le, Ke.method = Ee, Ae(R);
            }
            function Oe(R, be) {
              return he(R, be, T, I, z, M);
            }
            function j(R, be) {
              var Ee, X, le, Le;
              if (!R || !R.state || be > b || be < 0)
                return R ? ke(R, s) : s;
              if (X = R.state, !R.output || !R.input && R.avail_in !== 0 || X.status === Ce && be !== C)
                return ke(R, R.avail_out === 0 ? w : s);
              if (X.strm = R, Ee = X.last_flush, X.last_flush = be, X.status === ae)
                if (X.wrap === 2)
                  R.adler = 0, ye(X, 31), ye(X, 139), ye(X, 8), X.gzhead ? (ye(
                    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)
                  ), ye(X, X.gzhead.time & 255), ye(X, X.gzhead.time >> 8 & 255), ye(X, X.gzhead.time >> 16 & 255), ye(X, X.gzhead.time >> 24 & 255), ye(X, X.level === 9 ? 2 : X.strategy >= a || X.level < 2 ? 4 : 0), ye(X, X.gzhead.os & 255), X.gzhead.extra && X.gzhead.extra.length && (ye(X, X.gzhead.extra.length & 255), ye(X, X.gzhead.extra.length >> 8 & 255)), X.gzhead.hcrc && (R.adler = y(R.adler, X.pending_buf, X.pending, 0)), X.gzindex = 0, X.status = oe) : (ye(X, 0), ye(X, 0), ye(X, 0), ye(X, 0), ye(X, 0), ye(X, X.level === 9 ? 2 : X.strategy >= a || X.level < 2 ? 4 : 0), ye(X, we), X.status = fe);
                else {
                  var Ze = T + (X.w_bits - 8 << 4) << 8, Ke = -1;
                  X.strategy >= a || X.level < 2 ? Ke = 0 : X.level < 6 ? Ke = 1 : X.level === 6 ? Ke = 2 : Ke = 3, Ze |= Ke << 6, X.strstart !== 0 && (Ze |= Q), Ze += 31 - Ze % 31, X.status = fe, ge(X, Ze), X.strstart !== 0 && (ge(X, R.adler >>> 16), ge(X, R.adler & 65535)), R.adler = 1;
                }
              if (X.status === oe)
                if (X.gzhead.extra) {
                  for (le = X.pending; X.gzindex < (X.gzhead.extra.length & 65535) && !(X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), Be(R), le = X.pending, X.pending === X.pending_buf_size)); )
                    ye(X, X.gzhead.extra[X.gzindex] & 255), X.gzindex++;
                  X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), X.gzindex === X.gzhead.extra.length && (X.gzindex = 0, X.status = q);
                } else
                  X.status = q;
              if (X.status === q)
                if (X.gzhead.name) {
                  le = X.pending;
                  do {
                    if (X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), Be(R), le = X.pending, X.pending === X.pending_buf_size)) {
                      Le = 1;
                      break;
                    }
                    X.gzindex < X.gzhead.name.length ? Le = X.gzhead.name.charCodeAt(X.gzindex++) & 255 : Le = 0, ye(X, Le);
                  } while (Le !== 0);
                  X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), Le === 0 && (X.gzindex = 0, X.status = me);
                } else
                  X.status = me;
              if (X.status === me)
                if (X.gzhead.comment) {
                  le = X.pending;
                  do {
                    if (X.pending === X.pending_buf_size && (X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), Be(R), le = X.pending, X.pending === X.pending_buf_size)) {
                      Le = 1;
                      break;
                    }
                    X.gzindex < X.gzhead.comment.length ? Le = X.gzhead.comment.charCodeAt(X.gzindex++) & 255 : Le = 0, ye(X, Le);
                  } while (Le !== 0);
                  X.gzhead.hcrc && X.pending > le && (R.adler = y(R.adler, X.pending_buf, X.pending - le, le)), Le === 0 && (X.status = ne);
                } else
                  X.status = ne;
              if (X.status === ne && (X.gzhead.hcrc ? (X.pending + 2 > X.pending_buf_size && Be(R), X.pending + 2 <= X.pending_buf_size && (ye(X, R.adler & 255), ye(X, R.adler >> 8 & 255), R.adler = 0, X.status = fe)) : X.status = fe), X.pending !== 0) {
                if (Be(R), R.avail_out === 0)
                  return X.last_flush = -1, A;
              } else if (R.avail_in === 0 && Ue(be) <= Ue(Ee) && be !== C)
                return ke(R, w);
              if (X.status === Ce && R.avail_in !== 0)
                return ke(R, w);
              if (R.avail_in !== 0 || X.lookahead !== 0 || be !== _ && X.status !== Ce) {
                var je = X.strategy === a ? de(X, be) : X.strategy === l ? ee(X, be) : Ie[X.level].func(X, be);
                if ((je === se || je === pe) && (X.status = Ce), je === Me || je === se)
                  return R.avail_out === 0 && (X.last_flush = -1), A;
                if (je === Te && (be === E ? f._tr_align(X) : be !== b && (f._tr_stored_block(X, 0, 0, !1), be === c && (Ne(X.head), X.lookahead === 0 && (X.strstart = 0, X.block_start = 0, X.insert = 0))), Be(R), R.avail_out === 0))
                  return X.last_flush = -1, A;
              }
              return be !== C ? A : X.wrap <= 0 ? S : (X.wrap === 2 ? (ye(X, R.adler & 255), ye(X, R.adler >> 8 & 255), ye(X, R.adler >> 16 & 255), ye(X, R.adler >> 24 & 255), ye(X, R.total_in & 255), ye(X, R.total_in >> 8 & 255), ye(X, R.total_in >> 16 & 255), ye(X, R.total_in >> 24 & 255)) : (ge(X, R.adler >>> 16), ge(X, R.adler & 65535)), Be(R), X.wrap > 0 && (X.wrap = -X.wrap), X.pending !== 0 ? A : S);
            }
            function $e(R) {
              var be;
              return !R || !R.state ? s : (be = R.state.status, be !== ae && be !== oe && be !== q && be !== me && be !== ne && be !== fe && be !== Ce ? ke(R, s) : (R.state = null, be === fe ? ke(R, o) : A));
            }
            function Ve(R, be) {
              var Ee = be.length, X, le, Le, Ze, Ke, je, Je, Lt;
              if (!R || !R.state || (X = R.state, Ze = X.wrap, Ze === 2 || Ze === 1 && X.status !== ae || X.lookahead))
                return s;
              for (Ze === 1 && (R.adler = u(R.adler, be, Ee, 0)), X.wrap = 0, Ee >= X.w_size && (Ze === 0 && (Ne(X.head), X.strstart = 0, X.block_start = 0, X.insert = 0), Lt = new n.Buf8(X.w_size), n.arraySet(Lt, be, Ee - X.w_size, X.w_size, 0), be = Lt, Ee = X.w_size), Ke = R.avail_in, je = R.next_in, Je = R.input, R.avail_in = Ee, R.next_in = 0, R.input = be, He(X); X.lookahead >= H; ) {
                le = X.strstart, Le = X.lookahead - (H - 1);
                do
                  X.ins_h = (X.ins_h << X.hash_shift ^ X.window[le + H - 1]) & X.hash_mask, X.prev[le & X.w_mask] = X.head[X.ins_h], X.head[X.ins_h] = le, le++;
                while (--Le);
                X.strstart = le, X.lookahead = H - 1, He(X);
              }
              return X.strstart += X.lookahead, X.block_start = X.strstart, X.insert = X.lookahead, X.lookahead = 0, X.match_length = X.prev_length = H - 1, X.match_available = 0, R.next_in = je, R.input = Je, R.avail_in = Ke, X.wrap = Ze, A;
            }
            e.deflateInit = Oe, e.deflateInit2 = he, e.deflateReset = Ae, e.deflateResetKeep = ce, e.deflateSetHeader = Fe, e.deflate = j, e.deflateEnd = $e, e.deflateSetDictionary = Ve, e.deflateInfo = "pako deflate (from Nodeca project)";
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js ***!
            \*********************************************************************/
          /***/
          (r) => {
            function e() {
              this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
            }
            r.exports = e;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js ***!
            \********************************************************************/
          /***/
          (r) => {
            var e = 30, t = 12;
            r.exports = function(f, u) {
              var y, h, _, E, c, C, b, A, S, s, o, w, p, v, a, l, g, M, L, T, D, I, z, P, B;
              y = f.state, h = f.next_in, P = f.input, _ = h + (f.avail_in - 5), E = f.next_out, B = f.output, c = E - (u - f.avail_out), C = E + (f.avail_out - 257), b = y.dmax, A = y.wsize, S = y.whave, s = y.wnext, o = y.window, w = y.hold, p = y.bits, v = y.lencode, a = y.distcode, l = (1 << y.lenbits) - 1, g = (1 << y.distbits) - 1;
              e:
                do {
                  p < 15 && (w += P[h++] << p, p += 8, w += P[h++] << p, p += 8), M = v[w & l];
                  t:
                    for (; ; ) {
                      if (L = M >>> 24, w >>>= L, p -= L, L = M >>> 16 & 255, L === 0)
                        B[E++] = M & 65535;
                      else if (L & 16) {
                        T = M & 65535, L &= 15, L && (p < L && (w += P[h++] << p, p += 8), T += w & (1 << L) - 1, w >>>= L, p -= L), p < 15 && (w += P[h++] << p, p += 8, w += P[h++] << p, p += 8), M = a[w & g];
                        r:
                          for (; ; ) {
                            if (L = M >>> 24, w >>>= L, p -= L, L = M >>> 16 & 255, L & 16) {
                              if (D = M & 65535, L &= 15, p < L && (w += P[h++] << p, p += 8, p < L && (w += P[h++] << p, p += 8)), D += w & (1 << L) - 1, D > b) {
                                f.msg = "invalid distance too far back", y.mode = e;
                                break e;
                              }
                              if (w >>>= L, p -= L, L = E - c, D > L) {
                                if (L = D - L, L > S && y.sane) {
                                  f.msg = "invalid distance too far back", y.mode = e;
                                  break e;
                                }
                                if (I = 0, z = o, s === 0) {
                                  if (I += A - L, L < T) {
                                    T -= L;
                                    do
                                      B[E++] = o[I++];
                                    while (--L);
                                    I = E - D, z = B;
                                  }
                                } else if (s < L) {
                                  if (I += A + s - L, L -= s, L < T) {
                                    T -= L;
                                    do
                                      B[E++] = o[I++];
                                    while (--L);
                                    if (I = 0, s < T) {
                                      L = s, T -= L;
                                      do
                                        B[E++] = o[I++];
                                      while (--L);
                                      I = E - D, z = B;
                                    }
                                  }
                                } else if (I += s - L, L < T) {
                                  T -= L;
                                  do
                                    B[E++] = o[I++];
                                  while (--L);
                                  I = E - D, z = B;
                                }
                                for (; T > 2; )
                                  B[E++] = z[I++], B[E++] = z[I++], B[E++] = z[I++], T -= 3;
                                T && (B[E++] = z[I++], T > 1 && (B[E++] = z[I++]));
                              } else {
                                I = E - D;
                                do
                                  B[E++] = B[I++], B[E++] = B[I++], B[E++] = B[I++], T -= 3;
                                while (T > 2);
                                T && (B[E++] = B[I++], T > 1 && (B[E++] = B[I++]));
                              }
                            } else if (L & 64) {
                              f.msg = "invalid distance code", y.mode = e;
                              break e;
                            } else {
                              M = a[(M & 65535) + (w & (1 << L) - 1)];
                              continue r;
                            }
                            break;
                          }
                      } else if (L & 64)
                        if (L & 32) {
                          y.mode = t;
                          break e;
                        } else {
                          f.msg = "invalid literal/length code", y.mode = e;
                          break e;
                        }
                      else {
                        M = v[(M & 65535) + (w & (1 << L) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (h < _ && E < C);
              T = p >> 3, h -= T, p -= T << 3, w &= (1 << p) - 1, f.next_in = h, f.next_out = E, f.avail_in = h < _ ? 5 + (_ - h) : 5 - (h - _), f.avail_out = E < C ? 257 + (C - E) : 257 - (E - C), y.hold = w, y.bits = p;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js ***!
            \********************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), f = t(
              /*! ./adler32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js"
            ), u = t(
              /*! ./crc32 */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js"
            ), y = t(
              /*! ./inffast */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js"
            ), h = t(
              /*! ./inftrees */
              "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js"
            ), _ = 0, E = 1, c = 2, C = 4, b = 5, A = 6, S = 0, s = 1, o = 2, w = -2, p = -3, v = -4, a = -5, l = 8, g = 1, M = 2, L = 3, T = 4, D = 5, I = 6, z = 7, P = 8, B = 9, F = 10, N = 11, $ = 12, k = 13, G = 14, H = 15, U = 16, V = 17, Q = 18, ae = 19, oe = 20, q = 21, me = 22, ne = 23, fe = 24, Ce = 25, Me = 26, Te = 27, se = 28, pe = 29, we = 30, ke = 31, Ue = 32, Ne = 852, Be = 592, ue = 15, ye = ue;
            function ge(he) {
              return (he >>> 24 & 255) + (he >>> 8 & 65280) + ((he & 65280) << 8) + ((he & 255) << 24);
            }
            function Se() {
              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 n.Buf16(320), this.work = new n.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
            }
            function ze(he) {
              var Oe;
              return !he || !he.state ? w : (Oe = he.state, he.total_in = he.total_out = Oe.total = 0, he.msg = "", Oe.wrap && (he.adler = Oe.wrap & 1), Oe.mode = g, Oe.last = 0, Oe.havedict = 0, Oe.dmax = 32768, Oe.head = null, Oe.hold = 0, Oe.bits = 0, Oe.lencode = Oe.lendyn = new n.Buf32(Ne), Oe.distcode = Oe.distdyn = new n.Buf32(Be), Oe.sane = 1, Oe.back = -1, S);
            }
            function He(he) {
              var Oe;
              return !he || !he.state ? w : (Oe = he.state, Oe.wsize = 0, Oe.whave = 0, Oe.wnext = 0, ze(he));
            }
            function We(he, Oe) {
              var j, $e;
              return !he || !he.state || ($e = he.state, Oe < 0 ? (j = 0, Oe = -Oe) : (j = (Oe >> 4) + 1, Oe < 48 && (Oe &= 15)), Oe && (Oe < 8 || Oe > 15)) ? w : ($e.window !== null && $e.wbits !== Oe && ($e.window = null), $e.wrap = j, $e.wbits = Oe, He(he));
            }
            function Y(he, Oe) {
              var j, $e;
              return he ? ($e = new Se(), he.state = $e, $e.window = null, j = We(he, Oe), j !== S && (he.state = null), j) : w;
            }
            function K(he) {
              return Y(he, ye);
            }
            var ee = !0, de, ve;
            function Ie(he) {
              if (ee) {
                var Oe;
                for (de = new n.Buf32(512), ve = new n.Buf32(32), Oe = 0; Oe < 144; )
                  he.lens[Oe++] = 8;
                for (; Oe < 256; )
                  he.lens[Oe++] = 9;
                for (; Oe < 280; )
                  he.lens[Oe++] = 7;
                for (; Oe < 288; )
                  he.lens[Oe++] = 8;
                for (h(E, he.lens, 0, 288, de, 0, he.work, { bits: 9 }), Oe = 0; Oe < 32; )
                  he.lens[Oe++] = 5;
                h(c, he.lens, 0, 32, ve, 0, he.work, { bits: 5 }), ee = !1;
              }
              he.lencode = de, he.lenbits = 9, he.distcode = ve, he.distbits = 5;
            }
            function Re(he, Oe, j, $e) {
              var Ve, R = he.state;
              return R.window === null && (R.wsize = 1 << R.wbits, R.wnext = 0, R.whave = 0, R.window = new n.Buf8(R.wsize)), $e >= R.wsize ? (n.arraySet(R.window, Oe, j - R.wsize, R.wsize, 0), R.wnext = 0, R.whave = R.wsize) : (Ve = R.wsize - R.wnext, Ve > $e && (Ve = $e), n.arraySet(R.window, Oe, j - $e, Ve, R.wnext), $e -= Ve, $e ? (n.arraySet(R.window, Oe, j - $e, $e, 0), R.wnext = $e, R.whave = R.wsize) : (R.wnext += Ve, R.wnext === R.wsize && (R.wnext = 0), R.whave < R.wsize && (R.whave += Ve))), 0;
            }
            function Z(he, Oe) {
              var j, $e, Ve, R, be, Ee, X, le, Le, Ze, Ke, je, Je, Lt, rt = 0, it, tt, Et, lt, wt, Pt, vt, bt, mt = new n.Buf8(4), Tt, Ot, 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 (!he || !he.state || !he.output || !he.input && he.avail_in !== 0)
                return w;
              j = he.state, j.mode === $ && (j.mode = k), be = he.next_out, Ve = he.output, X = he.avail_out, R = he.next_in, $e = he.input, Ee = he.avail_in, le = j.hold, Le = j.bits, Ze = Ee, Ke = X, bt = S;
              e:
                for (; ; )
                  switch (j.mode) {
                    case g:
                      if (j.wrap === 0) {
                        j.mode = k;
                        break;
                      }
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if (j.wrap & 2 && le === 35615) {
                        j.check = 0, mt[0] = le & 255, mt[1] = le >>> 8 & 255, j.check = u(j.check, mt, 2, 0), le = 0, Le = 0, j.mode = M;
                        break;
                      }
                      if (j.flags = 0, j.head && (j.head.done = !1), !(j.wrap & 1) || /* check if zlib header allowed */
                      (((le & 255) << 8) + (le >> 8)) % 31) {
                        he.msg = "incorrect header check", j.mode = we;
                        break;
                      }
                      if ((le & 15) !== l) {
                        he.msg = "unknown compression method", j.mode = we;
                        break;
                      }
                      if (le >>>= 4, Le -= 4, vt = (le & 15) + 8, j.wbits === 0)
                        j.wbits = vt;
                      else if (vt > j.wbits) {
                        he.msg = "invalid window size", j.mode = we;
                        break;
                      }
                      j.dmax = 1 << vt, he.adler = j.check = 1, j.mode = le & 512 ? F : $, le = 0, Le = 0;
                      break;
                    case M:
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if (j.flags = le, (j.flags & 255) !== l) {
                        he.msg = "unknown compression method", j.mode = we;
                        break;
                      }
                      if (j.flags & 57344) {
                        he.msg = "unknown header flags set", j.mode = we;
                        break;
                      }
                      j.head && (j.head.text = le >> 8 & 1), j.flags & 512 && (mt[0] = le & 255, mt[1] = le >>> 8 & 255, j.check = u(j.check, mt, 2, 0)), le = 0, Le = 0, j.mode = L;
                    case L:
                      for (; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      j.head && (j.head.time = le), j.flags & 512 && (mt[0] = le & 255, mt[1] = le >>> 8 & 255, mt[2] = le >>> 16 & 255, mt[3] = le >>> 24 & 255, j.check = u(j.check, mt, 4, 0)), le = 0, Le = 0, j.mode = T;
                    case T:
                      for (; Le < 16; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      j.head && (j.head.xflags = le & 255, j.head.os = le >> 8), j.flags & 512 && (mt[0] = le & 255, mt[1] = le >>> 8 & 255, j.check = u(j.check, mt, 2, 0)), le = 0, Le = 0, j.mode = D;
                    case D:
                      if (j.flags & 1024) {
                        for (; Le < 16; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        j.length = le, j.head && (j.head.extra_len = le), j.flags & 512 && (mt[0] = le & 255, mt[1] = le >>> 8 & 255, j.check = u(j.check, mt, 2, 0)), le = 0, Le = 0;
                      } else
                        j.head && (j.head.extra = null);
                      j.mode = I;
                    case I:
                      if (j.flags & 1024 && (je = j.length, je > Ee && (je = Ee), je && (j.head && (vt = j.head.extra_len - j.length, j.head.extra || (j.head.extra = new Array(j.head.extra_len)), n.arraySet(
                        j.head.extra,
                        $e,
                        R,
                        // 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
                      )), j.flags & 512 && (j.check = u(j.check, $e, je, R)), Ee -= je, R += je, j.length -= je), j.length))
                        break e;
                      j.length = 0, j.mode = z;
                    case z:
                      if (j.flags & 2048) {
                        if (Ee === 0)
                          break e;
                        je = 0;
                        do
                          vt = $e[R + je++], j.head && vt && j.length < 65536 && (j.head.name += String.fromCharCode(vt));
                        while (vt && je < Ee);
                        if (j.flags & 512 && (j.check = u(j.check, $e, je, R)), Ee -= je, R += je, vt)
                          break e;
                      } else
                        j.head && (j.head.name = null);
                      j.length = 0, j.mode = P;
                    case P:
                      if (j.flags & 4096) {
                        if (Ee === 0)
                          break e;
                        je = 0;
                        do
                          vt = $e[R + je++], j.head && vt && j.length < 65536 && (j.head.comment += String.fromCharCode(vt));
                        while (vt && je < Ee);
                        if (j.flags & 512 && (j.check = u(j.check, $e, je, R)), Ee -= je, R += je, vt)
                          break e;
                      } else
                        j.head && (j.head.comment = null);
                      j.mode = B;
                    case B:
                      if (j.flags & 512) {
                        for (; Le < 16; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        if (le !== (j.check & 65535)) {
                          he.msg = "header crc mismatch", j.mode = we;
                          break;
                        }
                        le = 0, Le = 0;
                      }
                      j.head && (j.head.hcrc = j.flags >> 9 & 1, j.head.done = !0), he.adler = j.check = 0, j.mode = $;
                      break;
                    case F:
                      for (; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      he.adler = j.check = ge(le), le = 0, Le = 0, j.mode = N;
                    case N:
                      if (j.havedict === 0)
                        return he.next_out = be, he.avail_out = X, he.next_in = R, he.avail_in = Ee, j.hold = le, j.bits = Le, o;
                      he.adler = j.check = 1, j.mode = $;
                    case $:
                      if (Oe === b || Oe === A)
                        break e;
                    case k:
                      if (j.last) {
                        le >>>= Le & 7, Le -= Le & 7, j.mode = Te;
                        break;
                      }
                      for (; Le < 3; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      switch (j.last = le & 1, le >>>= 1, Le -= 1, le & 3) {
                        case 0:
                          j.mode = G;
                          break;
                        case 1:
                          if (Ie(j), j.mode = oe, Oe === A) {
                            le >>>= 2, Le -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          j.mode = V;
                          break;
                        case 3:
                          he.msg = "invalid block type", j.mode = we;
                      }
                      le >>>= 2, Le -= 2;
                      break;
                    case G:
                      for (le >>>= Le & 7, Le -= Le & 7; Le < 32; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if ((le & 65535) !== (le >>> 16 ^ 65535)) {
                        he.msg = "invalid stored block lengths", j.mode = we;
                        break;
                      }
                      if (j.length = le & 65535, le = 0, Le = 0, j.mode = H, Oe === A)
                        break e;
                    case H:
                      j.mode = U;
                    case U:
                      if (je = j.length, je) {
                        if (je > Ee && (je = Ee), je > X && (je = X), je === 0)
                          break e;
                        n.arraySet(Ve, $e, R, je, be), Ee -= je, R += je, X -= je, be += je, j.length -= je;
                        break;
                      }
                      j.mode = $;
                      break;
                    case V:
                      for (; Le < 14; ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if (j.nlen = (le & 31) + 257, le >>>= 5, Le -= 5, j.ndist = (le & 31) + 1, le >>>= 5, Le -= 5, j.ncode = (le & 15) + 4, le >>>= 4, Le -= 4, j.nlen > 286 || j.ndist > 30) {
                        he.msg = "too many length or distance symbols", j.mode = we;
                        break;
                      }
                      j.have = 0, j.mode = Q;
                    case Q:
                      for (; j.have < j.ncode; ) {
                        for (; Le < 3; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        j.lens[Ft[j.have++]] = le & 7, le >>>= 3, Le -= 3;
                      }
                      for (; j.have < 19; )
                        j.lens[Ft[j.have++]] = 0;
                      if (j.lencode = j.lendyn, j.lenbits = 7, Tt = { bits: j.lenbits }, bt = h(_, j.lens, 0, 19, j.lencode, 0, j.work, Tt), j.lenbits = Tt.bits, bt) {
                        he.msg = "invalid code lengths set", j.mode = we;
                        break;
                      }
                      j.have = 0, j.mode = ae;
                    case ae:
                      for (; j.have < j.nlen + j.ndist; ) {
                        for (; rt = j.lencode[le & (1 << j.lenbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        if (Et < 16)
                          le >>>= it, Le -= it, j.lens[j.have++] = Et;
                        else {
                          if (Et === 16) {
                            for (Ot = it + 2; Le < Ot; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, le += $e[R++] << Le, Le += 8;
                            }
                            if (le >>>= it, Le -= it, j.have === 0) {
                              he.msg = "invalid bit length repeat", j.mode = we;
                              break;
                            }
                            vt = j.lens[j.have - 1], je = 3 + (le & 3), le >>>= 2, Le -= 2;
                          } else if (Et === 17) {
                            for (Ot = it + 3; Le < Ot; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, le += $e[R++] << Le, Le += 8;
                            }
                            le >>>= it, Le -= it, vt = 0, je = 3 + (le & 7), le >>>= 3, Le -= 3;
                          } else {
                            for (Ot = it + 7; Le < Ot; ) {
                              if (Ee === 0)
                                break e;
                              Ee--, le += $e[R++] << Le, Le += 8;
                            }
                            le >>>= it, Le -= it, vt = 0, je = 11 + (le & 127), le >>>= 7, Le -= 7;
                          }
                          if (j.have + je > j.nlen + j.ndist) {
                            he.msg = "invalid bit length repeat", j.mode = we;
                            break;
                          }
                          for (; je--; )
                            j.lens[j.have++] = vt;
                        }
                      }
                      if (j.mode === we)
                        break;
                      if (j.lens[256] === 0) {
                        he.msg = "invalid code -- missing end-of-block", j.mode = we;
                        break;
                      }
                      if (j.lenbits = 9, Tt = { bits: j.lenbits }, bt = h(E, j.lens, 0, j.nlen, j.lencode, 0, j.work, Tt), j.lenbits = Tt.bits, bt) {
                        he.msg = "invalid literal/lengths set", j.mode = we;
                        break;
                      }
                      if (j.distbits = 6, j.distcode = j.distdyn, Tt = { bits: j.distbits }, bt = h(c, j.lens, j.nlen, j.ndist, j.distcode, 0, j.work, Tt), j.distbits = Tt.bits, bt) {
                        he.msg = "invalid distances set", j.mode = we;
                        break;
                      }
                      if (j.mode = oe, Oe === A)
                        break e;
                    case oe:
                      j.mode = q;
                    case q:
                      if (Ee >= 6 && X >= 258) {
                        he.next_out = be, he.avail_out = X, he.next_in = R, he.avail_in = Ee, j.hold = le, j.bits = Le, y(he, Ke), be = he.next_out, Ve = he.output, X = he.avail_out, R = he.next_in, $e = he.input, Ee = he.avail_in, le = j.hold, Le = j.bits, j.mode === $ && (j.back = -1);
                        break;
                      }
                      for (j.back = 0; rt = j.lencode[le & (1 << j.lenbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Le); ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if (tt && !(tt & 240)) {
                        for (lt = it, wt = tt, Pt = Et; rt = j.lencode[Pt + ((le & (1 << lt + wt) - 1) >> lt)], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(lt + it <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        le >>>= lt, Le -= lt, j.back += lt;
                      }
                      if (le >>>= it, Le -= it, j.back += it, j.length = Et, tt === 0) {
                        j.mode = Me;
                        break;
                      }
                      if (tt & 32) {
                        j.back = -1, j.mode = $;
                        break;
                      }
                      if (tt & 64) {
                        he.msg = "invalid literal/length code", j.mode = we;
                        break;
                      }
                      j.extra = tt & 15, j.mode = me;
                    case me:
                      if (j.extra) {
                        for (Ot = j.extra; Le < Ot; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        j.length += le & (1 << j.extra) - 1, le >>>= j.extra, Le -= j.extra, j.back += j.extra;
                      }
                      j.was = j.length, j.mode = ne;
                    case ne:
                      for (; rt = j.distcode[le & (1 << j.distbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Le); ) {
                        if (Ee === 0)
                          break e;
                        Ee--, le += $e[R++] << Le, Le += 8;
                      }
                      if (!(tt & 240)) {
                        for (lt = it, wt = tt, Pt = Et; rt = j.distcode[Pt + ((le & (1 << lt + wt) - 1) >> lt)], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(lt + it <= Le); ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        le >>>= lt, Le -= lt, j.back += lt;
                      }
                      if (le >>>= it, Le -= it, j.back += it, tt & 64) {
                        he.msg = "invalid distance code", j.mode = we;
                        break;
                      }
                      j.offset = Et, j.extra = tt & 15, j.mode = fe;
                    case fe:
                      if (j.extra) {
                        for (Ot = j.extra; Le < Ot; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        j.offset += le & (1 << j.extra) - 1, le >>>= j.extra, Le -= j.extra, j.back += j.extra;
                      }
                      if (j.offset > j.dmax) {
                        he.msg = "invalid distance too far back", j.mode = we;
                        break;
                      }
                      j.mode = Ce;
                    case Ce:
                      if (X === 0)
                        break e;
                      if (je = Ke - X, j.offset > je) {
                        if (je = j.offset - je, je > j.whave && j.sane) {
                          he.msg = "invalid distance too far back", j.mode = we;
                          break;
                        }
                        je > j.wnext ? (je -= j.wnext, Je = j.wsize - je) : Je = j.wnext - je, je > j.length && (je = j.length), Lt = j.window;
                      } else
                        Lt = Ve, Je = be - j.offset, je = j.length;
                      je > X && (je = X), X -= je, j.length -= je;
                      do
                        Ve[be++] = Lt[Je++];
                      while (--je);
                      j.length === 0 && (j.mode = q);
                      break;
                    case Me:
                      if (X === 0)
                        break e;
                      Ve[be++] = j.length, X--, j.mode = q;
                      break;
                    case Te:
                      if (j.wrap) {
                        for (; Le < 32; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le |= $e[R++] << Le, Le += 8;
                        }
                        if (Ke -= X, he.total_out += Ke, j.total += Ke, Ke && (he.adler = j.check = /*UPDATE(state.check, put - _out, _out);*/
                        j.flags ? u(j.check, Ve, Ke, be - Ke) : f(j.check, Ve, Ke, be - Ke)), Ke = X, (j.flags ? le : ge(le)) !== j.check) {
                          he.msg = "incorrect data check", j.mode = we;
                          break;
                        }
                        le = 0, Le = 0;
                      }
                      j.mode = se;
                    case se:
                      if (j.wrap && j.flags) {
                        for (; Le < 32; ) {
                          if (Ee === 0)
                            break e;
                          Ee--, le += $e[R++] << Le, Le += 8;
                        }
                        if (le !== (j.total & 4294967295)) {
                          he.msg = "incorrect length check", j.mode = we;
                          break;
                        }
                        le = 0, Le = 0;
                      }
                      j.mode = pe;
                    case pe:
                      bt = s;
                      break e;
                    case we:
                      bt = p;
                      break e;
                    case ke:
                      return v;
                    case Ue:
                    default:
                      return w;
                  }
              return he.next_out = be, he.avail_out = X, he.next_in = R, he.avail_in = Ee, j.hold = le, j.bits = Le, (j.wsize || Ke !== he.avail_out && j.mode < we && (j.mode < Te || Oe !== C)) && Re(he, he.output, he.next_out, Ke - he.avail_out), Ze -= he.avail_in, Ke -= he.avail_out, he.total_in += Ze, he.total_out += Ke, j.total += Ke, j.wrap && Ke && (he.adler = j.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
              j.flags ? u(j.check, Ve, Ke, he.next_out - Ke) : f(j.check, Ve, Ke, he.next_out - Ke)), he.data_type = j.bits + (j.last ? 64 : 0) + (j.mode === $ ? 128 : 0) + (j.mode === oe || j.mode === H ? 256 : 0), (Ze === 0 && Ke === 0 || Oe === C) && bt === S && (bt = a), bt;
            }
            function ce(he) {
              if (!he || !he.state)
                return w;
              var Oe = he.state;
              return Oe.window && (Oe.window = null), he.state = null, S;
            }
            function Ae(he, Oe) {
              var j;
              return !he || !he.state || (j = he.state, !(j.wrap & 2)) ? w : (j.head = Oe, Oe.done = !1, S);
            }
            function Fe(he, Oe) {
              var j = Oe.length, $e, Ve, R;
              return !he || !he.state || ($e = he.state, $e.wrap !== 0 && $e.mode !== N) ? w : $e.mode === N && (Ve = 1, Ve = f(Ve, Oe, j, 0), Ve !== $e.check) ? p : (R = Re(he, Oe, j, j), R ? ($e.mode = ke, v) : ($e.havedict = 1, S));
            }
            e.inflateReset = He, e.inflateReset2 = We, e.inflateResetKeep = ze, e.inflateInit = K, e.inflateInit2 = Y, e.inflate = Z, e.inflateEnd = ce, e.inflateGetHeader = Ae, e.inflateSetDictionary = Fe, e.inflateInfo = "pako inflate (from Nodeca project)";
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js ***!
            \*********************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), f = 15, u = 852, y = 592, h = 0, _ = 1, E = 2, c = [
              /* 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
            ], C = [
              /* 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
            ], b = [
              /* 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
            ], A = [
              /* 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
            ];
            r.exports = function(s, o, w, p, v, a, l, g) {
              var M = g.bits, L = 0, T = 0, D = 0, I = 0, z = 0, P = 0, B = 0, F = 0, N = 0, $ = 0, k, G, H, U, V, Q = null, ae = 0, oe, q = new n.Buf16(f + 1), me = new n.Buf16(f + 1), ne = null, fe = 0, Ce, Me, Te;
              for (L = 0; L <= f; L++)
                q[L] = 0;
              for (T = 0; T < p; T++)
                q[o[w + T]]++;
              for (z = M, I = f; I >= 1 && q[I] === 0; I--)
                ;
              if (z > I && (z = I), I === 0)
                return v[a++] = 20971520, v[a++] = 20971520, g.bits = 1, 0;
              for (D = 1; D < I && q[D] === 0; D++)
                ;
              for (z < D && (z = D), F = 1, L = 1; L <= f; L++)
                if (F <<= 1, F -= q[L], F < 0)
                  return -1;
              if (F > 0 && (s === h || I !== 1))
                return -1;
              for (me[1] = 0, L = 1; L < f; L++)
                me[L + 1] = me[L] + q[L];
              for (T = 0; T < p; T++)
                o[w + T] !== 0 && (l[me[o[w + T]]++] = T);
              if (s === h ? (Q = ne = l, oe = 19) : s === _ ? (Q = c, ae -= 257, ne = C, fe -= 257, oe = 256) : (Q = b, ne = A, oe = -1), $ = 0, T = 0, L = D, V = a, P = z, B = 0, H = -1, N = 1 << z, U = N - 1, s === _ && N > u || s === E && N > y)
                return 1;
              for (; ; ) {
                Ce = L - B, l[T] < oe ? (Me = 0, Te = l[T]) : l[T] > oe ? (Me = ne[fe + l[T]], Te = Q[ae + l[T]]) : (Me = 96, Te = 0), k = 1 << L - B, G = 1 << P, D = G;
                do
                  G -= k, v[V + ($ >> B) + G] = Ce << 24 | Me << 16 | Te | 0;
                while (G !== 0);
                for (k = 1 << L - 1; $ & k; )
                  k >>= 1;
                if (k !== 0 ? ($ &= k - 1, $ += k) : $ = 0, T++, --q[L] === 0) {
                  if (L === I)
                    break;
                  L = o[w + l[T]];
                }
                if (L > z && ($ & U) !== H) {
                  for (B === 0 && (B = z), V += D, P = L - B, F = 1 << P; P + B < I && (F -= q[P + B], !(F <= 0)); )
                    P++, F <<= 1;
                  if (N += 1 << P, s === _ && N > u || s === E && N > y)
                    return 1;
                  H = $ & U, v[H] = z << 24 | P << 16 | V - a | 0;
                }
              }
              return $ !== 0 && (v[V + $] = L - B << 24 | 4194304 | 0), g.bits = z, 0;
            };
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js": (
          /*!*********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js ***!
            \*********************************************************************/
          /***/
          (r) => {
            r.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 ***!
            \******************************************************************/
          /***/
          (r, e, t) => {
            var n = t(
              /*! ../utils/common */
              "./node_modules/upng-js/node_modules/pako/lib/utils/common.js"
            ), f = 4, u = 0, y = 1, h = 2;
            function _(Z) {
              for (var ce = Z.length; --ce >= 0; )
                Z[ce] = 0;
            }
            var E = 0, c = 1, C = 2, b = 3, A = 258, S = 29, s = 256, o = s + 1 + S, w = 30, p = 19, v = 2 * o + 1, a = 15, l = 16, g = 7, M = 256, L = 16, T = 17, D = 18, I = (
              /* extra bits for each length code */
              [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]
            ), z = (
              /* extra bits for each distance code */
              [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]
            ), 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, N = new Array((o + 2) * 2);
            _(N);
            var $ = new Array(w * 2);
            _($);
            var k = new Array(F);
            _(k);
            var G = new Array(A - b + 1);
            _(G);
            var H = new Array(S);
            _(H);
            var U = new Array(w);
            _(U);
            function V(Z, ce, Ae, Fe, he) {
              this.static_tree = Z, this.extra_bits = ce, this.extra_base = Ae, this.elems = Fe, this.max_length = he, this.has_stree = Z && Z.length;
            }
            var Q, ae, oe;
            function q(Z, ce) {
              this.dyn_tree = Z, this.max_code = 0, this.stat_desc = ce;
            }
            function me(Z) {
              return Z < 256 ? k[Z] : k[256 + (Z >>> 7)];
            }
            function ne(Z, ce) {
              Z.pending_buf[Z.pending++] = ce & 255, Z.pending_buf[Z.pending++] = ce >>> 8 & 255;
            }
            function fe(Z, ce, Ae) {
              Z.bi_valid > l - Ae ? (Z.bi_buf |= ce << Z.bi_valid & 65535, ne(Z, Z.bi_buf), Z.bi_buf = ce >> l - Z.bi_valid, Z.bi_valid += Ae - l) : (Z.bi_buf |= ce << Z.bi_valid & 65535, Z.bi_valid += Ae);
            }
            function Ce(Z, ce, Ae) {
              fe(
                Z,
                Ae[ce * 2],
                Ae[ce * 2 + 1]
                /*.Len*/
              );
            }
            function Me(Z, ce) {
              var Ae = 0;
              do
                Ae |= Z & 1, Z >>>= 1, Ae <<= 1;
              while (--ce > 0);
              return Ae >>> 1;
            }
            function Te(Z) {
              Z.bi_valid === 16 ? (ne(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 se(Z, ce) {
              var Ae = ce.dyn_tree, Fe = ce.max_code, he = ce.stat_desc.static_tree, Oe = ce.stat_desc.has_stree, j = ce.stat_desc.extra_bits, $e = ce.stat_desc.extra_base, Ve = ce.stat_desc.max_length, R, be, Ee, X, le, Le, Ze = 0;
              for (X = 0; X <= a; X++)
                Z.bl_count[X] = 0;
              for (Ae[Z.heap[Z.heap_max] * 2 + 1] = 0, R = Z.heap_max + 1; R < v; R++)
                be = Z.heap[R], X = Ae[Ae[be * 2 + 1] * 2 + 1] + 1, X > Ve && (X = Ve, Ze++), Ae[be * 2 + 1] = X, !(be > Fe) && (Z.bl_count[X]++, le = 0, be >= $e && (le = j[be - $e]), Le = Ae[be * 2], Z.opt_len += Le * (X + le), Oe && (Z.static_len += Le * (he[be * 2 + 1] + le)));
              if (Ze !== 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]--, Ze -= 2;
                } while (Ze > 0);
                for (X = Ve; X !== 0; X--)
                  for (be = Z.bl_count[X]; be !== 0; )
                    Ee = Z.heap[--R], !(Ee > Fe) && (Ae[Ee * 2 + 1] !== X && (Z.opt_len += (X - Ae[Ee * 2 + 1]) * Ae[Ee * 2], Ae[Ee * 2 + 1] = X), be--);
              }
            }
            function pe(Z, ce, Ae) {
              var Fe = new Array(a + 1), he = 0, Oe, j;
              for (Oe = 1; Oe <= a; Oe++)
                Fe[Oe] = he = he + Ae[Oe - 1] << 1;
              for (j = 0; j <= ce; j++) {
                var $e = Z[j * 2 + 1];
                $e !== 0 && (Z[j * 2] = Me(Fe[$e]++, $e));
              }
            }
            function we() {
              var Z, ce, Ae, Fe, he, Oe = new Array(a + 1);
              for (Ae = 0, Fe = 0; Fe < S - 1; Fe++)
                for (H[Fe] = Ae, Z = 0; Z < 1 << I[Fe]; Z++)
                  G[Ae++] = Fe;
              for (G[Ae - 1] = Fe, he = 0, Fe = 0; Fe < 16; Fe++)
                for (U[Fe] = he, Z = 0; Z < 1 << z[Fe]; Z++)
                  k[he++] = Fe;
              for (he >>= 7; Fe < w; Fe++)
                for (U[Fe] = he << 7, Z = 0; Z < 1 << z[Fe] - 7; Z++)
                  k[256 + he++] = Fe;
              for (ce = 0; ce <= a; ce++)
                Oe[ce] = 0;
              for (Z = 0; Z <= 143; )
                N[Z * 2 + 1] = 8, Z++, Oe[8]++;
              for (; Z <= 255; )
                N[Z * 2 + 1] = 9, Z++, Oe[9]++;
              for (; Z <= 279; )
                N[Z * 2 + 1] = 7, Z++, Oe[7]++;
              for (; Z <= 287; )
                N[Z * 2 + 1] = 8, Z++, Oe[8]++;
              for (pe(N, o + 1, Oe), Z = 0; Z < w; Z++)
                $[Z * 2 + 1] = 5, $[Z * 2] = Me(Z, 5);
              Q = new V(N, I, s + 1, o, a), ae = new V($, z, 0, w, a), oe = new V(new Array(0), P, 0, p, g);
            }
            function ke(Z) {
              var ce;
              for (ce = 0; ce < o; ce++)
                Z.dyn_ltree[ce * 2] = 0;
              for (ce = 0; ce < w; ce++)
                Z.dyn_dtree[ce * 2] = 0;
              for (ce = 0; ce < p; ce++)
                Z.bl_tree[ce * 2] = 0;
              Z.dyn_ltree[M * 2] = 1, Z.opt_len = Z.static_len = 0, Z.last_lit = Z.matches = 0;
            }
            function Ue(Z) {
              Z.bi_valid > 8 ? ne(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 Ne(Z, ce, Ae, Fe) {
              Ue(Z), Fe && (ne(Z, Ae), ne(Z, ~Ae)), n.arraySet(Z.pending_buf, Z.window, ce, Ae, Z.pending), Z.pending += Ae;
            }
            function Be(Z, ce, Ae, Fe) {
              var he = ce * 2, Oe = Ae * 2;
              return Z[he] < Z[Oe] || Z[he] === Z[Oe] && Fe[ce] <= Fe[Ae];
            }
            function ue(Z, ce, Ae) {
              for (var Fe = Z.heap[Ae], he = Ae << 1; he <= Z.heap_len && (he < Z.heap_len && Be(ce, Z.heap[he + 1], Z.heap[he], Z.depth) && he++, !Be(ce, Fe, Z.heap[he], Z.depth)); )
                Z.heap[Ae] = Z.heap[he], Ae = he, he <<= 1;
              Z.heap[Ae] = Fe;
            }
            function ye(Z, ce, Ae) {
              var Fe, he, Oe = 0, j, $e;
              if (Z.last_lit !== 0)
                do
                  Fe = Z.pending_buf[Z.d_buf + Oe * 2] << 8 | Z.pending_buf[Z.d_buf + Oe * 2 + 1], he = Z.pending_buf[Z.l_buf + Oe], Oe++, Fe === 0 ? Ce(Z, he, ce) : (j = G[he], Ce(Z, j + s + 1, ce), $e = I[j], $e !== 0 && (he -= H[j], fe(Z, he, $e)), Fe--, j = me(Fe), Ce(Z, j, Ae), $e = z[j], $e !== 0 && (Fe -= U[j], fe(Z, Fe, $e)));
                while (Oe < Z.last_lit);
              Ce(Z, M, ce);
            }
            function ge(Z, ce) {
              var Ae = ce.dyn_tree, Fe = ce.stat_desc.static_tree, he = ce.stat_desc.has_stree, Oe = ce.stat_desc.elems, j, $e, Ve = -1, R;
              for (Z.heap_len = 0, Z.heap_max = v, j = 0; j < Oe; j++)
                Ae[j * 2] !== 0 ? (Z.heap[++Z.heap_len] = Ve = j, Z.depth[j] = 0) : Ae[j * 2 + 1] = 0;
              for (; Z.heap_len < 2; )
                R = Z.heap[++Z.heap_len] = Ve < 2 ? ++Ve : 0, Ae[R * 2] = 1, Z.depth[R] = 0, Z.opt_len--, he && (Z.static_len -= Fe[R * 2 + 1]);
              for (ce.max_code = Ve, j = Z.heap_len >> 1; j >= 1; j--)
                ue(Z, Ae, j);
              R = Oe;
              do
                j = Z.heap[
                  1
                  /*SMALLEST*/
                ], Z.heap[
                  1
                  /*SMALLEST*/
                ] = Z.heap[Z.heap_len--], ue(
                  Z,
                  Ae,
                  1
                  /*SMALLEST*/
                ), $e = Z.heap[
                  1
                  /*SMALLEST*/
                ], Z.heap[--Z.heap_max] = j, Z.heap[--Z.heap_max] = $e, Ae[R * 2] = Ae[j * 2] + Ae[$e * 2], Z.depth[R] = (Z.depth[j] >= Z.depth[$e] ? Z.depth[j] : Z.depth[$e]) + 1, Ae[j * 2 + 1] = Ae[$e * 2 + 1] = R, Z.heap[
                  1
                  /*SMALLEST*/
                ] = R++, ue(
                  Z,
                  Ae,
                  1
                  /*SMALLEST*/
                );
              while (Z.heap_len >= 2);
              Z.heap[--Z.heap_max] = Z.heap[
                1
                /*SMALLEST*/
              ], se(Z, ce), pe(Ae, Ve, Z.bl_count);
            }
            function Se(Z, ce, Ae) {
              var Fe, he = -1, Oe, j = ce[0 * 2 + 1], $e = 0, Ve = 7, R = 4;
              for (j === 0 && (Ve = 138, R = 3), ce[(Ae + 1) * 2 + 1] = 65535, Fe = 0; Fe <= Ae; Fe++)
                Oe = j, j = ce[(Fe + 1) * 2 + 1], !(++$e < Ve && Oe === j) && ($e < R ? Z.bl_tree[Oe * 2] += $e : Oe !== 0 ? (Oe !== he && Z.bl_tree[Oe * 2]++, Z.bl_tree[L * 2]++) : $e <= 10 ? Z.bl_tree[T * 2]++ : Z.bl_tree[D * 2]++, $e = 0, he = Oe, j === 0 ? (Ve = 138, R = 3) : Oe === j ? (Ve = 6, R = 3) : (Ve = 7, R = 4));
            }
            function ze(Z, ce, Ae) {
              var Fe, he = -1, Oe, j = ce[0 * 2 + 1], $e = 0, Ve = 7, R = 4;
              for (j === 0 && (Ve = 138, R = 3), Fe = 0; Fe <= Ae; Fe++)
                if (Oe = j, j = ce[(Fe + 1) * 2 + 1], !(++$e < Ve && Oe === j)) {
                  if ($e < R)
                    do
                      Ce(Z, Oe, Z.bl_tree);
                    while (--$e !== 0);
                  else
                    Oe !== 0 ? (Oe !== he && (Ce(Z, Oe, Z.bl_tree), $e--), Ce(Z, L, Z.bl_tree), fe(Z, $e - 3, 2)) : $e <= 10 ? (Ce(Z, T, Z.bl_tree), fe(Z, $e - 3, 3)) : (Ce(Z, D, Z.bl_tree), fe(Z, $e - 11, 7));
                  $e = 0, he = Oe, j === 0 ? (Ve = 138, R = 3) : Oe === j ? (Ve = 6, R = 3) : (Ve = 7, R = 4);
                }
            }
            function He(Z) {
              var ce;
              for (Se(Z, Z.dyn_ltree, Z.l_desc.max_code), Se(Z, Z.dyn_dtree, Z.d_desc.max_code), ge(Z, Z.bl_desc), ce = p - 1; ce >= 3 && Z.bl_tree[B[ce] * 2 + 1] === 0; ce--)
                ;
              return Z.opt_len += 3 * (ce + 1) + 5 + 5 + 4, ce;
            }
            function We(Z, ce, Ae, Fe) {
              var he;
              for (fe(Z, ce - 257, 5), fe(Z, Ae - 1, 5), fe(Z, Fe - 4, 4), he = 0; he < Fe; he++)
                fe(Z, Z.bl_tree[B[he] * 2 + 1], 3);
              ze(Z, Z.dyn_ltree, ce - 1), ze(Z, Z.dyn_dtree, Ae - 1);
            }
            function Y(Z) {
              var ce = 4093624447, Ae;
              for (Ae = 0; Ae <= 31; Ae++, ce >>>= 1)
                if (ce & 1 && Z.dyn_ltree[Ae * 2] !== 0)
                  return u;
              if (Z.dyn_ltree[18] !== 0 || Z.dyn_ltree[20] !== 0 || Z.dyn_ltree[26] !== 0)
                return y;
              for (Ae = 32; Ae < s; Ae++)
                if (Z.dyn_ltree[Ae * 2] !== 0)
                  return y;
              return u;
            }
            var K = !1;
            function ee(Z) {
              K || (we(), K = !0), Z.l_desc = new q(Z.dyn_ltree, Q), Z.d_desc = new q(Z.dyn_dtree, ae), Z.bl_desc = new q(Z.bl_tree, oe), Z.bi_buf = 0, Z.bi_valid = 0, ke(Z);
            }
            function de(Z, ce, Ae, Fe) {
              fe(Z, (E << 1) + (Fe ? 1 : 0), 3), Ne(Z, ce, Ae, !0);
            }
            function ve(Z) {
              fe(Z, c << 1, 3), Ce(Z, M, N), Te(Z);
            }
            function Ie(Z, ce, Ae, Fe) {
              var he, Oe, j = 0;
              Z.level > 0 ? (Z.strm.data_type === h && (Z.strm.data_type = Y(Z)), ge(Z, Z.l_desc), ge(Z, Z.d_desc), j = He(Z), he = Z.opt_len + 3 + 7 >>> 3, Oe = Z.static_len + 3 + 7 >>> 3, Oe <= he && (he = Oe)) : he = Oe = Ae + 5, Ae + 4 <= he && ce !== -1 ? de(Z, ce, Ae, Fe) : Z.strategy === f || Oe === he ? (fe(Z, (c << 1) + (Fe ? 1 : 0), 3), ye(Z, N, $)) : (fe(Z, (C << 1) + (Fe ? 1 : 0), 3), We(Z, Z.l_desc.max_code + 1, Z.d_desc.max_code + 1, j + 1), ye(Z, Z.dyn_ltree, Z.dyn_dtree)), ke(Z), Fe && Ue(Z);
            }
            function Re(Z, ce, Ae) {
              return Z.pending_buf[Z.d_buf + Z.last_lit * 2] = ce >>> 8 & 255, Z.pending_buf[Z.d_buf + Z.last_lit * 2 + 1] = ce & 255, Z.pending_buf[Z.l_buf + Z.last_lit] = Ae & 255, Z.last_lit++, ce === 0 ? Z.dyn_ltree[Ae * 2]++ : (Z.matches++, ce--, Z.dyn_ltree[(G[Ae] + s + 1) * 2]++, Z.dyn_dtree[me(ce) * 2]++), Z.last_lit === Z.lit_bufsize - 1;
            }
            e._tr_init = ee, e._tr_stored_block = de, e._tr_flush_block = Ie, e._tr_tally = Re, e._tr_align = ve;
          }
        ),
        /***/
        "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js": (
          /*!********************************************************************!*\
            !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js ***!
            \********************************************************************/
          /***/
          (r) => {
            function e() {
              this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
            }
            r.exports = e;
          }
        ),
        /***/
        "./src/SurfaceWorker.js": (
          /*!******************************!*\
            !*** ./src/SurfaceWorker.js ***!
            \******************************/
          /***/
          () => {
            $3Dmol.workerString = (function() {
              self.onmessage = function(r) {
                var e = r.data, t = e.type;
                if (t < 0)
                  self.atomData = e.atoms, self.volume = e.volume, self.ps = new ProteinSurface();
                else {
                  var n = self.ps;
                  n.initparm(e.expandedExtent, t != 1, self.volume), n.fillvoxels(self.atomData, e.extendedAtoms), n.buildboundary(), (t === 4 || t === 2) && (n.fastdistancemap(), n.boundingatom(!1), n.fillvoxelswaals(self.atomData, e.extendedAtoms)), n.marchingcube(t);
                  var f = n.getFacesAndVertices(e.atomsToShow);
                  self.postMessage(f);
                }
              };
            }).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 ***!
            \*************************/
          /***/
          (r) => {
            typeof r.exports == "object" && (r.exports = window.$3Dmol);
          }
        ),
        /***/
        "./src/vendor/mmtf.js": (
          /*!****************************!*\
            !*** ./src/vendor/mmtf.js ***!
            \****************************/
          /***/
          function(r, e) {
            (function(t, n) {
              n(e);
            })(this, function(t) {
              function n(Y, K, ee) {
                for (var de = (Y.byteLength, 0), ve = ee.length; ve > de; de++) {
                  var Ie = ee.charCodeAt(de);
                  if (128 > Ie)
                    Y.setUint8(K++, Ie >>> 0 & 127 | 0);
                  else if (2048 > Ie)
                    Y.setUint8(K++, Ie >>> 6 & 31 | 192), Y.setUint8(K++, Ie >>> 0 & 63 | 128);
                  else if (65536 > Ie)
                    Y.setUint8(K++, Ie >>> 12 & 15 | 224), Y.setUint8(K++, Ie >>> 6 & 63 | 128), Y.setUint8(K++, Ie >>> 0 & 63 | 128);
                  else {
                    if (!(1114112 > Ie))
                      throw new Error("bad codepoint " + Ie);
                    Y.setUint8(K++, Ie >>> 18 & 7 | 240), Y.setUint8(K++, Ie >>> 12 & 63 | 128), Y.setUint8(K++, Ie >>> 6 & 63 | 128), Y.setUint8(K++, Ie >>> 0 & 63 | 128);
                  }
                }
              }
              function f(Y) {
                for (var K = 0, ee = 0, de = Y.length; de > ee; ee++) {
                  var ve = Y.charCodeAt(ee);
                  if (128 > ve)
                    K += 1;
                  else if (2048 > ve)
                    K += 2;
                  else if (65536 > ve)
                    K += 3;
                  else {
                    if (!(1114112 > ve))
                      throw new Error("bad codepoint " + ve);
                    K += 4;
                  }
                }
                return K;
              }
              function u(Y, K, ee) {
                var de = typeof Y;
                if (de === "string") {
                  var ve = f(Y);
                  if (32 > ve)
                    return K.setUint8(ee, 160 | ve), n(K, ee + 1, Y), 1 + ve;
                  if (256 > ve)
                    return K.setUint8(ee, 217), K.setUint8(ee + 1, ve), n(K, ee + 2, Y), 2 + ve;
                  if (65536 > ve)
                    return K.setUint8(ee, 218), K.setUint16(ee + 1, ve), n(K, ee + 3, Y), 3 + ve;
                  if (4294967296 > ve)
                    return K.setUint8(ee, 219), K.setUint32(ee + 1, ve), n(K, ee + 5, Y), 5 + ve;
                }
                if (Y instanceof Uint8Array) {
                  var ve = Y.byteLength, Ie = new Uint8Array(K.buffer);
                  if (256 > ve)
                    return K.setUint8(ee, 196), K.setUint8(ee + 1, ve), Ie.set(Y, ee + 2), 2 + ve;
                  if (65536 > ve)
                    return K.setUint8(ee, 197), K.setUint16(ee + 1, ve), Ie.set(Y, ee + 3), 3 + ve;
                  if (4294967296 > ve)
                    return K.setUint8(ee, 198), K.setUint32(ee + 1, ve), Ie.set(Y, ee + 5), 5 + ve;
                }
                if (de === "number") {
                  if (!isFinite(Y))
                    throw new Error("Number not finite: " + Y);
                  if (Math.floor(Y) !== Y)
                    return K.setUint8(ee, 203), K.setFloat64(ee + 1, Y), 9;
                  if (Y >= 0) {
                    if (128 > Y)
                      return K.setUint8(ee, Y), 1;
                    if (256 > Y)
                      return K.setUint8(ee, 204), K.setUint8(ee + 1, Y), 2;
                    if (65536 > Y)
                      return K.setUint8(ee, 205), K.setUint16(ee + 1, Y), 3;
                    if (4294967296 > Y)
                      return K.setUint8(ee, 206), K.setUint32(ee + 1, Y), 5;
                    throw new Error("Number too big 0x" + Y.toString(16));
                  }
                  if (Y >= -32)
                    return K.setInt8(ee, Y), 1;
                  if (Y >= -128)
                    return K.setUint8(ee, 208), K.setInt8(ee + 1, Y), 2;
                  if (Y >= -32768)
                    return K.setUint8(ee, 209), K.setInt16(ee + 1, Y), 3;
                  if (Y >= -2147483648)
                    return K.setUint8(ee, 210), K.setInt32(ee + 1, Y), 5;
                  throw new Error("Number too small -0x" + (-Y).toString(16).substr(1));
                }
                if (Y === null)
                  return K.setUint8(ee, 192), 1;
                if (de === "boolean")
                  return K.setUint8(ee, Y ? 195 : 194), 1;
                if (de === "object") {
                  var ve, ce = 0, Re = Array.isArray(Y);
                  if (Re)
                    ve = Y.length;
                  else {
                    var Z = Object.keys(Y);
                    ve = Z.length;
                  }
                  var ce;
                  if (16 > ve ? (K.setUint8(ee, ve | (Re ? 144 : 128)), ce = 1) : 65536 > ve ? (K.setUint8(ee, Re ? 220 : 222), K.setUint16(ee + 1, ve), ce = 3) : 4294967296 > ve && (K.setUint8(ee, Re ? 221 : 223), K.setUint32(ee + 1, ve), ce = 5), Re)
                    for (var Ae = 0; ve > Ae; Ae++)
                      ce += u(Y[Ae], K, ee + ce);
                  else
                    for (var Ae = 0; ve > Ae; Ae++) {
                      var Fe = Z[Ae];
                      ce += u(Fe, K, ee + ce), ce += u(Y[Fe], K, ee + ce);
                    }
                  return ce;
                }
                throw new Error("Unknown type " + de);
              }
              function y(Y) {
                var K = typeof Y;
                if (K === "string") {
                  var ee = f(Y);
                  if (32 > ee)
                    return 1 + ee;
                  if (256 > ee)
                    return 2 + ee;
                  if (65536 > ee)
                    return 3 + ee;
                  if (4294967296 > ee)
                    return 5 + ee;
                }
                if (Y instanceof Uint8Array) {
                  var ee = Y.byteLength;
                  if (256 > ee)
                    return 2 + ee;
                  if (65536 > ee)
                    return 3 + ee;
                  if (4294967296 > ee)
                    return 5 + ee;
                }
                if (K === "number") {
                  if (Math.floor(Y) !== Y)
                    return 9;
                  if (Y >= 0) {
                    if (128 > Y)
                      return 1;
                    if (256 > Y)
                      return 2;
                    if (65536 > Y)
                      return 3;
                    if (4294967296 > Y)
                      return 5;
                    throw new Error("Number too big 0x" + Y.toString(16));
                  }
                  if (Y >= -32)
                    return 1;
                  if (Y >= -128)
                    return 2;
                  if (Y >= -32768)
                    return 3;
                  if (Y >= -2147483648)
                    return 5;
                  throw new Error("Number too small -0x" + Y.toString(16).substr(1));
                }
                if (K === "boolean" || Y === null)
                  return 1;
                if (K === "object") {
                  var ee, de = 0;
                  if (Array.isArray(Y)) {
                    ee = Y.length;
                    for (var ve = 0; ee > ve; ve++)
                      de += y(Y[ve]);
                  } else {
                    var Ie = Object.keys(Y);
                    ee = Ie.length;
                    for (var ve = 0; ee > ve; ve++) {
                      var Re = Ie[ve];
                      de += y(Re) + y(Y[Re]);
                    }
                  }
                  if (16 > ee)
                    return 1 + de;
                  if (65536 > ee)
                    return 3 + de;
                  if (4294967296 > ee)
                    return 5 + de;
                  throw new Error("Array or object too long 0x" + ee.toString(16));
                }
                throw new Error("Unknown type " + K);
              }
              function h(Y) {
                var K = new ArrayBuffer(y(Y)), ee = new DataView(K);
                return u(Y, ee, 0), new Uint8Array(K);
              }
              function _(Y, K, ee) {
                return K ? new Y(K.buffer, K.byteOffset, K.byteLength / (ee || 1)) : void 0;
              }
              function E(Y) {
                return _(DataView, Y);
              }
              function c(Y) {
                return _(Uint8Array, Y);
              }
              function C(Y) {
                return _(Int8Array, Y);
              }
              function b(Y) {
                return _(Int32Array, Y, 4);
              }
              function A(Y) {
                return _(Float32Array, Y, 4);
              }
              function S(Y, K) {
                var ee = Y.length / 2;
                K || (K = new Int16Array(ee));
                for (var de = 0, ve = 0; ee > de; ++de, ve += 2)
                  K[de] = Y[ve] << 8 ^ Y[ve + 1] << 0;
                return K;
              }
              function s(Y, K) {
                var ee = Y.length;
                K || (K = new Uint8Array(2 * ee));
                for (var de = E(K), ve = 0; ee > ve; ++ve)
                  de.setInt16(2 * ve, Y[ve]);
                return c(K);
              }
              function o(Y, K) {
                var ee = Y.length / 4;
                K || (K = new Int32Array(ee));
                for (var de = 0, ve = 0; ee > de; ++de, ve += 4)
                  K[de] = Y[ve] << 24 ^ Y[ve + 1] << 16 ^ Y[ve + 2] << 8 ^ Y[ve + 3] << 0;
                return K;
              }
              function w(Y, K) {
                var ee = Y.length;
                K || (K = new Uint8Array(4 * ee));
                for (var de = E(K), ve = 0; ee > ve; ++ve)
                  de.setInt32(4 * ve, Y[ve]);
                return c(K);
              }
              function p(Y, K) {
                var ee = Y.length;
                K || (K = new Float32Array(ee / 4));
                for (var de = E(K), ve = E(Y), Ie = 0, Re = 0, Z = ee / 4; Z > Ie; ++Ie, Re += 4)
                  de.setFloat32(Re, ve.getFloat32(Re), !0);
                return K;
              }
              function v(Y, K, ee) {
                var de = Y.length, ve = 1 / K;
                ee || (ee = new Float32Array(de));
                for (var Ie = 0; de > Ie; ++Ie)
                  ee[Ie] = Y[Ie] * ve;
                return ee;
              }
              function a(Y, K, ee) {
                var de = Y.length;
                ee || (ee = new Int32Array(de));
                for (var ve = 0; de > ve; ++ve)
                  ee[ve] = Math.round(Y[ve] * K);
                return ee;
              }
              function l(Y, K) {
                var ee, de;
                if (!K) {
                  var ve = 0;
                  for (ee = 0, de = Y.length; de > ee; ee += 2)
                    ve += Y[ee + 1];
                  K = new Y.constructor(ve);
                }
                var Ie = 0;
                for (ee = 0, de = Y.length; de > ee; ee += 2)
                  for (var Re = Y[ee], Z = Y[ee + 1], ce = 0; Z > ce; ++ce)
                    K[Ie] = Re, ++Ie;
                return K;
              }
              function g(Y) {
                if (Y.length === 0)
                  return new Int32Array();
                var K, ee, de = 2;
                for (K = 1, ee = Y.length; ee > K; ++K)
                  Y[K - 1] !== Y[K] && (de += 2);
                var ve = new Int32Array(de), Ie = 0, Re = 1;
                for (K = 1, ee = Y.length; ee > K; ++K)
                  Y[K - 1] !== Y[K] ? (ve[Ie] = Y[K - 1], ve[Ie + 1] = Re, Re = 1, Ie += 2) : ++Re;
                return ve[Ie] = Y[Y.length - 1], ve[Ie + 1] = Re, ve;
              }
              function M(Y, K) {
                var ee = Y.length;
                K || (K = new Y.constructor(ee)), ee && (K[0] = Y[0]);
                for (var de = 1; ee > de; ++de)
                  K[de] = Y[de] + K[de - 1];
                return K;
              }
              function L(Y, K) {
                var ee = Y.length;
                K || (K = new Y.constructor(ee)), K[0] = Y[0];
                for (var de = 1; ee > de; ++de)
                  K[de] = Y[de] - Y[de - 1];
                return K;
              }
              function T(Y, K) {
                var ee, de, ve = Y instanceof Int8Array ? 127 : 32767, Ie = -ve - 1, Re = Y.length;
                if (!K) {
                  var Z = 0;
                  for (ee = 0; Re > ee; ++ee)
                    Y[ee] < ve && Y[ee] > Ie && ++Z;
                  K = new Int32Array(Z);
                }
                for (ee = 0, de = 0; Re > ee; ) {
                  for (var ce = 0; Y[ee] === ve || Y[ee] === Ie; )
                    ce += Y[ee], ++ee;
                  ce += Y[ee], ++ee, K[de] = ce, ++de;
                }
                return K;
              }
              function D(Y, K) {
                var ee, de = K ? 127 : 32767, ve = -de - 1, Ie = Y.length, Re = 0;
                for (ee = 0; Ie > ee; ++ee) {
                  var Z = Y[ee];
                  Z === 0 ? ++Re : Z > 0 ? (Re += Math.ceil(Z / de), Z % de === 0 && (Re += 1)) : (Re += Math.ceil(Z / ve), Z % ve === 0 && (Re += 1));
                }
                var ce = K ? new Int8Array(Re) : new Int16Array(Re), Ae = 0;
                for (ee = 0; Ie > ee; ++ee) {
                  var Z = Y[ee];
                  if (Z >= 0)
                    for (; Z >= de; )
                      ce[Ae] = de, ++Ae, Z -= de;
                  else
                    for (; ve >= Z; )
                      ce[Ae] = ve, ++Ae, Z -= ve;
                  ce[Ae] = Z, ++Ae;
                }
                return ce;
              }
              function I(Y, K) {
                return M(l(Y), K);
              }
              function z(Y) {
                return g(L(Y));
              }
              function P(Y, K, ee) {
                return v(l(Y, b(ee)), K, ee);
              }
              function B(Y, K) {
                return g(a(Y, K));
              }
              function F(Y, K, ee) {
                return v(M(Y, b(ee)), K, ee);
              }
              function N(Y, K, ee) {
                return L(a(Y, K), ee);
              }
              function $(Y, K, ee) {
                return v(T(Y, b(ee)), K, ee);
              }
              function k(Y, K, ee) {
                var de = T(Y, b(ee));
                return F(de, K, A(de));
              }
              function G(Y, K, ee) {
                return D(N(Y, K), ee);
              }
              function H(Ie) {
                var K = E(Ie), ee = K.getInt32(0), de = K.getInt32(4), ve = Ie.subarray(8, 12), Ie = Ie.subarray(12);
                return [ee, Ie, de, ve];
              }
              function U(Y, K, ee, de) {
                var ve = new ArrayBuffer(12 + de.byteLength), Ie = new Uint8Array(ve), Re = new DataView(ve);
                return Re.setInt32(0, Y), Re.setInt32(4, K), ee && Ie.set(ee, 8), Ie.set(de, 12), Ie;
              }
              function V(Y) {
                var K = Y.length, ee = c(Y);
                return U(2, K, void 0, ee);
              }
              function Q(Y) {
                var K = Y.length, ee = w(Y);
                return U(4, K, void 0, ee);
              }
              function ae(Y, K) {
                var ee = Y.length / K, de = w([K]), ve = c(Y);
                return U(5, ee, de, ve);
              }
              function oe(Y) {
                var K = Y.length, ee = w(g(Y));
                return U(6, K, void 0, ee);
              }
              function q(Y) {
                var K = Y.length, ee = w(z(Y));
                return U(8, K, void 0, ee);
              }
              function me(Y, K) {
                var ee = Y.length, de = w([K]), ve = w(B(Y, K));
                return U(9, ee, de, ve);
              }
              function ne(Y, K) {
                var ee = Y.length, de = w([K]), ve = s(G(Y, K));
                return U(10, ee, de, ve);
              }
              function fe(Y) {
                var K = {};
                return ue.forEach(function(ee) {
                  Y[ee] !== void 0 && (K[ee] = Y[ee]);
                }), Y.bondAtomList && (K.bondAtomList = Q(Y.bondAtomList)), Y.bondOrderList && (K.bondOrderList = V(Y.bondOrderList)), K.xCoordList = ne(Y.xCoordList, 1e3), K.yCoordList = ne(Y.yCoordList, 1e3), K.zCoordList = ne(Y.zCoordList, 1e3), Y.bFactorList && (K.bFactorList = ne(Y.bFactorList, 100)), Y.atomIdList && (K.atomIdList = q(Y.atomIdList)), Y.altLocList && (K.altLocList = oe(Y.altLocList)), Y.occupancyList && (K.occupancyList = me(Y.occupancyList, 100)), K.groupIdList = q(Y.groupIdList), K.groupTypeList = Q(Y.groupTypeList), Y.secStructList && (K.secStructList = V(Y.secStructList)), Y.insCodeList && (K.insCodeList = oe(Y.insCodeList)), Y.sequenceIndexList && (K.sequenceIndexList = q(Y.sequenceIndexList)), K.chainIdList = ae(Y.chainIdList, 4), Y.chainNameList && (K.chainNameList = ae(Y.chainNameList, 4)), K;
              }
              function Ce(Y) {
                function K(ce) {
                  for (var Ae = {}, Fe = 0; ce > Fe; Fe++) {
                    var he = Ie();
                    Ae[he] = Ie();
                  }
                  return Ae;
                }
                function ee(ce) {
                  var Ae = Y.subarray(Re, Re + ce);
                  return Re += ce, Ae;
                }
                function de(ce) {
                  var Ae = Y.subarray(Re, Re + ce);
                  Re += ce;
                  var Fe = 65535;
                  if (ce > Fe) {
                    for (var he = [], Oe = 0; Oe < Ae.length; Oe += Fe)
                      he.push(String.fromCharCode.apply(null, Ae.subarray(Oe, Oe + Fe)));
                    return he.join("");
                  }
                  return String.fromCharCode.apply(null, Ae);
                }
                function ve(ce) {
                  for (var Ae = new Array(ce), Fe = 0; ce > Fe; Fe++)
                    Ae[Fe] = Ie();
                  return Ae;
                }
                function Ie() {
                  var ce, Ae, Fe = Y[Re];
                  if (!(128 & Fe))
                    return Re++, Fe;
                  if ((240 & Fe) === 128)
                    return Ae = 15 & Fe, Re++, K(Ae);
                  if ((240 & Fe) === 144)
                    return Ae = 15 & Fe, Re++, ve(Ae);
                  if ((224 & Fe) === 160)
                    return Ae = 31 & Fe, Re++, de(Ae);
                  if ((224 & Fe) === 224)
                    return ce = Z.getInt8(Re), Re++, ce;
                  switch (Fe) {
                    case 192:
                      return Re++, null;
                    case 194:
                      return Re++, !1;
                    case 195:
                      return Re++, !0;
                    case 196:
                      return Ae = Z.getUint8(Re + 1), Re += 2, ee(Ae);
                    case 197:
                      return Ae = Z.getUint16(Re + 1), Re += 3, ee(Ae);
                    case 198:
                      return Ae = Z.getUint32(Re + 1), Re += 5, ee(Ae);
                    case 202:
                      return ce = Z.getFloat32(Re + 1), Re += 5, ce;
                    case 203:
                      return ce = Z.getFloat64(Re + 1), Re += 9, ce;
                    case 204:
                      return ce = Y[Re + 1], Re += 2, ce;
                    case 205:
                      return ce = Z.getUint16(Re + 1), Re += 3, ce;
                    case 206:
                      return ce = Z.getUint32(Re + 1), Re += 5, ce;
                    case 208:
                      return ce = Z.getInt8(Re + 1), Re += 2, ce;
                    case 209:
                      return ce = Z.getInt16(Re + 1), Re += 3, ce;
                    case 210:
                      return ce = Z.getInt32(Re + 1), Re += 5, ce;
                    case 217:
                      return Ae = Z.getUint8(Re + 1), Re += 2, de(Ae);
                    case 218:
                      return Ae = Z.getUint16(Re + 1), Re += 3, de(Ae);
                    case 219:
                      return Ae = Z.getUint32(Re + 1), Re += 5, de(Ae);
                    case 220:
                      return Ae = Z.getUint16(Re + 1), Re += 3, ve(Ae);
                    case 221:
                      return Ae = Z.getUint32(Re + 1), Re += 5, ve(Ae);
                    case 222:
                      return Ae = Z.getUint16(Re + 1), Re += 3, K(Ae);
                    case 223:
                      return Ae = Z.getUint32(Re + 1), Re += 5, K(Ae);
                  }
                  throw new Error("Unknown type 0x" + Fe.toString(16));
                }
                var Re = 0, Z = new DataView(Y.buffer);
                return Ie();
              }
              function Me(Y, K, ee, de) {
                switch (Y) {
                  case 1:
                    return p(K);
                  case 2:
                    return C(K);
                  case 3:
                    return S(K);
                  case 4:
                    return o(K);
                  case 5:
                    return c(K);
                  case 6:
                    return l(o(K), new Uint8Array(ee));
                  case 7:
                    return l(o(K));
                  case 8:
                    return I(o(K));
                  case 9:
                    return P(o(K), o(de)[0]);
                  case 10:
                    return k(S(K), o(de)[0]);
                  case 11:
                    return v(S(K), o(de)[0]);
                  case 12:
                    return $(S(K), o(de)[0]);
                  case 13:
                    return $(C(K), o(de)[0]);
                  case 14:
                    return T(S(K));
                  case 15:
                    return T(C(K));
                }
              }
              function Te(Y, K) {
                K = K || {};
                var ee = K.ignoreFields, de = {};
                return ge.forEach(function(ve) {
                  var Ie = ee ? ee.indexOf(ve) !== -1 : !1, Re = Y[ve];
                  Ie || Re === void 0 || (Re instanceof Uint8Array ? de[ve] = Me.apply(null, H(Re)) : de[ve] = Re);
                }), de;
              }
              function se(Y) {
                return String.fromCharCode.apply(null, Y).replace(/\0/g, "");
              }
              function pe(Y, K, ee) {
                ee = ee || {};
                var de, ve, Ie, Re, Z, ce, Ae = ee.firstModelOnly, Fe = K.onModel, he = K.onChain, Oe = K.onGroup, j = K.onAtom, $e = K.onBond, Ve = 0, R = 0, be = 0, Ee = 0, X = 0, le = -1, Le = Y.chainNameList, Ze = Y.secStructList, Ke = Y.insCodeList, je = Y.sequenceIndexList, Je = Y.atomIdList, Lt = Y.bFactorList, rt = Y.altLocList, it = Y.occupancyList, tt = Y.bondAtomList, Et = Y.bondOrderList;
                for (de = 0, ve = Y.chainsPerModel.length; ve > de && !(Ae && Ve > 0); ++de) {
                  var lt = Y.chainsPerModel[Ve];
                  for (Fe && Fe({ chainCount: lt, modelIndex: Ve }), Ie = 0; lt > Ie; ++Ie) {
                    var wt = Y.groupsPerChain[R];
                    if (he) {
                      var Pt = se(Y.chainIdList.subarray(4 * R, 4 * R + 4)), vt = null;
                      Le && (vt = se(Le.subarray(4 * R, 4 * R + 4))), he({ groupCount: wt, chainIndex: R, modelIndex: Ve, chainId: Pt, chainName: vt });
                    }
                    for (Re = 0; wt > Re; ++Re) {
                      var bt = Y.groupList[Y.groupTypeList[be]], mt = bt.atomNameList.length;
                      if (Oe) {
                        var Tt = null;
                        Ze && (Tt = Ze[be]);
                        var Ot = null;
                        Y.insCodeList && (Ot = String.fromCharCode(Ke[be]));
                        var Ft = null;
                        je && (Ft = je[be]), Oe({ atomCount: mt, groupIndex: be, chainIndex: R, modelIndex: Ve, groupId: Y.groupIdList[be], groupType: Y.groupTypeList[be], groupName: bt.groupName, singleLetterCode: bt.singleLetterCode, chemCompType: bt.chemCompType, secStruct: Tt, insCode: Ot, sequenceIndex: Ft });
                      }
                      for (Z = 0; mt > Z; ++Z) {
                        if (j) {
                          var Qt = null;
                          Je && (Qt = Je[Ee]);
                          var kt = null;
                          Lt && (kt = Lt[Ee]);
                          var Jt = null;
                          rt && (Jt = String.fromCharCode(rt[Ee]));
                          var qt = null;
                          it && (qt = it[Ee]), j({ atomIndex: Ee, groupIndex: be, chainIndex: R, modelIndex: Ve, atomId: Qt, element: bt.elementList[Z], atomName: bt.atomNameList[Z], formalCharge: bt.formalChargeList[Z], xCoord: Y.xCoordList[Ee], yCoord: Y.yCoordList[Ee], zCoord: Y.zCoordList[Ee], bFactor: kt, altLoc: Jt, occupancy: qt });
                        }
                        Ee += 1;
                      }
                      if ($e) {
                        var er = bt.bondAtomList;
                        for (Z = 0, ce = bt.bondOrderList.length; ce > Z; ++Z)
                          $e({ atomIndex1: Ee - mt + er[2 * Z], atomIndex2: Ee - mt + er[2 * Z + 1], bondOrder: bt.bondOrderList[Z] });
                      }
                      be += 1;
                    }
                    R += 1;
                  }
                  if (X = le + 1, le = Ee - 1, $e && tt)
                    for (Z = 0, ce = tt.length; ce > Z; Z += 2) {
                      var Ht = tt[Z], tr = tt[Z + 1];
                      (Ht >= X && le >= Ht || tr >= X && le >= tr) && $e({ atomIndex1: Ht, atomIndex2: tr, bondOrder: Et ? Et[Z / 2] : null });
                    }
                  Ve += 1;
                }
              }
              function we(Y) {
                return h(fe(Y));
              }
              function ke(Y, K) {
                Y instanceof ArrayBuffer && (Y = new Uint8Array(Y));
                var ee;
                return ee = Y instanceof Uint8Array ? Ce(Y) : Y, Te(ee, K);
              }
              function Ue(Y, K, ee, de) {
                function ve() {
                  try {
                    var Re = ke(Ie.response);
                    ee(Re);
                  } catch (Z) {
                    de(Z);
                  }
                }
                var Ie = new XMLHttpRequest();
                Ie.addEventListener("load", ve, !0), Ie.addEventListener("error", de, !0), Ie.responseType = "arraybuffer", Ie.open("GET", K + Y.toUpperCase()), Ie.send();
              }
              function Ne(Y, K, ee) {
                Ue(Y, He, K, ee);
              }
              function Be(Y, K, ee) {
                Ue(Y, We, K, ee);
              }
              var ue = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], ye = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], ge = ue.concat(ye), Se = "v1.0.1", ze = "//mmtf.rcsb.org/v1.0/", He = ze + "full/", We = ze + "reduced/";
              t.encode = we, t.decode = ke, t.traverse = pe, t.fetch = Ne, t.fetchReduced = Be, t.version = Se, t.fetchUrl = He, t.fetchReducedUrl = We, t.encodeMsgpack = h, t.encodeMmtf = fe, t.decodeMsgpack = Ce, t.decodeMmtf = Te;
            });
          }
        ),
        /***/
        "./node_modules/pako/dist/pako.esm.mjs": (
          /*!*********************************************!*\
            !*** ./node_modules/pako/dist/pako.esm.mjs ***!
            \*********************************************/
          /***/
          (r, e, t) => {
            t.r(e), t.d(e, {
              /* harmony export */
              Deflate: () => (
                /* binding */
                Ki
              ),
              /* harmony export */
              Inflate: () => (
                /* binding */
                Qi
              ),
              /* harmony export */
              constants: () => (
                /* binding */
                tn
              ),
              /* harmony export */
              default: () => (
                /* binding */
                Ks
              ),
              /* harmony export */
              deflate: () => (
                /* binding */
                Zi
              ),
              /* harmony export */
              deflateRaw: () => (
                /* binding */
                Yi
              ),
              /* harmony export */
              gzip: () => (
                /* binding */
                Xi
              ),
              /* harmony export */
              inflate: () => (
                /* binding */
                Ji
              ),
              /* harmony export */
              inflateRaw: () => (
                /* binding */
                qi
              ),
              /* harmony export */
              ungzip: () => (
                /* binding */
                en
              )
              /* harmony export */
            });
            /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
            const n = 4, f = 0, u = 1, y = 2;
            function h(x) {
              let W = x.length;
              for (; --W >= 0; )
                x[W] = 0;
            }
            const _ = 0, E = 1, c = 2, C = 3, b = 258, A = 29, S = 256, s = S + 1 + A, o = 30, w = 19, p = 2 * s + 1, v = 15, a = 16, l = 7, g = 256, M = 16, L = 17, T = 18, D = (
              /* 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])
            ), I = (
              /* extra bits for each distance code */
              new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13])
            ), z = (
              /* extra bits for each bit length code */
              new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
            ), 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((s + 2) * 2);
            h(F);
            const N = new Array(o * 2);
            h(N);
            const $ = new Array(B);
            h($);
            const k = new Array(b - C + 1);
            h(k);
            const G = new Array(A);
            h(G);
            const H = new Array(o);
            h(H);
            function U(x, W, O, J, ie) {
              this.static_tree = x, this.extra_bits = W, this.extra_base = O, this.elems = J, this.max_length = ie, this.has_stree = x && x.length;
            }
            let V, Q, ae;
            function oe(x, W) {
              this.dyn_tree = x, this.max_code = 0, this.stat_desc = W;
            }
            const q = (x) => x < 256 ? $[x] : $[256 + (x >>> 7)], me = (x, W) => {
              x.pending_buf[x.pending++] = W & 255, x.pending_buf[x.pending++] = W >>> 8 & 255;
            }, ne = (x, W, O) => {
              x.bi_valid > a - O ? (x.bi_buf |= W << x.bi_valid & 65535, me(x, x.bi_buf), x.bi_buf = W >> a - x.bi_valid, x.bi_valid += O - a) : (x.bi_buf |= W << x.bi_valid & 65535, x.bi_valid += O);
            }, fe = (x, W, O) => {
              ne(
                x,
                O[W * 2],
                O[W * 2 + 1]
                /*.Len*/
              );
            }, Ce = (x, W) => {
              let O = 0;
              do
                O |= x & 1, x >>>= 1, O <<= 1;
              while (--W > 0);
              return O >>> 1;
            }, Me = (x) => {
              x.bi_valid === 16 ? (me(x, x.bi_buf), x.bi_buf = 0, x.bi_valid = 0) : x.bi_valid >= 8 && (x.pending_buf[x.pending++] = x.bi_buf & 255, x.bi_buf >>= 8, x.bi_valid -= 8);
            }, Te = (x, W) => {
              const O = W.dyn_tree, J = W.max_code, ie = W.stat_desc.static_tree, te = W.stat_desc.has_stree, De = W.stat_desc.extra_bits, xe = W.stat_desc.extra_base, Qe = W.stat_desc.max_length;
              let _e, Pe, ut, Xe, Ge, qe, Ct = 0;
              for (Xe = 0; Xe <= v; Xe++)
                x.bl_count[Xe] = 0;
              for (O[x.heap[x.heap_max] * 2 + 1] = 0, _e = x.heap_max + 1; _e < p; _e++)
                Pe = x.heap[_e], Xe = O[O[Pe * 2 + 1] * 2 + 1] + 1, Xe > Qe && (Xe = Qe, Ct++), O[Pe * 2 + 1] = Xe, !(Pe > J) && (x.bl_count[Xe]++, Ge = 0, Pe >= xe && (Ge = De[Pe - xe]), qe = O[Pe * 2], x.opt_len += qe * (Xe + Ge), te && (x.static_len += qe * (ie[Pe * 2 + 1] + Ge)));
              if (Ct !== 0) {
                do {
                  for (Xe = Qe - 1; x.bl_count[Xe] === 0; )
                    Xe--;
                  x.bl_count[Xe]--, x.bl_count[Xe + 1] += 2, x.bl_count[Qe]--, Ct -= 2;
                } while (Ct > 0);
                for (Xe = Qe; Xe !== 0; Xe--)
                  for (Pe = x.bl_count[Xe]; Pe !== 0; )
                    ut = x.heap[--_e], !(ut > J) && (O[ut * 2 + 1] !== Xe && (x.opt_len += (Xe - O[ut * 2 + 1]) * O[ut * 2], O[ut * 2 + 1] = Xe), Pe--);
              }
            }, se = (x, W, O) => {
              const J = new Array(v + 1);
              let ie = 0, te, De;
              for (te = 1; te <= v; te++)
                ie = ie + O[te - 1] << 1, J[te] = ie;
              for (De = 0; De <= W; De++) {
                let xe = x[De * 2 + 1];
                xe !== 0 && (x[De * 2] = Ce(J[xe]++, xe));
              }
            }, pe = () => {
              let x, W, O, J, ie;
              const te = new Array(v + 1);
              for (O = 0, J = 0; J < A - 1; J++)
                for (G[J] = O, x = 0; x < 1 << D[J]; x++)
                  k[O++] = J;
              for (k[O - 1] = J, ie = 0, J = 0; J < 16; J++)
                for (H[J] = ie, x = 0; x < 1 << I[J]; x++)
                  $[ie++] = J;
              for (ie >>= 7; J < o; J++)
                for (H[J] = ie << 7, x = 0; x < 1 << I[J] - 7; x++)
                  $[256 + ie++] = J;
              for (W = 0; W <= v; W++)
                te[W] = 0;
              for (x = 0; x <= 143; )
                F[x * 2 + 1] = 8, x++, te[8]++;
              for (; x <= 255; )
                F[x * 2 + 1] = 9, x++, te[9]++;
              for (; x <= 279; )
                F[x * 2 + 1] = 7, x++, te[7]++;
              for (; x <= 287; )
                F[x * 2 + 1] = 8, x++, te[8]++;
              for (se(F, s + 1, te), x = 0; x < o; x++)
                N[x * 2 + 1] = 5, N[x * 2] = Ce(x, 5);
              V = new U(F, D, S + 1, s, v), Q = new U(N, I, 0, o, v), ae = new U(new Array(0), z, 0, w, l);
            }, we = (x) => {
              let W;
              for (W = 0; W < s; W++)
                x.dyn_ltree[W * 2] = 0;
              for (W = 0; W < o; W++)
                x.dyn_dtree[W * 2] = 0;
              for (W = 0; W < w; W++)
                x.bl_tree[W * 2] = 0;
              x.dyn_ltree[g * 2] = 1, x.opt_len = x.static_len = 0, x.sym_next = x.matches = 0;
            }, ke = (x) => {
              x.bi_valid > 8 ? me(x, x.bi_buf) : x.bi_valid > 0 && (x.pending_buf[x.pending++] = x.bi_buf), x.bi_buf = 0, x.bi_valid = 0;
            }, Ue = (x, W, O, J) => {
              const ie = W * 2, te = O * 2;
              return x[ie] < x[te] || x[ie] === x[te] && J[W] <= J[O];
            }, Ne = (x, W, O) => {
              const J = x.heap[O];
              let ie = O << 1;
              for (; ie <= x.heap_len && (ie < x.heap_len && Ue(W, x.heap[ie + 1], x.heap[ie], x.depth) && ie++, !Ue(W, J, x.heap[ie], x.depth)); )
                x.heap[O] = x.heap[ie], O = ie, ie <<= 1;
              x.heap[O] = J;
            }, Be = (x, W, O) => {
              let J, ie, te = 0, De, xe;
              if (x.sym_next !== 0)
                do
                  J = x.pending_buf[x.sym_buf + te++] & 255, J += (x.pending_buf[x.sym_buf + te++] & 255) << 8, ie = x.pending_buf[x.sym_buf + te++], J === 0 ? fe(x, ie, W) : (De = k[ie], fe(x, De + S + 1, W), xe = D[De], xe !== 0 && (ie -= G[De], ne(x, ie, xe)), J--, De = q(J), fe(x, De, O), xe = I[De], xe !== 0 && (J -= H[De], ne(x, J, xe)));
                while (te < x.sym_next);
              fe(x, g, W);
            }, ue = (x, W) => {
              const O = W.dyn_tree, J = W.stat_desc.static_tree, ie = W.stat_desc.has_stree, te = W.stat_desc.elems;
              let De, xe, Qe = -1, _e;
              for (x.heap_len = 0, x.heap_max = p, De = 0; De < te; De++)
                O[De * 2] !== 0 ? (x.heap[++x.heap_len] = Qe = De, x.depth[De] = 0) : O[De * 2 + 1] = 0;
              for (; x.heap_len < 2; )
                _e = x.heap[++x.heap_len] = Qe < 2 ? ++Qe : 0, O[_e * 2] = 1, x.depth[_e] = 0, x.opt_len--, ie && (x.static_len -= J[_e * 2 + 1]);
              for (W.max_code = Qe, De = x.heap_len >> 1; De >= 1; De--)
                Ne(x, O, De);
              _e = te;
              do
                De = x.heap[
                  1
                  /*SMALLEST*/
                ], x.heap[
                  1
                  /*SMALLEST*/
                ] = x.heap[x.heap_len--], Ne(
                  x,
                  O,
                  1
                  /*SMALLEST*/
                ), xe = x.heap[
                  1
                  /*SMALLEST*/
                ], x.heap[--x.heap_max] = De, x.heap[--x.heap_max] = xe, O[_e * 2] = O[De * 2] + O[xe * 2], x.depth[_e] = (x.depth[De] >= x.depth[xe] ? x.depth[De] : x.depth[xe]) + 1, O[De * 2 + 1] = O[xe * 2 + 1] = _e, x.heap[
                  1
                  /*SMALLEST*/
                ] = _e++, Ne(
                  x,
                  O,
                  1
                  /*SMALLEST*/
                );
              while (x.heap_len >= 2);
              x.heap[--x.heap_max] = x.heap[
                1
                /*SMALLEST*/
              ], Te(x, W), se(O, Qe, x.bl_count);
            }, ye = (x, W, O) => {
              let J, ie = -1, te, De = W[0 * 2 + 1], xe = 0, Qe = 7, _e = 4;
              for (De === 0 && (Qe = 138, _e = 3), W[(O + 1) * 2 + 1] = 65535, J = 0; J <= O; J++)
                te = De, De = W[(J + 1) * 2 + 1], !(++xe < Qe && te === De) && (xe < _e ? x.bl_tree[te * 2] += xe : te !== 0 ? (te !== ie && x.bl_tree[te * 2]++, x.bl_tree[M * 2]++) : xe <= 10 ? x.bl_tree[L * 2]++ : x.bl_tree[T * 2]++, xe = 0, ie = te, De === 0 ? (Qe = 138, _e = 3) : te === De ? (Qe = 6, _e = 3) : (Qe = 7, _e = 4));
            }, ge = (x, W, O) => {
              let J, ie = -1, te, De = W[0 * 2 + 1], xe = 0, Qe = 7, _e = 4;
              for (De === 0 && (Qe = 138, _e = 3), J = 0; J <= O; J++)
                if (te = De, De = W[(J + 1) * 2 + 1], !(++xe < Qe && te === De)) {
                  if (xe < _e)
                    do
                      fe(x, te, x.bl_tree);
                    while (--xe !== 0);
                  else
                    te !== 0 ? (te !== ie && (fe(x, te, x.bl_tree), xe--), fe(x, M, x.bl_tree), ne(x, xe - 3, 2)) : xe <= 10 ? (fe(x, L, x.bl_tree), ne(x, xe - 3, 3)) : (fe(x, T, x.bl_tree), ne(x, xe - 11, 7));
                  xe = 0, ie = te, De === 0 ? (Qe = 138, _e = 3) : te === De ? (Qe = 6, _e = 3) : (Qe = 7, _e = 4);
                }
            }, Se = (x) => {
              let W;
              for (ye(x, x.dyn_ltree, x.l_desc.max_code), ye(x, x.dyn_dtree, x.d_desc.max_code), ue(x, x.bl_desc), W = w - 1; W >= 3 && x.bl_tree[P[W] * 2 + 1] === 0; W--)
                ;
              return x.opt_len += 3 * (W + 1) + 5 + 5 + 4, W;
            }, ze = (x, W, O, J) => {
              let ie;
              for (ne(x, W - 257, 5), ne(x, O - 1, 5), ne(x, J - 4, 4), ie = 0; ie < J; ie++)
                ne(x, x.bl_tree[P[ie] * 2 + 1], 3);
              ge(x, x.dyn_ltree, W - 1), ge(x, x.dyn_dtree, O - 1);
            }, He = (x) => {
              let W = 4093624447, O;
              for (O = 0; O <= 31; O++, W >>>= 1)
                if (W & 1 && x.dyn_ltree[O * 2] !== 0)
                  return f;
              if (x.dyn_ltree[9 * 2] !== 0 || x.dyn_ltree[10 * 2] !== 0 || x.dyn_ltree[13 * 2] !== 0)
                return u;
              for (O = 32; O < S; O++)
                if (x.dyn_ltree[O * 2] !== 0)
                  return u;
              return f;
            };
            let We = !1;
            const Y = (x) => {
              We || (pe(), We = !0), x.l_desc = new oe(x.dyn_ltree, V), x.d_desc = new oe(x.dyn_dtree, Q), x.bl_desc = new oe(x.bl_tree, ae), x.bi_buf = 0, x.bi_valid = 0, we(x);
            }, K = (x, W, O, J) => {
              ne(x, (_ << 1) + (J ? 1 : 0), 3), ke(x), me(x, O), me(x, ~O), O && x.pending_buf.set(x.window.subarray(W, W + O), x.pending), x.pending += O;
            }, ee = (x) => {
              ne(x, E << 1, 3), fe(x, g, F), Me(x);
            }, de = (x, W, O, J) => {
              let ie, te, De = 0;
              x.level > 0 ? (x.strm.data_type === y && (x.strm.data_type = He(x)), ue(x, x.l_desc), ue(x, x.d_desc), De = Se(x), ie = x.opt_len + 3 + 7 >>> 3, te = x.static_len + 3 + 7 >>> 3, te <= ie && (ie = te)) : ie = te = O + 5, O + 4 <= ie && W !== -1 ? K(x, W, O, J) : x.strategy === n || te === ie ? (ne(x, (E << 1) + (J ? 1 : 0), 3), Be(x, F, N)) : (ne(x, (c << 1) + (J ? 1 : 0), 3), ze(x, x.l_desc.max_code + 1, x.d_desc.max_code + 1, De + 1), Be(x, x.dyn_ltree, x.dyn_dtree)), we(x), J && ke(x);
            }, ve = (x, W, O) => (x.pending_buf[x.sym_buf + x.sym_next++] = W, x.pending_buf[x.sym_buf + x.sym_next++] = W >> 8, x.pending_buf[x.sym_buf + x.sym_next++] = O, W === 0 ? x.dyn_ltree[O * 2]++ : (x.matches++, W--, x.dyn_ltree[(k[O] + S + 1) * 2]++, x.dyn_dtree[q(W) * 2]++), x.sym_next === x.sym_end);
            var Ie = Y, Re = K, Z = de, ce = ve, Ae = ee, Fe = {
              _tr_init: Ie,
              _tr_stored_block: Re,
              _tr_flush_block: Z,
              _tr_tally: ce,
              _tr_align: Ae
            }, Oe = (x, W, O, J) => {
              let ie = x & 65535 | 0, te = x >>> 16 & 65535 | 0, De = 0;
              for (; O !== 0; ) {
                De = O > 2e3 ? 2e3 : O, O -= De;
                do
                  ie = ie + W[J++] | 0, te = te + ie | 0;
                while (--De);
                ie %= 65521, te %= 65521;
              }
              return ie | te << 16 | 0;
            };
            const j = () => {
              let x, W = [];
              for (var O = 0; O < 256; O++) {
                x = O;
                for (var J = 0; J < 8; J++)
                  x = x & 1 ? 3988292384 ^ x >>> 1 : x >>> 1;
                W[O] = x;
              }
              return W;
            }, $e = new Uint32Array(j());
            var R = (x, W, O, J) => {
              const ie = $e, te = J + O;
              x ^= -1;
              for (let De = J; De < te; De++)
                x = x >>> 8 ^ ie[(x ^ W[De]) & 255];
              return x ^ -1;
            }, be = {
              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) */
            }, Ee = {
              /* 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: le, _tr_flush_block: Le, _tr_tally: Ze, _tr_align: Ke } = Fe, {
              Z_NO_FLUSH: je,
              Z_PARTIAL_FLUSH: Je,
              Z_FULL_FLUSH: Lt,
              Z_FINISH: rt,
              Z_BLOCK: it,
              Z_OK: tt,
              Z_STREAM_END: Et,
              Z_STREAM_ERROR: lt,
              Z_DATA_ERROR: wt,
              Z_BUF_ERROR: Pt,
              Z_DEFAULT_COMPRESSION: vt,
              Z_FILTERED: bt,
              Z_HUFFMAN_ONLY: mt,
              Z_RLE: Tt,
              Z_FIXED: Ot,
              Z_DEFAULT_STRATEGY: Ft,
              Z_UNKNOWN: Qt,
              Z_DEFLATED: kt
            } = Ee, Jt = 9, qt = 15, er = 8, Ht = 29, lr = 256 + 1 + Ht, Or = 30, Dr = 19, Pr = 2 * lr + 1, Ir = 15, at = 3, Bt = 258, pt = Bt + at + 1, yt = 32, At = 42, rr = 57, Rr = 69, $r = 73, Br = 91, zr = 103, Vt = 113, hr = 666, Dt = 1, ir = 2, jt = 3, nr = 4, nn = 3, Kt = (x, W) => (x.msg = be[W], W), Xr = (x) => x * 2 - (x > 4 ? 9 : 0), Gt = (x) => {
              let W = x.length;
              for (; --W >= 0; )
                x[W] = 0;
            }, sn = (x) => {
              let W, O, J, ie = x.w_size;
              W = x.hash_size, J = W;
              do
                O = x.head[--J], x.head[J] = O >= ie ? O - ie : 0;
              while (--W);
              W = ie, J = W;
              do
                O = x.prev[--J], x.prev[J] = O >= ie ? O - ie : 0;
              while (--W);
            };
            let Wt = (x, W, O) => (W << x.hash_shift ^ O) & x.hash_mask;
            const It = (x) => {
              const W = x.state;
              let O = W.pending;
              O > x.avail_out && (O = x.avail_out), O !== 0 && (x.output.set(W.pending_buf.subarray(W.pending_out, W.pending_out + O), x.next_out), x.next_out += O, W.pending_out += O, x.total_out += O, x.avail_out -= O, W.pending -= O, W.pending === 0 && (W.pending_out = 0));
            }, Rt = (x, W) => {
              Le(x, x.block_start >= 0 ? x.block_start : -1, x.strstart - x.block_start, W), x.block_start = x.strstart, It(x.strm);
            }, dt = (x, W) => {
              x.pending_buf[x.pending++] = W;
            }, fr = (x, W) => {
              x.pending_buf[x.pending++] = W >>> 8 & 255, x.pending_buf[x.pending++] = W & 255;
            }, Fr = (x, W, O, J) => {
              let ie = x.avail_in;
              return ie > J && (ie = J), ie === 0 ? 0 : (x.avail_in -= ie, W.set(x.input.subarray(x.next_in, x.next_in + ie), O), x.state.wrap === 1 ? x.adler = Oe(x.adler, W, ie, O) : x.state.wrap === 2 && (x.adler = R(x.adler, W, ie, O)), x.next_in += ie, x.total_in += ie, ie);
            }, Qr = (x, W) => {
              let O = x.max_chain_length, J = x.strstart, ie, te, De = x.prev_length, xe = x.nice_match;
              const Qe = x.strstart > x.w_size - pt ? x.strstart - (x.w_size - pt) : 0, _e = x.window, Pe = x.w_mask, ut = x.prev, Xe = x.strstart + Bt;
              let Ge = _e[J + De - 1], qe = _e[J + De];
              x.prev_length >= x.good_match && (O >>= 2), xe > x.lookahead && (xe = x.lookahead);
              do
                if (ie = W, !(_e[ie + De] !== qe || _e[ie + De - 1] !== Ge || _e[ie] !== _e[J] || _e[++ie] !== _e[J + 1])) {
                  J += 2, ie++;
                  do
                    ;
                  while (_e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && _e[++J] === _e[++ie] && J < Xe);
                  if (te = Bt - (Xe - J), J = Xe - Bt, te > De) {
                    if (x.match_start = W, De = te, te >= xe)
                      break;
                    Ge = _e[J + De - 1], qe = _e[J + De];
                  }
                }
              while ((W = ut[W & Pe]) > Qe && --O !== 0);
              return De <= x.lookahead ? De : x.lookahead;
            }, sr = (x) => {
              const W = x.w_size;
              let O, J, ie;
              do {
                if (J = x.window_size - x.lookahead - x.strstart, x.strstart >= W + (W - pt) && (x.window.set(x.window.subarray(W, W + W - J), 0), x.match_start -= W, x.strstart -= W, x.block_start -= W, x.insert > x.strstart && (x.insert = x.strstart), sn(x), J += W), x.strm.avail_in === 0)
                  break;
                if (O = Fr(x.strm, x.window, x.strstart + x.lookahead, J), x.lookahead += O, x.lookahead + x.insert >= at)
                  for (ie = x.strstart - x.insert, x.ins_h = x.window[ie], x.ins_h = Wt(x, x.ins_h, x.window[ie + 1]); x.insert && (x.ins_h = Wt(x, x.ins_h, x.window[ie + at - 1]), x.prev[ie & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = ie, ie++, x.insert--, !(x.lookahead + x.insert < at)); )
                    ;
              } while (x.lookahead < pt && x.strm.avail_in !== 0);
            }, Jr = (x, W) => {
              let O = x.pending_buf_size - 5 > x.w_size ? x.w_size : x.pending_buf_size - 5, J, ie, te, De = 0, xe = x.strm.avail_in;
              do {
                if (J = 65535, te = x.bi_valid + 42 >> 3, x.strm.avail_out < te || (te = x.strm.avail_out - te, ie = x.strstart - x.block_start, J > ie + x.strm.avail_in && (J = ie + x.strm.avail_in), J > te && (J = te), J < O && (J === 0 && W !== rt || W === je || J !== ie + x.strm.avail_in)))
                  break;
                De = W === rt && J === ie + x.strm.avail_in ? 1 : 0, le(x, 0, 0, De), x.pending_buf[x.pending - 4] = J, x.pending_buf[x.pending - 3] = J >> 8, x.pending_buf[x.pending - 2] = ~J, x.pending_buf[x.pending - 1] = ~J >> 8, It(x.strm), ie && (ie > J && (ie = J), x.strm.output.set(x.window.subarray(x.block_start, x.block_start + ie), x.strm.next_out), x.strm.next_out += ie, x.strm.avail_out -= ie, x.strm.total_out += ie, x.block_start += ie, J -= ie), J && (Fr(x.strm, x.strm.output, x.strm.next_out, J), x.strm.next_out += J, x.strm.avail_out -= J, x.strm.total_out += J);
              } while (De === 0);
              return xe -= x.strm.avail_in, xe && (xe >= x.w_size ? (x.matches = 2, x.window.set(x.strm.input.subarray(x.strm.next_in - x.w_size, x.strm.next_in), 0), x.strstart = x.w_size, x.insert = x.strstart) : (x.window_size - x.strstart <= xe && (x.strstart -= x.w_size, x.window.set(x.window.subarray(x.w_size, x.w_size + x.strstart), 0), x.matches < 2 && x.matches++, x.insert > x.strstart && (x.insert = x.strstart)), x.window.set(x.strm.input.subarray(x.strm.next_in - xe, x.strm.next_in), x.strstart), x.strstart += xe, x.insert += xe > x.w_size - x.insert ? x.w_size - x.insert : xe), x.block_start = x.strstart), x.high_water < x.strstart && (x.high_water = x.strstart), De ? nr : W !== je && W !== rt && x.strm.avail_in === 0 && x.strstart === x.block_start ? ir : (te = x.window_size - x.strstart, x.strm.avail_in > te && x.block_start >= x.w_size && (x.block_start -= x.w_size, x.strstart -= x.w_size, x.window.set(x.window.subarray(x.w_size, x.w_size + x.strstart), 0), x.matches < 2 && x.matches++, te += x.w_size, x.insert > x.strstart && (x.insert = x.strstart)), te > x.strm.avail_in && (te = x.strm.avail_in), te && (Fr(x.strm, x.window, x.strstart, te), x.strstart += te, x.insert += te > x.w_size - x.insert ? x.w_size - x.insert : te), x.high_water < x.strstart && (x.high_water = x.strstart), te = x.bi_valid + 42 >> 3, te = x.pending_buf_size - te > 65535 ? 65535 : x.pending_buf_size - te, O = te > x.w_size ? x.w_size : te, ie = x.strstart - x.block_start, (ie >= O || (ie || W === rt) && W !== je && x.strm.avail_in === 0 && ie <= te) && (J = ie > te ? te : ie, De = W === rt && x.strm.avail_in === 0 && J === ie ? 1 : 0, le(x, x.block_start, J, De), x.block_start += J, It(x.strm)), De ? jt : Dt);
            }, kr = (x, W) => {
              let O, J;
              for (; ; ) {
                if (x.lookahead < pt) {
                  if (sr(x), x.lookahead < pt && W === je)
                    return Dt;
                  if (x.lookahead === 0)
                    break;
                }
                if (O = 0, x.lookahead >= at && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart), O !== 0 && x.strstart - O <= x.w_size - pt && (x.match_length = Qr(x, O)), x.match_length >= at)
                  if (J = Ze(x, x.strstart - x.match_start, x.match_length - at), x.lookahead -= x.match_length, x.match_length <= x.max_lazy_match && x.lookahead >= at) {
                    x.match_length--;
                    do
                      x.strstart++, x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart;
                    while (--x.match_length !== 0);
                    x.strstart++;
                  } else
                    x.strstart += x.match_length, x.match_length = 0, x.ins_h = x.window[x.strstart], x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + 1]);
                else
                  J = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++;
                if (J && (Rt(x, !1), x.strm.avail_out === 0))
                  return Dt;
              }
              return x.insert = x.strstart < at - 1 ? x.strstart : at - 1, W === rt ? (Rt(x, !0), x.strm.avail_out === 0 ? jt : nr) : x.sym_next && (Rt(x, !1), x.strm.avail_out === 0) ? Dt : ir;
            }, ar = (x, W) => {
              let O, J, ie;
              for (; ; ) {
                if (x.lookahead < pt) {
                  if (sr(x), x.lookahead < pt && W === je)
                    return Dt;
                  if (x.lookahead === 0)
                    break;
                }
                if (O = 0, x.lookahead >= at && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart), x.prev_length = x.match_length, x.prev_match = x.match_start, x.match_length = at - 1, O !== 0 && x.prev_length < x.max_lazy_match && x.strstart - O <= x.w_size - pt && (x.match_length = Qr(x, O), x.match_length <= 5 && (x.strategy === bt || x.match_length === at && x.strstart - x.match_start > 4096) && (x.match_length = at - 1)), x.prev_length >= at && x.match_length <= x.prev_length) {
                  ie = x.strstart + x.lookahead - at, J = Ze(x, x.strstart - 1 - x.prev_match, x.prev_length - at), x.lookahead -= x.prev_length - 1, x.prev_length -= 2;
                  do
                    ++x.strstart <= ie && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart);
                  while (--x.prev_length !== 0);
                  if (x.match_available = 0, x.match_length = at - 1, x.strstart++, J && (Rt(x, !1), x.strm.avail_out === 0))
                    return Dt;
                } else if (x.match_available) {
                  if (J = Ze(x, 0, x.window[x.strstart - 1]), J && Rt(x, !1), x.strstart++, x.lookahead--, x.strm.avail_out === 0)
                    return Dt;
                } else
                  x.match_available = 1, x.strstart++, x.lookahead--;
              }
              return x.match_available && (J = Ze(x, 0, x.window[x.strstart - 1]), x.match_available = 0), x.insert = x.strstart < at - 1 ? x.strstart : at - 1, W === rt ? (Rt(x, !0), x.strm.avail_out === 0 ? jt : nr) : x.sym_next && (Rt(x, !1), x.strm.avail_out === 0) ? Dt : ir;
            }, an = (x, W) => {
              let O, J, ie, te;
              const De = x.window;
              for (; ; ) {
                if (x.lookahead <= Bt) {
                  if (sr(x), x.lookahead <= Bt && W === je)
                    return Dt;
                  if (x.lookahead === 0)
                    break;
                }
                if (x.match_length = 0, x.lookahead >= at && x.strstart > 0 && (ie = x.strstart - 1, J = De[ie], J === De[++ie] && J === De[++ie] && J === De[++ie])) {
                  te = x.strstart + Bt;
                  do
                    ;
                  while (J === De[++ie] && J === De[++ie] && J === De[++ie] && J === De[++ie] && J === De[++ie] && J === De[++ie] && J === De[++ie] && J === De[++ie] && ie < te);
                  x.match_length = Bt - (te - ie), x.match_length > x.lookahead && (x.match_length = x.lookahead);
                }
                if (x.match_length >= at ? (O = Ze(x, 1, x.match_length - at), x.lookahead -= x.match_length, x.strstart += x.match_length, x.match_length = 0) : (O = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++), O && (Rt(x, !1), x.strm.avail_out === 0))
                  return Dt;
              }
              return x.insert = 0, W === rt ? (Rt(x, !0), x.strm.avail_out === 0 ? jt : nr) : x.sym_next && (Rt(x, !1), x.strm.avail_out === 0) ? Dt : ir;
            }, on = (x, W) => {
              let O;
              for (; ; ) {
                if (x.lookahead === 0 && (sr(x), x.lookahead === 0)) {
                  if (W === je)
                    return Dt;
                  break;
                }
                if (x.match_length = 0, O = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++, O && (Rt(x, !1), x.strm.avail_out === 0))
                  return Dt;
              }
              return x.insert = 0, W === rt ? (Rt(x, !0), x.strm.avail_out === 0 ? jt : nr) : x.sym_next && (Rt(x, !1), x.strm.avail_out === 0) ? Dt : ir;
            };
            function zt(x, W, O, J, ie) {
              this.good_length = x, this.max_lazy = W, this.nice_length = O, this.max_chain = J, this.func = ie;
            }
            const cr = [
              /*      good lazy nice chain */
              new zt(0, 0, 0, 0, Jr),
              /* 0 store only */
              new zt(4, 4, 8, 4, kr),
              /* 1 max speed, no lazy matches */
              new zt(4, 5, 16, 8, kr),
              /* 2 */
              new zt(4, 6, 32, 32, kr),
              /* 3 */
              new zt(4, 4, 16, 16, ar),
              /* 4 lazy matches */
              new zt(8, 16, 32, 32, ar),
              /* 5 */
              new zt(8, 16, 128, 128, ar),
              /* 6 */
              new zt(8, 32, 128, 256, ar),
              /* 7 */
              new zt(32, 128, 258, 1024, ar),
              /* 8 */
              new zt(32, 258, 258, 4096, ar)
              /* 9 max compression */
            ], ln = (x) => {
              x.window_size = 2 * x.w_size, Gt(x.head), x.max_lazy_match = cr[x.level].max_lazy, x.good_match = cr[x.level].good_length, x.nice_match = cr[x.level].nice_length, x.max_chain_length = cr[x.level].max_chain, x.strstart = 0, x.block_start = 0, x.lookahead = 0, x.insert = 0, x.match_length = x.prev_length = at - 1, x.match_available = 0, x.ins_h = 0;
            };
            function hn() {
              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 = kt, 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(Pr * 2), this.dyn_dtree = new Uint16Array((2 * Or + 1) * 2), this.bl_tree = new Uint16Array((2 * Dr + 1) * 2), Gt(this.dyn_ltree), Gt(this.dyn_dtree), Gt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(Ir + 1), this.heap = new Uint16Array(2 * lr + 1), Gt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * lr + 1), Gt(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 ur = (x) => {
              if (!x)
                return 1;
              const W = x.state;
              return !W || W.strm !== x || W.status !== At && //#ifdef GZIP
              W.status !== rr && //#endif
              W.status !== Rr && W.status !== $r && W.status !== Br && W.status !== zr && W.status !== Vt && W.status !== hr ? 1 : 0;
            }, qr = (x) => {
              if (ur(x))
                return Kt(x, lt);
              x.total_in = x.total_out = 0, x.data_type = Qt;
              const W = x.state;
              return W.pending = 0, W.pending_out = 0, W.wrap < 0 && (W.wrap = -W.wrap), W.status = //#ifdef GZIP
              W.wrap === 2 ? rr : (
                //#endif
                W.wrap ? At : Vt
              ), x.adler = W.wrap === 2 ? 0 : 1, W.last_flush = -2, X(W), tt;
            }, ei = (x) => {
              const W = qr(x);
              return W === tt && ln(x.state), W;
            }, cn = (x, W) => ur(x) || x.state.wrap !== 2 ? lt : (x.state.gzhead = W, tt), ti = (x, W, O, J, ie, te) => {
              if (!x)
                return lt;
              let De = 1;
              if (W === vt && (W = 6), J < 0 ? (De = 0, J = -J) : J > 15 && (De = 2, J -= 16), ie < 1 || ie > Jt || O !== kt || J < 8 || J > 15 || W < 0 || W > 9 || te < 0 || te > Ot || J === 8 && De !== 1)
                return Kt(x, lt);
              J === 8 && (J = 9);
              const xe = new hn();
              return x.state = xe, xe.strm = x, xe.status = At, xe.wrap = De, xe.gzhead = null, xe.w_bits = J, xe.w_size = 1 << xe.w_bits, xe.w_mask = xe.w_size - 1, xe.hash_bits = ie + 7, xe.hash_size = 1 << xe.hash_bits, xe.hash_mask = xe.hash_size - 1, xe.hash_shift = ~~((xe.hash_bits + at - 1) / at), xe.window = new Uint8Array(xe.w_size * 2), xe.head = new Uint16Array(xe.hash_size), xe.prev = new Uint16Array(xe.w_size), xe.lit_bufsize = 1 << ie + 6, xe.pending_buf_size = xe.lit_bufsize * 4, xe.pending_buf = new Uint8Array(xe.pending_buf_size), xe.sym_buf = xe.lit_bufsize, xe.sym_end = (xe.lit_bufsize - 1) * 3, xe.level = W, xe.strategy = te, xe.method = O, ei(x);
            }, un = (x, W) => ti(x, W, kt, qt, er, Ft), dn = (x, W) => {
              if (ur(x) || W > it || W < 0)
                return x ? Kt(x, lt) : lt;
              const O = x.state;
              if (!x.output || x.avail_in !== 0 && !x.input || O.status === hr && W !== rt)
                return Kt(x, x.avail_out === 0 ? Pt : lt);
              const J = O.last_flush;
              if (O.last_flush = W, O.pending !== 0) {
                if (It(x), x.avail_out === 0)
                  return O.last_flush = -1, tt;
              } else if (x.avail_in === 0 && Xr(W) <= Xr(J) && W !== rt)
                return Kt(x, Pt);
              if (O.status === hr && x.avail_in !== 0)
                return Kt(x, Pt);
              if (O.status === At && O.wrap === 0 && (O.status = Vt), O.status === At) {
                let ie = kt + (O.w_bits - 8 << 4) << 8, te = -1;
                if (O.strategy >= mt || O.level < 2 ? te = 0 : O.level < 6 ? te = 1 : O.level === 6 ? te = 2 : te = 3, ie |= te << 6, O.strstart !== 0 && (ie |= yt), ie += 31 - ie % 31, fr(O, ie), O.strstart !== 0 && (fr(O, x.adler >>> 16), fr(O, x.adler & 65535)), x.adler = 1, O.status = Vt, It(x), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (O.status === rr) {
                if (x.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 >= mt || 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 && (x.adler = R(x.adler, O.pending_buf, O.pending, 0)), O.gzindex = 0, O.status = Rr;
                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 >= mt || O.level < 2 ? 4 : 0), dt(O, nn), O.status = Vt, It(x), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (O.status === Rr) {
                if (O.gzhead.extra) {
                  let ie = O.pending, te = (O.gzhead.extra.length & 65535) - O.gzindex;
                  for (; O.pending + te > O.pending_buf_size; ) {
                    let xe = O.pending_buf_size - O.pending;
                    if (O.pending_buf.set(O.gzhead.extra.subarray(O.gzindex, O.gzindex + xe), O.pending), O.pending = O.pending_buf_size, O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie)), O.gzindex += xe, It(x), O.pending !== 0)
                      return O.last_flush = -1, tt;
                    ie = 0, te -= xe;
                  }
                  let De = new Uint8Array(O.gzhead.extra);
                  O.pending_buf.set(De.subarray(O.gzindex, O.gzindex + te), O.pending), O.pending += te, O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie)), O.gzindex = 0;
                }
                O.status = $r;
              }
              if (O.status === $r) {
                if (O.gzhead.name) {
                  let ie = O.pending, te;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie)), It(x), O.pending !== 0)
                        return O.last_flush = -1, tt;
                      ie = 0;
                    }
                    O.gzindex < O.gzhead.name.length ? te = O.gzhead.name.charCodeAt(O.gzindex++) & 255 : te = 0, dt(O, te);
                  } while (te !== 0);
                  O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie)), O.gzindex = 0;
                }
                O.status = Br;
              }
              if (O.status === Br) {
                if (O.gzhead.comment) {
                  let ie = O.pending, te;
                  do {
                    if (O.pending === O.pending_buf_size) {
                      if (O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie)), It(x), O.pending !== 0)
                        return O.last_flush = -1, tt;
                      ie = 0;
                    }
                    O.gzindex < O.gzhead.comment.length ? te = O.gzhead.comment.charCodeAt(O.gzindex++) & 255 : te = 0, dt(O, te);
                  } while (te !== 0);
                  O.gzhead.hcrc && O.pending > ie && (x.adler = R(x.adler, O.pending_buf, O.pending - ie, ie));
                }
                O.status = zr;
              }
              if (O.status === zr) {
                if (O.gzhead.hcrc) {
                  if (O.pending + 2 > O.pending_buf_size && (It(x), O.pending !== 0))
                    return O.last_flush = -1, tt;
                  dt(O, x.adler & 255), dt(O, x.adler >> 8 & 255), x.adler = 0;
                }
                if (O.status = Vt, It(x), O.pending !== 0)
                  return O.last_flush = -1, tt;
              }
              if (x.avail_in !== 0 || O.lookahead !== 0 || W !== je && O.status !== hr) {
                let ie = O.level === 0 ? Jr(O, W) : O.strategy === mt ? on(O, W) : O.strategy === Tt ? an(O, W) : cr[O.level].func(O, W);
                if ((ie === jt || ie === nr) && (O.status = hr), ie === Dt || ie === jt)
                  return x.avail_out === 0 && (O.last_flush = -1), tt;
                if (ie === ir && (W === Je ? Ke(O) : W !== it && (le(O, 0, 0, !1), W === Lt && (Gt(O.head), O.lookahead === 0 && (O.strstart = 0, O.block_start = 0, O.insert = 0))), It(x), x.avail_out === 0))
                  return O.last_flush = -1, tt;
              }
              return W !== rt ? tt : O.wrap <= 0 ? Et : (O.wrap === 2 ? (dt(O, x.adler & 255), dt(O, x.adler >> 8 & 255), dt(O, x.adler >> 16 & 255), dt(O, x.adler >> 24 & 255), dt(O, x.total_in & 255), dt(O, x.total_in >> 8 & 255), dt(O, x.total_in >> 16 & 255), dt(O, x.total_in >> 24 & 255)) : (fr(O, x.adler >>> 16), fr(O, x.adler & 65535)), It(x), O.wrap > 0 && (O.wrap = -O.wrap), O.pending !== 0 ? tt : Et);
            }, _n = (x) => {
              if (ur(x))
                return lt;
              const W = x.state.status;
              return x.state = null, W === Vt ? Kt(x, wt) : tt;
            }, pn = (x, W) => {
              let O = W.length;
              if (ur(x))
                return lt;
              const J = x.state, ie = J.wrap;
              if (ie === 2 || ie === 1 && J.status !== At || J.lookahead)
                return lt;
              if (ie === 1 && (x.adler = Oe(x.adler, W, O, 0)), J.wrap = 0, O >= J.w_size) {
                ie === 0 && (Gt(J.head), J.strstart = 0, J.block_start = 0, J.insert = 0);
                let Qe = new Uint8Array(J.w_size);
                Qe.set(W.subarray(O - J.w_size, O), 0), W = Qe, O = J.w_size;
              }
              const te = x.avail_in, De = x.next_in, xe = x.input;
              for (x.avail_in = O, x.next_in = 0, x.input = W, sr(J); J.lookahead >= at; ) {
                let Qe = J.strstart, _e = J.lookahead - (at - 1);
                do
                  J.ins_h = Wt(J, J.ins_h, J.window[Qe + at - 1]), J.prev[Qe & J.w_mask] = J.head[J.ins_h], J.head[J.ins_h] = Qe, Qe++;
                while (--_e);
                J.strstart = Qe, J.lookahead = at - 1, sr(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, x.next_in = De, x.input = xe, x.avail_in = te, J.wrap = ie, tt;
            };
            var gn = un, mn = ti, vn = ei, bn = qr, yn = cn, xn = dn, En = _n, wn = pn, An = "pako deflate (from Nodeca project)", dr = {
              deflateInit: gn,
              deflateInit2: mn,
              deflateReset: vn,
              deflateResetKeep: bn,
              deflateSetHeader: yn,
              deflate: xn,
              deflateEnd: En,
              deflateSetDictionary: wn,
              deflateInfo: An
            };
            const Mn = (x, W) => Object.prototype.hasOwnProperty.call(x, W);
            var Cn = function(x) {
              const W = Array.prototype.slice.call(arguments, 1);
              for (; W.length; ) {
                const O = W.shift();
                if (O) {
                  if (typeof O != "object")
                    throw new TypeError(O + "must be non-object");
                  for (const J in O)
                    Mn(O, J) && (x[J] = O[J]);
                }
              }
              return x;
            }, Ln = (x) => {
              let W = 0;
              for (let J = 0, ie = x.length; J < ie; J++)
                W += x[J].length;
              const O = new Uint8Array(W);
              for (let J = 0, ie = 0, te = x.length; J < te; J++) {
                let De = x[J];
                O.set(De, ie), ie += De.length;
              }
              return O;
            }, yr = {
              assign: Cn,
              flattenChunks: Ln
            };
            let ri = !0;
            try {
              String.fromCharCode.apply(null, new Uint8Array(1));
            } catch {
              ri = !1;
            }
            const _r = new Uint8Array(256);
            for (let x = 0; x < 256; x++)
              _r[x] = x >= 252 ? 6 : x >= 248 ? 5 : x >= 240 ? 4 : x >= 224 ? 3 : x >= 192 ? 2 : 1;
            _r[254] = _r[254] = 1;
            var Sn = (x) => {
              if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
                return new TextEncoder().encode(x);
              let W, O, J, ie, te, De = x.length, xe = 0;
              for (ie = 0; ie < De; ie++)
                O = x.charCodeAt(ie), (O & 64512) === 55296 && ie + 1 < De && (J = x.charCodeAt(ie + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), ie++)), xe += O < 128 ? 1 : O < 2048 ? 2 : O < 65536 ? 3 : 4;
              for (W = new Uint8Array(xe), te = 0, ie = 0; te < xe; ie++)
                O = x.charCodeAt(ie), (O & 64512) === 55296 && ie + 1 < De && (J = x.charCodeAt(ie + 1), (J & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (J - 56320), ie++)), O < 128 ? W[te++] = O : O < 2048 ? (W[te++] = 192 | O >>> 6, W[te++] = 128 | O & 63) : O < 65536 ? (W[te++] = 224 | O >>> 12, W[te++] = 128 | O >>> 6 & 63, W[te++] = 128 | O & 63) : (W[te++] = 240 | O >>> 18, W[te++] = 128 | O >>> 12 & 63, W[te++] = 128 | O >>> 6 & 63, W[te++] = 128 | O & 63);
              return W;
            };
            const Tn = (x, W) => {
              if (W < 65534 && x.subarray && ri)
                return String.fromCharCode.apply(null, x.length === W ? x : x.subarray(0, W));
              let O = "";
              for (let J = 0; J < W; J++)
                O += String.fromCharCode(x[J]);
              return O;
            };
            var On = (x, W) => {
              const O = W || x.length;
              if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
                return new TextDecoder().decode(x.subarray(0, W));
              let J, ie;
              const te = new Array(O * 2);
              for (ie = 0, J = 0; J < O; ) {
                let De = x[J++];
                if (De < 128) {
                  te[ie++] = De;
                  continue;
                }
                let xe = _r[De];
                if (xe > 4) {
                  te[ie++] = 65533, J += xe - 1;
                  continue;
                }
                for (De &= xe === 2 ? 31 : xe === 3 ? 15 : 7; xe > 1 && J < O; )
                  De = De << 6 | x[J++] & 63, xe--;
                if (xe > 1) {
                  te[ie++] = 65533;
                  continue;
                }
                De < 65536 ? te[ie++] = De : (De -= 65536, te[ie++] = 55296 | De >> 10 & 1023, te[ie++] = 56320 | De & 1023);
              }
              return Tn(te, ie);
            }, Dn = (x, W) => {
              W = W || x.length, W > x.length && (W = x.length);
              let O = W - 1;
              for (; O >= 0 && (x[O] & 192) === 128; )
                O--;
              return O < 0 || O === 0 ? W : O + _r[x[O]] > W ? O : W;
            }, pr = {
              string2buf: Sn,
              buf2string: On,
              utf8border: Dn
            };
            function Pn() {
              this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
            }
            var ii = Pn;
            const ni = Object.prototype.toString, {
              Z_NO_FLUSH: In,
              Z_SYNC_FLUSH: Rn,
              Z_FULL_FLUSH: $n,
              Z_FINISH: Bn,
              Z_OK: xr,
              Z_STREAM_END: zn,
              Z_DEFAULT_COMPRESSION: Fn,
              Z_DEFAULT_STRATEGY: kn,
              Z_DEFLATED: Un
            } = Ee;
            function gr(x) {
              this.options = yr.assign({
                level: Fn,
                method: Un,
                chunkSize: 16384,
                windowBits: 15,
                memLevel: 8,
                strategy: kn
              }, x || {});
              let W = this.options;
              W.raw && W.windowBits > 0 ? W.windowBits = -W.windowBits : W.gzip && W.windowBits > 0 && W.windowBits < 16 && (W.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0;
              let O = dr.deflateInit2(
                this.strm,
                W.level,
                W.method,
                W.windowBits,
                W.memLevel,
                W.strategy
              );
              if (O !== xr)
                throw new Error(be[O]);
              if (W.header && dr.deflateSetHeader(this.strm, W.header), W.dictionary) {
                let J;
                if (typeof W.dictionary == "string" ? J = pr.string2buf(W.dictionary) : ni.call(W.dictionary) === "[object ArrayBuffer]" ? J = new Uint8Array(W.dictionary) : J = W.dictionary, O = dr.deflateSetDictionary(this.strm, J), O !== xr)
                  throw new Error(be[O]);
                this._dict_set = !0;
              }
            }
            gr.prototype.push = function(x, W) {
              const O = this.strm, J = this.options.chunkSize;
              let ie, te;
              if (this.ended)
                return !1;
              for (W === ~~W ? te = W : te = W === !0 ? Bn : In, typeof x == "string" ? O.input = pr.string2buf(x) : ni.call(x) === "[object ArrayBuffer]" ? O.input = new Uint8Array(x) : O.input = x, 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), (te === Rn || te === $n) && O.avail_out <= 6) {
                  this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0;
                  continue;
                }
                if (ie = dr.deflate(O, te), ie === zn)
                  return O.next_out > 0 && this.onData(O.output.subarray(0, O.next_out)), ie = dr.deflateEnd(this.strm), this.onEnd(ie), this.ended = !0, ie === xr;
                if (O.avail_out === 0) {
                  this.onData(O.output);
                  continue;
                }
                if (te > 0 && O.next_out > 0) {
                  this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0;
                  continue;
                }
                if (O.avail_in === 0)
                  break;
              }
              return !0;
            }, gr.prototype.onData = function(x) {
              this.chunks.push(x);
            }, gr.prototype.onEnd = function(x) {
              x === xr && (this.result = yr.flattenChunks(this.chunks)), this.chunks = [], this.err = x, this.msg = this.strm.msg;
            };
            function Ur(x, W) {
              const O = new gr(W);
              if (O.push(x, !0), O.err)
                throw O.msg || be[O.err];
              return O.result;
            }
            function Nn(x, W) {
              return W = W || {}, W.raw = !0, Ur(x, W);
            }
            function Gn(x, W) {
              return W = W || {}, W.gzip = !0, Ur(x, W);
            }
            var Wn = gr, Hn = Ur, Vn = Nn, jn = Gn, Kn = Ee, Zn = {
              Deflate: Wn,
              deflate: Hn,
              deflateRaw: Vn,
              gzip: jn,
              constants: Kn
            };
            const Er = 16209, Yn = 16191;
            var Xn = function(W, O) {
              let J, ie, te, De, xe, Qe, _e, Pe, ut, Xe, Ge, qe, Ct, ft, st, gt, ot, Ye, _t, St, et, xt, ct, nt;
              const ht = W.state;
              J = W.next_in, ct = W.input, ie = J + (W.avail_in - 5), te = W.next_out, nt = W.output, De = te - (O - W.avail_out), xe = te + (W.avail_out - 257), Qe = ht.dmax, _e = ht.wsize, Pe = ht.whave, ut = ht.wnext, Xe = ht.window, Ge = ht.hold, qe = ht.bits, Ct = ht.lencode, ft = ht.distcode, st = (1 << ht.lenbits) - 1, gt = (1 << ht.distbits) - 1;
              e:
                do {
                  qe < 15 && (Ge += ct[J++] << qe, qe += 8, Ge += ct[J++] << qe, qe += 8), ot = Ct[Ge & st];
                  t:
                    for (; ; ) {
                      if (Ye = ot >>> 24, Ge >>>= Ye, qe -= Ye, Ye = ot >>> 16 & 255, Ye === 0)
                        nt[te++] = ot & 65535;
                      else if (Ye & 16) {
                        _t = ot & 65535, Ye &= 15, Ye && (qe < Ye && (Ge += ct[J++] << qe, qe += 8), _t += Ge & (1 << Ye) - 1, Ge >>>= Ye, qe -= Ye), qe < 15 && (Ge += ct[J++] << qe, qe += 8, Ge += ct[J++] << qe, qe += 8), ot = ft[Ge & gt];
                        r:
                          for (; ; ) {
                            if (Ye = ot >>> 24, Ge >>>= Ye, qe -= Ye, Ye = ot >>> 16 & 255, Ye & 16) {
                              if (St = ot & 65535, Ye &= 15, qe < Ye && (Ge += ct[J++] << qe, qe += 8, qe < Ye && (Ge += ct[J++] << qe, qe += 8)), St += Ge & (1 << Ye) - 1, St > Qe) {
                                W.msg = "invalid distance too far back", ht.mode = Er;
                                break e;
                              }
                              if (Ge >>>= Ye, qe -= Ye, Ye = te - De, St > Ye) {
                                if (Ye = St - Ye, Ye > Pe && ht.sane) {
                                  W.msg = "invalid distance too far back", ht.mode = Er;
                                  break e;
                                }
                                if (et = 0, xt = Xe, ut === 0) {
                                  if (et += _e - Ye, Ye < _t) {
                                    _t -= Ye;
                                    do
                                      nt[te++] = Xe[et++];
                                    while (--Ye);
                                    et = te - St, xt = nt;
                                  }
                                } else if (ut < Ye) {
                                  if (et += _e + ut - Ye, Ye -= ut, Ye < _t) {
                                    _t -= Ye;
                                    do
                                      nt[te++] = Xe[et++];
                                    while (--Ye);
                                    if (et = 0, ut < _t) {
                                      Ye = ut, _t -= Ye;
                                      do
                                        nt[te++] = Xe[et++];
                                      while (--Ye);
                                      et = te - St, xt = nt;
                                    }
                                  }
                                } else if (et += ut - Ye, Ye < _t) {
                                  _t -= Ye;
                                  do
                                    nt[te++] = Xe[et++];
                                  while (--Ye);
                                  et = te - St, xt = nt;
                                }
                                for (; _t > 2; )
                                  nt[te++] = xt[et++], nt[te++] = xt[et++], nt[te++] = xt[et++], _t -= 3;
                                _t && (nt[te++] = xt[et++], _t > 1 && (nt[te++] = xt[et++]));
                              } else {
                                et = te - St;
                                do
                                  nt[te++] = nt[et++], nt[te++] = nt[et++], nt[te++] = nt[et++], _t -= 3;
                                while (_t > 2);
                                _t && (nt[te++] = nt[et++], _t > 1 && (nt[te++] = nt[et++]));
                              }
                            } else if (Ye & 64) {
                              W.msg = "invalid distance code", ht.mode = Er;
                              break e;
                            } else {
                              ot = ft[(ot & 65535) + (Ge & (1 << Ye) - 1)];
                              continue r;
                            }
                            break;
                          }
                      } else if (Ye & 64)
                        if (Ye & 32) {
                          ht.mode = Yn;
                          break e;
                        } else {
                          W.msg = "invalid literal/length code", ht.mode = Er;
                          break e;
                        }
                      else {
                        ot = Ct[(ot & 65535) + (Ge & (1 << Ye) - 1)];
                        continue t;
                      }
                      break;
                    }
                } while (J < ie && te < xe);
              _t = qe >> 3, J -= _t, qe -= _t << 3, Ge &= (1 << qe) - 1, W.next_in = J, W.next_out = te, W.avail_in = J < ie ? 5 + (ie - J) : 5 - (J - ie), W.avail_out = te < xe ? 257 + (xe - te) : 257 - (te - xe), ht.hold = Ge, ht.bits = qe;
            };
            const or = 15, si = 852, ai = 592, oi = 0, Nr = 1, li = 2, Qn = 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
            ]), Jn = 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
            ]), es = 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 mr = (x, W, O, J, ie, te, De, xe) => {
              const Qe = xe.bits;
              let _e = 0, Pe = 0, ut = 0, Xe = 0, Ge = 0, qe = 0, Ct = 0, ft = 0, st = 0, gt = 0, ot, Ye, _t, St, et, xt = null, ct;
              const nt = new Uint16Array(or + 1), ht = new Uint16Array(or + 1);
              let Xt = null, rn, Sr, Tr;
              for (_e = 0; _e <= or; _e++)
                nt[_e] = 0;
              for (Pe = 0; Pe < J; Pe++)
                nt[W[O + Pe]]++;
              for (Ge = Qe, Xe = or; Xe >= 1 && nt[Xe] === 0; Xe--)
                ;
              if (Ge > Xe && (Ge = Xe), Xe === 0)
                return ie[te++] = 1 << 24 | 64 << 16 | 0, ie[te++] = 1 << 24 | 64 << 16 | 0, xe.bits = 1, 0;
              for (ut = 1; ut < Xe && nt[ut] === 0; ut++)
                ;
              for (Ge < ut && (Ge = ut), ft = 1, _e = 1; _e <= or; _e++)
                if (ft <<= 1, ft -= nt[_e], ft < 0)
                  return -1;
              if (ft > 0 && (x === oi || Xe !== 1))
                return -1;
              for (ht[1] = 0, _e = 1; _e < or; _e++)
                ht[_e + 1] = ht[_e] + nt[_e];
              for (Pe = 0; Pe < J; Pe++)
                W[O + Pe] !== 0 && (De[ht[W[O + Pe]]++] = Pe);
              if (x === oi ? (xt = Xt = De, ct = 20) : x === Nr ? (xt = Qn, Xt = Jn, ct = 257) : (xt = qn, Xt = es, ct = 0), gt = 0, Pe = 0, _e = ut, et = te, qe = Ge, Ct = 0, _t = -1, st = 1 << Ge, St = st - 1, x === Nr && st > si || x === li && st > ai)
                return 1;
              for (; ; ) {
                rn = _e - Ct, De[Pe] + 1 < ct ? (Sr = 0, Tr = De[Pe]) : De[Pe] >= ct ? (Sr = Xt[De[Pe] - ct], Tr = xt[De[Pe] - ct]) : (Sr = 32 + 64, Tr = 0), ot = 1 << _e - Ct, Ye = 1 << qe, ut = Ye;
                do
                  Ye -= ot, ie[et + (gt >> Ct) + Ye] = rn << 24 | Sr << 16 | Tr | 0;
                while (Ye !== 0);
                for (ot = 1 << _e - 1; gt & ot; )
                  ot >>= 1;
                if (ot !== 0 ? (gt &= ot - 1, gt += ot) : gt = 0, Pe++, --nt[_e] === 0) {
                  if (_e === Xe)
                    break;
                  _e = W[O + De[Pe]];
                }
                if (_e > Ge && (gt & St) !== _t) {
                  for (Ct === 0 && (Ct = Ge), et += ut, qe = _e - Ct, ft = 1 << qe; qe + Ct < Xe && (ft -= nt[qe + Ct], !(ft <= 0)); )
                    qe++, ft <<= 1;
                  if (st += 1 << qe, x === Nr && st > si || x === li && st > ai)
                    return 1;
                  _t = gt & St, ie[_t] = Ge << 24 | qe << 16 | et - te | 0;
                }
              }
              return gt !== 0 && (ie[et + gt] = _e - Ct << 24 | 64 << 16 | 0), xe.bits = Ge, 0;
            };
            const ts = 0, hi = 1, fi = 2, {
              Z_FINISH: ci,
              Z_BLOCK: rs,
              Z_TREES: wr,
              Z_OK: Zt,
              Z_STREAM_END: is,
              Z_NEED_DICT: ns,
              Z_STREAM_ERROR: $t,
              Z_DATA_ERROR: ui,
              Z_MEM_ERROR: di,
              Z_BUF_ERROR: ss,
              Z_DEFLATED: _i
            } = Ee, Ar = 16180, pi = 16181, gi = 16182, mi = 16183, vi = 16184, bi = 16185, yi = 16186, xi = 16187, Ei = 16188, wi = 16189, Mr = 16190, Ut = 16191, Gr = 16192, Ai = 16193, Wr = 16194, Mi = 16195, Ci = 16196, Li = 16197, Si = 16198, Cr = 16199, Lr = 16200, Ti = 16201, Oi = 16202, Di = 16203, Pi = 16204, Ii = 16205, Hr = 16206, Ri = 16207, $i = 16208, Mt = 16209, Bi = 16210, zi = 16211, as = 852, os = 592, ls = 15, Fi = (x) => (x >>> 24 & 255) + (x >>> 8 & 65280) + ((x & 65280) << 8) + ((x & 255) << 24);
            function hs() {
              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 Yt = (x) => {
              if (!x)
                return 1;
              const W = x.state;
              return !W || W.strm !== x || W.mode < Ar || W.mode > zi ? 1 : 0;
            }, ki = (x) => {
              if (Yt(x))
                return $t;
              const W = x.state;
              return x.total_in = x.total_out = W.total = 0, x.msg = "", W.wrap && (x.adler = W.wrap & 1), W.mode = Ar, W.last = 0, W.havedict = 0, W.flags = -1, W.dmax = 32768, W.head = null, W.hold = 0, W.bits = 0, W.lencode = W.lendyn = new Int32Array(as), W.distcode = W.distdyn = new Int32Array(os), W.sane = 1, W.back = -1, Zt;
            }, Ui = (x) => {
              if (Yt(x))
                return $t;
              const W = x.state;
              return W.wsize = 0, W.whave = 0, W.wnext = 0, ki(x);
            }, Ni = (x, W) => {
              let O;
              if (Yt(x))
                return $t;
              const J = x.state;
              return W < 0 ? (O = 0, W = -W) : (O = (W >> 4) + 5, W < 48 && (W &= 15)), W && (W < 8 || W > 15) ? $t : (J.window !== null && J.wbits !== W && (J.window = null), J.wrap = O, J.wbits = W, Ui(x));
            }, Gi = (x, W) => {
              if (!x)
                return $t;
              const O = new hs();
              x.state = O, O.strm = x, O.window = null, O.mode = Ar;
              const J = Ni(x, W);
              return J !== Zt && (x.state = null), J;
            }, fs = (x) => Gi(x, ls);
            let Wi = !0, Vr, jr;
            const cs = (x) => {
              if (Wi) {
                Vr = new Int32Array(512), jr = new Int32Array(32);
                let W = 0;
                for (; W < 144; )
                  x.lens[W++] = 8;
                for (; W < 256; )
                  x.lens[W++] = 9;
                for (; W < 280; )
                  x.lens[W++] = 7;
                for (; W < 288; )
                  x.lens[W++] = 8;
                for (mr(hi, x.lens, 0, 288, Vr, 0, x.work, { bits: 9 }), W = 0; W < 32; )
                  x.lens[W++] = 5;
                mr(fi, x.lens, 0, 32, jr, 0, x.work, { bits: 5 }), Wi = !1;
              }
              x.lencode = Vr, x.lenbits = 9, x.distcode = jr, x.distbits = 5;
            }, Hi = (x, W, O, J) => {
              let ie;
              const te = x.state;
              return te.window === null && (te.wsize = 1 << te.wbits, te.wnext = 0, te.whave = 0, te.window = new Uint8Array(te.wsize)), J >= te.wsize ? (te.window.set(W.subarray(O - te.wsize, O), 0), te.wnext = 0, te.whave = te.wsize) : (ie = te.wsize - te.wnext, ie > J && (ie = J), te.window.set(W.subarray(O - J, O - J + ie), te.wnext), J -= ie, J ? (te.window.set(W.subarray(O - J, O), 0), te.wnext = J, te.whave = te.wsize) : (te.wnext += ie, te.wnext === te.wsize && (te.wnext = 0), te.whave < te.wsize && (te.whave += ie))), 0;
            }, us = (x, W) => {
              let O, J, ie, te, De, xe, Qe, _e, Pe, ut, Xe, Ge, qe, Ct, ft = 0, st, gt, ot, Ye, _t, St, et, xt;
              const ct = new Uint8Array(4);
              let nt, ht;
              const Xt = (
                /* 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 (Yt(x) || !x.output || !x.input && x.avail_in !== 0)
                return $t;
              O = x.state, O.mode === Ut && (O.mode = Gr), De = x.next_out, ie = x.output, Qe = x.avail_out, te = x.next_in, J = x.input, xe = x.avail_in, _e = O.hold, Pe = O.bits, ut = xe, Xe = Qe, xt = Zt;
              e:
                for (; ; )
                  switch (O.mode) {
                    case Ar:
                      if (O.wrap === 0) {
                        O.mode = Gr;
                        break;
                      }
                      for (; Pe < 16; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if (O.wrap & 2 && _e === 35615) {
                        O.wbits === 0 && (O.wbits = 15), O.check = 0, ct[0] = _e & 255, ct[1] = _e >>> 8 & 255, O.check = R(O.check, ct, 2, 0), _e = 0, Pe = 0, O.mode = pi;
                        break;
                      }
                      if (O.head && (O.head.done = !1), !(O.wrap & 1) || /* check if zlib header allowed */
                      (((_e & 255) << 8) + (_e >> 8)) % 31) {
                        x.msg = "incorrect header check", O.mode = Mt;
                        break;
                      }
                      if ((_e & 15) !== _i) {
                        x.msg = "unknown compression method", O.mode = Mt;
                        break;
                      }
                      if (_e >>>= 4, Pe -= 4, et = (_e & 15) + 8, O.wbits === 0 && (O.wbits = et), et > 15 || et > O.wbits) {
                        x.msg = "invalid window size", O.mode = Mt;
                        break;
                      }
                      O.dmax = 1 << O.wbits, O.flags = 0, x.adler = O.check = 1, O.mode = _e & 512 ? wi : Ut, _e = 0, Pe = 0;
                      break;
                    case pi:
                      for (; Pe < 16; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if (O.flags = _e, (O.flags & 255) !== _i) {
                        x.msg = "unknown compression method", O.mode = Mt;
                        break;
                      }
                      if (O.flags & 57344) {
                        x.msg = "unknown header flags set", O.mode = Mt;
                        break;
                      }
                      O.head && (O.head.text = _e >> 8 & 1), O.flags & 512 && O.wrap & 4 && (ct[0] = _e & 255, ct[1] = _e >>> 8 & 255, O.check = R(O.check, ct, 2, 0)), _e = 0, Pe = 0, O.mode = gi;
                    case gi:
                      for (; Pe < 32; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      O.head && (O.head.time = _e), O.flags & 512 && O.wrap & 4 && (ct[0] = _e & 255, ct[1] = _e >>> 8 & 255, ct[2] = _e >>> 16 & 255, ct[3] = _e >>> 24 & 255, O.check = R(O.check, ct, 4, 0)), _e = 0, Pe = 0, O.mode = mi;
                    case mi:
                      for (; Pe < 16; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      O.head && (O.head.xflags = _e & 255, O.head.os = _e >> 8), O.flags & 512 && O.wrap & 4 && (ct[0] = _e & 255, ct[1] = _e >>> 8 & 255, O.check = R(O.check, ct, 2, 0)), _e = 0, Pe = 0, O.mode = vi;
                    case vi:
                      if (O.flags & 1024) {
                        for (; Pe < 16; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        O.length = _e, O.head && (O.head.extra_len = _e), O.flags & 512 && O.wrap & 4 && (ct[0] = _e & 255, ct[1] = _e >>> 8 & 255, O.check = R(O.check, ct, 2, 0)), _e = 0, Pe = 0;
                      } else
                        O.head && (O.head.extra = null);
                      O.mode = bi;
                    case bi:
                      if (O.flags & 1024 && (Ge = O.length, Ge > xe && (Ge = xe), Ge && (O.head && (et = O.head.extra_len - O.length, O.head.extra || (O.head.extra = new Uint8Array(O.head.extra_len)), O.head.extra.set(
                        J.subarray(
                          te,
                          // extra field is limited to 65536 bytes
                          // - no need for additional size check
                          te + Ge
                        ),
                        /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
                        et
                      )), O.flags & 512 && O.wrap & 4 && (O.check = R(O.check, J, Ge, te)), xe -= Ge, te += Ge, O.length -= Ge), O.length))
                        break e;
                      O.length = 0, O.mode = yi;
                    case yi:
                      if (O.flags & 2048) {
                        if (xe === 0)
                          break e;
                        Ge = 0;
                        do
                          et = J[te + Ge++], O.head && et && O.length < 65536 && (O.head.name += String.fromCharCode(et));
                        while (et && Ge < xe);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = R(O.check, J, Ge, te)), xe -= Ge, te += Ge, et)
                          break e;
                      } else
                        O.head && (O.head.name = null);
                      O.length = 0, O.mode = xi;
                    case xi:
                      if (O.flags & 4096) {
                        if (xe === 0)
                          break e;
                        Ge = 0;
                        do
                          et = J[te + Ge++], O.head && et && O.length < 65536 && (O.head.comment += String.fromCharCode(et));
                        while (et && Ge < xe);
                        if (O.flags & 512 && O.wrap & 4 && (O.check = R(O.check, J, Ge, te)), xe -= Ge, te += Ge, et)
                          break e;
                      } else
                        O.head && (O.head.comment = null);
                      O.mode = Ei;
                    case Ei:
                      if (O.flags & 512) {
                        for (; Pe < 16; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        if (O.wrap & 4 && _e !== (O.check & 65535)) {
                          x.msg = "header crc mismatch", O.mode = Mt;
                          break;
                        }
                        _e = 0, Pe = 0;
                      }
                      O.head && (O.head.hcrc = O.flags >> 9 & 1, O.head.done = !0), x.adler = O.check = 0, O.mode = Ut;
                      break;
                    case wi:
                      for (; Pe < 32; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      x.adler = O.check = Fi(_e), _e = 0, Pe = 0, O.mode = Mr;
                    case Mr:
                      if (O.havedict === 0)
                        return x.next_out = De, x.avail_out = Qe, x.next_in = te, x.avail_in = xe, O.hold = _e, O.bits = Pe, ns;
                      x.adler = O.check = 1, O.mode = Ut;
                    case Ut:
                      if (W === rs || W === wr)
                        break e;
                    case Gr:
                      if (O.last) {
                        _e >>>= Pe & 7, Pe -= Pe & 7, O.mode = Hr;
                        break;
                      }
                      for (; Pe < 3; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      switch (O.last = _e & 1, _e >>>= 1, Pe -= 1, _e & 3) {
                        case 0:
                          O.mode = Ai;
                          break;
                        case 1:
                          if (cs(O), O.mode = Cr, W === wr) {
                            _e >>>= 2, Pe -= 2;
                            break e;
                          }
                          break;
                        case 2:
                          O.mode = Ci;
                          break;
                        case 3:
                          x.msg = "invalid block type", O.mode = Mt;
                      }
                      _e >>>= 2, Pe -= 2;
                      break;
                    case Ai:
                      for (_e >>>= Pe & 7, Pe -= Pe & 7; Pe < 32; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if ((_e & 65535) !== (_e >>> 16 ^ 65535)) {
                        x.msg = "invalid stored block lengths", O.mode = Mt;
                        break;
                      }
                      if (O.length = _e & 65535, _e = 0, Pe = 0, O.mode = Wr, W === wr)
                        break e;
                    case Wr:
                      O.mode = Mi;
                    case Mi:
                      if (Ge = O.length, Ge) {
                        if (Ge > xe && (Ge = xe), Ge > Qe && (Ge = Qe), Ge === 0)
                          break e;
                        ie.set(J.subarray(te, te + Ge), De), xe -= Ge, te += Ge, Qe -= Ge, De += Ge, O.length -= Ge;
                        break;
                      }
                      O.mode = Ut;
                      break;
                    case Ci:
                      for (; Pe < 14; ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if (O.nlen = (_e & 31) + 257, _e >>>= 5, Pe -= 5, O.ndist = (_e & 31) + 1, _e >>>= 5, Pe -= 5, O.ncode = (_e & 15) + 4, _e >>>= 4, Pe -= 4, O.nlen > 286 || O.ndist > 30) {
                        x.msg = "too many length or distance symbols", O.mode = Mt;
                        break;
                      }
                      O.have = 0, O.mode = Li;
                    case Li:
                      for (; O.have < O.ncode; ) {
                        for (; Pe < 3; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        O.lens[Xt[O.have++]] = _e & 7, _e >>>= 3, Pe -= 3;
                      }
                      for (; O.have < 19; )
                        O.lens[Xt[O.have++]] = 0;
                      if (O.lencode = O.lendyn, O.lenbits = 7, nt = { bits: O.lenbits }, xt = mr(ts, O.lens, 0, 19, O.lencode, 0, O.work, nt), O.lenbits = nt.bits, xt) {
                        x.msg = "invalid code lengths set", O.mode = Mt;
                        break;
                      }
                      O.have = 0, O.mode = Si;
                    case Si:
                      for (; O.have < O.nlen + O.ndist; ) {
                        for (; ft = O.lencode[_e & (1 << O.lenbits) - 1], st = ft >>> 24, gt = ft >>> 16 & 255, ot = ft & 65535, !(st <= Pe); ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        if (ot < 16)
                          _e >>>= st, Pe -= st, O.lens[O.have++] = ot;
                        else {
                          if (ot === 16) {
                            for (ht = st + 2; Pe < ht; ) {
                              if (xe === 0)
                                break e;
                              xe--, _e += J[te++] << Pe, Pe += 8;
                            }
                            if (_e >>>= st, Pe -= st, O.have === 0) {
                              x.msg = "invalid bit length repeat", O.mode = Mt;
                              break;
                            }
                            et = O.lens[O.have - 1], Ge = 3 + (_e & 3), _e >>>= 2, Pe -= 2;
                          } else if (ot === 17) {
                            for (ht = st + 3; Pe < ht; ) {
                              if (xe === 0)
                                break e;
                              xe--, _e += J[te++] << Pe, Pe += 8;
                            }
                            _e >>>= st, Pe -= st, et = 0, Ge = 3 + (_e & 7), _e >>>= 3, Pe -= 3;
                          } else {
                            for (ht = st + 7; Pe < ht; ) {
                              if (xe === 0)
                                break e;
                              xe--, _e += J[te++] << Pe, Pe += 8;
                            }
                            _e >>>= st, Pe -= st, et = 0, Ge = 11 + (_e & 127), _e >>>= 7, Pe -= 7;
                          }
                          if (O.have + Ge > O.nlen + O.ndist) {
                            x.msg = "invalid bit length repeat", O.mode = Mt;
                            break;
                          }
                          for (; Ge--; )
                            O.lens[O.have++] = et;
                        }
                      }
                      if (O.mode === Mt)
                        break;
                      if (O.lens[256] === 0) {
                        x.msg = "invalid code -- missing end-of-block", O.mode = Mt;
                        break;
                      }
                      if (O.lenbits = 9, nt = { bits: O.lenbits }, xt = mr(hi, O.lens, 0, O.nlen, O.lencode, 0, O.work, nt), O.lenbits = nt.bits, xt) {
                        x.msg = "invalid literal/lengths set", O.mode = Mt;
                        break;
                      }
                      if (O.distbits = 6, O.distcode = O.distdyn, nt = { bits: O.distbits }, xt = mr(fi, O.lens, O.nlen, O.ndist, O.distcode, 0, O.work, nt), O.distbits = nt.bits, xt) {
                        x.msg = "invalid distances set", O.mode = Mt;
                        break;
                      }
                      if (O.mode = Cr, W === wr)
                        break e;
                    case Cr:
                      O.mode = Lr;
                    case Lr:
                      if (xe >= 6 && Qe >= 258) {
                        x.next_out = De, x.avail_out = Qe, x.next_in = te, x.avail_in = xe, O.hold = _e, O.bits = Pe, Xn(x, Xe), De = x.next_out, ie = x.output, Qe = x.avail_out, te = x.next_in, J = x.input, xe = x.avail_in, _e = O.hold, Pe = O.bits, O.mode === Ut && (O.back = -1);
                        break;
                      }
                      for (O.back = 0; ft = O.lencode[_e & (1 << O.lenbits) - 1], st = ft >>> 24, gt = ft >>> 16 & 255, ot = ft & 65535, !(st <= Pe); ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if (gt && !(gt & 240)) {
                        for (Ye = st, _t = gt, St = ot; ft = O.lencode[St + ((_e & (1 << Ye + _t) - 1) >> Ye)], st = ft >>> 24, gt = ft >>> 16 & 255, ot = ft & 65535, !(Ye + st <= Pe); ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        _e >>>= Ye, Pe -= Ye, O.back += Ye;
                      }
                      if (_e >>>= st, Pe -= st, O.back += st, O.length = ot, gt === 0) {
                        O.mode = Ii;
                        break;
                      }
                      if (gt & 32) {
                        O.back = -1, O.mode = Ut;
                        break;
                      }
                      if (gt & 64) {
                        x.msg = "invalid literal/length code", O.mode = Mt;
                        break;
                      }
                      O.extra = gt & 15, O.mode = Ti;
                    case Ti:
                      if (O.extra) {
                        for (ht = O.extra; Pe < ht; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        O.length += _e & (1 << O.extra) - 1, _e >>>= O.extra, Pe -= O.extra, O.back += O.extra;
                      }
                      O.was = O.length, O.mode = Oi;
                    case Oi:
                      for (; ft = O.distcode[_e & (1 << O.distbits) - 1], st = ft >>> 24, gt = ft >>> 16 & 255, ot = ft & 65535, !(st <= Pe); ) {
                        if (xe === 0)
                          break e;
                        xe--, _e += J[te++] << Pe, Pe += 8;
                      }
                      if (!(gt & 240)) {
                        for (Ye = st, _t = gt, St = ot; ft = O.distcode[St + ((_e & (1 << Ye + _t) - 1) >> Ye)], st = ft >>> 24, gt = ft >>> 16 & 255, ot = ft & 65535, !(Ye + st <= Pe); ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        _e >>>= Ye, Pe -= Ye, O.back += Ye;
                      }
                      if (_e >>>= st, Pe -= st, O.back += st, gt & 64) {
                        x.msg = "invalid distance code", O.mode = Mt;
                        break;
                      }
                      O.offset = ot, O.extra = gt & 15, O.mode = Di;
                    case Di:
                      if (O.extra) {
                        for (ht = O.extra; Pe < ht; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        O.offset += _e & (1 << O.extra) - 1, _e >>>= O.extra, Pe -= O.extra, O.back += O.extra;
                      }
                      if (O.offset > O.dmax) {
                        x.msg = "invalid distance too far back", O.mode = Mt;
                        break;
                      }
                      O.mode = Pi;
                    case Pi:
                      if (Qe === 0)
                        break e;
                      if (Ge = Xe - Qe, O.offset > Ge) {
                        if (Ge = O.offset - Ge, Ge > O.whave && O.sane) {
                          x.msg = "invalid distance too far back", O.mode = Mt;
                          break;
                        }
                        Ge > O.wnext ? (Ge -= O.wnext, qe = O.wsize - Ge) : qe = O.wnext - Ge, Ge > O.length && (Ge = O.length), Ct = O.window;
                      } else
                        Ct = ie, qe = De - O.offset, Ge = O.length;
                      Ge > Qe && (Ge = Qe), Qe -= Ge, O.length -= Ge;
                      do
                        ie[De++] = Ct[qe++];
                      while (--Ge);
                      O.length === 0 && (O.mode = Lr);
                      break;
                    case Ii:
                      if (Qe === 0)
                        break e;
                      ie[De++] = O.length, Qe--, O.mode = Lr;
                      break;
                    case Hr:
                      if (O.wrap) {
                        for (; Pe < 32; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e |= J[te++] << Pe, Pe += 8;
                        }
                        if (Xe -= Qe, x.total_out += Xe, O.total += Xe, O.wrap & 4 && Xe && (x.adler = O.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/
                        O.flags ? R(O.check, ie, Xe, De - Xe) : Oe(O.check, ie, Xe, De - Xe)), Xe = Qe, O.wrap & 4 && (O.flags ? _e : Fi(_e)) !== O.check) {
                          x.msg = "incorrect data check", O.mode = Mt;
                          break;
                        }
                        _e = 0, Pe = 0;
                      }
                      O.mode = Ri;
                    case Ri:
                      if (O.wrap && O.flags) {
                        for (; Pe < 32; ) {
                          if (xe === 0)
                            break e;
                          xe--, _e += J[te++] << Pe, Pe += 8;
                        }
                        if (O.wrap & 4 && _e !== (O.total & 4294967295)) {
                          x.msg = "incorrect length check", O.mode = Mt;
                          break;
                        }
                        _e = 0, Pe = 0;
                      }
                      O.mode = $i;
                    case $i:
                      xt = is;
                      break e;
                    case Mt:
                      xt = ui;
                      break e;
                    case Bi:
                      return di;
                    case zi:
                    default:
                      return $t;
                  }
              return x.next_out = De, x.avail_out = Qe, x.next_in = te, x.avail_in = xe, O.hold = _e, O.bits = Pe, (O.wsize || Xe !== x.avail_out && O.mode < Mt && (O.mode < Hr || W !== ci)) && Hi(x, x.output, x.next_out, Xe - x.avail_out), ut -= x.avail_in, Xe -= x.avail_out, x.total_in += ut, x.total_out += Xe, O.total += Xe, O.wrap & 4 && Xe && (x.adler = O.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
              O.flags ? R(O.check, ie, Xe, x.next_out - Xe) : Oe(O.check, ie, Xe, x.next_out - Xe)), x.data_type = O.bits + (O.last ? 64 : 0) + (O.mode === Ut ? 128 : 0) + (O.mode === Cr || O.mode === Wr ? 256 : 0), (ut === 0 && Xe === 0 || W === ci) && xt === Zt && (xt = ss), xt;
            }, ds = (x) => {
              if (Yt(x))
                return $t;
              let W = x.state;
              return W.window && (W.window = null), x.state = null, Zt;
            }, _s = (x, W) => {
              if (Yt(x))
                return $t;
              const O = x.state;
              return O.wrap & 2 ? (O.head = W, W.done = !1, Zt) : $t;
            }, ps = (x, W) => {
              const O = W.length;
              let J, ie, te;
              return Yt(x) || (J = x.state, J.wrap !== 0 && J.mode !== Mr) ? $t : J.mode === Mr && (ie = 1, ie = Oe(ie, W, O, 0), ie !== J.check) ? ui : (te = Hi(x, W, O, O), te ? (J.mode = Bi, di) : (J.havedict = 1, Zt));
            };
            var gs = Ui, ms = Ni, vs = ki, bs = fs, ys = Gi, xs = us, Es = ds, ws = _s, As = ps, Ms = "pako inflate (from Nodeca project)", Nt = {
              inflateReset: gs,
              inflateReset2: ms,
              inflateResetKeep: vs,
              inflateInit: bs,
              inflateInit2: ys,
              inflate: xs,
              inflateEnd: Es,
              inflateGetHeader: ws,
              inflateSetDictionary: As,
              inflateInfo: Ms
            };
            function Cs() {
              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 Ls = Cs;
            const Vi = Object.prototype.toString, {
              Z_NO_FLUSH: Ss,
              Z_FINISH: Ts,
              Z_OK: vr,
              Z_STREAM_END: Kr,
              Z_NEED_DICT: Zr,
              Z_STREAM_ERROR: Os,
              Z_DATA_ERROR: ji,
              Z_MEM_ERROR: Ds
            } = Ee;
            function br(x) {
              this.options = yr.assign({
                chunkSize: 65536,
                windowBits: 15,
                to: ""
              }, x || {});
              const W = this.options;
              W.raw && W.windowBits >= 0 && W.windowBits < 16 && (W.windowBits = -W.windowBits, W.windowBits === 0 && (W.windowBits = -15)), W.windowBits >= 0 && W.windowBits < 16 && !(x && x.windowBits) && (W.windowBits += 32), W.windowBits > 15 && W.windowBits < 48 && (W.windowBits & 15 || (W.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0;
              let O = Nt.inflateInit2(
                this.strm,
                W.windowBits
              );
              if (O !== vr)
                throw new Error(be[O]);
              if (this.header = new Ls(), Nt.inflateGetHeader(this.strm, this.header), W.dictionary && (typeof W.dictionary == "string" ? W.dictionary = pr.string2buf(W.dictionary) : Vi.call(W.dictionary) === "[object ArrayBuffer]" && (W.dictionary = new Uint8Array(W.dictionary)), W.raw && (O = Nt.inflateSetDictionary(this.strm, W.dictionary), O !== vr)))
                throw new Error(be[O]);
            }
            br.prototype.push = function(x, W) {
              const O = this.strm, J = this.options.chunkSize, ie = this.options.dictionary;
              let te, De, xe;
              if (this.ended)
                return !1;
              for (W === ~~W ? De = W : De = W === !0 ? Ts : Ss, Vi.call(x) === "[object ArrayBuffer]" ? O.input = new Uint8Array(x) : O.input = x, 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), te = Nt.inflate(O, De), te === Zr && ie && (te = Nt.inflateSetDictionary(O, ie), te === vr ? te = Nt.inflate(O, De) : te === ji && (te = Zr)); O.avail_in > 0 && te === Kr && O.state.wrap > 0 && x[O.next_in] !== 0; )
                  Nt.inflateReset(O), te = Nt.inflate(O, De);
                switch (te) {
                  case Os:
                  case ji:
                  case Zr:
                  case Ds:
                    return this.onEnd(te), this.ended = !0, !1;
                }
                if (xe = O.avail_out, O.next_out && (O.avail_out === 0 || te === Kr))
                  if (this.options.to === "string") {
                    let Qe = pr.utf8border(O.output, O.next_out), _e = O.next_out - Qe, Pe = pr.buf2string(O.output, Qe);
                    O.next_out = _e, O.avail_out = J - _e, _e && O.output.set(O.output.subarray(Qe, Qe + _e), 0), this.onData(Pe);
                  } else
                    this.onData(O.output.length === O.next_out ? O.output : O.output.subarray(0, O.next_out));
                if (!(te === vr && xe === 0)) {
                  if (te === Kr)
                    return te = Nt.inflateEnd(this.strm), this.onEnd(te), this.ended = !0, !0;
                  if (O.avail_in === 0)
                    break;
                }
              }
              return !0;
            }, br.prototype.onData = function(x) {
              this.chunks.push(x);
            }, br.prototype.onEnd = function(x) {
              x === vr && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = yr.flattenChunks(this.chunks)), this.chunks = [], this.err = x, this.msg = this.strm.msg;
            };
            function Yr(x, W) {
              const O = new br(W);
              if (O.push(x), O.err)
                throw O.msg || be[O.err];
              return O.result;
            }
            function Ps(x, W) {
              return W = W || {}, W.raw = !0, Yr(x, W);
            }
            var Is = br, Rs = Yr, $s = Ps, Bs = Yr, zs = Ee, Fs = {
              Inflate: Is,
              inflate: Rs,
              inflateRaw: $s,
              ungzip: Bs,
              constants: zs
            };
            const { Deflate: ks, deflate: Us, deflateRaw: Ns, gzip: Gs } = Zn, { Inflate: Ws, inflate: Hs, inflateRaw: Vs, ungzip: js } = Fs;
            var Ki = ks, Zi = Us, Yi = Ns, Xi = Gs, Qi = Ws, Ji = Hs, qi = Vs, en = js, tn = Ee, Ks = {
              Deflate: Ki,
              deflate: Zi,
              deflateRaw: Yi,
              gzip: Xi,
              Inflate: Qi,
              inflate: Ji,
              inflateRaw: qi,
              ungzip: en,
              constants: tn
            };
          }
        )
        /******/
      }, __webpack_module_cache__ = {};
      function __webpack_require__(r) {
        var e = __webpack_module_cache__[r];
        if (e !== void 0)
          return e.exports;
        var t = __webpack_module_cache__[r] = {
          /******/
          // no module.id needed
          /******/
          // no module.loaded needed
          /******/
          exports: {}
          /******/
        };
        return __webpack_modules__[r].call(t.exports, t, t.exports, __webpack_require__), t.exports;
      }
      __webpack_require__.n = (r) => {
        var e = r && r.__esModule ? (
          /******/
          () => r.default
        ) : (
          /******/
          () => r
        );
        return __webpack_require__.d(e, { a: e }), e;
      }, __webpack_require__.d = (r, e) => {
        for (var t in e)
          __webpack_require__.o(e, t) && !__webpack_require__.o(r, t) && Object.defineProperty(r, t, { enumerable: !0, get: e[t] });
      }, __webpack_require__.o = (r, e) => Object.prototype.hasOwnProperty.call(r, e), __webpack_require__.r = (r) => {
        typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(r, "__esModule", { value: !0 });
      }, __webpack_require__("./src/index.ts"), __webpack_require__("./src/SurfaceWorker.js");
      var __webpack_exports__ = __webpack_require__("./src/exporter.js");
      return __webpack_exports__;
    })()
  ));
})(_3Dmol$1);
var _3DmolExports = _3Dmol$1.exports;
const _3Dmol = /* @__PURE__ */ getDefaultExportFromCjs(_3DmolExports), MolecularViewer_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$a,
  add_render_callback,
  append: append$8,
  attr: attr$8,
  binding_callbacks: binding_callbacks$3,
  create_in_transition,
  destroy_each: destroy_each$2,
  detach: detach$a,
  element: element$7,
  ensure_array_like: ensure_array_like$2,
  init: init$a,
  insert: insert$a,
  listen: listen$2,
  noop: noop$6,
  null_to_empty,
  run_all: run_all$3,
  safe_not_equal: safe_not_equal$b,
  select_option,
  select_value,
  set_data: set_data$3,
  set_input_value: set_input_value$1,
  set_style: set_style$3,
  space: space$7,
  svg_element: svg_element$3,
  text: text$3,
  toggle_class: toggle_class$5,
  transition_in: transition_in$7
} = window.__gradio__svelte__internal, { onMount: onMount$1 } = window.__gradio__svelte__internal;
function get_each_context$2(r, e, t) {
  const n = r.slice();
  return n[53] = e[t], n[54] = e, n[55] = t, n;
}
function get_each_context_1$1(r, e, t) {
  const n = r.slice();
  return n[56] = e[t], n[58] = t, n;
}
function get_each_context_2(r, e, t) {
  const n = r.slice();
  return n[59] = e[t], n[60] = e, n[61] = t, n;
}
function get_each_context_3(r, e, t) {
  const n = r.slice();
  return n[62] = e[t], n;
}
function create_if_block_8$1(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o, w, p, v, a, l, g, M, L, T, D, I, z, P;
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("div"), f = element$7("span"), f.textContent = " ", u = element$7("span"), y = text$3("Very high ("), h = text$3(
        /*confidenceLabel*/
        r[2]
      ), _ = text$3(" > 90)"), E = space$7(), c = element$7("div"), C = element$7("span"), C.textContent = " ", b = element$7("span"), A = text$3("Confident (90 > "), S = text$3(
        /*confidenceLabel*/
        r[2]
      ), s = text$3(" > 70)"), o = space$7(), w = element$7("div"), p = element$7("span"), p.textContent = " ", v = element$7("span"), a = text$3("Low (70 > "), l = text$3(
        /*confidenceLabel*/
        r[2]
      ), g = text$3(" > 50)"), M = space$7(), L = element$7("div"), T = element$7("span"), T.textContent = " ", D = element$7("span"), I = text$3("Very low ("), z = text$3(
        /*confidenceLabel*/
        r[2]
      ), P = text$3(" < 50)"), attr$8(f, "class", "w-4 h-4 svelte-1ib1ln5"), set_style$3(f, "background-color", "rgb(0, 83, 214)"), attr$8(u, "class", "legendlabel svelte-1ib1ln5"), attr$8(n, "class", "flex space-x-1 py-1 items-center svelte-1ib1ln5"), attr$8(C, "class", "w-4 h-4 svelte-1ib1ln5"), set_style$3(C, "background-color", "rgb(101, 203, 243)"), attr$8(b, "class", "legendlabel svelte-1ib1ln5"), attr$8(c, "class", "flex space-x-1 py-1 items-center svelte-1ib1ln5"), attr$8(p, "class", "w-4 h-4 svelte-1ib1ln5"), set_style$3(p, "background-color", "rgb(255, 219, 19)"), attr$8(v, "class", "legendlabel svelte-1ib1ln5"), attr$8(w, "class", "flex space-x-1 py-1 items-center svelte-1ib1ln5"), attr$8(T, "class", "w-4 h-4 svelte-1ib1ln5"), set_style$3(T, "background-color", "rgb(255, 125, 69)"), attr$8(D, "class", "legendlabel svelte-1ib1ln5"), attr$8(L, "class", "flex space-x-1 py-1 items-center svelte-1ib1ln5"), attr$8(t, "class", "flex text-sm items-center space-x-2 justify-center svelte-1ib1ln5"), attr$8(e, "class", "absolute bottom-0 left-0 z-50 p-2 -mb-2 w-full bg-white svelte-1ib1ln5");
    },
    m(B, F) {
      insert$a(B, e, F), append$8(e, t), append$8(t, n), append$8(n, f), append$8(n, u), append$8(u, y), append$8(u, h), append$8(u, _), append$8(t, E), append$8(t, c), append$8(c, C), append$8(c, b), append$8(b, A), append$8(b, S), append$8(b, s), append$8(t, o), append$8(t, w), append$8(w, p), append$8(w, v), append$8(v, a), append$8(v, l), append$8(v, g), append$8(t, M), append$8(t, L), append$8(L, T), append$8(L, D), append$8(D, I), append$8(D, z), append$8(D, P);
    },
    p(B, F) {
      F[0] & /*confidenceLabel*/
      4 && set_data$3(
        h,
        /*confidenceLabel*/
        B[2]
      ), F[0] & /*confidenceLabel*/
      4 && set_data$3(
        S,
        /*confidenceLabel*/
        B[2]
      ), F[0] & /*confidenceLabel*/
      4 && set_data$3(
        l,
        /*confidenceLabel*/
        B[2]
      ), F[0] & /*confidenceLabel*/
      4 && set_data$3(
        z,
        /*confidenceLabel*/
        B[2]
      );
    },
    d(B) {
      B && detach$a(e);
    }
  };
}
function create_if_block_6$1(r) {
  let e;
  function t(u, y) {
    return (
      /*isAnimated*/
      u[10] ? create_else_block$5 : create_if_block_7$1
    );
  }
  let n = t(r), f = n(r);
  return {
    c() {
      e = element$7("div"), f.c(), attr$8(e, "class", "absolute z-50 bottom-0 right-0 mr-2 flex divide-x border border-gray-200 mb-2 rounded items-center justify-center svelte-1ib1ln5");
    },
    m(u, y) {
      insert$a(u, e, y), f.m(e, null);
    },
    p(u, y) {
      n === (n = t(u)) && f ? f.p(u, y) : (f.d(1), f = n(u), f && (f.c(), f.m(e, null)));
    },
    d(u) {
      u && detach$a(e), f.d();
    }
  };
}
function create_else_block$5(r) {
  let e, t, n;
  return {
    c() {
      e = element$7("button"), e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-4 h-4 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z" class="svelte-1ib1ln5"></path></svg>', attr$8(e, "class", "p-2 svelte-1ib1ln5"), attr$8(e, "title", "Pause");
    },
    m(f, u) {
      insert$a(f, e, u), t || (n = listen$2(
        e,
        "click",
        /*toggleAnimation*/
        r[19]
      ), t = !0);
    },
    p: noop$6,
    d(f) {
      f && detach$a(e), t = !1, n();
    }
  };
}
function create_if_block_7$1(r) {
  let e, t, n;
  return {
    c() {
      e = element$7("button"), e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-4 h-4 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" class="svelte-1ib1ln5"></path></svg>', attr$8(e, "class", "p-2 svelte-1ib1ln5"), attr$8(e, "title", "Play");
    },
    m(f, u) {
      insert$a(f, e, u), t || (n = listen$2(
        e,
        "click",
        /*toggleAnimation*/
        r[19]
      ), t = !0);
    },
    p: noop$6,
    d(f) {
      f && detach$a(e), t = !1, n();
    }
  };
}
function create_if_block_2$1(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o, w, p = ensure_array_like$2(Object.keys(
    /*config*/
    r[0]
  )), v = [];
  for (let a = 0; a < p.length; a += 1)
    v[a] = create_each_block_2(get_each_context_2(r, p, a));
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("h5"), n.textContent = "Settings", f = space$7(), u = element$7("button"), u.innerHTML = '<svg aria-hidden="true" class="w-5 h-5 svelte-1ib1ln5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" class="svelte-1ib1ln5"></path></svg> <span class="sr-only svelte-1ib1ln5">Close menu</span>', y = space$7();
      for (let a = 0; a < v.length; a += 1)
        v[a].c();
      h = space$7(), _ = element$7("div"), E = element$7("div"), c = element$7("label"), c.textContent = "Label atoms on hover", C = space$7(), b = element$7("label"), A = element$7("input"), S = space$7(), s = element$7("div"), attr$8(n, "id", "settings-drawer-label"), attr$8(n, "class", "inline-flex items-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400 svelte-1ib1ln5"), attr$8(u, "type", "button"), attr$8(u, "data-drawer-hide", "drawer-example"), attr$8(u, "aria-controls", "drawer-example"), attr$8(u, "class", "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 right-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white svelte-1ib1ln5"), attr$8(t, "class", "p-4 svelte-1ib1ln5"), attr$8(c, "class", "text-sm font-medium text-gray-600 dark:text-gray-400 w-1/2 svelte-1ib1ln5"), attr$8(A, "type", "checkbox"), attr$8(A, "class", "sr-only peer svelte-1ib1ln5"), attr$8(s, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1ib1ln5"), attr$8(b, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center justify-center svelte-1ib1ln5"), attr$8(E, "class", "flex items-center border-t border-b border-gray-200 bg-white px-4 py-2 space-x-2 svelte-1ib1ln5"), attr$8(_, "class", "bg-white svelte-1ib1ln5"), attr$8(e, "id", "settings-drawer"), attr$8(e, "class", "absolute top-0 right-0 z-50 h-full overflow-y-auto transition-transform bg-gray-100 w-80 dark:bg-gray-800 svelte-1ib1ln5"), attr$8(e, "tabindex", "-1"), attr$8(e, "aria-labelledby", "settings-drawer-label");
    },
    m(a, l) {
      insert$a(a, e, l), append$8(e, t), append$8(t, n), append$8(t, f), append$8(t, u), append$8(e, y);
      for (let g = 0; g < v.length; g += 1)
        v[g] && v[g].m(e, null);
      append$8(e, h), append$8(e, _), append$8(_, E), append$8(E, c), append$8(E, C), append$8(E, b), append$8(b, A), set_input_value$1(
        A,
        /*labelHover*/
        r[5]
      ), append$8(b, S), append$8(b, s), o || (w = [
        listen$2(
          u,
          "click",
          /*toggleOffCanvas*/
          r[14]
        ),
        listen$2(
          A,
          "change",
          /*input_change_handler_1*/
          r[25]
        )
      ], o = !0);
    },
    p(a, l) {
      if (l[0] & /*config, settings*/
      4097) {
        p = ensure_array_like$2(Object.keys(
          /*config*/
          a[0]
        ));
        let g;
        for (g = 0; g < p.length; g += 1) {
          const M = get_each_context_2(a, p, g);
          v[g] ? v[g].p(M, l) : (v[g] = create_each_block_2(M), v[g].c(), v[g].m(e, h));
        }
        for (; g < v.length; g += 1)
          v[g].d(1);
        v.length = p.length;
      }
      l[0] & /*labelHover*/
      32 && set_input_value$1(
        A,
        /*labelHover*/
        a[5]
      );
    },
    d(a) {
      a && detach$a(e), destroy_each$2(v, a), o = !1, run_all$3(w);
    }
  };
}
function create_if_block_5$1(r) {
  let e, t, n, f, u, y;
  function h() {
    r[22].call(
      t,
      /*setting*/
      r[59]
    );
  }
  return {
    c() {
      e = element$7("label"), t = element$7("input"), n = space$7(), f = element$7("div"), attr$8(t, "type", "checkbox"), t.__value = "", set_input_value$1(t, t.__value), attr$8(t, "class", "sr-only peer svelte-1ib1ln5"), attr$8(f, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1ib1ln5"), attr$8(e, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center justify-center svelte-1ib1ln5");
    },
    m(_, E) {
      insert$a(_, e, E), append$8(e, t), t.checked = /*config*/
      r[0][
        /*setting*/
        r[59]
      ], append$8(e, n), append$8(e, f), u || (y = listen$2(t, "change", h), u = !0);
    },
    p(_, E) {
      r = _, E[0] & /*config, settings*/
      4097 && (t.checked = /*config*/
      r[0][
        /*setting*/
        r[59]
      ]);
    },
    d(_) {
      _ && detach$a(e), u = !1, y();
    }
  };
}
function create_if_block_4$1(r) {
  let e, t, n, f, u, y, h, _, E = (
    /*config*/
    r[0][
      /*setting*/
      r[59]
    ] + ""
  ), c, C, b;
  function A() {
    return (
      /*change_handler*/
      r[23](
        /*setting*/
        r[59]
      )
    );
  }
  return {
    c() {
      e = element$7("div"), t = element$7("input"), h = space$7(), _ = element$7("span"), c = text$3(E), attr$8(t, "id", "medium-range"), attr$8(t, "type", "range"), t.value = n = /*config*/
      r[0][
        /*setting*/
        r[59]
      ], attr$8(t, "min", f = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].min), attr$8(t, "max", u = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].max), attr$8(t, "step", y = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].step), attr$8(t, "class", "w-2/3 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 svelte-1ib1ln5"), attr$8(_, "class", "w-1/3 text-center text-sm font-medium text-gray-600 dark:text-gray-400 svelte-1ib1ln5"), attr$8(e, "class", "flex items-center svelte-1ib1ln5");
    },
    m(S, s) {
      insert$a(S, e, s), append$8(e, t), append$8(e, h), append$8(e, _), append$8(_, c), C || (b = listen$2(t, "change", A), C = !0);
    },
    p(S, s) {
      r = S, s[0] & /*config, settings*/
      4097 && n !== (n = /*config*/
      r[0][
        /*setting*/
        r[59]
      ]) && (t.value = n), s[0] & /*config, settings*/
      4097 && f !== (f = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].min) && attr$8(t, "min", f), s[0] & /*config, settings*/
      4097 && u !== (u = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].max) && attr$8(t, "max", u), s[0] & /*config, settings*/
      4097 && y !== (y = /*settings*/
      r[12][
        /*setting*/
        r[59]
      ].step) && attr$8(t, "step", y), s[0] & /*config*/
      1 && E !== (E = /*config*/
      r[0][
        /*setting*/
        r[59]
      ] + "") && set_data$3(c, E);
    },
    d(S) {
      S && detach$a(e), C = !1, b();
    }
  };
}
function create_if_block_3$1(r) {
  let e, t, n, f, u, y, h, _, E = ensure_array_like$2(
    /*settings*/
    r[12][
      /*setting*/
      r[59]
    ].options
  ), c = [];
  for (let b = 0; b < E.length; b += 1)
    c[b] = create_each_block_3(get_each_context_3(r, E, b));
  function C() {
    r[24].call(
      u,
      /*setting*/
      r[59]
    );
  }
  return {
    c() {
      e = element$7("label"), t = text$3("Select style"), f = space$7(), u = element$7("select");
      for (let b = 0; b < c.length; b += 1)
        c[b].c();
      attr$8(e, "for", n = /*setting*/
      r[59]), attr$8(e, "class", "sr-only svelte-1ib1ln5"), attr$8(u, "id", y = /*setting*/
      r[59]), attr$8(u, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 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-1ib1ln5"), /*config*/
      r[0][
        /*setting*/
        r[59]
      ] === void 0 && add_render_callback(C);
    },
    m(b, A) {
      insert$a(b, e, A), append$8(e, t), insert$a(b, f, A), insert$a(b, u, A);
      for (let S = 0; S < c.length; S += 1)
        c[S] && c[S].m(u, null);
      select_option(
        u,
        /*config*/
        r[0][
          /*setting*/
          r[59]
        ],
        !0
      ), h || (_ = listen$2(u, "change", C), h = !0);
    },
    p(b, A) {
      if (r = b, A[0] & /*config, settings*/
      4097 && n !== (n = /*setting*/
      r[59]) && attr$8(e, "for", n), A[0] & /*settings, config*/
      4097) {
        E = ensure_array_like$2(
          /*settings*/
          r[12][
            /*setting*/
            r[59]
          ].options
        );
        let S;
        for (S = 0; S < E.length; S += 1) {
          const s = get_each_context_3(r, E, S);
          c[S] ? c[S].p(s, A) : (c[S] = create_each_block_3(s), c[S].c(), c[S].m(u, null));
        }
        for (; S < c.length; S += 1)
          c[S].d(1);
        c.length = E.length;
      }
      A[0] & /*config, settings*/
      4097 && y !== (y = /*setting*/
      r[59]) && attr$8(u, "id", y), A[0] & /*config, settings*/
      4097 && select_option(
        u,
        /*config*/
        r[0][
          /*setting*/
          r[59]
        ]
      );
    },
    d(b) {
      b && (detach$a(e), detach$a(f), detach$a(u)), destroy_each$2(c, b), h = !1, _();
    }
  };
}
function create_each_block_3(r) {
  let e, t = (
    /*option*/
    r[62] + ""
  ), n, f, u;
  return {
    c() {
      e = element$7("option"), n = text$3(t), e.__value = f = /*option*/
      r[62], set_input_value$1(e, e.__value), e.selected = u = /*option*/
      r[62] == /*config*/
      r[0][
        /*setting*/
        r[59]
      ], attr$8(e, "class", "svelte-1ib1ln5");
    },
    m(y, h) {
      insert$a(y, e, h), append$8(e, n);
    },
    p(y, h) {
      h[0] & /*config*/
      1 && t !== (t = /*option*/
      y[62] + "") && set_data$3(n, t), h[0] & /*config, settings*/
      4097 && f !== (f = /*option*/
      y[62]) && (e.__value = f, set_input_value$1(e, e.__value)), h[0] & /*config, settings*/
      4097 && u !== (u = /*option*/
      y[62] == /*config*/
      y[0][
        /*setting*/
        y[59]
      ]) && (e.selected = u);
    },
    d(y) {
      y && detach$a(e);
    }
  };
}
function create_each_block_2(r) {
  let e, t, n, f = (
    /*setting*/
    r[59] + ""
  ), u, y, h, _, E, c = (
    /*settings*/
    r[12][
      /*setting*/
      r[59]
    ].type == "toggle" && create_if_block_5$1(r)
  ), C = (
    /*settings*/
    r[12][
      /*setting*/
      r[59]
    ].type == "range" && create_if_block_4$1(r)
  ), b = (
    /*settings*/
    r[12][
      /*setting*/
      r[59]
    ].type == "select" && create_if_block_3$1(r)
  );
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("label"), u = text$3(f), h = space$7(), c && c.c(), _ = space$7(), C && C.c(), E = space$7(), b && b.c(), attr$8(n, "for", y = /*setting*/
      r[59]), attr$8(n, "class", "text-sm font-medium text-gray-600 dark:text-gray-400 w-1/2 svelte-1ib1ln5"), attr$8(t, "class", "flex items-center border-t border-b border-gray-200 bg-white px-4 py-2 space-x-2 svelte-1ib1ln5"), attr$8(e, "class", "flex flex-col mb-4 divide-y svelte-1ib1ln5");
    },
    m(A, S) {
      insert$a(A, e, S), append$8(e, t), append$8(t, n), append$8(n, u), append$8(t, h), c && c.m(t, null), append$8(t, _), C && C.m(t, null), append$8(t, E), b && b.m(t, null);
    },
    p(A, S) {
      S[0] & /*config*/
      1 && f !== (f = /*setting*/
      A[59] + "") && set_data$3(u, f), S[0] & /*config, settings*/
      4097 && y !== (y = /*setting*/
      A[59]) && attr$8(n, "for", y), /*settings*/
      A[12][
        /*setting*/
        A[59]
      ].type == "toggle" ? c ? c.p(A, S) : (c = create_if_block_5$1(A), c.c(), c.m(t, _)) : c && (c.d(1), c = null), /*settings*/
      A[12][
        /*setting*/
        A[59]
      ].type == "range" ? C ? C.p(A, S) : (C = create_if_block_4$1(A), C.c(), C.m(t, E)) : C && (C.d(1), C = null), /*settings*/
      A[12][
        /*setting*/
        A[59]
      ].type == "select" ? b ? b.p(A, S) : (b = create_if_block_3$1(A), b.c(), b.m(t, null)) : b && (b.d(1), b = null);
    },
    d(A) {
      A && detach$a(e), c && c.d(), C && C.d(), b && b.d();
    }
  };
}
function create_if_block$6(r) {
  let e, t, n, f, u, y, h, _, E, c, C = ensure_array_like$2(
    /*representations*/
    r[1]
  ), b = [];
  for (let A = 0; A < C.length; A += 1)
    b[A] = create_each_block$2(get_each_context$2(r, C, A));
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("h5"), n.textContent = "Representations", f = space$7(), u = element$7("button"), u.innerHTML = '<svg aria-hidden="true" class="w-5 h-5 svelte-1ib1ln5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" class="svelte-1ib1ln5"></path></svg> <span class="sr-only svelte-1ib1ln5">Close menu</span>', y = space$7();
      for (let A = 0; A < b.length; A += 1)
        b[A].c();
      h = space$7(), _ = element$7("button"), _.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-4 h-4 svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" class="svelte-1ib1ln5"></path></svg> <div class="svelte-1ib1ln5">Add representation</div>', attr$8(n, "id", "drawer-label"), attr$8(n, "class", "inline-flex items-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400 svelte-1ib1ln5"), attr$8(u, "type", "button"), attr$8(u, "data-drawer-hide", "drawer-example"), attr$8(u, "aria-controls", "drawer-example"), attr$8(u, "class", "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 right-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white svelte-1ib1ln5"), attr$8(t, "class", "p-4 svelte-1ib1ln5"), attr$8(_, "class", "w-full flex text-orange-600 justify-center my-2 text-sm space-x-2 items-center hover:text-gray-600 cursor-pointer svelte-1ib1ln5"), attr$8(e, "id", "drawer-example"), attr$8(e, "class", "absolute top-0 right-0 z-50 h-full overflow-y-auto transition-transform bg-gray-100 w-80 dark:bg-gray-800 border-l border-gray-200 svelte-1ib1ln5"), attr$8(e, "tabindex", "-1"), attr$8(e, "aria-labelledby", "drawer-label");
    },
    m(A, S) {
      insert$a(A, e, S), append$8(e, t), append$8(t, n), append$8(t, f), append$8(t, u), append$8(e, y);
      for (let s = 0; s < b.length; s += 1)
        b[s] && b[s].m(e, null);
      append$8(e, h), append$8(e, _), E || (c = [
        listen$2(
          u,
          "click",
          /*toggleOffCanvasReps*/
          r[15]
        ),
        listen$2(
          _,
          "click",
          /*insertRep*/
          r[17]
        )
      ], E = !0);
    },
    p(A, S) {
      if (S[0] & /*representations, moldata, resetZoom, deleteRep*/
      327690) {
        C = ensure_array_like$2(
          /*representations*/
          A[1]
        );
        let s;
        for (s = 0; s < C.length; s += 1) {
          const o = get_each_context$2(A, C, s);
          b[s] ? b[s].p(o, S) : (b[s] = create_each_block$2(o), b[s].c(), b[s].m(e, h));
        }
        for (; s < b.length; s += 1)
          b[s].d(1);
        b.length = C.length;
      }
    },
    d(A) {
      A && detach$a(e), destroy_each$2(b, A), E = !1, run_all$3(c);
    }
  };
}
function create_if_block_1$5(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o, w, p, v, a, l, g, M, L, T, D, I, z, P, B, F, N, $, k, G, H, U, V, Q, ae, oe, q, me, ne, fe, Ce, Me, Te, se, pe, we, ke, Ue, Ne, Be, ue, ye, ge, Se, ze, He, We, Y, K, ee, de, ve, Ie, Re, Z, ce, Ae, Fe, he, Oe, j, $e, Ve, R, be, Ee, X, le, Le, Ze, Ke, je, Je, Lt, rt, it, tt, Et, lt = ensure_array_like$2(
    /*moldata*/
    r[3]
  ), wt = [];
  for (let pt = 0; pt < lt.length; pt += 1)
    wt[pt] = create_each_block_1$1(get_each_context_1$1(r, lt, pt));
  function Pt() {
    r[29].call(
      n,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function vt() {
    r[30].call(
      u,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function bt() {
    r[31].call(
      _,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function mt() {
    r[32].call(
      c,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function Tt() {
    r[33].call(
      s,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function Ot(...pt) {
    return (
      /*change_handler_1*/
      r[34](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55],
        ...pt
      )
    );
  }
  function Ft() {
    r[35].call(
      z,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function Qt() {
    r[36].call(
      U,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function kt() {
    r[37].call(
      fe,
      /*each_value*/
      r[54],
      /*index*/
      r[55]
    );
  }
  function Jt() {
    return (
      /*click_handler_3*/
      r[38](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function qt() {
    return (
      /*click_handler_4*/
      r[39](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function er() {
    return (
      /*click_handler_5*/
      r[40](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Ht() {
    return (
      /*click_handler_6*/
      r[41](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function tr() {
    return (
      /*click_handler_7*/
      r[42](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function lr() {
    return (
      /*click_handler_8*/
      r[43](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Or() {
    return (
      /*click_handler_9*/
      r[44](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Dr() {
    return (
      /*click_handler_10*/
      r[45](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Pr() {
    return (
      /*click_handler_11*/
      r[46](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Ir() {
    return (
      /*click_handler_12*/
      r[47](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function at() {
    return (
      /*click_handler_13*/
      r[48](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function Bt() {
    return (
      /*click_handler_14*/
      r[49](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("select");
      for (let pt = 0; pt < wt.length; pt += 1)
        wt[pt].c();
      f = space$7(), u = element$7("input"), y = space$7(), h = element$7("div"), _ = element$7("input"), E = space$7(), c = element$7("input"), C = space$7(), b = element$7("div"), A = element$7("label"), A.textContent = "Select style", S = space$7(), s = element$7("select"), o = element$7("option"), o.textContent = "Stick", w = element$7("option"), w.textContent = "Cartoon", p = element$7("option"), p.textContent = "Surface", v = text$3(`$
                        `), a = element$7("option"), a.textContent = "Sphere", l = space$7(), g = element$7("div"), M = element$7("div"), M.textContent = "Expand selection", L = space$7(), T = element$7("input"), I = space$7(), z = element$7("input"), P = space$7(), B = element$7("div"), B.textContent = "Å", F = space$7(), N = element$7("div"), $ = element$7("div"), k = element$7("span"), k.textContent = "Full residue", G = space$7(), H = element$7("label"), U = element$7("input"), V = space$7(), Q = element$7("div"), ae = space$7(), oe = element$7("div"), q = element$7("span"), q.textContent = "Only sidechain", me = space$7(), ne = element$7("label"), fe = element$7("input"), Ce = space$7(), Me = element$7("div"), Te = space$7(), se = element$7("div"), pe = element$7("button"), ke = space$7(), Ue = element$7("button"), Be = space$7(), ue = element$7("button"), ge = space$7(), Se = element$7("button"), He = space$7(), We = element$7("button"), K = space$7(), ee = element$7("button"), ve = space$7(), Ie = element$7("button"), Z = space$7(), ce = element$7("div"), Ae = element$7("button"), Fe = text$3("AlphaFold"), Oe = space$7(), j = element$7("button"), $e = text$3("PyMol"), R = space$7(), be = element$7("button"), Ee = text$3("Jmol"), le = space$7(), Le = element$7("button"), Ze = text$3("Chain"), je = space$7(), Je = element$7("button"), Lt = text$3("Spectrum"), attr$8(n, "id", "style"), attr$8(n, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 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-1ib1ln5"), /*rep*/
      r[53].model === void 0 && add_render_callback(Pt), attr$8(u, "type", "text"), attr$8(u, "id", "chain"), attr$8(u, "class", "w-1/2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 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-1ib1ln5"), attr$8(u, "placeholder", "Chain"), attr$8(t, "class", "p-1 flex space-x-1 svelte-1ib1ln5"), attr$8(_, "type", "text"), attr$8(_, "id", "chain"), attr$8(_, "class", "w-1/2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 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-1ib1ln5"), attr$8(_, "placeholder", "Resname"), attr$8(c, "type", "text"), attr$8(c, "id", "residue_range"), attr$8(c, "class", "w-full bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 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-1ib1ln5"), attr$8(c, "placeholder", "Residue range"), attr$8(h, "class", "p-1 flex space-x-1 svelte-1ib1ln5"), attr$8(A, "for", "countries"), attr$8(A, "class", "block mb-2 text-sm w-1/3 font-medium text-gray-600 dark:text-white svelte-1ib1ln5"), o.__value = "stick", set_input_value$1(o, o.__value), attr$8(o, "class", "svelte-1ib1ln5"), w.__value = "cartoon", set_input_value$1(w, w.__value), attr$8(w, "class", "svelte-1ib1ln5"), p.__value = "surface", set_input_value$1(p, p.__value), attr$8(p, "class", "svelte-1ib1ln5"), a.__value = "sphere", set_input_value$1(a, a.__value), attr$8(a, "class", "svelte-1ib1ln5"), attr$8(s, "id", "style"), attr$8(s, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 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-1ib1ln5"), /*rep*/
      r[53].style === void 0 && add_render_callback(Tt), attr$8(b, "class", "p-1 flex space-x-1 items-center svelte-1ib1ln5"), attr$8(M, "class", " svelte-1ib1ln5"), attr$8(T, "id", "around"), attr$8(T, "type", "range"), T.value = D = /*rep*/
      r[53].around, attr$8(T, "min", "0"), attr$8(T, "max", "10"), attr$8(T, "step", "0.5"), attr$8(T, "class", "h-2 w-1/3 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 svelte-1ib1ln5"), attr$8(z, "type", "text"), attr$8(z, "class", "w-8 svelte-1ib1ln5"), attr$8(B, "class", "svelte-1ib1ln5"), attr$8(g, "class", "flex p-1 items-center text-gray-700 space-x-1 text-sm svelte-1ib1ln5"), attr$8(k, "class", "svelte-1ib1ln5"), attr$8(U, "type", "checkbox"), U.__value = "", set_input_value$1(U, U.__value), attr$8(U, "class", "sr-only peer svelte-1ib1ln5"), attr$8(Q, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1ib1ln5"), attr$8(H, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center svelte-1ib1ln5"), attr$8($, "class", "flex space-x-1 w-1/2 svelte-1ib1ln5"), attr$8(q, "class", "svelte-1ib1ln5"), attr$8(fe, "type", "checkbox"), fe.__value = "", set_input_value$1(fe, fe.__value), attr$8(fe, "class", "sr-only peer svelte-1ib1ln5"), attr$8(Me, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1ib1ln5"), attr$8(ne, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center svelte-1ib1ln5"), attr$8(oe, "class", "flex space-x-1 w-1/2 svelte-1ib1ln5"), attr$8(N, "class", "flex p-1 items-center text-gray-700 space-x-1 text-sm svelte-1ib1ln5"), attr$8(pe, "class", we = null_to_empty(
        /*rep*/
        r[53].color === "orangeCarbon" ? "bg-orange-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-orange-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(Ue, "class", Ne = null_to_empty(
        /*rep*/
        r[53].color === "redCarbon" ? "bg-red-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-red-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(ue, "class", ye = null_to_empty(
        /*rep*/
        r[53].color === "blackCarbon" ? "bg-black rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-black rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(Se, "class", ze = null_to_empty(
        /*rep*/
        r[53].color === "blueCarbon" ? "bg-blue-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-blue-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(We, "class", Y = null_to_empty(
        /*rep*/
        r[53].color === "grayCarbon" ? "bg-gray-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-gray-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(ee, "class", de = null_to_empty(
        /*rep*/
        r[53].color === "greenCarbon" ? "bg-green-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-green-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(Ie, "class", Re = null_to_empty(
        /*rep*/
        r[53].color === "cyanCarbon" ? "bg-cyan-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-cyan-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5"), attr$8(se, "class", "flex space-x-2 mt-2 svelte-1ib1ln5"), attr$8(Ae, "class", he = null_to_empty(
        /*rep*/
        r[53].color === "alphafold" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5"), attr$8(j, "class", Ve = null_to_empty(
        /*rep*/
        r[53].color === "default" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5"), attr$8(be, "class", X = null_to_empty(
        /*rep*/
        r[53].color === "Jmol" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5"), attr$8(Le, "class", Ke = null_to_empty(
        /*rep*/
        r[53].color === "chain" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5"), attr$8(Je, "class", rt = null_to_empty(
        /*rep*/
        r[53].color === "spectrum" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5"), attr$8(ce, "class", "flex space-x-2 py-2 text-sm svelte-1ib1ln5"), attr$8(e, "class", "svelte-1ib1ln5");
    },
    m(pt, yt) {
      insert$a(pt, e, yt), append$8(e, t), append$8(t, n);
      for (let At = 0; At < wt.length; At += 1)
        wt[At] && wt[At].m(n, null);
      select_option(
        n,
        /*rep*/
        r[53].model,
        !0
      ), append$8(t, f), append$8(t, u), set_input_value$1(
        u,
        /*rep*/
        r[53].chain
      ), append$8(e, y), append$8(e, h), append$8(h, _), set_input_value$1(
        _,
        /*rep*/
        r[53].resname
      ), append$8(h, E), append$8(h, c), set_input_value$1(
        c,
        /*rep*/
        r[53].residue_range
      ), append$8(e, C), append$8(e, b), append$8(b, A), append$8(b, S), append$8(b, s), append$8(s, o), append$8(s, w), append$8(s, p), append$8(s, v), append$8(s, a), select_option(
        s,
        /*rep*/
        r[53].style,
        !0
      ), append$8(e, l), append$8(e, g), append$8(g, M), append$8(g, L), append$8(g, T), append$8(g, I), append$8(g, z), set_input_value$1(
        z,
        /*rep*/
        r[53].around
      ), append$8(g, P), append$8(g, B), append$8(e, F), append$8(e, N), append$8(N, $), append$8($, k), append$8($, G), append$8($, H), append$8(H, U), U.checked = /*rep*/
      r[53].byres, append$8(H, V), append$8(H, Q), append$8(N, ae), append$8(N, oe), append$8(oe, q), append$8(oe, me), append$8(oe, ne), append$8(ne, fe), fe.checked = /*rep*/
      r[53].sidechain, append$8(ne, Ce), append$8(ne, Me), append$8(e, Te), append$8(e, se), append$8(se, pe), append$8(se, ke), append$8(se, Ue), append$8(se, Be), append$8(se, ue), append$8(se, ge), append$8(se, Se), append$8(se, He), append$8(se, We), append$8(se, K), append$8(se, ee), append$8(se, ve), append$8(se, Ie), append$8(e, Z), append$8(e, ce), append$8(ce, Ae), append$8(Ae, Fe), append$8(ce, Oe), append$8(ce, j), append$8(j, $e), append$8(ce, R), append$8(ce, be), append$8(be, Ee), append$8(ce, le), append$8(ce, Le), append$8(Le, Ze), append$8(ce, je), append$8(ce, Je), append$8(Je, Lt), tt || (Et = [
        listen$2(n, "change", Pt),
        listen$2(u, "input", vt),
        listen$2(_, "input", bt),
        listen$2(c, "input", mt),
        listen$2(s, "change", Tt),
        listen$2(T, "change", Ot),
        listen$2(z, "input", Ft),
        listen$2(U, "change", Qt),
        listen$2(fe, "change", kt),
        listen$2(pe, "click", Jt),
        listen$2(Ue, "click", qt),
        listen$2(ue, "click", er),
        listen$2(Se, "click", Ht),
        listen$2(We, "click", tr),
        listen$2(ee, "click", lr),
        listen$2(Ie, "click", Or),
        listen$2(Ae, "click", Dr),
        listen$2(j, "click", Pr),
        listen$2(be, "click", Ir),
        listen$2(Le, "click", at),
        listen$2(Je, "click", Bt)
      ], tt = !0);
    },
    p(pt, yt) {
      if (r = pt, yt[0] & /*moldata*/
      8) {
        lt = ensure_array_like$2(
          /*moldata*/
          r[3]
        );
        let At;
        for (At = 0; At < lt.length; At += 1) {
          const rr = get_each_context_1$1(r, lt, At);
          wt[At] ? wt[At].p(rr, yt) : (wt[At] = create_each_block_1$1(rr), wt[At].c(), wt[At].m(n, null));
        }
        for (; At < wt.length; At += 1)
          wt[At].d(1);
        wt.length = lt.length;
      }
      yt[0] & /*representations*/
      2 && select_option(
        n,
        /*rep*/
        r[53].model
      ), yt[0] & /*representations*/
      2 && u.value !== /*rep*/
      r[53].chain && set_input_value$1(
        u,
        /*rep*/
        r[53].chain
      ), yt[0] & /*representations*/
      2 && _.value !== /*rep*/
      r[53].resname && set_input_value$1(
        _,
        /*rep*/
        r[53].resname
      ), yt[0] & /*representations*/
      2 && c.value !== /*rep*/
      r[53].residue_range && set_input_value$1(
        c,
        /*rep*/
        r[53].residue_range
      ), yt[0] & /*representations*/
      2 && select_option(
        s,
        /*rep*/
        r[53].style
      ), yt[0] & /*representations*/
      2 && D !== (D = /*rep*/
      r[53].around) && (T.value = D), yt[0] & /*representations*/
      2 && z.value !== /*rep*/
      r[53].around && set_input_value$1(
        z,
        /*rep*/
        r[53].around
      ), yt[0] & /*representations*/
      2 && (U.checked = /*rep*/
      r[53].byres), yt[0] & /*representations*/
      2 && (fe.checked = /*rep*/
      r[53].sidechain), yt[0] & /*representations*/
      2 && we !== (we = null_to_empty(
        /*rep*/
        r[53].color === "orangeCarbon" ? "bg-orange-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-orange-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(pe, "class", we), yt[0] & /*representations*/
      2 && Ne !== (Ne = null_to_empty(
        /*rep*/
        r[53].color === "redCarbon" ? "bg-red-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-red-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(Ue, "class", Ne), yt[0] & /*representations*/
      2 && ye !== (ye = null_to_empty(
        /*rep*/
        r[53].color === "blackCarbon" ? "bg-black rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-black rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(ue, "class", ye), yt[0] & /*representations*/
      2 && ze !== (ze = null_to_empty(
        /*rep*/
        r[53].color === "blueCarbon" ? "bg-blue-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-blue-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(Se, "class", ze), yt[0] & /*representations*/
      2 && Y !== (Y = null_to_empty(
        /*rep*/
        r[53].color === "grayCarbon" ? "bg-gray-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-gray-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(We, "class", Y), yt[0] & /*representations*/
      2 && de !== (de = null_to_empty(
        /*rep*/
        r[53].color === "greenCarbon" ? "bg-green-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-green-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(ee, "class", de), yt[0] & /*representations*/
      2 && Re !== (Re = null_to_empty(
        /*rep*/
        r[53].color === "cyanCarbon" ? "bg-cyan-600 rounded-full w-8 h-8 border-4 border-gray-300  cursor-pointer" : "bg-cyan-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer"
      ) + " svelte-1ib1ln5") && attr$8(Ie, "class", Re), yt[0] & /*representations*/
      2 && he !== (he = null_to_empty(
        /*rep*/
        r[53].color === "alphafold" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5") && attr$8(Ae, "class", he), yt[0] & /*representations*/
      2 && Ve !== (Ve = null_to_empty(
        /*rep*/
        r[53].color === "default" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5") && attr$8(j, "class", Ve), yt[0] & /*representations*/
      2 && X !== (X = null_to_empty(
        /*rep*/
        r[53].color === "Jmol" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5") && attr$8(be, "class", X), yt[0] & /*representations*/
      2 && Ke !== (Ke = null_to_empty(
        /*rep*/
        r[53].color === "chain" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5") && attr$8(Le, "class", Ke), yt[0] & /*representations*/
      2 && rt !== (rt = null_to_empty(
        /*rep*/
        r[53].color === "spectrum" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white"
      ) + " svelte-1ib1ln5") && attr$8(Je, "class", rt);
    },
    i(pt) {
      pt && (it || add_render_callback(() => {
        it = create_in_transition(e, fade, {}), it.start();
      }));
    },
    o: noop$6,
    d(pt) {
      pt && detach$a(e), destroy_each$2(wt, pt), tt = !1, run_all$3(Et);
    }
  };
}
function create_each_block_1$1(r) {
  let e, t = (
    /*mol*/
    r[56].name + ""
  ), n, f, u;
  return {
    c() {
      e = element$7("option"), n = text$3(t), f = text$3(" #"), u = text$3(
        /*i*/
        r[58]
      ), e.__value = /*i*/
      r[58], set_input_value$1(e, e.__value), attr$8(e, "class", "svelte-1ib1ln5");
    },
    m(y, h) {
      insert$a(y, e, h), append$8(e, n), append$8(e, f), append$8(e, u);
    },
    p(y, h) {
      h[0] & /*moldata*/
      8 && t !== (t = /*mol*/
      y[56].name + "") && set_data$3(n, t);
    },
    d(y) {
      y && detach$a(e);
    }
  };
}
function create_each_block$2(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o;
  function w() {
    return (
      /*click_handler*/
      r[26](
        /*rep*/
        r[53],
        /*each_value*/
        r[54],
        /*index*/
        r[55]
      )
    );
  }
  function p() {
    return (
      /*click_handler_1*/
      r[27](
        /*index*/
        r[55]
      )
    );
  }
  function v() {
    return (
      /*click_handler_2*/
      r[28](
        /*rep*/
        r[53]
      )
    );
  }
  let a = (
    /*rep*/
    r[53].visible && create_if_block_1$5(r)
  );
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("div"), f = element$7("button"), u = svg_element$3("svg"), y = svg_element$3("path"), _ = space$7(), E = element$7("span"), E.textContent = `Representation #${/*index*/
      r[55]}`, c = space$7(), C = element$7("button"), C.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.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 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" class="svelte-1ib1ln5"></path></svg>', b = space$7(), A = element$7("button"), A.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" class="svelte-1ib1ln5"></path></svg>', S = space$7(), a && a.c(), attr$8(y, "stroke-linecap", "round"), attr$8(y, "stroke-linejoin", "round"), attr$8(y, "d", "M8.25 4.5l7.5 7.5-7.5 7.5"), attr$8(y, "class", "svelte-1ib1ln5"), attr$8(u, "xmlns", "http://www.w3.org/2000/svg"), attr$8(u, "fill", "none"), attr$8(u, "viewBox", "0 0 24 24"), attr$8(u, "stroke-width", "1.5"), attr$8(u, "stroke", "currentColor"), attr$8(u, "class", h = null_to_empty(
        /*rep*/
        r[53].visible ? "transform rotate-90 w-5 h-5 " : "w-5 h-5 "
      ) + " svelte-1ib1ln5"), attr$8(E, "class", "svelte-1ib1ln5"), attr$8(f, "class", "flex items-center space-x-2 svelte-1ib1ln5"), attr$8(C, "class", "svelte-1ib1ln5"), attr$8(A, "title", "zoom to selection"), attr$8(A, "class", "svelte-1ib1ln5"), attr$8(n, "class", "flex space-x-2 items-center cursor-pointer p-1 svelte-1ib1ln5"), attr$8(t, "class", " svelte-1ib1ln5"), attr$8(e, "class", "bg-white border-b border-t border-gray-200 py-4 px-2 svelte-1ib1ln5");
    },
    m(l, g) {
      insert$a(l, e, g), append$8(e, t), append$8(t, n), append$8(n, f), append$8(f, u), append$8(u, y), append$8(f, _), append$8(f, E), append$8(n, c), append$8(n, C), append$8(n, b), append$8(n, A), append$8(t, S), a && a.m(t, null), s || (o = [
        listen$2(f, "click", w),
        listen$2(C, "click", p),
        listen$2(A, "click", v)
      ], s = !0);
    },
    p(l, g) {
      r = l, g[0] & /*representations*/
      2 && h !== (h = null_to_empty(
        /*rep*/
        r[53].visible ? "transform rotate-90 w-5 h-5 " : "w-5 h-5 "
      ) + " svelte-1ib1ln5") && attr$8(u, "class", h), /*rep*/
      r[53].visible ? a ? (a.p(r, g), g[0] & /*representations*/
      2 && transition_in$7(a, 1)) : (a = create_if_block_1$5(r), a.c(), transition_in$7(a, 1), a.m(t, null)) : a && (a.d(1), a = null);
    },
    d(l) {
      l && detach$a(e), a && a.d(), s = !1, run_all$3(o);
    }
  };
}
function create_fragment$a(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o, w, p, v, a, l, g, M = (
    /*anyColorAlphaFold*/
    r[11] && create_if_block_8$1(r)
  ), L = (
    /*hasFrames*/
    r[9] && create_if_block_6$1(r)
  ), T = (
    /*showOffCanvas*/
    r[7] && create_if_block_2$1(r)
  ), D = (
    /*showOffCanvasReps*/
    r[8] && create_if_block$6(r)
  );
  return {
    c() {
      e = element$7("div"), t = element$7("div"), n = element$7("div"), f = element$7("div"), u = element$7("button"), u.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" class="svelte-1ib1ln5"></path></svg>', y = space$7(), h = element$7("button"), h.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5"><path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75" class="svelte-1ib1ln5"></path></svg>', _ = space$7(), E = element$7("button"), E.innerHTML = '<svg class="w-5 h-5 text-gray-500 hover:text-orange-600 cursor-pointer svelte-1ib1ln5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.0281146,15 L12.5,15 C13.3284271,15 14,15.6715729 14,16.5 L14,20.5 C14,21.3284271 13.3284271,22 12.5,22 L10.5,22 C9.67157288,22 9,21.3284271 9,20.5 L9,16.5 C9,15.6715729 9.67157288,15 10.5,15 L11.0167145,15 C11.1492163,13.8570393 12.0552513,12.9352285 13.2239212,12.8053762 L18.6656473,12.20074 C19.4252963,12.1163346 20,11.4742382 20,10.7099144 L20,8.5 C20,7.67157288 19.3284271,7 18.5,7 C18.2238576,7 18,6.77614237 18,6.5 C18,6.22385763 18.2238576,6 18.5,6 C19.8807119,6 21,7.11928813 21,8.5 L21,10.7099144 C21,11.9837875 20.0421605,13.053948 18.7760788,13.1946238 L13.3343527,13.79926 C12.6731623,13.8727256 12.1520824,14.3686853 12.0281146,15 Z M10.5,16 C10.2238576,16 10,16.2238576 10,16.5 L10,20.5 C10,20.7761424 10.2238576,21 10.5,21 L12.5,21 C12.7761424,21 13,20.7761424 13,20.5 L13,16.5 C13,16.2238576 12.7761424,16 12.5,16 L10.5,16 Z M5.49996942,2.99995128 L16.5,2.99995128 C17.8807119,2.99995128 19,4.11923941 19,5.49995128 L19,7.5 C19,8.88071187 17.8807119,10 16.5,10 L5.49996942,10 C4.11925755,10 2.99996942,8.88071187 2.99996942,7.5 L2.99996942,5.49995128 C2.99996942,4.11923941 4.11925755,2.99995128 5.49996942,2.99995128 Z M5.49996942,3.99995128 C4.6715423,3.99995128 3.99996942,4.67152416 3.99996942,5.49995128 L3.99996942,7.5 C3.99996942,8.32842712 4.6715423,9 5.49996942,9 L16.5,9 C17.3284271,9 18,8.32842712 18,7.5 L18,5.49995128 C18,4.67152416 17.3284271,3.99995128 16.5,3.99995128 L5.49996942,3.99995128 Z" class="svelte-1ib1ln5"></path></svg>', c = space$7(), M && M.c(), C = space$7(), L && L.c(), b = space$7(), A = element$7("div"), S = element$7("button"), S.innerHTML = '<svg class="w-4 h-4 text-gray-500 hover:text-orange-600 cursor-pointer fill-current svelte-1ib1ln5" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0" class="svelte-1ib1ln5"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" class="svelte-1ib1ln5"></g><g id="SVGRepo_iconCarrier" class="svelte-1ib1ln5"><path d="M12.6 7.6v3.9h-1.1v4.6h-3v-4.6H7.4V7.6c0-.3.3-.6.6-.6h4c.3 0 .6.3.6.6zM10 6.5c.7 0 1.3-.6 1.3-1.3 0-.7-.6-1.3-1.3-1.3-.7 0-1.3.6-1.3 1.3 0 .7.6 1.3 1.3 1.3zm9.6 3.5c0 2.7-.9 4.9-2.7 6.7-1.9 1.9-4.2 2.9-6.9 2.9-2.6 0-4.9-.9-6.8-2.8C1.3 14.9.4 12.7.4 10c0-2.6.9-4.9 2.8-6.8C5.1 1.3 7.3.4 10 .4s5 .9 6.8 2.8c1.9 1.8 2.8 4.1 2.8 6.8zm-1.7 0c0-2.2-.8-4-2.3-5.6C14 2.9 12.2 2.1 10 2.1c-2.2 0-4 .8-5.5 2.3C2.9 6 2.1 7.9 2.1 10c0 2.1.8 4 2.3 5.5s3.4 2.3 5.6 2.3c2.1 0 4-.8 5.6-2.4 1.5-1.4 2.3-3.2 2.3-5.4z" class="svelte-1ib1ln5"></path></g></svg>', s = space$7(), o = element$7("span"), o.textContent = "Cite 3dmol.js as Rego & Koes, doi:10/gb5g5n", w = space$7(), p = element$7("div"), v = space$7(), T && T.c(), a = space$7(), D && D.c(), attr$8(u, "class", "p-2 svelte-1ib1ln5"), attr$8(u, "title", "Reset View"), attr$8(h, "class", "p-2 svelte-1ib1ln5"), attr$8(h, "title", "Settings"), attr$8(E, "class", "p-2 svelte-1ib1ln5"), attr$8(E, "title", "Representations"), attr$8(f, "class", "absolute z-50 top-0 right-0 mr-2 flex flex-col divide-y border border-gray-200 mt-2 rounded items-center justify-center bg-white dark:bg-gray-800 svelte-1ib1ln5"), attr$8(S, "class", "p-1 svelte-1ib1ln5"), attr$8(S, "title", "How to cite 3Dmol.js"), attr$8(o, "class", "absolute -top-1 left-6 w-max rounded bg-gray-900 px-2 py-1 text-sm font-medium text-gray-50 opacity-0 shadow transition-opacity svelte-1ib1ln5"), toggle_class$5(
        o,
        "opacity-100",
        /*showCiteTooltip*/
        r[6]
      ), attr$8(A, "class", "absolute z-50 bottom-0 left-0 ml-2 flex divide-x mb-2 rounded items-center justify-center svelte-1ib1ln5"), attr$8(p, "class", "viewer w-full h-full z-10 svelte-1ib1ln5"), attr$8(n, "class", "gr-block gr-box relative w-full overflow-hidden svelte-1ib1ln5"), attr$8(t, "class", "overflow-hidden flex gap-px w-full h-full flex-wrap svelte-1ib1ln5"), attr$8(e, "class", "bg-white w-full minh svelte-1ib1ln5");
    },
    m(I, z) {
      insert$a(I, e, z), append$8(e, t), append$8(t, n), append$8(n, f), append$8(f, u), append$8(f, y), append$8(f, h), append$8(f, _), append$8(f, E), append$8(n, c), M && M.m(n, null), append$8(n, C), L && L.m(n, null), append$8(n, b), append$8(n, A), append$8(A, S), append$8(A, s), append$8(A, o), append$8(n, w), append$8(n, p), r[21](p), append$8(n, v), T && T.m(n, null), append$8(n, a), D && D.m(n, null), l || (g = [
        listen$2(
          u,
          "click",
          /*resetZoom*/
          r[18]
        ),
        listen$2(
          h,
          "click",
          /*toggleOffCanvas*/
          r[14]
        ),
        listen$2(
          E,
          "click",
          /*toggleOffCanvasReps*/
          r[15]
        ),
        listen$2(
          S,
          "click",
          /*toggleCiteTooltip*/
          r[13]
        )
      ], l = !0);
    },
    p(I, z) {
      /*anyColorAlphaFold*/
      I[11] ? M ? M.p(I, z) : (M = create_if_block_8$1(I), M.c(), M.m(n, C)) : M && (M.d(1), M = null), /*hasFrames*/
      I[9] ? L ? L.p(I, z) : (L = create_if_block_6$1(I), L.c(), L.m(n, b)) : L && (L.d(1), L = null), z[0] & /*showCiteTooltip*/
      64 && toggle_class$5(
        o,
        "opacity-100",
        /*showCiteTooltip*/
        I[6]
      ), /*showOffCanvas*/
      I[7] ? T ? T.p(I, z) : (T = create_if_block_2$1(I), T.c(), T.m(n, a)) : T && (T.d(1), T = null), /*showOffCanvasReps*/
      I[8] ? D ? D.p(I, z) : (D = create_if_block$6(I), D.c(), D.m(n, null)) : D && (D.d(1), D = null);
    },
    i: noop$6,
    o: noop$6,
    d(I) {
      I && detach$a(e), M && M.d(), L && L.d(), r[21](null), T && T.d(), D && D.d(), l = !1, run_all$3(g);
    }
  };
}
function fade(r, { delay: e = 0, duration: t = 50 }) {
  const n = +getComputedStyle(r).opacity;
  return {
    delay: e,
    duration: t,
    css: (f) => `opacity: ${f * n}`
  };
}
function instance$9(r, e, t) {
  let n = _3Dmol, f, { confidenceLabel: u = null } = e, { moldata: y = null } = e, h = {
    backgroundColor: {
      type: "select",
      options: ["white", "black", "gray", "lightgray", "beige", "orange"]
    },
    orthographic: { type: "toggle" },
    disableFog: { type: "toggle" }
  }, { config: _ = {} } = e, E = !0, c = !1;
  function C() {
    t(6, c = !c);
  }
  let { representations: b = [] } = e, A = !1, S = !1;
  function s() {
    t(7, A = !A);
  }
  function o() {
    t(8, S = !S);
  }
  function w(ue) {
    b.splice(ue, 1), t(1, b);
  }
  function p() {
    b.push({
      model: 0,
      chain: "",
      resname: "",
      style: "cartoon",
      color: "grayCarbon",
      residue_range: "",
      around: 0,
      byres: !1,
      visible: !0
    }), t(1, b);
  }
  let v = function(ue) {
    return ue.b < 50 ? "OrangeRed" : ue.b < 70 ? "Gold" : ue.b < 90 ? "MediumTurquoise" : "Blue";
  }, a;
  function l(ue) {
    if (ue.type != null)
      a.zoomTo();
    else {
      let ye = { model: ue.model };
      ue.chain !== "" && (ye.chain = ue.chain), ue.residue_range !== "" && (ye.resi = ue.residue_range), ue.resname !== "" && (ye.resn = ue.resname), a.zoomTo(ye);
    }
  }
  function g(ue) {
    a !== void 0 && (a.setStyle(), a.removeAllSurfaces(), ue.forEach((ye) => {
      let ge;
      ye.color === "alphafold" ? ge = { colorfunc: v } : ye.color == "spectrum" ? ge = { color: "spectrum" } : ge = { colorscheme: ye.color };
      let Se = { model: ye.model };
      if (ye.chain !== "" && (Se.chain = ye.chain), ye.residue_range !== "" && (Se.resi = ye.residue_range), ye.resname !== "" && (Se.resn = ye.resname), Se.byres = ye.byres, ye.around !== 0 && (Se.expand = ye.around), ye.sidechain && (Se = {
        and: [Se, { atom: ["N", "C", "O"], invert: !0 }]
      }), ye.style === "surface")
        ge.opacity = 0.8, a.addSurface(n.SurfaceType.VDW, ge, Se);
      else
        try {
          a.getModel(Se.model) != null && a.addStyle(Se, { [ye.style]: ge });
        } catch (ze) {
          console.log(ze);
        }
    }), a.render());
  }
  onMount$1(() => {
    let ue = { ..._, cartoonQuality: 7 };
    t(20, a = n.createViewer(f, ue));
    let ye = [];
    b.forEach((ge) => {
      ye.some((Se) => Se.model === ge.model && Se.chain === ge.chain && Se.resname === ge.resname && Se.style === ge.style && Se.color === ge.color && Se.residue_range === ge.residue_range && Se.around === ge.around && Se.byres === ge.byres && Se.sidechain === ge.sidechain) || ye.push(ge);
    }), t(1, b = ye), y.length > 0 && y.forEach((ge) => {
      ge.asFrames ? a.addModelsAsFrames(ge.data, ge.format) : a.addModel(ge.data, ge.format);
    }), g(b), a.zoomTo(), a.render(), a.zoom(0.8, 2e3), b.forEach((ge) => {
      ge.color === "alphafold" && t(11, T = !0);
    }), E && a.setHoverable(
      {},
      !0,
      function(ge, Se, ze, He) {
        if (!ge.label) {
          let We;
          T ? We = ge.resn + ":" + ge.resi + ":" + ge.atom + " (" + u + " " + ge.b + ")" : We = ge.resn + ":" + ge.resi + ":" + ge.atom, ge.label = Se.addLabel(We, {
            position: ge,
            backgroundColor: "#ffffff",
            borderColor: "#dddddd",
            fontColor: "black"
          });
        }
      },
      function(ge, Se) {
        ge.label && (Se.removeLabel(ge.label), delete ge.label);
      }
    );
  });
  let M = !1, L = !1, T = !1;
  function D() {
    console.log(a.isAnimated()), L ? a.pauseAnimate() : a.animate({ loop: "forward", reps: 0 }), a.render(), console.log(a.isAnimated()), t(10, L = !L);
  }
  function I(ue) {
    binding_callbacks$3[ue ? "unshift" : "push"](() => {
      f = ue, t(4, f);
    });
  }
  function z(ue) {
    _[ue] = this.checked, t(0, _), t(12, h);
  }
  const P = (ue) => {
    t(0, _[ue] = event.target.value, _);
  };
  function B(ue) {
    _[ue] = select_value(this), t(0, _), t(12, h);
  }
  function F() {
    E = this.value, t(5, E);
  }
  const N = (ue, ye, ge) => t(1, ye[ge].visible = !ue.visible, b), $ = (ue) => w(ue), k = (ue) => l(ue);
  function G(ue, ye) {
    ue[ye].model = select_value(this), t(1, b);
  }
  function H(ue, ye) {
    ue[ye].chain = this.value, t(1, b);
  }
  function U(ue, ye) {
    ue[ye].resname = this.value, t(1, b);
  }
  function V(ue, ye) {
    ue[ye].residue_range = this.value, t(1, b);
  }
  function Q(ue, ye) {
    ue[ye].style = select_value(this), t(1, b);
  }
  const ae = (ue, ye, ge, Se) => {
    t(1, ye[ge].around = Se.target.value, b);
  };
  function oe(ue, ye) {
    ue[ye].around = this.value, t(1, b);
  }
  function q(ue, ye) {
    ue[ye].byres = this.checked, t(1, b);
  }
  function me(ue, ye) {
    ue[ye].sidechain = this.checked, t(1, b);
  }
  const ne = (ue, ye, ge) => t(1, ye[ge].color = "orangeCarbon", b), fe = (ue, ye, ge) => t(1, ye[ge].color = "redCarbon", b), Ce = (ue, ye, ge) => t(1, ye[ge].color = "blackCarbon", b), Me = (ue, ye, ge) => t(1, ye[ge].color = "blueCarbon", b), Te = (ue, ye, ge) => t(1, ye[ge].color = "grayCarbon", b), se = (ue, ye, ge) => t(1, ye[ge].color = "greenCarbon", b), pe = (ue, ye, ge) => t(1, ye[ge].color = "cyanCarbon", b), we = (ue, ye, ge) => t(1, ye[ge].color = "alphafold", b), ke = (ue, ye, ge) => t(1, ye[ge].color = "default", b), Ue = (ue, ye, ge) => t(1, ye[ge].color = "Jmol", b), Ne = (ue, ye, ge) => t(1, ye[ge].color = "chain", b), Be = (ue, ye, ge) => t(1, ye[ge].color = "spectrum", b);
  return r.$$set = (ue) => {
    "confidenceLabel" in ue && t(2, u = ue.confidenceLabel), "moldata" in ue && t(3, y = ue.moldata), "config" in ue && t(0, _ = ue.config), "representations" in ue && t(1, b = ue.representations);
  }, r.$$.update = () => {
    r.$$.dirty[0] & /*view, config*/
    1048577 && a != null && (a.setBackgroundColor(_.backgroundColor), a.enableFog(!_.disableFog), a.setCameraParameters({ orthographic: _.orthographic })), r.$$.dirty[0] & /*representations*/
    2 && g(b), r.$$.dirty[0] & /*moldata*/
    8 && y.forEach((ue) => {
      ue.asFrames && t(9, M = !0);
    }), r.$$.dirty[0] & /*representations*/
    2 && (t(11, T = !1), b.forEach((ue) => {
      ue.color === "alphafold" && t(11, T = !0);
    }));
  }, [
    _,
    b,
    u,
    y,
    f,
    E,
    c,
    A,
    S,
    M,
    L,
    T,
    h,
    C,
    s,
    o,
    w,
    p,
    l,
    D,
    a,
    I,
    z,
    P,
    B,
    F,
    N,
    $,
    k,
    G,
    H,
    U,
    V,
    Q,
    ae,
    oe,
    q,
    me,
    ne,
    fe,
    Ce,
    Me,
    Te,
    se,
    pe,
    we,
    ke,
    Ue,
    Ne,
    Be
  ];
}
class MolecularViewer extends SvelteComponent$a {
  constructor(e) {
    super(), init$a(
      this,
      e,
      instance$9,
      create_fragment$a,
      safe_not_equal$b,
      {
        confidenceLabel: 2,
        moldata: 3,
        config: 0,
        representations: 1
      },
      null,
      [-1, -1, -1]
    );
  }
}
const {
  SvelteComponent: SvelteComponent$9,
  bubble: bubble$2,
  check_outros: check_outros$5,
  create_component: create_component$5,
  destroy_component: destroy_component$5,
  detach: detach$9,
  empty: empty$3,
  group_outros: group_outros$5,
  init: init$9,
  insert: insert$9,
  mount_component: mount_component$5,
  safe_not_equal: safe_not_equal$a,
  space: space$6,
  transition_in: transition_in$6,
  transition_out: transition_out$6
} = window.__gradio__svelte__internal;
function create_else_block$4(r) {
  let e, t;
  return e = new Empty({
    props: {
      unpadded_box: !0,
      size: "large",
      $$slots: { default: [create_default_slot$2] },
      $$scope: { ctx: r }
    }
  }), {
    c() {
      create_component$5(e.$$.fragment);
    },
    m(n, f) {
      mount_component$5(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f & /*$$scope*/
      8192 && (u.$$scope = { dirty: f, ctx: n }), e.$set(u);
    },
    i(n) {
      t || (transition_in$6(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$6(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$5(e, n);
    }
  };
}
function create_if_block$5(r) {
  let e, t, n, f;
  e = new FilePreview({
    props: {
      i18n: (
        /*i18n*/
        r[5]
      ),
      selectable: (
        /*selectable*/
        r[3]
      ),
      value: (
        /*value*/
        r[0]
      ),
      height: (
        /*height*/
        r[4]
      )
    }
  }), e.$on(
    "select",
    /*select_handler*/
    r[12]
  );
  let u = (
    /*moldata*/
    r[9] != null && /*molviewer*/
    r[10] && create_if_block_1$4(r)
  );
  return {
    c() {
      create_component$5(e.$$.fragment), t = space$6(), u && u.c(), n = empty$3();
    },
    m(y, h) {
      mount_component$5(e, y, h), insert$9(y, t, h), u && u.m(y, h), insert$9(y, n, h), f = !0;
    },
    p(y, h) {
      const _ = {};
      h & /*i18n*/
      32 && (_.i18n = /*i18n*/
      y[5]), h & /*selectable*/
      8 && (_.selectable = /*selectable*/
      y[3]), h & /*value*/
      1 && (_.value = /*value*/
      y[0]), h & /*height*/
      16 && (_.height = /*height*/
      y[4]), e.$set(_), /*moldata*/
      y[9] != null && /*molviewer*/
      y[10] ? u ? (u.p(y, h), h & /*moldata, molviewer*/
      1536 && transition_in$6(u, 1)) : (u = create_if_block_1$4(y), u.c(), transition_in$6(u, 1), u.m(n.parentNode, n)) : u && (group_outros$5(), transition_out$6(u, 1, 1, () => {
        u = null;
      }), check_outros$5());
    },
    i(y) {
      f || (transition_in$6(e.$$.fragment, y), transition_in$6(u), f = !0);
    },
    o(y) {
      transition_out$6(e.$$.fragment, y), transition_out$6(u), f = !1;
    },
    d(y) {
      y && (detach$9(t), detach$9(n)), destroy_component$5(e, y), u && u.d(y);
    }
  };
}
function create_default_slot$2(r) {
  let e, t;
  return e = new File$1({}), {
    c() {
      create_component$5(e.$$.fragment);
    },
    m(n, f) {
      mount_component$5(e, n, f), t = !0;
    },
    i(n) {
      t || (transition_in$6(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$6(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$5(e, n);
    }
  };
}
function create_if_block_1$4(r) {
  let e, t;
  return e = new MolecularViewer({
    props: {
      moldata: (
        /*moldata*/
        r[9]
      ),
      config: (
        /*config*/
        r[6]
      ),
      confidenceLabel: (
        /*confidenceLabel*/
        r[7]
      ),
      representations: (
        /*representations*/
        r[8]
      )
    }
  }), {
    c() {
      create_component$5(e.$$.fragment);
    },
    m(n, f) {
      mount_component$5(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f & /*moldata*/
      512 && (u.moldata = /*moldata*/
      n[9]), f & /*config*/
      64 && (u.config = /*config*/
      n[6]), f & /*confidenceLabel*/
      128 && (u.confidenceLabel = /*confidenceLabel*/
      n[7]), f & /*representations*/
      256 && (u.representations = /*representations*/
      n[8]), e.$set(u);
    },
    i(n) {
      t || (transition_in$6(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$6(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$5(e, n);
    }
  };
}
function create_fragment$9(r) {
  let e, t, n, f, u, y;
  e = new BlockLabel({
    props: {
      show_label: (
        /*show_label*/
        r[2]
      ),
      float: (
        /*value*/
        r[0] === null
      ),
      Icon: File$1,
      label: (
        /*label*/
        r[1] || "File"
      )
    }
  });
  const h = [create_if_block$5, create_else_block$4], _ = [];
  function E(c, C) {
    return (
      /*value*/
      c[0] ? 0 : 1
    );
  }
  return n = E(r), f = _[n] = h[n](r), {
    c() {
      create_component$5(e.$$.fragment), t = space$6(), f.c(), u = empty$3();
    },
    m(c, C) {
      mount_component$5(e, c, C), insert$9(c, t, C), _[n].m(c, C), insert$9(c, u, C), y = !0;
    },
    p(c, [C]) {
      const b = {};
      C & /*show_label*/
      4 && (b.show_label = /*show_label*/
      c[2]), C & /*value*/
      1 && (b.float = /*value*/
      c[0] === null), C & /*label*/
      2 && (b.label = /*label*/
      c[1] || "File"), e.$set(b);
      let A = n;
      n = E(c), n === A ? _[n].p(c, C) : (group_outros$5(), transition_out$6(_[A], 1, 1, () => {
        _[A] = null;
      }), check_outros$5(), f = _[n], f ? f.p(c, C) : (f = _[n] = h[n](c), f.c()), transition_in$6(f, 1), f.m(u.parentNode, u));
    },
    i(c) {
      y || (transition_in$6(e.$$.fragment, c), transition_in$6(f), y = !0);
    },
    o(c) {
      transition_out$6(e.$$.fragment, c), transition_out$6(f), y = !1;
    },
    d(c) {
      c && (detach$9(t), detach$9(u)), destroy_component$5(e, c), _[n].d(c);
    }
  };
}
function instance$8(r, e, t) {
  let { value: n = null } = e, { label: f } = e, { show_label: u = !0 } = e, { selectable: y = !1 } = e, { height: h = void 0 } = e, { i18n: _ } = e, { config: E = {} } = e, { confidenceLabel: c = "" } = e, { representations: C = [] } = e, { moldata: b = null } = e, { molviewer: A = !1 } = e, { errors: S = [] } = e;
  function s(o) {
    bubble$2.call(this, r, o);
  }
  return r.$$set = (o) => {
    "value" in o && t(0, n = o.value), "label" in o && t(1, f = o.label), "show_label" in o && t(2, u = o.show_label), "selectable" in o && t(3, y = o.selectable), "height" in o && t(4, h = o.height), "i18n" in o && t(5, _ = o.i18n), "config" in o && t(6, E = o.config), "confidenceLabel" in o && t(7, c = o.confidenceLabel), "representations" in o && t(8, C = o.representations), "moldata" in o && t(9, b = o.moldata), "molviewer" in o && t(10, A = o.molviewer), "errors" in o && t(11, S = o.errors);
  }, [
    n,
    f,
    u,
    y,
    h,
    _,
    E,
    c,
    C,
    b,
    A,
    S,
    s
  ];
}
class File_1 extends SvelteComponent$9 {
  constructor(e) {
    super(), init$9(this, e, instance$8, create_fragment$9, safe_not_equal$a, {
      value: 0,
      label: 1,
      show_label: 2,
      selectable: 3,
      height: 4,
      i18n: 5,
      config: 6,
      confidenceLabel: 7,
      representations: 8,
      moldata: 9,
      molviewer: 10,
      errors: 11
    });
  }
}
var fn = new Intl.Collator(0, { numeric: 1 }).compare;
function semiver(r, e, t) {
  return r = r.split("."), e = e.split("."), fn(r[0], e[0]) || fn(r[1], e[1]) || (e[2] = e.slice(2).join("."), t = /[.-]/.test(r[2] = r.slice(2).join(".")), t == /[.-]/.test(e[2]) ? fn(r[2], e[2]) : t ? -1 : 1);
}
function resolve_root(r, e, t) {
  return e.startsWith("http://") || e.startsWith("https://") ? t ? r : e : r + e;
}
function determine_protocol(r) {
  if (r.startsWith("http")) {
    const { protocol: e, host: t } = new URL(r);
    return t.endsWith("hf.space") ? {
      ws_protocol: "wss",
      host: t,
      http_protocol: e
    } : {
      ws_protocol: e === "https:" ? "wss" : "ws",
      http_protocol: e,
      host: t
    };
  } else if (r.startsWith("file:"))
    return {
      ws_protocol: "ws",
      http_protocol: "http:",
      host: "lite.local"
      // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
    };
  return {
    ws_protocol: "wss",
    http_protocol: "https:",
    host: r
  };
}
const RE_SPACE_NAME = /^[^\/]*\/[^\/]*$/, RE_SPACE_DOMAIN = /.*hf\.space\/{0,1}$/;
async function process_endpoint(r, e) {
  const t = {};
  e && (t.Authorization = `Bearer ${e}`);
  const n = r.trim();
  if (RE_SPACE_NAME.test(n))
    try {
      const f = await fetch(
        `https://huggingface.co/api/spaces/${n}/host`,
        { headers: t }
      );
      if (f.status !== 200)
        throw new Error("Space metadata could not be loaded.");
      const u = (await f.json()).host;
      return {
        space_id: r,
        ...determine_protocol(u)
      };
    } catch (f) {
      throw new Error("Space metadata could not be loaded." + f.message);
    }
  if (RE_SPACE_DOMAIN.test(n)) {
    const { ws_protocol: f, http_protocol: u, host: y } = determine_protocol(n);
    return {
      space_id: y.replace(".hf.space", ""),
      ws_protocol: f,
      http_protocol: u,
      host: y
    };
  }
  return {
    space_id: !1,
    ...determine_protocol(n)
  };
}
function map_names_to_ids(r) {
  let e = {};
  return r.forEach(({ api_name: t }, n) => {
    t && (e[t] = n);
  }), e;
}
const RE_DISABLED_DISCUSSION = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
async function discussions_enabled(r) {
  try {
    const t = (await fetch(
      `https://huggingface.co/api/spaces/${r}/discussions`,
      {
        method: "HEAD"
      }
    )).headers.get("x-error-message");
    return !(t && RE_DISABLED_DISCUSSION.test(t));
  } catch {
    return !1;
  }
}
function normalise_file(r, e, t) {
  if (r == null)
    return null;
  if (Array.isArray(r)) {
    const n = [];
    for (const f of r)
      f == null ? n.push(null) : n.push(normalise_file(f, e, t));
    return n;
  }
  return r.is_stream ? t == null ? new FileData({
    ...r,
    url: e + "/stream/" + r.path
  }) : new FileData({
    ...r,
    url: "/proxy=" + t + "stream/" + r.path
  }) : new FileData({
    ...r,
    url: get_fetchable_url_or_file(r.path, e, t)
  });
}
function is_url(r) {
  try {
    const e = new URL(r);
    return e.protocol === "http:" || e.protocol === "https:";
  } catch {
    return !1;
  }
}
function get_fetchable_url_or_file(r, e, t) {
  return r == null ? t ? `/proxy=${t}file=` : `${e}/file=` : is_url(r) ? r : t ? `/proxy=${t}file=${r}` : `${e}/file=${r}`;
}
async function upload(r, e, t = upload_files) {
  let n = (Array.isArray(r) ? r : [r]).map(
    (f) => f.blob
  );
  return await Promise.all(
    await t(e, n).then(
      async (f) => {
        if (f.error)
          throw new Error(f.error);
        return f.files ? f.files.map((u, y) => {
          const h = new FileData({ ...r[y], path: u });
          return normalise_file(h, e, null);
        }) : [];
      }
    )
  );
}
async function prepare_files(r, e) {
  return r.map(
    (t, n) => new FileData({
      path: t.name,
      orig_name: t.name,
      blob: t,
      size: t.size,
      mime_type: t.type,
      is_stream: e
    })
  );
}
class FileData {
  constructor({
    path: e,
    url: t,
    orig_name: n,
    size: f,
    blob: u,
    is_stream: y,
    mime_type: h,
    alt_text: _
  }) {
    this.path = e, this.url = t, this.orig_name = n, this.size = f, this.blob = t ? void 0 : u, this.is_stream = y, this.mime_type = h, this.alt_text = _;
  }
}
const QUEUE_FULL_MSG = "This application is too busy. Keep trying!", BROKEN_CONNECTION_MSG = "Connection errored out.";
let NodeBlob;
function api_factory(r, e) {
  return { post_data: t, upload_files: n, client: f, handle_blob: u };
  async function t(y, h, _) {
    const E = { "Content-Type": "application/json" };
    _ && (E.Authorization = `Bearer ${_}`);
    try {
      var c = await r(y, {
        method: "POST",
        body: JSON.stringify(h),
        headers: E
      });
    } catch {
      return [{ error: BROKEN_CONNECTION_MSG }, 500];
    }
    return [await c.json(), c.status];
  }
  async function n(y, h, _) {
    const E = {};
    _ && (E.Authorization = `Bearer ${_}`);
    const c = 1e3, C = [];
    for (let A = 0; A < h.length; A += c) {
      const S = h.slice(A, A + c), s = new FormData();
      S.forEach((w) => {
        s.append("files", w);
      });
      try {
        var b = await r(`${y}/upload`, {
          method: "POST",
          body: s,
          headers: E
        });
      } catch {
        return { error: BROKEN_CONNECTION_MSG };
      }
      const o = await b.json();
      C.push(...o);
    }
    return { files: C };
  }
  async function f(y, h = { normalise_files: !0 }) {
    return new Promise(async (_) => {
      const { status_callback: E, hf_token: c, normalise_files: C } = h, b = {
        predict: D,
        submit: I,
        view_api: P,
        component_server: z
      }, A = C ?? !0;
      if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) {
        const B = await import("./wrapper-98f94c21-f7f71f53.js");
        NodeBlob = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = B.WebSocket;
      }
      const { ws_protocol: S, http_protocol: s, host: o, space_id: w } = await process_endpoint(y, c), p = Math.random().toString(36).substring(2), v = {};
      let a, l = {}, g = !1;
      c && w && (g = await get_jwt(w, c));
      async function M(B) {
        if (a = B, l = map_names_to_ids((B == null ? void 0 : B.dependencies) || []), a.auth_required)
          return {
            config: a,
            ...b
          };
        try {
          L = await P(a);
        } catch (F) {
          console.error(`Could not get api details: ${F.message}`);
        }
        return {
          config: a,
          ...b
        };
      }
      let L;
      async function T(B) {
        if (E && E(B), B.status === "running")
          try {
            a = await resolve_config(
              r,
              `${s}//${o}`,
              c
            );
            const F = await M(a);
            _(F);
          } catch (F) {
            console.error(F), E && E({
              status: "error",
              message: "Could not load this space.",
              load_status: "error",
              detail: "NOT_FOUND"
            });
          }
      }
      try {
        a = await resolve_config(
          r,
          `${s}//${o}`,
          c
        );
        const B = await M(a);
        _(B);
      } catch (B) {
        console.error(B), w ? check_space_status(
          w,
          RE_SPACE_NAME.test(w) ? "space_name" : "subdomain",
          T
        ) : E && E({
          status: "error",
          message: "Could not load this space.",
          load_status: "error",
          detail: "NOT_FOUND"
        });
      }
      function D(B, F, N) {
        let $ = !1, k = !1, G;
        if (typeof B == "number")
          G = a.dependencies[B];
        else {
          const H = B.replace(/^\//, "");
          G = a.dependencies[l[H]];
        }
        if (G.types.continuous)
          throw new Error(
            "Cannot call predict on this function as it may run forever. Use submit instead"
          );
        return new Promise((H, U) => {
          const V = I(B, F, N);
          let Q;
          V.on("data", (ae) => {
            k && (V.destroy(), H(ae)), $ = !0, Q = ae;
          }).on("status", (ae) => {
            ae.stage === "error" && U(ae), ae.stage === "complete" && (k = !0, $ && (V.destroy(), H(Q)));
          });
        });
      }
      function I(B, F, N) {
        let $, k;
        if (typeof B == "number")
          $ = B, k = L.unnamed_endpoints[$];
        else {
          const se = B.replace(/^\//, "");
          $ = l[se], k = L.named_endpoints[B.trim()];
        }
        if (typeof $ != "number")
          throw new Error(
            "There is no endpoint matching that name of fn_index matching that number."
          );
        let G, H, U = a.protocol ?? "sse";
        const V = typeof B == "number" ? "/predict" : B;
        let Q, ae = null, oe = !1;
        const q = {};
        let me = "";
        typeof window < "u" && (me = new URLSearchParams(window.location.search).toString()), u(
          `${s}//${resolve_root(o, a.path, !0)}`,
          F,
          k,
          c
        ).then((se) => {
          if (Q = { data: se || [], event_data: N, fn_index: $ }, skip_queue($, a))
            ne({
              type: "status",
              endpoint: V,
              stage: "pending",
              queue: !1,
              fn_index: $,
              time: /* @__PURE__ */ new Date()
            }), t(
              `${s}//${resolve_root(o, a.path, !0)}/run${V.startsWith("/") ? V : `/${V}`}${me ? "?" + me : ""}`,
              {
                ...Q,
                session_hash: p
              },
              c
            ).then(([we, ke]) => {
              const Ue = A ? transform_output(
                we.data,
                k,
                a.root,
                a.root_url
              ) : we.data;
              ke == 200 ? (ne({
                type: "data",
                endpoint: V,
                fn_index: $,
                data: Ue,
                time: /* @__PURE__ */ new Date()
              }), ne({
                type: "status",
                endpoint: V,
                fn_index: $,
                stage: "complete",
                eta: we.average_duration,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              })) : ne({
                type: "status",
                stage: "error",
                endpoint: V,
                fn_index: $,
                message: we.error,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              });
            }).catch((we) => {
              ne({
                type: "status",
                stage: "error",
                message: we.message,
                endpoint: V,
                fn_index: $,
                queue: !1,
                time: /* @__PURE__ */ new Date()
              });
            });
          else if (U == "ws") {
            ne({
              type: "status",
              stage: "pending",
              queue: !0,
              endpoint: V,
              fn_index: $,
              time: /* @__PURE__ */ new Date()
            });
            let we = new URL(`${S}://${resolve_root(
              o,
              a.path,
              !0
            )}
							/queue/join${me ? "?" + me : ""}`);
            g && we.searchParams.set("__sign", g), G = e(we), G.onclose = (ke) => {
              ke.wasClean || ne({
                type: "status",
                stage: "error",
                broken: !0,
                message: BROKEN_CONNECTION_MSG,
                queue: !0,
                endpoint: V,
                fn_index: $,
                time: /* @__PURE__ */ new Date()
              });
            }, G.onmessage = function(ke) {
              const Ue = JSON.parse(ke.data), { type: Ne, status: Be, data: ue } = handle_message(
                Ue,
                v[$]
              );
              if (Ne === "update" && Be && !oe)
                ne({
                  type: "status",
                  endpoint: V,
                  fn_index: $,
                  time: /* @__PURE__ */ new Date(),
                  ...Be
                }), Be.stage === "error" && G.close();
              else if (Ne === "hash") {
                G.send(JSON.stringify({ fn_index: $, session_hash: p }));
                return;
              } else
                Ne === "data" ? G.send(JSON.stringify({ ...Q, session_hash: p })) : Ne === "complete" ? oe = Be : Ne === "log" ? ne({
                  type: "log",
                  log: ue.log,
                  level: ue.level,
                  endpoint: V,
                  fn_index: $
                }) : Ne === "generating" && ne({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...Be,
                  stage: Be == null ? void 0 : Be.stage,
                  queue: !0,
                  endpoint: V,
                  fn_index: $
                });
              ue && (ne({
                type: "data",
                time: /* @__PURE__ */ new Date(),
                data: A ? transform_output(
                  ue.data,
                  k,
                  a.root,
                  a.root_url
                ) : ue.data,
                endpoint: V,
                fn_index: $
              }), oe && (ne({
                type: "status",
                time: /* @__PURE__ */ new Date(),
                ...oe,
                stage: Be == null ? void 0 : Be.stage,
                queue: !0,
                endpoint: V,
                fn_index: $
              }), G.close()));
            }, semiver(a.version || "2.0.0", "3.6") < 0 && addEventListener(
              "open",
              () => G.send(JSON.stringify({ hash: p }))
            );
          } else {
            ne({
              type: "status",
              stage: "pending",
              queue: !0,
              endpoint: V,
              fn_index: $,
              time: /* @__PURE__ */ new Date()
            });
            var pe = new URLSearchParams({
              fn_index: $.toString(),
              session_hash: p
            }).toString();
            let we = new URL(
              `${s}//${resolve_root(
                o,
                a.path,
                !0
              )}/queue/join?${pe}`
            );
            H = new EventSource(we), H.onmessage = async function(ke) {
              const Ue = JSON.parse(ke.data), { type: Ne, status: Be, data: ue } = handle_message(
                Ue,
                v[$]
              );
              if (Ne === "update" && Be && !oe)
                ne({
                  type: "status",
                  endpoint: V,
                  fn_index: $,
                  time: /* @__PURE__ */ new Date(),
                  ...Be
                }), Be.stage === "error" && H.close();
              else if (Ne === "data") {
                ae = Ue.event_id;
                let [ye, ge] = await t(
                  `${s}//${resolve_root(
                    o,
                    a.path,
                    !0
                  )}/queue/data`,
                  {
                    ...Q,
                    session_hash: p,
                    event_id: ae
                  },
                  c
                );
                ge !== 200 && (ne({
                  type: "status",
                  stage: "error",
                  message: BROKEN_CONNECTION_MSG,
                  queue: !0,
                  endpoint: V,
                  fn_index: $,
                  time: /* @__PURE__ */ new Date()
                }), H.close());
              } else
                Ne === "complete" ? oe = Be : Ne === "log" ? ne({
                  type: "log",
                  log: ue.log,
                  level: ue.level,
                  endpoint: V,
                  fn_index: $
                }) : Ne === "generating" && ne({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...Be,
                  stage: Be == null ? void 0 : Be.stage,
                  queue: !0,
                  endpoint: V,
                  fn_index: $
                });
              ue && (ne({
                type: "data",
                time: /* @__PURE__ */ new Date(),
                data: A ? transform_output(
                  ue.data,
                  k,
                  a.root,
                  a.root_url
                ) : ue.data,
                endpoint: V,
                fn_index: $
              }), oe && (ne({
                type: "status",
                time: /* @__PURE__ */ new Date(),
                ...oe,
                stage: Be == null ? void 0 : Be.stage,
                queue: !0,
                endpoint: V,
                fn_index: $
              }), H.close()));
            };
          }
        });
        function ne(se) {
          const we = q[se.type] || [];
          we == null || we.forEach((ke) => ke(se));
        }
        function fe(se, pe) {
          const we = q, ke = we[se] || [];
          return we[se] = ke, ke == null || ke.push(pe), { on: fe, off: Ce, cancel: Me, destroy: Te };
        }
        function Ce(se, pe) {
          const we = q;
          let ke = we[se] || [];
          return ke = ke == null ? void 0 : ke.filter((Ue) => Ue !== pe), we[se] = ke, { on: fe, off: Ce, cancel: Me, destroy: Te };
        }
        async function Me() {
          const se = {
            stage: "complete",
            queue: !1,
            time: /* @__PURE__ */ new Date()
          };
          oe = se, ne({
            ...se,
            type: "status",
            endpoint: V,
            fn_index: $
          });
          let pe = {};
          U === "ws" ? (G && G.readyState === 0 ? G.addEventListener("open", () => {
            G.close();
          }) : G.close(), pe = { fn_index: $, session_hash: p }) : (H.close(), pe = { event_id: ae });
          try {
            await r(
              `${s}//${resolve_root(
                o,
                a.path,
                !0
              )}/reset`,
              {
                headers: { "Content-Type": "application/json" },
                method: "POST",
                body: JSON.stringify(pe)
              }
            );
          } catch {
            console.warn(
              "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
            );
          }
        }
        function Te() {
          for (const se in q)
            q[se].forEach((pe) => {
              Ce(se, pe);
            });
        }
        return {
          on: fe,
          off: Ce,
          cancel: Me,
          destroy: Te
        };
      }
      async function z(B, F, N) {
        var $;
        const k = { "Content-Type": "application/json" };
        c && (k.Authorization = `Bearer ${c}`);
        let G, H = a.components.find(
          (Q) => Q.id === B
        );
        ($ = H == null ? void 0 : H.props) != null && $.root_url ? G = H.props.root_url : G = `${s}//${resolve_root(
          o,
          a.path,
          !0
        )}/`;
        const U = await r(
          `${G}component_server/`,
          {
            method: "POST",
            body: JSON.stringify({
              data: N,
              component_id: B,
              fn_name: F,
              session_hash: p
            }),
            headers: k
          }
        );
        if (!U.ok)
          throw new Error(
            "Could not connect to component server: " + U.statusText
          );
        return await U.json();
      }
      async function P(B) {
        if (L)
          return L;
        const F = { "Content-Type": "application/json" };
        c && (F.Authorization = `Bearer ${c}`);
        let N;
        if (semiver(B.version || "2.0.0", "3.30") < 0 ? N = await r(
          "https://gradio-space-api-fetcher-v2.hf.space/api",
          {
            method: "POST",
            body: JSON.stringify({
              serialize: !1,
              config: JSON.stringify(B)
            }),
            headers: F
          }
        ) : N = await r(`${B.root}/info`, {
          headers: F
        }), !N.ok)
          throw new Error(BROKEN_CONNECTION_MSG);
        let $ = await N.json();
        return "api" in $ && ($ = $.api), $.named_endpoints["/predict"] && !$.unnamed_endpoints[0] && ($.unnamed_endpoints[0] = $.named_endpoints["/predict"]), transform_api_info($, B, l);
      }
    });
  }
  async function u(y, h, _, E) {
    const c = await walk_and_store_blobs(
      h,
      void 0,
      [],
      !0,
      _
    );
    return Promise.all(
      c.map(async ({ path: C, blob: b, type: A }) => {
        if (b) {
          const S = (await n(y, [b], E)).files[0];
          return { path: C, file_url: S, type: A, name: b == null ? void 0 : b.name };
        }
        return { path: C, type: A };
      })
    ).then((C) => (C.forEach(({ path: b, file_url: A, type: S, name: s }) => {
      if (S === "Gallery")
        update_object(h, A, b);
      else if (A) {
        const o = new FileData({ path: A, orig_name: s });
        update_object(h, o, b);
      }
    }), h));
  }
}
const { post_data, upload_files, client, handle_blob } = api_factory(
  fetch,
  (...r) => new WebSocket(...r)
);
function transform_output(r, e, t, n) {
  return r.map((f, u) => {
    var y, h, _, E;
    return ((h = (y = e == null ? void 0 : e.returns) == null ? void 0 : y[u]) == null ? void 0 : h.component) === "File" ? normalise_file(f, t, n) : ((E = (_ = e == null ? void 0 : e.returns) == null ? void 0 : _[u]) == null ? void 0 : E.component) === "Gallery" ? f.map((c) => Array.isArray(c) ? [normalise_file(c[0], t, n), c[1]] : [normalise_file(c, t, n), null]) : typeof f == "object" && f.path ? normalise_file(f, t, n) : f;
  });
}
function get_type(r, e, t, n) {
  switch (r.type) {
    case "string":
      return "string";
    case "boolean":
      return "boolean";
    case "number":
      return "number";
  }
  if (t === "JSONSerializable" || t === "StringSerializable")
    return "any";
  if (t === "ListStringSerializable")
    return "string[]";
  if (e === "Image")
    return n === "parameter" ? "Blob | File | Buffer" : "string";
  if (t === "FileSerializable")
    return (r == null ? void 0 : r.type) === "array" ? n === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : n === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
  if (t === "GallerySerializable")
    return n === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
}
function get_description(r, e) {
  return e === "GallerySerializable" ? "array of [file, label] tuples" : e === "ListStringSerializable" ? "array of strings" : e === "FileSerializable" ? "array of files or single file" : r.description;
}
function transform_api_info(r, e, t) {
  const n = {
    named_endpoints: {},
    unnamed_endpoints: {}
  };
  for (const f in r) {
    const u = r[f];
    for (const y in u) {
      const h = e.dependencies[y] ? y : t[y.replace("/", "")], _ = u[y];
      n[f][y] = {}, n[f][y].parameters = {}, n[f][y].returns = {}, n[f][y].type = e.dependencies[h].types, n[f][y].parameters = _.parameters.map(
        ({ label: E, component: c, type: C, serializer: b }) => ({
          label: E,
          component: c,
          type: get_type(C, c, b, "parameter"),
          description: get_description(C, b)
        })
      ), n[f][y].returns = _.returns.map(
        ({ label: E, component: c, type: C, serializer: b }) => ({
          label: E,
          component: c,
          type: get_type(C, c, b, "return"),
          description: get_description(C, b)
        })
      );
    }
  }
  return n;
}
async function get_jwt(r, e) {
  try {
    return (await (await fetch(`https://huggingface.co/api/spaces/${r}/jwt`, {
      headers: {
        Authorization: `Bearer ${e}`
      }
    })).json()).token || !1;
  } catch (t) {
    return console.error(t), !1;
  }
}
function update_object(r, e, t) {
  for (; t.length > 1; )
    r = r[t.shift()];
  r[t.shift()] = e;
}
async function walk_and_store_blobs(r, e = void 0, t = [], n = !1, f = void 0) {
  if (Array.isArray(r)) {
    let u = [];
    return await Promise.all(
      r.map(async (y, h) => {
        var _;
        let E = t.slice();
        E.push(h);
        const c = await walk_and_store_blobs(
          r[h],
          n ? ((_ = f == null ? void 0 : f.parameters[h]) == null ? void 0 : _.component) || void 0 : e,
          E,
          !1,
          f
        );
        u = u.concat(c);
      })
    ), u;
  } else {
    if (globalThis.Buffer && r instanceof globalThis.Buffer)
      return [
        {
          path: t,
          blob: e === "Image" ? !1 : new NodeBlob([r]),
          type: e
        }
      ];
    if (typeof r == "object") {
      let u = [];
      for (let y in r)
        if (r.hasOwnProperty(y)) {
          let h = t.slice();
          h.push(y), u = u.concat(
            await walk_and_store_blobs(
              r[y],
              void 0,
              h,
              !1,
              f
            )
          );
        }
      return u;
    }
  }
  return [];
}
function skip_queue(r, e) {
  var t, n, f, u;
  return !(((n = (t = e == null ? void 0 : e.dependencies) == null ? void 0 : t[r]) == null ? void 0 : n.queue) === null ? e.enable_queue : (u = (f = e == null ? void 0 : e.dependencies) == null ? void 0 : f[r]) != null && u.queue) || !1;
}
async function resolve_config(r, e, t) {
  const n = {};
  if (t && (n.Authorization = `Bearer ${t}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) {
    const f = window.gradio_config.root, u = window.gradio_config;
    return u.root = resolve_root(e, u.root, !1), { ...u, path: f };
  } else if (e) {
    let f = await r(`${e}/config`, {
      headers: n
    });
    if (f.status === 200) {
      const u = await f.json();
      return u.path = u.path ?? "", u.root = e, u;
    }
    throw new Error("Could not get config.");
  }
  throw new Error("No config or app endpoint found");
}
async function check_space_status(r, e, t) {
  let n = e === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${r}` : `https://huggingface.co/api/spaces/${r}`, f, u;
  try {
    if (f = await fetch(n), u = f.status, u !== 200)
      throw new Error();
    f = await f.json();
  } catch {
    t({
      status: "error",
      load_status: "error",
      message: "Could not get space status",
      detail: "NOT_FOUND"
    });
    return;
  }
  if (!f || u !== 200)
    return;
  const {
    runtime: { stage: y },
    id: h
  } = f;
  switch (y) {
    case "STOPPED":
    case "SLEEPING":
      t({
        status: "sleeping",
        load_status: "pending",
        message: "Space is asleep. Waking it up...",
        detail: y
      }), setTimeout(() => {
        check_space_status(r, e, t);
      }, 1e3);
      break;
    case "PAUSED":
      t({
        status: "paused",
        load_status: "error",
        message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
        detail: y,
        discussions_enabled: await discussions_enabled(h)
      });
      break;
    case "RUNNING":
    case "RUNNING_BUILDING":
      t({
        status: "running",
        load_status: "complete",
        message: "",
        detail: y
      });
      break;
    case "BUILDING":
      t({
        status: "building",
        load_status: "pending",
        message: "Space is building...",
        detail: y
      }), setTimeout(() => {
        check_space_status(r, e, t);
      }, 1e3);
      break;
    default:
      t({
        status: "space_error",
        load_status: "error",
        message: "This space is experiencing an issue.",
        detail: y,
        discussions_enabled: await discussions_enabled(h)
      });
      break;
  }
}
function handle_message(r, e) {
  switch (r.msg) {
    case "send_data":
      return { type: "data" };
    case "send_hash":
      return { type: "hash" };
    case "queue_full":
      return {
        type: "update",
        status: {
          queue: !0,
          message: QUEUE_FULL_MSG,
          stage: "error",
          code: r.code,
          success: r.success
        }
      };
    case "estimation":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: e || "pending",
          code: r.code,
          size: r.queue_size,
          position: r.rank,
          eta: r.rank_eta,
          success: r.success
        }
      };
    case "progress":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: r.code,
          progress_data: r.progress_data,
          success: r.success
        }
      };
    case "log":
      return { type: "log", data: r };
    case "process_generating":
      return {
        type: "generating",
        status: {
          queue: !0,
          message: r.success ? null : r.output.error,
          stage: r.success ? "generating" : "error",
          code: r.code,
          progress_data: r.progress_data,
          eta: r.average_duration
        },
        data: r.success ? r.output : null
      };
    case "process_completed":
      return "error" in r.output ? {
        type: "update",
        status: {
          queue: !0,
          message: r.output.error,
          stage: "error",
          code: r.code,
          success: r.success
        }
      } : {
        type: "complete",
        status: {
          queue: !0,
          message: r.success ? void 0 : r.output.error,
          stage: r.success ? "complete" : "error",
          code: r.code,
          progress_data: r.progress_data,
          eta: r.output.average_duration
        },
        data: r.success ? r.output : null
      };
    case "process_starts":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: r.code,
          size: r.rank,
          position: 0,
          success: r.success
        }
      };
  }
  return { type: "none", status: { stage: "error", queue: !0 } };
}
function noop$5() {
}
function run(r) {
  return r();
}
function run_all$2(r) {
  r.forEach(run);
}
function is_function(r) {
  return typeof r == "function";
}
function safe_not_equal$9(r, e) {
  return r != r ? e == e : r !== e || r && typeof r == "object" || typeof r == "function";
}
function subscribe(r, ...e) {
  if (r == null) {
    for (const n of e)
      n(void 0);
    return noop$5;
  }
  const t = r.subscribe(...e);
  return t.unsubscribe ? () => t.unsubscribe() : t;
}
const is_client = typeof window < "u";
let now = is_client ? () => window.performance.now() : () => Date.now(), raf = is_client ? (r) => requestAnimationFrame(r) : noop$5;
const tasks = /* @__PURE__ */ new Set();
function run_tasks(r) {
  tasks.forEach((e) => {
    e.c(r) || (tasks.delete(e), e.f());
  }), tasks.size !== 0 && raf(run_tasks);
}
function loop(r) {
  let e;
  return tasks.size === 0 && raf(run_tasks), {
    promise: new Promise((t) => {
      tasks.add(e = { c: r, f: t });
    }),
    abort() {
      tasks.delete(e);
    }
  };
}
const subscriber_queue = [];
function readable(r, e) {
  return {
    subscribe: writable(r, e).subscribe
  };
}
function writable(r, e = noop$5) {
  let t;
  const n = /* @__PURE__ */ new Set();
  function f(h) {
    if (safe_not_equal$9(r, h) && (r = h, t)) {
      const _ = !subscriber_queue.length;
      for (const E of n)
        E[1](), subscriber_queue.push(E, r);
      if (_) {
        for (let E = 0; E < subscriber_queue.length; E += 2)
          subscriber_queue[E][0](subscriber_queue[E + 1]);
        subscriber_queue.length = 0;
      }
    }
  }
  function u(h) {
    f(h(r));
  }
  function y(h, _ = noop$5) {
    const E = [h, _];
    return n.add(E), n.size === 1 && (t = e(f, u) || noop$5), h(r), () => {
      n.delete(E), n.size === 0 && t && (t(), t = null);
    };
  }
  return { set: f, update: u, subscribe: y };
}
function derived(r, e, t) {
  const n = !Array.isArray(r), f = n ? [r] : r;
  if (!f.every(Boolean))
    throw new Error("derived() expects stores as input, got a falsy value");
  const u = e.length < 2;
  return readable(t, (y, h) => {
    let _ = !1;
    const E = [];
    let c = 0, C = noop$5;
    const b = () => {
      if (c)
        return;
      C();
      const S = e(n ? E[0] : E, y, h);
      u ? y(S) : C = is_function(S) ? S : noop$5;
    }, A = f.map(
      (S, s) => subscribe(
        S,
        (o) => {
          E[s] = o, c &= ~(1 << s), _ && b();
        },
        () => {
          c |= 1 << s;
        }
      )
    );
    return _ = !0, b(), function() {
      run_all$2(A), C(), _ = !1;
    };
  });
}
function is_date(r) {
  return Object.prototype.toString.call(r) === "[object Date]";
}
function tick_spring(r, e, t, n) {
  if (typeof t == "number" || is_date(t)) {
    const f = n - t, u = (t - e) / (r.dt || 1 / 60), y = r.opts.stiffness * f, h = r.opts.damping * u, _ = (y - h) * r.inv_mass, E = (u + _) * r.dt;
    return Math.abs(E) < r.opts.precision && Math.abs(f) < r.opts.precision ? n : (r.settled = !1, is_date(t) ? new Date(t.getTime() + E) : t + E);
  } else {
    if (Array.isArray(t))
      return t.map(
        (f, u) => tick_spring(r, e[u], t[u], n[u])
      );
    if (typeof t == "object") {
      const f = {};
      for (const u in t)
        f[u] = tick_spring(r, e[u], t[u], n[u]);
      return f;
    } else
      throw new Error(`Cannot spring ${typeof t} values`);
  }
}
function spring(r, e = {}) {
  const t = writable(r), { stiffness: n = 0.15, damping: f = 0.8, precision: u = 0.01 } = e;
  let y, h, _, E = r, c = r, C = 1, b = 0, A = !1;
  function S(o, w = {}) {
    c = o;
    const p = _ = {};
    return r == null || w.hard || s.stiffness >= 1 && s.damping >= 1 ? (A = !0, y = now(), E = o, t.set(r = c), Promise.resolve()) : (w.soft && (b = 1 / ((w.soft === !0 ? 0.5 : +w.soft) * 60), C = 0), h || (y = now(), A = !1, h = loop((v) => {
      if (A)
        return A = !1, h = null, !1;
      C = Math.min(C + b, 1);
      const a = {
        inv_mass: C,
        opts: s,
        settled: !0,
        dt: (v - y) * 60 / 1e3
      }, l = tick_spring(a, E, r, c);
      return y = v, E = r, t.set(r = l), a.settled && (h = null), !a.settled;
    })), new Promise((v) => {
      h.promise.then(() => {
        p === _ && v();
      });
    }));
  }
  const s = {
    set: S,
    update: (o, w) => S(o(c, r), w),
    subscribe: t.subscribe,
    stiffness: n,
    damping: f,
    precision: u
  };
  return s;
}
var isMergeableObject = function r(e) {
  return isNonNullObject(e) && !isSpecial(e);
};
function isNonNullObject(r) {
  return !!r && typeof r == "object";
}
function isSpecial(r) {
  var e = Object.prototype.toString.call(r);
  return e === "[object RegExp]" || e === "[object Date]" || isReactElement(r);
}
var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
function isReactElement(r) {
  return r.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(r) {
  return Array.isArray(r) ? [] : {};
}
function cloneUnlessOtherwiseSpecified(r, e) {
  return e.clone !== !1 && e.isMergeableObject(r) ? deepmerge(emptyTarget(r), r, e) : r;
}
function defaultArrayMerge(r, e, t) {
  return r.concat(e).map(function(n) {
    return cloneUnlessOtherwiseSpecified(n, t);
  });
}
function getMergeFunction(r, e) {
  if (!e.customMerge)
    return deepmerge;
  var t = e.customMerge(r);
  return typeof t == "function" ? t : deepmerge;
}
function getEnumerableOwnPropertySymbols(r) {
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(r).filter(function(e) {
    return Object.propertyIsEnumerable.call(r, e);
  }) : [];
}
function getKeys(r) {
  return Object.keys(r).concat(getEnumerableOwnPropertySymbols(r));
}
function propertyIsOnObject(r, e) {
  try {
    return e in r;
  } catch {
    return !1;
  }
}
function propertyIsUnsafe(r, e) {
  return propertyIsOnObject(r, e) && !(Object.hasOwnProperty.call(r, e) && Object.propertyIsEnumerable.call(r, e));
}
function mergeObject(r, e, t) {
  var n = {};
  return t.isMergeableObject(r) && getKeys(r).forEach(function(f) {
    n[f] = cloneUnlessOtherwiseSpecified(r[f], t);
  }), getKeys(e).forEach(function(f) {
    propertyIsUnsafe(r, f) || (propertyIsOnObject(r, f) && t.isMergeableObject(e[f]) ? n[f] = getMergeFunction(f, t)(r[f], e[f], t) : n[f] = cloneUnlessOtherwiseSpecified(e[f], t));
  }), n;
}
function deepmerge(r, e, t) {
  t = t || {}, t.arrayMerge = t.arrayMerge || defaultArrayMerge, t.isMergeableObject = t.isMergeableObject || isMergeableObject, t.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
  var n = Array.isArray(e), f = Array.isArray(r), u = n === f;
  return u ? n ? t.arrayMerge(r, e, t) : mergeObject(r, e, t) : cloneUnlessOtherwiseSpecified(e, t);
}
deepmerge.all = function r(e, t) {
  if (!Array.isArray(e))
    throw new Error("first argument should be an array");
  return e.reduce(function(n, f) {
    return deepmerge(n, f, t);
  }, {});
};
var deepmerge_1 = deepmerge, cjs = deepmerge_1;
const deepmerge$1 = /* @__PURE__ */ getDefaultExportFromCjs(cjs);
var extendStatics = function(r, e) {
  return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
    t.__proto__ = n;
  } || function(t, n) {
    for (var f in n)
      Object.prototype.hasOwnProperty.call(n, f) && (t[f] = n[f]);
  }, extendStatics(r, e);
};
function __extends(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  extendStatics(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var __assign = function() {
  return __assign = Object.assign || function(e) {
    for (var t, n = 1, f = arguments.length; n < f; n++) {
      t = arguments[n];
      for (var u in t)
        Object.prototype.hasOwnProperty.call(t, u) && (e[u] = t[u]);
    }
    return e;
  }, __assign.apply(this, arguments);
};
function __spreadArray(r, e, t) {
  if (t || arguments.length === 2)
    for (var n = 0, f = e.length, u; n < f; n++)
      (u || !(n in e)) && (u || (u = Array.prototype.slice.call(e, 0, n)), u[n] = e[n]);
  return r.concat(u || Array.prototype.slice.call(e));
}
typeof SuppressedError == "function" && SuppressedError;
var ErrorKind;
(function(r) {
  r[r.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", r[r.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", r[r.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", r[r.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", r[r.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", r[r.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", r[r.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", r[r.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", r[r.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", r[r.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", r[r.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", r[r.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", r[r.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", r[r.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", r[r.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", r[r.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", r[r.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", r[r.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", r[r.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", r[r.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", r[r.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", r[r.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", r[r.INVALID_TAG = 23] = "INVALID_TAG", r[r.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", r[r.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", r[r.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
})(ErrorKind || (ErrorKind = {}));
var TYPE;
(function(r) {
  r[r.literal = 0] = "literal", r[r.argument = 1] = "argument", r[r.number = 2] = "number", r[r.date = 3] = "date", r[r.time = 4] = "time", r[r.select = 5] = "select", r[r.plural = 6] = "plural", r[r.pound = 7] = "pound", r[r.tag = 8] = "tag";
})(TYPE || (TYPE = {}));
var SKELETON_TYPE;
(function(r) {
  r[r.number = 0] = "number", r[r.dateTime = 1] = "dateTime";
})(SKELETON_TYPE || (SKELETON_TYPE = {}));
function isLiteralElement(r) {
  return r.type === TYPE.literal;
}
function isArgumentElement(r) {
  return r.type === TYPE.argument;
}
function isNumberElement(r) {
  return r.type === TYPE.number;
}
function isDateElement(r) {
  return r.type === TYPE.date;
}
function isTimeElement(r) {
  return r.type === TYPE.time;
}
function isSelectElement(r) {
  return r.type === TYPE.select;
}
function isPluralElement(r) {
  return r.type === TYPE.plural;
}
function isPoundElement(r) {
  return r.type === TYPE.pound;
}
function isTagElement(r) {
  return r.type === TYPE.tag;
}
function isNumberSkeleton(r) {
  return !!(r && typeof r == "object" && r.type === SKELETON_TYPE.number);
}
function isDateTimeSkeleton(r) {
  return !!(r && typeof r == "object" && r.type === SKELETON_TYPE.dateTime);
}
var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function parseDateTimeSkeleton(r) {
  var e = {};
  return r.replace(DATE_TIME_REGEX, function(t) {
    var n = t.length;
    switch (t[0]) {
      case "G":
        e.era = n === 4 ? "long" : n === 5 ? "narrow" : "short";
        break;
      case "y":
        e.year = n === 2 ? "2-digit" : "numeric";
        break;
      case "Y":
      case "u":
      case "U":
      case "r":
        throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
      case "q":
      case "Q":
        throw new RangeError("`q/Q` (quarter) patterns are not supported");
      case "M":
      case "L":
        e.month = ["numeric", "2-digit", "short", "long", "narrow"][n - 1];
        break;
      case "w":
      case "W":
        throw new RangeError("`w/W` (week) patterns are not supported");
      case "d":
        e.day = ["numeric", "2-digit"][n - 1];
        break;
      case "D":
      case "F":
      case "g":
        throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
      case "E":
        e.weekday = n === 4 ? "short" : n === 5 ? "narrow" : "short";
        break;
      case "e":
        if (n < 4)
          throw new RangeError("`e..eee` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][n - 4];
        break;
      case "c":
        if (n < 4)
          throw new RangeError("`c..ccc` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][n - 4];
        break;
      case "a":
        e.hour12 = !0;
        break;
      case "b":
      case "B":
        throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
      case "h":
        e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "H":
        e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "K":
        e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "k":
        e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][n - 1];
        break;
      case "j":
      case "J":
      case "C":
        throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
      case "m":
        e.minute = ["numeric", "2-digit"][n - 1];
        break;
      case "s":
        e.second = ["numeric", "2-digit"][n - 1];
        break;
      case "S":
      case "A":
        throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
      case "z":
        e.timeZoneName = n < 4 ? "short" : "long";
        break;
      case "Z":
      case "O":
      case "v":
      case "V":
      case "X":
      case "x":
        throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
    }
    return "";
  }), e;
}
var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
function parseNumberSkeletonFromString(r) {
  if (r.length === 0)
    throw new Error("Number skeleton cannot be empty");
  for (var e = r.split(WHITE_SPACE_REGEX).filter(function(b) {
    return b.length > 0;
  }), t = [], n = 0, f = e; n < f.length; n++) {
    var u = f[n], y = u.split("/");
    if (y.length === 0)
      throw new Error("Invalid number skeleton");
    for (var h = y[0], _ = y.slice(1), E = 0, c = _; E < c.length; E++) {
      var C = c[E];
      if (C.length === 0)
        throw new Error("Invalid number skeleton");
    }
    t.push({ stem: h, options: _ });
  }
  return t;
}
function icuUnitToEcma(r) {
  return r.replace(/^(.*?)-/, "");
}
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g, INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g, CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
function parseSignificantPrecision(r) {
  var e = {};
  return r[r.length - 1] === "r" ? e.roundingPriority = "morePrecision" : r[r.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), r.replace(SIGNIFICANT_PRECISION_REGEX, function(t, n, f) {
    return typeof f != "string" ? (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length) : f === "+" ? e.minimumSignificantDigits = n.length : n[0] === "#" ? e.maximumSignificantDigits = n.length : (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length + (typeof f == "string" ? f.length : 0)), "";
  }), e;
}
function parseSign(r) {
  switch (r) {
    case "sign-auto":
      return {
        signDisplay: "auto"
      };
    case "sign-accounting":
    case "()":
      return {
        currencySign: "accounting"
      };
    case "sign-always":
    case "+!":
      return {
        signDisplay: "always"
      };
    case "sign-accounting-always":
    case "()!":
      return {
        signDisplay: "always",
        currencySign: "accounting"
      };
    case "sign-except-zero":
    case "+?":
      return {
        signDisplay: "exceptZero"
      };
    case "sign-accounting-except-zero":
    case "()?":
      return {
        signDisplay: "exceptZero",
        currencySign: "accounting"
      };
    case "sign-never":
    case "+_":
      return {
        signDisplay: "never"
      };
  }
}
function parseConciseScientificAndEngineeringStem(r) {
  var e;
  if (r[0] === "E" && r[1] === "E" ? (e = {
    notation: "engineering"
  }, r = r.slice(2)) : r[0] === "E" && (e = {
    notation: "scientific"
  }, r = r.slice(1)), e) {
    var t = r.slice(0, 2);
    if (t === "+!" ? (e.signDisplay = "always", r = r.slice(2)) : t === "+?" && (e.signDisplay = "exceptZero", r = r.slice(2)), !CONCISE_INTEGER_WIDTH_REGEX.test(r))
      throw new Error("Malformed concise eng/scientific notation");
    e.minimumIntegerDigits = r.length;
  }
  return e;
}
function parseNotationOptions(r) {
  var e = {}, t = parseSign(r);
  return t || e;
}
function parseNumberSkeleton(r) {
  for (var e = {}, t = 0, n = r; t < n.length; t++) {
    var f = n[t];
    switch (f.stem) {
      case "percent":
      case "%":
        e.style = "percent";
        continue;
      case "%x100":
        e.style = "percent", e.scale = 100;
        continue;
      case "currency":
        e.style = "currency", e.currency = f.options[0];
        continue;
      case "group-off":
      case ",_":
        e.useGrouping = !1;
        continue;
      case "precision-integer":
      case ".":
        e.maximumFractionDigits = 0;
        continue;
      case "measure-unit":
      case "unit":
        e.style = "unit", e.unit = icuUnitToEcma(f.options[0]);
        continue;
      case "compact-short":
      case "K":
        e.notation = "compact", e.compactDisplay = "short";
        continue;
      case "compact-long":
      case "KK":
        e.notation = "compact", e.compactDisplay = "long";
        continue;
      case "scientific":
        e = __assign(__assign(__assign({}, e), { notation: "scientific" }), f.options.reduce(function(_, E) {
          return __assign(__assign({}, _), parseNotationOptions(E));
        }, {}));
        continue;
      case "engineering":
        e = __assign(__assign(__assign({}, e), { notation: "engineering" }), f.options.reduce(function(_, E) {
          return __assign(__assign({}, _), parseNotationOptions(E));
        }, {}));
        continue;
      case "notation-simple":
        e.notation = "standard";
        continue;
      case "unit-width-narrow":
        e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow";
        continue;
      case "unit-width-short":
        e.currencyDisplay = "code", e.unitDisplay = "short";
        continue;
      case "unit-width-full-name":
        e.currencyDisplay = "name", e.unitDisplay = "long";
        continue;
      case "unit-width-iso-code":
        e.currencyDisplay = "symbol";
        continue;
      case "scale":
        e.scale = parseFloat(f.options[0]);
        continue;
      case "integer-width":
        if (f.options.length > 1)
          throw new RangeError("integer-width stems only accept a single optional option");
        f.options[0].replace(INTEGER_WIDTH_REGEX, function(_, E, c, C, b, A) {
          if (E)
            e.minimumIntegerDigits = c.length;
          else {
            if (C && b)
              throw new Error("We currently do not support maximum integer digits");
            if (A)
              throw new Error("We currently do not support exact integer digits");
          }
          return "";
        });
        continue;
    }
    if (CONCISE_INTEGER_WIDTH_REGEX.test(f.stem)) {
      e.minimumIntegerDigits = f.stem.length;
      continue;
    }
    if (FRACTION_PRECISION_REGEX.test(f.stem)) {
      if (f.options.length > 1)
        throw new RangeError("Fraction-precision stems only accept a single optional option");
      f.stem.replace(FRACTION_PRECISION_REGEX, function(_, E, c, C, b, A) {
        return c === "*" ? e.minimumFractionDigits = E.length : C && C[0] === "#" ? e.maximumFractionDigits = C.length : b && A ? (e.minimumFractionDigits = b.length, e.maximumFractionDigits = b.length + A.length) : (e.minimumFractionDigits = E.length, e.maximumFractionDigits = E.length), "";
      });
      var u = f.options[0];
      u === "w" ? e = __assign(__assign({}, e), { trailingZeroDisplay: "stripIfInteger" }) : u && (e = __assign(__assign({}, e), parseSignificantPrecision(u)));
      continue;
    }
    if (SIGNIFICANT_PRECISION_REGEX.test(f.stem)) {
      e = __assign(__assign({}, e), parseSignificantPrecision(f.stem));
      continue;
    }
    var y = parseSign(f.stem);
    y && (e = __assign(__assign({}, e), y));
    var h = parseConciseScientificAndEngineeringStem(f.stem);
    h && (e = __assign(__assign({}, e), h));
  }
  return e;
}
var timeData = {
  AX: [
    "H"
  ],
  BQ: [
    "H"
  ],
  CP: [
    "H"
  ],
  CZ: [
    "H"
  ],
  DK: [
    "H"
  ],
  FI: [
    "H"
  ],
  ID: [
    "H"
  ],
  IS: [
    "H"
  ],
  ML: [
    "H"
  ],
  NE: [
    "H"
  ],
  RU: [
    "H"
  ],
  SE: [
    "H"
  ],
  SJ: [
    "H"
  ],
  SK: [
    "H"
  ],
  AS: [
    "h",
    "H"
  ],
  BT: [
    "h",
    "H"
  ],
  DJ: [
    "h",
    "H"
  ],
  ER: [
    "h",
    "H"
  ],
  GH: [
    "h",
    "H"
  ],
  IN: [
    "h",
    "H"
  ],
  LS: [
    "h",
    "H"
  ],
  PG: [
    "h",
    "H"
  ],
  PW: [
    "h",
    "H"
  ],
  SO: [
    "h",
    "H"
  ],
  TO: [
    "h",
    "H"
  ],
  VU: [
    "h",
    "H"
  ],
  WS: [
    "h",
    "H"
  ],
  "001": [
    "H",
    "h"
  ],
  AL: [
    "h",
    "H",
    "hB"
  ],
  TD: [
    "h",
    "H",
    "hB"
  ],
  "ca-ES": [
    "H",
    "h",
    "hB"
  ],
  CF: [
    "H",
    "h",
    "hB"
  ],
  CM: [
    "H",
    "h",
    "hB"
  ],
  "fr-CA": [
    "H",
    "h",
    "hB"
  ],
  "gl-ES": [
    "H",
    "h",
    "hB"
  ],
  "it-CH": [
    "H",
    "h",
    "hB"
  ],
  "it-IT": [
    "H",
    "h",
    "hB"
  ],
  LU: [
    "H",
    "h",
    "hB"
  ],
  NP: [
    "H",
    "h",
    "hB"
  ],
  PF: [
    "H",
    "h",
    "hB"
  ],
  SC: [
    "H",
    "h",
    "hB"
  ],
  SM: [
    "H",
    "h",
    "hB"
  ],
  SN: [
    "H",
    "h",
    "hB"
  ],
  TF: [
    "H",
    "h",
    "hB"
  ],
  VA: [
    "H",
    "h",
    "hB"
  ],
  CY: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  GR: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  CO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  DO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KP: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  NA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  VE: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  AC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  AI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BW: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BZ: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  DG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  FK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GB: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IM: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IO: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  JE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  LT: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MS: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NF: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NR: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NU: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  PN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SH: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  TA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  ZA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  "af-ZA": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  AR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CL: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CU: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  EA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BO": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BR": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-EC": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-ES": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-GQ": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-PE": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  GT: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  HN: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  IC: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KG: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KM: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  LK: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MX: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  NI: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  PY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  SV: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  UY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  JP: [
    "H",
    "h",
    "K"
  ],
  AD: [
    "H",
    "hB"
  ],
  AM: [
    "H",
    "hB"
  ],
  AO: [
    "H",
    "hB"
  ],
  AT: [
    "H",
    "hB"
  ],
  AW: [
    "H",
    "hB"
  ],
  BE: [
    "H",
    "hB"
  ],
  BF: [
    "H",
    "hB"
  ],
  BJ: [
    "H",
    "hB"
  ],
  BL: [
    "H",
    "hB"
  ],
  BR: [
    "H",
    "hB"
  ],
  CG: [
    "H",
    "hB"
  ],
  CI: [
    "H",
    "hB"
  ],
  CV: [
    "H",
    "hB"
  ],
  DE: [
    "H",
    "hB"
  ],
  EE: [
    "H",
    "hB"
  ],
  FR: [
    "H",
    "hB"
  ],
  GA: [
    "H",
    "hB"
  ],
  GF: [
    "H",
    "hB"
  ],
  GN: [
    "H",
    "hB"
  ],
  GP: [
    "H",
    "hB"
  ],
  GW: [
    "H",
    "hB"
  ],
  HR: [
    "H",
    "hB"
  ],
  IL: [
    "H",
    "hB"
  ],
  IT: [
    "H",
    "hB"
  ],
  KZ: [
    "H",
    "hB"
  ],
  MC: [
    "H",
    "hB"
  ],
  MD: [
    "H",
    "hB"
  ],
  MF: [
    "H",
    "hB"
  ],
  MQ: [
    "H",
    "hB"
  ],
  MZ: [
    "H",
    "hB"
  ],
  NC: [
    "H",
    "hB"
  ],
  NL: [
    "H",
    "hB"
  ],
  PM: [
    "H",
    "hB"
  ],
  PT: [
    "H",
    "hB"
  ],
  RE: [
    "H",
    "hB"
  ],
  RO: [
    "H",
    "hB"
  ],
  SI: [
    "H",
    "hB"
  ],
  SR: [
    "H",
    "hB"
  ],
  ST: [
    "H",
    "hB"
  ],
  TG: [
    "H",
    "hB"
  ],
  TR: [
    "H",
    "hB"
  ],
  WF: [
    "H",
    "hB"
  ],
  YT: [
    "H",
    "hB"
  ],
  BD: [
    "h",
    "hB",
    "H"
  ],
  PK: [
    "h",
    "hB",
    "H"
  ],
  AZ: [
    "H",
    "hB",
    "h"
  ],
  BA: [
    "H",
    "hB",
    "h"
  ],
  BG: [
    "H",
    "hB",
    "h"
  ],
  CH: [
    "H",
    "hB",
    "h"
  ],
  GE: [
    "H",
    "hB",
    "h"
  ],
  LI: [
    "H",
    "hB",
    "h"
  ],
  ME: [
    "H",
    "hB",
    "h"
  ],
  RS: [
    "H",
    "hB",
    "h"
  ],
  UA: [
    "H",
    "hB",
    "h"
  ],
  UZ: [
    "H",
    "hB",
    "h"
  ],
  XK: [
    "H",
    "hB",
    "h"
  ],
  AG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  AU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  CA: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  DM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  "en-001": [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FJ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GD: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  JM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KN: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LR: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MH: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MP: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MW: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  NZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SL: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TT: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  UM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  US: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  ZM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BO: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  EC: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  ES: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  GQ: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  PE: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  AE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  "ar-001": [
    "h",
    "hB",
    "hb",
    "H"
  ],
  BH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  DZ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EG: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  HK: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  IQ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  JO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  KW: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LB: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MR: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  OM: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PS: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  QA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SD: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  TN: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  YE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  AF: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  LA: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  CN: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  LV: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  TL: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  "zu-ZA": [
    "H",
    "hB",
    "hb",
    "h"
  ],
  CD: [
    "hB",
    "H"
  ],
  IR: [
    "hB",
    "H"
  ],
  "hi-IN": [
    "hB",
    "h",
    "H"
  ],
  "kn-IN": [
    "hB",
    "h",
    "H"
  ],
  "ml-IN": [
    "hB",
    "h",
    "H"
  ],
  "te-IN": [
    "hB",
    "h",
    "H"
  ],
  KH: [
    "hB",
    "h",
    "H",
    "hb"
  ],
  "ta-IN": [
    "hB",
    "h",
    "hb",
    "H"
  ],
  BN: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  MY: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  ET: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "gu-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "mr-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "pa-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  TW: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  KE: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  MM: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  TZ: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  UG: [
    "hB",
    "hb",
    "H",
    "h"
  ]
};
function getBestPattern(r, e) {
  for (var t = "", n = 0; n < r.length; n++) {
    var f = r.charAt(n);
    if (f === "j") {
      for (var u = 0; n + 1 < r.length && r.charAt(n + 1) === f; )
        u++, n++;
      var y = 1 + (u & 1), h = u < 2 ? 1 : 3 + (u >> 1), _ = "a", E = getDefaultHourSymbolFromLocale(e);
      for ((E == "H" || E == "k") && (h = 0); h-- > 0; )
        t += _;
      for (; y-- > 0; )
        t = E + t;
    } else
      f === "J" ? t += "H" : t += f;
  }
  return t;
}
function getDefaultHourSymbolFromLocale(r) {
  var e = r.hourCycle;
  if (e === void 0 && // @ts-ignore hourCycle(s) is not identified yet
  r.hourCycles && // @ts-ignore
  r.hourCycles.length && (e = r.hourCycles[0]), e)
    switch (e) {
      case "h24":
        return "k";
      case "h23":
        return "H";
      case "h12":
        return "h";
      case "h11":
        return "K";
      default:
        throw new Error("Invalid hourCycle");
    }
  var t = r.language, n;
  t !== "root" && (n = r.maximize().region);
  var f = timeData[n || ""] || timeData[t || ""] || timeData["".concat(t, "-001")] || timeData["001"];
  return f[0];
}
var _a, SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*")), SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
function createLocation(r, e) {
  return { start: r, end: e };
}
var hasNativeStartsWith = !!String.prototype.startsWith, hasNativeFromCodePoint = !!String.fromCodePoint, hasNativeFromEntries = !!Object.fromEntries, hasNativeCodePointAt = !!String.prototype.codePointAt, hasTrimStart = !!String.prototype.trimStart, hasTrimEnd = !!String.prototype.trimEnd, hasNativeIsSafeInteger = !!Number.isSafeInteger, isSafeInteger = hasNativeIsSafeInteger ? Number.isSafeInteger : function(r) {
  return typeof r == "number" && isFinite(r) && Math.floor(r) === r && Math.abs(r) <= 9007199254740991;
}, REGEX_SUPPORTS_U_AND_Y = !0;
try {
  var re = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec("a")) === null || _a === void 0 ? void 0 : _a[0]) === "a";
} catch (r) {
  REGEX_SUPPORTS_U_AND_Y = !1;
}
var startsWith = hasNativeStartsWith ? (
  // Native
  function r(e, t, n) {
    return e.startsWith(t, n);
  }
) : (
  // For IE11
  function r(e, t, n) {
    return e.slice(n, n + t.length) === t;
  }
), fromCodePoint = hasNativeFromCodePoint ? String.fromCodePoint : (
  // IE11
  function r() {
    for (var e = [], t = 0; t < arguments.length; t++)
      e[t] = arguments[t];
    for (var n = "", f = e.length, u = 0, y; f > u; ) {
      if (y = e[u++], y > 1114111)
        throw RangeError(y + " is not a valid code point");
      n += y < 65536 ? String.fromCharCode(y) : String.fromCharCode(((y -= 65536) >> 10) + 55296, y % 1024 + 56320);
    }
    return n;
  }
), fromEntries = (
  // native
  hasNativeFromEntries ? Object.fromEntries : (
    // Ponyfill
    function r(e) {
      for (var t = {}, n = 0, f = e; n < f.length; n++) {
        var u = f[n], y = u[0], h = u[1];
        t[y] = h;
      }
      return t;
    }
  )
), codePointAt = hasNativeCodePointAt ? (
  // Native
  function r(e, t) {
    return e.codePointAt(t);
  }
) : (
  // IE 11
  function r(e, t) {
    var n = e.length;
    if (!(t < 0 || t >= n)) {
      var f = e.charCodeAt(t), u;
      return f < 55296 || f > 56319 || t + 1 === n || (u = e.charCodeAt(t + 1)) < 56320 || u > 57343 ? f : (f - 55296 << 10) + (u - 56320) + 65536;
    }
  }
), trimStart = hasTrimStart ? (
  // Native
  function r(e) {
    return e.trimStart();
  }
) : (
  // Ponyfill
  function r(e) {
    return e.replace(SPACE_SEPARATOR_START_REGEX, "");
  }
), trimEnd = hasTrimEnd ? (
  // Native
  function r(e) {
    return e.trimEnd();
  }
) : (
  // Ponyfill
  function r(e) {
    return e.replace(SPACE_SEPARATOR_END_REGEX, "");
  }
);
function RE(r, e) {
  return new RegExp(r, e);
}
var matchIdentifierAtIndex;
if (REGEX_SUPPORTS_U_AND_Y) {
  var IDENTIFIER_PREFIX_RE_1 = RE("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  matchIdentifierAtIndex = function(e, t) {
    var n;
    IDENTIFIER_PREFIX_RE_1.lastIndex = t;
    var f = IDENTIFIER_PREFIX_RE_1.exec(e);
    return (n = f[1]) !== null && n !== void 0 ? n : "";
  };
} else
  matchIdentifierAtIndex = function(e, t) {
    for (var n = []; ; ) {
      var f = codePointAt(e, t);
      if (f === void 0 || _isWhiteSpace(f) || _isPatternSyntax(f))
        break;
      n.push(f), t += f >= 65536 ? 2 : 1;
    }
    return fromCodePoint.apply(void 0, n);
  };
var Parser = (
  /** @class */
  function() {
    function r(e, t) {
      t === void 0 && (t = {}), this.message = e, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!t.ignoreTag, this.locale = t.locale, this.requiresOtherClause = !!t.requiresOtherClause, this.shouldParseSkeletons = !!t.shouldParseSkeletons;
    }
    return r.prototype.parse = function() {
      if (this.offset() !== 0)
        throw Error("parser can only be used once");
      return this.parseMessage(0, "", !1);
    }, r.prototype.parseMessage = function(e, t, n) {
      for (var f = []; !this.isEOF(); ) {
        var u = this.char();
        if (u === 123) {
          var y = this.parseArgument(e, n);
          if (y.err)
            return y;
          f.push(y.val);
        } else {
          if (u === 125 && e > 0)
            break;
          if (u === 35 && (t === "plural" || t === "selectordinal")) {
            var h = this.clonePosition();
            this.bump(), f.push({
              type: TYPE.pound,
              location: createLocation(h, this.clonePosition())
            });
          } else if (u === 60 && !this.ignoreTag && this.peek() === 47) {
            if (n)
              break;
            return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
          } else if (u === 60 && !this.ignoreTag && _isAlpha(this.peek() || 0)) {
            var y = this.parseTag(e, t);
            if (y.err)
              return y;
            f.push(y.val);
          } else {
            var y = this.parseLiteral(e, t);
            if (y.err)
              return y;
            f.push(y.val);
          }
        }
      }
      return { val: f, err: null };
    }, r.prototype.parseTag = function(e, t) {
      var n = this.clonePosition();
      this.bump();
      var f = this.parseTagName();
      if (this.bumpSpace(), this.bumpIf("/>"))
        return {
          val: {
            type: TYPE.literal,
            value: "<".concat(f, "/>"),
            location: createLocation(n, this.clonePosition())
          },
          err: null
        };
      if (this.bumpIf(">")) {
        var u = this.parseMessage(e + 1, t, !0);
        if (u.err)
          return u;
        var y = u.val, h = this.clonePosition();
        if (this.bumpIf("</")) {
          if (this.isEOF() || !_isAlpha(this.char()))
            return this.error(ErrorKind.INVALID_TAG, createLocation(h, this.clonePosition()));
          var _ = this.clonePosition(), E = this.parseTagName();
          return f !== E ? this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(_, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
            val: {
              type: TYPE.tag,
              value: f,
              children: y,
              location: createLocation(n, this.clonePosition())
            },
            err: null
          } : this.error(ErrorKind.INVALID_TAG, createLocation(h, this.clonePosition())));
        } else
          return this.error(ErrorKind.UNCLOSED_TAG, createLocation(n, this.clonePosition()));
      } else
        return this.error(ErrorKind.INVALID_TAG, createLocation(n, this.clonePosition()));
    }, r.prototype.parseTagName = function() {
      var e = this.offset();
      for (this.bump(); !this.isEOF() && _isPotentialElementNameChar(this.char()); )
        this.bump();
      return this.message.slice(e, this.offset());
    }, r.prototype.parseLiteral = function(e, t) {
      for (var n = this.clonePosition(), f = ""; ; ) {
        var u = this.tryParseQuote(t);
        if (u) {
          f += u;
          continue;
        }
        var y = this.tryParseUnquoted(e, t);
        if (y) {
          f += y;
          continue;
        }
        var h = this.tryParseLeftAngleBracket();
        if (h) {
          f += h;
          continue;
        }
        break;
      }
      var _ = createLocation(n, this.clonePosition());
      return {
        val: { type: TYPE.literal, value: f, location: _ },
        err: null
      };
    }, r.prototype.tryParseLeftAngleBracket = function() {
      return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
      !_isAlphaOrSlash(this.peek() || 0)) ? (this.bump(), "<") : null;
    }, r.prototype.tryParseQuote = function(e) {
      if (this.isEOF() || this.char() !== 39)
        return null;
      switch (this.peek()) {
        case 39:
          return this.bump(), this.bump(), "'";
        case 123:
        case 60:
        case 62:
        case 125:
          break;
        case 35:
          if (e === "plural" || e === "selectordinal")
            break;
          return null;
        default:
          return null;
      }
      this.bump();
      var t = [this.char()];
      for (this.bump(); !this.isEOF(); ) {
        var n = this.char();
        if (n === 39)
          if (this.peek() === 39)
            t.push(39), this.bump();
          else {
            this.bump();
            break;
          }
        else
          t.push(n);
        this.bump();
      }
      return fromCodePoint.apply(void 0, t);
    }, r.prototype.tryParseUnquoted = function(e, t) {
      if (this.isEOF())
        return null;
      var n = this.char();
      return n === 60 || n === 123 || n === 35 && (t === "plural" || t === "selectordinal") || n === 125 && e > 0 ? null : (this.bump(), fromCodePoint(n));
    }, r.prototype.parseArgument = function(e, t) {
      var n = this.clonePosition();
      if (this.bump(), this.bumpSpace(), this.isEOF())
        return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition()));
      if (this.char() === 125)
        return this.bump(), this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(n, this.clonePosition()));
      var f = this.parseIdentifierIfPossible().value;
      if (!f)
        return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(n, this.clonePosition()));
      if (this.bumpSpace(), this.isEOF())
        return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition()));
      switch (this.char()) {
        case 125:
          return this.bump(), {
            val: {
              type: TYPE.argument,
              // value does not include the opening and closing braces.
              value: f,
              location: createLocation(n, this.clonePosition())
            },
            err: null
          };
        case 44:
          return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(n, this.clonePosition())) : this.parseArgumentOptions(e, t, f, n);
        default:
          return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(n, this.clonePosition()));
      }
    }, r.prototype.parseIdentifierIfPossible = function() {
      var e = this.clonePosition(), t = this.offset(), n = matchIdentifierAtIndex(this.message, t), f = t + n.length;
      this.bumpTo(f);
      var u = this.clonePosition(), y = createLocation(e, u);
      return { value: n, location: y };
    }, r.prototype.parseArgumentOptions = function(e, t, n, f) {
      var u, y = this.clonePosition(), h = this.parseIdentifierIfPossible().value, _ = this.clonePosition();
      switch (h) {
        case "":
          return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(y, _));
        case "number":
        case "date":
        case "time": {
          this.bumpSpace();
          var E = null;
          if (this.bumpIf(",")) {
            this.bumpSpace();
            var c = this.clonePosition(), C = this.parseSimpleArgStyleIfPossible();
            if (C.err)
              return C;
            var b = trimEnd(C.val);
            if (b.length === 0)
              return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
            var A = createLocation(c, this.clonePosition());
            E = { style: b, styleLocation: A };
          }
          var S = this.tryParseArgumentClose(f);
          if (S.err)
            return S;
          var s = createLocation(f, this.clonePosition());
          if (E && startsWith(E == null ? void 0 : E.style, "::", 0)) {
            var o = trimStart(E.style.slice(2));
            if (h === "number") {
              var C = this.parseNumberSkeletonFromString(o, E.styleLocation);
              return C.err ? C : {
                val: { type: TYPE.number, value: n, location: s, style: C.val },
                err: null
              };
            } else {
              if (o.length === 0)
                return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, s);
              var w = o;
              this.locale && (w = getBestPattern(o, this.locale));
              var b = {
                type: SKELETON_TYPE.dateTime,
                pattern: w,
                location: E.styleLocation,
                parsedOptions: this.shouldParseSkeletons ? parseDateTimeSkeleton(w) : {}
              }, p = h === "date" ? TYPE.date : TYPE.time;
              return {
                val: { type: p, value: n, location: s, style: b },
                err: null
              };
            }
          }
          return {
            val: {
              type: h === "number" ? TYPE.number : h === "date" ? TYPE.date : TYPE.time,
              value: n,
              location: s,
              style: (u = E == null ? void 0 : E.style) !== null && u !== void 0 ? u : null
            },
            err: null
          };
        }
        case "plural":
        case "selectordinal":
        case "select": {
          var v = this.clonePosition();
          if (this.bumpSpace(), !this.bumpIf(","))
            return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(v, __assign({}, v)));
          this.bumpSpace();
          var a = this.parseIdentifierIfPossible(), l = 0;
          if (h !== "select" && a.value === "offset") {
            if (!this.bumpIf(":"))
              return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));
            this.bumpSpace();
            var C = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
            if (C.err)
              return C;
            this.bumpSpace(), a = this.parseIdentifierIfPossible(), l = C.val;
          }
          var g = this.tryParsePluralOrSelectOptions(e, h, t, a);
          if (g.err)
            return g;
          var S = this.tryParseArgumentClose(f);
          if (S.err)
            return S;
          var M = createLocation(f, this.clonePosition());
          return h === "select" ? {
            val: {
              type: TYPE.select,
              value: n,
              options: fromEntries(g.val),
              location: M
            },
            err: null
          } : {
            val: {
              type: TYPE.plural,
              value: n,
              options: fromEntries(g.val),
              offset: l,
              pluralType: h === "plural" ? "cardinal" : "ordinal",
              location: M
            },
            err: null
          };
        }
        default:
          return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(y, _));
      }
    }, r.prototype.tryParseArgumentClose = function(e) {
      return this.isEOF() || this.char() !== 125 ? this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(e, this.clonePosition())) : (this.bump(), { val: !0, err: null });
    }, r.prototype.parseSimpleArgStyleIfPossible = function() {
      for (var e = 0, t = this.clonePosition(); !this.isEOF(); ) {
        var n = this.char();
        switch (n) {
          case 39: {
            this.bump();
            var f = this.clonePosition();
            if (!this.bumpUntil("'"))
              return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(f, this.clonePosition()));
            this.bump();
            break;
          }
          case 123: {
            e += 1, this.bump();
            break;
          }
          case 125: {
            if (e > 0)
              e -= 1;
            else
              return {
                val: this.message.slice(t.offset, this.offset()),
                err: null
              };
            break;
          }
          default:
            this.bump();
            break;
        }
      }
      return {
        val: this.message.slice(t.offset, this.offset()),
        err: null
      };
    }, r.prototype.parseNumberSkeletonFromString = function(e, t) {
      var n = [];
      try {
        n = parseNumberSkeletonFromString(e);
      } catch {
        return this.error(ErrorKind.INVALID_NUMBER_SKELETON, t);
      }
      return {
        val: {
          type: SKELETON_TYPE.number,
          tokens: n,
          location: t,
          parsedOptions: this.shouldParseSkeletons ? parseNumberSkeleton(n) : {}
        },
        err: null
      };
    }, r.prototype.tryParsePluralOrSelectOptions = function(e, t, n, f) {
      for (var u, y = !1, h = [], _ = /* @__PURE__ */ new Set(), E = f.value, c = f.location; ; ) {
        if (E.length === 0) {
          var C = this.clonePosition();
          if (t !== "select" && this.bumpIf("=")) {
            var b = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);
            if (b.err)
              return b;
            c = createLocation(C, this.clonePosition()), E = this.message.slice(C.offset, this.offset());
          } else
            break;
        }
        if (_.has(E))
          return this.error(t === "select" ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, c);
        E === "other" && (y = !0), this.bumpSpace();
        var A = this.clonePosition();
        if (!this.bumpIf("{"))
          return this.error(t === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));
        var S = this.parseMessage(e + 1, t, n);
        if (S.err)
          return S;
        var s = this.tryParseArgumentClose(A);
        if (s.err)
          return s;
        h.push([
          E,
          {
            value: S.val,
            location: createLocation(A, this.clonePosition())
          }
        ]), _.add(E), this.bumpSpace(), u = this.parseIdentifierIfPossible(), E = u.value, c = u.location;
      }
      return h.length === 0 ? this.error(t === "select" ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !y ? this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition())) : { val: h, err: null };
    }, r.prototype.tryParseDecimalInteger = function(e, t) {
      var n = 1, f = this.clonePosition();
      this.bumpIf("+") || this.bumpIf("-") && (n = -1);
      for (var u = !1, y = 0; !this.isEOF(); ) {
        var h = this.char();
        if (h >= 48 && h <= 57)
          u = !0, y = y * 10 + (h - 48), this.bump();
        else
          break;
      }
      var _ = createLocation(f, this.clonePosition());
      return u ? (y *= n, isSafeInteger(y) ? { val: y, err: null } : this.error(t, _)) : this.error(e, _);
    }, r.prototype.offset = function() {
      return this.position.offset;
    }, r.prototype.isEOF = function() {
      return this.offset() === this.message.length;
    }, r.prototype.clonePosition = function() {
      return {
        offset: this.position.offset,
        line: this.position.line,
        column: this.position.column
      };
    }, r.prototype.char = function() {
      var e = this.position.offset;
      if (e >= this.message.length)
        throw Error("out of bound");
      var t = codePointAt(this.message, e);
      if (t === void 0)
        throw Error("Offset ".concat(e, " is at invalid UTF-16 code unit boundary"));
      return t;
    }, r.prototype.error = function(e, t) {
      return {
        val: null,
        err: {
          kind: e,
          message: this.message,
          location: t
        }
      };
    }, r.prototype.bump = function() {
      if (!this.isEOF()) {
        var e = this.char();
        e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
      }
    }, r.prototype.bumpIf = function(e) {
      if (startsWith(this.message, e, this.offset())) {
        for (var t = 0; t < e.length; t++)
          this.bump();
        return !0;
      }
      return !1;
    }, r.prototype.bumpUntil = function(e) {
      var t = this.offset(), n = this.message.indexOf(e, t);
      return n >= 0 ? (this.bumpTo(n), !0) : (this.bumpTo(this.message.length), !1);
    }, r.prototype.bumpTo = function(e) {
      if (this.offset() > e)
        throw Error("targetOffset ".concat(e, " must be greater than or equal to the current offset ").concat(this.offset()));
      for (e = Math.min(e, this.message.length); ; ) {
        var t = this.offset();
        if (t === e)
          break;
        if (t > e)
          throw Error("targetOffset ".concat(e, " is at invalid UTF-16 code unit boundary"));
        if (this.bump(), this.isEOF())
          break;
      }
    }, r.prototype.bumpSpace = function() {
      for (; !this.isEOF() && _isWhiteSpace(this.char()); )
        this.bump();
    }, r.prototype.peek = function() {
      if (this.isEOF())
        return null;
      var e = this.char(), t = this.offset(), n = this.message.charCodeAt(t + (e >= 65536 ? 2 : 1));
      return n ?? null;
    }, r;
  }()
);
function _isAlpha(r) {
  return r >= 97 && r <= 122 || r >= 65 && r <= 90;
}
function _isAlphaOrSlash(r) {
  return _isAlpha(r) || r === 47;
}
function _isPotentialElementNameChar(r) {
  return r === 45 || r === 46 || r >= 48 && r <= 57 || r === 95 || r >= 97 && r <= 122 || r >= 65 && r <= 90 || r == 183 || r >= 192 && r <= 214 || r >= 216 && r <= 246 || r >= 248 && r <= 893 || r >= 895 && r <= 8191 || r >= 8204 && r <= 8205 || r >= 8255 && r <= 8256 || r >= 8304 && r <= 8591 || r >= 11264 && r <= 12271 || r >= 12289 && r <= 55295 || r >= 63744 && r <= 64975 || r >= 65008 && r <= 65533 || r >= 65536 && r <= 983039;
}
function _isWhiteSpace(r) {
  return r >= 9 && r <= 13 || r === 32 || r === 133 || r >= 8206 && r <= 8207 || r === 8232 || r === 8233;
}
function _isPatternSyntax(r) {
  return r >= 33 && r <= 35 || r === 36 || r >= 37 && r <= 39 || r === 40 || r === 41 || r === 42 || r === 43 || r === 44 || r === 45 || r >= 46 && r <= 47 || r >= 58 && r <= 59 || r >= 60 && r <= 62 || r >= 63 && r <= 64 || r === 91 || r === 92 || r === 93 || r === 94 || r === 96 || r === 123 || r === 124 || r === 125 || r === 126 || r === 161 || r >= 162 && r <= 165 || r === 166 || r === 167 || r === 169 || r === 171 || r === 172 || r === 174 || r === 176 || r === 177 || r === 182 || r === 187 || r === 191 || r === 215 || r === 247 || r >= 8208 && r <= 8213 || r >= 8214 && r <= 8215 || r === 8216 || r === 8217 || r === 8218 || r >= 8219 && r <= 8220 || r === 8221 || r === 8222 || r === 8223 || r >= 8224 && r <= 8231 || r >= 8240 && r <= 8248 || r === 8249 || r === 8250 || r >= 8251 && r <= 8254 || r >= 8257 && r <= 8259 || r === 8260 || r === 8261 || r === 8262 || r >= 8263 && r <= 8273 || r === 8274 || r === 8275 || r >= 8277 && r <= 8286 || r >= 8592 && r <= 8596 || r >= 8597 && r <= 8601 || r >= 8602 && r <= 8603 || r >= 8604 && r <= 8607 || r === 8608 || r >= 8609 && r <= 8610 || r === 8611 || r >= 8612 && r <= 8613 || r === 8614 || r >= 8615 && r <= 8621 || r === 8622 || r >= 8623 && r <= 8653 || r >= 8654 && r <= 8655 || r >= 8656 && r <= 8657 || r === 8658 || r === 8659 || r === 8660 || r >= 8661 && r <= 8691 || r >= 8692 && r <= 8959 || r >= 8960 && r <= 8967 || r === 8968 || r === 8969 || r === 8970 || r === 8971 || r >= 8972 && r <= 8991 || r >= 8992 && r <= 8993 || r >= 8994 && r <= 9e3 || r === 9001 || r === 9002 || r >= 9003 && r <= 9083 || r === 9084 || r >= 9085 && r <= 9114 || r >= 9115 && r <= 9139 || r >= 9140 && r <= 9179 || r >= 9180 && r <= 9185 || r >= 9186 && r <= 9254 || r >= 9255 && r <= 9279 || r >= 9280 && r <= 9290 || r >= 9291 && r <= 9311 || r >= 9472 && r <= 9654 || r === 9655 || r >= 9656 && r <= 9664 || r === 9665 || r >= 9666 && r <= 9719 || r >= 9720 && r <= 9727 || r >= 9728 && r <= 9838 || r === 9839 || r >= 9840 && r <= 10087 || r === 10088 || r === 10089 || r === 10090 || r === 10091 || r === 10092 || r === 10093 || r === 10094 || r === 10095 || r === 10096 || r === 10097 || r === 10098 || r === 10099 || r === 10100 || r === 10101 || r >= 10132 && r <= 10175 || r >= 10176 && r <= 10180 || r === 10181 || r === 10182 || r >= 10183 && r <= 10213 || r === 10214 || r === 10215 || r === 10216 || r === 10217 || r === 10218 || r === 10219 || r === 10220 || r === 10221 || r === 10222 || r === 10223 || r >= 10224 && r <= 10239 || r >= 10240 && r <= 10495 || r >= 10496 && r <= 10626 || r === 10627 || r === 10628 || r === 10629 || r === 10630 || r === 10631 || r === 10632 || r === 10633 || r === 10634 || r === 10635 || r === 10636 || r === 10637 || r === 10638 || r === 10639 || r === 10640 || r === 10641 || r === 10642 || r === 10643 || r === 10644 || r === 10645 || r === 10646 || r === 10647 || r === 10648 || r >= 10649 && r <= 10711 || r === 10712 || r === 10713 || r === 10714 || r === 10715 || r >= 10716 && r <= 10747 || r === 10748 || r === 10749 || r >= 10750 && r <= 11007 || r >= 11008 && r <= 11055 || r >= 11056 && r <= 11076 || r >= 11077 && r <= 11078 || r >= 11079 && r <= 11084 || r >= 11085 && r <= 11123 || r >= 11124 && r <= 11125 || r >= 11126 && r <= 11157 || r === 11158 || r >= 11159 && r <= 11263 || r >= 11776 && r <= 11777 || r === 11778 || r === 11779 || r === 11780 || r === 11781 || r >= 11782 && r <= 11784 || r === 11785 || r === 11786 || r === 11787 || r === 11788 || r === 11789 || r >= 11790 && r <= 11798 || r === 11799 || r >= 11800 && r <= 11801 || r === 11802 || r === 11803 || r === 11804 || r === 11805 || r >= 11806 && r <= 11807 || r === 11808 || r === 11809 || r === 11810 || r === 11811 || r === 11812 || r === 11813 || r === 11814 || r === 11815 || r === 11816 || r === 11817 || r >= 11818 && r <= 11822 || r === 11823 || r >= 11824 && r <= 11833 || r >= 11834 && r <= 11835 || r >= 11836 && r <= 11839 || r === 11840 || r === 11841 || r === 11842 || r >= 11843 && r <= 11855 || r >= 11856 && r <= 11857 || r === 11858 || r >= 11859 && r <= 11903 || r >= 12289 && r <= 12291 || r === 12296 || r === 12297 || r === 12298 || r === 12299 || r === 12300 || r === 12301 || r === 12302 || r === 12303 || r === 12304 || r === 12305 || r >= 12306 && r <= 12307 || r === 12308 || r === 12309 || r === 12310 || r === 12311 || r === 12312 || r === 12313 || r === 12314 || r === 12315 || r === 12316 || r === 12317 || r >= 12318 && r <= 12319 || r === 12320 || r === 12336 || r === 64830 || r === 64831 || r >= 65093 && r <= 65094;
}
function pruneLocation(r) {
  r.forEach(function(e) {
    if (delete e.location, isSelectElement(e) || isPluralElement(e))
      for (var t in e.options)
        delete e.options[t].location, pruneLocation(e.options[t].value);
    else
      isNumberElement(e) && isNumberSkeleton(e.style) || (isDateElement(e) || isTimeElement(e)) && isDateTimeSkeleton(e.style) ? delete e.style.location : isTagElement(e) && pruneLocation(e.children);
  });
}
function parse(r, e) {
  e === void 0 && (e = {}), e = __assign({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, e);
  var t = new Parser(r, e).parse();
  if (t.err) {
    var n = SyntaxError(ErrorKind[t.err.kind]);
    throw n.location = t.err.location, n.originalMessage = t.err.message, n;
  }
  return e != null && e.captureLocation || pruneLocation(t.val), t.val;
}
function memoize(r, e) {
  var t = e && e.cache ? e.cache : cacheDefault, n = e && e.serializer ? e.serializer : serializerDefault, f = e && e.strategy ? e.strategy : strategyDefault;
  return f(r, {
    cache: t,
    serializer: n
  });
}
function isPrimitive(r) {
  return r == null || typeof r == "number" || typeof r == "boolean";
}
function monadic(r, e, t, n) {
  var f = isPrimitive(n) ? n : t(n), u = e.get(f);
  return typeof u > "u" && (u = r.call(this, n), e.set(f, u)), u;
}
function variadic(r, e, t) {
  var n = Array.prototype.slice.call(arguments, 3), f = t(n), u = e.get(f);
  return typeof u > "u" && (u = r.apply(this, n), e.set(f, u)), u;
}
function assemble(r, e, t, n, f) {
  return t.bind(e, r, n, f);
}
function strategyDefault(r, e) {
  var t = r.length === 1 ? monadic : variadic;
  return assemble(r, this, t, e.cache.create(), e.serializer);
}
function strategyVariadic(r, e) {
  return assemble(r, this, variadic, e.cache.create(), e.serializer);
}
function strategyMonadic(r, e) {
  return assemble(r, this, monadic, e.cache.create(), e.serializer);
}
var serializerDefault = function() {
  return JSON.stringify(arguments);
};
function ObjectWithoutPrototypeCache() {
  this.cache = /* @__PURE__ */ Object.create(null);
}
ObjectWithoutPrototypeCache.prototype.get = function(r) {
  return this.cache[r];
};
ObjectWithoutPrototypeCache.prototype.set = function(r, e) {
  this.cache[r] = e;
};
var cacheDefault = {
  create: function r() {
    return new ObjectWithoutPrototypeCache();
  }
}, strategies = {
  variadic: strategyVariadic,
  monadic: strategyMonadic
}, ErrorCode;
(function(r) {
  r.MISSING_VALUE = "MISSING_VALUE", r.INVALID_VALUE = "INVALID_VALUE", r.MISSING_INTL_API = "MISSING_INTL_API";
})(ErrorCode || (ErrorCode = {}));
var FormatError = (
  /** @class */
  function(r) {
    __extends(e, r);
    function e(t, n, f) {
      var u = r.call(this, t) || this;
      return u.code = n, u.originalMessage = f, u;
    }
    return e.prototype.toString = function() {
      return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
    }, e;
  }(Error)
), InvalidValueError = (
  /** @class */
  function(r) {
    __extends(e, r);
    function e(t, n, f, u) {
      return r.call(this, 'Invalid values for "'.concat(t, '": "').concat(n, '". Options are "').concat(Object.keys(f).join('", "'), '"'), ErrorCode.INVALID_VALUE, u) || this;
    }
    return e;
  }(FormatError)
), InvalidValueTypeError = (
  /** @class */
  function(r) {
    __extends(e, r);
    function e(t, n, f) {
      return r.call(this, 'Value for "'.concat(t, '" must be of type ').concat(n), ErrorCode.INVALID_VALUE, f) || this;
    }
    return e;
  }(FormatError)
), MissingValueError = (
  /** @class */
  function(r) {
    __extends(e, r);
    function e(t, n) {
      return r.call(this, 'The intl string context variable "'.concat(t, '" was not provided to the string "').concat(n, '"'), ErrorCode.MISSING_VALUE, n) || this;
    }
    return e;
  }(FormatError)
), PART_TYPE;
(function(r) {
  r[r.literal = 0] = "literal", r[r.object = 1] = "object";
})(PART_TYPE || (PART_TYPE = {}));
function mergeLiteral(r) {
  return r.length < 2 ? r : r.reduce(function(e, t) {
    var n = e[e.length - 1];
    return !n || n.type !== PART_TYPE.literal || t.type !== PART_TYPE.literal ? e.push(t) : n.value += t.value, e;
  }, []);
}
function isFormatXMLElementFn(r) {
  return typeof r == "function";
}
function formatToParts(r, e, t, n, f, u, y) {
  if (r.length === 1 && isLiteralElement(r[0]))
    return [
      {
        type: PART_TYPE.literal,
        value: r[0].value
      }
    ];
  for (var h = [], _ = 0, E = r; _ < E.length; _++) {
    var c = E[_];
    if (isLiteralElement(c)) {
      h.push({
        type: PART_TYPE.literal,
        value: c.value
      });
      continue;
    }
    if (isPoundElement(c)) {
      typeof u == "number" && h.push({
        type: PART_TYPE.literal,
        value: t.getNumberFormat(e).format(u)
      });
      continue;
    }
    var C = c.value;
    if (!(f && C in f))
      throw new MissingValueError(C, y);
    var b = f[C];
    if (isArgumentElement(c)) {
      (!b || typeof b == "string" || typeof b == "number") && (b = typeof b == "string" || typeof b == "number" ? String(b) : ""), h.push({
        type: typeof b == "string" ? PART_TYPE.literal : PART_TYPE.object,
        value: b
      });
      continue;
    }
    if (isDateElement(c)) {
      var A = typeof c.style == "string" ? n.date[c.style] : isDateTimeSkeleton(c.style) ? c.style.parsedOptions : void 0;
      h.push({
        type: PART_TYPE.literal,
        value: t.getDateTimeFormat(e, A).format(b)
      });
      continue;
    }
    if (isTimeElement(c)) {
      var A = typeof c.style == "string" ? n.time[c.style] : isDateTimeSkeleton(c.style) ? c.style.parsedOptions : n.time.medium;
      h.push({
        type: PART_TYPE.literal,
        value: t.getDateTimeFormat(e, A).format(b)
      });
      continue;
    }
    if (isNumberElement(c)) {
      var A = typeof c.style == "string" ? n.number[c.style] : isNumberSkeleton(c.style) ? c.style.parsedOptions : void 0;
      A && A.scale && (b = b * (A.scale || 1)), h.push({
        type: PART_TYPE.literal,
        value: t.getNumberFormat(e, A).format(b)
      });
      continue;
    }
    if (isTagElement(c)) {
      var S = c.children, s = c.value, o = f[s];
      if (!isFormatXMLElementFn(o))
        throw new InvalidValueTypeError(s, "function", y);
      var w = formatToParts(S, e, t, n, f, u), p = o(w.map(function(l) {
        return l.value;
      }));
      Array.isArray(p) || (p = [p]), h.push.apply(h, p.map(function(l) {
        return {
          type: typeof l == "string" ? PART_TYPE.literal : PART_TYPE.object,
          value: l
        };
      }));
    }
    if (isSelectElement(c)) {
      var v = c.options[b] || c.options.other;
      if (!v)
        throw new InvalidValueError(c.value, b, Object.keys(c.options), y);
      h.push.apply(h, formatToParts(v.value, e, t, n, f));
      continue;
    }
    if (isPluralElement(c)) {
      var v = c.options["=".concat(b)];
      if (!v) {
        if (!Intl.PluralRules)
          throw new FormatError(`Intl.PluralRules is not available in this environment.
Try polyfilling it using "@formatjs/intl-pluralrules"
`, ErrorCode.MISSING_INTL_API, y);
        var a = t.getPluralRules(e, { type: c.pluralType }).select(b - (c.offset || 0));
        v = c.options[a] || c.options.other;
      }
      if (!v)
        throw new InvalidValueError(c.value, b, Object.keys(c.options), y);
      h.push.apply(h, formatToParts(v.value, e, t, n, f, b - (c.offset || 0)));
      continue;
    }
  }
  return mergeLiteral(h);
}
function mergeConfig(r, e) {
  return e ? __assign(__assign(__assign({}, r || {}), e || {}), Object.keys(r).reduce(function(t, n) {
    return t[n] = __assign(__assign({}, r[n]), e[n] || {}), t;
  }, {})) : r;
}
function mergeConfigs(r, e) {
  return e ? Object.keys(r).reduce(function(t, n) {
    return t[n] = mergeConfig(r[n], e[n]), t;
  }, __assign({}, r)) : r;
}
function createFastMemoizeCache(r) {
  return {
    create: function() {
      return {
        get: function(e) {
          return r[e];
        },
        set: function(e, t) {
          r[e] = t;
        }
      };
    }
  };
}
function createDefaultFormatters(r) {
  return r === void 0 && (r = {
    number: {},
    dateTime: {},
    pluralRules: {}
  }), {
    getNumberFormat: memoize(function() {
      for (var e, t = [], n = 0; n < arguments.length; n++)
        t[n] = arguments[n];
      return new ((e = Intl.NumberFormat).bind.apply(e, __spreadArray([void 0], t, !1)))();
    }, {
      cache: createFastMemoizeCache(r.number),
      strategy: strategies.variadic
    }),
    getDateTimeFormat: memoize(function() {
      for (var e, t = [], n = 0; n < arguments.length; n++)
        t[n] = arguments[n];
      return new ((e = Intl.DateTimeFormat).bind.apply(e, __spreadArray([void 0], t, !1)))();
    }, {
      cache: createFastMemoizeCache(r.dateTime),
      strategy: strategies.variadic
    }),
    getPluralRules: memoize(function() {
      for (var e, t = [], n = 0; n < arguments.length; n++)
        t[n] = arguments[n];
      return new ((e = Intl.PluralRules).bind.apply(e, __spreadArray([void 0], t, !1)))();
    }, {
      cache: createFastMemoizeCache(r.pluralRules),
      strategy: strategies.variadic
    })
  };
}
var IntlMessageFormat = (
  /** @class */
  function() {
    function r(e, t, n, f) {
      var u = this;
      if (t === void 0 && (t = r.defaultLocale), this.formatterCache = {
        number: {},
        dateTime: {},
        pluralRules: {}
      }, this.format = function(y) {
        var h = u.formatToParts(y);
        if (h.length === 1)
          return h[0].value;
        var _ = h.reduce(function(E, c) {
          return !E.length || c.type !== PART_TYPE.literal || typeof E[E.length - 1] != "string" ? E.push(c.value) : E[E.length - 1] += c.value, E;
        }, []);
        return _.length <= 1 ? _[0] || "" : _;
      }, this.formatToParts = function(y) {
        return formatToParts(u.ast, u.locales, u.formatters, u.formats, y, void 0, u.message);
      }, this.resolvedOptions = function() {
        return {
          locale: u.resolvedLocale.toString()
        };
      }, this.getAst = function() {
        return u.ast;
      }, this.locales = t, this.resolvedLocale = r.resolveLocale(t), typeof e == "string") {
        if (this.message = e, !r.__parse)
          throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
        this.ast = r.__parse(e, {
          ignoreTag: f == null ? void 0 : f.ignoreTag,
          locale: this.resolvedLocale
        });
      } else
        this.ast = e;
      if (!Array.isArray(this.ast))
        throw new TypeError("A message must be provided as a String or AST.");
      this.formats = mergeConfigs(r.formats, n), this.formatters = f && f.formatters || createDefaultFormatters(this.formatterCache);
    }
    return Object.defineProperty(r, "defaultLocale", {
      get: function() {
        return r.memoizedDefaultLocale || (r.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), r.memoizedDefaultLocale;
      },
      enumerable: !1,
      configurable: !0
    }), r.memoizedDefaultLocale = null, r.resolveLocale = function(e) {
      var t = Intl.NumberFormat.supportedLocalesOf(e);
      return t.length > 0 ? new Intl.Locale(t[0]) : new Intl.Locale(typeof e == "string" ? e : e[0]);
    }, r.__parse = parse, r.formats = {
      number: {
        integer: {
          maximumFractionDigits: 0
        },
        currency: {
          style: "currency"
        },
        percent: {
          style: "percent"
        }
      },
      date: {
        short: {
          month: "numeric",
          day: "numeric",
          year: "2-digit"
        },
        medium: {
          month: "short",
          day: "numeric",
          year: "numeric"
        },
        long: {
          month: "long",
          day: "numeric",
          year: "numeric"
        },
        full: {
          weekday: "long",
          month: "long",
          day: "numeric",
          year: "numeric"
        }
      },
      time: {
        short: {
          hour: "numeric",
          minute: "numeric"
        },
        medium: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric"
        },
        long: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        },
        full: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        }
      }
    }, r;
  }()
);
function delve(r, e) {
  if (e == null)
    return;
  if (e in r)
    return r[e];
  const t = e.split(".");
  let n = r;
  for (let f = 0; f < t.length; f++)
    if (typeof n == "object") {
      if (f > 0) {
        const u = t.slice(f, t.length).join(".");
        if (u in n) {
          n = n[u];
          break;
        }
      }
      n = n[t[f]];
    } else
      n = void 0;
  return n;
}
const lookupCache = {}, addToCache = (r, e, t) => t && (e in lookupCache || (lookupCache[e] = {}), r in lookupCache[e] || (lookupCache[e][r] = t), t), lookup = (r, e) => {
  if (e == null)
    return;
  if (e in lookupCache && r in lookupCache[e])
    return lookupCache[e][r];
  const t = getPossibleLocales(e);
  for (let n = 0; n < t.length; n++) {
    const f = t[n], u = getMessageFromDictionary(f, r);
    if (u)
      return addToCache(r, e, u);
  }
};
let dictionary;
const $dictionary = writable({});
function getLocaleDictionary(r) {
  return dictionary[r] || null;
}
function hasLocaleDictionary(r) {
  return r in dictionary;
}
function getMessageFromDictionary(r, e) {
  if (!hasLocaleDictionary(r))
    return null;
  const t = getLocaleDictionary(r);
  return delve(t, e);
}
function getClosestAvailableLocale(r) {
  if (r == null)
    return;
  const e = getPossibleLocales(r);
  for (let t = 0; t < e.length; t++) {
    const n = e[t];
    if (hasLocaleDictionary(n))
      return n;
  }
}
function addMessages(r, ...e) {
  delete lookupCache[r], $dictionary.update((t) => (t[r] = deepmerge$1.all([t[r] || {}, ...e]), t));
}
derived(
  [$dictionary],
  ([r]) => Object.keys(r)
);
$dictionary.subscribe((r) => dictionary = r);
const queue = {};
function removeLoaderFromQueue(r, e) {
  queue[r].delete(e), queue[r].size === 0 && delete queue[r];
}
function getLocaleQueue(r) {
  return queue[r];
}
function getLocalesQueues(r) {
  return getPossibleLocales(r).map((e) => {
    const t = getLocaleQueue(e);
    return [e, t ? [...t] : []];
  }).filter(([, e]) => e.length > 0);
}
function hasLocaleQueue(r) {
  return r == null ? !1 : getPossibleLocales(r).some(
    (e) => {
      var t;
      return (t = getLocaleQueue(e)) == null ? void 0 : t.size;
    }
  );
}
function loadLocaleQueue(r, e) {
  return Promise.all(
    e.map((n) => (removeLoaderFromQueue(r, n), n().then((f) => f.default || f)))
  ).then((n) => addMessages(r, ...n));
}
const activeFlushes = {};
function flush$1(r) {
  if (!hasLocaleQueue(r))
    return r in activeFlushes ? activeFlushes[r] : Promise.resolve();
  const e = getLocalesQueues(r);
  return activeFlushes[r] = Promise.all(
    e.map(
      ([t, n]) => loadLocaleQueue(t, n)
    )
  ).then(() => {
    if (hasLocaleQueue(r))
      return flush$1(r);
    delete activeFlushes[r];
  }), activeFlushes[r];
}
const defaultFormats = {
  number: {
    scientific: { notation: "scientific" },
    engineering: { notation: "engineering" },
    compactLong: { notation: "compact", compactDisplay: "long" },
    compactShort: { notation: "compact", compactDisplay: "short" }
  },
  date: {
    short: { month: "numeric", day: "numeric", year: "2-digit" },
    medium: { month: "short", day: "numeric", year: "numeric" },
    long: { month: "long", day: "numeric", year: "numeric" },
    full: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
  },
  time: {
    short: { hour: "numeric", minute: "numeric" },
    medium: { hour: "numeric", minute: "numeric", second: "numeric" },
    long: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    },
    full: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    }
  }
}, defaultOptions = {
  fallbackLocale: null,
  loadingDelay: 200,
  formats: defaultFormats,
  warnOnMissingMessages: !0,
  handleMissingMessage: void 0,
  ignoreTag: !0
}, options = defaultOptions;
function getOptions() {
  return options;
}
const $isLoading = writable(!1);
var __defProp$1 = Object.defineProperty, __defProps = Object.defineProperties, __getOwnPropDescs = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$1 = Object.getOwnPropertySymbols, __hasOwnProp$1 = Object.prototype.hasOwnProperty, __propIsEnum$1 = Object.prototype.propertyIsEnumerable, __defNormalProp$1 = (r, e, t) => e in r ? __defProp$1(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, __spreadValues$1 = (r, e) => {
  for (var t in e || (e = {}))
    __hasOwnProp$1.call(e, t) && __defNormalProp$1(r, t, e[t]);
  if (__getOwnPropSymbols$1)
    for (var t of __getOwnPropSymbols$1(e))
      __propIsEnum$1.call(e, t) && __defNormalProp$1(r, t, e[t]);
  return r;
}, __spreadProps = (r, e) => __defProps(r, __getOwnPropDescs(e));
let current;
const internalLocale = writable(null);
function getSubLocales(r) {
  return r.split("-").map((e, t, n) => n.slice(0, t + 1).join("-")).reverse();
}
function getPossibleLocales(r, e = getOptions().fallbackLocale) {
  const t = getSubLocales(r);
  return e ? [.../* @__PURE__ */ new Set([...t, ...getSubLocales(e)])] : t;
}
function getCurrentLocale() {
  return current ?? void 0;
}
internalLocale.subscribe((r) => {
  current = r ?? void 0, typeof window < "u" && r != null && document.documentElement.setAttribute("lang", r);
});
const set = (r) => {
  if (r && getClosestAvailableLocale(r) && hasLocaleQueue(r)) {
    const { loadingDelay: e } = getOptions();
    let t;
    return typeof window < "u" && getCurrentLocale() != null && e ? t = window.setTimeout(
      () => $isLoading.set(!0),
      e
    ) : $isLoading.set(!0), flush$1(r).then(() => {
      internalLocale.set(r);
    }).finally(() => {
      clearTimeout(t), $isLoading.set(!1);
    });
  }
  return internalLocale.set(r);
}, $locale = __spreadProps(__spreadValues$1({}, internalLocale), {
  set
}), monadicMemoize = (r) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (n) => {
    const f = JSON.stringify(n);
    return f in e ? e[f] : e[f] = r(n);
  };
};
var __defProp = Object.defineProperty, __getOwnPropSymbols = Object.getOwnPropertySymbols, __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable, __defNormalProp = (r, e, t) => e in r ? __defProp(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, __spreadValues = (r, e) => {
  for (var t in e || (e = {}))
    __hasOwnProp.call(e, t) && __defNormalProp(r, t, e[t]);
  if (__getOwnPropSymbols)
    for (var t of __getOwnPropSymbols(e))
      __propIsEnum.call(e, t) && __defNormalProp(r, t, e[t]);
  return r;
}, __objRest = (r, e) => {
  var t = {};
  for (var n in r)
    __hasOwnProp.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
  if (r != null && __getOwnPropSymbols)
    for (var n of __getOwnPropSymbols(r))
      e.indexOf(n) < 0 && __propIsEnum.call(r, n) && (t[n] = r[n]);
  return t;
};
const getIntlFormatterOptions = (r, e) => {
  const { formats: t } = getOptions();
  if (r in t && e in t[r])
    return t[r][e];
  throw new Error(`[svelte-i18n] Unknown "${e}" ${r} format.`);
}, createNumberFormatter = monadicMemoize(
  (r) => {
    var e = r, { locale: t, format: n } = e, f = __objRest(e, ["locale", "format"]);
    if (t == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format numbers');
    return n && (f = getIntlFormatterOptions("number", n)), new Intl.NumberFormat(t, f);
  }
), createDateFormatter = monadicMemoize(
  (r) => {
    var e = r, { locale: t, format: n } = e, f = __objRest(e, ["locale", "format"]);
    if (t == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format dates');
    return n ? f = getIntlFormatterOptions("date", n) : Object.keys(f).length === 0 && (f = getIntlFormatterOptions("date", "short")), new Intl.DateTimeFormat(t, f);
  }
), createTimeFormatter = monadicMemoize(
  (r) => {
    var e = r, { locale: t, format: n } = e, f = __objRest(e, ["locale", "format"]);
    if (t == null)
      throw new Error(
        '[svelte-i18n] A "locale" must be set to format time values'
      );
    return n ? f = getIntlFormatterOptions("time", n) : Object.keys(f).length === 0 && (f = getIntlFormatterOptions("time", "short")), new Intl.DateTimeFormat(t, f);
  }
), getNumberFormatter = (r = {}) => {
  var e = r, {
    locale: t = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createNumberFormatter(__spreadValues({ locale: t }, n));
}, getDateFormatter = (r = {}) => {
  var e = r, {
    locale: t = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createDateFormatter(__spreadValues({ locale: t }, n));
}, getTimeFormatter = (r = {}) => {
  var e = r, {
    locale: t = getCurrentLocale()
  } = e, n = __objRest(e, [
    "locale"
  ]);
  return createTimeFormatter(__spreadValues({ locale: t }, n));
}, getMessageFormatter = monadicMemoize(
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  (r, e = getCurrentLocale()) => new IntlMessageFormat(r, e, getOptions().formats, {
    ignoreTag: getOptions().ignoreTag
  })
), formatMessage = (r, e = {}) => {
  var t, n, f, u;
  let y = e;
  typeof r == "object" && (y = r, r = y.id);
  const {
    values: h,
    locale: _ = getCurrentLocale(),
    default: E
  } = y;
  if (_ == null)
    throw new Error(
      "[svelte-i18n] Cannot format a message without first setting the initial locale."
    );
  let c = lookup(r, _);
  if (!c)
    c = (u = (f = (n = (t = getOptions()).handleMissingMessage) == null ? void 0 : n.call(t, { locale: _, id: r, defaultValue: E })) != null ? f : E) != null ? u : r;
  else if (typeof c != "string")
    return console.warn(
      `[svelte-i18n] Message with id "${r}" must be of type "string", found: "${typeof c}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`
    ), c;
  if (!h)
    return c;
  let C = c;
  try {
    C = getMessageFormatter(c, _).format(h);
  } catch (b) {
    b instanceof Error && console.warn(
      `[svelte-i18n] Message "${r}" has syntax error:`,
      b.message
    );
  }
  return C;
}, formatTime = (r, e) => getTimeFormatter(e).format(r), formatDate = (r, e) => getDateFormatter(e).format(r), formatNumber = (r, e) => getNumberFormatter(e).format(r), getJSON = (r, e = getCurrentLocale()) => lookup(r, e);
derived([$locale, $dictionary], () => formatMessage);
derived([$locale], () => formatTime);
derived([$locale], () => formatDate);
derived([$locale], () => formatNumber);
derived([$locale, $dictionary], () => getJSON);
const Upload_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$8,
  append: append$7,
  attr: attr$7,
  binding_callbacks: binding_callbacks$2,
  bubble: bubble$1,
  create_slot: create_slot$2,
  detach: detach$8,
  element: element$6,
  get_all_dirty_from_scope: get_all_dirty_from_scope$2,
  get_slot_changes: get_slot_changes$2,
  init: init$8,
  insert: insert$8,
  listen: listen$1,
  prevent_default,
  run_all: run_all$1,
  safe_not_equal: safe_not_equal$8,
  space: space$5,
  stop_propagation,
  toggle_class: toggle_class$4,
  transition_in: transition_in$5,
  transition_out: transition_out$5,
  update_slot_base: update_slot_base$2
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$3, tick: tick$3, getContext: getContext$1 } = window.__gradio__svelte__internal;
function create_fragment$8(r) {
  let e, t, n, f, u, y, h, _, E;
  const c = (
    /*#slots*/
    r[16].default
  ), C = create_slot$2(
    c,
    r,
    /*$$scope*/
    r[15],
    null
  );
  return {
    c() {
      e = element$6("button"), C && C.c(), t = space$5(), n = element$6("input"), attr$7(n, "type", "file"), attr$7(
        n,
        "accept",
        /*filetype*/
        r[0]
      ), n.multiple = f = /*file_count*/
      r[4] === "multiple" || void 0, attr$7(n, "webkitdirectory", u = /*file_count*/
      r[4] === "directory" || void 0), attr$7(n, "mozdirectory", y = /*file_count*/
      r[4] === "directory" || void 0), attr$7(n, "class", "svelte-18dlsnh"), attr$7(e, "class", "svelte-18dlsnh"), toggle_class$4(
        e,
        "hidden",
        /*hidden*/
        r[5]
      ), toggle_class$4(
        e,
        "center",
        /*center*/
        r[2]
      ), toggle_class$4(
        e,
        "boundedheight",
        /*boundedheight*/
        r[1]
      ), toggle_class$4(
        e,
        "flex",
        /*flex*/
        r[3]
      );
    },
    m(b, A) {
      insert$8(b, e, A), C && C.m(e, null), append$7(e, t), append$7(e, n), r[24](n), h = !0, _ || (E = [
        listen$1(
          n,
          "change",
          /*load_files_from_upload*/
          r[9]
        ),
        listen$1(e, "drag", stop_propagation(prevent_default(
          /*drag_handler*/
          r[17]
        ))),
        listen$1(e, "dragstart", stop_propagation(prevent_default(
          /*dragstart_handler*/
          r[18]
        ))),
        listen$1(e, "dragend", stop_propagation(prevent_default(
          /*dragend_handler*/
          r[19]
        ))),
        listen$1(e, "dragover", stop_propagation(prevent_default(
          /*dragover_handler*/
          r[20]
        ))),
        listen$1(e, "dragenter", stop_propagation(prevent_default(
          /*dragenter_handler*/
          r[21]
        ))),
        listen$1(e, "dragleave", stop_propagation(prevent_default(
          /*dragleave_handler*/
          r[22]
        ))),
        listen$1(e, "drop", stop_propagation(prevent_default(
          /*drop_handler*/
          r[23]
        ))),
        listen$1(
          e,
          "click",
          /*open_file_upload*/
          r[6]
        ),
        listen$1(
          e,
          "drop",
          /*loadFilesFromDrop*/
          r[10]
        ),
        listen$1(
          e,
          "dragenter",
          /*updateDragging*/
          r[8]
        ),
        listen$1(
          e,
          "dragleave",
          /*updateDragging*/
          r[8]
        )
      ], _ = !0);
    },
    p(b, [A]) {
      C && C.p && (!h || A & /*$$scope*/
      32768) && update_slot_base$2(
        C,
        c,
        b,
        /*$$scope*/
        b[15],
        h ? get_slot_changes$2(
          c,
          /*$$scope*/
          b[15],
          A,
          null
        ) : get_all_dirty_from_scope$2(
          /*$$scope*/
          b[15]
        ),
        null
      ), (!h || A & /*filetype*/
      1) && attr$7(
        n,
        "accept",
        /*filetype*/
        b[0]
      ), (!h || A & /*file_count*/
      16 && f !== (f = /*file_count*/
      b[4] === "multiple" || void 0)) && (n.multiple = f), (!h || A & /*file_count*/
      16 && u !== (u = /*file_count*/
      b[4] === "directory" || void 0)) && attr$7(n, "webkitdirectory", u), (!h || A & /*file_count*/
      16 && y !== (y = /*file_count*/
      b[4] === "directory" || void 0)) && attr$7(n, "mozdirectory", y), (!h || A & /*hidden*/
      32) && toggle_class$4(
        e,
        "hidden",
        /*hidden*/
        b[5]
      ), (!h || A & /*center*/
      4) && toggle_class$4(
        e,
        "center",
        /*center*/
        b[2]
      ), (!h || A & /*boundedheight*/
      2) && toggle_class$4(
        e,
        "boundedheight",
        /*boundedheight*/
        b[1]
      ), (!h || A & /*flex*/
      8) && toggle_class$4(
        e,
        "flex",
        /*flex*/
        b[3]
      );
    },
    i(b) {
      h || (transition_in$5(C, b), h = !0);
    },
    o(b) {
      transition_out$5(C, b), h = !1;
    },
    d(b) {
      b && detach$8(e), C && C.d(b), r[24](null), _ = !1, run_all$1(E);
    }
  };
}
function _optionalChain(r) {
  let e, t = r[0], n = 1;
  for (; n < r.length; ) {
    const f = r[n], u = r[n + 1];
    if (n += 2, (f === "optionalAccess" || f === "optionalCall") && t == null)
      return;
    f === "access" || f === "optionalAccess" ? (e = t, t = u(t)) : (f === "call" || f === "optionalCall") && (t = u((...y) => t.call(e, ...y)), e = void 0);
  }
  return t;
}
function is_valid_mimetype(r, e) {
  return !r || r === "*" ? !0 : r.endsWith("/*") ? e.startsWith(r.slice(0, -1)) : r === e;
}
function instance$7(r, e, t) {
  let { $$slots: n = {}, $$scope: f } = e, { filetype: u = null } = e, { dragging: y = !1 } = e, { boundedheight: h = !0 } = e, { center: _ = !0 } = e, { flex: E = !0 } = e, { file_count: c = "single" } = e, { disable_click: C = !1 } = e, { root: b } = e, { hidden: A = !1 } = e;
  const S = getContext$1("upload_files");
  let s;
  const o = createEventDispatcher$3();
  function w() {
    t(11, y = !y);
  }
  function p() {
    C || (t(7, s.value = "", s), s.click());
  }
  async function v(F) {
    await tick$3();
    const N = await upload(F, b, S);
    return o("load", c === "single" ? _optionalChain([N, "optionalAccess", ($) => $[0]]) : N), N || [];
  }
  async function a(F) {
    if (!F.length)
      return;
    let N = F.map((k) => new File([k], k.name)), $ = await prepare_files(N);
    return await v($);
  }
  async function l(F) {
    const N = F.target;
    N.files && await a(Array.from(N.files));
  }
  async function g(F) {
    if (t(11, y = !1), !_optionalChain([F, "access", ($) => $.dataTransfer, "optionalAccess", ($) => $.files]))
      return;
    const N = Array.from(F.dataTransfer.files).filter(($) => is_valid_mimetype(u, $.type) ? !0 : (o("error", `Invalid file type only ${u} allowed.`), !1));
    await a(N);
  }
  function M(F) {
    bubble$1.call(this, r, F);
  }
  function L(F) {
    bubble$1.call(this, r, F);
  }
  function T(F) {
    bubble$1.call(this, r, F);
  }
  function D(F) {
    bubble$1.call(this, r, F);
  }
  function I(F) {
    bubble$1.call(this, r, F);
  }
  function z(F) {
    bubble$1.call(this, r, F);
  }
  function P(F) {
    bubble$1.call(this, r, F);
  }
  function B(F) {
    binding_callbacks$2[F ? "unshift" : "push"](() => {
      s = F, t(7, s);
    });
  }
  return r.$$set = (F) => {
    "filetype" in F && t(0, u = F.filetype), "dragging" in F && t(11, y = F.dragging), "boundedheight" in F && t(1, h = F.boundedheight), "center" in F && t(2, _ = F.center), "flex" in F && t(3, E = F.flex), "file_count" in F && t(4, c = F.file_count), "disable_click" in F && t(12, C = F.disable_click), "root" in F && t(13, b = F.root), "hidden" in F && t(5, A = F.hidden), "$$scope" in F && t(15, f = F.$$scope);
  }, [
    u,
    h,
    _,
    E,
    c,
    A,
    p,
    s,
    w,
    l,
    g,
    y,
    C,
    b,
    a,
    f,
    n,
    M,
    L,
    T,
    D,
    I,
    z,
    P,
    B
  ];
}
class Upload extends SvelteComponent$8 {
  constructor(e) {
    super(), init$8(this, e, instance$7, create_fragment$8, safe_not_equal$8, {
      filetype: 0,
      dragging: 11,
      boundedheight: 1,
      center: 2,
      flex: 3,
      file_count: 4,
      disable_click: 12,
      root: 13,
      hidden: 5,
      open_file_upload: 6,
      load_files: 14
    });
  }
  get open_file_upload() {
    return this.$$.ctx[6];
  }
  get load_files() {
    return this.$$.ctx[14];
  }
}
const ModifyUpload_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$7,
  append: append$6,
  attr: attr$6,
  check_outros: check_outros$4,
  create_component: create_component$4,
  destroy_component: destroy_component$4,
  detach: detach$7,
  element: element$5,
  group_outros: group_outros$4,
  init: init$7,
  insert: insert$7,
  mount_component: mount_component$4,
  safe_not_equal: safe_not_equal$7,
  set_style: set_style$2,
  space: space$4,
  toggle_class: toggle_class$3,
  transition_in: transition_in$4,
  transition_out: transition_out$4
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal;
function create_if_block_1$3(r) {
  let e, t;
  return e = new IconButton({
    props: {
      Icon: Edit,
      label: (
        /*i18n*/
        r[3]("common.edit")
      )
    }
  }), e.$on(
    "click",
    /*click_handler*/
    r[5]
  ), {
    c() {
      create_component$4(e.$$.fragment);
    },
    m(n, f) {
      mount_component$4(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f & /*i18n*/
      8 && (u.label = /*i18n*/
      n[3]("common.edit")), e.$set(u);
    },
    i(n) {
      t || (transition_in$4(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$4(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$4(e, n);
    }
  };
}
function create_if_block$4(r) {
  let e, t;
  return e = new IconButton({
    props: {
      Icon: Undo,
      label: (
        /*i18n*/
        r[3]("common.undo")
      )
    }
  }), e.$on(
    "click",
    /*click_handler_1*/
    r[6]
  ), {
    c() {
      create_component$4(e.$$.fragment);
    },
    m(n, f) {
      mount_component$4(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f & /*i18n*/
      8 && (u.label = /*i18n*/
      n[3]("common.undo")), e.$set(u);
    },
    i(n) {
      t || (transition_in$4(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$4(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$4(e, n);
    }
  };
}
function create_fragment$7(r) {
  let e, t, n, f, u, y = (
    /*editable*/
    r[0] && create_if_block_1$3(r)
  ), h = (
    /*undoable*/
    r[1] && create_if_block$4(r)
  );
  return f = new IconButton({
    props: {
      Icon: Clear,
      label: (
        /*i18n*/
        r[3]("common.clear")
      )
    }
  }), f.$on(
    "click",
    /*click_handler_2*/
    r[7]
  ), {
    c() {
      e = element$5("div"), y && y.c(), t = space$4(), h && h.c(), n = space$4(), create_component$4(f.$$.fragment), attr$6(e, "class", "svelte-1wj0ocy"), toggle_class$3(e, "not-absolute", !/*absolute*/
      r[2]), set_style$2(
        e,
        "position",
        /*absolute*/
        r[2] ? "absolute" : "static"
      );
    },
    m(_, E) {
      insert$7(_, e, E), y && y.m(e, null), append$6(e, t), h && h.m(e, null), append$6(e, n), mount_component$4(f, e, null), u = !0;
    },
    p(_, [E]) {
      /*editable*/
      _[0] ? y ? (y.p(_, E), E & /*editable*/
      1 && transition_in$4(y, 1)) : (y = create_if_block_1$3(_), y.c(), transition_in$4(y, 1), y.m(e, t)) : y && (group_outros$4(), transition_out$4(y, 1, 1, () => {
        y = null;
      }), check_outros$4()), /*undoable*/
      _[1] ? h ? (h.p(_, E), E & /*undoable*/
      2 && transition_in$4(h, 1)) : (h = create_if_block$4(_), h.c(), transition_in$4(h, 1), h.m(e, n)) : h && (group_outros$4(), transition_out$4(h, 1, 1, () => {
        h = null;
      }), check_outros$4());
      const c = {};
      E & /*i18n*/
      8 && (c.label = /*i18n*/
      _[3]("common.clear")), f.$set(c), (!u || E & /*absolute*/
      4) && toggle_class$3(e, "not-absolute", !/*absolute*/
      _[2]), E & /*absolute*/
      4 && set_style$2(
        e,
        "position",
        /*absolute*/
        _[2] ? "absolute" : "static"
      );
    },
    i(_) {
      u || (transition_in$4(y), transition_in$4(h), transition_in$4(f.$$.fragment, _), u = !0);
    },
    o(_) {
      transition_out$4(y), transition_out$4(h), transition_out$4(f.$$.fragment, _), u = !1;
    },
    d(_) {
      _ && detach$7(e), y && y.d(), h && h.d(), destroy_component$4(f);
    }
  };
}
function instance$6(r, e, t) {
  let { editable: n = !1 } = e, { undoable: f = !1 } = e, { absolute: u = !0 } = e, { i18n: y } = e;
  const h = createEventDispatcher$2(), _ = () => h("edit"), E = () => h("undo"), c = (C) => {
    h("clear"), C.stopPropagation();
  };
  return r.$$set = (C) => {
    "editable" in C && t(0, n = C.editable), "undoable" in C && t(1, f = C.undoable), "absolute" in C && t(2, u = C.absolute), "i18n" in C && t(3, y = C.i18n);
  }, [
    n,
    f,
    u,
    y,
    h,
    _,
    E,
    c
  ];
}
class ModifyUpload extends SvelteComponent$7 {
  constructor(e) {
    super(), init$7(this, e, instance$6, create_fragment$7, safe_not_equal$7, {
      editable: 0,
      undoable: 1,
      absolute: 2,
      i18n: 3
    });
  }
}
const {
  SvelteComponent: SvelteComponent$6,
  append: append$5,
  attr: attr$5,
  detach: detach$6,
  init: init$6,
  insert: insert$6,
  noop: noop$4,
  safe_not_equal: safe_not_equal$6,
  svg_element: svg_element$2
} = window.__gradio__svelte__internal;
function create_fragment$6(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b;
  return {
    c() {
      e = svg_element$2("svg"), t = svg_element$2("defs"), n = svg_element$2("linearGradient"), f = svg_element$2("stop"), u = svg_element$2("stop"), y = svg_element$2("stop"), h = svg_element$2("g"), _ = svg_element$2("g"), E = svg_element$2("path"), c = svg_element$2("animateTransform"), C = svg_element$2("circle"), b = svg_element$2("animateTransform"), attr$5(f, "stop-color", "#FF7C00"), attr$5(f, "stop-opacity", "0"), attr$5(f, "offset", "0%"), attr$5(u, "stop-color", "#FF7C00"), attr$5(u, "stop-opacity", ".631"), attr$5(u, "offset", "63.146%"), attr$5(y, "stop-color", "#FF7C00"), attr$5(y, "offset", "100%"), attr$5(n, "x1", "8.042%"), attr$5(n, "y1", "0%"), attr$5(n, "x2", "65.682%"), attr$5(n, "y2", "23.865%"), attr$5(n, "id", "a"), attr$5(c, "attributeName", "transform"), attr$5(c, "type", "rotate"), attr$5(c, "from", "0 18 18"), attr$5(c, "to", "360 18 18"), attr$5(c, "dur", "0.9s"), attr$5(c, "repeatCount", "indefinite"), attr$5(E, "d", "M36 18c0-9.94-8.06-18-18-18"), attr$5(E, "id", "Oval-2"), attr$5(E, "stroke", "url(#a)"), attr$5(E, "stroke-width", "2"), attr$5(b, "attributeName", "transform"), attr$5(b, "type", "rotate"), attr$5(b, "from", "0 18 18"), attr$5(b, "to", "360 18 18"), attr$5(b, "dur", "0.9s"), attr$5(b, "repeatCount", "indefinite"), attr$5(C, "fill", "#FFf"), attr$5(C, "cx", "36"), attr$5(C, "cy", "18"), attr$5(C, "r", "1"), attr$5(_, "transform", "translate(1 1)"), attr$5(h, "fill", "none"), attr$5(h, "fill-rule", "evenodd"), attr$5(e, "width", "20"), attr$5(e, "height", "20 "), attr$5(e, "viewBox", "0 0 38 38"), attr$5(e, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(A, S) {
      insert$6(A, e, S), append$5(e, t), append$5(t, n), append$5(n, f), append$5(n, u), append$5(n, y), append$5(e, h), append$5(h, _), append$5(_, E), append$5(E, c), append$5(_, C), append$5(C, b);
    },
    p: noop$4,
    i: noop$4,
    o: noop$4,
    d(A) {
      A && detach$6(e);
    }
  };
}
class Loading_spinner extends SvelteComponent$6 {
  constructor(e) {
    super(), init$6(this, e, null, create_fragment$6, safe_not_equal$6, {});
  }
}
const FileRetrieval_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$5,
  append: append$4,
  attr: attr$4,
  check_outros: check_outros$3,
  create_component: create_component$3,
  destroy_component: destroy_component$3,
  detach: detach$5,
  element: element$4,
  group_outros: group_outros$3,
  init: init$5,
  insert: insert$5,
  listen,
  mount_component: mount_component$3,
  noop: noop$3,
  run_all,
  safe_not_equal: safe_not_equal$5,
  set_input_value,
  space: space$3,
  transition_in: transition_in$3,
  transition_out: transition_out$3
} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$1, tick: tick$2, getContext } = window.__gradio__svelte__internal;
function create_else_block$3(r) {
  let e;
  return {
    c() {
      e = element$4("span"), e.textContent = "Fetch";
    },
    m(t, n) {
      insert$5(t, e, n);
    },
    i: noop$3,
    o: noop$3,
    d(t) {
      t && detach$5(e);
    }
  };
}
function create_if_block$3(r) {
  let e, t;
  return e = new Loading_spinner({}), {
    c() {
      create_component$3(e.$$.fragment);
    },
    m(n, f) {
      mount_component$3(e, n, f), t = !0;
    },
    i(n) {
      t || (transition_in$3(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$3(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$3(e, n);
    }
  };
}
function create_fragment$5(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b, A, S, s, o, w, p;
  const v = [create_if_block$3, create_else_block$3], a = [];
  function l(g, M) {
    return (
      /*loading*/
      g[1] ? 0 : 1
    );
  }
  return b = l(r), A = a[b] = v[b](r), {
    c() {
      e = element$4("div"), t = element$4("div"), n = element$4("input"), f = space$3(), u = element$4("select"), y = element$4("option"), y.textContent = "PDB Assym. Unit", h = element$4("option"), h.textContent = "PDB BioAssembly", _ = element$4("option"), _.textContent = "AlphaFold DB", E = element$4("option"), E.textContent = "ESMFold DB", c = space$3(), C = element$4("button"), A.c(), S = space$3(), s = element$4("span"), s.textContent = "- or -", attr$4(n, "type", "text"), attr$4(
        n,
        "placeholder",
        /*placeholder*/
        r[2]
      ), attr$4(n, "class", "wfull inp svelte-18kpwjt"), y.__value = "pdb_assym", set_input_value(y, y.__value), h.__value = "pdb_bioass", set_input_value(h, h.__value), _.__value = "af", set_input_value(_, _.__value), E.__value = "esm", set_input_value(E, E.__value), attr$4(u, "name", ""), attr$4(u, "id", ""), attr$4(u, "class", "select svelte-18kpwjt"), attr$4(t, "class", "flex input wfull svelte-18kpwjt"), attr$4(C, "class", "btn text-center svelte-18kpwjt"), attr$4(e, "class", "flex mt-2 svelte-18kpwjt"), attr$4(s, "class", "or py svelte-18kpwjt");
    },
    m(g, M) {
      insert$5(g, e, M), append$4(e, t), append$4(t, n), set_input_value(
        n,
        /*textInput*/
        r[3]
      ), append$4(t, f), append$4(t, u), append$4(u, y), append$4(u, h), append$4(u, _), append$4(u, E), append$4(e, c), append$4(e, C), a[b].m(C, null), insert$5(g, S, M), insert$5(g, s, M), o = !0, w || (p = [
        listen(
          n,
          "input",
          /*input_input_handler*/
          r[8]
        ),
        listen(
          n,
          "keydown",
          /*isEnterPressed*/
          r[6]
        ),
        listen(
          u,
          "change",
          /*handleSelect*/
          r[5]
        ),
        listen(
          C,
          "click",
          /*click_handler*/
          r[9]
        )
      ], w = !0);
    },
    p(g, [M]) {
      (!o || M & /*placeholder*/
      4) && attr$4(
        n,
        "placeholder",
        /*placeholder*/
        g[2]
      ), M & /*textInput*/
      8 && n.value !== /*textInput*/
      g[3] && set_input_value(
        n,
        /*textInput*/
        g[3]
      );
      let L = b;
      b = l(g), b !== L && (group_outros$3(), transition_out$3(a[L], 1, 1, () => {
        a[L] = null;
      }), check_outros$3(), A = a[b], A || (A = a[b] = v[b](g), A.c()), transition_in$3(A, 1), A.m(C, null));
    },
    i(g) {
      o || (transition_in$3(A), o = !0);
    },
    o(g) {
      transition_out$3(A), o = !1;
    },
    d(g) {
      g && (detach$5(e), detach$5(S), detach$5(s)), a[b].d(), w = !1, run_all(p);
    }
  };
}
function instance$5(r, e, t) {
  let n;
  const f = createEventDispatcher$1();
  let { root: u } = e;
  const y = getContext("upload_files");
  async function h(p) {
    await tick$2(), n = await upload(p, u, y), n[0].orig_name = p.name, n[0].size = p.size, f("load", n);
  }
  let _ = !1;
  async function E(p, v) {
    let a = {
      pdb_assym: {
        url: "https://files.rcsb.org/view/",
        ext: ".pdb"
      },
      pdb_bioass: {
        url: "https://files.rcsb.org/view/",
        ext: ".pdb1"
      },
      af: {
        url: "https://alphafold.ebi.ac.uk/files/AF-",
        ext: "-F1-model_v4.pdb"
      },
      esm: {
        url: "https://api.esmatlas.com/fetchPredictedStructure/",
        ext: ".pdb"
      }
    }, l = a[v].url, g = a[v].ext;
    t(1, _ = !0);
    let M = null;
    try {
      M = await fetch(l + p + g).then((T) => {
        if (t(1, _ = !1), T.status == 200) {
          let D = T.blob();
          return D.name = p + g, D;
        } else
          f("notfound");
      });
    } catch {
      t(1, _ = !1), f("notfound");
    }
    let L = {
      name: p + ".pdb",
      size: M.size,
      data: "",
      blob: M
    };
    await h(L);
  }
  let c = "pdb_assym", C = "", b = "";
  function A(p) {
    t(0, c = p.target.value);
  }
  let S = {
    pdb_assym: "Enter PDB identifier",
    pdb_bioass: "Enter PDB identifier",
    af: "Enter UniProt identifier",
    esm: "Enter MGnify protein identifier"
  };
  function s(p) {
    p.key === "Enter" && E(b, c);
  }
  function o() {
    b = this.value, t(3, b);
  }
  const w = () => E(b, c);
  return r.$$set = (p) => {
    "root" in p && t(7, u = p.root);
  }, r.$$.update = () => {
    r.$$.dirty & /*selectedValue*/
    1 && t(2, C = S[c]);
  }, [
    c,
    _,
    C,
    b,
    E,
    A,
    s,
    u,
    o,
    w
  ];
}
class FileRetrieval extends SvelteComponent$5 {
  constructor(e) {
    super(), init$5(this, e, instance$5, create_fragment$5, safe_not_equal$5, { root: 7 });
  }
}
const {
  SvelteComponent: SvelteComponent$4,
  add_flush_callback,
  bind,
  binding_callbacks: binding_callbacks$1,
  bubble,
  check_outros: check_outros$2,
  create_component: create_component$2,
  create_slot: create_slot$1,
  destroy_component: destroy_component$2,
  detach: detach$4,
  empty: empty$2,
  get_all_dirty_from_scope: get_all_dirty_from_scope$1,
  get_slot_changes: get_slot_changes$1,
  group_outros: group_outros$2,
  init: init$4,
  insert: insert$4,
  mount_component: mount_component$2,
  safe_not_equal: safe_not_equal$4,
  space: space$2,
  transition_in: transition_in$2,
  transition_out: transition_out$2,
  update_slot_base: update_slot_base$1
} = window.__gradio__svelte__internal, { createEventDispatcher, tick: tick$1 } = window.__gradio__svelte__internal;
function create_else_block$2(r) {
  let e, t, n, f, u;
  e = new FileRetrieval({ props: { root: (
    /*root*/
    r[5]
  ) } }), e.$on(
    "load",
    /*handle_upload*/
    r[15]
  ), e.$on(
    "notfound",
    /*notfound_handler*/
    r[21]
  );
  function y(_) {
    r[22](_);
  }
  let h = {
    filetype: (
      /*accept_file_types*/
      r[14]
    ),
    file_count: (
      /*file_count*/
      r[3]
    ),
    root: (
      /*root*/
      r[5]
    ),
    $$slots: { default: [create_default_slot$1] },
    $$scope: { ctx: r }
  };
  return (
    /*dragging*/
    r[13] !== void 0 && (h.dragging = /*dragging*/
    r[13]), n = new Upload({ props: h }), binding_callbacks$1.push(() => bind(n, "dragging", y)), n.$on(
      "load",
      /*handle_upload*/
      r[15]
    ), {
      c() {
        create_component$2(e.$$.fragment), t = space$2(), create_component$2(n.$$.fragment);
      },
      m(_, E) {
        mount_component$2(e, _, E), insert$4(_, t, E), mount_component$2(n, _, E), u = !0;
      },
      p(_, E) {
        const c = {};
        E & /*root*/
        32 && (c.root = /*root*/
        _[5]), e.$set(c);
        const C = {};
        E & /*accept_file_types*/
        16384 && (C.filetype = /*accept_file_types*/
        _[14]), E & /*file_count*/
        8 && (C.file_count = /*file_count*/
        _[3]), E & /*root*/
        32 && (C.root = /*root*/
        _[5]), E & /*$$scope*/
        8388608 && (C.$$scope = { dirty: E, ctx: _ }), !f && E & /*dragging*/
        8192 && (f = !0, C.dragging = /*dragging*/
        _[13], add_flush_callback(() => f = !1)), n.$set(C);
      },
      i(_) {
        u || (transition_in$2(e.$$.fragment, _), transition_in$2(n.$$.fragment, _), u = !0);
      },
      o(_) {
        transition_out$2(e.$$.fragment, _), transition_out$2(n.$$.fragment, _), u = !1;
      },
      d(_) {
        _ && detach$4(t), destroy_component$2(e, _), destroy_component$2(n, _);
      }
    }
  );
}
function create_if_block$2(r) {
  let e, t, n, f, u, y;
  e = new ModifyUpload({
    props: { i18n: (
      /*i18n*/
      r[7]
    ), absolute: !0 }
  }), e.$on(
    "clear",
    /*handle_clear*/
    r[16]
  ), n = new FilePreview({
    props: {
      i18n: (
        /*i18n*/
        r[7]
      ),
      selectable: (
        /*selectable*/
        r[4]
      ),
      value: (
        /*value*/
        r[0]
      ),
      height: (
        /*height*/
        r[6]
      )
    }
  }), n.$on(
    "select",
    /*select_handler*/
    r[20]
  );
  let h = (
    /*moldata*/
    r[11] != null && /*molviewer*/
    r[12] && create_if_block_1$2(r)
  );
  return {
    c() {
      create_component$2(e.$$.fragment), t = space$2(), create_component$2(n.$$.fragment), f = space$2(), h && h.c(), u = empty$2();
    },
    m(_, E) {
      mount_component$2(e, _, E), insert$4(_, t, E), mount_component$2(n, _, E), insert$4(_, f, E), h && h.m(_, E), insert$4(_, u, E), y = !0;
    },
    p(_, E) {
      const c = {};
      E & /*i18n*/
      128 && (c.i18n = /*i18n*/
      _[7]), e.$set(c);
      const C = {};
      E & /*i18n*/
      128 && (C.i18n = /*i18n*/
      _[7]), E & /*selectable*/
      16 && (C.selectable = /*selectable*/
      _[4]), E & /*value*/
      1 && (C.value = /*value*/
      _[0]), E & /*height*/
      64 && (C.height = /*height*/
      _[6]), n.$set(C), /*moldata*/
      _[11] != null && /*molviewer*/
      _[12] ? h ? (h.p(_, E), E & /*moldata, molviewer*/
      6144 && transition_in$2(h, 1)) : (h = create_if_block_1$2(_), h.c(), transition_in$2(h, 1), h.m(u.parentNode, u)) : h && (group_outros$2(), transition_out$2(h, 1, 1, () => {
        h = null;
      }), check_outros$2());
    },
    i(_) {
      y || (transition_in$2(e.$$.fragment, _), transition_in$2(n.$$.fragment, _), transition_in$2(h), y = !0);
    },
    o(_) {
      transition_out$2(e.$$.fragment, _), transition_out$2(n.$$.fragment, _), transition_out$2(h), y = !1;
    },
    d(_) {
      _ && (detach$4(t), detach$4(f), detach$4(u)), destroy_component$2(e, _), destroy_component$2(n, _), h && h.d(_);
    }
  };
}
function create_default_slot$1(r) {
  let e;
  const t = (
    /*#slots*/
    r[19].default
  ), n = create_slot$1(
    t,
    r,
    /*$$scope*/
    r[23],
    null
  );
  return {
    c() {
      n && n.c();
    },
    m(f, u) {
      n && n.m(f, u), e = !0;
    },
    p(f, u) {
      n && n.p && (!e || u & /*$$scope*/
      8388608) && update_slot_base$1(
        n,
        t,
        f,
        /*$$scope*/
        f[23],
        e ? get_slot_changes$1(
          t,
          /*$$scope*/
          f[23],
          u,
          null
        ) : get_all_dirty_from_scope$1(
          /*$$scope*/
          f[23]
        ),
        null
      );
    },
    i(f) {
      e || (transition_in$2(n, f), e = !0);
    },
    o(f) {
      transition_out$2(n, f), e = !1;
    },
    d(f) {
      n && n.d(f);
    }
  };
}
function create_if_block_1$2(r) {
  let e, t;
  return e = new MolecularViewer({
    props: {
      moldata: (
        /*moldata*/
        r[11]
      ),
      config: (
        /*config*/
        r[8]
      ),
      confidenceLabel: (
        /*confidenceLabel*/
        r[9]
      ),
      representations: (
        /*representations*/
        r[10]
      )
    }
  }), {
    c() {
      create_component$2(e.$$.fragment);
    },
    m(n, f) {
      mount_component$2(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f & /*moldata*/
      2048 && (u.moldata = /*moldata*/
      n[11]), f & /*config*/
      256 && (u.config = /*config*/
      n[8]), f & /*confidenceLabel*/
      512 && (u.confidenceLabel = /*confidenceLabel*/
      n[9]), f & /*representations*/
      1024 && (u.representations = /*representations*/
      n[10]), e.$set(u);
    },
    i(n) {
      t || (transition_in$2(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$2(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$2(e, n);
    }
  };
}
function create_fragment$4(r) {
  let e, t, n, f, u, y;
  e = new BlockLabel({
    props: {
      show_label: (
        /*show_label*/
        r[2]
      ),
      Icon: File$1,
      float: (
        /*value*/
        r[0] === null
      ),
      label: (
        /*label*/
        r[1] || "File"
      )
    }
  });
  const h = [create_if_block$2, create_else_block$2], _ = [];
  function E(c, C) {
    return (
      /*value*/
      c[0] ? 0 : 1
    );
  }
  return n = E(r), f = _[n] = h[n](r), {
    c() {
      create_component$2(e.$$.fragment), t = space$2(), f.c(), u = empty$2();
    },
    m(c, C) {
      mount_component$2(e, c, C), insert$4(c, t, C), _[n].m(c, C), insert$4(c, u, C), y = !0;
    },
    p(c, [C]) {
      const b = {};
      C & /*show_label*/
      4 && (b.show_label = /*show_label*/
      c[2]), C & /*value*/
      1 && (b.float = /*value*/
      c[0] === null), C & /*label*/
      2 && (b.label = /*label*/
      c[1] || "File"), e.$set(b);
      let A = n;
      n = E(c), n === A ? _[n].p(c, C) : (group_outros$2(), transition_out$2(_[A], 1, 1, () => {
        _[A] = null;
      }), check_outros$2(), f = _[n], f ? f.p(c, C) : (f = _[n] = h[n](c), f.c()), transition_in$2(f, 1), f.m(u.parentNode, u));
    },
    i(c) {
      y || (transition_in$2(e.$$.fragment, c), transition_in$2(f), y = !0);
    },
    o(c) {
      transition_out$2(e.$$.fragment, c), transition_out$2(f), y = !1;
    },
    d(c) {
      c && (detach$4(t), detach$4(u)), destroy_component$2(e, c), _[n].d(c);
    }
  };
}
function instance$4(r, e, t) {
  let { $$slots: n = {}, $$scope: f } = e, { value: u } = e, { label: y } = e, { show_label: h = !0 } = e, { file_count: _ = "single" } = e, { file_types: E = null } = e, { selectable: c = !1 } = e, { root: C } = e, { height: b = void 0 } = e, { i18n: A } = e, { config: S = {} } = e, { confidenceLabel: s = "" } = e, { representations: o = [] } = e, { moldata: w = null } = e, { molviewer: p = !1 } = e;
  async function v({ detail: I }) {
    t(0, u = I), await tick$1(), l("change", u), l("upload", I);
  }
  function a() {
    t(0, u = null), l("change", null), l("clear");
  }
  const l = createEventDispatcher();
  let g;
  E == null ? g = null : (E = E.map((I) => I.startsWith(".") ? I : I + "/*"), g = E.join(", "));
  let M = !1;
  function L(I) {
    bubble.call(this, r, I);
  }
  const T = () => l("notfound");
  function D(I) {
    M = I, t(13, M);
  }
  return r.$$set = (I) => {
    "value" in I && t(0, u = I.value), "label" in I && t(1, y = I.label), "show_label" in I && t(2, h = I.show_label), "file_count" in I && t(3, _ = I.file_count), "file_types" in I && t(18, E = I.file_types), "selectable" in I && t(4, c = I.selectable), "root" in I && t(5, C = I.root), "height" in I && t(6, b = I.height), "i18n" in I && t(7, A = I.i18n), "config" in I && t(8, S = I.config), "confidenceLabel" in I && t(9, s = I.confidenceLabel), "representations" in I && t(10, o = I.representations), "moldata" in I && t(11, w = I.moldata), "molviewer" in I && t(12, p = I.molviewer), "$$scope" in I && t(23, f = I.$$scope);
  }, r.$$.update = () => {
    r.$$.dirty & /*dragging*/
    8192 && l("drag", M);
  }, [
    u,
    y,
    h,
    _,
    c,
    C,
    b,
    A,
    S,
    s,
    o,
    w,
    p,
    M,
    g,
    v,
    a,
    l,
    E,
    n,
    L,
    T,
    D,
    f
  ];
}
class FileUpload extends SvelteComponent$4 {
  constructor(e) {
    super(), init$4(this, e, instance$4, create_fragment$4, safe_not_equal$4, {
      value: 0,
      label: 1,
      show_label: 2,
      file_count: 3,
      file_types: 18,
      selectable: 4,
      root: 5,
      height: 6,
      i18n: 7,
      config: 8,
      confidenceLabel: 9,
      representations: 10,
      moldata: 11,
      molviewer: 12
    });
  }
}
function pretty_si(r) {
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
  for (; r > 1e3 && t < e.length - 1; )
    r /= 1e3, t++;
  let n = e[t];
  return (Number.isInteger(r) ? r : r.toFixed(1)) + n;
}
const Loader_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$3,
  append: append$3,
  attr: attr$3,
  component_subscribe,
  detach: detach$3,
  element: element$3,
  init: init$3,
  insert: insert$3,
  noop: noop$2,
  safe_not_equal: safe_not_equal$3,
  set_style: set_style$1,
  svg_element: svg_element$1,
  toggle_class: toggle_class$2
} = window.__gradio__svelte__internal, { onMount } = window.__gradio__svelte__internal;
function create_fragment$3(r) {
  let e, t, n, f, u, y, h, _, E, c, C, b;
  return {
    c() {
      e = element$3("div"), t = svg_element$1("svg"), n = svg_element$1("g"), f = svg_element$1("path"), u = svg_element$1("path"), y = svg_element$1("path"), h = svg_element$1("path"), _ = svg_element$1("g"), E = svg_element$1("path"), c = svg_element$1("path"), C = svg_element$1("path"), b = svg_element$1("path"), attr$3(f, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), attr$3(f, "fill", "#FF7C00"), attr$3(f, "fill-opacity", "0.4"), attr$3(f, "class", "svelte-43sxxs"), attr$3(u, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), attr$3(u, "fill", "#FF7C00"), attr$3(u, "class", "svelte-43sxxs"), attr$3(y, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), attr$3(y, "fill", "#FF7C00"), attr$3(y, "fill-opacity", "0.4"), attr$3(y, "class", "svelte-43sxxs"), attr$3(h, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), attr$3(h, "fill", "#FF7C00"), attr$3(h, "class", "svelte-43sxxs"), set_style$1(n, "transform", "translate(" + /*$top*/
      r[1][0] + "px, " + /*$top*/
      r[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(c, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), attr$3(c, "fill", "#FF7C00"), attr$3(c, "class", "svelte-43sxxs"), attr$3(C, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), attr$3(C, "fill", "#FF7C00"), attr$3(C, "fill-opacity", "0.4"), attr$3(C, "class", "svelte-43sxxs"), attr$3(b, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), attr$3(b, "fill", "#FF7C00"), attr$3(b, "class", "svelte-43sxxs"), set_style$1(_, "transform", "translate(" + /*$bottom*/
      r[2][0] + "px, " + /*$bottom*/
      r[2][1] + "px)"), attr$3(t, "viewBox", "-1200 -1200 3000 3000"), attr$3(t, "fill", "none"), attr$3(t, "xmlns", "http://www.w3.org/2000/svg"), attr$3(t, "class", "svelte-43sxxs"), attr$3(e, "class", "svelte-43sxxs"), toggle_class$2(
        e,
        "margin",
        /*margin*/
        r[0]
      );
    },
    m(A, S) {
      insert$3(A, e, S), append$3(e, t), append$3(t, n), append$3(n, f), append$3(n, u), append$3(n, y), append$3(n, h), append$3(t, _), append$3(_, E), append$3(_, c), append$3(_, C), append$3(_, b);
    },
    p(A, [S]) {
      S & /*$top*/
      2 && set_style$1(n, "transform", "translate(" + /*$top*/
      A[1][0] + "px, " + /*$top*/
      A[1][1] + "px)"), S & /*$bottom*/
      4 && set_style$1(_, "transform", "translate(" + /*$bottom*/
      A[2][0] + "px, " + /*$bottom*/
      A[2][1] + "px)"), S & /*margin*/
      1 && toggle_class$2(
        e,
        "margin",
        /*margin*/
        A[0]
      );
    },
    i: noop$2,
    o: noop$2,
    d(A) {
      A && detach$3(e);
    }
  };
}
function instance$3(r, e, t) {
  let n, f, { margin: u = !0 } = e;
  const y = spring([0, 0]);
  component_subscribe(r, y, (b) => t(1, n = b));
  const h = spring([0, 0]);
  component_subscribe(r, h, (b) => t(2, f = b));
  let _;
  async function E() {
    await Promise.all([y.set([125, 140]), h.set([-125, -140])]), await Promise.all([y.set([-125, 140]), h.set([125, -140])]), await Promise.all([y.set([-125, 0]), h.set([125, -0])]), await Promise.all([y.set([125, 0]), h.set([-125, 0])]);
  }
  async function c() {
    await E(), _ || c();
  }
  async function C() {
    await Promise.all([y.set([125, 0]), h.set([-125, 0])]), c();
  }
  return onMount(() => (C(), () => _ = !0)), r.$$set = (b) => {
    "margin" in b && t(0, u = b.margin);
  }, [u, n, f, y, h];
}
class Loader extends SvelteComponent$3 {
  constructor(e) {
    super(), init$3(this, e, instance$3, create_fragment$3, safe_not_equal$3, { margin: 0 });
  }
}
const index_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$2,
  append: append$2,
  attr: attr$2,
  binding_callbacks,
  check_outros: check_outros$1,
  create_component: create_component$1,
  create_slot,
  destroy_component: destroy_component$1,
  destroy_each: destroy_each$1,
  detach: detach$2,
  element: element$2,
  empty: empty$1,
  ensure_array_like: ensure_array_like$1,
  get_all_dirty_from_scope,
  get_slot_changes,
  group_outros: group_outros$1,
  init: init$2,
  insert: insert$2,
  mount_component: mount_component$1,
  noop: noop$1,
  safe_not_equal: safe_not_equal$2,
  set_data: set_data$2,
  set_style,
  space: space$1,
  text: text$2,
  toggle_class: toggle_class$1,
  transition_in: transition_in$1,
  transition_out: transition_out$1,
  update_slot_base
} = window.__gradio__svelte__internal, { tick } = window.__gradio__svelte__internal, { onDestroy } = window.__gradio__svelte__internal, get_error_slot_changes = (r) => ({}), get_error_slot_context = (r) => ({});
function get_each_context$1(r, e, t) {
  const n = r.slice();
  return n[38] = e[t], n[40] = t, n;
}
function get_each_context_1(r, e, t) {
  const n = r.slice();
  return n[38] = e[t], n;
}
function create_if_block_17(r) {
  let e, t = (
    /*i18n*/
    r[1]("common.error") + ""
  ), n, f, u;
  const y = (
    /*#slots*/
    r[29].error
  ), h = create_slot(
    y,
    r,
    /*$$scope*/
    r[28],
    get_error_slot_context
  );
  return {
    c() {
      e = element$2("span"), n = text$2(t), f = space$1(), h && h.c(), attr$2(e, "class", "error svelte-14miwb5");
    },
    m(_, E) {
      insert$2(_, e, E), append$2(e, n), insert$2(_, f, E), h && h.m(_, E), u = !0;
    },
    p(_, E) {
      (!u || E[0] & /*i18n*/
      2) && t !== (t = /*i18n*/
      _[1]("common.error") + "") && set_data$2(n, t), h && h.p && (!u || E[0] & /*$$scope*/
      268435456) && update_slot_base(
        h,
        y,
        _,
        /*$$scope*/
        _[28],
        u ? get_slot_changes(
          y,
          /*$$scope*/
          _[28],
          E,
          get_error_slot_changes
        ) : get_all_dirty_from_scope(
          /*$$scope*/
          _[28]
        ),
        get_error_slot_context
      );
    },
    i(_) {
      u || (transition_in$1(h, _), u = !0);
    },
    o(_) {
      transition_out$1(h, _), u = !1;
    },
    d(_) {
      _ && (detach$2(e), detach$2(f)), h && h.d(_);
    }
  };
}
function create_if_block$1(r) {
  let e, t, n, f, u, y, h, _, E, c = (
    /*variant*/
    r[8] === "default" && /*show_eta_bar*/
    r[18] && /*show_progress*/
    r[6] === "full" && create_if_block_16(r)
  );
  function C(v, a) {
    if (
      /*progress*/
      v[7]
    )
      return create_if_block_11;
    if (
      /*queue_position*/
      v[2] !== null && /*queue_size*/
      v[3] !== void 0 && /*queue_position*/
      v[2] >= 0
    )
      return create_if_block_14;
    if (
      /*queue_position*/
      v[2] === 0
    )
      return create_if_block_15;
  }
  let b = C(r), A = b && b(r), S = (
    /*timer*/
    r[5] && create_if_block_10(r)
  );
  const s = [create_if_block_2, create_if_block_9], o = [];
  function w(v, a) {
    return (
      /*last_progress_level*/
      v[15] != null ? 0 : (
        /*show_progress*/
        v[6] === "full" ? 1 : -1
      )
    );
  }
  ~(u = w(r)) && (y = o[u] = s[u](r));
  let p = !/*timer*/
  r[5] && create_if_block_1$1(r);
  return {
    c() {
      c && c.c(), e = space$1(), t = element$2("div"), A && A.c(), n = space$1(), S && S.c(), f = space$1(), y && y.c(), h = space$1(), p && p.c(), _ = empty$1(), attr$2(t, "class", "progress-text svelte-14miwb5"), toggle_class$1(
        t,
        "meta-text-center",
        /*variant*/
        r[8] === "center"
      ), toggle_class$1(
        t,
        "meta-text",
        /*variant*/
        r[8] === "default"
      );
    },
    m(v, a) {
      c && c.m(v, a), insert$2(v, e, a), insert$2(v, t, a), A && A.m(t, null), append$2(t, n), S && S.m(t, null), insert$2(v, f, a), ~u && o[u].m(v, a), insert$2(v, h, a), p && p.m(v, a), insert$2(v, _, a), E = !0;
    },
    p(v, a) {
      /*variant*/
      v[8] === "default" && /*show_eta_bar*/
      v[18] && /*show_progress*/
      v[6] === "full" ? c ? c.p(v, a) : (c = create_if_block_16(v), c.c(), c.m(e.parentNode, e)) : c && (c.d(1), c = null), b === (b = C(v)) && A ? A.p(v, a) : (A && A.d(1), A = b && b(v), A && (A.c(), A.m(t, n))), /*timer*/
      v[5] ? S ? S.p(v, a) : (S = create_if_block_10(v), S.c(), S.m(t, null)) : S && (S.d(1), S = null), (!E || a[0] & /*variant*/
      256) && toggle_class$1(
        t,
        "meta-text-center",
        /*variant*/
        v[8] === "center"
      ), (!E || a[0] & /*variant*/
      256) && toggle_class$1(
        t,
        "meta-text",
        /*variant*/
        v[8] === "default"
      );
      let l = u;
      u = w(v), u === l ? ~u && o[u].p(v, a) : (y && (group_outros$1(), transition_out$1(o[l], 1, 1, () => {
        o[l] = null;
      }), check_outros$1()), ~u ? (y = o[u], y ? y.p(v, a) : (y = o[u] = s[u](v), y.c()), transition_in$1(y, 1), y.m(h.parentNode, h)) : y = null), /*timer*/
      v[5] ? p && (p.d(1), p = null) : p ? p.p(v, a) : (p = create_if_block_1$1(v), p.c(), p.m(_.parentNode, _));
    },
    i(v) {
      E || (transition_in$1(y), E = !0);
    },
    o(v) {
      transition_out$1(y), E = !1;
    },
    d(v) {
      v && (detach$2(e), detach$2(t), detach$2(f), detach$2(h), detach$2(_)), c && c.d(v), A && A.d(), S && S.d(), ~u && o[u].d(v), p && p.d(v);
    }
  };
}
function create_if_block_16(r) {
  let e, t = `translateX(${/*eta_level*/
  (r[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      e = element$2("div"), attr$2(e, "class", "eta-bar svelte-14miwb5"), set_style(e, "transform", t);
    },
    m(n, f) {
      insert$2(n, e, f);
    },
    p(n, f) {
      f[0] & /*eta_level*/
      131072 && t !== (t = `translateX(${/*eta_level*/
      (n[17] || 0) * 100 - 100}%)`) && set_style(e, "transform", t);
    },
    d(n) {
      n && detach$2(e);
    }
  };
}
function create_if_block_15(r) {
  let e;
  return {
    c() {
      e = text$2("processing |");
    },
    m(t, n) {
      insert$2(t, e, n);
    },
    p: noop$1,
    d(t) {
      t && detach$2(e);
    }
  };
}
function create_if_block_14(r) {
  let e, t = (
    /*queue_position*/
    r[2] + 1 + ""
  ), n, f, u, y;
  return {
    c() {
      e = text$2("queue: "), n = text$2(t), f = text$2("/"), u = text$2(
        /*queue_size*/
        r[3]
      ), y = text$2(" |");
    },
    m(h, _) {
      insert$2(h, e, _), insert$2(h, n, _), insert$2(h, f, _), insert$2(h, u, _), insert$2(h, y, _);
    },
    p(h, _) {
      _[0] & /*queue_position*/
      4 && t !== (t = /*queue_position*/
      h[2] + 1 + "") && set_data$2(n, t), _[0] & /*queue_size*/
      8 && set_data$2(
        u,
        /*queue_size*/
        h[3]
      );
    },
    d(h) {
      h && (detach$2(e), detach$2(n), detach$2(f), detach$2(u), detach$2(y));
    }
  };
}
function create_if_block_11(r) {
  let e, t = ensure_array_like$1(
    /*progress*/
    r[7]
  ), n = [];
  for (let f = 0; f < t.length; f += 1)
    n[f] = create_each_block_1(get_each_context_1(r, t, f));
  return {
    c() {
      for (let f = 0; f < n.length; f += 1)
        n[f].c();
      e = empty$1();
    },
    m(f, u) {
      for (let y = 0; y < n.length; y += 1)
        n[y] && n[y].m(f, u);
      insert$2(f, e, u);
    },
    p(f, u) {
      if (u[0] & /*progress*/
      128) {
        t = ensure_array_like$1(
          /*progress*/
          f[7]
        );
        let y;
        for (y = 0; y < t.length; y += 1) {
          const h = get_each_context_1(f, t, y);
          n[y] ? n[y].p(h, u) : (n[y] = create_each_block_1(h), n[y].c(), n[y].m(e.parentNode, e));
        }
        for (; y < n.length; y += 1)
          n[y].d(1);
        n.length = t.length;
      }
    },
    d(f) {
      f && detach$2(e), destroy_each$1(n, f);
    }
  };
}
function create_if_block_12(r) {
  let e, t = (
    /*p*/
    r[38].unit + ""
  ), n, f, u = " ", y;
  function h(c, C) {
    return (
      /*p*/
      c[38].length != null ? create_if_block_13 : create_else_block$1
    );
  }
  let _ = h(r), E = _(r);
  return {
    c() {
      E.c(), e = space$1(), n = text$2(t), f = text$2(" | "), y = text$2(u);
    },
    m(c, C) {
      E.m(c, C), insert$2(c, e, C), insert$2(c, n, C), insert$2(c, f, C), insert$2(c, y, C);
    },
    p(c, C) {
      _ === (_ = h(c)) && E ? E.p(c, C) : (E.d(1), E = _(c), E && (E.c(), E.m(e.parentNode, e))), C[0] & /*progress*/
      128 && t !== (t = /*p*/
      c[38].unit + "") && set_data$2(n, t);
    },
    d(c) {
      c && (detach$2(e), detach$2(n), detach$2(f), detach$2(y)), E.d(c);
    }
  };
}
function create_else_block$1(r) {
  let e = pretty_si(
    /*p*/
    r[38].index || 0
  ) + "", t;
  return {
    c() {
      t = text$2(e);
    },
    m(n, f) {
      insert$2(n, t, f);
    },
    p(n, f) {
      f[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        n[38].index || 0
      ) + "") && set_data$2(t, e);
    },
    d(n) {
      n && detach$2(t);
    }
  };
}
function create_if_block_13(r) {
  let e = pretty_si(
    /*p*/
    r[38].index || 0
  ) + "", t, n, f = pretty_si(
    /*p*/
    r[38].length
  ) + "", u;
  return {
    c() {
      t = text$2(e), n = text$2("/"), u = text$2(f);
    },
    m(y, h) {
      insert$2(y, t, h), insert$2(y, n, h), insert$2(y, u, h);
    },
    p(y, h) {
      h[0] & /*progress*/
      128 && e !== (e = pretty_si(
        /*p*/
        y[38].index || 0
      ) + "") && set_data$2(t, e), h[0] & /*progress*/
      128 && f !== (f = pretty_si(
        /*p*/
        y[38].length
      ) + "") && set_data$2(u, f);
    },
    d(y) {
      y && (detach$2(t), detach$2(n), detach$2(u));
    }
  };
}
function create_each_block_1(r) {
  let e, t = (
    /*p*/
    r[38].index != null && create_if_block_12(r)
  );
  return {
    c() {
      t && t.c(), e = empty$1();
    },
    m(n, f) {
      t && t.m(n, f), insert$2(n, e, f);
    },
    p(n, f) {
      /*p*/
      n[38].index != null ? t ? t.p(n, f) : (t = create_if_block_12(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
    },
    d(n) {
      n && detach$2(e), t && t.d(n);
    }
  };
}
function create_if_block_10(r) {
  let e, t = (
    /*eta*/
    r[0] ? `/${/*formatted_eta*/
    r[19]}` : ""
  ), n, f;
  return {
    c() {
      e = text$2(
        /*formatted_timer*/
        r[20]
      ), n = text$2(t), f = text$2("s");
    },
    m(u, y) {
      insert$2(u, e, y), insert$2(u, n, y), insert$2(u, f, y);
    },
    p(u, y) {
      y[0] & /*formatted_timer*/
      1048576 && set_data$2(
        e,
        /*formatted_timer*/
        u[20]
      ), y[0] & /*eta, formatted_eta*/
      524289 && t !== (t = /*eta*/
      u[0] ? `/${/*formatted_eta*/
      u[19]}` : "") && set_data$2(n, t);
    },
    d(u) {
      u && (detach$2(e), detach$2(n), detach$2(f));
    }
  };
}
function create_if_block_9(r) {
  let e, t;
  return e = new Loader({
    props: { margin: (
      /*variant*/
      r[8] === "default"
    ) }
  }), {
    c() {
      create_component$1(e.$$.fragment);
    },
    m(n, f) {
      mount_component$1(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f[0] & /*variant*/
      256 && (u.margin = /*variant*/
      n[8] === "default"), e.$set(u);
    },
    i(n) {
      t || (transition_in$1(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out$1(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component$1(e, n);
    }
  };
}
function create_if_block_2(r) {
  let e, t, n, f, u, y = `${/*last_progress_level*/
  r[15] * 100}%`, h = (
    /*progress*/
    r[7] != null && create_if_block_3(r)
  );
  return {
    c() {
      e = element$2("div"), t = element$2("div"), h && h.c(), n = space$1(), f = element$2("div"), u = element$2("div"), attr$2(t, "class", "progress-level-inner svelte-14miwb5"), attr$2(u, "class", "progress-bar svelte-14miwb5"), set_style(u, "width", y), attr$2(f, "class", "progress-bar-wrap svelte-14miwb5"), attr$2(e, "class", "progress-level svelte-14miwb5");
    },
    m(_, E) {
      insert$2(_, e, E), append$2(e, t), h && h.m(t, null), append$2(e, n), append$2(e, f), append$2(f, u), r[30](u);
    },
    p(_, E) {
      /*progress*/
      _[7] != null ? h ? h.p(_, E) : (h = create_if_block_3(_), h.c(), h.m(t, null)) : h && (h.d(1), h = null), E[0] & /*last_progress_level*/
      32768 && y !== (y = `${/*last_progress_level*/
      _[15] * 100}%`) && set_style(u, "width", y);
    },
    i: noop$1,
    o: noop$1,
    d(_) {
      _ && detach$2(e), h && h.d(), r[30](null);
    }
  };
}
function create_if_block_3(r) {
  let e, t = ensure_array_like$1(
    /*progress*/
    r[7]
  ), n = [];
  for (let f = 0; f < t.length; f += 1)
    n[f] = create_each_block$1(get_each_context$1(r, t, f));
  return {
    c() {
      for (let f = 0; f < n.length; f += 1)
        n[f].c();
      e = empty$1();
    },
    m(f, u) {
      for (let y = 0; y < n.length; y += 1)
        n[y] && n[y].m(f, u);
      insert$2(f, e, u);
    },
    p(f, u) {
      if (u[0] & /*progress_level, progress*/
      16512) {
        t = ensure_array_like$1(
          /*progress*/
          f[7]
        );
        let y;
        for (y = 0; y < t.length; y += 1) {
          const h = get_each_context$1(f, t, y);
          n[y] ? n[y].p(h, u) : (n[y] = create_each_block$1(h), n[y].c(), n[y].m(e.parentNode, e));
        }
        for (; y < n.length; y += 1)
          n[y].d(1);
        n.length = t.length;
      }
    },
    d(f) {
      f && detach$2(e), destroy_each$1(n, f);
    }
  };
}
function create_if_block_4(r) {
  let e, t, n, f, u = (
    /*i*/
    r[40] !== 0 && create_if_block_8()
  ), y = (
    /*p*/
    r[38].desc != null && create_if_block_7(r)
  ), h = (
    /*p*/
    r[38].desc != null && /*progress_level*/
    r[14] && /*progress_level*/
    r[14][
      /*i*/
      r[40]
    ] != null && create_if_block_6()
  ), _ = (
    /*progress_level*/
    r[14] != null && create_if_block_5(r)
  );
  return {
    c() {
      u && u.c(), e = space$1(), y && y.c(), t = space$1(), h && h.c(), n = space$1(), _ && _.c(), f = empty$1();
    },
    m(E, c) {
      u && u.m(E, c), insert$2(E, e, c), y && y.m(E, c), insert$2(E, t, c), h && h.m(E, c), insert$2(E, n, c), _ && _.m(E, c), insert$2(E, f, c);
    },
    p(E, c) {
      /*p*/
      E[38].desc != null ? y ? y.p(E, c) : (y = create_if_block_7(E), y.c(), y.m(t.parentNode, t)) : y && (y.d(1), y = null), /*p*/
      E[38].desc != null && /*progress_level*/
      E[14] && /*progress_level*/
      E[14][
        /*i*/
        E[40]
      ] != null ? h || (h = create_if_block_6(), h.c(), h.m(n.parentNode, n)) : h && (h.d(1), h = null), /*progress_level*/
      E[14] != null ? _ ? _.p(E, c) : (_ = create_if_block_5(E), _.c(), _.m(f.parentNode, f)) : _ && (_.d(1), _ = null);
    },
    d(E) {
      E && (detach$2(e), detach$2(t), detach$2(n), detach$2(f)), u && u.d(E), y && y.d(E), h && h.d(E), _ && _.d(E);
    }
  };
}
function create_if_block_8(r) {
  let e;
  return {
    c() {
      e = text$2(" /");
    },
    m(t, n) {
      insert$2(t, e, n);
    },
    d(t) {
      t && detach$2(e);
    }
  };
}
function create_if_block_7(r) {
  let e = (
    /*p*/
    r[38].desc + ""
  ), t;
  return {
    c() {
      t = text$2(e);
    },
    m(n, f) {
      insert$2(n, t, f);
    },
    p(n, f) {
      f[0] & /*progress*/
      128 && e !== (e = /*p*/
      n[38].desc + "") && set_data$2(t, e);
    },
    d(n) {
      n && detach$2(t);
    }
  };
}
function create_if_block_6(r) {
  let e;
  return {
    c() {
      e = text$2("-");
    },
    m(t, n) {
      insert$2(t, e, n);
    },
    d(t) {
      t && detach$2(e);
    }
  };
}
function create_if_block_5(r) {
  let e = (100 * /*progress_level*/
  (r[14][
    /*i*/
    r[40]
  ] || 0)).toFixed(1) + "", t, n;
  return {
    c() {
      t = text$2(e), n = text$2("%");
    },
    m(f, u) {
      insert$2(f, t, u), insert$2(f, n, u);
    },
    p(f, u) {
      u[0] & /*progress_level*/
      16384 && e !== (e = (100 * /*progress_level*/
      (f[14][
        /*i*/
        f[40]
      ] || 0)).toFixed(1) + "") && set_data$2(t, e);
    },
    d(f) {
      f && (detach$2(t), detach$2(n));
    }
  };
}
function create_each_block$1(r) {
  let e, t = (
    /*p*/
    (r[38].desc != null || /*progress_level*/
    r[14] && /*progress_level*/
    r[14][
      /*i*/
      r[40]
    ] != null) && create_if_block_4(r)
  );
  return {
    c() {
      t && t.c(), e = empty$1();
    },
    m(n, f) {
      t && t.m(n, f), insert$2(n, e, f);
    },
    p(n, f) {
      /*p*/
      n[38].desc != null || /*progress_level*/
      n[14] && /*progress_level*/
      n[14][
        /*i*/
        n[40]
      ] != null ? t ? t.p(n, f) : (t = create_if_block_4(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
    },
    d(n) {
      n && detach$2(e), t && t.d(n);
    }
  };
}
function create_if_block_1$1(r) {
  let e, t;
  return {
    c() {
      e = element$2("p"), t = text$2(
        /*loading_text*/
        r[9]
      ), attr$2(e, "class", "loading svelte-14miwb5");
    },
    m(n, f) {
      insert$2(n, e, f), append$2(e, t);
    },
    p(n, f) {
      f[0] & /*loading_text*/
      512 && set_data$2(
        t,
        /*loading_text*/
        n[9]
      );
    },
    d(n) {
      n && detach$2(e);
    }
  };
}
function create_fragment$2(r) {
  let e, t, n, f, u;
  const y = [create_if_block$1, create_if_block_17], h = [];
  function _(E, c) {
    return (
      /*status*/
      E[4] === "pending" ? 0 : (
        /*status*/
        E[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(t = _(r)) && (n = h[t] = y[t](r)), {
    c() {
      e = element$2("div"), n && n.c(), attr$2(e, "class", f = "wrap " + /*variant*/
      r[8] + " " + /*show_progress*/
      r[6] + " svelte-14miwb5"), toggle_class$1(e, "hide", !/*status*/
      r[4] || /*status*/
      r[4] === "complete" || /*show_progress*/
      r[6] === "hidden"), toggle_class$1(
        e,
        "translucent",
        /*variant*/
        r[8] === "center" && /*status*/
        (r[4] === "pending" || /*status*/
        r[4] === "error") || /*translucent*/
        r[11] || /*show_progress*/
        r[6] === "minimal"
      ), toggle_class$1(
        e,
        "generating",
        /*status*/
        r[4] === "generating"
      ), toggle_class$1(
        e,
        "border",
        /*border*/
        r[12]
      ), set_style(
        e,
        "position",
        /*absolute*/
        r[10] ? "absolute" : "static"
      ), set_style(
        e,
        "padding",
        /*absolute*/
        r[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(E, c) {
      insert$2(E, e, c), ~t && h[t].m(e, null), r[31](e), u = !0;
    },
    p(E, c) {
      let C = t;
      t = _(E), t === C ? ~t && h[t].p(E, c) : (n && (group_outros$1(), transition_out$1(h[C], 1, 1, () => {
        h[C] = null;
      }), check_outros$1()), ~t ? (n = h[t], n ? n.p(E, c) : (n = h[t] = y[t](E), n.c()), transition_in$1(n, 1), n.m(e, null)) : n = null), (!u || c[0] & /*variant, show_progress*/
      320 && f !== (f = "wrap " + /*variant*/
      E[8] + " " + /*show_progress*/
      E[6] + " svelte-14miwb5")) && attr$2(e, "class", f), (!u || c[0] & /*variant, show_progress, status, show_progress*/
      336) && toggle_class$1(e, "hide", !/*status*/
      E[4] || /*status*/
      E[4] === "complete" || /*show_progress*/
      E[6] === "hidden"), (!u || c[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && toggle_class$1(
        e,
        "translucent",
        /*variant*/
        E[8] === "center" && /*status*/
        (E[4] === "pending" || /*status*/
        E[4] === "error") || /*translucent*/
        E[11] || /*show_progress*/
        E[6] === "minimal"
      ), (!u || c[0] & /*variant, show_progress, status*/
      336) && toggle_class$1(
        e,
        "generating",
        /*status*/
        E[4] === "generating"
      ), (!u || c[0] & /*variant, show_progress, border*/
      4416) && toggle_class$1(
        e,
        "border",
        /*border*/
        E[12]
      ), c[0] & /*absolute*/
      1024 && set_style(
        e,
        "position",
        /*absolute*/
        E[10] ? "absolute" : "static"
      ), c[0] & /*absolute*/
      1024 && set_style(
        e,
        "padding",
        /*absolute*/
        E[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(E) {
      u || (transition_in$1(n), u = !0);
    },
    o(E) {
      transition_out$1(n), u = !1;
    },
    d(E) {
      E && detach$2(e), ~t && h[t].d(), r[31](null);
    }
  };
}
let items = [], called = !1;
async function scroll_into_view(r, e = !0) {
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && e !== !0)) {
    if (items.push(r), !called)
      called = !0;
    else
      return;
    await tick(), requestAnimationFrame(() => {
      let t = [0, 0];
      for (let n = 0; n < items.length; n++) {
        const u = items[n].getBoundingClientRect();
        (n === 0 || u.top + window.scrollY <= t[0]) && (t[0] = u.top + window.scrollY, t[1] = n);
      }
      window.scrollTo({ top: t[0] - 20, behavior: "smooth" }), called = !1, items = [];
    });
  }
}
function instance$2(r, e, t) {
  let n, { $$slots: f = {}, $$scope: u } = e, { i18n: y } = e, { eta: h = null } = e, { queue: _ = !1 } = e, { queue_position: E } = e, { queue_size: c } = e, { status: C } = e, { scroll_to_output: b = !1 } = e, { timer: A = !0 } = e, { show_progress: S = "full" } = e, { message: s = null } = e, { progress: o = null } = e, { variant: w = "default" } = e, { loading_text: p = "Loading..." } = e, { absolute: v = !0 } = e, { translucent: a = !1 } = e, { border: l = !1 } = e, { autoscroll: g } = e, M, L = !1, T = 0, D = 0, I = null, z = 0, P = null, B, F = null, N = !0;
  const $ = () => {
    t(25, T = performance.now()), t(26, D = 0), L = !0, k();
  };
  function k() {
    requestAnimationFrame(() => {
      t(26, D = (performance.now() - T) / 1e3), L && k();
    });
  }
  function G() {
    t(26, D = 0), L && (L = !1);
  }
  onDestroy(() => {
    L && G();
  });
  let H = null;
  function U(Q) {
    binding_callbacks[Q ? "unshift" : "push"](() => {
      F = Q, t(16, F), t(7, o), t(14, P), t(15, B);
    });
  }
  function V(Q) {
    binding_callbacks[Q ? "unshift" : "push"](() => {
      M = Q, t(13, M);
    });
  }
  return r.$$set = (Q) => {
    "i18n" in Q && t(1, y = Q.i18n), "eta" in Q && t(0, h = Q.eta), "queue" in Q && t(21, _ = Q.queue), "queue_position" in Q && t(2, E = Q.queue_position), "queue_size" in Q && t(3, c = Q.queue_size), "status" in Q && t(4, C = Q.status), "scroll_to_output" in Q && t(22, b = Q.scroll_to_output), "timer" in Q && t(5, A = Q.timer), "show_progress" in Q && t(6, S = Q.show_progress), "message" in Q && t(23, s = Q.message), "progress" in Q && t(7, o = Q.progress), "variant" in Q && t(8, w = Q.variant), "loading_text" in Q && t(9, p = Q.loading_text), "absolute" in Q && t(10, v = Q.absolute), "translucent" in Q && t(11, a = Q.translucent), "border" in Q && t(12, l = Q.border), "autoscroll" in Q && t(24, g = Q.autoscroll), "$$scope" in Q && t(28, u = Q.$$scope);
  }, r.$$.update = () => {
    r.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
    169869313 && (h === null ? t(0, h = I) : _ && t(0, h = (performance.now() - T) / 1e3 + h), h != null && (t(19, H = h.toFixed(1)), t(27, I = h))), r.$$.dirty[0] & /*eta, timer_diff*/
    67108865 && t(17, z = h === null || h <= 0 || !D ? null : Math.min(D / h, 1)), r.$$.dirty[0] & /*progress*/
    128 && o != null && t(18, N = !1), r.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (o != null ? t(14, P = o.map((Q) => {
      if (Q.index != null && Q.length != null)
        return Q.index / Q.length;
      if (Q.progress != null)
        return Q.progress;
    })) : t(14, P = null), P ? (t(15, B = P[P.length - 1]), F && (B === 0 ? t(16, F.style.transition = "0", F) : t(16, F.style.transition = "150ms", F))) : t(15, B = void 0)), r.$$.dirty[0] & /*status*/
    16 && (C === "pending" ? $() : G()), r.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && M && b && (C === "pending" || C === "complete") && scroll_into_view(M, g), r.$$.dirty[0] & /*status, message*/
    8388624, r.$$.dirty[0] & /*timer_diff*/
    67108864 && t(20, n = D.toFixed(1));
  }, [
    h,
    y,
    E,
    c,
    C,
    A,
    S,
    o,
    w,
    p,
    v,
    a,
    l,
    M,
    P,
    B,
    F,
    z,
    N,
    H,
    n,
    _,
    b,
    s,
    g,
    T,
    D,
    I,
    u,
    f,
    U,
    V
  ];
}
class Static extends SvelteComponent$2 {
  constructor(e) {
    super(), init$2(
      this,
      e,
      instance$2,
      create_fragment$2,
      safe_not_equal$2,
      {
        i18n: 1,
        eta: 0,
        queue: 21,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 22,
        timer: 5,
        show_progress: 6,
        message: 23,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 24
      },
      null,
      [-1, -1]
    );
  }
}
const ToastContent_svelte_svelte_type_style_lang = "", Toast_svelte_svelte_type_style_lang = "", Example_svelte_svelte_type_style_lang = "", {
  SvelteComponent: SvelteComponent$1,
  append: append$1,
  attr: attr$1,
  detach: detach$1,
  element: element$1,
  init: init$1,
  insert: insert$1,
  noop,
  safe_not_equal: safe_not_equal$1,
  set_data: set_data$1,
  text: text$1,
  toggle_class
} = window.__gradio__svelte__internal;
function create_fragment$1(r) {
  let e, t = (Array.isArray(
    /*value*/
    r[0]
  ) ? (
    /*value*/
    r[0].join(", ")
  ) : (
    /*value*/
    r[0]
  )) + "", n;
  return {
    c() {
      e = element$1("div"), n = text$1(t), attr$1(e, "class", "svelte-1hgn91n"), toggle_class(
        e,
        "table",
        /*type*/
        r[1] === "table"
      ), toggle_class(
        e,
        "gallery",
        /*type*/
        r[1] === "gallery"
      ), toggle_class(
        e,
        "selected",
        /*selected*/
        r[2]
      );
    },
    m(f, u) {
      insert$1(f, e, u), append$1(e, n);
    },
    p(f, [u]) {
      u & /*value*/
      1 && t !== (t = (Array.isArray(
        /*value*/
        f[0]
      ) ? (
        /*value*/
        f[0].join(", ")
      ) : (
        /*value*/
        f[0]
      )) + "") && set_data$1(n, t), u & /*type*/
      2 && toggle_class(
        e,
        "table",
        /*type*/
        f[1] === "table"
      ), u & /*type*/
      2 && toggle_class(
        e,
        "gallery",
        /*type*/
        f[1] === "gallery"
      ), u & /*selected*/
      4 && toggle_class(
        e,
        "selected",
        /*selected*/
        f[2]
      );
    },
    i: noop,
    o: noop,
    d(f) {
      f && detach$1(e);
    }
  };
}
function instance$1(r, e, t) {
  let { value: n } = e, { type: f } = e, { selected: u = !1 } = e;
  return r.$$set = (y) => {
    "value" in y && t(0, n = y.value), "type" in y && t(1, f = y.type), "selected" in y && t(2, u = y.selected);
  }, [n, f, u];
}
class Example extends SvelteComponent$1 {
  constructor(e) {
    super(), init$1(this, e, instance$1, create_fragment$1, safe_not_equal$1, { value: 0, type: 1, selected: 2 });
  }
}
const Index_svelte_svelte_type_style_lang = "", {
  SvelteComponent,
  append,
  assign,
  attr,
  check_outros,
  create_component,
  destroy_component,
  destroy_each,
  detach,
  element,
  empty,
  ensure_array_like,
  flush,
  get_spread_object,
  get_spread_update,
  group_outros,
  init,
  insert,
  mount_component,
  safe_not_equal,
  set_data,
  space,
  svg_element,
  text,
  transition_in,
  transition_out
} = window.__gradio__svelte__internal;
function get_each_context(r, e, t) {
  const n = r.slice();
  return n[40] = e[t], n;
}
function create_else_block(r) {
  let e, t;
  return e = new FileUpload({
    props: {
      label: (
        /*label*/
        r[6]
      ),
      show_label: (
        /*show_label*/
        r[7]
      ),
      value: (
        /*_value*/
        r[22]
      ),
      file_count: (
        /*file_count*/
        r[18]
      ),
      file_types: (
        /*file_types*/
        r[19]
      ),
      selectable: (
        /*_selectable*/
        r[12]
      ),
      root: (
        /*root*/
        r[5]
      ),
      height: (
        /*height*/
        r[8]
      ),
      representations: (
        /*representations*/
        r[24]
      ),
      config: (
        /*config*/
        r[9]
      ),
      confidenceLabel: (
        /*confidenceLabel*/
        r[10]
      ),
      moldata: (
        /*moldata*/
        r[20]
      ),
      molviewer: (
        /*showviewer*/
        r[11]
      ),
      i18n: (
        /*gradio*/
        r[17].i18n
      ),
      $$slots: { default: [create_default_slot_1] },
      $$scope: { ctx: r }
    }
  }), e.$on(
    "change",
    /*change_handler*/
    r[30]
  ), e.$on(
    "drag",
    /*drag_handler*/
    r[31]
  ), e.$on(
    "clear",
    /*clear_handler*/
    r[32]
  ), e.$on(
    "select",
    /*select_handler_1*/
    r[33]
  ), e.$on(
    "notfound",
    /*notfound_handler*/
    r[34]
  ), e.$on(
    "upload",
    /*upload_handler*/
    r[35]
  ), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, f) {
      mount_component(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f[0] & /*label*/
      64 && (u.label = /*label*/
      n[6]), f[0] & /*show_label*/
      128 && (u.show_label = /*show_label*/
      n[7]), f[0] & /*_value*/
      4194304 && (u.value = /*_value*/
      n[22]), f[0] & /*file_count*/
      262144 && (u.file_count = /*file_count*/
      n[18]), f[0] & /*file_types*/
      524288 && (u.file_types = /*file_types*/
      n[19]), f[0] & /*_selectable*/
      4096 && (u.selectable = /*_selectable*/
      n[12]), f[0] & /*root*/
      32 && (u.root = /*root*/
      n[5]), f[0] & /*height*/
      256 && (u.height = /*height*/
      n[8]), f[0] & /*config*/
      512 && (u.config = /*config*/
      n[9]), f[0] & /*confidenceLabel*/
      1024 && (u.confidenceLabel = /*confidenceLabel*/
      n[10]), f[0] & /*moldata*/
      1048576 && (u.moldata = /*moldata*/
      n[20]), f[0] & /*showviewer*/
      2048 && (u.molviewer = /*showviewer*/
      n[11]), f[0] & /*gradio*/
      131072 && (u.i18n = /*gradio*/
      n[17].i18n), f[0] & /*gradio*/
      131072 | f[1] & /*$$scope*/
      4096 && (u.$$scope = { dirty: f, ctx: n }), e.$set(u);
    },
    i(n) {
      t || (transition_in(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function create_if_block_1(r) {
  let e, t;
  return e = new File_1({
    props: {
      selectable: (
        /*_selectable*/
        r[12]
      ),
      value: (
        /*_value*/
        r[22]
      ),
      label: (
        /*label*/
        r[6]
      ),
      show_label: (
        /*show_label*/
        r[7]
      ),
      height: (
        /*height*/
        r[8]
      ),
      representations: (
        /*representations*/
        r[24]
      ),
      config: (
        /*config*/
        r[9]
      ),
      confidenceLabel: (
        /*confidenceLabel*/
        r[10]
      ),
      moldata: (
        /*moldata*/
        r[20]
      ),
      errors: (
        /*errors*/
        r[21]
      ),
      i18n: (
        /*gradio*/
        r[17].i18n
      ),
      molviewer: (
        /*showviewer*/
        r[11]
      )
    }
  }), e.$on(
    "select",
    /*select_handler*/
    r[29]
  ), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, f) {
      mount_component(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f[0] & /*_selectable*/
      4096 && (u.selectable = /*_selectable*/
      n[12]), f[0] & /*_value*/
      4194304 && (u.value = /*_value*/
      n[22]), f[0] & /*label*/
      64 && (u.label = /*label*/
      n[6]), f[0] & /*show_label*/
      128 && (u.show_label = /*show_label*/
      n[7]), f[0] & /*height*/
      256 && (u.height = /*height*/
      n[8]), f[0] & /*config*/
      512 && (u.config = /*config*/
      n[9]), f[0] & /*confidenceLabel*/
      1024 && (u.confidenceLabel = /*confidenceLabel*/
      n[10]), f[0] & /*moldata*/
      1048576 && (u.moldata = /*moldata*/
      n[20]), f[0] & /*errors*/
      2097152 && (u.errors = /*errors*/
      n[21]), f[0] & /*gradio*/
      131072 && (u.i18n = /*gradio*/
      n[17].i18n), f[0] & /*showviewer*/
      2048 && (u.molviewer = /*showviewer*/
      n[11]), e.$set(u);
    },
    i(n) {
      t || (transition_in(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function create_default_slot_1(r) {
  let e, t;
  return e = new UploadText({
    props: {
      i18n: (
        /*gradio*/
        r[17].i18n
      ),
      type: "file"
    }
  }), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, f) {
      mount_component(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f[0] & /*gradio*/
      131072 && (u.i18n = /*gradio*/
      n[17].i18n), e.$set(u);
    },
    i(n) {
      t || (transition_in(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
function create_if_block(r) {
  let e, t, n, f, u, y, h, _, E, c, C = ensure_array_like(
    /*errors*/
    r[21]
  ), b = [];
  for (let A = 0; A < C.length; A += 1)
    b[A] = create_each_block(get_each_context(r, C, A));
  return {
    c() {
      e = element("div"), t = svg_element("svg"), n = svg_element("path"), f = space(), u = element("span"), u.textContent = "Error in the representations", y = space(), h = element("div"), _ = element("span"), _.textContent = "Couldn't display Molecule. Fix the following problems:", E = space(), c = element("ul");
      for (let A = 0; A < b.length; A += 1)
        b[A].c();
      attr(n, "stroke-linecap", "round"), attr(n, "stroke-linejoin", "round"), attr(n, "d", "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"), attr(t, "class", "flex-shrink-0 inline w-4 h-4 mr-3 mt-[2px] svelte-1j3z0by"), attr(t, "xmlns", "http://www.w3.org/2000/svg"), attr(t, "fill", "none"), attr(t, "viewBox", "0 0 24 24"), attr(t, "stroke-width", "1.5"), attr(t, "stroke", "currentColor"), attr(u, "class", "sr-only svelte-1j3z0by"), attr(_, "class", "font-medium svelte-1j3z0by"), attr(c, "class", "mt-1.5 ml-4 list-disc list-inside svelte-1j3z0by"), attr(e, "class", "flex m-2 p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400 svelte-1j3z0by"), attr(e, "role", "alert");
    },
    m(A, S) {
      insert(A, e, S), append(e, t), append(t, n), append(e, f), append(e, u), append(e, y), append(e, h), append(h, _), append(h, E), append(h, c);
      for (let s = 0; s < b.length; s += 1)
        b[s] && b[s].m(c, null);
    },
    p(A, S) {
      if (S[0] & /*errors*/
      2097152) {
        C = ensure_array_like(
          /*errors*/
          A[21]
        );
        let s;
        for (s = 0; s < C.length; s += 1) {
          const o = get_each_context(A, C, s);
          b[s] ? b[s].p(o, S) : (b[s] = create_each_block(o), b[s].c(), b[s].m(c, null));
        }
        for (; s < b.length; s += 1)
          b[s].d(1);
        b.length = C.length;
      }
    },
    d(A) {
      A && detach(e), destroy_each(b, A);
    }
  };
}
function create_each_block(r) {
  let e, t = (
    /*error*/
    r[40] + ""
  ), n;
  return {
    c() {
      e = element("li"), n = text(t);
    },
    m(f, u) {
      insert(f, e, u), append(e, n);
    },
    p(f, u) {
      u[0] & /*errors*/
      2097152 && t !== (t = /*error*/
      f[40] + "") && set_data(n, t);
    },
    d(f) {
      f && detach(e);
    }
  };
}
function create_default_slot(r) {
  var S;
  let e, t, n, f, u, y, h;
  const _ = [
    {
      autoscroll: (
        /*gradio*/
        r[17].autoscroll
      )
    },
    { i18n: (
      /*gradio*/
      r[17].i18n
    ) },
    /*loading_status*/
    r[13],
    {
      status: (
        /*loading_status*/
        ((S = r[13]) == null ? void 0 : S.status) || "complete"
      )
    }
  ];
  let E = {};
  for (let s = 0; s < _.length; s += 1)
    E = assign(E, _[s]);
  e = new Static({ props: E });
  const c = [create_if_block_1, create_else_block], C = [];
  function b(s, o) {
    return (
      /*interactive*/
      s[4] ? 1 : 0
    );
  }
  n = b(r), f = C[n] = c[n](r);
  let A = (
    /*errors*/
    r[21].length > 0 && /*_value*/
    r[22] !== null && create_if_block(r)
  );
  return {
    c() {
      create_component(e.$$.fragment), t = space(), f.c(), u = space(), A && A.c(), y = empty();
    },
    m(s, o) {
      mount_component(e, s, o), insert(s, t, o), C[n].m(s, o), insert(s, u, o), A && A.m(s, o), insert(s, y, o), h = !0;
    },
    p(s, o) {
      var v;
      const w = o[0] & /*gradio, loading_status*/
      139264 ? get_spread_update(_, [
        o[0] & /*gradio*/
        131072 && {
          autoscroll: (
            /*gradio*/
            s[17].autoscroll
          )
        },
        o[0] & /*gradio*/
        131072 && { i18n: (
          /*gradio*/
          s[17].i18n
        ) },
        o[0] & /*loading_status*/
        8192 && get_spread_object(
          /*loading_status*/
          s[13]
        ),
        o[0] & /*loading_status*/
        8192 && {
          status: (
            /*loading_status*/
            ((v = s[13]) == null ? void 0 : v.status) || "complete"
          )
        }
      ]) : {};
      e.$set(w);
      let p = n;
      n = b(s), n === p ? C[n].p(s, o) : (group_outros(), transition_out(C[p], 1, 1, () => {
        C[p] = null;
      }), check_outros(), f = C[n], f ? f.p(s, o) : (f = C[n] = c[n](s), f.c()), transition_in(f, 1), f.m(u.parentNode, u)), /*errors*/
      s[21].length > 0 && /*_value*/
      s[22] !== null ? A ? A.p(s, o) : (A = create_if_block(s), A.c(), A.m(y.parentNode, y)) : A && (A.d(1), A = null);
    },
    i(s) {
      h || (transition_in(e.$$.fragment, s), transition_in(f), h = !0);
    },
    o(s) {
      transition_out(e.$$.fragment, s), transition_out(f), h = !1;
    },
    d(s) {
      s && (detach(t), detach(u), detach(y)), destroy_component(e, s), C[n].d(s), A && A.d(s);
    }
  };
}
function create_fragment(r) {
  let e, t;
  return e = new Block({
    props: {
      visible: (
        /*visible*/
        r[3]
      ),
      variant: (
        /*value*/
        r[0] === null ? "dashed" : "solid"
      ),
      border_mode: (
        /*dragging*/
        r[23] ? "focus" : "base"
      ),
      padding: !1,
      elem_id: (
        /*elem_id*/
        r[1]
      ),
      elem_classes: (
        /*elem_classes*/
        r[2]
      ),
      container: (
        /*container*/
        r[14]
      ),
      scale: (
        /*scale*/
        r[15]
      ),
      min_width: (
        /*min_width*/
        r[16]
      ),
      allow_overflow: !1,
      $$slots: { default: [create_default_slot] },
      $$scope: { ctx: r }
    }
  }), {
    c() {
      create_component(e.$$.fragment);
    },
    m(n, f) {
      mount_component(e, n, f), t = !0;
    },
    p(n, f) {
      const u = {};
      f[0] & /*visible*/
      8 && (u.visible = /*visible*/
      n[3]), f[0] & /*value*/
      1 && (u.variant = /*value*/
      n[0] === null ? "dashed" : "solid"), f[0] & /*dragging*/
      8388608 && (u.border_mode = /*dragging*/
      n[23] ? "focus" : "base"), f[0] & /*elem_id*/
      2 && (u.elem_id = /*elem_id*/
      n[1]), f[0] & /*elem_classes*/
      4 && (u.elem_classes = /*elem_classes*/
      n[2]), f[0] & /*container*/
      16384 && (u.container = /*container*/
      n[14]), f[0] & /*scale*/
      32768 && (u.scale = /*scale*/
      n[15]), f[0] & /*min_width*/
      65536 && (u.min_width = /*min_width*/
      n[16]), f[0] & /*errors, _value, _selectable, label, show_label, height, config, confidenceLabel, moldata, gradio, showviewer, interactive, file_count, file_types, root, value, dragging, loading_status*/
      16662513 | f[1] & /*$$scope*/
      4096 && (u.$$scope = { dirty: f, ctx: n }), e.$set(u);
    },
    i(n) {
      t || (transition_in(e.$$.fragment, n), t = !0);
    },
    o(n) {
      transition_out(e.$$.fragment, n), t = !1;
    },
    d(n) {
      destroy_component(e, n);
    }
  };
}
async function fetchFileContent(r) {
  return await (await fetch(r)).text();
}
function instance(r, e, t) {
  let n, { elem_id: f = "" } = e, { elem_classes: u = [] } = e, { visible: y = !0 } = e, { value: h } = e, { interactive: _ } = e, { root: E } = e, { label: c } = e, { show_label: C } = e, { height: b = void 0 } = e, { reps: A = [] } = e, { config: S = {} } = e, { confidenceLabel: s = "" } = e, { showviewer: o = !0 } = e, { proxy_url: w } = e, { _selectable: p = !1 } = e, { loading_status: v } = e, { container: a = !0 } = e, { scale: l = null } = e, { min_width: g = void 0 } = e, { gradio: M } = e, { file_count: L } = e, { file_types: T = ["file"] } = e, D = n, I = !1, z = {
    model: { type: Number, default: 0 },
    chain: { type: String, default: "" },
    resname: { type: String, default: "" },
    style: {
      type: String,
      default: "cartoon",
      choices: ["cartoon", "stick", "sphere", "surface"]
    },
    color: {
      type: String,
      default: "whiteCarbon",
      choices: [
        "whiteCarbon",
        "orangeCarbon",
        "redCarbon",
        "blackCarbon",
        "blueCarbon",
        "grayCarbon",
        "greenCarbon",
        "cyanCarbon",
        "alphafold",
        "default",
        "Jmol",
        "chain",
        "spectrum"
      ]
    },
    residue_range: { type: String, default: "" },
    around: { type: Number, default: 0 },
    byres: { type: Boolean, default: !1 },
    visible: { type: Boolean, default: !0 }
  }, P = null, B = ["pdb", "sdf", "mol2"], F = [];
  async function N(q) {
    if (q == null)
      return [];
    if (Array.isArray(q)) {
      let me = [];
      for (const ne of q) {
        let fe = ne.orig_name.split(".").pop();
        if (!B.includes(fe)) {
          F.push(`Invalid file extension for ${ne.orig_name}. Expected one of ${B.join(", ")}, got ${fe}`), t(20, P = null);
          continue;
        }
        me.push({
          data: await fetchFileContent(ne.url),
          name: ne.orig_name,
          format: fe,
          asFrames: !1
        });
      }
      t(20, P = me);
    } else if (typeof q == "object" && q !== null) {
      let me = q.orig_name.split(".").pop();
      if (!B.includes(me))
        F.push(`Invalid file extension for ${q.orig_name}. Expected one of ${B.join(", ")}, got ${me}`), t(20, P = null);
      else {
        let ne = await fetchFileContent(q.url);
        t(20, P = [
          {
            data: ne,
            name: q.orig_name,
            format: "pdb",
            asFrames: !1
          }
        ]);
      }
    } else
      t(20, P = null);
  }
  let $ = 0, k = [];
  const G = ({ detail: q }) => M.dispatch("select", q), H = ({ detail: q }) => {
    t(21, F = []), t(0, h = q);
  }, U = ({ detail: q }) => t(23, I = q), V = () => M.dispatch("clear"), Q = ({ detail: q }) => M.dispatch("select", q), ae = () => M.dispatch("error", "identifier not found in database, check spelling"), oe = () => M.dispatch("upload");
  return r.$$set = (q) => {
    "elem_id" in q && t(1, f = q.elem_id), "elem_classes" in q && t(2, u = q.elem_classes), "visible" in q && t(3, y = q.visible), "value" in q && t(0, h = q.value), "interactive" in q && t(4, _ = q.interactive), "root" in q && t(5, E = q.root), "label" in q && t(6, c = q.label), "show_label" in q && t(7, C = q.show_label), "height" in q && t(8, b = q.height), "reps" in q && t(25, A = q.reps), "config" in q && t(9, S = q.config), "confidenceLabel" in q && t(10, s = q.confidenceLabel), "showviewer" in q && t(11, o = q.showviewer), "proxy_url" in q && t(26, w = q.proxy_url), "_selectable" in q && t(12, p = q._selectable), "loading_status" in q && t(13, v = q.loading_status), "container" in q && t(14, a = q.container), "scale" in q && t(15, l = q.scale), "min_width" in q && t(16, g = q.min_width), "gradio" in q && t(17, M = q.gradio), "file_count" in q && t(18, L = q.file_count), "file_types" in q && t(19, T = q.file_types);
  }, r.$$.update = () => {
    r.$$.dirty[0] & /*value, root, proxy_url*/
    67108897 && t(22, n = normalise_file(h, E, w)), r.$$.dirty[0] & /*old_value, _value, gradio*/
    138543104 && JSON.stringify(D) !== JSON.stringify(n) && (M.dispatch("change"), t(27, D = n), console.log("value change", n)), r.$$.dirty[0] & /*moldata*/
    1048576 && t(28, $ = P ? P.length : 0), r.$$.dirty[0] & /*reps, errors, lenMoldata*/
    304087040 && (A.forEach((q) => {
      for (const [me, ne] of Object.entries(z))
        q[me] === void 0 && (q[me] = ne.default), q[me].constructor != ne.type && F.push(`Invalid type for ${me} in reps. Expected ${ne.type}, got ${typeof q[me]}`);
    }), A.forEach((q) => {
      q.model <= $ && k.push(q);
    })), r.$$.dirty[0] & /*_value*/
    4194304 && N(n);
  }, [
    h,
    f,
    u,
    y,
    _,
    E,
    c,
    C,
    b,
    S,
    s,
    o,
    p,
    v,
    a,
    l,
    g,
    M,
    L,
    T,
    P,
    F,
    n,
    I,
    k,
    A,
    w,
    D,
    $,
    G,
    H,
    U,
    V,
    Q,
    ae,
    oe
  ];
}
class Index extends SvelteComponent {
  constructor(e) {
    super(), init(
      this,
      e,
      instance,
      create_fragment,
      safe_not_equal,
      {
        elem_id: 1,
        elem_classes: 2,
        visible: 3,
        value: 0,
        interactive: 4,
        root: 5,
        label: 6,
        show_label: 7,
        height: 8,
        reps: 25,
        config: 9,
        confidenceLabel: 10,
        showviewer: 11,
        proxy_url: 26,
        _selectable: 12,
        loading_status: 13,
        container: 14,
        scale: 15,
        min_width: 16,
        gradio: 17,
        file_count: 18,
        file_types: 19
      },
      null,
      [-1, -1]
    );
  }
  get elem_id() {
    return this.$$.ctx[1];
  }
  set elem_id(e) {
    this.$$set({ elem_id: e }), flush();
  }
  get elem_classes() {
    return this.$$.ctx[2];
  }
  set elem_classes(e) {
    this.$$set({ elem_classes: e }), flush();
  }
  get visible() {
    return this.$$.ctx[3];
  }
  set visible(e) {
    this.$$set({ visible: e }), flush();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(e) {
    this.$$set({ value: e }), flush();
  }
  get interactive() {
    return this.$$.ctx[4];
  }
  set interactive(e) {
    this.$$set({ interactive: e }), flush();
  }
  get root() {
    return this.$$.ctx[5];
  }
  set root(e) {
    this.$$set({ root: e }), flush();
  }
  get label() {
    return this.$$.ctx[6];
  }
  set label(e) {
    this.$$set({ label: e }), flush();
  }
  get show_label() {
    return this.$$.ctx[7];
  }
  set show_label(e) {
    this.$$set({ show_label: e }), flush();
  }
  get height() {
    return this.$$.ctx[8];
  }
  set height(e) {
    this.$$set({ height: e }), flush();
  }
  get reps() {
    return this.$$.ctx[25];
  }
  set reps(e) {
    this.$$set({ reps: e }), flush();
  }
  get config() {
    return this.$$.ctx[9];
  }
  set config(e) {
    this.$$set({ config: e }), flush();
  }
  get confidenceLabel() {
    return this.$$.ctx[10];
  }
  set confidenceLabel(e) {
    this.$$set({ confidenceLabel: e }), flush();
  }
  get showviewer() {
    return this.$$.ctx[11];
  }
  set showviewer(e) {
    this.$$set({ showviewer: e }), flush();
  }
  get proxy_url() {
    return this.$$.ctx[26];
  }
  set proxy_url(e) {
    this.$$set({ proxy_url: e }), flush();
  }
  get _selectable() {
    return this.$$.ctx[12];
  }
  set _selectable(e) {
    this.$$set({ _selectable: e }), flush();
  }
  get loading_status() {
    return this.$$.ctx[13];
  }
  set loading_status(e) {
    this.$$set({ loading_status: e }), flush();
  }
  get container() {
    return this.$$.ctx[14];
  }
  set container(e) {
    this.$$set({ container: e }), flush();
  }
  get scale() {
    return this.$$.ctx[15];
  }
  set scale(e) {
    this.$$set({ scale: e }), flush();
  }
  get min_width() {
    return this.$$.ctx[16];
  }
  set min_width(e) {
    this.$$set({ min_width: e }), flush();
  }
  get gradio() {
    return this.$$.ctx[17];
  }
  set gradio(e) {
    this.$$set({ gradio: e }), flush();
  }
  get file_count() {
    return this.$$.ctx[18];
  }
  set file_count(e) {
    this.$$set({ file_count: e }), flush();
  }
  get file_types() {
    return this.$$.ctx[19];
  }
  set file_types(e) {
    this.$$set({ file_types: e }), flush();
  }
}
export {
  Example as BaseExample,
  File_1 as BaseFile,
  FileUpload as BaseFileUpload,
  FilePreview,
  Index as default
};
