const {
  SvelteComponent: PF,
  assign: MF,
  create_slot: EF,
  detach: TF,
  element: kF,
  get_all_dirty_from_scope: DF,
  get_slot_changes: OF,
  get_spread_update: BF,
  init: RF,
  insert: LF,
  safe_not_equal: NF,
  set_dynamic_element_data: n9,
  set_style: oo,
  toggle_class: eu,
  transition_in: XE,
  transition_out: ZE,
  update_slot_base: FF
} = window.__gradio__svelte__internal;
function VF(e) {
  let t, n, r;
  const i = (
    /*#slots*/
    e[18].default
  ), a = EF(
    i,
    e,
    /*$$scope*/
    e[17],
    null
  );
  let o = [
    { "data-testid": (
      /*test_id*/
      e[7]
    ) },
    { id: (
      /*elem_id*/
      e[2]
    ) },
    {
      class: n = "block " + /*elem_classes*/
      e[3].join(" ") + " svelte-nl1om8"
    }
  ], s = {};
  for (let u = 0; u < o.length; u += 1)
    s = MF(s, o[u]);
  return {
    c() {
      t = kF(
        /*tag*/
        e[14]
      ), a && a.c(), n9(
        /*tag*/
        e[14]
      )(t, s), eu(
        t,
        "hidden",
        /*visible*/
        e[10] === !1
      ), eu(
        t,
        "padded",
        /*padding*/
        e[6]
      ), eu(
        t,
        "border_focus",
        /*border_mode*/
        e[5] === "focus"
      ), eu(
        t,
        "border_contrast",
        /*border_mode*/
        e[5] === "contrast"
      ), eu(t, "hide-container", !/*explicit_call*/
      e[8] && !/*container*/
      e[9]), oo(
        t,
        "height",
        /*get_dimension*/
        e[15](
          /*height*/
          e[0]
        )
      ), oo(t, "width", typeof /*width*/
      e[1] == "number" ? `calc(min(${/*width*/
      e[1]}px, 100%))` : (
        /*get_dimension*/
        e[15](
          /*width*/
          e[1]
        )
      )), oo(
        t,
        "border-style",
        /*variant*/
        e[4]
      ), oo(
        t,
        "overflow",
        /*allow_overflow*/
        e[11] ? "visible" : "hidden"
      ), oo(
        t,
        "flex-grow",
        /*scale*/
        e[12]
      ), oo(t, "min-width", `calc(min(${/*min_width*/
      e[13]}px, 100%))`), oo(t, "border-width", "var(--block-border-width)");
    },
    m(u, l) {
      LF(u, t, l), a && a.m(t, null), r = !0;
    },
    p(u, l) {
      a && a.p && (!r || l & /*$$scope*/
      131072) && FF(
        a,
        i,
        u,
        /*$$scope*/
        u[17],
        r ? OF(
          i,
          /*$$scope*/
          u[17],
          l,
          null
        ) : DF(
          /*$$scope*/
          u[17]
        ),
        null
      ), n9(
        /*tag*/
        u[14]
      )(t, s = BF(o, [
        (!r || l & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          u[7]
        ) },
        (!r || l & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          u[2]
        ) },
        (!r || l & /*elem_classes*/
        8 && n !== (n = "block " + /*elem_classes*/
        u[3].join(" ") + " svelte-nl1om8")) && { class: n }
      ])), eu(
        t,
        "hidden",
        /*visible*/
        u[10] === !1
      ), eu(
        t,
        "padded",
        /*padding*/
        u[6]
      ), eu(
        t,
        "border_focus",
        /*border_mode*/
        u[5] === "focus"
      ), eu(
        t,
        "border_contrast",
        /*border_mode*/
        u[5] === "contrast"
      ), eu(t, "hide-container", !/*explicit_call*/
      u[8] && !/*container*/
      u[9]), l & /*height*/
      1 && oo(
        t,
        "height",
        /*get_dimension*/
        u[15](
          /*height*/
          u[0]
        )
      ), l & /*width*/
      2 && oo(t, "width", typeof /*width*/
      u[1] == "number" ? `calc(min(${/*width*/
      u[1]}px, 100%))` : (
        /*get_dimension*/
        u[15](
          /*width*/
          u[1]
        )
      )), l & /*variant*/
      16 && oo(
        t,
        "border-style",
        /*variant*/
        u[4]
      ), l & /*allow_overflow*/
      2048 && oo(
        t,
        "overflow",
        /*allow_overflow*/
        u[11] ? "visible" : "hidden"
      ), l & /*scale*/
      4096 && oo(
        t,
        "flex-grow",
        /*scale*/
        u[12]
      ), l & /*min_width*/
      8192 && oo(t, "min-width", `calc(min(${/*min_width*/
      u[13]}px, 100%))`);
    },
    i(u) {
      r || (XE(a, u), r = !0);
    },
    o(u) {
      ZE(a, u), r = !1;
    },
    d(u) {
      u && TF(t), a && a.d(u);
    }
  };
}
function GF(e) {
  let t, n = (
    /*tag*/
    e[14] && VF(e)
  );
  return {
    c() {
      n && n.c();
    },
    m(r, i) {
      n && n.m(r, i), t = !0;
    },
    p(r, [i]) {
      /*tag*/
      r[14] && n.p(r, i);
    },
    i(r) {
      t || (XE(n, r), t = !0);
    },
    o(r) {
      ZE(n, r), t = !1;
    },
    d(r) {
      n && n.d(r);
    }
  };
}
function zF(e, t, n) {
  let { $$slots: r = {}, $$scope: i } = t, { height: a = void 0 } = t, { width: o = void 0 } = t, { elem_id: s = "" } = t, { elem_classes: u = [] } = t, { variant: l = "solid" } = t, { border_mode: c = "base" } = t, { padding: d = !0 } = t, { type: f = "normal" } = t, { test_id: p = void 0 } = t, { explicit_call: g = !1 } = t, { container: m = !0 } = t, { visible: v = !0 } = t, { allow_overflow: h = !0 } = t, { scale: y = null } = t, { min_width: x = 0 } = t, S = f === "fieldset" ? "fieldset" : "div";
  const b = (_) => {
    if (_ !== void 0) {
      if (typeof _ == "number")
        return _ + "px";
      if (typeof _ == "string")
        return _;
    }
  };
  return e.$$set = (_) => {
    "height" in _ && n(0, a = _.height), "width" in _ && n(1, o = _.width), "elem_id" in _ && n(2, s = _.elem_id), "elem_classes" in _ && n(3, u = _.elem_classes), "variant" in _ && n(4, l = _.variant), "border_mode" in _ && n(5, c = _.border_mode), "padding" in _ && n(6, d = _.padding), "type" in _ && n(16, f = _.type), "test_id" in _ && n(7, p = _.test_id), "explicit_call" in _ && n(8, g = _.explicit_call), "container" in _ && n(9, m = _.container), "visible" in _ && n(10, v = _.visible), "allow_overflow" in _ && n(11, h = _.allow_overflow), "scale" in _ && n(12, y = _.scale), "min_width" in _ && n(13, x = _.min_width), "$$scope" in _ && n(17, i = _.$$scope);
  }, [
    a,
    o,
    s,
    u,
    l,
    c,
    d,
    p,
    g,
    m,
    v,
    h,
    y,
    x,
    S,
    b,
    f,
    i,
    r
  ];
}
class UF extends PF {
  constructor(t) {
    super(), RF(this, t, zF, GF, NF, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 16,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const {
  SvelteComponent: HF,
  append: Hb,
  attr: ol,
  bubble: qF,
  create_component: jF,
  destroy_component: KF,
  detach: QE,
  element: qb,
  init: YF,
  insert: JE,
  listen: WF,
  mount_component: XF,
  safe_not_equal: ZF,
  set_data: QF,
  set_style: jf,
  space: JF,
  text: $F,
  toggle_class: Ba,
  transition_in: eV,
  transition_out: tV
} = window.__gradio__svelte__internal;
function r9(e) {
  let t, n;
  return {
    c() {
      t = qb("span"), n = $F(
        /*label*/
        e[1]
      ), ol(t, "class", "svelte-1lrphxw");
    },
    m(r, i) {
      JE(r, t, i), Hb(t, n);
    },
    p(r, i) {
      i & /*label*/
      2 && QF(
        n,
        /*label*/
        r[1]
      );
    },
    d(r) {
      r && QE(t);
    }
  };
}
function nV(e) {
  let t, n, r, i, a, o, s, u = (
    /*show_label*/
    e[2] && r9(e)
  );
  return i = new /*Icon*/
  e[0]({}), {
    c() {
      t = qb("button"), u && u.c(), n = JF(), r = qb("div"), jF(i.$$.fragment), ol(r, "class", "svelte-1lrphxw"), Ba(
        r,
        "small",
        /*size*/
        e[4] === "small"
      ), Ba(
        r,
        "large",
        /*size*/
        e[4] === "large"
      ), Ba(
        r,
        "medium",
        /*size*/
        e[4] === "medium"
      ), t.disabled = /*disabled*/
      e[7], ol(
        t,
        "aria-label",
        /*label*/
        e[1]
      ), ol(
        t,
        "aria-haspopup",
        /*hasPopup*/
        e[8]
      ), ol(
        t,
        "title",
        /*label*/
        e[1]
      ), ol(t, "class", "svelte-1lrphxw"), Ba(
        t,
        "pending",
        /*pending*/
        e[3]
      ), Ba(
        t,
        "padded",
        /*padded*/
        e[5]
      ), Ba(
        t,
        "highlight",
        /*highlight*/
        e[6]
      ), Ba(
        t,
        "transparent",
        /*transparent*/
        e[9]
      ), jf(t, "color", !/*disabled*/
      e[7] && /*_color*/
      e[12] ? (
        /*_color*/
        e[12]
      ) : "var(--block-label-text-color)"), jf(t, "--bg-color", /*disabled*/
      e[7] ? "auto" : (
        /*background*/
        e[10]
      )), jf(
        t,
        "margin-left",
        /*offset*/
        e[11] + "px"
      );
    },
    m(l, c) {
      JE(l, t, c), u && u.m(t, null), Hb(t, n), Hb(t, r), XF(i, r, null), a = !0, o || (s = WF(
        t,
        "click",
        /*click_handler*/
        e[14]
      ), o = !0);
    },
    p(l, [c]) {
      /*show_label*/
      l[2] ? u ? u.p(l, c) : (u = r9(l), u.c(), u.m(t, n)) : u && (u.d(1), u = null), (!a || c & /*size*/
      16) && Ba(
        r,
        "small",
        /*size*/
        l[4] === "small"
      ), (!a || c & /*size*/
      16) && Ba(
        r,
        "large",
        /*size*/
        l[4] === "large"
      ), (!a || c & /*size*/
      16) && Ba(
        r,
        "medium",
        /*size*/
        l[4] === "medium"
      ), (!a || c & /*disabled*/
      128) && (t.disabled = /*disabled*/
      l[7]), (!a || c & /*label*/
      2) && ol(
        t,
        "aria-label",
        /*label*/
        l[1]
      ), (!a || c & /*hasPopup*/
      256) && ol(
        t,
        "aria-haspopup",
        /*hasPopup*/
        l[8]
      ), (!a || c & /*label*/
      2) && ol(
        t,
        "title",
        /*label*/
        l[1]
      ), (!a || c & /*pending*/
      8) && Ba(
        t,
        "pending",
        /*pending*/
        l[3]
      ), (!a || c & /*padded*/
      32) && Ba(
        t,
        "padded",
        /*padded*/
        l[5]
      ), (!a || c & /*highlight*/
      64) && Ba(
        t,
        "highlight",
        /*highlight*/
        l[6]
      ), (!a || c & /*transparent*/
      512) && Ba(
        t,
        "transparent",
        /*transparent*/
        l[9]
      ), c & /*disabled, _color*/
      4224 && jf(t, "color", !/*disabled*/
      l[7] && /*_color*/
      l[12] ? (
        /*_color*/
        l[12]
      ) : "var(--block-label-text-color)"), c & /*disabled, background*/
      1152 && jf(t, "--bg-color", /*disabled*/
      l[7] ? "auto" : (
        /*background*/
        l[10]
      )), c & /*offset*/
      2048 && jf(
        t,
        "margin-left",
        /*offset*/
        l[11] + "px"
      );
    },
    i(l) {
      a || (eV(i.$$.fragment, l), a = !0);
    },
    o(l) {
      tV(i.$$.fragment, l), a = !1;
    },
    d(l) {
      l && QE(t), u && u.d(), KF(i), o = !1, s();
    }
  };
}
function rV(e, t, n) {
  let r, { Icon: i } = t, { label: a = "" } = t, { show_label: o = !1 } = t, { pending: s = !1 } = t, { size: u = "small" } = t, { padded: l = !0 } = t, { highlight: c = !1 } = t, { disabled: d = !1 } = t, { hasPopup: f = !1 } = t, { color: p = "var(--block-label-text-color)" } = t, { transparent: g = !1 } = t, { background: m = "var(--background-fill-primary)" } = t, { offset: v = 0 } = t;
  function h(y) {
    qF.call(this, e, y);
  }
  return e.$$set = (y) => {
    "Icon" in y && n(0, i = y.Icon), "label" in y && n(1, a = y.label), "show_label" in y && n(2, o = y.show_label), "pending" in y && n(3, s = y.pending), "size" in y && n(4, u = y.size), "padded" in y && n(5, l = y.padded), "highlight" in y && n(6, c = y.highlight), "disabled" in y && n(7, d = y.disabled), "hasPopup" in y && n(8, f = y.hasPopup), "color" in y && n(13, p = y.color), "transparent" in y && n(9, g = y.transparent), "background" in y && n(10, m = y.background), "offset" in y && n(11, v = y.offset);
  }, e.$$.update = () => {
    e.$$.dirty & /*highlight, color*/
    8256 && n(12, r = c ? "var(--color-accent)" : p);
  }, [
    i,
    a,
    o,
    s,
    u,
    l,
    c,
    d,
    f,
    g,
    m,
    v,
    r,
    p,
    h
  ];
}
class iV extends HF {
  constructor(t) {
    super(), YF(this, t, rV, nV, ZF, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 13,
      transparent: 9,
      background: 10,
      offset: 11
    });
  }
}
const {
  SvelteComponent: aV,
  append: iy,
  attr: bs,
  detach: oV,
  init: sV,
  insert: uV,
  noop: ay,
  safe_not_equal: lV,
  set_style: tu,
  svg_element: Vh
} = window.__gradio__svelte__internal;
function cV(e) {
  let t, n, r, i;
  return {
    c() {
      t = Vh("svg"), n = Vh("g"), r = Vh("path"), i = Vh("path"), bs(r, "d", "M18,6L6.087,17.913"), tu(r, "fill", "none"), tu(r, "fill-rule", "nonzero"), tu(r, "stroke-width", "2px"), bs(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), bs(i, "d", "M4.364,4.364L19.636,19.636"), tu(i, "fill", "none"), tu(i, "fill-rule", "nonzero"), tu(i, "stroke-width", "2px"), bs(t, "width", "100%"), bs(t, "height", "100%"), bs(t, "viewBox", "0 0 24 24"), bs(t, "version", "1.1"), bs(t, "xmlns", "http://www.w3.org/2000/svg"), bs(t, "xmlns:xlink", "http://www.w3.org/1999/xlink"), bs(t, "xml:space", "preserve"), bs(t, "stroke", "currentColor"), tu(t, "fill-rule", "evenodd"), tu(t, "clip-rule", "evenodd"), tu(t, "stroke-linecap", "round"), tu(t, "stroke-linejoin", "round");
    },
    m(a, o) {
      uV(a, t, o), iy(t, n), iy(n, r), iy(t, i);
    },
    p: ay,
    i: ay,
    o: ay,
    d(a) {
      a && oV(t);
    }
  };
}
class dV extends aV {
  constructor(t) {
    super(), sV(this, t, null, cV, lV, {});
  }
}
const fV = [
  { 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 }
], i9 = {
  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"
  }
};
fV.reduce(
  (e, { color: t, primary: n, secondary: r }) => ({
    ...e,
    [t]: {
      primary: i9[t][n],
      secondary: i9[t][r]
    }
  }),
  {}
);
function M1(e) {
  let t = ["", "k", "M", "G", "T", "P", "E", "Z"], n = 0;
  for (; e > 1e3 && n < t.length - 1; )
    e /= 1e3, n++;
  let r = t[n];
  return (Number.isInteger(e) ? e : e.toFixed(1)) + r;
}
function dg() {
}
const mV = (e) => e;
function pV(e, t) {
  return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
}
const $E = typeof window < "u";
let a9 = $E ? () => window.performance.now() : () => Date.now(), eT = $E ? (e) => requestAnimationFrame(e) : dg;
const L1 = /* @__PURE__ */ new Set();
function tT(e) {
  L1.forEach((t) => {
    t.c(e) || (L1.delete(t), t.f());
  }), L1.size !== 0 && eT(tT);
}
function hV(e) {
  let t;
  return L1.size === 0 && eT(tT), {
    promise: new Promise((n) => {
      L1.add(t = { c: e, f: n });
    }),
    abort() {
      L1.delete(t);
    }
  };
}
function gV(e) {
  const t = e - 1;
  return t * t * t + 1;
}
function o9(e, { delay: t = 0, duration: n = 400, easing: r = mV } = {}) {
  const i = +getComputedStyle(e).opacity;
  return {
    delay: t,
    duration: n,
    easing: r,
    css: (a) => `opacity: ${a * i}`
  };
}
function s9(e, { delay: t = 0, duration: n = 400, easing: r = gV, start: i = 0, opacity: a = 0 } = {}) {
  const o = getComputedStyle(e), s = +o.opacity, u = o.transform === "none" ? "" : o.transform, l = 1 - i, c = s * (1 - a);
  return {
    delay: t,
    duration: n,
    easing: r,
    css: (d, f) => `
			transform: ${u} scale(${1 - l * f});
			opacity: ${s - c * f}
		`
  };
}
const Kf = [];
function nT(e, t = dg) {
  let n;
  const r = /* @__PURE__ */ new Set();
  function i(s) {
    if (pV(e, s) && (e = s, n)) {
      const u = !Kf.length;
      for (const l of r)
        l[1](), Kf.push(l, e);
      if (u) {
        for (let l = 0; l < Kf.length; l += 2)
          Kf[l][0](Kf[l + 1]);
        Kf.length = 0;
      }
    }
  }
  function a(s) {
    i(s(e));
  }
  function o(s, u = dg) {
    const l = [s, u];
    return r.add(l), r.size === 1 && (n = t(i, a) || dg), s(e), () => {
      r.delete(l), r.size === 0 && n && (n(), n = null);
    };
  }
  return { set: i, update: a, subscribe: o };
}
function u9(e) {
  return Object.prototype.toString.call(e) === "[object Date]";
}
function jb(e, t, n, r) {
  if (typeof n == "number" || u9(n)) {
    const i = r - n, a = (n - t) / (e.dt || 1 / 60), o = e.opts.stiffness * i, s = e.opts.damping * a, u = (o - s) * e.inv_mass, l = (a + u) * e.dt;
    return Math.abs(l) < e.opts.precision && Math.abs(i) < e.opts.precision ? r : (e.settled = !1, u9(n) ? new Date(n.getTime() + l) : n + l);
  } else {
    if (Array.isArray(n))
      return n.map(
        (i, a) => jb(e, t[a], n[a], r[a])
      );
    if (typeof n == "object") {
      const i = {};
      for (const a in n)
        i[a] = jb(e, t[a], n[a], r[a]);
      return i;
    } else
      throw new Error(`Cannot spring ${typeof n} values`);
  }
}
function l9(e, t = {}) {
  const n = nT(e), { stiffness: r = 0.15, damping: i = 0.8, precision: a = 0.01 } = t;
  let o, s, u, l = e, c = e, d = 1, f = 0, p = !1;
  function g(v, h = {}) {
    c = v;
    const y = u = {};
    return e == null || h.hard || m.stiffness >= 1 && m.damping >= 1 ? (p = !0, o = a9(), l = v, n.set(e = c), Promise.resolve()) : (h.soft && (f = 1 / ((h.soft === !0 ? 0.5 : +h.soft) * 60), d = 0), s || (o = a9(), p = !1, s = hV((x) => {
      if (p)
        return p = !1, s = null, !1;
      d = Math.min(d + f, 1);
      const S = {
        inv_mass: d,
        opts: m,
        settled: !0,
        dt: (x - o) * 60 / 1e3
      }, b = jb(S, l, e, c);
      return o = x, l = e, n.set(e = b), S.settled && (s = null), !S.settled;
    })), new Promise((x) => {
      s.promise.then(() => {
        y === u && x();
      });
    }));
  }
  const m = {
    set: g,
    update: (v, h) => g(v(c, e), h),
    subscribe: n.subscribe,
    stiffness: r,
    damping: i,
    precision: a
  };
  return m;
}
const {
  SvelteComponent: vV,
  append: _s,
  attr: Hn,
  component_subscribe: c9,
  detach: yV,
  element: bV,
  init: _V,
  insert: xV,
  noop: d9,
  safe_not_equal: CV,
  set_style: Gh,
  svg_element: xs,
  toggle_class: f9
} = window.__gradio__svelte__internal, { onMount: SV } = window.__gradio__svelte__internal;
function AV(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f;
  return {
    c() {
      t = bV("div"), n = xs("svg"), r = xs("g"), i = xs("path"), a = xs("path"), o = xs("path"), s = xs("path"), u = xs("g"), l = xs("path"), c = xs("path"), d = xs("path"), f = xs("path"), Hn(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), Hn(i, "fill", "#FF7C00"), Hn(i, "fill-opacity", "0.4"), Hn(i, "class", "svelte-43sxxs"), Hn(a, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), Hn(a, "fill", "#FF7C00"), Hn(a, "class", "svelte-43sxxs"), Hn(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), Hn(o, "fill", "#FF7C00"), Hn(o, "fill-opacity", "0.4"), Hn(o, "class", "svelte-43sxxs"), Hn(s, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), Hn(s, "fill", "#FF7C00"), Hn(s, "class", "svelte-43sxxs"), Gh(r, "transform", "translate(" + /*$top*/
      e[1][0] + "px, " + /*$top*/
      e[1][1] + "px)"), Hn(l, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), Hn(l, "fill", "#FF7C00"), Hn(l, "fill-opacity", "0.4"), Hn(l, "class", "svelte-43sxxs"), Hn(c, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), Hn(c, "fill", "#FF7C00"), Hn(c, "class", "svelte-43sxxs"), Hn(d, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), Hn(d, "fill", "#FF7C00"), Hn(d, "fill-opacity", "0.4"), Hn(d, "class", "svelte-43sxxs"), Hn(f, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), Hn(f, "fill", "#FF7C00"), Hn(f, "class", "svelte-43sxxs"), Gh(u, "transform", "translate(" + /*$bottom*/
      e[2][0] + "px, " + /*$bottom*/
      e[2][1] + "px)"), Hn(n, "viewBox", "-1200 -1200 3000 3000"), Hn(n, "fill", "none"), Hn(n, "xmlns", "http://www.w3.org/2000/svg"), Hn(n, "class", "svelte-43sxxs"), Hn(t, "class", "svelte-43sxxs"), f9(
        t,
        "margin",
        /*margin*/
        e[0]
      );
    },
    m(p, g) {
      xV(p, t, g), _s(t, n), _s(n, r), _s(r, i), _s(r, a), _s(r, o), _s(r, s), _s(n, u), _s(u, l), _s(u, c), _s(u, d), _s(u, f);
    },
    p(p, [g]) {
      g & /*$top*/
      2 && Gh(r, "transform", "translate(" + /*$top*/
      p[1][0] + "px, " + /*$top*/
      p[1][1] + "px)"), g & /*$bottom*/
      4 && Gh(u, "transform", "translate(" + /*$bottom*/
      p[2][0] + "px, " + /*$bottom*/
      p[2][1] + "px)"), g & /*margin*/
      1 && f9(
        t,
        "margin",
        /*margin*/
        p[0]
      );
    },
    i: d9,
    o: d9,
    d(p) {
      p && yV(t);
    }
  };
}
function wV(e, t, n) {
  let r, i;
  var a = this && this.__awaiter || function(p, g, m, v) {
    function h(y) {
      return y instanceof m ? y : new m(function(x) {
        x(y);
      });
    }
    return new (m || (m = Promise))(function(y, x) {
      function S(C) {
        try {
          _(v.next(C));
        } catch (w) {
          x(w);
        }
      }
      function b(C) {
        try {
          _(v.throw(C));
        } catch (w) {
          x(w);
        }
      }
      function _(C) {
        C.done ? y(C.value) : h(C.value).then(S, b);
      }
      _((v = v.apply(p, g || [])).next());
    });
  };
  let { margin: o = !0 } = t;
  const s = l9([0, 0]);
  c9(e, s, (p) => n(1, r = p));
  const u = l9([0, 0]);
  c9(e, u, (p) => n(2, i = p));
  let l;
  function c() {
    return a(this, void 0, void 0, function* () {
      yield Promise.all([s.set([125, 140]), u.set([-125, -140])]), yield Promise.all([s.set([-125, 140]), u.set([125, -140])]), yield Promise.all([s.set([-125, 0]), u.set([125, -0])]), yield Promise.all([s.set([125, 0]), u.set([-125, 0])]);
    });
  }
  function d() {
    return a(this, void 0, void 0, function* () {
      yield c(), l || d();
    });
  }
  function f() {
    return a(this, void 0, void 0, function* () {
      yield Promise.all([s.set([125, 0]), u.set([-125, 0])]), d();
    });
  }
  return SV(() => (f(), () => l = !0)), e.$$set = (p) => {
    "margin" in p && n(0, o = p.margin);
  }, [o, r, i, s, u];
}
class IV extends vV {
  constructor(t) {
    super(), _V(this, t, wV, AV, CV, { margin: 0 });
  }
}
const {
  SvelteComponent: PV,
  append: Zd,
  attr: Ns,
  binding_callbacks: m9,
  check_outros: Kb,
  create_component: rT,
  create_slot: iT,
  destroy_component: aT,
  destroy_each: oT,
  detach: vn,
  element: bu,
  empty: Om,
  ensure_array_like: Lg,
  get_all_dirty_from_scope: sT,
  get_slot_changes: uT,
  group_outros: Yb,
  init: MV,
  insert: yn,
  mount_component: lT,
  noop: Wb,
  safe_not_equal: EV,
  set_data: cs,
  set_style: Nc,
  space: rs,
  text: Gr,
  toggle_class: Wo,
  transition_in: Os,
  transition_out: _u,
  update_slot_base: cT
} = window.__gradio__svelte__internal, { tick: TV } = window.__gradio__svelte__internal, { onDestroy: kV } = window.__gradio__svelte__internal, { createEventDispatcher: DV } = window.__gradio__svelte__internal, OV = (e) => ({}), p9 = (e) => ({}), BV = (e) => ({}), h9 = (e) => ({});
function g9(e, t, n) {
  const r = e.slice();
  return r[41] = t[n], r[43] = n, r;
}
function v9(e, t, n) {
  const r = e.slice();
  return r[41] = t[n], r;
}
function RV(e) {
  let t, n, r, i, a = (
    /*i18n*/
    e[1]("common.error") + ""
  ), o, s, u;
  n = new iV({
    props: {
      Icon: dV,
      label: (
        /*i18n*/
        e[1]("common.clear")
      ),
      disabled: !1
    }
  }), n.$on(
    "click",
    /*click_handler*/
    e[32]
  );
  const l = (
    /*#slots*/
    e[30].error
  ), c = iT(
    l,
    e,
    /*$$scope*/
    e[29],
    p9
  );
  return {
    c() {
      t = bu("div"), rT(n.$$.fragment), r = rs(), i = bu("span"), o = Gr(a), s = rs(), c && c.c(), Ns(t, "class", "clear-status svelte-vopvsi"), Ns(i, "class", "error svelte-vopvsi");
    },
    m(d, f) {
      yn(d, t, f), lT(n, t, null), yn(d, r, f), yn(d, i, f), Zd(i, o), yn(d, s, f), c && c.m(d, f), u = !0;
    },
    p(d, f) {
      const p = {};
      f[0] & /*i18n*/
      2 && (p.label = /*i18n*/
      d[1]("common.clear")), n.$set(p), (!u || f[0] & /*i18n*/
      2) && a !== (a = /*i18n*/
      d[1]("common.error") + "") && cs(o, a), c && c.p && (!u || f[0] & /*$$scope*/
      536870912) && cT(
        c,
        l,
        d,
        /*$$scope*/
        d[29],
        u ? uT(
          l,
          /*$$scope*/
          d[29],
          f,
          OV
        ) : sT(
          /*$$scope*/
          d[29]
        ),
        p9
      );
    },
    i(d) {
      u || (Os(n.$$.fragment, d), Os(c, d), u = !0);
    },
    o(d) {
      _u(n.$$.fragment, d), _u(c, d), u = !1;
    },
    d(d) {
      d && (vn(t), vn(r), vn(i), vn(s)), aT(n), c && c.d(d);
    }
  };
}
function LV(e) {
  let t, n, r, i, a, o, s, u, l, c = (
    /*variant*/
    e[8] === "default" && /*show_eta_bar*/
    e[18] && /*show_progress*/
    e[6] === "full" && y9(e)
  );
  function d(x, S) {
    if (
      /*progress*/
      x[7]
    ) return VV;
    if (
      /*queue_position*/
      x[2] !== null && /*queue_size*/
      x[3] !== void 0 && /*queue_position*/
      x[2] >= 0
    ) return FV;
    if (
      /*queue_position*/
      x[2] === 0
    ) return NV;
  }
  let f = d(e), p = f && f(e), g = (
    /*timer*/
    e[5] && x9(e)
  );
  const m = [HV, UV], v = [];
  function h(x, S) {
    return (
      /*last_progress_level*/
      x[15] != null ? 0 : (
        /*show_progress*/
        x[6] === "full" ? 1 : -1
      )
    );
  }
  ~(a = h(e)) && (o = v[a] = m[a](e));
  let y = !/*timer*/
  e[5] && M9(e);
  return {
    c() {
      c && c.c(), t = rs(), n = bu("div"), p && p.c(), r = rs(), g && g.c(), i = rs(), o && o.c(), s = rs(), y && y.c(), u = Om(), Ns(n, "class", "progress-text svelte-vopvsi"), Wo(
        n,
        "meta-text-center",
        /*variant*/
        e[8] === "center"
      ), Wo(
        n,
        "meta-text",
        /*variant*/
        e[8] === "default"
      );
    },
    m(x, S) {
      c && c.m(x, S), yn(x, t, S), yn(x, n, S), p && p.m(n, null), Zd(n, r), g && g.m(n, null), yn(x, i, S), ~a && v[a].m(x, S), yn(x, s, S), y && y.m(x, S), yn(x, u, S), l = !0;
    },
    p(x, S) {
      /*variant*/
      x[8] === "default" && /*show_eta_bar*/
      x[18] && /*show_progress*/
      x[6] === "full" ? c ? c.p(x, S) : (c = y9(x), c.c(), c.m(t.parentNode, t)) : c && (c.d(1), c = null), f === (f = d(x)) && p ? p.p(x, S) : (p && p.d(1), p = f && f(x), p && (p.c(), p.m(n, r))), /*timer*/
      x[5] ? g ? g.p(x, S) : (g = x9(x), g.c(), g.m(n, null)) : g && (g.d(1), g = null), (!l || S[0] & /*variant*/
      256) && Wo(
        n,
        "meta-text-center",
        /*variant*/
        x[8] === "center"
      ), (!l || S[0] & /*variant*/
      256) && Wo(
        n,
        "meta-text",
        /*variant*/
        x[8] === "default"
      );
      let b = a;
      a = h(x), a === b ? ~a && v[a].p(x, S) : (o && (Yb(), _u(v[b], 1, 1, () => {
        v[b] = null;
      }), Kb()), ~a ? (o = v[a], o ? o.p(x, S) : (o = v[a] = m[a](x), o.c()), Os(o, 1), o.m(s.parentNode, s)) : o = null), /*timer*/
      x[5] ? y && (Yb(), _u(y, 1, 1, () => {
        y = null;
      }), Kb()) : y ? (y.p(x, S), S[0] & /*timer*/
      32 && Os(y, 1)) : (y = M9(x), y.c(), Os(y, 1), y.m(u.parentNode, u));
    },
    i(x) {
      l || (Os(o), Os(y), l = !0);
    },
    o(x) {
      _u(o), _u(y), l = !1;
    },
    d(x) {
      x && (vn(t), vn(n), vn(i), vn(s), vn(u)), c && c.d(x), p && p.d(), g && g.d(), ~a && v[a].d(x), y && y.d(x);
    }
  };
}
function y9(e) {
  let t, n = `translateX(${/*eta_level*/
  (e[17] || 0) * 100 - 100}%)`;
  return {
    c() {
      t = bu("div"), Ns(t, "class", "eta-bar svelte-vopvsi"), Nc(t, "transform", n);
    },
    m(r, i) {
      yn(r, t, i);
    },
    p(r, i) {
      i[0] & /*eta_level*/
      131072 && n !== (n = `translateX(${/*eta_level*/
      (r[17] || 0) * 100 - 100}%)`) && Nc(t, "transform", n);
    },
    d(r) {
      r && vn(t);
    }
  };
}
function NV(e) {
  let t;
  return {
    c() {
      t = Gr("processing |");
    },
    m(n, r) {
      yn(n, t, r);
    },
    p: Wb,
    d(n) {
      n && vn(t);
    }
  };
}
function FV(e) {
  let t, n = (
    /*queue_position*/
    e[2] + 1 + ""
  ), r, i, a, o;
  return {
    c() {
      t = Gr("queue: "), r = Gr(n), i = Gr("/"), a = Gr(
        /*queue_size*/
        e[3]
      ), o = Gr(" |");
    },
    m(s, u) {
      yn(s, t, u), yn(s, r, u), yn(s, i, u), yn(s, a, u), yn(s, o, u);
    },
    p(s, u) {
      u[0] & /*queue_position*/
      4 && n !== (n = /*queue_position*/
      s[2] + 1 + "") && cs(r, n), u[0] & /*queue_size*/
      8 && cs(
        a,
        /*queue_size*/
        s[3]
      );
    },
    d(s) {
      s && (vn(t), vn(r), vn(i), vn(a), vn(o));
    }
  };
}
function VV(e) {
  let t, n = Lg(
    /*progress*/
    e[7]
  ), r = [];
  for (let i = 0; i < n.length; i += 1)
    r[i] = _9(v9(e, n, i));
  return {
    c() {
      for (let i = 0; i < r.length; i += 1)
        r[i].c();
      t = Om();
    },
    m(i, a) {
      for (let o = 0; o < r.length; o += 1)
        r[o] && r[o].m(i, a);
      yn(i, t, a);
    },
    p(i, a) {
      if (a[0] & /*progress*/
      128) {
        n = Lg(
          /*progress*/
          i[7]
        );
        let o;
        for (o = 0; o < n.length; o += 1) {
          const s = v9(i, n, o);
          r[o] ? r[o].p(s, a) : (r[o] = _9(s), r[o].c(), r[o].m(t.parentNode, t));
        }
        for (; o < r.length; o += 1)
          r[o].d(1);
        r.length = n.length;
      }
    },
    d(i) {
      i && vn(t), oT(r, i);
    }
  };
}
function b9(e) {
  let t, n = (
    /*p*/
    e[41].unit + ""
  ), r, i, a = " ", o;
  function s(c, d) {
    return (
      /*p*/
      c[41].length != null ? zV : GV
    );
  }
  let u = s(e), l = u(e);
  return {
    c() {
      l.c(), t = rs(), r = Gr(n), i = Gr(" | "), o = Gr(a);
    },
    m(c, d) {
      l.m(c, d), yn(c, t, d), yn(c, r, d), yn(c, i, d), yn(c, o, d);
    },
    p(c, d) {
      u === (u = s(c)) && l ? l.p(c, d) : (l.d(1), l = u(c), l && (l.c(), l.m(t.parentNode, t))), d[0] & /*progress*/
      128 && n !== (n = /*p*/
      c[41].unit + "") && cs(r, n);
    },
    d(c) {
      c && (vn(t), vn(r), vn(i), vn(o)), l.d(c);
    }
  };
}
function GV(e) {
  let t = M1(
    /*p*/
    e[41].index || 0
  ) + "", n;
  return {
    c() {
      n = Gr(t);
    },
    m(r, i) {
      yn(r, n, i);
    },
    p(r, i) {
      i[0] & /*progress*/
      128 && t !== (t = M1(
        /*p*/
        r[41].index || 0
      ) + "") && cs(n, t);
    },
    d(r) {
      r && vn(n);
    }
  };
}
function zV(e) {
  let t = M1(
    /*p*/
    e[41].index || 0
  ) + "", n, r, i = M1(
    /*p*/
    e[41].length
  ) + "", a;
  return {
    c() {
      n = Gr(t), r = Gr("/"), a = Gr(i);
    },
    m(o, s) {
      yn(o, n, s), yn(o, r, s), yn(o, a, s);
    },
    p(o, s) {
      s[0] & /*progress*/
      128 && t !== (t = M1(
        /*p*/
        o[41].index || 0
      ) + "") && cs(n, t), s[0] & /*progress*/
      128 && i !== (i = M1(
        /*p*/
        o[41].length
      ) + "") && cs(a, i);
    },
    d(o) {
      o && (vn(n), vn(r), vn(a));
    }
  };
}
function _9(e) {
  let t, n = (
    /*p*/
    e[41].index != null && b9(e)
  );
  return {
    c() {
      n && n.c(), t = Om();
    },
    m(r, i) {
      n && n.m(r, i), yn(r, t, i);
    },
    p(r, i) {
      /*p*/
      r[41].index != null ? n ? n.p(r, i) : (n = b9(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && vn(t), n && n.d(r);
    }
  };
}
function x9(e) {
  let t, n = (
    /*eta*/
    e[0] ? `/${/*formatted_eta*/
    e[19]}` : ""
  ), r, i;
  return {
    c() {
      t = Gr(
        /*formatted_timer*/
        e[20]
      ), r = Gr(n), i = Gr("s");
    },
    m(a, o) {
      yn(a, t, o), yn(a, r, o), yn(a, i, o);
    },
    p(a, o) {
      o[0] & /*formatted_timer*/
      1048576 && cs(
        t,
        /*formatted_timer*/
        a[20]
      ), o[0] & /*eta, formatted_eta*/
      524289 && n !== (n = /*eta*/
      a[0] ? `/${/*formatted_eta*/
      a[19]}` : "") && cs(r, n);
    },
    d(a) {
      a && (vn(t), vn(r), vn(i));
    }
  };
}
function UV(e) {
  let t, n;
  return t = new IV({
    props: { margin: (
      /*variant*/
      e[8] === "default"
    ) }
  }), {
    c() {
      rT(t.$$.fragment);
    },
    m(r, i) {
      lT(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i[0] & /*variant*/
      256 && (a.margin = /*variant*/
      r[8] === "default"), t.$set(a);
    },
    i(r) {
      n || (Os(t.$$.fragment, r), n = !0);
    },
    o(r) {
      _u(t.$$.fragment, r), n = !1;
    },
    d(r) {
      aT(t, r);
    }
  };
}
function HV(e) {
  let t, n, r, i, a, o = `${/*last_progress_level*/
  e[15] * 100}%`, s = (
    /*progress*/
    e[7] != null && C9(e)
  );
  return {
    c() {
      t = bu("div"), n = bu("div"), s && s.c(), r = rs(), i = bu("div"), a = bu("div"), Ns(n, "class", "progress-level-inner svelte-vopvsi"), Ns(a, "class", "progress-bar svelte-vopvsi"), Nc(a, "width", o), Ns(i, "class", "progress-bar-wrap svelte-vopvsi"), Ns(t, "class", "progress-level svelte-vopvsi");
    },
    m(u, l) {
      yn(u, t, l), Zd(t, n), s && s.m(n, null), Zd(t, r), Zd(t, i), Zd(i, a), e[31](a);
    },
    p(u, l) {
      /*progress*/
      u[7] != null ? s ? s.p(u, l) : (s = C9(u), s.c(), s.m(n, null)) : s && (s.d(1), s = null), l[0] & /*last_progress_level*/
      32768 && o !== (o = `${/*last_progress_level*/
      u[15] * 100}%`) && Nc(a, "width", o);
    },
    i: Wb,
    o: Wb,
    d(u) {
      u && vn(t), s && s.d(), e[31](null);
    }
  };
}
function C9(e) {
  let t, n = Lg(
    /*progress*/
    e[7]
  ), r = [];
  for (let i = 0; i < n.length; i += 1)
    r[i] = P9(g9(e, n, i));
  return {
    c() {
      for (let i = 0; i < r.length; i += 1)
        r[i].c();
      t = Om();
    },
    m(i, a) {
      for (let o = 0; o < r.length; o += 1)
        r[o] && r[o].m(i, a);
      yn(i, t, a);
    },
    p(i, a) {
      if (a[0] & /*progress_level, progress*/
      16512) {
        n = Lg(
          /*progress*/
          i[7]
        );
        let o;
        for (o = 0; o < n.length; o += 1) {
          const s = g9(i, n, o);
          r[o] ? r[o].p(s, a) : (r[o] = P9(s), r[o].c(), r[o].m(t.parentNode, t));
        }
        for (; o < r.length; o += 1)
          r[o].d(1);
        r.length = n.length;
      }
    },
    d(i) {
      i && vn(t), oT(r, i);
    }
  };
}
function S9(e) {
  let t, n, r, i, a = (
    /*i*/
    e[43] !== 0 && qV()
  ), o = (
    /*p*/
    e[41].desc != null && A9(e)
  ), s = (
    /*p*/
    e[41].desc != null && /*progress_level*/
    e[14] && /*progress_level*/
    e[14][
      /*i*/
      e[43]
    ] != null && w9()
  ), u = (
    /*progress_level*/
    e[14] != null && I9(e)
  );
  return {
    c() {
      a && a.c(), t = rs(), o && o.c(), n = rs(), s && s.c(), r = rs(), u && u.c(), i = Om();
    },
    m(l, c) {
      a && a.m(l, c), yn(l, t, c), o && o.m(l, c), yn(l, n, c), s && s.m(l, c), yn(l, r, c), u && u.m(l, c), yn(l, i, c);
    },
    p(l, c) {
      /*p*/
      l[41].desc != null ? o ? o.p(l, c) : (o = A9(l), o.c(), o.m(n.parentNode, n)) : o && (o.d(1), o = null), /*p*/
      l[41].desc != null && /*progress_level*/
      l[14] && /*progress_level*/
      l[14][
        /*i*/
        l[43]
      ] != null ? s || (s = w9(), s.c(), s.m(r.parentNode, r)) : s && (s.d(1), s = null), /*progress_level*/
      l[14] != null ? u ? u.p(l, c) : (u = I9(l), u.c(), u.m(i.parentNode, i)) : u && (u.d(1), u = null);
    },
    d(l) {
      l && (vn(t), vn(n), vn(r), vn(i)), a && a.d(l), o && o.d(l), s && s.d(l), u && u.d(l);
    }
  };
}
function qV(e) {
  let t;
  return {
    c() {
      t = Gr(" /");
    },
    m(n, r) {
      yn(n, t, r);
    },
    d(n) {
      n && vn(t);
    }
  };
}
function A9(e) {
  let t = (
    /*p*/
    e[41].desc + ""
  ), n;
  return {
    c() {
      n = Gr(t);
    },
    m(r, i) {
      yn(r, n, i);
    },
    p(r, i) {
      i[0] & /*progress*/
      128 && t !== (t = /*p*/
      r[41].desc + "") && cs(n, t);
    },
    d(r) {
      r && vn(n);
    }
  };
}
function w9(e) {
  let t;
  return {
    c() {
      t = Gr("-");
    },
    m(n, r) {
      yn(n, t, r);
    },
    d(n) {
      n && vn(t);
    }
  };
}
function I9(e) {
  let t = (100 * /*progress_level*/
  (e[14][
    /*i*/
    e[43]
  ] || 0)).toFixed(1) + "", n, r;
  return {
    c() {
      n = Gr(t), r = Gr("%");
    },
    m(i, a) {
      yn(i, n, a), yn(i, r, a);
    },
    p(i, a) {
      a[0] & /*progress_level*/
      16384 && t !== (t = (100 * /*progress_level*/
      (i[14][
        /*i*/
        i[43]
      ] || 0)).toFixed(1) + "") && cs(n, t);
    },
    d(i) {
      i && (vn(n), vn(r));
    }
  };
}
function P9(e) {
  let t, n = (
    /*p*/
    (e[41].desc != null || /*progress_level*/
    e[14] && /*progress_level*/
    e[14][
      /*i*/
      e[43]
    ] != null) && S9(e)
  );
  return {
    c() {
      n && n.c(), t = Om();
    },
    m(r, i) {
      n && n.m(r, i), yn(r, t, i);
    },
    p(r, i) {
      /*p*/
      r[41].desc != null || /*progress_level*/
      r[14] && /*progress_level*/
      r[14][
        /*i*/
        r[43]
      ] != null ? n ? n.p(r, i) : (n = S9(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && vn(t), n && n.d(r);
    }
  };
}
function M9(e) {
  let t, n, r, i;
  const a = (
    /*#slots*/
    e[30]["additional-loading-text"]
  ), o = iT(
    a,
    e,
    /*$$scope*/
    e[29],
    h9
  );
  return {
    c() {
      t = bu("p"), n = Gr(
        /*loading_text*/
        e[9]
      ), r = rs(), o && o.c(), Ns(t, "class", "loading svelte-vopvsi");
    },
    m(s, u) {
      yn(s, t, u), Zd(t, n), yn(s, r, u), o && o.m(s, u), i = !0;
    },
    p(s, u) {
      (!i || u[0] & /*loading_text*/
      512) && cs(
        n,
        /*loading_text*/
        s[9]
      ), o && o.p && (!i || u[0] & /*$$scope*/
      536870912) && cT(
        o,
        a,
        s,
        /*$$scope*/
        s[29],
        i ? uT(
          a,
          /*$$scope*/
          s[29],
          u,
          BV
        ) : sT(
          /*$$scope*/
          s[29]
        ),
        h9
      );
    },
    i(s) {
      i || (Os(o, s), i = !0);
    },
    o(s) {
      _u(o, s), i = !1;
    },
    d(s) {
      s && (vn(t), vn(r)), o && o.d(s);
    }
  };
}
function jV(e) {
  let t, n, r, i, a;
  const o = [LV, RV], s = [];
  function u(l, c) {
    return (
      /*status*/
      l[4] === "pending" ? 0 : (
        /*status*/
        l[4] === "error" ? 1 : -1
      )
    );
  }
  return ~(n = u(e)) && (r = s[n] = o[n](e)), {
    c() {
      t = bu("div"), r && r.c(), Ns(t, "class", i = "wrap " + /*variant*/
      e[8] + " " + /*show_progress*/
      e[6] + " svelte-vopvsi"), Wo(t, "hide", !/*status*/
      e[4] || /*status*/
      e[4] === "complete" || /*show_progress*/
      e[6] === "hidden"), Wo(
        t,
        "translucent",
        /*variant*/
        e[8] === "center" && /*status*/
        (e[4] === "pending" || /*status*/
        e[4] === "error") || /*translucent*/
        e[11] || /*show_progress*/
        e[6] === "minimal"
      ), Wo(
        t,
        "generating",
        /*status*/
        e[4] === "generating"
      ), Wo(
        t,
        "border",
        /*border*/
        e[12]
      ), Nc(
        t,
        "position",
        /*absolute*/
        e[10] ? "absolute" : "static"
      ), Nc(
        t,
        "padding",
        /*absolute*/
        e[10] ? "0" : "var(--size-8) 0"
      );
    },
    m(l, c) {
      yn(l, t, c), ~n && s[n].m(t, null), e[33](t), a = !0;
    },
    p(l, c) {
      let d = n;
      n = u(l), n === d ? ~n && s[n].p(l, c) : (r && (Yb(), _u(s[d], 1, 1, () => {
        s[d] = null;
      }), Kb()), ~n ? (r = s[n], r ? r.p(l, c) : (r = s[n] = o[n](l), r.c()), Os(r, 1), r.m(t, null)) : r = null), (!a || c[0] & /*variant, show_progress*/
      320 && i !== (i = "wrap " + /*variant*/
      l[8] + " " + /*show_progress*/
      l[6] + " svelte-vopvsi")) && Ns(t, "class", i), (!a || c[0] & /*variant, show_progress, status, show_progress*/
      336) && Wo(t, "hide", !/*status*/
      l[4] || /*status*/
      l[4] === "complete" || /*show_progress*/
      l[6] === "hidden"), (!a || c[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
      2384) && Wo(
        t,
        "translucent",
        /*variant*/
        l[8] === "center" && /*status*/
        (l[4] === "pending" || /*status*/
        l[4] === "error") || /*translucent*/
        l[11] || /*show_progress*/
        l[6] === "minimal"
      ), (!a || c[0] & /*variant, show_progress, status*/
      336) && Wo(
        t,
        "generating",
        /*status*/
        l[4] === "generating"
      ), (!a || c[0] & /*variant, show_progress, border*/
      4416) && Wo(
        t,
        "border",
        /*border*/
        l[12]
      ), c[0] & /*absolute*/
      1024 && Nc(
        t,
        "position",
        /*absolute*/
        l[10] ? "absolute" : "static"
      ), c[0] & /*absolute*/
      1024 && Nc(
        t,
        "padding",
        /*absolute*/
        l[10] ? "0" : "var(--size-8) 0"
      );
    },
    i(l) {
      a || (Os(r), a = !0);
    },
    o(l) {
      _u(r), a = !1;
    },
    d(l) {
      l && vn(t), ~n && s[n].d(), e[33](null);
    }
  };
}
var KV = function(e, t, n, r) {
  function i(a) {
    return a instanceof n ? a : new n(function(o) {
      o(a);
    });
  }
  return new (n || (n = Promise))(function(a, o) {
    function s(c) {
      try {
        l(r.next(c));
      } catch (d) {
        o(d);
      }
    }
    function u(c) {
      try {
        l(r.throw(c));
      } catch (d) {
        o(d);
      }
    }
    function l(c) {
      c.done ? a(c.value) : i(c.value).then(s, u);
    }
    l((r = r.apply(e, t || [])).next());
  });
};
let zh = [], oy = !1;
function YV(e) {
  return KV(this, arguments, void 0, function* (t, n = !0) {
    if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && n !== !0)) {
      if (zh.push(t), !oy) oy = !0;
      else return;
      yield TV(), requestAnimationFrame(() => {
        let r = [0, 0];
        for (let i = 0; i < zh.length; i++) {
          const o = zh[i].getBoundingClientRect();
          (i === 0 || o.top + window.scrollY <= r[0]) && (r[0] = o.top + window.scrollY, r[1] = i);
        }
        window.scrollTo({ top: r[0] - 20, behavior: "smooth" }), oy = !1, zh = [];
      });
    }
  });
}
function WV(e, t, n) {
  let r, { $$slots: i = {}, $$scope: a } = t;
  this && this.__awaiter;
  const o = DV();
  let { i18n: s } = t, { eta: u = null } = t, { queue_position: l } = t, { queue_size: c } = t, { status: d } = t, { scroll_to_output: f = !1 } = t, { timer: p = !0 } = t, { show_progress: g = "full" } = t, { message: m = null } = t, { progress: v = null } = t, { variant: h = "default" } = t, { loading_text: y = "Loading..." } = t, { absolute: x = !0 } = t, { translucent: S = !1 } = t, { border: b = !1 } = t, { autoscroll: _ } = t, C, w = !1, I = 0, M = 0, E = null, T = null, P = 0, k = null, D, B = null, L = !0;
  const F = () => {
    n(0, u = n(27, E = n(19, H = null))), n(25, I = performance.now()), n(26, M = 0), w = !0, V();
  };
  function V() {
    requestAnimationFrame(() => {
      n(26, M = (performance.now() - I) / 1e3), w && V();
    });
  }
  function G() {
    n(26, M = 0), n(0, u = n(27, E = n(19, H = null))), w && (w = !1);
  }
  kV(() => {
    w && G();
  });
  let H = null;
  function q(Y) {
    m9[Y ? "unshift" : "push"](() => {
      B = Y, n(16, B), n(7, v), n(14, k), n(15, D);
    });
  }
  const z = () => {
    o("clear_status");
  };
  function K(Y) {
    m9[Y ? "unshift" : "push"](() => {
      C = Y, n(13, C);
    });
  }
  return e.$$set = (Y) => {
    "i18n" in Y && n(1, s = Y.i18n), "eta" in Y && n(0, u = Y.eta), "queue_position" in Y && n(2, l = Y.queue_position), "queue_size" in Y && n(3, c = Y.queue_size), "status" in Y && n(4, d = Y.status), "scroll_to_output" in Y && n(22, f = Y.scroll_to_output), "timer" in Y && n(5, p = Y.timer), "show_progress" in Y && n(6, g = Y.show_progress), "message" in Y && n(23, m = Y.message), "progress" in Y && n(7, v = Y.progress), "variant" in Y && n(8, h = Y.variant), "loading_text" in Y && n(9, y = Y.loading_text), "absolute" in Y && n(10, x = Y.absolute), "translucent" in Y && n(11, S = Y.translucent), "border" in Y && n(12, b = Y.border), "autoscroll" in Y && n(24, _ = Y.autoscroll), "$$scope" in Y && n(29, a = Y.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
    436207617 && (u === null && n(0, u = E), u != null && E !== u && (n(28, T = (performance.now() - I) / 1e3 + u), n(19, H = T.toFixed(1)), n(27, E = u))), e.$$.dirty[0] & /*eta_from_start, timer_diff*/
    335544320 && n(17, P = T === null || T <= 0 || !M ? null : Math.min(M / T, 1)), e.$$.dirty[0] & /*progress*/
    128 && v != null && n(18, L = !1), e.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
    114816 && (v != null ? n(14, k = v.map((Y) => {
      if (Y.index != null && Y.length != null)
        return Y.index / Y.length;
      if (Y.progress != null)
        return Y.progress;
    })) : n(14, k = null), k ? (n(15, D = k[k.length - 1]), B && (D === 0 ? n(16, B.style.transition = "0", B) : n(16, B.style.transition = "150ms", B))) : n(15, D = void 0)), e.$$.dirty[0] & /*status*/
    16 && (d === "pending" ? F() : G()), e.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
    20979728 && C && f && (d === "pending" || d === "complete") && YV(C, _), e.$$.dirty[0] & /*status, message*/
    8388624, e.$$.dirty[0] & /*timer_diff*/
    67108864 && n(20, r = M.toFixed(1));
  }, [
    u,
    s,
    l,
    c,
    d,
    p,
    g,
    v,
    h,
    y,
    x,
    S,
    b,
    C,
    k,
    D,
    B,
    P,
    L,
    H,
    r,
    o,
    f,
    m,
    _,
    I,
    M,
    E,
    T,
    a,
    i,
    q,
    z,
    K
  ];
}
class XV extends PV {
  constructor(t) {
    super(), MV(
      this,
      t,
      WV,
      jV,
      EV,
      {
        i18n: 1,
        eta: 0,
        queue_position: 2,
        queue_size: 3,
        status: 4,
        scroll_to_output: 22,
        timer: 5,
        show_progress: 6,
        message: 23,
        progress: 7,
        variant: 8,
        loading_text: 9,
        absolute: 10,
        translucent: 11,
        border: 12,
        autoscroll: 24
      },
      null,
      [-1, -1]
    );
  }
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var Xb = function(e, t) {
  return Xb = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
    n.__proto__ = r;
  } || function(n, r) {
    for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
  }, Xb(e, t);
};
function Zi(e, t) {
  if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
  function n() {
    this.constructor = e;
  }
  Xb(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var O = function() {
  return O = Object.assign || function(e) {
    for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
    return e;
  }, O.apply(this, arguments);
};
function se(e, t, n, r) {
  return new (n || (n = Promise))(function(i, a) {
    function o(l) {
      try {
        u(r.next(l));
      } catch (c) {
        a(c);
      }
    }
    function s(l) {
      try {
        u(r.throw(l));
      } catch (c) {
        a(c);
      }
    }
    function u(l) {
      var c;
      l.done ? i(l.value) : (c = l.value, c instanceof n ? c : new n(function(d) {
        d(c);
      })).then(o, s);
    }
    u((r = r.apply(e, [])).next());
  });
}
function ie(e, t) {
  var n, r, i, a, o = { label: 0, sent: function() {
    if (1 & i[0]) throw i[1];
    return i[1];
  }, trys: [], ops: [] };
  return a = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
    return this;
  }), a;
  function s(u) {
    return function(l) {
      return function(c) {
        if (n) throw new TypeError("Generator is already executing.");
        for (; o; ) try {
          if (n = 1, r && (i = 2 & c[0] ? r.return : c[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, c[1])).done) return i;
          switch (r = 0, i && (c = [2 & c[0], i.value]), c[0]) {
            case 0:
            case 1:
              i = c;
              break;
            case 4:
              return o.label++, { value: c[1], done: !1 };
            case 5:
              o.label++, r = c[1], c = [0];
              continue;
            case 7:
              c = o.ops.pop(), o.trys.pop();
              continue;
            default:
              if (i = o.trys, !((i = i.length > 0 && i[i.length - 1]) || c[0] !== 6 && c[0] !== 2)) {
                o = 0;
                continue;
              }
              if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
                o.label = c[1];
                break;
              }
              if (c[0] === 6 && o.label < i[1]) {
                o.label = i[1], i = c;
                break;
              }
              if (i && o.label < i[2]) {
                o.label = i[2], o.ops.push(c);
                break;
              }
              i[2] && o.ops.pop(), o.trys.pop();
              continue;
          }
          c = t.call(e, o);
        } catch (d) {
          c = [6, d], r = 0;
        } finally {
          n = i = 0;
        }
        if (5 & c[0]) throw c[1];
        return { value: c[0] ? c[1] : void 0, done: !0 };
      }([u, l]);
    };
  }
}
function Zb(e) {
  var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
  if (n) return n.call(e);
  if (e && typeof e.length == "number") return { next: function() {
    return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
  } };
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function Ng(e, t) {
  var n = typeof Symbol == "function" && e[Symbol.iterator];
  if (!n) return e;
  var r, i, a = n.call(e), o = [];
  try {
    for (; (t === void 0 || t-- > 0) && !(r = a.next()).done; ) o.push(r.value);
  } catch (s) {
    i = { error: s };
  } finally {
    try {
      r && !r.done && (n = a.return) && n.call(a);
    } finally {
      if (i) throw i.error;
    }
  }
  return o;
}
function Re(e, t, n) {
  if (n || arguments.length === 2) for (var r, i = 0, a = t.length; i < a; i++) !r && i in t || (r || (r = Array.prototype.slice.call(t, 0, i)), r[i] = t[i]);
  return e.concat(r || Array.prototype.slice.call(t));
}
function Sl(e) {
  return typeof e == "function";
}
function dT(e) {
  var t = e(function(n) {
    Error.call(n), n.stack = new Error().stack;
  });
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
}
var sy = dT(function(e) {
  return function(t) {
    e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
` + t.map(function(n, r) {
      return r + 1 + ") " + n.toString();
    }).join(`
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
  };
});
function Qb(e, t) {
  if (e) {
    var n = e.indexOf(t);
    0 <= n && e.splice(n, 1);
  }
}
var i3 = function() {
  function e(n) {
    this.initialTeardown = n, this.closed = !1, this._parentage = null, this._teardowns = null;
  }
  var t;
  return e.prototype.unsubscribe = function() {
    var n, r, i, a, o;
    if (!this.closed) {
      this.closed = !0;
      var s = this._parentage;
      if (s) if (this._parentage = null, Array.isArray(s)) try {
        for (var u = Zb(s), l = u.next(); !l.done; l = u.next())
          l.value.remove(this);
      } catch (m) {
        n = { error: m };
      } finally {
        try {
          l && !l.done && (r = u.return) && r.call(u);
        } finally {
          if (n) throw n.error;
        }
      }
      else s.remove(this);
      var c = this.initialTeardown;
      if (Sl(c)) try {
        c();
      } catch (m) {
        o = m instanceof sy ? m.errors : [m];
      }
      var d = this._teardowns;
      if (d) {
        this._teardowns = null;
        try {
          for (var f = Zb(d), p = f.next(); !p.done; p = f.next()) {
            var g = p.value;
            try {
              E9(g);
            } catch (m) {
              o = o ?? [], m instanceof sy ? o = Re(Re([], Ng(o)), Ng(m.errors)) : o.push(m);
            }
          }
        } catch (m) {
          i = { error: m };
        } finally {
          try {
            p && !p.done && (a = f.return) && a.call(f);
          } finally {
            if (i) throw i.error;
          }
        }
      }
      if (o) throw new sy(o);
    }
  }, e.prototype.add = function(n) {
    var r;
    if (n && n !== this) if (this.closed) E9(n);
    else {
      if (n instanceof e) {
        if (n.closed || n._hasParent(this)) return;
        n._addParent(this);
      }
      (this._teardowns = (r = this._teardowns) !== null && r !== void 0 ? r : []).push(n);
    }
  }, e.prototype._hasParent = function(n) {
    var r = this._parentage;
    return r === n || Array.isArray(r) && r.includes(n);
  }, e.prototype._addParent = function(n) {
    var r = this._parentage;
    this._parentage = Array.isArray(r) ? (r.push(n), r) : r ? [r, n] : n;
  }, e.prototype._removeParent = function(n) {
    var r = this._parentage;
    r === n ? this._parentage = null : Array.isArray(r) && Qb(r, n);
  }, e.prototype.remove = function(n) {
    var r = this._teardowns;
    r && Qb(r, n), n instanceof e && n._removeParent(this);
  }, e.EMPTY = ((t = new e()).closed = !0, t), e;
}(), fT = i3.EMPTY;
function mT(e) {
  return e instanceof i3 || e && "closed" in e && Sl(e.remove) && Sl(e.add) && Sl(e.unsubscribe);
}
function E9(e) {
  Sl(e) ? e() : e.unsubscribe();
}
var pT = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: !1, useDeprecatedNextContext: !1 }, ZV = { setTimeout: function() {
  for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
  return setTimeout.apply(void 0, Re([], Ng(e)));
}, clearTimeout: function(e) {
  return clearTimeout(e);
}, delegate: void 0 };
function Fg() {
}
function fg(e) {
  e();
}
var hT = function(e) {
  function t(n) {
    var r = e.call(this) || this;
    return r.isStopped = !1, n ? (r.destination = n, mT(n) && n.add(r)) : r.destination = QV, r;
  }
  return Zi(t, e), t.create = function(n, r, i) {
    return new Jb(n, r, i);
  }, t.prototype.next = function(n) {
    this.isStopped || this._next(n);
  }, t.prototype.error = function(n) {
    this.isStopped || (this.isStopped = !0, this._error(n));
  }, t.prototype.complete = function() {
    this.isStopped || (this.isStopped = !0, this._complete());
  }, t.prototype.unsubscribe = function() {
    this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
  }, t.prototype._next = function(n) {
    this.destination.next(n);
  }, t.prototype._error = function(n) {
    try {
      this.destination.error(n);
    } finally {
      this.unsubscribe();
    }
  }, t.prototype._complete = function() {
    try {
      this.destination.complete();
    } finally {
      this.unsubscribe();
    }
  }, t;
}(i3), Jb = function(e) {
  function t(n, r, i) {
    var a, o = e.call(this) || this;
    if (Sl(n)) a = n;
    else if (n) {
      var s;
      a = n.next, r = n.error, i = n.complete, o && pT.useDeprecatedNextContext ? (s = Object.create(n)).unsubscribe = function() {
        return o.unsubscribe();
      } : s = n, a = a == null ? void 0 : a.bind(s), r = r == null ? void 0 : r.bind(s), i = i == null ? void 0 : i.bind(s);
    }
    return o.destination = { next: a ? uy(a) : Fg, error: uy(r ?? gT), complete: i ? uy(i) : Fg }, o;
  }
  return Zi(t, e), t;
}(hT);
function uy(e, t) {
  return function() {
    for (var n = [], r = 0; r < arguments.length; r++) n[r] = arguments[r];
    try {
      e.apply(void 0, Re([], Ng(n)));
    } catch (i) {
      (function(a) {
        ZV.setTimeout(function() {
          throw a;
        });
      })(i);
    }
  };
}
function gT(e) {
  throw e;
}
var QV = { closed: !0, next: Fg, error: gT, complete: Fg }, JV = typeof Symbol == "function" && Symbol.observable || "@@observable";
function $V(e) {
  return e;
}
var T9 = function() {
  function e(t) {
    t && (this._subscribe = t);
  }
  return e.prototype.lift = function(t) {
    var n = new e();
    return n.source = this, n.operator = t, n;
  }, e.prototype.subscribe = function(t, n, r) {
    var i, a = this, o = (i = t) && i instanceof hT || function(s) {
      return s && Sl(s.next) && Sl(s.error) && Sl(s.complete);
    }(i) && mT(i) ? t : new Jb(t, n, r);
    return fg(function() {
      var s = a, u = s.operator, l = s.source;
      o.add(u ? u.call(o, l) : l ? a._subscribe(o) : a._trySubscribe(o));
    }), o;
  }, e.prototype._trySubscribe = function(t) {
    try {
      return this._subscribe(t);
    } catch (n) {
      t.error(n);
    }
  }, e.prototype.forEach = function(t, n) {
    var r = this;
    return new (n = k9(n))(function(i, a) {
      var o = new Jb({ next: function(s) {
        try {
          t(s);
        } catch (u) {
          a(u), o.unsubscribe();
        }
      }, error: a, complete: i });
      r.subscribe(o);
    });
  }, e.prototype._subscribe = function(t) {
    var n;
    return (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t);
  }, e.prototype[JV] = function() {
    return this;
  }, e.prototype.pipe = function() {
    for (var t, n = [], r = 0; r < arguments.length; r++) n[r] = arguments[r];
    return ((t = n).length === 0 ? $V : t.length === 1 ? t[0] : function(i) {
      return t.reduce(function(a, o) {
        return o(a);
      }, i);
    })(this);
  }, e.prototype.toPromise = function(t) {
    var n = this;
    return new (t = k9(t))(function(r, i) {
      var a;
      n.subscribe(function(o) {
        return a = o;
      }, function(o) {
        return i(o);
      }, function() {
        return r(a);
      });
    });
  }, e.create = function(t) {
    return new e(t);
  }, e;
}();
function k9(e) {
  var t;
  return (t = e ?? pT.Promise) !== null && t !== void 0 ? t : Promise;
}
var eG = dT(function(e) {
  return function() {
    e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
  };
}), qr = function(e) {
  function t() {
    var n = e.call(this) || this;
    return n.closed = !1, n.observers = [], n.isStopped = !1, n.hasError = !1, n.thrownError = null, n;
  }
  return Zi(t, e), t.prototype.lift = function(n) {
    var r = new D9(this, this);
    return r.operator = n, r;
  }, t.prototype._throwIfClosed = function() {
    if (this.closed) throw new eG();
  }, t.prototype.next = function(n) {
    var r = this;
    fg(function() {
      var i, a;
      if (r._throwIfClosed(), !r.isStopped) {
        var o = r.observers.slice();
        try {
          for (var s = Zb(o), u = s.next(); !u.done; u = s.next())
            u.value.next(n);
        } catch (l) {
          i = { error: l };
        } finally {
          try {
            u && !u.done && (a = s.return) && a.call(s);
          } finally {
            if (i) throw i.error;
          }
        }
      }
    });
  }, t.prototype.error = function(n) {
    var r = this;
    fg(function() {
      if (r._throwIfClosed(), !r.isStopped) {
        r.hasError = r.isStopped = !0, r.thrownError = n;
        for (var i = r.observers; i.length; ) i.shift().error(n);
      }
    });
  }, t.prototype.complete = function() {
    var n = this;
    fg(function() {
      if (n._throwIfClosed(), !n.isStopped) {
        n.isStopped = !0;
        for (var r = n.observers; r.length; ) r.shift().complete();
      }
    });
  }, t.prototype.unsubscribe = function() {
    this.isStopped = this.closed = !0, this.observers = null;
  }, Object.defineProperty(t.prototype, "observed", { get: function() {
    var n;
    return ((n = this.observers) === null || n === void 0 ? void 0 : n.length) > 0;
  }, enumerable: !1, configurable: !0 }), t.prototype._trySubscribe = function(n) {
    return this._throwIfClosed(), e.prototype._trySubscribe.call(this, n);
  }, t.prototype._subscribe = function(n) {
    return this._throwIfClosed(), this._checkFinalizedStatuses(n), this._innerSubscribe(n);
  }, t.prototype._innerSubscribe = function(n) {
    var r = this, i = r.hasError, a = r.isStopped, o = r.observers;
    return i || a ? fT : (o.push(n), new i3(function() {
      return Qb(o, n);
    }));
  }, t.prototype._checkFinalizedStatuses = function(n) {
    var r = this, i = r.hasError, a = r.thrownError, o = r.isStopped;
    i ? n.error(a) : o && n.complete();
  }, t.prototype.asObservable = function() {
    var n = new T9();
    return n.source = this, n;
  }, t.create = function(n, r) {
    return new D9(n, r);
  }, t;
}(T9), D9 = function(e) {
  function t(n, r) {
    var i = e.call(this) || this;
    return i.destination = n, i.source = r, i;
  }
  return Zi(t, e), t.prototype.next = function(n) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || i === void 0 || i.call(r, n);
  }, t.prototype.error = function(n) {
    var r, i;
    (i = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || i === void 0 || i.call(r, n);
  }, t.prototype.complete = function() {
    var n, r;
    (r = (n = this.destination) === null || n === void 0 ? void 0 : n.complete) === null || r === void 0 || r.call(n);
  }, t.prototype._subscribe = function(n) {
    var r, i;
    return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(n)) !== null && i !== void 0 ? i : fT;
  }, t;
}(qr), Fc = function(e) {
  function t(n) {
    var r = e.call(this) || this;
    return r._value = n, r;
  }
  return Zi(t, e), Object.defineProperty(t.prototype, "value", { get: function() {
    return this.getValue();
  }, enumerable: !1, configurable: !0 }), t.prototype._subscribe = function(n) {
    var r = e.prototype._subscribe.call(this, n);
    return !r.closed && n.next(this._value), r;
  }, t.prototype.getValue = function() {
    var n = this, r = n.hasError, i = n.thrownError, a = n._value;
    if (r) throw i;
    return this._throwIfClosed(), a;
  }, t.prototype.next = function(n) {
    e.prototype.next.call(this, this._value = n);
  }, t;
}(qr), Wr = function() {
  if (typeof window < "u" && window.performance) {
    var e = window.performance;
    return function() {
      return e.now();
    };
  }
  return typeof process < "u" && process.hrtime !== "undefined" && typeof process.hrtime == "function" ? function() {
    var t = process.hrtime();
    return 1e3 * t[0] + t[1] / 1e6;
  } : Date.now ? function() {
    return Date.now();
  } : function() {
    return +/* @__PURE__ */ new Date();
  };
}(), sr = 1e-6;
function Ar(e, t, n) {
  return Math.abs(e - t) <= n;
}
var wr, Qi, Sn, di, O9, Zp, B9 = Math.PI / 2, vT = Math.PI / 180;
function xr(e) {
  return e * vT;
}
function ta(e) {
  return e / vT;
}
function yT(e, t) {
  return e * t;
}
function ne() {
  return ne.zero();
}
function Ia(e, t, n) {
  return Math.max(t, Math.min(n, e));
}
function si(e, t, n) {
  return e + (t - e) * n;
}
function mg(e, t, n, r, i, a) {
  var o = (n - e) * a, s = (r - t) * a, u = i * i;
  return (2 * t - 2 * n + o + s) * (i * u) + (-3 * t + 3 * n - 2 * o - s) * u + o * i + t;
}
function ly(e, t, n, r) {
  var i = 1 - r;
  return i * i * e + 2 * i * r * t + r * r * n;
}
function bT(e, t, n) {
  var r;
  return r = function(i, a, o) {
    return (i - a) / (o - a);
  }(n, e, t), (n = Ia(r, 0, 1)) * n * (3 - 2 * n);
}
function A() {
  return A.zero();
}
function pi() {
  return pi.zero();
}
function xe() {
  return xe.zero();
}
function Nt() {
  return Nt.zero();
}
function yr() {
  return yr.zero();
}
function tG(e, t) {
  return e - t;
}
function ha(e, t) {
  e === void 0 && (e = 0), t === void 0 && (t = Number.MAX_SAFE_INTEGER);
  var n = e;
  return function() {
    var r = n;
    return n = (n + 1) % t, r;
  };
}
(function(e) {
  function t() {
    var m = [0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    return m[0] = 0, m;
  }
  function n() {
    var m = t();
    return m[0] = 1, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = 1, m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = 1, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }
  function r(m) {
    return m[0] = 1, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = 1, m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = 1, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }
  function i(m) {
    for (var v = 0; v < 16; v++) m[v] = 0;
    return m;
  }
  e.zero = t, e.identity = n, e.setIdentity = r, e.setZero = i, e.ofRows = function(m) {
    for (var v = t(), h = 0; h < 4; h++) for (var y = m[h], x = 0; x < 4; x++) v[4 * x + h] = y[x];
    return v;
  };
  var a = n();
  function o(m, v, h) {
    for (var y = 0; y < 16; y++) if (Math.abs(m[y] - v[y]) > h) return !1;
    return !0;
  }
  function s(m, v, h, y) {
    m[4 * h + v] = y;
  }
  function u(m, v) {
    return m[0] = v[0], m[1] = v[1], m[2] = v[2], m[3] = v[3], m[4] = v[4], m[5] = v[5], m[6] = v[6], m[7] = v[7], m[8] = v[8], m[9] = v[9], m[10] = v[10], m[11] = v[11], m[12] = v[12], m[13] = v[13], m[14] = v[14], m[15] = v[15], m;
  }
  function l(m, v) {
    var h = v[0], y = v[1], x = v[2], S = v[3], b = v[4], _ = v[5], C = v[6], w = v[7], I = v[8], M = v[9], E = v[10], T = v[11], P = v[12], k = v[13], D = v[14], B = v[15], L = h * _ - y * b, F = h * C - x * b, V = h * w - S * b, G = y * C - x * _, H = y * w - S * _, q = x * w - S * C, z = I * k - M * P, K = I * D - E * P, Y = I * B - T * P, Z = M * D - E * k, X = M * B - T * k, W = E * B - T * D, J = L * W - F * X + V * Z + G * Y - H * K + q * z;
    return !!J && (J = 1 / J, m[0] = (_ * W - C * X + w * Z) * J, m[1] = (x * X - y * W - S * Z) * J, m[2] = (k * q - D * H + B * G) * J, m[3] = (E * H - M * q - T * G) * J, m[4] = (C * Y - b * W - w * K) * J, m[5] = (h * W - x * Y + S * K) * J, m[6] = (D * V - P * q - B * F) * J, m[7] = (I * q - E * V + T * F) * J, m[8] = (b * X - _ * Y + w * z) * J, m[9] = (y * Y - h * X - S * z) * J, m[10] = (P * H - k * V + B * L) * J, m[11] = (M * V - I * H - T * L) * J, m[12] = (_ * K - b * Z - C * z) * J, m[13] = (h * Z - y * K + x * z) * J, m[14] = (k * F - P * G - D * L) * J, m[15] = (I * G - M * F + E * L) * J, !0);
  }
  function c(m, v, h) {
    var y = v[0], x = v[1], S = v[2], b = v[3], _ = v[4], C = v[5], w = v[6], I = v[7], M = v[8], E = v[9], T = v[10], P = v[11], k = v[12], D = v[13], B = v[14], L = v[15], F = h[0], V = h[1], G = h[2], H = h[3];
    return m[0] = F * y + V * _ + G * M + H * k, m[1] = F * x + V * C + G * E + H * D, m[2] = F * S + V * w + G * T + H * B, m[3] = F * b + V * I + G * P + H * L, F = h[4], V = h[5], G = h[6], H = h[7], m[4] = F * y + V * _ + G * M + H * k, m[5] = F * x + V * C + G * E + H * D, m[6] = F * S + V * w + G * T + H * B, m[7] = F * b + V * I + G * P + H * L, F = h[8], V = h[9], G = h[10], H = h[11], m[8] = F * y + V * _ + G * M + H * k, m[9] = F * x + V * C + G * E + H * D, m[10] = F * S + V * w + G * T + H * B, m[11] = F * b + V * I + G * P + H * L, F = h[12], V = h[13], G = h[14], H = h[15], m[12] = F * y + V * _ + G * M + H * k, m[13] = F * x + V * C + G * E + H * D, m[14] = F * S + V * w + G * T + H * B, m[15] = F * b + V * I + G * P + H * L, m;
  }
  function d(m, v, h) {
    var y = h[0], x = h[1], S = h[2], b = Math.sqrt(y * y + x * x + S * S);
    if (Math.abs(b) < sr) return r(m);
    y *= b = 1 / b, x *= b, S *= b;
    var _ = Math.sin(v), C = Math.cos(v), w = 1 - C;
    return m[0] = y * y * w + C, m[1] = x * y * w + S * _, m[2] = S * y * w - x * _, m[3] = 0, m[4] = y * x * w - S * _, m[5] = x * x * w + C, m[6] = S * x * w + y * _, m[7] = 0, m[8] = y * S * w + x * _, m[9] = x * S * w - y * _, m[10] = S * S * w + C, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }
  e.isIdentity = function(m, v) {
    return o(m, a, v === void 0 ? sr : v);
  }, e.hasNaN = function(m) {
    for (var v = 0; v < 16; v++) if (isNaN(m[v])) return !0;
    return !1;
  }, e.areEqual = o, e.setValue = s, e.getValue = function(m, v, h) {
    return m[4 * h + v];
  }, e.toArray = function(m, v, h) {
    return v[h + 0] = m[0], v[h + 1] = m[1], v[h + 2] = m[2], v[h + 3] = m[3], v[h + 4] = m[4], v[h + 5] = m[5], v[h + 6] = m[6], v[h + 7] = m[7], v[h + 8] = m[8], v[h + 9] = m[9], v[h + 10] = m[10], v[h + 11] = m[11], v[h + 12] = m[12], v[h + 13] = m[13], v[h + 14] = m[14], v[h + 15] = m[15], v;
  }, e.fromArray = function(m, v, h) {
    return m[0] = v[h + 0], m[1] = v[h + 1], m[2] = v[h + 2], m[3] = v[h + 3], m[4] = v[h + 4], m[5] = v[h + 5], m[6] = v[h + 6], m[7] = v[h + 7], m[8] = v[h + 8], m[9] = v[h + 9], m[10] = v[h + 10], m[11] = v[h + 11], m[12] = v[h + 12], m[13] = v[h + 13], m[14] = v[h + 14], m[15] = v[h + 15], m;
  }, e.fromBasis = function(m, v, h, y) {
    return i(m), s(m, 0, 0, v[0]), s(m, 1, 0, v[1]), s(m, 2, 0, v[2]), s(m, 0, 1, h[0]), s(m, 1, 1, h[1]), s(m, 2, 1, h[2]), s(m, 0, 2, y[0]), s(m, 1, 2, y[1]), s(m, 2, 2, y[2]), s(m, 3, 3, 1), m;
  }, e.copy = u, e.clone = function(m) {
    return u(t(), m);
  }, e.getTranslation = function(m, v) {
    return m[0] = v[12], m[1] = v[13], m[2] = v[14], m;
  }, e.getScaling = function(m, v) {
    var h = v[0], y = v[1], x = v[2], S = v[4], b = v[5], _ = v[6], C = v[8], w = v[9], I = v[10];
    return m[0] = Math.sqrt(h * h + y * y + x * x), m[1] = Math.sqrt(S * S + b * b + _ * _), m[2] = Math.sqrt(C * C + w * w + I * I), m;
  }, e.getRotation = function(m, v) {
    var h = v[0] + v[5] + v[10], y = 0;
    return h > 0 ? (y = 2 * Math.sqrt(h + 1), m[3] = 0.25 * y, m[0] = (v[6] - v[9]) / y, m[1] = (v[8] - v[2]) / y, m[2] = (v[1] - v[4]) / y) : v[0] > v[5] && v[0] > v[10] ? (y = 2 * Math.sqrt(1 + v[0] - v[5] - v[10]), m[3] = (v[6] - v[9]) / y, m[0] = 0.25 * y, m[1] = (v[1] + v[4]) / y, m[2] = (v[8] + v[2]) / y) : v[5] > v[10] ? (y = 2 * Math.sqrt(1 + v[5] - v[0] - v[10]), m[3] = (v[8] - v[2]) / y, m[0] = (v[1] + v[4]) / y, m[1] = 0.25 * y, m[2] = (v[6] + v[9]) / y) : (y = 2 * Math.sqrt(1 + v[10] - v[0] - v[5]), m[3] = (v[1] - v[4]) / y, m[0] = (v[8] + v[2]) / y, m[1] = (v[6] + v[9]) / y, m[2] = 0.25 * y), m;
  }, e.extractRotation = function(m, v) {
    var h = 1 / Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]), y = 1 / Math.sqrt(v[4] * v[4] + v[5] * v[5] + v[6] * v[6]), x = 1 / Math.sqrt(v[8] * v[8] + v[9] * v[9] + v[10] * v[10]);
    return m[0] = v[0] * h, m[1] = v[1] * h, m[2] = v[2] * h, m[3] = 0, m[4] = v[4] * y, m[5] = v[5] * y, m[6] = v[6] * y, m[7] = 0, m[8] = v[8] * x, m[9] = v[9] * x, m[10] = v[10] * x, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }, e.transpose = function(m, v) {
    if (m === v) {
      var h = v[1], y = v[2], x = v[3], S = v[6], b = v[7], _ = v[11];
      m[1] = v[4], m[2] = v[8], m[3] = v[12], m[4] = h, m[6] = v[9], m[7] = v[13], m[8] = y, m[9] = S, m[11] = v[14], m[12] = x, m[13] = b, m[14] = _;
    } else m[0] = v[0], m[1] = v[4], m[2] = v[8], m[3] = v[12], m[4] = v[1], m[5] = v[5], m[6] = v[9], m[7] = v[13], m[8] = v[2], m[9] = v[6], m[10] = v[10], m[11] = v[14], m[12] = v[3], m[13] = v[7], m[14] = v[11], m[15] = v[15];
    return m;
  }, e.tryInvert = l, e.invert = function(m, v) {
    return l(m, v) || console.warn("non-invertible matrix.", v), m;
  }, e.mul = c, e.mulOffset = function(m, v, h, y, x, S) {
    var b = v[0 + x], _ = v[1 + x], C = v[2 + x], w = v[3 + x], I = v[4 + x], M = v[5 + x], E = v[6 + x], T = v[7 + x], P = v[8 + x], k = v[9 + x], D = v[10 + x], B = v[11 + x], L = v[12 + x], F = v[13 + x], V = v[14 + x], G = v[15 + x], H = h[0 + S], q = h[1 + S], z = h[2 + S], K = h[3 + S];
    return m[0 + y] = H * b + q * I + z * P + K * L, m[1 + y] = H * _ + q * M + z * k + K * F, m[2 + y] = H * C + q * E + z * D + K * V, m[3 + y] = H * w + q * T + z * B + K * G, H = h[4 + S], q = h[5 + S], z = h[6 + S], K = h[7 + S], m[4 + y] = H * b + q * I + z * P + K * L, m[5 + y] = H * _ + q * M + z * k + K * F, m[6 + y] = H * C + q * E + z * D + K * V, m[7 + y] = H * w + q * T + z * B + K * G, H = h[8 + S], q = h[9 + S], z = h[10 + S], K = h[11 + S], m[8 + y] = H * b + q * I + z * P + K * L, m[9 + y] = H * _ + q * M + z * k + K * F, m[10 + y] = H * C + q * E + z * D + K * V, m[11 + y] = H * w + q * T + z * B + K * G, H = h[12 + S], q = h[13 + S], z = h[14 + S], K = h[15 + S], m[12 + y] = H * b + q * I + z * P + K * L, m[13 + y] = H * _ + q * M + z * k + K * F, m[14 + y] = H * C + q * E + z * D + K * V, m[15 + y] = H * w + q * T + z * B + K * G, m;
  }, e.mul3 = function(m, v, h, y) {
    return c(m, c(m, v, h), y);
  }, e.translate = function(m, v, h) {
    var y, x, S, b, _, C, w, I, M, E, T, P, k = h[0], D = h[1], B = h[2];
    return v === m ? (m[12] = v[0] * k + v[4] * D + v[8] * B + v[12], m[13] = v[1] * k + v[5] * D + v[9] * B + v[13], m[14] = v[2] * k + v[6] * D + v[10] * B + v[14], m[15] = v[3] * k + v[7] * D + v[11] * B + v[15]) : (y = v[0], x = v[1], S = v[2], b = v[3], _ = v[4], C = v[5], w = v[6], I = v[7], M = v[8], E = v[9], T = v[10], P = v[11], m[0] = y, m[1] = x, m[2] = S, m[3] = b, m[4] = _, m[5] = C, m[6] = w, m[7] = I, m[8] = M, m[9] = E, m[10] = T, m[11] = P, m[12] = y * k + _ * D + M * B + v[12], m[13] = x * k + C * D + E * B + v[13], m[14] = S * k + w * D + T * B + v[14], m[15] = b * k + I * D + P * B + v[15]), m;
  }, e.fromTranslation = function(m, v) {
    return m[0] = 1, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = 1, m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = 1, m[11] = 0, m[12] = v[0], m[13] = v[1], m[14] = v[2], m[15] = 1, m;
  }, e.setTranslation = function(m, v) {
    return m[12] = v[0], m[13] = v[1], m[14] = v[2], m;
  }, e.setAxes = function(m, v, h, y) {
    return m[0] = h[0], m[4] = h[1], m[8] = h[2], m[1] = y[0], m[5] = y[1], m[9] = y[2], m[2] = v[0], m[6] = v[1], m[10] = v[2], m;
  }, e.rotate = function(m, v, h, y) {
    var x = y[0], S = y[1], b = y[2], _ = Math.sqrt(x * x + S * S + b * b);
    if (Math.abs(_) < sr) return n();
    x *= _ = 1 / _, S *= _, b *= _;
    var C = Math.sin(h), w = Math.cos(h), I = 1 - w, M = v[0], E = v[1], T = v[2], P = v[3], k = v[4], D = v[5], B = v[6], L = v[7], F = v[8], V = v[9], G = v[10], H = v[11], q = x * x * I + w, z = S * x * I + b * C, K = b * x * I - S * C, Y = x * S * I - b * C, Z = S * S * I + w, X = b * S * I + x * C, W = x * b * I + S * C, J = S * b * I - x * C, $ = b * b * I + w;
    return m[0] = M * q + k * z + F * K, m[1] = E * q + D * z + V * K, m[2] = T * q + B * z + G * K, m[3] = P * q + L * z + H * K, m[4] = M * Y + k * Z + F * X, m[5] = E * Y + D * Z + V * X, m[6] = T * Y + B * Z + G * X, m[7] = P * Y + L * Z + H * X, m[8] = M * W + k * J + F * $, m[9] = E * W + D * J + V * $, m[10] = T * W + B * J + G * $, m[11] = P * W + L * J + H * $, v !== m && (m[12] = v[12], m[13] = v[13], m[14] = v[14], m[15] = v[15]), m;
  }, e.fromRotation = d, e.scale = function(m, v, h) {
    var y = h[0], x = h[1], S = h[2];
    return m[0] = v[0] * y, m[1] = v[1] * y, m[2] = v[2] * y, m[3] = v[3] * y, m[4] = v[4] * x, m[5] = v[5] * x, m[6] = v[6] * x, m[7] = v[7] * x, m[8] = v[8] * S, m[9] = v[9] * S, m[10] = v[10] * S, m[11] = v[11] * S, m[12] = v[12], m[13] = v[13], m[14] = v[14], m[15] = v[15], m;
  }, e.scaleUniformly = function(m, v, h) {
    return m[0] = v[0] * h, m[1] = v[1] * h, m[2] = v[2] * h, m[3] = v[3] * h, m[4] = v[4] * h, m[5] = v[5] * h, m[6] = v[6] * h, m[7] = v[7] * h, m[8] = v[8] * h, m[9] = v[9] * h, m[10] = v[10] * h, m[11] = v[11] * h, m[12] = v[12], m[13] = v[13], m[14] = v[14], m[15] = v[15], m;
  }, e.fromScaling = function(m, v) {
    return m[0] = v[0], m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = v[1], m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = v[2], m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }, e.fromUniformScaling = function(m, v) {
    return m[0] = v, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = v, m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = v, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }, e.fromMat3 = function(m, v) {
    return m[0] = v[0], m[1] = v[1], m[2] = v[2], m[4] = v[3], m[5] = v[4], m[6] = v[5], m[8] = v[6], m[9] = v[7], m[10] = v[8], m;
  }, e.makeTable = function(m) {
    for (var v = "", h = 0; h < 4; h++) {
      for (var y = 0; y < 4; y++) v += m[4 * y + h].toString(), y < 3 && (v += " ");
      h < 3 && (v += `
`);
    }
    return v;
  }, e.determinant = function(m) {
    var v = m[0], h = m[1], y = m[2], x = m[3], S = m[4], b = m[5], _ = m[6], C = m[7], w = m[8], I = m[9], M = m[10], E = m[11], T = m[12], P = m[13], k = m[14], D = m[15];
    return (v * b - h * S) * (M * D - E * k) - (v * _ - y * S) * (I * D - E * P) + (v * C - x * S) * (I * k - M * P) + (h * _ - y * b) * (w * D - E * T) - (h * C - x * b) * (w * k - M * T) + (y * C - x * _) * (w * P - I * T);
  }, e.isRotationAndTranslation = function(m, v) {
    return function(h, y) {
      var x = h[0], S = h[1], b = h[2], _ = h[3], C = h[4], w = h[5], I = h[6], M = h[7], E = h[8], T = h[9], P = h[10], k = h[11], D = h[15];
      return !(!(Ar(D, 1, y) && Ar(_, 0, y) && Ar(M, 0, y) && Ar(k, 0, y)) || !Ar(Math.abs(x * (w * P - I * T) - S * (C * P - I * E) + b * (C * T - w * E)), 1, y));
    }(m, v !== void 0 ? v : sr);
  }, e.isTranslationAndUniformScaling = function(m, v) {
    return function(h, y) {
      var x = h[0];
      return Ar(h[1], 0, y) && Ar(h[2], 0, y) && Ar(h[3], 0, y) && Ar(h[4], 0, y) && Ar(h[5], x, y) && Ar(h[6], 0, y) && Ar(h[7], 0, y) && Ar(h[8], 0, y) && Ar(h[9], 0, y) && Ar(h[10], x, y) && Ar(h[11], 0, y) && Ar(h[15], 1, y);
    }(m, v !== void 0 ? v : sr);
  }, e.fromQuat = function(m, v) {
    var h = v[0], y = v[1], x = v[2], S = v[3], b = h + h, _ = y + y, C = x + x, w = h * b, I = y * b, M = y * _, E = x * b, T = x * _, P = x * C, k = S * b, D = S * _, B = S * C;
    return m[0] = 1 - M - P, m[1] = I + B, m[2] = E - D, m[3] = 0, m[4] = I - B, m[5] = 1 - w - P, m[6] = T + k, m[7] = 0, m[8] = E + D, m[9] = T - k, m[10] = 1 - w - M, m[11] = 0, m[12] = 0, m[13] = 0, m[14] = 0, m[15] = 1, m;
  }, e.perspective = function(m, v, h, y, x, S, b) {
    var _ = 2 * S / (h - v), C = 2 * S / (y - x), w = (h + v) / (h - v), I = (y + x) / (y - x), M = -(b + S) / (b - S), E = -2 * b * S / (b - S);
    return m[0] = _, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = C, m[6] = 0, m[7] = 0, m[8] = w, m[9] = I, m[10] = M, m[11] = -1, m[12] = 0, m[13] = 0, m[14] = E, m[15] = 0, m;
  }, e.ortho = function(m, v, h, y, x, S, b) {
    var _ = 1 / (h - v), C = 1 / (y - x), w = 1 / (b - S), I = (h + v) * _, M = (y + x) * C, E = (b + S) * w;
    return m[0] = 2 * _, m[1] = 0, m[2] = 0, m[3] = 0, m[4] = 0, m[5] = 2 * C, m[6] = 0, m[7] = 0, m[8] = 0, m[9] = 0, m[10] = -2 * w, m[11] = 0, m[12] = -I, m[13] = -M, m[14] = -E, m[15] = 1, m;
  }, e.lookAt = function(m, v, h, y) {
    var x, S, b, _, C, w, I, M, E, T, P = v[0], k = v[1], D = v[2], B = y[0], L = y[1], F = y[2], V = h[0], G = h[1], H = h[2];
    return Math.abs(P - V) < sr && Math.abs(k - G) < sr && Math.abs(D - H) < sr ? r(m) : (I = P - V, M = k - G, E = D - H, x = L * (E *= T = 1 / Math.sqrt(I * I + M * M + E * E)) - F * (M *= T), S = F * (I *= T) - B * E, b = B * M - L * I, (T = Math.sqrt(x * x + S * S + b * b)) ? (x *= T = 1 / T, S *= T, b *= T) : (x = 0, S = 0, b = 0), _ = M * b - E * S, C = E * x - I * b, w = I * S - M * x, (T = Math.sqrt(_ * _ + C * C + w * w)) ? (_ *= T = 1 / T, C *= T, w *= T) : (_ = 0, C = 0, w = 0), m[0] = x, m[1] = _, m[2] = I, m[3] = 0, m[4] = S, m[5] = C, m[6] = M, m[7] = 0, m[8] = b, m[9] = w, m[10] = E, m[11] = 0, m[12] = -(x * P + S * k + b * D), m[13] = -(_ * P + C * k + w * D), m[14] = -(I * P + M * k + E * D), m[15] = 1, m);
  }, e.targetTo = function(m, v, h, y) {
    var x = v[0], S = v[1], b = v[2], _ = y[0], C = y[1], w = y[2], I = x - h[0], M = S - h[1], E = b - h[2], T = I * I + M * M + E * E;
    T > 0 && (I *= T = 1 / Math.sqrt(T), M *= T, E *= T);
    var P = C * E - w * M, k = w * I - _ * E, D = _ * M - C * I;
    return (T = P * P + k * k + D * D) > 0 && (P *= T = 1 / Math.sqrt(T), k *= T, D *= T), m[0] = P, m[1] = k, m[2] = D, m[3] = 0, m[4] = M * D - E * k, m[5] = E * P - I * D, m[6] = I * k - M * P, m[7] = 0, m[8] = I, m[9] = M, m[10] = E, m[11] = 0, m[12] = x, m[13] = S, m[14] = b, m[15] = 1, m;
  }, e.fromPermutation = function(m, v) {
    i(m);
    for (var h = 0; h < 4; h++)
      s(m, h, v[h], 1);
    return m;
  }, e.getMaxScaleOnAxis = function(m) {
    var v = m[0] * m[0] + m[1] * m[1] + m[2] * m[2], h = m[4] * m[4] + m[5] * m[5] + m[6] * m[6], y = m[8] * m[8] + m[9] * m[9] + m[10] * m[10];
    return Math.sqrt(Math.max(v, h, y));
  };
  var f = [1, 0, 0], p = [0, 1, 0], g = [0, 0, 1];
  e.rotX90 = d(t(), xr(90), f), e.rotX180 = d(t(), xr(180), f), e.rotY90 = d(t(), xr(90), p), e.rotY180 = d(t(), xr(180), p), e.rotY270 = d(t(), xr(270), p), e.rotZ90 = d(t(), xr(90), g), e.rotZ180 = d(t(), xr(180), g), e.rotXY90 = c(t(), e.rotX90, e.rotY90), e.rotZY90 = c(t(), e.rotZ90, e.rotY90), e.rotZYZ90 = c(t(), e.rotZY90, e.rotZ90), e.rotZ90X180 = c(t(), e.rotZ90, e.rotX180), e.rotY90Z180 = c(t(), e.rotY90, e.rotZ180), e.id = n();
})(ne || (ne = {})), function(e) {
  function t() {
    var T = [0.1, 0, 0];
    return T[0] = 0, T;
  }
  function n(T, P, k) {
    var D = t();
    return D[0] = T, D[1] = P, D[2] = k, D;
  }
  function r(T, P) {
    return T[0] = P[0], T[1] = P[1], T[2] = P[2], T;
  }
  function i(T, P, k) {
    return T[0] = P[0] + k[0], T[1] = P[1] + k[1], T[2] = P[2] + k[2], T;
  }
  function a(T, P, k) {
    return T[0] = P[0] - k[0], T[1] = P[1] - k[1], T[2] = P[2] - k[2], T;
  }
  function o(T, P, k) {
    return T[0] = P[0] * k, T[1] = P[1] * k, T[2] = P[2] * k, T;
  }
  function s(T, P, k, D) {
    return T[0] = P[0] + k[0] * D, T[1] = P[1] + k[1] * D, T[2] = P[2] + k[2] * D, T;
  }
  function u(T) {
    var P = T[0], k = T[1], D = T[2];
    return P * P + k * k + D * D;
  }
  function l(T, P) {
    return T[0] = -P[0], T[1] = -P[1], T[2] = -P[2], T;
  }
  function c(T, P) {
    var k = P[0], D = P[1], B = P[2], L = k * k + D * D + B * B;
    return L > 0 && (L = 1 / Math.sqrt(L), T[0] = P[0] * L, T[1] = P[1] * L, T[2] = P[2] * L), T;
  }
  function d(T, P) {
    return T[0] * P[0] + T[1] * P[1] + T[2] * P[2];
  }
  function f(T, P, k) {
    var D = P[0], B = P[1], L = P[2], F = k[0], V = k[1], G = k[2];
    return T[0] = B * G - L * V, T[1] = L * F - D * G, T[2] = D * V - B * F, T;
  }
  e.zero = t, e.clone = function(T) {
    var P = t();
    return P[0] = T[0], P[1] = T[1], P[2] = T[2], P;
  }, e.hasNaN = function(T) {
    return isNaN(T[0]) || isNaN(T[1]) || isNaN(T[2]);
  }, e.setNaN = function(T) {
    return T[0] = NaN, T[1] = NaN, T[2] = NaN, T;
  }, e.fromObj = function(T) {
    return n(T.x, T.y, T.z);
  }, e.toObj = function(T) {
    return { x: T[0], y: T[1], z: T[2] };
  }, e.fromArray = function(T, P, k) {
    return T[0] = P[k + 0], T[1] = P[k + 1], T[2] = P[k + 2], T;
  }, e.toArray = function(T, P, k) {
    return P[k + 0] = T[0], P[k + 1] = T[1], P[k + 2] = T[2], P;
  }, e.create = n, e.ofArray = function(T) {
    var P = t();
    return P[0] = T[0], P[1] = T[1], P[2] = T[2], P;
  }, e.set = function(T, P, k, D) {
    return T[0] = P, T[1] = k, T[2] = D, T;
  }, e.copy = r, e.add = i, e.sub = a, e.mul = function(T, P, k) {
    return T[0] = P[0] * k[0], T[1] = P[1] * k[1], T[2] = P[2] * k[2], T;
  }, e.div = function(T, P, k) {
    return T[0] = P[0] / k[0], T[1] = P[1] / k[1], T[2] = P[2] / k[2], T;
  }, e.scale = o, e.scaleAndAdd = s, e.scaleAndSub = function(T, P, k, D) {
    return T[0] = P[0] - k[0] * D, T[1] = P[1] - k[1] * D, T[2] = P[2] - k[2] * D, T;
  }, e.addScalar = function(T, P, k) {
    return T[0] = P[0] + k, T[1] = P[1] + k, T[2] = P[2] + k, T;
  }, e.subScalar = function(T, P, k) {
    return T[0] = P[0] - k, T[1] = P[1] - k, T[2] = P[2] - k, T;
  }, e.round = function(T, P) {
    return T[0] = Math.round(P[0]), T[1] = Math.round(P[1]), T[2] = Math.round(P[2]), T;
  }, e.ceil = function(T, P) {
    return T[0] = Math.ceil(P[0]), T[1] = Math.ceil(P[1]), T[2] = Math.ceil(P[2]), T;
  }, e.floor = function(T, P) {
    return T[0] = Math.floor(P[0]), T[1] = Math.floor(P[1]), T[2] = Math.floor(P[2]), T;
  }, e.trunc = function(T, P) {
    return T[0] = Math.trunc(P[0]), T[1] = Math.trunc(P[1]), T[2] = Math.trunc(P[2]), T;
  }, e.abs = function(T, P) {
    return T[0] = Math.abs(P[0]), T[1] = Math.abs(P[1]), T[2] = Math.abs(P[2]), T;
  }, e.min = function(T, P, k) {
    return T[0] = Math.min(P[0], k[0]), T[1] = Math.min(P[1], k[1]), T[2] = Math.min(P[2], k[2]), T;
  }, e.max = function(T, P, k) {
    return T[0] = Math.max(P[0], k[0]), T[1] = Math.max(P[1], k[1]), T[2] = Math.max(P[2], k[2]), T;
  }, e.distance = function(T, P) {
    var k = P[0] - T[0], D = P[1] - T[1], B = P[2] - T[2];
    return Math.sqrt(k * k + D * D + B * B);
  }, e.squaredDistance = function(T, P) {
    var k = P[0] - T[0], D = P[1] - T[1], B = P[2] - T[2];
    return k * k + D * D + B * B;
  }, e.magnitude = function(T) {
    var P = T[0], k = T[1], D = T[2];
    return Math.sqrt(P * P + k * k + D * D);
  }, e.squaredMagnitude = u, e.setMagnitude = function(T, P, k) {
    return o(T, c(T, P), k);
  }, e.negate = l, e.inverse = function(T, P) {
    return T[0] = 1 / P[0], T[1] = 1 / P[1], T[2] = 1 / P[2], T;
  }, e.normalize = c, e.dot = d, e.cross = f, e.lerp = function(T, P, k, D) {
    var B = P[0], L = P[1], F = P[2];
    return T[0] = B + D * (k[0] - B), T[1] = L + D * (k[1] - L), T[2] = F + D * (k[2] - F), T;
  };
  var p = t();
  function g(T, P) {
    var k = Math.sqrt(u(T) * u(P));
    if (k === 0) return Math.PI / 2;
    var D = d(T, P) / k;
    return Math.acos(Ia(D, -1, 1));
  }
  e.slerp = function(T, P, k, D) {
    var B = Ia(d(P, k), -1, 1), L = Math.acos(B) * D;
    return s(p, k, P, -B), c(p, p), i(T, o(T, P, Math.cos(L)), o(p, p, Math.sin(L)));
  }, e.hermite = function(T, P, k, D, B, L) {
    var F = L * L, V = F * (2 * L - 3) + 1, G = F * (L - 2) + L, H = F * (L - 1), q = F * (3 - 2 * L);
    return T[0] = P[0] * V + k[0] * G + D[0] * H + B[0] * q, T[1] = P[1] * V + k[1] * G + D[1] * H + B[1] * q, T[2] = P[2] * V + k[2] * G + D[2] * H + B[2] * q, T;
  }, e.bezier = function(T, P, k, D, B, L) {
    var F = 1 - L, V = F * F, G = L * L, H = V * F, q = 3 * L * V, z = 3 * G * F, K = G * L;
    return T[0] = P[0] * H + k[0] * q + D[0] * z + B[0] * K, T[1] = P[1] * H + k[1] * q + D[1] * z + B[1] * K, T[2] = P[2] * H + k[2] * q + D[2] * z + B[2] * K, T;
  }, e.quadraticBezier = function(T, P, k, D, B) {
    return T[0] = ly(P[0], k[0], D[0], B), T[1] = ly(P[1], k[1], D[1], B), T[2] = ly(P[2], k[2], D[2], B), T;
  }, e.spline = function(T, P, k, D, B, L, F) {
    return T[0] = mg(P[0], k[0], D[0], B[0], L, F), T[1] = mg(P[1], k[1], D[1], B[1], L, F), T[2] = mg(P[2], k[2], D[2], B[2], L, F), T;
  }, e.random = function(T, P) {
    var k = 2 * Math.random() * Math.PI, D = 2 * Math.random() - 1, B = Math.sqrt(1 - D * D) * P;
    return T[0] = Math.cos(k) * B, T[1] = Math.sin(k) * B, T[2] = D * P, T;
  }, e.transformMat4 = function(T, P, k) {
    var D = P[0], B = P[1], L = P[2], F = 1 / (k[3] * D + k[7] * B + k[11] * L + k[15] || 1);
    return T[0] = (k[0] * D + k[4] * B + k[8] * L + k[12]) * F, T[1] = (k[1] * D + k[5] * B + k[9] * L + k[13]) * F, T[2] = (k[2] * D + k[6] * B + k[10] * L + k[14]) * F, T;
  }, e.transformMat4Offset = function(T, P, k, D, B, L) {
    var F = P[0 + B], V = P[1 + B], G = P[2 + B], H = 1 / (k[3 + L] * F + k[7 + L] * V + k[11 + L] * G + k[15 + L] || 1);
    return T[0 + D] = (k[0 + L] * F + k[4 + L] * V + k[8 + L] * G + k[12 + L]) * H, T[1 + D] = (k[1 + L] * F + k[5 + L] * V + k[9 + L] * G + k[13 + L]) * H, T[2 + D] = (k[2 + L] * F + k[6 + L] * V + k[10 + L] * G + k[14 + L]) * H, T;
  }, e.transformMat3 = function(T, P, k) {
    var D = P[0], B = P[1], L = P[2];
    return T[0] = D * k[0] + B * k[3] + L * k[6], T[1] = D * k[1] + B * k[4] + L * k[7], T[2] = D * k[2] + B * k[5] + L * k[8], T;
  }, e.transformQuat = function(T, P, k) {
    var D = P[0], B = P[1], L = P[2], F = k[0], V = k[1], G = k[2], H = k[3], q = H * D + V * L - G * B, z = H * B + G * D - F * L, K = H * L + F * B - V * D, Y = -F * D - V * B - G * L;
    return T[0] = q * H + Y * -F + z * -G - K * -V, T[1] = z * H + Y * -V + K * -F - q * -G, T[2] = K * H + Y * -G + q * -V - z * -F, T;
  }, e.angle = g;
  var m = t(), v = t(), h = t(), y = t(), x = t(), S = t(), b = t();
  e.dihedralAngle = function(T, P, k, D) {
    a(m, T, P), a(v, k, P), a(h, P, k), a(y, D, k), f(x, m, v), f(S, h, y);
    var B = g(x, S);
    return f(b, x, S), d(v, b) > 0 ? B : -B;
  }, e.directionFromSpherical = function(T, P, k, D) {
    return e.set(T, D * Math.cos(k) * Math.sin(P), D * Math.sin(k) * Math.sin(P), D * Math.cos(P));
  }, e.exactEquals = function(T, P) {
    return T[0] === P[0] && T[1] === P[1] && T[2] === P[2];
  }, e.equals = function(T, P) {
    var k = T[0], D = T[1], B = T[2], L = P[0], F = P[1], V = P[2];
    return Math.abs(k - L) <= sr * Math.max(1, Math.abs(k), Math.abs(L)) && Math.abs(D - F) <= sr * Math.max(1, Math.abs(D), Math.abs(F)) && Math.abs(B - V) <= sr * Math.max(1, Math.abs(B), Math.abs(V));
  };
  var _ = t();
  e.makeRotation = function(T, P, k) {
    var D = g(P, k);
    if (Math.abs(D) < 1e-4) return ne.setIdentity(T);
    if (Math.abs(D - Math.PI) < sr) return ne.fromScaling(T, e.negUnit);
    var B = f(_, P, k);
    return ne.fromRotation(T, D, B);
  }, e.isZero = function(T) {
    return T[0] === 0 && T[1] === 0 && T[2] === 0;
  }, e.projectPointOnVector = function(T, P, k, D) {
    return a(T, P, D), i(T, o(T, k, d(k, T) / u(k)), D);
  };
  var C = t();
  function w(T, P, k) {
    return o(T, k, d(k, P) / u(k));
  }
  e.projectPointOnPlane = function(T, P, k, D) {
    return c(C, k), a(T, P, D), a(T, P, o(C, C, d(T, C)));
  }, e.projectOnVector = w;
  var I = t();
  e.projectOnPlane = function(T, P, k) {
    return w(I, P, k), a(T, P, I);
  }, e.orthogonalize = function(T, P, k) {
    return c(T, f(T, f(T, P, k), P));
  }, e.matchDirection = function(T, P, k) {
    return d(P, k) > 0 ? r(T, P) : l(T, r(T, P)), T;
  };
  var M = t(), E = t();
  e.triangleNormal = function(T, P, k, D) {
    return a(M, k, P), a(E, D, P), c(T, f(T, M, E));
  }, e.toString = function(T, P) {
    return "[".concat(T[0].toPrecision(P), " ").concat(T[1].toPrecision(P), " ").concat(T[2].toPrecision(P), "]");
  }, e.origin = n(0, 0, 0), e.unit = n(1, 1, 1), e.negUnit = n(-1, -1, -1), e.unitX = n(1, 0, 0), e.unitY = n(0, 1, 0), e.unitZ = n(0, 0, 1), e.negUnitX = n(-1, 0, 0), e.negUnitY = n(0, -1, 0), e.negUnitZ = n(0, 0, -1);
}(A || (A = {})), function(e) {
  function t() {
    var b = [0.1, 0, 0, 0, 0, 0, 0, 0, 0];
    return b[0] = 0, b;
  }
  function n() {
    var b = t();
    return b[0] = 1, b[1] = 0, b[2] = 0, b[3] = 0, b[4] = 1, b[5] = 0, b[6] = 0, b[7] = 0, b[8] = 1, b;
  }
  function r(b, _) {
    return b[0] = _[0], b[1] = _[1], b[2] = _[2], b[3] = _[4], b[4] = _[5], b[5] = _[6], b[6] = _[8], b[7] = _[9], b[8] = _[10], b;
  }
  e.zero = t, e.identity = n, e.setIdentity = function(b) {
    return b[0] = 1, b[1] = 0, b[2] = 0, b[3] = 0, b[4] = 1, b[5] = 0, b[6] = 0, b[7] = 0, b[8] = 1, b;
  }, e.toArray = function(b, _, C) {
    return _[C + 0] = b[0], _[C + 1] = b[1], _[C + 2] = b[2], _[C + 3] = b[3], _[C + 4] = b[4], _[C + 5] = b[5], _[C + 6] = b[6], _[C + 7] = b[7], _[C + 8] = b[8], _;
  }, e.fromArray = function(b, _, C) {
    return b[0] = _[C + 0], b[1] = _[C + 1], b[2] = _[C + 2], b[3] = _[C + 3], b[4] = _[C + 4], b[5] = _[C + 5], b[6] = _[C + 6], b[7] = _[C + 7], b[8] = _[C + 8], b;
  }, e.fromMat4 = r, e.create = function(b, _, C, w, I, M, E, T, P) {
    var k = t();
    return k[0] = b, k[1] = _, k[2] = C, k[3] = w, k[4] = I, k[5] = M, k[6] = E, k[7] = T, k[8] = P, k;
  };
  var i = n();
  function a(b, _, C) {
    for (var w = 0; w < 9; w++) if (Math.abs(b[w] - _[w]) > C) return !1;
    return !0;
  }
  function o(b, _) {
    return b[0] = _[0], b[1] = _[1], b[2] = _[2], b[3] = _[3], b[4] = _[4], b[5] = _[5], b[6] = _[6], b[7] = _[7], b[8] = _[8], b;
  }
  function s(b, _) {
    if (b === _) {
      var C = _[1], w = _[2], I = _[5];
      b[1] = _[3], b[2] = _[6], b[3] = C, b[5] = _[7], b[6] = w, b[7] = I;
    } else b[0] = _[0], b[1] = _[3], b[2] = _[6], b[3] = _[1], b[4] = _[4], b[5] = _[7], b[6] = _[2], b[7] = _[5], b[8] = _[8];
    return b;
  }
  function u(b, _) {
    var C = _[0], w = _[1], I = _[2], M = _[3], E = _[4], T = _[5], P = _[6], k = _[7], D = _[8], B = D * E - T * k, L = -D * M + T * P, F = k * M - E * P, V = C * B + w * L + I * F;
    return V ? (V = 1 / V, b[0] = B * V, b[1] = (-D * w + I * k) * V, b[2] = (T * w - I * E) * V, b[3] = L * V, b[4] = (D * C - I * P) * V, b[5] = (-T * C + I * M) * V, b[6] = F * V, b[7] = (-k * C + w * P) * V, b[8] = (E * C - w * M) * V, b) : (console.warn("non-invertible matrix.", _), b);
  }
  function l(b) {
    var _ = b[0], C = b[1], w = b[2], I = b[3], M = b[4], E = b[5], T = b[6], P = b[7], k = b[8];
    return _ * (k * M - E * P) + C * (-k * I + E * T) + w * (P * I - M * T);
  }
  function c(b) {
    return b[0] + b[4] + b[8];
  }
  function d(b, _, C) {
    return b[0] = _[0] - C[0], b[1] = _[1] - C[1], b[2] = _[2] - C[2], b[3] = _[3] - C[3], b[4] = _[4] - C[4], b[5] = _[5] - C[5], b[6] = _[6] - C[6], b[7] = _[7] - C[7], b[8] = _[8] - C[8], b;
  }
  function f(b, _, C) {
    return b[0] = _[0] * C, b[1] = _[1] * C, b[2] = _[2] * C, b[3] = _[3] * C, b[4] = _[4] * C, b[5] = _[5] * C, b[6] = _[6] * C, b[7] = _[7] * C, b[8] = _[8] * C, b;
  }
  e.isIdentity = function(b, _) {
    return a(b, i, _ === void 0 ? sr : _);
  }, e.hasNaN = function(b) {
    for (var _ = 0; _ < 9; _++) if (isNaN(b[_])) return !0;
    return !1;
  }, e.clone = function(b) {
    return o(t(), b);
  }, e.areEqual = a, e.setValue = function(b, _, C, w) {
    b[3 * C + _] = w;
  }, e.getValue = function(b, _, C) {
    return b[3 * C + _];
  }, e.copy = o, e.transpose = s, e.invert = u, e.symmtricFromUpper = function(b, _) {
    return b === _ ? (b[3] = _[1], b[6] = _[2], b[7] = _[5]) : (b[0] = _[0], b[1] = _[1], b[2] = _[2], b[3] = _[1], b[4] = _[4], b[5] = _[5], b[6] = _[2], b[7] = _[5], b[8] = _[8]), b;
  }, e.symmtricFromLower = function(b, _) {
    return b === _ ? (b[1] = _[3], b[2] = _[6], b[5] = _[7]) : (b[0] = _[0], b[1] = _[3], b[2] = _[6], b[3] = _[3], b[4] = _[4], b[5] = _[7], b[6] = _[6], b[7] = _[7], b[8] = _[8]), b;
  }, e.determinant = l, e.trace = c, e.sub = d, e.add = function(b, _, C) {
    return b[0] = _[0] + C[0], b[1] = _[1] + C[1], b[2] = _[2] + C[2], b[3] = _[3] + C[3], b[4] = _[4] + C[4], b[5] = _[5] + C[5], b[6] = _[6] + C[6], b[7] = _[7] + C[7], b[8] = _[8] + C[8], b;
  }, e.mul = function(b, _, C) {
    var w = _[0], I = _[1], M = _[2], E = _[3], T = _[4], P = _[5], k = _[6], D = _[7], B = _[8], L = C[0], F = C[1], V = C[2], G = C[3], H = C[4], q = C[5], z = C[6], K = C[7], Y = C[8];
    return b[0] = L * w + F * E + V * k, b[1] = L * I + F * T + V * D, b[2] = L * M + F * P + V * B, b[3] = G * w + H * E + q * k, b[4] = G * I + H * T + q * D, b[5] = G * M + H * P + q * B, b[6] = z * w + K * E + Y * k, b[7] = z * I + K * T + Y * D, b[8] = z * M + K * P + Y * B, b;
  }, e.subScalar = function(b, _, C) {
    return b[0] = _[0] - C, b[1] = _[1] - C, b[2] = _[2] - C, b[3] = _[3] - C, b[4] = _[4] - C, b[5] = _[5] - C, b[6] = _[6] - C, b[7] = _[7] - C, b[8] = _[8] - C, b;
  }, e.addScalar = function(b, _, C) {
    return b[0] = _[0] + C, b[1] = _[1] + C, b[2] = _[2] + C, b[3] = _[3] + C, b[4] = _[4] + C, b[5] = _[5] + C, b[6] = _[6] + C, b[7] = _[7] + C, b[8] = _[8] + C, b;
  }, e.mulScalar = f;
  var p = Math.PI / 3, g = t();
  e.symmetricEigenvalues = function(b, _) {
    var C = _[1] * _[1] + _[2] * _[2] + _[5] * _[5];
    if (C === 0) b[0] = _[0], b[1] = _[4], b[2] = _[8];
    else {
      var w = c(_) / 3, I = _[0] - w, M = _[4] - w, E = _[8] - w, T = I * I + M * M + E * E + 2 * C, P = Math.sqrt(T / 6);
      f(g, e.Identity, w), d(g, _, g), f(g, g, 1 / P);
      var k = l(g) / 2, D = k <= -1 ? p : k >= 1 ? 0 : Math.acos(k) / 3;
      b[0] = w + 2 * P * Math.cos(D), b[2] = w + 2 * P * Math.cos(D + 2 * p), b[1] = 3 * w - b[0] - b[2];
    }
    return b;
  };
  var m = [0.1, 0, 0], v = [0.1, 0, 0], h = [0.1, 0, 0], y = [0.1, 0, 0], x = [0.1, 0, 0], S = [0.1, 0, 0];
  e.eigenvector = function(b, _, C) {
    A.set(m, _[0] - C, _[1], _[2]), A.set(v, _[1], _[4] - C, _[5]), A.set(h, _[2], _[5], _[8] - C), A.cross(y, m, v), A.cross(x, m, h), A.cross(S, v, h);
    var w = A.dot(y, y), I = A.dot(x, x), M = A.dot(S, S), E = w, T = 0;
    return I > E && (E = I, T = 1), M > E && (T = 2), T === 0 ? A.scale(b, y, 1 / Math.sqrt(w)) : T === 1 ? A.scale(b, x, 1 / Math.sqrt(I)) : A.scale(b, S, 1 / Math.sqrt(M)), b;
  }, e.directionTransform = function(b, _) {
    return r(b, _), u(b, b), s(b, b), b;
  }, e.Identity = n();
}(pi || (pi = {})), function(e) {
  function t() {
    var n = [0.1, 0];
    return n[0] = 0, n;
  }
  e.zero = t, e.clone = function(n) {
    var r = t();
    return r[0] = n[0], r[1] = n[1], r;
  }, e.create = function(n, r) {
    var i = t();
    return i[0] = n, i[1] = r, i;
  }, e.hasNaN = function(n) {
    return isNaN(n[0]) || isNaN(n[1]);
  }, e.toArray = function(n, r, i) {
    return r[i + 0] = n[0], r[i + 1] = n[1], r;
  }, e.fromArray = function(n, r, i) {
    return n[0] = r[i + 0], n[1] = r[i + 1], n;
  }, e.copy = function(n, r) {
    return n[0] = r[0], n[1] = r[1], n;
  }, e.set = function(n, r, i) {
    return n[0] = r, n[1] = i, n;
  }, e.add = function(n, r, i) {
    return n[0] = r[0] + i[0], n[1] = r[1] + i[1], n;
  }, e.sub = function(n, r, i) {
    return n[0] = r[0] - i[0], n[1] = r[1] - i[1], n;
  }, e.mul = function(n, r, i) {
    return n[0] = r[0] * i[0], n[1] = r[1] * i[1], n;
  }, e.div = function(n, r, i) {
    return n[0] = r[0] / i[0], n[1] = r[1] / i[1], n;
  }, e.scale = function(n, r, i) {
    return n[0] = r[0] * i, n[1] = r[1] * i, n;
  }, e.round = function(n, r) {
    return n[0] = Math.round(r[0]), n[1] = Math.round(r[1]), n;
  }, e.ceil = function(n, r) {
    return n[0] = Math.ceil(r[0]), n[1] = Math.ceil(r[1]), n;
  }, e.floor = function(n, r) {
    return n[0] = Math.floor(r[0]), n[1] = Math.floor(r[1]), n;
  }, e.distance = function(n, r) {
    var i = r[0] - n[0], a = r[1] - n[1];
    return Math.sqrt(i * i + a * a);
  }, e.squaredDistance = function(n, r) {
    var i = r[0] - n[0], a = r[1] - n[1];
    return i * i + a * a;
  }, e.magnitude = function(n) {
    var r = n[0], i = n[1];
    return Math.sqrt(r * r + i * i);
  }, e.squaredMagnitude = function(n) {
    var r = n[0], i = n[1];
    return r * r + i * i;
  }, e.inverse = function(n, r) {
    return n[0] = 1 / r[0], n[1] = 1 / r[1], n;
  }, e.areEqual = function(n, r) {
    return n[0] === r[0] && n[1] === r[1];
  }, e.toString = function(n, r) {
    return "[".concat(n[0].toPrecision(r), " ").concat(n[1].toPrecision(r), "}]");
  }, e.normalize = function(n, r) {
    var i = r[0], a = r[1], o = i * i + a * a;
    return o > 0 && (o = 1 / Math.sqrt(o), n[0] = r[0] * o, n[1] = r[1] * o), n;
  };
}(xe || (xe = {})), function(e) {
  function t() {
    var r = [0.1, 0, 0, 0];
    return r[0] = 0, r;
  }
  function n(r, i) {
    return r[0] = i.center[0], r[1] = i.center[1], r[2] = i.center[2], r[3] = i.radius, r;
  }
  e.zero = t, e.clone = function(r) {
    var i = t();
    return i[0] = r[0], i[1] = r[1], i[2] = r[2], i[3] = r[3], i;
  }, e.create = function(r, i, a, o) {
    var s = t();
    return s[0] = r, s[1] = i, s[2] = a, s[3] = o, s;
  }, e.fromSphere = n, e.ofSphere = function(r) {
    return n(t(), r);
  }, e.hasNaN = function(r) {
    return isNaN(r[0]) || isNaN(r[1]) || isNaN(r[2]) || isNaN(r[3]);
  }, e.toArray = function(r, i, a) {
    return i[a + 0] = r[0], i[a + 1] = r[1], i[a + 2] = r[2], i[a + 3] = r[3], i;
  }, e.fromArray = function(r, i, a) {
    return r[0] = i[a + 0], r[1] = i[a + 1], r[2] = i[a + 2], r[3] = i[a + 3], r;
  }, e.toVec3Array = function(r, i, a) {
    i[a + 0] = r[0], i[a + 1] = r[1], i[a + 2] = r[2];
  }, e.fromVec3Array = function(r, i, a) {
    return r[0] = i[a + 0], r[1] = i[a + 1], r[2] = i[a + 2], r[3] = 0, r;
  }, e.copy = function(r, i) {
    return r[0] = i[0], r[1] = i[1], r[2] = i[2], r[3] = i[3], r;
  }, e.set = function(r, i, a, o, s) {
    return r[0] = i, r[1] = a, r[2] = o, r[3] = s, r;
  }, e.add = function(r, i, a) {
    return r[0] = i[0] + a[0], r[1] = i[1] + a[1], r[2] = i[2] + a[2], r[3] = i[3] + a[3], r;
  }, e.distance = function(r, i) {
    var a = i[0] - r[0], o = i[1] - r[1], s = i[2] - r[2], u = i[3] - r[3];
    return Math.sqrt(a * a + o * o + s * s + u * u);
  }, e.scale = function(r, i, a) {
    return r[0] = i[0] * a, r[1] = i[1] * a, r[2] = i[2] * a, r[4] = i[4] * a, r;
  }, e.round = function(r, i) {
    return r[0] = Math.round(i[0]), r[1] = Math.round(i[1]), r[2] = Math.round(i[2]), r[3] = Math.round(i[3]), r;
  }, e.ceil = function(r, i) {
    return r[0] = Math.ceil(i[0]), r[1] = Math.ceil(i[1]), r[2] = Math.ceil(i[2]), r[3] = Math.ceil(i[3]), r;
  }, e.floor = function(r, i) {
    return r[0] = Math.floor(i[0]), r[1] = Math.floor(i[1]), r[2] = Math.floor(i[2]), r[3] = Math.floor(i[3]), r;
  }, e.squaredDistance = function(r, i) {
    var a = i[0] - r[0], o = i[1] - r[1], s = i[2] - r[2], u = i[3] - r[3];
    return a * a + o * o + s * s + u * u;
  }, e.norm = function(r) {
    var i = r[0], a = r[1], o = r[2], s = r[3];
    return Math.sqrt(i * i + a * a + o * o + s * s);
  }, e.squaredNorm = function(r) {
    var i = r[0], a = r[1], o = r[2], s = r[3];
    return i * i + a * a + o * o + s * s;
  }, e.transformMat4 = function(r, i, a) {
    var o = i[0], s = i[1], u = i[2], l = i[3];
    return r[0] = a[0] * o + a[4] * s + a[8] * u + a[12] * l, r[1] = a[1] * o + a[5] * s + a[9] * u + a[13] * l, r[2] = a[2] * o + a[6] * s + a[10] * u + a[14] * l, r[3] = a[3] * o + a[7] * s + a[11] * u + a[15] * l, r;
  }, e.dot = function(r, i) {
    return r[0] * i[0] + r[1] * i[1] + r[2] * i[2] + r[3] * i[3];
  }, e.inverse = function(r, i) {
    return r[0] = 1 / i[0], r[1] = 1 / i[1], r[2] = 1 / i[2], r[3] = 1 / i[3], r;
  }, e.exactEquals = function(r, i) {
    return r[0] === i[0] && r[1] === i[1] && r[2] === i[2] && r[3] === i[3];
  }, e.equals = function(r, i) {
    var a = r[0], o = r[1], s = r[2], u = r[3], l = i[0], c = i[1], d = i[2], f = i[3];
    return Math.abs(a - l) <= sr * Math.max(1, Math.abs(a), Math.abs(l)) && Math.abs(o - c) <= sr * Math.max(1, Math.abs(o), Math.abs(c)) && Math.abs(s - d) <= sr * Math.max(1, Math.abs(s), Math.abs(d)) && Math.abs(u - f) <= sr * Math.max(1, Math.abs(u), Math.abs(f));
  }, e.toString = function(r, i) {
    return "[".concat(r[0].toPrecision(i), " ").concat(r[1].toPrecision(i), " ").concat(r[2].toPrecision(i), "  ").concat(r[3].toPrecision(i), "]");
  };
}(Nt || (Nt = {})), function(e) {
  function t() {
    var g = [0.1, 0, 0, 0];
    return g[0] = 0, g;
  }
  function n() {
    var g = t();
    return g[3] = 1, g;
  }
  function r(g, m, v) {
    v *= 0.5;
    var h = Math.sin(v);
    return g[0] = h * m[0], g[1] = h * m[1], g[2] = h * m[2], g[3] = Math.cos(v), g;
  }
  function i(g, m, v, h) {
    var y, x, S, b, _, C = m[0], w = m[1], I = m[2], M = m[3], E = v[0], T = v[1], P = v[2], k = v[3];
    return (x = C * E + w * T + I * P + M * k) < 0 && (x = -x, E = -E, T = -T, P = -P, k = -k), 1 - x > 1e-6 ? (y = Math.acos(x), S = Math.sin(y), b = Math.sin((1 - h) * y) / S, _ = Math.sin(h * y) / S) : (b = 1 - h, _ = h), g[0] = b * C + _ * E, g[1] = b * w + _ * T, g[2] = b * I + _ * P, g[3] = b * M + _ * k, g;
  }
  function a(g, m) {
    var v, h = m[0] + m[4] + m[8];
    if (h > 0) v = Math.sqrt(h + 1), g[3] = 0.5 * v, v = 0.5 / v, g[0] = (m[5] - m[7]) * v, g[1] = (m[6] - m[2]) * v, g[2] = (m[1] - m[3]) * v;
    else {
      var y = 0;
      m[4] > m[0] && (y = 1), m[8] > m[3 * y + y] && (y = 2);
      var x = (y + 1) % 3, S = (y + 2) % 3;
      v = Math.sqrt(m[3 * y + y] - m[3 * x + x] - m[3 * S + S] + 1), g[y] = 0.5 * v, v = 0.5 / v, g[3] = (m[3 * x + S] - m[3 * S + x]) * v, g[x] = (m[3 * x + y] + m[3 * y + x]) * v, g[S] = (m[3 * S + y] + m[3 * y + S]) * v;
    }
    return g;
  }
  e.zero = t, e.identity = n, e.setIdentity = function(g) {
    g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 1;
  }, e.hasNaN = function(g) {
    return isNaN(g[0]) || isNaN(g[1]) || isNaN(g[2]) || isNaN(g[3]);
  }, e.create = function(g, m, v, h) {
    var y = n();
    return y[0] = g, y[1] = m, y[2] = v, y[3] = h, y;
  }, e.setAxisAngle = r, e.getAxisAngle = function(g, m) {
    var v = 2 * Math.acos(m[3]), h = Math.sin(v / 2);
    return h !== 0 ? (g[0] = m[0] / h, g[1] = m[1] / h, g[2] = m[2] / h) : (g[0] = 1, g[1] = 0, g[2] = 0), v;
  }, e.multiply = function(g, m, v) {
    var h = m[0], y = m[1], x = m[2], S = m[3], b = v[0], _ = v[1], C = v[2], w = v[3];
    return g[0] = h * w + S * b + y * C - x * _, g[1] = y * w + S * _ + x * b - h * C, g[2] = x * w + S * C + h * _ - y * b, g[3] = S * w - h * b - y * _ - x * C, g;
  }, e.rotateX = function(g, m, v) {
    v *= 0.5;
    var h = m[0], y = m[1], x = m[2], S = m[3], b = Math.sin(v), _ = Math.cos(v);
    return g[0] = h * _ + S * b, g[1] = y * _ + x * b, g[2] = x * _ - y * b, g[3] = S * _ - h * b, g;
  }, e.rotateY = function(g, m, v) {
    v *= 0.5;
    var h = m[0], y = m[1], x = m[2], S = m[3], b = Math.sin(v), _ = Math.cos(v);
    return g[0] = h * _ - x * b, g[1] = y * _ + S * b, g[2] = x * _ + h * b, g[3] = S * _ - y * b, g;
  }, e.rotateZ = function(g, m, v) {
    v *= 0.5;
    var h = m[0], y = m[1], x = m[2], S = m[3], b = Math.sin(v), _ = Math.cos(v);
    return g[0] = h * _ + y * b, g[1] = y * _ - h * b, g[2] = x * _ + S * b, g[3] = S * _ - x * b, g;
  }, e.calculateW = function(g, m) {
    var v = m[0], h = m[1], y = m[2];
    return g[0] = v, g[1] = h, g[2] = y, g[3] = Math.sqrt(Math.abs(1 - v * v - h * h - y * y)), g;
  }, e.slerp = i, e.invert = function(g, m) {
    var v = m[0], h = m[1], y = m[2], x = m[3], S = v * v + h * h + y * y + x * x, b = S ? 1 / S : 0;
    return g[0] = -v * b, g[1] = -h * b, g[2] = -y * b, g[3] = x * b, g;
  }, e.conjugate = function(g, m) {
    return g[0] = -m[0], g[1] = -m[1], g[2] = -m[2], g[3] = m[3], g;
  }, e.fromMat3 = a;
  var o = [0, 0, 0];
  function s(g, m) {
    var v = m[0], h = m[1], y = m[2], x = m[3], S = v * v + h * h + y * y + x * x;
    return S > 0 && (S = 1 / Math.sqrt(S), g[0] = v * S, g[1] = h * S, g[2] = y * S, g[3] = x * S), g;
  }
  e.fromUnitVec3 = function(g, m, v) {
    var h = A.dot(m, v) + 1;
    return h < sr ? (h = 0, Math.abs(m[0]) > Math.abs(m[2]) ? A.set(o, -m[1], m[0], 0) : A.set(o, 0, -m[2], m[1])) : A.cross(o, m, v), g[0] = o[0], g[1] = o[1], g[2] = o[2], g[3] = h, s(g, g), g;
  }, e.clone = function(g) {
    var m = t();
    return m[0] = g[0], m[1] = g[1], m[2] = g[2], m[3] = g[3], m;
  }, e.toArray = function(g, m, v) {
    return m[v + 0] = g[0], m[v + 1] = g[1], m[v + 2] = g[2], m[v + 3] = g[3], m;
  }, e.fromArray = function(g, m, v) {
    return g[0] = m[v + 0], g[1] = m[v + 1], g[2] = m[v + 2], g[3] = m[v + 3], g;
  }, e.copy = function(g, m) {
    return g[0] = m[0], g[1] = m[1], g[2] = m[2], g[3] = m[3], g;
  }, e.set = function(g, m, v, h, y) {
    return g[0] = m, g[1] = v, g[2] = h, g[3] = y, g;
  }, e.exactEquals = function(g, m) {
    return g[0] === m[0] && g[1] === m[1] && g[2] === m[2] && g[3] === m[3];
  }, e.equals = function(g, m) {
    var v = g[0], h = g[1], y = g[2], x = g[3], S = m[0], b = m[1], _ = m[2], C = m[3];
    return Math.abs(v - S) <= sr * Math.max(1, Math.abs(v), Math.abs(S)) && Math.abs(h - b) <= sr * Math.max(1, Math.abs(h), Math.abs(b)) && Math.abs(y - _) <= sr * Math.max(1, Math.abs(y), Math.abs(_)) && Math.abs(x - C) <= sr * Math.max(1, Math.abs(x), Math.abs(C));
  }, e.add = function(g, m, v) {
    return g[0] = m[0] + v[0], g[1] = m[1] + v[1], g[2] = m[2] + v[2], g[3] = m[3] + v[3], g;
  }, e.normalize = s;
  var u = [0, 0, 0], l = [1, 0, 0], c = [0, 1, 0];
  e.rotationTo = function(g, m, v) {
    var h = A.dot(m, v);
    return h < -0.999999 ? (A.cross(u, l, m), A.magnitude(u) < 1e-6 && A.cross(u, c, m), A.normalize(u, u), r(g, u, Math.PI), g) : h > 0.999999 ? (g[0] = 0, g[1] = 0, g[2] = 0, g[3] = 1, g) : (A.cross(u, m, v), g[0] = u[0], g[1] = u[1], g[2] = u[2], g[3] = 1 + h, s(g, g));
  };
  var d = t(), f = t();
  e.sqlerp = function(g, m, v, h, y, x) {
    return i(d, m, y, x), i(f, v, h, x), i(g, d, f, 2 * x * (1 - x)), g;
  };
  var p = [0, 0, 0, 0, 0, 0, 0, 0, 0];
  e.setAxes = function(g, m, v, h) {
    return p[0] = v[0], p[3] = v[1], p[6] = v[2], p[1] = h[0], p[4] = h[1], p[7] = h[2], p[2] = -m[0], p[5] = -m[1], p[8] = -m[2], s(g, a(g, p));
  }, e.toString = function(g, m) {
    return "[".concat(g[0].toPrecision(m), " ").concat(g[1].toPrecision(m), " ").concat(g[2].toPrecision(m), "  ").concat(g[3].toPrecision(m), "]");
  }, e.Identity = n();
}(yr || (yr = {})), function(e) {
  function t(o, s, u) {
    var l = function(v, h, y) {
      for (var x = [], S = 0; S < h.length; S++) x[S] = h[h.length - S - 1];
      var b = [1];
      for (S = 1; S < v.length; S++) b[S] = v[x[S - 1]];
      return { dimensions: v, axisOrderFastToSlow: x, axisOrderSlowToFast: h, accessDimensions: b, defaultCtor: y || Float64Array };
    }(o, s, u), c = n(l), d = c.get, f = c.set, p = c.add, g = c.dataOffset, m = c.getCoords;
    return { rank: o.length, dimensions: o, axisOrderSlowToFast: s, create: r(l), get: d, set: f, add: p, dataOffset: g, getCoords: m };
  }
  function n(o) {
    var s = o.dimensions, u = o.axisOrderFastToSlow;
    switch (s.length) {
      case 1:
        return { get: function(P, k) {
          return P[k];
        }, set: function(P, k, D) {
          return P[k] = D;
        }, add: function(P, k, D) {
          return P[k] += D;
        }, dataOffset: function(P) {
          return P;
        }, getCoords: function(P, k) {
          return k[0] = P, k;
        } };
      case 2:
        if (u[0] === 0 && u[1] === 1) {
          var l = s[0];
          return { get: function(P, k, D) {
            return P[D * l + k];
          }, set: function(P, k, D, B) {
            return P[D * l + k] = B;
          }, add: function(P, k, D, B) {
            return P[D * l + k] += B;
          }, dataOffset: function(P, k) {
            return k * l + P;
          }, getCoords: function(P, k) {
            return k[0] = P % l, k[1] = Math.floor(P / l), k;
          } };
        }
        if (u[0] === 1 && u[1] === 0) {
          var c = s[1];
          return { get: function(P, k, D) {
            return P[k * c + D];
          }, set: function(P, k, D, B) {
            return P[k * c + D] = B;
          }, add: function(P, k, D, B) {
            return P[k * c + D] += B;
          }, dataOffset: function(P, k) {
            return P * c + k;
          }, getCoords: function(P, k) {
            return k[0] = Math.floor(P / c), k[1] = P % c, k;
          } };
        }
        throw new Error("bad axis order");
      case 3:
        if (u[0] === 0 && u[1] === 1 && u[2] === 2) {
          var d = s[0], f = s[1], p = d * f;
          return { get: function(P, k, D, B) {
            return P[k + D * d + B * p];
          }, set: function(P, k, D, B, L) {
            return P[k + D * d + B * p] = L;
          }, add: function(P, k, D, B, L) {
            return P[k + D * d + B * p] += L;
          }, dataOffset: function(P, k, D) {
            return P + k * d + D * p;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / d);
            return k[0] = P % d, k[1] = D % f, k[2] = Math.floor(D / f), k;
          } };
        }
        if (u[0] === 0 && u[1] === 2 && u[2] === 1) {
          var g = s[0], m = s[2], v = g * m;
          return { get: function(P, k, D, B) {
            return P[k + B * g + D * v];
          }, set: function(P, k, D, B, L) {
            return P[k + B * g + D * v] = L;
          }, add: function(P, k, D, B, L) {
            return P[k + B * g + D * v] += L;
          }, dataOffset: function(P, k, D) {
            return P + D * g + k * v;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / g);
            return k[0] = P % g, k[1] = Math.floor(D / m), k[2] = D % m, k;
          } };
        }
        if (u[0] === 1 && u[1] === 0 && u[2] === 2) {
          var h = s[1], y = s[0], x = h * y;
          return { get: function(P, k, D, B) {
            return P[D + k * h + B * x];
          }, set: function(P, k, D, B, L) {
            return P[D + k * h + B * x] = L;
          }, add: function(P, k, D, B, L) {
            return P[D + k * h + B * x] += L;
          }, dataOffset: function(P, k, D) {
            return k + P * h + D * x;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / h);
            return k[0] = D % y, k[1] = P % h, k[2] = Math.floor(D / y), k;
          } };
        }
        if (u[0] === 1 && u[1] === 2 && u[2] === 0) {
          var S = s[1], b = s[2], _ = S * b;
          return { get: function(P, k, D, B) {
            return P[D + B * S + k * _];
          }, set: function(P, k, D, B, L) {
            return P[D + B * S + k * _] = L;
          }, add: function(P, k, D, B, L) {
            return P[D + B * S + k * _] += L;
          }, dataOffset: function(P, k, D) {
            return k + D * S + P * _;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / S);
            return k[0] = Math.floor(D / b), k[1] = P % S, k[2] = D % b, k;
          } };
        }
        if (u[0] === 2 && u[1] === 0 && u[2] === 1) {
          var C = s[2], w = s[0], I = C * w;
          return { get: function(P, k, D, B) {
            return P[B + k * C + D * I];
          }, set: function(P, k, D, B, L) {
            return P[B + k * C + D * I] = L;
          }, add: function(P, k, D, B, L) {
            return P[B + k * C + D * I] += L;
          }, dataOffset: function(P, k, D) {
            return D + P * C + k * I;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / C);
            return k[0] = D % w, k[1] = Math.floor(D / w), k[2] = P % C, k;
          } };
        }
        if (u[0] === 2 && u[1] === 1 && u[2] === 0) {
          var M = s[2], E = s[1], T = M * E;
          return { get: function(P, k, D, B) {
            return P[B + D * M + k * T];
          }, set: function(P, k, D, B, L) {
            return P[B + D * M + k * T] = L;
          }, add: function(P, k, D, B, L) {
            return P[B + D * M + k * T] += L;
          }, dataOffset: function(P, k, D) {
            return D + k * M + P * T;
          }, getCoords: function(P, k) {
            var D = Math.floor(P / M);
            return k[0] = Math.floor(D / E), k[1] = D % E, k[2] = P % M, k;
          } };
        }
        throw new Error("bad axis order");
      default:
        return { get: function(P) {
          for (var k = [], D = 1; D < arguments.length; D++) k[D - 1] = arguments[D];
          return P[i(o, k)];
        }, set: function(P) {
          for (var k = [], D = 1; D < arguments.length; D++) k[D - 1] = arguments[D];
          return P[i(o, k)] = k[k.length - 1];
        }, add: function(P) {
          for (var k = [], D = 1; D < arguments.length; D++) k[D - 1] = arguments[D];
          return P[i(o, k)] += k[k.length - 1];
        }, dataOffset: function() {
          for (var P = [], k = 0; k < arguments.length; k++) P[k] = arguments[k];
          return i(o, P);
        }, getCoords: function(P, k) {
          return function(D, B, L) {
            for (var F = D.dimensions, V = D.axisOrderFastToSlow, G = F.length, H = B, q = 0; q < G; q++) {
              var z = F[V[q]];
              L[V[q]] = H % z, H = Math.floor(H / z);
            }
            return L[V[G + 1]] = H, L;
          }(o, P, k);
        } };
    }
  }
  function r(o) {
    for (var s = o.dimensions, u = 1, l = 0, c = s.length; l < c; l++) u *= s[l];
    return function(d) {
      return new (d || o.defaultCtor)(u);
    };
  }
  function i(o, s) {
    for (var u = o.accessDimensions, l = o.axisOrderFastToSlow, c = u.length - 1, d = u[c] * s[l[c]], f = c - 1; f >= 0; f--) d = (d + s[l[f]]) * u[f];
    return d;
  }
  function a(o, s) {
    for (var u = [], l = 0; l < o.length; l++) u[l] = o[s[l]];
    return u;
  }
  e.create = function(o, s) {
    return { space: o, data: s };
  }, e.Space = t, e.Data1 = function(o) {
    return o;
  }, e.Vector = function(o, s) {
    return t([o], [0], s);
  }, e.ColumnMajorMatrix = function(o, s, u) {
    return t([o, s], [1, 0], u);
  }, e.RowMajorMatrix = function(o, s, u) {
    return t([o, s], [0, 1], u);
  }, e.toMat4 = function(o, s, u) {
    if (s.rank !== 2) throw new Error("Invalid tensor rank");
    for (var l = Math.min(4, s.dimensions[0]), c = Math.min(4, s.dimensions[1]), d = 0; d < l; d++) for (var f = 0; f < c; f++) ne.setValue(o, d, f, s.get(u, d, f));
    return o;
  }, e.toMat3 = function(o, s, u) {
    if (s.rank !== 2) throw new Error("Invalid tensor rank");
    for (var l = Math.min(3, s.dimensions[0]), c = Math.min(3, s.dimensions[1]), d = 0; d < l; d++) for (var f = 0; f < c; f++) pi.setValue(o, d, f, s.get(u, d, f));
    return o;
  }, e.toVec3 = function(o, s, u) {
    if (s.rank !== 1) throw new Error("Invalid tensor rank");
    for (var l = Math.min(3, s.dimensions[0]), c = 0; c < l; c++) o[c] = u[c];
    return o;
  }, e.toVec4 = function(o, s, u) {
    if (s.rank !== 1) throw new Error("Invalid tensor rank");
    for (var l = Math.min(4, s.dimensions[0]), c = 0; c < l; c++) o[c] = u[c];
    return o;
  }, e.areEqualExact = function(o, s) {
    var u = o.length;
    if (u !== s.length) return !1;
    for (var l = 0; l < u; l++) if (o[l] !== s[l]) return !1;
    return !0;
  }, e.invertAxisOrder = function(o) {
    for (var s = [], u = 0; u < o.length; u++) s[u] = o[o.length - u - 1];
    return s;
  }, e.convertToCanonicalAxisIndicesFastToSlow = function(o) {
    for (var s = new Int32Array(o.length), u = 0; u < o.length; u++) s[o[u]] = u;
    return function(l) {
      return a(l, s);
    };
  }, e.convertToCanonicalAxisIndicesSlowToFast = function(o) {
    for (var s = new Int32Array(o.length), u = 0; u < o.length; u++) s[o[o.length - u - 1]] = u;
    return function(l) {
      return a(l, s);
    };
  };
}(wr || (wr = {})), function(e) {
  e.create = function(t) {
    return t;
  }, e.has = function(t, n) {
    return !!(t & n);
  }, e.hasAll = function(t, n) {
    return !!n && (t & n) === n;
  };
}(Qi || (Qi = {})), function(e) {
  e.create = function(i) {
    return i === void 0 && (i = 512), { current: [], offset: 0, capacity: i, chunks: [] };
  }, e.getString = function(i) {
    return i.chunks.length ? (i.offset > 0 && (i.chunks[i.chunks.length] = i.current.length === i.offset ? i.current.join("") : i.current.slice(0, i.offset).join("")), i.chunks.join("")) : i.current.length === i.offset ? i.current.join("") : i.current.splice(0, i.offset).join("");
  }, e.getSize = function(i) {
    for (var a = 0, o = 0, s = i.chunks; o < s.length; o++)
      a += s[o].length;
    for (var u = 0; u < i.offset; u++) a += i.current[u].length;
    return a;
  }, e.getChunks = function(i) {
    return i.offset > 0 && (i.current.length === i.offset ? i.chunks[i.chunks.length] = i.current.join("") : i.chunks[i.chunks.length] = i.current.slice(0, i.offset).join(""), i.offset = 0), i.chunks;
  };
  var t = [];
  function n(i, a) {
    a > 0 && r(i, t[a]);
  }
  function r(i, a) {
    i.offset === i.capacity && (i.chunks[i.chunks.length] = i.current.join(""), i.offset = 0), i.current[i.offset++] = a;
  }
  (function() {
    for (var i = "", a = 0; a < 512; a++) t[a] = i, i += " ";
  })(), e.newline = function(i) {
    r(i, `
`);
  }, e.whitespace = n, e.whitespace1 = function(i) {
    r(i, " ");
  }, e.write = function(i, a) {
    a && (i.offset === i.capacity && (i.chunks[i.chunks.length] = i.current.join(""), i.offset = 0), i.current[i.offset++] = a);
  }, e.writeSafe = r, e.writePadLeft = function(i, a, o) {
    a ? (n(i, o - a.length), r(i, a)) : n(i, o);
  }, e.writePadRight = function(i, a, o) {
    if (a) {
      var s = o - a.length;
      r(i, a), n(i, s);
    } else n(i, o);
  }, e.writeInteger = function(i, a) {
    r(i, "" + a);
  }, e.writeIntegerAndSpace = function(i, a) {
    r(i, a + " ");
  }, e.writeIntegerPadLeft = function(i, a, o) {
    var s = "" + a;
    n(i, o - s.length), r(i, s);
  }, e.writeIntegerPadRight = function(i, a, o) {
    var s = "" + a, u = o - s.length;
    r(i, s), n(i, u);
  }, e.writeFloat = function(i, a, o) {
    r(i, "" + Math.round(o * a) / o);
  }, e.writeFloatPadLeft = function(i, a, o, s) {
    var u = "" + Math.round(o * a) / o;
    n(i, s - u.length), r(i, u);
  }, e.writeFloatPadRight = function(i, a, o, s) {
    var u = "" + Math.round(o * a) / o, l = s - u.length;
    r(i, u), n(i, l);
  };
}(Sn || (Sn = {})), function(e) {
  var t = typeof btoa < "u" ? btoa : function(r) {
    return Buffer.from(r).toString("base64");
  }, n = [];
  e.create22 = function() {
    for (var r = +/* @__PURE__ */ new Date() + Wr(), i = 0; i < 16; i++) n[i] = String.fromCharCode((r + 255 * Math.random()) % 255 | 0), r = Math.floor(r / 255);
    return t(n.join("")).replace(/\+/g, "-").replace(/\//g, "_").substr(0, 22);
  }, e.createv4 = function() {
    var r = +/* @__PURE__ */ new Date() + Wr(), i = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(a) {
      var o = (r + 16 * Math.random()) % 16 | 0;
      return r = Math.floor(r / 16), (a === "x" ? o : 3 & o | 8).toString(16);
    });
    return i;
  }, e.is = function(r) {
    return typeof r == "string";
  };
}(di || (di = {})), function(e) {
  var t = function() {
    function u() {
      this.size = 0;
    }
    return u.prototype.has = function(l) {
      return !1;
    }, u.prototype.forEach = function(l, c) {
      return c;
    }, u;
  }(), n = function() {
    function u(l) {
      this.idx = l, this.size = 1;
    }
    return u.prototype.has = function(l) {
      return l === this.idx;
    }, u.prototype.forEach = function(l, c) {
      return l(this.idx, c), c;
    }, u;
  }(), r = function() {
    function u(l, c) {
      this.mask = l, this.size = c, this.length = l.length;
    }
    return u.prototype.has = function(l) {
      return l < this.length && !!this.mask[l];
    }, u.prototype._forEach = function(l, c) {
      for (var d = 0; d < this.length; d++) this.mask[d] && l(d, c);
    }, u.prototype.forEach = function(l, c) {
      return this._forEach(l, c), c;
    }, u;
  }(), i = function() {
    function u(l) {
      this.size = l;
    }
    return u.prototype.has = function(l) {
      return !0;
    }, u.prototype._forEach = function(l, c) {
      for (var d = 0; d < this.size; d++) l(d, c);
    }, u.prototype.forEach = function(l, c) {
      return this._forEach(l, c), c;
    }, u;
  }(), a = function() {
    function u(l) {
      this.set = l, this._flat = void 0, this.size = l.size;
    }
    return u.prototype.has = function(l) {
      return this.set.has(l);
    }, u.prototype._forEach = function(l, c) {
      for (var d = 0, f = this.flatten(); d < f.length; d++)
        l(f[d], c);
    }, u.prototype.flatten = function() {
      if (this._flat) return this._flat;
      var l = new Int32Array(this.size), c = 0;
      return this.set.forEach(function(d) {
        return l[c++] = d;
      }), function(d) {
        Array.prototype.sort.call(d, tG);
      }(l), this._flat = l, this._flat;
    }, u.prototype.forEach = function(l, c) {
      return this._forEach(l, c), c;
    }, u;
  }();
  function o(u) {
    return new a(u);
  }
  function s(u, l) {
    return new r(u, l);
  }
  e.always = function(u) {
    return new i(u);
  }, e.never = new t(), e.ofSet = o, e.singleton = function(u) {
    return new n(u);
  }, e.ofUniqueIndices = function(u) {
    var l = u.length;
    if (l === 0) return new t();
    if (l === 1) return new n(u[0]);
    for (var c = 0, d = 0, f = u; d < f.length; d++)
      (v = f[d]) > c && (c = v);
    if (l === c) return new i(l);
    if (l / c < 1 / 12) {
      for (var p = /* @__PURE__ */ new Set(), g = 0, m = u; g < m.length; g++) {
        var v = m[g];
        p.add(v);
      }
      return new a(p);
    }
    for (var h = new Int8Array(c + 1), y = 0, x = u; y < x.length; y++)
      h[v = x[y]] = 1;
    return new r(h, u.length);
  }, e.ofMask = s, e.hasAny = function(u, l) {
    for (var c = 0, d = l; c < d.length; c++) {
      var f = d[c];
      if (u.has(f)) return !0;
    }
    return !1;
  }, e.complement = function(u, l) {
    var c = 0, d = 0;
    if (l.forEach(function(g) {
      u.has(g) || (c++, g > d && (d = g));
    }), c / d < 1 / 12) {
      var f = /* @__PURE__ */ new Set();
      return l.forEach(function(g) {
        u.has(g) || f.add(g);
      }), o(f);
    }
    var p = new Uint8Array(d + 1);
    return l.forEach(function(g) {
      u.has(g) || (p[g] = 1);
    }), s(p, c);
  };
}(O9 || (O9 = {})), function(e) {
  e.create = function(t) {
    return { ref: t };
  }, e.set = function(t, n) {
    return t.ref = n, t;
  };
}(Zp || (Zp = {}));
var Vc, R, nG = ha(0, 2147483647);
function Bi() {
  return Bi.zero();
}
function fu() {
  return fu.zero();
}
function Ae(e) {
  return e;
}
function dn(e, t, n, r) {
  return { label: e, description: n, list: r, type: t };
}
function Of(e, t, n) {
  var r = {};
  for (var i in e) {
    var a = e[i];
    a = Ae.saturate(a, t), a = Ae.darken(a, -n), r[i] = a;
  }
  return r;
}
(function(e) {
  e.create = function(t, n) {
    return { id: nG(), version: 0, value: t, metadata: n };
  }, e.withValue = function(t, n) {
    return { id: t.id, version: t.version + 1, value: n, metadata: t.metadata };
  };
})(Vc || (Vc = {})), function(e) {
  function t(n, r) {
    return Zp.set(n, Vc.withValue(n.ref, r));
  }
  e.create = function(n, r) {
    return Zp.create(Vc.create(n, r));
  }, e.update = t, e.set = function(n, r) {
    return Zp.set(n, r);
  }, e.updateIfChanged = function(n, r) {
    return n.ref.value !== r ? t(n, r) : n;
  };
}(R || (R = {})), function(e) {
  function t() {
    var y = [0.1, 0, 0];
    return y[0] = 0, y;
  }
  function n(y, x) {
    var S = x[0], b = x[1], _ = x[2], C = Math.sqrt(b * b + _ * _), w = (ta(Math.atan2(_, b)) + 360) % 360;
    return Math.round(1e4 * C) === 0 && (w = Number.NaN), y[0] = w, y[1] = C, y[2] = S, y;
  }
  function r(y, x, S) {
    return y[0] = x[0] - o * S, y[1] = x[1], y[2] = x[2], y;
  }
  e.zero = t, e.create = function(y, x, S) {
    var b = t();
    return b[0] = y, b[1] = x, b[2] = S, b;
  }, e.fromColor = function(y, x) {
    var S = Ae.toRgb(x), b = function(M, E, T) {
      M = v(M), E = v(E), T = v(T);
      var P = h((0.4124564 * M + 0.3575761 * E + 0.1804375 * T) / s), k = h((0.2126729 * M + 0.7151522 * E + 0.072175 * T) / u), D = h((0.0193339 * M + 0.119192 * E + 0.9503041 * T) / l);
      return [P, k, D];
    }(S[0], S[1], S[2]), _ = b[0], C = b[1], w = b[2], I = 116 * C - 16;
    return y[0] = I < 0 ? 0 : I, y[1] = 500 * (_ - C), y[2] = 200 * (C - w), y;
  }, e.fromHcl = function(y, x) {
    return fu.toLab(y, x);
  }, e.toColor = function(y) {
    var x = (y[0] + 16) / 116, S = isNaN(y[1]) ? x : x + y[1] / 500, b = isNaN(y[2]) ? x : x - y[2] / 200;
    x = u * m(x);
    var _ = g(3.2404542 * (S = s * m(S)) - 1.5371385 * x - 0.4985314 * (b = l * m(b))), C = g(-0.969266 * S + 1.8760108 * x + 0.041556 * b), w = g(0.0556434 * S - 0.2040259 * x + 1.0572252 * b);
    return Ae.fromRgb(Math.round(Ia(_, 0, 255)), Math.round(Ia(C, 0, 255)), Math.round(Ia(w, 0, 255)));
  }, e.toHcl = n, e.copy = function(y, x) {
    return y[0] = x[0], y[1] = x[1], y[2] = x[2], y;
  }, e.darken = r, e.lighten = function(y, x, S) {
    return r(y, x, -S);
  };
  var i = [0, 0, 0];
  function a(y, x, S) {
    return n(i, x), fu.toLab(y, fu.saturate(i, i, S));
  }
  e.saturate = a, e.desaturate = function(y, x, S) {
    return a(y, x, -S);
  };
  var o = 18, s = 0.95047, u = 1, l = 1.08883, c = 0.137931034, d = 0.206896552, f = 0.12841855, p = 8856452e-9;
  function g(y) {
    return 255 * (y <= 304e-5 ? 12.92 * y : 1.055 * Math.pow(y, 1 / 2.4) - 0.055);
  }
  function m(y) {
    return y > d ? y * y * y : f * (y - c);
  }
  function v(y) {
    return (y /= 255) <= 0.04045 ? y / 12.92 : Math.pow((y + 0.055) / 1.055, 2.4);
  }
  function h(y) {
    return y > p ? Math.pow(y, 1 / 3) : y / f + c;
  }
}(Bi || (Bi = {})), function(e) {
  function t() {
    var l = [0.1, 0, 0];
    return l[0] = 0, l;
  }
  e.zero = t, e.create = function(l, c, d) {
    var f = t();
    return f[0] = l, f[1] = c, f[2] = d, f;
  };
  var n = [0, 0, 0];
  e.fromColor = function(l, c) {
    return Bi.toHcl(l, Bi.fromColor(n, c));
  }, e.fromLab = function(l, c) {
    return Bi.toHcl(l, c);
  };
  var r = [0, 0, 0];
  function i(l, c) {
    var d = c[0], f = c[1], p = c[2];
    return isNaN(d) && (d = 0), d = xr(d), l[0] = p, l[1] = Math.cos(d) * f, l[2] = Math.sin(d) * f, l;
  }
  function a(l, c, d) {
    return l[0] = c[0], l[1] = Math.max(0, c[1] + u * d), l[2] = c[2], l;
  }
  e.toColor = function(l) {
    return Bi.toColor(i(r, l));
  }, e.toLab = i, e.copy = function(l, c) {
    return l[0] = c[0], l[1] = c[1], l[2] = c[2], l;
  }, e.saturate = a, e.desaturate = function(l, c, d) {
    return a(l, c, -d);
  };
  var o = [0, 0, 0];
  function s(l, c, d) {
    return i(o, c), Bi.toHcl(l, Bi.darken(o, o, d));
  }
  e.darken = s, e.lighten = function(l, c, d) {
    return s(l, c, -d);
  };
  var u = 18;
}(fu || (fu = {})), function(e) {
  function t(l, c, d) {
    return l << 16 | c << 8 | d;
  }
  function n(l, c, d) {
    return 255 * l << 16 | 255 * c << 8 | 255 * d;
  }
  e.toStyle = function(l) {
    return "rgb(".concat(l >> 16 & 255, ", ").concat(l >> 8 & 255, ", ").concat(255 & l, ")");
  }, e.toHexString = function(l) {
    return "0x" + ("000000" + l.toString(16)).slice(-6);
  }, e.toRgbString = function(l) {
    return "RGB: ".concat(e.toRgb(l).join(", "));
  }, e.toRgb = function(l) {
    return [l >> 16 & 255, l >> 8 & 255, 255 & l];
  }, e.toRgbNormalized = function(l) {
    return [(l >> 16 & 255) / 255, (l >> 8 & 255) / 255, (255 & l) / 255];
  }, e.fromRgb = t, e.fromNormalizedRgb = n, e.fromArray = function(l, c) {
    return t(l[c], l[c + 1], l[c + 2]);
  }, e.fromNormalizedArray = function(l, c) {
    return n(l[c], l[c + 1], l[c + 2]);
  }, e.toArray = function(l, c, d) {
    return c[d] = l >> 16 & 255, c[d + 1] = l >> 8 & 255, c[d + 2] = 255 & l, c;
  }, e.toArrayNormalized = function(l, c, d) {
    return c[d] = (l >> 16 & 255) / 255, c[d + 1] = (l >> 8 & 255) / 255, c[d + 2] = (255 & l) / 255, c;
  }, e.toVec3 = function(l, c) {
    return l[0] = c >> 16 & 255, l[1] = c >> 8 & 255, l[2] = 255 & c, l;
  }, e.toVec3Normalized = function(l, c) {
    return l[0] = (c >> 16 & 255) / 255, l[1] = (c >> 8 & 255) / 255, l[2] = (255 & c) / 255, l;
  }, e.interpolate = function(l, c, d) {
    var f = l >> 16 & 255, p = l >> 8 & 255, g = 255 & l;
    return f + ((c >> 16 & 255) - f) * d << 16 | p + ((c >> 8 & 255) - p) * d << 8 | g + ((255 & c) - g) * d;
  };
  var r = [0, 0, 0];
  function i(l, c) {
    return fu.fromColor(r, l), fu.toColor(fu.saturate(r, r, c));
  }
  e.saturate = i, e.desaturate = function(l, c) {
    return i(l, -c);
  };
  var a = [0, 0, 0];
  function o(l, c) {
    return Bi.fromColor(a, l), Bi.toColor(Bi.darken(a, a, c));
  }
  function s(l) {
    return l < 0.04045 ? 0.0773993808 * l : Math.pow(0.9478672986 * l + 0.0521327014, 2.4);
  }
  function u(l) {
    return l < 31308e-7 ? 12.92 * l : 1.055 * Math.pow(l, 0.41666) - 0.055;
  }
  e.darken = o, e.lighten = function(l, c) {
    return o(l, -c);
  }, e.sRGBToLinear = function(l) {
    return n(s((l >> 16 & 255) / 255), s((l >> 8 & 255) / 255), s((255 & l) / 255));
  }, e.linearToSRGB = function(l) {
    return n(u((l >> 16 & 255) / 255), u((l >> 8 & 255) / 255), u((255 & l) / 255));
  };
}(Ae || (Ae = {}));
var rG = function(e) {
  return e.toUpperCase();
};
function S6(e) {
  return e.toLowerCase().replace(/^\w|\s\w/g, rG);
}
function Su(e) {
  return S6(function(t, n) {
    return n === void 0 && (n = " "), t.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g, "$1".concat(n, "$2"));
  }(function(t) {
    return t.replace(/_/g, " ");
  }(function(t) {
    return t.replace(/-/g, " ");
  }(e))));
}
function Ur(e, t, n, r) {
  var i = r.length;
  if (i > n - t) return !1;
  for (var a = 0; a < i; a++) if (e.charCodeAt(t + a) !== r.charCodeAt(a)) return !1;
  return !0;
}
function A6(e) {
  return e.replace(/<\/?[^>]+>/g, "");
}
var be, ja = { "orange-red": dn("Orange-Red", "sequential", "Orange-Red, sequential color scheme from ColorBrewer 2.0", [16775148, 16705736, 16635038, 16628612, 16551257, 15689032, 14102559, 11730944, 8323072]), "purple-blue": dn("Purple-Blue", "sequential", "Purple-Blue, sequential color scheme from ColorBrewer 2.0", [16775163, 15525874, 13685222, 10927579, 7645647, 3576e3, 356528, 285325, 145496]), "blue-purple": dn("Blue-Purple", "sequential", "Blue-Purple, sequential color scheme from ColorBrewer 2.0", [16252157, 14740724, 12571622, 10403034, 9213638, 9202609, 8929693, 8458108, 5046347]), oranges: dn("Oranges", "sequential", "", [16774635, 16705230, 16634018, 16625259, 16616764, 15821075, 14239745, 10892803, 8333060]), "blue-green": dn("Blue-Green", "sequential", "", [16252157, 15070713, 13429990, 10082505, 6734500, 4304502, 2329413, 27948, 17435]), "yellow-orange-brown": dn("Yellow-Orange-Brown", "sequential", "", [16777189, 16775100, 16704401, 16696399, 16685353, 15495188, 13388802, 10040324, 6694150]), "yellow-green": dn("Yellow-Green", "sequential", "", [16777189, 16252089, 14282915, 11394446, 7915129, 4303709, 2327619, 26679, 17705]), reds: dn("Reds", "sequential", "", [16774640, 16703698, 16563105, 16552562, 16476746, 15678252, 13309981, 10817301, 6750221]), "red-purple": dn("Red-Purple", "sequential", "", [16775155, 16638173, 16565696, 16424885, 16214177, 14496919, 11403646, 7995767, 4784234]), greens: dn("Greens", "sequential", "", [16252149, 15070688, 13101504, 10607003, 7652470, 4303709, 2329413, 27948, 17435]), "yellow-green-blue": dn("Yellow-Green-Blue", "sequential", "", [16777177, 15595697, 13101492, 8375739, 4306628, 1937856, 2252456, 2438292, 531800]), purples: dn("Purples", "sequential", "", [16579581, 15724021, 14342891, 12369372, 10394312, 8420794, 6967715, 5515151, 4128893]), "green-blue": dn("Green-Blue", "sequential", "", [16252144, 14742491, 13429701, 11066805, 8113348, 5157843, 2854078, 551084, 540801]), greys: dn("Greys", "sequential", "", [16777215, 15790320, 14277081, 12434877, 9868950, 7566195, 5395026, 2434341, 0]), "yellow-orange-red": dn("Yellow-Orange-Red", "sequential", "", [16777164, 16772512, 16701814, 16691788, 16616764, 16535082, 14883356, 12386342, 8388646]), "purple-red": dn("Purple-Red", "sequential", "", [16250105, 15196655, 13941210, 13210823, 14640560, 15149450, 13505110, 9961539, 6750239]), blues: dn("Blues", "sequential", "", [16251903, 14609399, 13032431, 10406625, 7057110, 4362950, 2191797, 545180, 536683]), "purple-blue-green": dn("Purple-Blue-Green", "sequential", "", [16775163, 15524592, 13685222, 10927579, 6793679, 3576e3, 164234, 93273, 83510]), spectral: dn("Spectral", "diverging", "", [10355010, 13975119, 16018755, 16625249, 16703627, 16777151, 15136152, 11263396, 6734501, 3311805, 6180770]), "red-yellow-green": dn("Red-Yellow-Green", "diverging", "", [10813478, 14102567, 16018755, 16625249, 16703627, 16777151, 14282635, 10934634, 6733155, 1742928, 26679]), "red-blue": dn("Red-Blue", "diverging", "", [6750239, 11671595, 14049357, 16033154, 16636871, 16250871, 13755888, 9618910, 4428739, 2188972, 340065]), "pink-yellow-green": dn("Pink-Yellow-Green", "diverging", "", [9306450, 12917629, 14579630, 15840986, 16638191, 16250871, 15136208, 12116358, 8371265, 5083681, 2581529]), "purple-green": dn("Purple-Green", "diverging", "", [4194379, 7744131, 10055851, 12756431, 15193320, 16250871, 14282963, 10935200, 5942881, 1800247, 17435]), "red-yellow-blue": dn("Red-Yellow-Blue", "diverging", "Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0", [10813478, 14102567, 16018755, 16625249, 16703632, 16777151, 14742520, 11262441, 7646673, 4552116, 3225237]), "brown-white-green": dn("Brown-White-Green", "diverging", "", [5517317, 9195786, 12550445, 14664317, 16181443, 16119285, 13101797, 8441281, 3512207, 91742, 15408]), "red-grey": dn("Red-Grey", "diverging", "", [6750239, 11671595, 14049357, 16033154, 16636871, 16777215, 14737632, 12237498, 8882055, 5066061, 1710618]), "orange-purple": dn("Orange-Purple", "diverging", "", [8338184, 11753478, 14713364, 16627811, 16703670, 16250871, 14211819, 11709394, 8418220, 5515144, 2949195]), "set-2": dn("Set-2", "qualitative", "", [6734501, 16551266, 9281739, 15174339, 10934356, 16767279, 15058068, 11776947]), accent: dn("Accent", "qualitative", "", [8374655, 12496596, 16629894, 16777113, 3697840, 15729279, 12540695, 6710886]), "set-1": dn("Set-1", "qualitative", "", [14948892, 3636920, 5091146, 9981603, 16744192, 16777011, 10901032, 16220607, 10066329]), "set-3": dn("Set-3", "qualitative", "", [9294791, 16777139, 12499674, 16482418, 8434131, 16626786, 11787881, 16567781, 14277081, 12353725, 13429701, 16772463]), "dark-2": dn("Dark-2", "qualitative", "", [1810039, 14245634, 7696563, 15149450, 6727198, 15117058, 10909213, 6710886]), paired: dn("Paired", "qualitative", "", [10931939, 2062516, 11722634, 3383340, 16489113, 14883356, 16629615, 16744192, 13284054, 6962586, 16777113, 11622696]), "pastel-2": dn("Pastel-2", "qualitative", "", [11789005, 16633260, 13358568, 16042724, 15136201, 16773806, 15852236, 13421772]), "pastel-1": dn("Pastel-1", "qualitative", "", [16495790, 11783651, 13429701, 14601188, 16701862, 16777164, 15063229, 16636652, 15921906]), "many-distinct": dn("Many-Distinct", "qualitative", "", [8948459, 11646160, 16116990, 6994595, 6727198, 15117058, 10909213, 6710886, 14948892, 3636920, 5091146, 9981603, 16744192, 16777011, 10901032, 16220607, 10066329, 6734501, 16551266, 9281739, 15174339, 10934356, 16767279, 15058068, 11776947]), magma: dn("Magma", "sequential", "Perceptually uniform shades of black-red-white", [4329332, 4853881, 5378684, 5903742, 6363263, 6888576, 7413633, 7938689, 8463745, 8988801, 9513600, 10038655, 10563454, 11088508, 11613562, 12138360, 12728949, 13254258, 13714030, 14239338, 14699366, 15094114, 15489119, 15753309, 16017499, 16216411, 16350045, 16483424, 16551523, 16619368, 16621934, 16689780, 16692091, 16694402, 16696969, 16633746, 16636058, 16638371, 16575148, 16577461, 16514239]), inferno: dn("Inferno", "sequential", "Perceptually uniform shades of black-red-yellow", [4721514, 5246316, 5771373, 6296430, 6821486, 7346542, 7871597, 8396651, 8921450, 9446504, 9971557, 10496610, 10956127, 11481435, 12006486, 12466258, 12926285, 13386056, 13780802, 14241085, 14570295, 14965297, 15229227, 15558693, 15757342, 15956248, 16154897, 16288267, 16421638, 16489734, 16492043, 16494612, 16496926, 16368426, 16305463, 16111429, 15982678, 15853928, 15856253, 16119953, 16580260]), plasma: dn("Plasma", "sequential", "Perceptually uniform shades of blue-red-yellow", [1771148, 2426257, 3081365, 3671193, 4195228, 4784799, 5308834, 5833124, 6357158, 6815911, 7340200, 7864744, 8324007, 8783782, 9309348, 9769377, 10164126, 10624154, 11018902, 11413393, 11808141, 12137352, 12466307, 12795519, 13124730, 13453685, 13717361, 14046573, 14309992, 14573668, 14837344, 15035483, 15299159, 15497299, 15695438, 15893834, 16091974, 16224833, 16357693, 16425017, 16557877, 16625457, 16627245, 16629289, 16631334, 16567845, 16438820, 16310052, 16115494, 15921190, 15726625]), viridis: dn("Viridis", "sequential", "Perceptually uniform shades of blue-green-yellow", [4524123, 4656994, 4658793, 4726127, 4727668, 4663929, 4599933, 4535937, 4406404, 4276870, 4081800, 3952010, 3822475, 3627148, 3497356, 3302029, 3172237, 3042446, 2912654, 2782862, 2652814, 2523022, 2393229, 2328973, 2198924, 2069132, 2004874, 2005897, 2007175, 2139525, 2337154, 2666111, 3060348, 3520376, 4045684, 4570991, 5227369, 5883748, 6605661, 7392854, 8180303, 8967495, 9819967, 10672695, 11525166, 12443174, 13295646, 14148121, 15000344, 15852828, 16639780]), cividis: dn("Cividis", "sequential", "Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users", [11367, 12400, 537456, 1455727, 2046574, 2571629, 3031404, 3425388, 3754092, 4148075, 4476779, 4805227, 5133932, 5396844, 5725549, 5988462, 6317166, 6580079, 6843249, 7171698, 7434867, 7697781, 7960951, 8289656, 8618104, 8881272, 9209976, 9538679, 9867127, 10195830, 10524533, 10853235, 11181938, 11510640, 11839343, 12168045, 12497002, 12891240, 13219941, 13548642, 13943134, 14271834, 14666326, 14995025, 15389516, 15718470, 16112703, 16507190, 16639799]), twilight: dn("Twilight", "sequential", "Perceptually uniform shades of white-blue-black-red-white, cyclic", [14670305, 14211037, 13554648, 12766675, 11847630, 10993866, 10139847, 9351365, 8628419, 8036290, 7509952, 7048895, 6718653, 6519739, 6386105, 6252470, 6184114, 6181293, 6112935, 6044831, 5976470, 5777291, 5447293, 5052270, 4592479, 4067665, 3674181, 3281211, 3150646, 3543352, 4067644, 4657728, 5379141, 6166345, 6953549, 7741007, 8463184, 9120336, 9777743, 10304079, 10830671, 11291984, 11687762, 12083541, 12348505, 12613471, 12878439, 13077872, 13211771, 13411209, 13545111, 13809830, 14074293, 14338756, 14537169, 14735067, 14801121]), turbo: dn("Turbo", "sequential", "Improved (smooth) rainbow colormap for visualization", [4866485, 4872413, 4354034, 3770361, 3120629, 2667241, 2475736, 2611140, 3073454, 3928216, 5109892, 6487408, 8126047, 9829201, 11531332, 13167162, 14605618, 15780908, 16693543, 16753699, 16748063, 16741916, 16146200, 15026195, 13644558, 12198408, 10818563, 9833728]), rainbow: dn("Rainbow", "sequential", "", [3367393, 3516485, 16383744, 15501073, 12526114]), "red-white-blue": dn("Red-White-Blue", "diverging", "", [12526114, 16777215, 3367393]) }, R9 = Object.keys(ja).map(function(e) {
  return [e, ja[e].label, S6(ja[e].type)];
});
function Dl(e) {
  return e in ja ? ja[e] : (console.warn("unknown color list named '".concat(e, "'")), ja["red-yellow-blue"]);
}
function Ws(e) {
  return { kind: "table-legend", table: e };
}
function pg(e, t, n) {
  return e[t] - e[n];
}
function Qd(e, t, n) {
  var r = e[t];
  e[t] = e[n], e[n] = r;
}
function _T(e, t, n, r) {
  var i = n + r >> 1;
  return t(e, n, r) > 0 ? t(e, n, i) > 0 ? t(e, i, r) > 0 ? i : r : n : t(e, r, i) > 0 ? t(e, i, n) > 0 ? i : n : r;
}
function iG(e, t, n) {
  var r = e.cmp, i = e.swap, a = e.data, o = e.parts, s = t + 1, u = n;
  for (i(a, t, _T(a, r, t, n)); r(a, u, t) > 0; ) --u;
  for (var l = t + 1; l <= u; l++) {
    var c = r(a, l, t);
    if (c > 0) {
      for (i(a, l, u), --u; r(a, u, t) > 0; ) --u;
      l--;
    } else c === 0 && (i(a, l, s), s++);
  }
  for (l = t; l < s; l++) i(a, l, t + u - l);
  o[0] = u - s + t + 1, o[1] = u;
}
function aG(e, t, n) {
  for (var r = e.data, i = e.cmp, a = e.swap, o = t + 1; o <= n; o++) for (var s = o - 1; s >= t && i(r, s, s + 1) > 0; ) a(r, s, s + 1), s -= 1;
}
function Vg(e, t, n) {
  for (var r = e.parts; t < n; ) {
    if (n - t < 16) return void aG(e, t, n);
    iG(e, t, n);
    var i = r[0], a = r[1];
    i - t < n - a ? (Vg(e, t, i - 1), t = a + 1) : (Vg(e, a + 1, n), n = i - 1);
  }
}
function oG(e, t, n, r) {
  var i = n + 1, a = r;
  Qd(e, n, _T(e, pg, n, r));
  for (var o = e[n]; e[a] > o; ) --a;
  for (var s = n + 1; s <= a; s++) {
    var u = e[s];
    if (u > o) {
      for (Qd(e, s, a), --a; e[a] > o; ) --a;
      s--;
    } else u === o && (Qd(e, s, i), ++i);
  }
  for (s = n; s < i; s++) Qd(e, s, n + a - s);
  t[0] = a - i + n + 1, t[1] = a;
}
function sG(e, t, n) {
  for (var r = t + 1; r <= n; r++) {
    for (var i = e[r], a = r - 1; a >= t && e[a] > i; ) e[a + 1] = e[a], a -= 1;
    e[a + 1] = i;
  }
}
function $b(e, t, n, r) {
  for (; n < r; ) {
    if (r - n < 16) return void sG(e, n, r);
    oG(e, t, n, r);
    var i = t[0], a = t[1];
    i - n < r - a ? ($b(e, t, n, i - 1), n = a + 1) : ($b(e, t, a + 1, r), r = i - 1);
  }
}
function zs(e, t) {
  return t === void 0 && (t = pg), function(n, r, i, a) {
    return a === void 0 && (a = pg), a === pg ? $b(n, [0, 0], r, i - 1) : Vg({ data: n, cmp: a, swap: Qd, parts: [0, 0] }, r, i - 1), n;
  }(e, 0, e.length, t);
}
function xT(e, t, n, r, i) {
  return Vg({ data: e, cmp: r, swap: i, parts: [0, 0] }, t, n - 1), e;
}
function uG(e, t, n) {
  return e[t].key < e[n].key ? -1 : 1;
}
function cy(e, t, n) {
  var r = n && n.start || 0, i = n && n.end || e.length;
  if (i - r <= 0) throw new Error("Can only bucket non-empty collections.");
  return function(a, o, s, u, l) {
    for (var c = /* @__PURE__ */ new Map(), d = [], f = o(a[0]), p = !0, g = u; g < l; g++) {
      var m = o(a[g]);
      if (c.has(m)) c.get(m).count++, f !== m && (p = !1);
      else {
        var v = { key: m, count: 1, offset: g };
        c.set(m, v), d[d.length] = v;
      }
      f = m;
    }
    var h = new Int32Array(d.length + 1);
    h[d.length] = l;
    var y = !0;
    if (s) {
      g = 1;
      for (var x = d.length; g < x; g++) if (d[g - 1].key > d[g].key) {
        y = !1;
        break;
      }
    }
    if (p && y) {
      for (g = 0; g < d.length; g++) h[g] = d[g].offset;
      return h;
    }
    s && !y && xT(d, 0, d.length, uG, Qd);
    var S = 0;
    for (g = 0; g < d.length; g++) {
      var b = d[g];
      b.offset = S, S += b.count;
    }
    var _ = new Int32Array(l - u);
    for (g = u; g < l; g++) m = o(a[g]), _[(v = c.get(m)).offset++] = a[g];
    for (g = 0, x = _.length; g < x; g++) a[g + u] = _[g];
    for (h[0] = u, g = 1; g < d.length; g++) h[g] = d[g - 1].offset + u;
    return h;
  }(e, t, !(!n || !n.sort), r, i);
}
R9.filter(function(e) {
  return ja[e[0]].type === "diverging" || ja[e[0]].type === "sequential";
}), R9.filter(function(e) {
  return ja[e[0]].type === "qualitative";
}), function(e) {
  function t(r) {
    var i = r.growBy * r.elementSize;
    r.currentSize = i, r.currentIndex = 0, r.currentChunk = new r.ctor(i), r.allocatedSize += i, r.chunks[r.chunks.length] = r.currentChunk;
  }
  function n(r, i) {
    var a = r.ctor, o = r.chunks, s = r.currentIndex;
    if (!o.length) return new a(0);
    if (o.length === 1 && (i || s === r.allocatedSize)) return o[0];
    for (var u = 0, l = 0, c = o.length - 1; l < c; l++) u += o[l].length;
    var d = new a(u += r.currentIndex), f = 0;
    if (d.buffer) for (l = 0, c = o.length - 1; l < c; l++) d.set(o[l], f), f += o[l].length;
    else for (l = 0, c = o.length - 1; l < c; l++) {
      for (var p = o[l], g = 0, m = p.length; g < m; g++) d[f + g] = p[g];
      f += p.length;
    }
    var v = o[o.length - 1];
    if (d.buffer && s >= r.currentSize) d.set(v, f);
    else for (g = 0, m = v.length; g < m; g++) d[f + g] = v[g];
    return d;
  }
  e.is = function(r) {
    return r.creator && r.chunkSize;
  }, e.add4 = function(r, i, a, o, s) {
    r.currentIndex >= r.currentSize && t(r);
    var u = r.currentChunk, l = r.currentIndex;
    return u[l] = i, u[l + 1] = a, u[l + 2] = o, u[l + 3] = s, r.currentIndex += 4, r.elementCount++;
  }, e.add3 = function(r, i, a, o) {
    r.currentIndex >= r.currentSize && t(r);
    var s = r.currentChunk, u = r.currentIndex;
    return s[u] = i, s[u + 1] = a, s[u + 2] = o, r.currentIndex += 3, r.elementCount++;
  }, e.add2 = function(r, i, a) {
    r.currentIndex >= r.currentSize && t(r);
    var o = r.currentChunk, s = r.currentIndex;
    return o[s] = i, o[s + 1] = a, r.currentIndex += 2, r.elementCount++;
  }, e.add = function(r, i) {
    return r.currentIndex >= r.currentSize && t(r), r.currentChunk[r.currentIndex] = i, r.currentIndex += 1, r.elementCount++;
  }, e.addRepeat = function(r, i, a) {
    for (var o = 0; o < i; o++) r.currentIndex >= r.currentSize && t(r), r.currentChunk[r.currentIndex++] = a, r.elementCount++;
    return r.elementCount;
  }, e.addMany = function(r, i) {
    for (var a = r.elementSize, o = 0, s = i.length; o < s; o += a) {
      r.currentIndex >= r.currentSize && t(r);
      for (var u = r.currentChunk, l = 0; l < a; l++) u[r.currentIndex++] = i[o + l];
      r.elementCount++;
    }
    return r.elementCount;
  }, e.compact = function(r, i) {
    return i === void 0 && (i = !1), n(r, i);
  }, e._compact = n, e.create = function(r, i, a, o) {
    var s = { ctor: r, elementSize: i, growBy: Math.max(1, Math.ceil(a)), allocatedSize: 0, elementCount: 0, currentSize: 0, currentChunk: void 0, currentIndex: 0, chunks: [] };
    if (o === void 0) return s;
    if (typeof o == "number") return s.currentChunk = new r(o * i), s.allocatedSize = o * i, s.currentSize = s.currentChunk.length, s.chunks[0] = s.currentChunk, s;
    var u = o;
    if (u.length % i != 0) throw new Error("initialChunk length must be a multiple of the element size.");
    return s.currentChunk = u, s.allocatedSize = u.length, s.currentSize = u.length, s.chunks[0] = u, s;
  };
}(be || (be = {}));
var Q, On, e5, Xr, lG = function() {
  function e(t, n) {
    this.getHash = t, this.areEqual = n, this.id = 0, this.byHash = /* @__PURE__ */ new Map(), this.groups = [];
  }
  return e.prototype.createGroup = function(t, n) {
    var r = this.id++, i = [t];
    return this.groups[r] = i, { id: r, keys: i, value: n };
  }, e.prototype.add = function(t, n) {
    var r = this.getHash(n);
    if (this.byHash.has(r)) {
      for (var i = this.byHash.get(r), a = 0, o = i.length; a < o; a++) {
        var s = i[a];
        if (this.areEqual(n, s.value)) return s.keys[s.keys.length] = t, s.value;
      }
      var u = this.createGroup(t, n);
      return i[i.length] = u, u.value;
    }
    return u = this.createGroup(t, n), this.byHash.set(r, [u]), u.value;
  }, e;
}();
function CT(e) {
  var t = e ^ e >> 4;
  return t = (3735928559 ^ t) + (t << 5), t ^= t >> 11;
}
function Bm(e, t) {
  var n = 23;
  return n = 31 * (n = 31 * n + e | 0) + t | 0, n = (3735928559 ^ (n ^= n >> 4)) + (n << 5), n ^= n >> 11;
}
function t5(e) {
  for (var t = 0, n = 0, r = e.length; n < r; n++) t = (t << 5) - t + e.charCodeAt(n++) | 0;
  return t;
}
function as(e, t) {
  return (e + t) * (e + t + 1) / 2 + t;
}
function Gg(e, t) {
  return e < t ? as(e, t) : as(t, e);
}
function pa(e) {
  for (var t = 2166136261, n = 0, r = e.length; n < r; ++n) t ^= e[n], t += (t << 1) + (t << 4) + (t << 7) + (t << 8) + (t << 24);
  return t >>> 0;
}
function zg(e, t) {
  return { start: t && t.start !== void 0 ? Math.max(Math.min(t.start, e - 1), 0) : 0, end: t && t.end !== void 0 ? Math.min(t.end, e) : e };
}
function th(e, t) {
  var n = t && t.array !== void 0 ? t.array : Array, r = zg(e, t), i = r.start, a = r.end;
  return { array: new n(a - i), start: i, end: a };
}
function Ri(e, t, n) {
  var r = th(e, n);
  return function(i, a, o) {
    for (var s = 0, u = a.length; s < u; s++) a[s] = i(o + s);
    return a;
  }(t, r.array, r.start);
}
function w6(e) {
  return !!e.buffer && typeof e.byteLength == "number" && typeof e.BYTES_PER_ELEMENT == "number";
}
function Ug(e, t) {
  var n = e.constructor, r = e.buffer, i = e.length, a = e.byteOffset, o = e.BYTES_PER_ELEMENT, s = zg(i, t), u = s.start, l = s.end;
  return u === 0 && l === i ? e : new n(r, a + o * u, Math.min(i, l - u));
}
function Hd(e, t, n) {
  for (; t < n && e.charCodeAt(t) === 32; ) t++;
  return Qc(e, t, n);
}
function Qc(e, t, n) {
  var r = t, i = 0, a = 1;
  for (e.charCodeAt(r) === 45 ? (a = -1, ++r) : e.charCodeAt(r) === 43 && ++r; r < n; r++) {
    var o = e.charCodeAt(r) - 48;
    if (o > 9 || o < 0) return a * i | 0;
    i = 10 * i + o | 0;
  }
  return a * i;
}
function L9(e, t, n, r) {
  return t.charCodeAt(n) === 43 && n++, e * Math.pow(10, Qc(t, n, r));
}
function sf(e, t, n) {
  var r = t, i = 1, a = 0, o = 0, s = 1;
  for (e.charCodeAt(r) === 45 ? (i = -1, ++r) : e.charCodeAt(r) === 43 && ++r; r < n; ) {
    var u = e.charCodeAt(r) - 48;
    if (!(u >= 0 && u < 10)) {
      if (u === -2) {
        for (++r; r < n; ) {
          if (!((u = e.charCodeAt(r) - 48) >= 0 && u < 10)) return u === 53 || u === 21 ? L9(i * (a + o / s), e, r + 1, n) : i * (a + o / s);
          o = 10 * o + u, s *= 10, ++r;
        }
        return i * (a + o / s);
      }
      if (u === 53 || u === 21) return L9(i * a, e, r + 1, n);
      break;
    }
    a = 10 * a + u, ++r;
  }
  return i * a;
}
function N9(e, t, n, r) {
  return { schema: n, __array: void 0, isDefined: r === 0, rowCount: t, value: function(i) {
    return e;
  }, valueKind: function(i) {
    return r;
  }, toArray: function(i) {
    for (var a = th(t, i).array, o = 0, s = a.length; o < s; o++) a[o] = e;
    return a;
  }, areValuesEqual: function(i, a) {
    return !0;
  } };
}
function Uh(e) {
  var t = e.value, n = e.valueKind, r = e.areValuesEqual, i = e.rowCount;
  return { schema: e.schema, __array: void 0, isDefined: !0, rowCount: i, value: t, valueKind: n || function(a) {
    return 0;
  }, toArray: function(a) {
    for (var o = th(i, a), s = o.array, u = o.start, l = 0, c = s.length; l < c; l++) s[l] = t(l + u);
    return s;
  }, areValuesEqual: r || function(a, o) {
    return t(a) === t(o);
  } };
}
function ul(e) {
  var t = e.array, n = e.schema, r = e.valueKind, i = t.length, a = n.valueType === "str" ? function(s) {
    var u = t[s];
    return typeof u == "string" ? u : "" + u;
  } : function(s) {
    return t[s];
  }, o = w6(t);
  return { schema: n, __array: t, isDefined: !0, rowCount: i, value: a, valueKind: r || function(s) {
    return 0;
  }, toArray: n.valueType === "str" ? function(s) {
    for (var u = zg(i, s), l = u.start, c = u.end, d = new (s && s.array !== void 0 ? s.array : t.constructor)(c - l), f = 0, p = c - l; f < p; f++) {
      var g = t[l + f];
      d[f] = typeof g == "string" ? g : "" + g;
    }
    return d;
  } : o ? function(s) {
    return Ug(t, s);
  } : function(s) {
    var u = zg(i, s), l = u.start, c = u.end;
    if (l === 0 && c === t.length) return t;
    for (var d = new (s && s.array !== void 0 ? s.array : t.constructor)(c - l), f = 0, p = c - l; f < p; f++) d[f] = t[l + f];
    return d;
  }, areValuesEqual: function(s, u) {
    return t[s] === t[u];
  } };
}
function cG(e, t, n) {
  return e.isDefined ? t === 0 && n === e.rowCount ? e : e.__array && w6(e.__array) ? function(r, i, a) {
    var o = Ug(r.__array, { start: i, end: a }), s = r.valueKind;
    return ul({ array: o, schema: r.schema, valueKind: function(u) {
      return s(i + u);
    } });
  }(e, t, n) : function(r, i, a) {
    var o = r.value, s = r.valueKind, u = r.areValuesEqual, l = i === 0 ? o : function(d) {
      return o(d + i);
    }, c = a - i;
    return { schema: r.schema, __array: void 0, isDefined: r.isDefined, rowCount: c, value: l, valueKind: i === 0 ? s : function(d) {
      return s(d + i);
    }, toArray: function(d) {
      for (var f = th(c, d).array, p = 0, g = f.length; p < g; p++) f[p] = o(p + i);
      return f;
    }, areValuesEqual: i === 0 ? u : function(d, f) {
      return u(d + i, f + i);
    } };
  }(e, t, n) : Q.Undefined(n - t, e.schema);
}
function dG(e, t, n) {
  return e.rowCount === 0 || n && function(r, i) {
    if (r.length !== i) return !1;
    for (var a = 0, o = r.length; a < o; a++) if (r[a] !== a) return !1;
    return !0;
  }(t, e.rowCount) ? e : e.__array && typeof e.value(0) == typeof e.__array[0] ? function(r, i) {
    for (var a = r.__array, o = new a.constructor(i.length), s = 0, u = i.length; s < u; s++) o[s] = a[i[s]];
    var l = r.valueKind;
    return ul({ array: o, schema: r.schema, valueKind: function(c) {
      return l(i[c]);
    } });
  }(e, t) : function(r, i) {
    var a = r.value, o = r.valueKind, s = r.areValuesEqual, u = function(c) {
      return a(i[c]);
    }, l = i.length;
    return { schema: r.schema, __array: void 0, isDefined: r.isDefined, rowCount: l, value: u, valueKind: function(c) {
      return o(i[c]);
    }, toArray: function(c) {
      for (var d = th(l, c).array, f = 0, p = d.length; f < p; f++) d[f] = a(i[f]);
      return d;
    }, areValuesEqual: function(c, d) {
      return s(i[c], i[d]);
    } };
  }(e, t);
}
function I6(e) {
  if (Array.from) return Array.from(e);
  for (var t = []; ; ) {
    var n = e.next(), r = n.done, i = n.value;
    if (r) break;
    t[t.length] = i;
  }
  return t;
}
function n5(e, t, n) {
  for (var r = t - e + 1, i = new Int32Array(r), a = 0; a < r; a++) i[a] = a + e;
  return i;
}
function fG(e, t) {
  for (var n = new (function(a) {
    var o = a.constructor;
    if (!o) throw new Error("data does not define a constructor and it should");
    return o;
  }(e))(t.length), r = 0, i = t.length; r < i; r++) n[r] = e[t[r]];
  return n;
}
(function(e) {
  var t;
  function n(i, a) {
    return N9(a.T, i, a, 1);
  }
  function r(i) {
    return Uh(i);
  }
  (function(i) {
    function a(o, s) {
      return s === void 0 && (s = i.float), { "@type": "tensor", T: o.create(), space: o, valueType: "tensor", baseType: s };
    }
    i.str = { "@type": "str", T: "", valueType: "str" }, i.int = { "@type": "int", T: 0, valueType: "int" }, i.coord = { "@type": "coord", T: 0, valueType: "float" }, i.float = { "@type": "float", T: 0, valueType: "float" }, i.Str = function(o) {
      return o === void 0 && (o = ""), { "@type": "str", T: o, valueType: "str" };
    }, i.Int = function(o) {
      return o === void 0 && (o = 0), { "@type": "int", T: o, valueType: "int" };
    }, i.Float = function(o) {
      return o === void 0 && (o = 0), { "@type": "float", T: o, valueType: "float" };
    }, i.Tensor = a, i.Vector = function(o, s) {
      return s === void 0 && (s = i.float), a(wr.Vector(o, s["@type"] === "int" ? Int32Array : Float64Array), s);
    }, i.Matrix = function(o, s, u) {
      return u === void 0 && (u = i.float), a(wr.ColumnMajorMatrix(o, s, u["@type"] === "int" ? Int32Array : Float64Array), u);
    }, i.Aliased = function(o, s) {
      return s !== void 0 ? O(O({}, o), { T: s }) : o;
    }, i.List = function(o, s, u) {
      return u === void 0 && (u = []), { "@type": "list", T: u, separator: o, itemParse: s, valueType: "list" };
    };
  })(t = e.Schema || (e.Schema = {})), e.is = function(i) {
    return !!i && !!i.schema && !!i.value;
  }, e.Undefined = n, e.ofConst = function(i, a, o) {
    return N9(i, a, o, 0);
  }, e.ofLambda = r, e.range = function(i, a) {
    return r({ value: function(o) {
      return o + i;
    }, rowCount: Math.max(a - i + 1, 0), schema: t.int });
  }, e.ofArray = function(i) {
    return ul(i);
  }, e.ofIntArray = function(i) {
    return ul({ array: i, schema: t.int });
  }, e.ofFloatArray = function(i) {
    return ul({ array: i, schema: t.float });
  }, e.ofStringArray = function(i) {
    return ul({ array: i, schema: t.str });
  }, e.ofStringAliasArray = function(i) {
    return ul({ array: i, schema: t.Aliased(t.str) });
  }, e.ofStringListArray = function(i, a) {
    return a === void 0 && (a = ","), ul({ array: i, schema: t.List(a, function(o) {
      return o;
    }) });
  }, e.ofIntTokens = function(i) {
    var a = i.count, o = i.data, s = i.indices;
    return Uh({ value: function(u) {
      return Qc(o, s[2 * u], s[2 * u + 1]) || 0;
    }, rowCount: a, schema: t.int });
  }, e.ofFloatTokens = function(i) {
    var a = i.count, o = i.data, s = i.indices;
    return Uh({ value: function(u) {
      return sf(o, s[2 * u], s[2 * u + 1]) || 0;
    }, rowCount: a, schema: t.float });
  }, e.ofStringTokens = function(i) {
    var a = i.count, o = i.data, s = i.indices;
    return Uh({ value: function(u) {
      var l = o.substring(s[2 * u], s[2 * u + 1]);
      return l === "." || l === "?" ? "" : l;
    }, rowCount: a, schema: t.str });
  }, e.window = function(i, a, o) {
    return cG(i, a, o);
  }, e.view = function(i, a, o) {
    return o === void 0 && (o = !0), dG(i, a, o);
  }, e.createFirstIndexMap = function(i) {
    return function(a) {
      for (var o = /* @__PURE__ */ new Map(), s = 0, u = a.rowCount; s < u; s++) {
        var l = a.value(s);
        o.has(l) || o.set(a.value(s), s);
      }
      return o;
    }(i);
  }, e.createIndexer = function(i) {
    return function(a) {
      for (var o = /* @__PURE__ */ new Map(), s = 0, u = a.rowCount; s < u; s++) {
        var l = a.value(s);
        o.has(l) || o.set(a.value(s), s);
      }
      return function(c) {
        return o.has(c) ? o.get(c) : -1;
      };
    }(i);
  }, e.mapToArray = function(i, a, o) {
    return function(s, u, l) {
      for (var c = new l(s.rowCount), d = 0, f = s.rowCount; d < f; d++) c[d] = u(s.value(d));
      return c;
    }(i, a, o || Array);
  }, e.areEqual = function(i, a) {
    return function(o, s) {
      return o === s || o.rowCount === s.rowCount && o.isDefined === s.isDefined && o.schema.valueType === s.schema.valueType && (o.__array && s.__array ? function(u, l) {
        for (var c = u.__array, d = l.__array, f = 0, p = u.rowCount; f < p; f++) if (c[f] !== d[f]) return !1;
        return !0;
      }(o, s) : function(u, l) {
        for (var c = u.value, d = l.value, f = 0, p = u.rowCount; f < p; f++) if (c(f) !== d(f)) return !1;
        return !0;
      }(o, s));
    }(i, a);
  }, e.indicesOf = function(i, a) {
    return function(o, s) {
      for (var u = [], l = o.value, c = 0, d = o.rowCount; c < d; c++) s(l(c)) && (u[u.length] = c);
      return u;
    }(i, a);
  }, e.asArrayColumn = function(i, a) {
    return i.__array ? i : i.isDefined ? ul({ array: i.toArray({ array: a }), schema: i.schema, valueKind: i.valueKind }) : n(i.rowCount, i.schema);
  }, e.copyToArray = function(i, a, o) {
    if (o === void 0 && (o = 0), i.isDefined) {
      var s = i.__array;
      if (s) for (var u = 0, l = s.length; u < l; u++) a[o + u] = s[u];
      else for (u = 0, l = i.rowCount; u < l; u++) a[o + u] = i.value(u);
    }
  }, e.isIdentity = function(i) {
    for (var a = 0, o = i.rowCount; a < o; a++) if (a !== i.value(a)) return !1;
    return !0;
  };
})(Q || (Q = {})), function(e) {
  function t(r, i, a) {
    var o = /* @__PURE__ */ Object.create(null), s = Object.keys(i);
    o._rowCount = a.length, o._columns = s, o._schema = i;
    for (var u = 0, l = s; u < l.length; u++) {
      var c = l[u];
      o[c] = Q.view(r[c], a);
    }
    return o;
  }
  function n(r, i) {
    for (var a = /* @__PURE__ */ Object.create(null), o = r._columns, s = 0; s < o.length; s++) {
      var u = o[s];
      a[u] = r[u].value(i);
    }
    return a;
  }
  e.is = function(r) {
    return r && typeof r._rowCount == "number" && !!r._columns && !!r._schema;
  }, e.pickColumns = function(r, i, a) {
    a === void 0 && (a = {});
    var o = /* @__PURE__ */ Object.create(null), s = Object.keys(r);
    o._rowCount = i._rowCount, o._columns = s, o._schema = r;
    for (var u = 0, l = s; u < l.length; u++) {
      var c = l[u];
      if (i[c]) o[c] = i[c];
      else {
        if (!a[c]) throw Error("Cannot find column '".concat(c, "'."));
        o[c] = a[c];
      }
    }
    return o;
  }, e.ofColumns = function(r, i) {
    var a = Object.keys(i), o = i[a[0]].rowCount;
    return O({ _rowCount: o, _columns: a, _schema: r }, i);
  }, e.ofPartialColumns = function(r, i, a) {
    var o = /* @__PURE__ */ Object.create(null), s = Object.keys(r);
    o._rowCount = a, o._columns = s, o._schema = r;
    for (var u = 0, l = s; u < l.length; u++) {
      var c = l[u];
      o[c] = c in i ? i[c] : Q.Undefined(a, r[c]);
    }
    return o;
  }, e.ofUndefinedColumns = function(r, i) {
    var a = /* @__PURE__ */ Object.create(null), o = Object.keys(r);
    a._rowCount = i, a._columns = o, a._schema = r;
    for (var s = 0, u = o; s < u.length; s++) {
      var l = u[s];
      a[l] = Q.Undefined(i, r[l]);
    }
    return a;
  }, e.ofRows = function(r, i) {
    var a = /* @__PURE__ */ Object.create(null), o = i.length, s = Object.keys(r);
    a._rowCount = o, a._columns = s, a._schema = r;
    for (var u = function(d) {
      a[d] = Q.ofLambda({ rowCount: o, schema: r[d], value: function(f) {
        return i[f][d];
      }, valueKind: function(f) {
        return i[f][d] === void 0 ? 1 : 0;
      } });
    }, l = 0, c = s; l < c.length; l++)
      u(c[l]);
    return a;
  }, e.ofArrays = function(r, i) {
    var a, o = /* @__PURE__ */ Object.create(null), s = Object.keys(r);
    o._rowCount = 0, o._columns = s, o._schema = r;
    for (var u = 0, l = s; u < l.length; u++) {
      var c = l[u];
      i[c] !== void 0 ? (o[c] = Q.ofArray({ array: i[c], schema: r[c] }), o._rowCount = (a = i[c]) === null || a === void 0 ? void 0 : a.length) : o[c] = Q.Undefined(o._rowCount, r[c]);
    }
    return o;
  }, e.view = t, e.pick = function(r, i, a) {
    for (var o = [], s = 0, u = r._rowCount; s < u; ++s) a(s) && o.push(s);
    return t(r, i, o);
  }, e.window = function(r, i, a, o) {
    if (a === 0 && o === r._rowCount) return r;
    var s = /* @__PURE__ */ Object.create(null), u = Object.keys(i);
    s._rowCount = o - a, s._columns = u, s._schema = i;
    for (var l = 0, c = u; l < c.length; l++) {
      var d = c[l];
      s[d] = Q.window(r[d], a, o);
    }
    return s;
  }, e.concat = function(r, i) {
    var a = /* @__PURE__ */ Object.create(null), o = Object.keys(i);
    a._rowCount = 0;
    for (var s = 0, u = r; s < u.length; s++) {
      var l = u[s];
      a._rowCount += l._rowCount;
    }
    for (var c = {}, d = 0, f = o; d < f.length; d++)
      c[f[d]] = new Array(a._rowCount);
    a._columns = o, a._schema = i;
    for (var p = 0, g = 0, m = r; g < m.length; g++) {
      l = m[g];
      for (var v = 0, h = o; v < h.length; v++) {
        var y = h[v];
        Q.copyToArray(l[y], c[y], p);
      }
      p += l._rowCount;
    }
    for (var x = 0, S = o; x < S.length; x++)
      a[y = S[x]] = Q.ofArray({ array: c[y], schema: i[y] });
    return a;
  }, e.columnToArray = function(r, i, a) {
    r[i] = Q.asArrayColumn(r[i], a);
  }, e.sort = function(r, i) {
    for (var a = new Int32Array(r._rowCount), o = 0, s = a.length; o < s; o++) a[o] = o;
    zs(a, function(p, g, m) {
      return i(g, m);
    });
    var u = !0;
    for (o = 0, s = a.length; o < s; o++) if (a[o] !== o) {
      u = !1;
      break;
    }
    if (u) return r;
    var l = /* @__PURE__ */ Object.create(null);
    l._rowCount = r._rowCount, l._columns = r._columns, l._schema = r._schema;
    for (var c = 0, d = r._columns; c < d.length; c++) {
      var f = d[c];
      l[f] = Q.view(r[f], a, !1);
    }
    return l;
  }, e.areEqual = function(r, i) {
    if (r._rowCount !== i._rowCount || r._columns.length !== i._columns.length) return !1;
    for (var a = 0, o = r._columns; a < o.length; a++)
      if (!i[l = o[a]]) return !1;
    for (var s = 0, u = r._columns; s < u.length; s++) {
      var l = u[s];
      if (!Q.areEqual(r[l], i[l])) return !1;
    }
    return !0;
  }, e.getRow = n, e.pickRow = function(r, i) {
    for (var a = 0, o = r._rowCount; a < o; ++a) if (i(a)) return n(r, a);
  }, e.getRows = function(r) {
    for (var i = [], a = r._rowCount, o = 0; o < a; o++) i[o] = n(r, o);
    return i;
  }, e.toArrays = function(r) {
    for (var i = {}, a = r._columns, o = 0; o < a.length; o++) {
      var s = a[o];
      i[s] = r[s].toArray();
    }
    return i;
  }, e.formatToString = function(r) {
    var i = Sn.create(), a = r._columns, o = r._rowCount, s = 1;
    Sn.write(i, "|");
    for (var u = 0; u < a.length; u++) Sn.write(i, a[u]), Sn.write(i, "|"), s += a[u].length + 1;
    Sn.newline(i), Sn.write(i, new Array(s + 1).join("-")), Sn.newline(i);
    for (var l = 0; l < o; l++) {
      for (Sn.write(i, "|"), u = 0; u < a.length; u++) {
        var c = r[a[u]];
        c.valueKind(l) === 0 ? (Sn.write(i, c.value(l)), Sn.write(i, "|")) : Sn.write(i, ".|");
      }
      Sn.newline(i);
    }
    return Sn.getString(i);
  };
}(On || (On = {})), function(e) {
  e.ofTables = function(t, n, r) {
    var i = Object.keys(r), a = /* @__PURE__ */ Object.create(null), o = [];
    a._name = t, a._tableNames = o, a._schema = n;
    for (var s = 0, u = i; s < u.length; s++) {
      var l = u[s];
      On.is(r[l]) && (a[l] = r[l], o[o.length] = l);
    }
    return a;
  }, e.getTablesAsRows = function(t) {
    for (var n = {}, r = 0, i = t._tableNames; r < i.length; r++) {
      var a = i[r];
      n[a] = On.getRows(t[a]);
    }
    return n;
  };
}(e5 || (e5 = {})), function(e) {
  e.Zero = 0;
  var t, n, r = (t = new ArrayBuffer(8), n = new ArrayBuffer(8), { _int32: new Int32Array(t), _float64: new Float64Array(t), _int32_1: new Int32Array(n), _float64_1: new Float64Array(n) }), i = r._int32, a = r._float64, o = r._int32_1, s = r._float64_1;
  e.is = function(u) {
    return typeof u == "number";
  }, e.create = function(u, l) {
    return i[0] = u, i[1] = l, a[0];
  }, e.diff = function(u) {
    return a[0] = u, i[1] - i[0];
  }, e.fst = function(u) {
    return a[0] = u, i[0];
  }, e.snd = function(u) {
    return a[0] = u, i[1];
  }, e.areEqual = function(u, l) {
    return a[0] = u, s[0] = l, i[0] === o[0] && i[1] === o[1];
  }, e.compare = function(u, l) {
    a[0] = u, s[0] = l;
    var c = i[0] - o[0];
    return c !== 0 ? c : i[1] - o[1];
  }, e.compareInArray = function(u, l, c) {
    a[0] = u[l], s[0] = u[c];
    var d = i[0] - o[0];
    return d !== 0 ? d : i[1] - o[1];
  }, e.hashCode = function(u) {
    return a[0] = u, Bm(i[0], i[1]);
  }, e.toString = function(u) {
    return a[0] = u, "(".concat(i[0], ", ").concat(i[1], ")");
  };
}(Xr || (Xr = {}));
var ST = Xr.Zero;
function F9(e, t) {
  return t < e ? Xr.create(e, e) : Xr.create(e, t + 1);
}
function P6(e, t) {
  return t <= e ? Xr.create(e, e) : Xr.create(e, t);
}
function mG(e) {
  return e < 0 ? Xr.create(0, 0) : Xr.create(0, e);
}
var pG = Xr.is, Ol = Xr.fst, rd = Xr.snd, Hg = Xr.fst;
function qg(e) {
  return Xr.snd(e) - 1;
}
var uf = Xr.diff, hG = Xr.hashCode, gG = Xr.toString;
function vG(e, t) {
  return Xr.fst(e) <= t && t < Xr.snd(e);
}
function yG(e, t) {
  var n = Ol(e);
  return t >= n && t < rd(e) ? t - n : -1;
}
function bG(e, t) {
  return Xr.fst(e) + t;
}
var le, _G = Xr.areEqual;
function AT(e, t) {
  var n = uf(e), r = uf(t);
  return n === 0 && r === 0 || n > 0 && r > 0 && qg(e) >= Hg(t) && Hg(e) <= qg(t);
}
function xG(e, t) {
  return uf(e) ? !uf(t) || Ol(e) <= Ol(t) && rd(e) >= rd(t) : uf(t) === 0;
}
function r5(e, t) {
  var n = Ol(e);
  if (t <= n) return 0;
  var r = rd(e);
  return t >= r ? r - n : t - n;
}
function CG(e, t, n) {
  var r = Ol(n), i = Ol(e);
  if (t <= r + i) return r;
  var a = rd(n);
  return t >= a + i ? a : t - i;
}
function wT(e, t, n) {
  return P6(r5(e, t), r5(e, n + 1));
}
function SG(e, t) {
  return AT(e, t) ? P6(Math.max(Ol(e), Ol(t)), Math.min(rd(e), rd(t))) : ST;
}
function AG(e, t) {
  return uf(wT(e, Hg(t), qg(t)));
}
(function(e) {
  e.Empty = ST, e.ofSingleton = function(t) {
    return F9(t, t);
  }, e.ofRange = F9, e.ofBounds = P6, e.ofLength = mG, e.is = pG, e.has = vG, e.indexOf = yG, e.getAt = bG, e.start = Ol, e.end = rd, e.min = Hg, e.max = qg, e.size = uf, e.hashCode = hG, e.toString = gG, e.areEqual = _G, e.areIntersecting = AT, e.isSubInterval = xG, e.findPredecessorIndex = r5, e.findPredecessorIndexInInterval = CG, e.findRange = wT, e.intersectionSize = AG, e.intersect = SG;
})(le || (le = {}));
var x0 = [];
function wG(e) {
  return [e];
}
function IG(e) {
  return e;
}
function PG(e) {
  return zs(e), e;
}
function V9(e, t) {
  if (t < e) return [];
  for (var n = new Int32Array(t - e + 1), r = e; r <= t; r++) n[r - e] = r;
  return n;
}
function MG(e) {
  return e && (Array.isArray(e) || !!e.buffer);
}
function IT(e) {
  return e[e.length - 1] - e[0] + 1 === e.length;
}
function i5(e) {
  return e[0];
}
function a5(e) {
  return e[e.length - 1] + 1;
}
function EG(e) {
  return e[0];
}
function TG(e) {
  return e[e.length - 1];
}
function PT(e) {
  return e.length;
}
function kG(e) {
  var t = e.length;
  return t ? t > 2 ? function(n, r, i, a) {
    var o = 23;
    return o = 31 * (o = 31 * (o = 31 * (o = 31 * o + n | 0) + r | 0) + i | 0) + a | 0, o = (3735928559 ^ (o ^= o >> 4)) + (o << 5), o ^ o >> 11;
  }(t, e[0], e[t - 1], e[t >> 1]) : function(n, r, i) {
    var a = 23;
    return a = 31 * (a = 31 * (a = 31 * a + n | 0) + r | 0) + i | 0, a = (3735928559 ^ (a ^= a >> 4)) + (a << 5), a ^ a >> 11;
  }(t, e[0], e[t - 1]) : 0;
}
function DG(e) {
  var t = e.length;
  return t > 5 ? "[".concat(e[0], ", ").concat(e[1], ", ..., ").concat(e[t - 1], "], length ").concat(t) : "[".concat(e.join(", "), "]");
}
function MT(e, t) {
  var n = e.length;
  return n === 0 ? -1 : e[0] <= t && t <= e[n - 1] ? kT(e, t, 0, n) : -1;
}
function OG(e, t, n) {
  return ET(e, t, le.start(n), le.end(n));
}
function ET(e, t, n, r) {
  return e.length === 0 || r <= n ? -1 : e[n] <= t && t <= e[r - 1] ? kT(e, t, n, r) : -1;
}
function BG(e, t) {
  return MT(e, t) >= 0;
}
function TT(e, t) {
  if (e === t) return !0;
  var n = e.length;
  if (n !== t.length || e[0] !== t[0] || e[n - 1] !== t[n - 1]) return !1;
  if (IT(e)) return !0;
  n--;
  for (var r = 1; r < n; r++) if (e[r] !== t[r]) return !1;
  return !0;
}
function Jd(e, t) {
  var n = e.length;
  return t <= e[0] ? 0 : t > e[n - 1] ? n : DT(e, t, 0, n);
}
function RG(e, t, n) {
  var r = le.start(n), i = le.end(n), a = e[r];
  return t <= a ? r : i > r && t > e[i - 1] ? i : t - a <= 11 ? function(o, s, u, l) {
    for (var c = u; c < l; c++) if (s <= o[c]) return c;
    return l;
  }(e, t, r + 1, i) : DT(e, t, r, i);
}
function LG(e, t, n) {
  return le.ofBounds(Jd(e, t), Jd(e, n + 1));
}
function kT(e, t, n, r) {
  for (var i = n, a = r - 1; i <= a; ) {
    if (i + 11 > a) {
      for (var o = i; o <= a; o++) if (t === e[o]) return o;
      return -1;
    }
    var s = i + a >> 1, u = e[s];
    if (t < u) a = s - 1;
    else {
      if (!(t > u)) return s;
      i = s + 1;
    }
  }
  return -1;
}
function DT(e, t, n, r) {
  for (var i = n, a = r - 1; i < a; ) {
    if (i + 11 > a) {
      for (var o = i; o <= a; o++) if (t <= e[o]) return o;
      return a + 1;
    }
    var s = i + a >> 1, u = e[s];
    if (t < u) a = s - 1;
    else {
      if (!(t > u)) return s;
      i = s + 1;
    }
  }
  return i > a ? a + 1 : e[i] >= t ? i : i + 1;
}
function NG(e, t) {
  if (e === t) return !0;
  for (var n = Bf(e, t), r = n.startI, i = n.startJ, a = n.endI, o = n.endJ; r < a && i < o; ) {
    var s = e[r], u = t[i];
    if (s < u) r++;
    else {
      if (!(s > u)) return !0;
      i++;
    }
  }
  return !1;
}
function FG(e, t) {
  if (e === t) return !0;
  var n = t.length, r = Bf(e, t), i = r.startI, a = r.startJ, o = r.endI, s = r.endJ;
  if (s - a < n || o - i < n) return !1;
  for (var u = 0; i < o && a < s; ) {
    var l = e[i], c = t[a];
    l < c ? i++ : l > c ? a++ : (i++, a++, u++);
  }
  return u === n;
}
function OT(e, t) {
  if (e === t) return e;
  var n = e.length, r = t.length;
  if (n === 0) return t;
  if (r === 0) return e;
  if (e[0] > t[0]) return OT(t, e);
  var i = Bf(e, t), a = i.startI, o = i.startJ, s = i.endI, u = i.endJ, l = M6(e, t, a, o, s, u);
  if (l === n && l === r || l === r) return e;
  if (l === n) return t;
  var c = new Int32Array(n + r - l), d = 0, f = 0, p = 0;
  for (d = 0; d < a; d++) c[p++] = e[d];
  for (; f < u && e[a] > t[f]; ) c[p++] = t[f++];
  for (; d < s && f < u; ) {
    var g = e[d], m = t[f];
    g < m ? (c[p++] = g, d++) : g > m ? (c[p++] = m, f++) : (c[p++] = g, d++, f++);
  }
  for (; d < s; d++) c[p++] = e[d];
  for (; f < u; f++) c[p++] = t[f];
  for (; d < n; d++) c[p++] = e[d];
  for (; f < r; f++) c[p++] = t[f];
  return c;
}
function VG(e, t) {
  if (e === t) return PT(e);
  var n = Bf(e, t);
  return M6(e, t, n.startI, n.startJ, n.endI, n.endJ);
}
function M6(e, t, n, r, i, a) {
  for (var o = n, s = r, u = 0; o < i && s < a; ) {
    var l = e[o], c = t[s];
    l < c ? o++ : l > c ? s++ : (o++, s++, u++);
  }
  return u;
}
function GG(e, t) {
  if (e === t) return e;
  var n = Bf(e, t), r = n.startI, i = n.startJ, a = n.endI, o = n.endJ, s = M6(e, t, r, i, a, o), u = e.length, l = t.length;
  if (!s) return x0;
  if (s === u && s === l || s === l) return t;
  if (s === u) return e;
  for (var c = new Int32Array(s), d = 0, f = r, p = i; f < a && p < o; ) {
    var g = e[f], m = t[p];
    g < m ? f++ : (g > m || (c[d++] = g, f++), p++);
  }
  return c;
}
function zG(e, t) {
  if (e === t) return x0;
  for (var n = e.length, r = Bf(e, t), i = r.startI, a = r.startJ, o = r.endI, s = r.endJ, u = i, l = a, c = 0; u < o && l < s; )
    (g = e[u]) < (m = t[l]) ? u++ : g > m ? l++ : (u++, l++, c++);
  if (!c) return e;
  if (c >= n) return x0;
  for (var d = new Int32Array(n - c), f = 0, p = 0; p < i; p++) d[f++] = e[p];
  for (u = i, l = a; u < o && l < s; ) {
    var g, m;
    (g = e[u]) < (m = t[l]) ? (d[f++] = g, u++) : (g > m || u++, l++);
  }
  for (; u < n; u++) d[f++] = e[u];
  return d;
}
function UG(e) {
  if (e.length < 2) return e;
  for (var t = 1, n = 0, r = e.length - 1; n < r; n++) e[n] !== e[n + 1] && t++;
  if (t === e.length) return e;
  var i = new Int32Array(t), a = 0;
  for (n = 0, r = e.length - 1; n < r; n++) e[n] !== e[n + 1] && (i[a++] = e[n]);
  return i[a] = e[e.length - 1], i;
}
function HG(e, t) {
  if (TT(e, t)) return n5(0, e.length - 1);
  for (var n = Bf(e, t), r = n.startI, i = n.startJ, a = n.endI, o = n.endJ, s = r, u = i, l = 0; s < a && u < o; )
    (p = e[s]) < (g = t[u]) ? s++ : p > g ? u++ : (s++, u++, l++);
  var c = e.length;
  if (!l) return x0;
  if (l === c) return n5(0, e.length - 1);
  var d = new Int32Array(l), f = 0;
  for (s = r, u = i; s < a && u < o; ) {
    var p, g;
    (p = e[s]) < (g = t[u]) ? s++ : (p > g || (d[f++] = s, s++), u++);
  }
  return d;
}
var Me, Uu = { startI: 0, startJ: 0, endI: 0, endJ: 0 };
function Bf(e, t) {
  var n = e.length, r = t.length, i = n / r;
  return n >= 128 || r >= 128 || i <= 0.34 || i >= 2.99 ? (Uu.startI = Jd(e, i5(t)), Uu.startJ = Jd(t, i5(e)), Uu.endI = Jd(e, a5(t)), Uu.endJ = Jd(t, a5(e))) : (Uu.startI = 0, Uu.startJ = 0, Uu.endI = n, Uu.endJ = r), Uu;
}
(function(e) {
  e.Empty = x0, e.ofUnsortedArray = PG, e.ofSingleton = wG, e.ofSortedArray = IG, e.ofRange = V9, e.ofBounds = function(t, n) {
    return V9(t, n - 1);
  }, e.is = MG, e.isRange = IT, e.has = BG, e.indexOf = MT, e.indexOfInInterval = OG, e.indexOfInRange = ET, e.start = i5, e.end = a5, e.min = EG, e.max = TG, e.size = PT, e.hashCode = kG, e.toString = DG, e.areEqual = TT, e.areIntersecting = NG, e.isSubset = FG, e.union = OT, e.intersect = GG, e.subtract = zG, e.findPredecessorIndex = Jd, e.findPredecessorIndexInInterval = RG, e.findRange = LG, e.intersectionSize = VG, e.deduplicate = UG, e.indicesOf = HG;
})(Me || (Me = {}));
var _e, xu = le.Empty, qG = le.ofSingleton, jG = le.ofRange, KG = le.ofBounds;
function Fs(e) {
  return e.length ? Me.isRange(e) ? le.ofRange(e[0], e[e.length - 1]) : e : xu;
}
function lf(e) {
  return le.is(e) ? le.size(e) : Me.size(e);
}
function YG(e, t) {
  return le.is(e) ? le.has(e, t) : Me.has(e, t);
}
function WG(e, t) {
  return le.is(e) ? le.indexOf(e, t) : Me.indexOf(e, t);
}
function o5(e, t) {
  return le.is(e) ? le.getAt(e, t) : e[t];
}
function W1(e) {
  return le.is(e) ? le.min(e) : Me.min(e);
}
function X1(e) {
  return le.is(e) ? le.max(e) : Me.max(e);
}
function XG(e) {
  return le.is(e) ? le.start(e) : Me.start(e);
}
function ZG(e) {
  return le.is(e) ? le.end(e) : Me.end(e);
}
function QG(e) {
  return le.is(e) ? le.hashCode(e) : Me.hashCode(e);
}
function JG(e, t) {
  return le.is(e) ? le.is(t) ? le.areEqual(e, t) : G9(e, t) : le.is(t) ? G9(t, e) : Me.areEqual(e, t);
}
function $G(e, t) {
  return le.is(e) ? le.is(t) ? le.areIntersecting(e, t) : z9(t, e) : le.is(t) ? z9(e, t) : Me.areIntersecting(e, t);
}
function ez(e, t) {
  return le.is(e) ? le.is(t) ? le.isSubInterval(e, t) : function(n, r) {
    var i = le.min(n), a = le.max(n);
    if (a - i + 1 == 0) return !1;
    var o = Me.min(r), s = Me.max(r);
    return o >= i && s <= a;
  }(e, t) : le.is(t) ? function(n, r) {
    var i = le.min(r), a = le.max(r);
    if (a - i + 1 == 0) return !0;
    var o = Me.min(n), s = Me.max(n);
    if (i < o || a > s) return !1;
    var u = Me.findRange(n, i, a);
    return le.size(u) === le.size(r);
  }(e, t) : Me.isSubset(e, t);
}
function tz(e, t) {
  return le.is(e) ? le.findPredecessorIndex(e, t) : Me.findPredecessorIndex(e, t);
}
function nz(e, t, n) {
  return le.is(e) ? le.findPredecessorIndexInInterval(e, t, n) : Me.findPredecessorIndexInInterval(e, t, n);
}
function rz(e, t, n) {
  return le.is(e) ? le.findRange(e, t, n) : Me.findRange(e, t, n);
}
function iz(e, t) {
  return le.is(e) ? le.is(t) ? le.intersectionSize(e, t) : H9(t, e) : le.is(t) ? H9(e, t) : Me.intersectionSize(e, t);
}
function az(e, t) {
  return le.is(e) ? le.is(t) ? function(n, r) {
    if (le.areEqual(n, r)) return n;
    var i = le.size(n), a = le.size(r);
    if (!a) return n;
    if (!i) return r;
    var o, s, u, l, c = le.min(n), d = le.min(r);
    if (function(g, m) {
      var v = lf(g), h = lf(m);
      return v === 0 && h === 0 || v > 0 && h > 0 && X1(g) >= W1(m) && W1(g) <= X1(m);
    }(n, r)) return le.ofRange(Math.min(c, d), Math.max(le.max(n), le.max(r)));
    c < d ? (o = i, s = c, u = a, l = d) : (o = a, s = d, u = i, l = c);
    for (var f = new Int32Array(i + a), p = 0; p < o; p++) f[p] = p + s;
    for (p = 0; p < u; p++) f[p + o] = p + l;
    return Fs(f);
  }(e, t) : U9(t, e) : le.is(t) ? U9(e, t) : Fs(Me.union(e, t));
}
function oz(e, t) {
  return le.is(e) ? le.is(t) ? le.intersect(e, t) : q9(t, e) : le.is(t) ? q9(e, t) : Fs(Me.intersect(e, t));
}
function sz(e, t) {
  return le.is(e) ? le.is(t) ? function(n, r) {
    if (le.areEqual(n, r)) return xu;
    if (!le.areIntersecting(n, r)) return n;
    var i = le.min(n), a = le.max(n), o = le.min(r), s = le.max(r);
    if (a < i || s < o) return n;
    if (le.isSubInterval(r, n)) return xu;
    if (le.isSubInterval(n, r)) {
      var u = o - i, l = a - s;
      if (u <= 0) return le.ofRange(s + 1, s + l);
      if (l <= 0) return le.ofRange(i, i + u - 1);
      for (var c = new Int32Array(u + l), d = 0, f = 0; f < u; f++) c[d++] = i + f;
      for (f = 1; f <= l; f++) c[d++] = s + f;
      return Fs(c);
    }
    return i < o ? le.ofRange(i, o - 1) : le.ofRange(s + 1, a);
  }(e, t) : function(n, r) {
    var i = le.min(n), a = le.max(n);
    if (a < i) return n;
    var o = a - i + 1, s = Me.findRange(r, i, a), u = le.start(s), l = le.end(s), c = l - u;
    if (c === 0) return n;
    var d = o - c;
    if (d <= 0) return xu;
    for (var f = new Int32Array(d), p = r.length - 1, g = r[Math.min(u, p)], m = r[Math.min(l, p)], v = 0, h = i; h < g; h++) f[v++] = h;
    for (h = g; h <= m; h++) Me.indexOfInInterval(r, h, s) < 0 && (f[v++] = h);
    for (h = m + 1; h <= a; h++) f[v++] = h;
    return Fs(f);
  }(e, t) : le.is(t) ? function(n, r) {
    var i = le.min(r), a = le.max(r);
    if (a < i) return n;
    var o = Me.findRange(n, i, a), s = le.start(o), u = le.end(o), l = n.length - (u - s);
    if (l <= 0) return xu;
    if (l === n.length) return n;
    for (var c = new Int32Array(l), d = 0, f = 0; f < s; f++) c[d++] = n[f];
    f = u;
    for (var p = n.length; f < p; f++) c[d++] = n[f];
    return Fs(c);
  }(e, t) : Fs(Me.subtract(e, t));
}
function G9(e, t) {
  return le.size(e) === Me.size(t) && le.start(e) === Me.start(t) && le.end(e) === Me.end(t);
}
function z9(e, t) {
  return e.length !== 0 && le.size(Me.findRange(e, le.min(t), le.max(t))) !== 0;
}
function uz(e, t) {
  return lf(e) ? !lf(t) || W1(e) <= W1(t) && X1(e) >= X1(t) : lf(t) === 0;
}
function U9(e, t) {
  var n = le.size(t);
  if (!n) return e;
  if (uz(t, e)) return t;
  for (var r = le.min(t), i = le.max(t), a = Me.findRange(e, r, i), o = le.start(a), s = le.end(a), u = new Int32Array(o + (e.length - s) + n), l = 0, c = 0; c < o; c++) u[l++] = e[c];
  for (c = r; c <= i; c++) u[l++] = c;
  c = s;
  for (var d = e.length; c < d; c++) u[l++] = e[c];
  return Fs(u);
}
function H9(e, t) {
  if (!le.size(t)) return 0;
  var n = Me.findRange(e, le.min(t), le.max(t));
  return le.end(n) - le.start(n);
}
function q9(e, t) {
  if (!le.size(t)) return xu;
  var n = Me.findRange(e, le.min(t), le.max(t)), r = le.start(n), i = le.end(n), a = i - r;
  if (!a) return xu;
  if (a === e.length) return e;
  for (var o = new Int32Array(a), s = 0, u = r; u < i; u++) o[s++] = e[u];
  return Fs(o);
}
function lz(e, t, n) {
  if (t === n) return e;
  var r = lf(e), i = t.length, a = n.length;
  if (r === 0 || i === 0 || a === 0) return xu;
  for (var o = Me.findPredecessorIndex(n, t[W1(e)]), s = Me.findPredecessorIndex(n, t[X1(e)] + 1), u = 0, l = 0, c = 0, d = o; c < r && d < s; )
    (p = t[o5(e, c)]) < (g = n[d]) ? c++ : (p > g || (u++, c++), d++);
  if (u === 0) return xu;
  if (u === i && u === a) return e;
  var f = new Int32Array(u);
  for (l = 0, c = 0, d = o; c < r && d < s; ) {
    var p, g;
    (p = t[o5(e, c)]) < (g = n[d]) ? c++ : (p > g || (f[l++] = d, c++), d++);
  }
  return Fs(f);
}
function BT(e) {
  for (var t = Me.ofSortedArray(e), n = Me.max(t), r = new Int32Array(n), i = 0, a = e.length - 1; i < a; i++) for (var o = e[i], s = e[i + 1]; o < s; o++) r[o] = i;
  return { offsets: t, index: r, count: e.length - 1 };
}
function cz(e, t) {
  for (var n = le.start(t), r = new Int32Array(e.length + 1), i = 0, a = e.length; i < a; i++) r[i] = e[i] - n;
  return r[e.length] = le.end(t) - n, BT(r);
}
function dz(e) {
  return e.count;
}
function fz(e, t) {
  return e.index[t];
}
function mz(e, t, n) {
  var r = e.offsets, i = n >= _e.max(r) ? -1 : _e.findPredecessorIndex(r, n - 1);
  return _e.findRange(t, _e.getAt(r, i), _e.getAt(r, i + 1) - 1);
}
(function(e) {
  e.Empty = xu, e.ofSingleton = qG, e.ofRange = jG, e.ofBounds = KG, e.ofSortedArray = Fs, e.has = YG, e.indexOf = WG, e.getAt = o5, e.min = W1, e.max = X1, e.start = XG, e.end = ZG, e.size = lf, e.hashCode = QG, e.areEqual = JG, e.areIntersecting = $G, e.isSubset = ez, e.union = az, e.intersect = oz, e.indexedIntersect = lz, e.subtract = sz, e.findPredecessorIndex = tz, e.findPredecessorIndexInInterval = nz, e.findRange = rz, e.intersectionSize = iz, e.forEach = function(t, n, r) {
    return function(i, a, o) {
      if (le.is(i)) for (var s = le.min(i), u = s, l = le.max(i); u <= l; u++) a(u, u - s, o);
      else for (u = 0, l = i.length; u < l; u++) a(i[u], u, o);
      return o;
    }(t, n, r);
  }, e.forEachSegment = function(t, n, r, i) {
    return function(a, o, s, u) {
      if (le.is(a)) for (var l = 0, c = le.min(a), d = le.max(a); c <= d; c++) {
        for (var f = o(c), p = c + 1; p < d && o(p) === f; ) p++;
        c = p - 1, s(f, l, u), l++;
      }
      else for (l = 0, c = 0, d = a.length; c < d; c++) {
        for (f = o(a[c]), p = c + 1; p < d && o(a[p]) === f; ) p++;
        c = p - 1, s(f, l, u), l++;
      }
      return u;
    }(t, n, r, i);
  }, e.isInterval = function(t) {
    return le.is(t);
  }, e.isSortedArray = function(t) {
    return !le.is(t);
  }, e.toArray = function(t) {
    var n = [];
    return e.forEach(t, function(r) {
      return n.push(r);
    }), n;
  }, e.toString = function(t) {
    return function(n) {
      return le.is(n) ? le.toString(n) : Me.toString(n);
    }(t);
  };
})(_e || (_e = {}));
var Kt, pz = function() {
  function e(t, n, r, i) {
    this.segments = t, this.segmentMap = n, this.set = r, this.segmentMin = 0, this.segmentMax = 0, this.setRange = le.Empty, this.value = { index: 0, start: 0, end: 0 }, this.hasNext = !1, this.setRange = i, this.updateSegmentRange();
  }
  return e.prototype.move = function() {
    for (; this.hasNext; ) {
      if (this.updateValue()) {
        this.value.index = this.segmentMin++, this.hasNext = this.segmentMax >= this.segmentMin && le.size(this.setRange) > 0;
        break;
      }
      this.updateSegmentRange();
    }
    return this.value;
  }, e.prototype.updateValue = function() {
    var t = this.segments[this.segmentMin + 1], n = _e.findPredecessorIndexInInterval(this.set, t, this.setRange);
    return this.value.start = le.start(this.setRange), this.value.end = n, this.setRange = le.ofBounds(n, le.end(this.setRange)), n > this.value.start;
  }, e.prototype.updateSegmentRange = function() {
    var t = le.min(this.setRange), n = le.max(this.setRange);
    n < t ? this.hasNext = !1 : (this.segmentMin = this.segmentMap[_e.getAt(this.set, t)], this.segmentMax = this.segmentMap[_e.getAt(this.set, n)], this.hasNext = this.segmentMax >= this.segmentMin);
  }, e.prototype.setSegment = function(t) {
    this.setRange = le.ofBounds(t.start, t.end), this.updateSegmentRange();
  }, e;
}();
function hz(e, t, n) {
  var r = n !== void 0 ? le.ofBounds(n.start, n.end) : le.ofBounds(0, _e.size(t));
  return new pz(e.offsets, e.index, t, r);
}
(function(e) {
  e.create = BT, e.ofOffsets = cz, e.count = dz, e.getSegment = fz, e.projectValue = mz, e.transientSegments = hz;
})(Kt || (Kt = {}));
var Mu, gz = function() {
  function e(t) {
    this.head = t > 0 ? 0 : -1, this.prev = new Int32Array(t), this.next = new Int32Array(t);
    for (var n = 0; n < t; n++) this.next[n] = n + 1, this.prev[n] = n - 1;
    this.prev[0] = -1, this.next[t - 1] = -1;
  }
  return e.prototype.remove = function(t) {
    var n = this.prev, r = this.next, i = n[t], a = r[t];
    i >= 0 && (r[i] = a, n[t] = -1), a >= 0 && (n[a] = i, r[t] = -1), t === this.head && (this.head = i < 0 ? a : i);
  }, e.prototype.has = function(t) {
    return this.prev[t] >= 0 || this.next[t] >= 0 || this.head === t;
  }, e;
}();
(function(e) {
  function t() {
    return /* @__PURE__ */ new Map();
  }
  e.Empty = /* @__PURE__ */ new Map(), e.keyArray = function(n) {
    return I6(n.keys());
  }, e.Mutable = t, e.asImmutable = function(n) {
    return n;
  }, e.copy = function(n) {
    for (var r = t(), i = n.keys(); ; ) {
      var a = i.next(), o = a.done, s = a.value;
      if (o) break;
      r.set(s, n.get(s));
    }
    return r;
  }, e.addFrom = function(n, r) {
    for (var i = r.keys(); ; ) {
      var a = i.next(), o = a.done, s = a.value;
      if (o) break;
      n.set(s, r.get(s));
    }
    return n;
  };
})(Mu || (Mu = {}));
var jg, vz = function() {
  function e(t) {
    this.xs = [], this.index = -1, this.length = 0, this.hasNext = !1, this.length = t.length, this.hasNext = t.length > 0, this.xs = t, this.index = -1, this.lastValue = t.length > 0 ? t[0] : void 0;
  }
  return e.prototype.move = function() {
    return ++this.index, this.lastValue = this.xs[this.index], this.hasNext = this.index < this.length - 1, this.lastValue;
  }, e;
}(), j9 = function() {
  function e(t, n) {
    this.max = n, this.value = 0, this.hasNext = !1, this.value = t - 1, this.hasNext = n >= t;
  }
  return e.prototype.move = function() {
    return ++this.value, this.hasNext = this.value < this.max, this.value;
  }, e;
}(), yz = function() {
  function e(t) {
    this.value = t, this.hasNext = !0;
  }
  return e.prototype.move = function() {
    return this.hasNext = !1, this.value;
  }, e;
}(), bz = function() {
  function e(t, n) {
    this.base = t, this.f = n, this.hasNext = !1, this.hasNext = t.hasNext;
  }
  return e.prototype.move = function() {
    var t = this.f(this.base.move());
    return this.hasNext = this.base.hasNext, t;
  }, e;
}(), _z = function() {
  function e(t, n) {
    this.base = t, this.p = n, this.hasNext = this.findNext();
  }
  return e.prototype.move = function() {
    var t = this.next;
    return this.hasNext = this.findNext(), t;
  }, e.prototype.findNext = function() {
    for (; this.base.hasNext; ) if (this.next = this.base.move(), this.p(this.next)) return !0;
    return !1;
  }, e;
}();
(function(e) {
  e.Empty = new j9(0, -1), e.Array = function(t) {
    return new vz(t);
  }, e.Value = function(t) {
    return new yz(t);
  }, e.Range = function(t, n) {
    return new j9(t, n);
  }, e.map = function(t, n) {
    return new bz(t, n);
  }, e.filter = function(t, n) {
    return new _z(t, n);
  }, e.forEach = function(t, n, r) {
    for (; t.hasNext; )
      if (n(t.move(), r)) return r;
    return r;
  };
})(jg || (jg = {}));
var Eu, ka, xz = { domain: [0, 1], reverse: !1, listOrName: "red-yellow-blue", minLabel: "", maxLabel: "" };
function E6(e) {
  return Object.keys(e);
}
function Mi(e) {
  throw new Error("unreachable");
}
function T6(e) {
  return typeof (e == null ? void 0 : e.then) == "function";
}
(function(e) {
  e.create = function(t) {
    var n = O(O({}, xz), t), r = n.domain, i = n.reverse, a = n.listOrName, o = typeof a == "string" ? Dl(a).list : a, s = i ? o.slice().reverse() : o, u = s.length - 1, l = 0, c = 0, d = 0;
    function f(b, _) {
      l = (d = _) - (c = b) || 1;
    }
    f(r[0], r[1]);
    var p, g = ui(t.minLabel, c.toString()), m = ui(t.maxLabel, d.toString()), v = s.every(function(b) {
      return Array.isArray(b);
    });
    if (v) {
      var h = Re([], s, !0);
      h.sort(function(b, _) {
        return b[1] - _[1];
      });
      var y = h.map(function(b) {
        return b[0];
      }), x = Me.ofSortedArray(h.map(function(b) {
        return b[1];
      })), S = y.length - 1;
      p = function(b) {
        var _ = Ia((b - c) / l, 0, 1), C = Me.findPredecessorIndex(x, _);
        if (C === 0) return y[c];
        if (C > S) return y[S];
        var w = x[C - 1], I = Ia((_ - w) / (x[C] - w), 0, 1);
        return Ae.interpolate(y[C - 1], y[C], I);
      };
    } else p = function(b) {
      var _ = Math.min(s.length - 1, Math.max(0, (b - c) / l * u)), C = Math.floor(_), w = s[C], I = s[Math.ceil(_)];
      return Ae.interpolate(w, I, _ - C);
    };
    return { color: p, colorToArray: function(b, _, C) {
      Ae.toArray(p(b), _, C);
    }, normalizedColorToArray: function(b, _, C) {
      Ae.toArrayNormalized(p(b), _, C);
    }, setDomain: f, get legend() {
      return /* @__PURE__ */ function(b, _, C) {
        return { kind: "scale-legend", minLabel: b, maxLabel: _, colors: C };
      }(g, m, s);
    } };
  };
})(Eu || (Eu = {})), function(e) {
  e.toArray = function(t) {
    return I6(t.values());
  }, e.isSuperset = function(t, n) {
    var r = !0;
    return n.forEach(function(i) {
      t.has(i) || (r = !1);
    }), r;
  }, e.add = function(t) {
    for (var n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];
    for (var i = 0; i < n.length; i++) n[i].forEach(function(a) {
      return t.add(a);
    });
    return t;
  }, e.union = function(t, n) {
    var r = new Set(t);
    return n.forEach(function(i) {
      return r.add(i);
    }), r;
  }, e.unionMany = function() {
    for (var t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
    if (t.length === 0) return /* @__PURE__ */ new Set();
    t.length === 1 && new Set(t[0]);
    for (var r = new Set(t[0]), i = 1, a = t.length; i < a; i++) t[i].forEach(function(o) {
      return r.add(o);
    });
    return r;
  }, e.unionManyArrays = function(t) {
    if (t.length === 0) return /* @__PURE__ */ new Set();
    for (var n = new Set(t[0]), r = 1; r < t.length; r++) for (var i = 0, a = t[r]; i < a.length; i++) {
      var o = a[i];
      n.add(o);
    }
    return n;
  }, e.intersection = function(t, n) {
    var r = /* @__PURE__ */ new Set();
    return n.forEach(function(i) {
      t.has(i) && r.add(i);
    }), r;
  }, e.areIntersecting = function(t, n) {
    var r = !1;
    return n.forEach(function(i) {
      t.has(i) && (r = !0);
    }), r;
  }, e.intersectionSize = function(t, n) {
    var r = 0;
    return n.forEach(function(i) {
      t.has(i) && (r += 1);
    }), r;
  }, e.difference = function(t, n) {
    var r = new Set(t);
    return n.forEach(function(i) {
      return r.delete(i);
    }), r;
  }, e.differenceSize = function(t, n) {
    var r = t.size;
    return t.forEach(function(i) {
      n.has(i) && (r -= 1);
    }), r;
  }, e.areEqual = function(t, n) {
    if (t.size !== n.size) return !1;
    var r = !0;
    return n.forEach(function(i) {
      t.has(i) || (r = !1);
    }), r;
  };
}(ka || (ka = {}));
var k6 = function() {
};
function Pa(e, t) {
  var n = e.length;
  if (n !== t.length) return !1;
  for (var r = 0; r < n; r++) if (e[r] !== t[r]) return !1;
  return !0;
}
var RT = Object.prototype.hasOwnProperty;
function id(e, t) {
  if (e === t) return !0;
  var n = Array.isArray(e), r = Array.isArray(t);
  if (n && r) {
    if (e.length !== t.length) return !1;
    for (var i = 0; i < e.length; i++) if (!id(e[i], t[i])) return !1;
    return !0;
  }
  if (n !== r) return !1;
  if (e && t && typeof e == "object" && typeof t == "object") {
    var a = Object.keys(e);
    if (a.length !== Object.keys(t).length) return !1;
    var o = e instanceof Date, s = t instanceof Date;
    if (o && s) return e.getTime() === t.getTime();
    if (o !== s) return !1;
    var u = e instanceof RegExp, l = t instanceof RegExp;
    if (u && l) return e.toString() === t.toString();
    if (u !== l) return !1;
    for (i = 0; i < a.length; i++) if (!RT.call(t, a[i])) return !1;
    for (i = 0; i < a.length; i++) if (!id(e[a[i]], t[a[i]])) return !1;
    return !0;
  }
  return !1;
}
function s5(e, t) {
  if (e === t) return !0;
  var n = Array.isArray(e), r = Array.isArray(t);
  return n && r ? Cz(e, t) : n === r && !(!e || !t || typeof e != "object" || typeof t != "object") && LT(e, t);
}
function LT(e, t) {
  if (e === t) return !0;
  if (!e || !t) return !1;
  var n = Object.keys(e);
  if (Object.keys(t).length !== n.length) return !1;
  for (var r = 0, i = n; r < i.length; r++) {
    var a = i[r];
    if (!RT.call(e, a) || e[a] !== t[a]) return !1;
  }
  return !0;
}
function Cz(e, t) {
  if (e === t) return !0;
  if (!e || !t || e.length !== t.length) return !1;
  for (var n = 0, r = e.length; n < r; ++n) if (e[n] !== t[n]) return !1;
  return !0;
}
function ui(e, t) {
  return e !== void 0 ? e : t;
}
function dy(e) {
  if (typeof e == "object") {
    if ("buttons" in e) return e.buttons;
    if ("which" in e) {
      var t = e.which;
      if (t === 2) return 4;
      if (t === 3) return 2;
      if (t > 0) return 1 << t - 1;
    }
  }
  return 0;
}
function K9(e) {
  if (typeof e == "object" && "button" in e) {
    var t = e.button;
    if (t === 1) return 4;
    if (t === 2) return 2;
    if (t >= 0) return 1 << t;
  }
  return 0;
}
var Z1, yf, Y9 = { noScroll: !0, noMiddleClickScroll: !0, noContextMenu: !0, noPinchZoom: !0, noTextSelect: !0, preventGestures: !1, mask: function(e, t) {
  return !0;
}, pixelScale: 1 };
function W9() {
  return { drag: new qr(), interactionEnd: new qr(), click: new qr(), move: new qr(), wheel: new qr(), pinch: new qr(), gesture: new qr(), resize: new qr(), leave: new qr(), enter: new qr(), modifiers: new qr(), key: new qr() };
}
(function(e) {
  function t(n) {
    return n === void 0 && (n = {}), { shift: !!n.shift, alt: !!n.alt, control: !!n.control, meta: !!n.meta };
  }
  e.None = t(), e.areEqual = function(n, r) {
    return n.shift === r.shift && n.alt === r.alt && n.control === r.control && n.meta === r.meta;
  }, e.size = function(n) {
    if (!n) return 0;
    var r = 0;
    return n.shift && r++, n.alt && r++, n.control && r++, n.meta && r++, r;
  }, e.create = t;
})(Z1 || (Z1 = {})), function(e) {
  e.has = Qi.has, e.create = Qi.create;
}(yf || (yf = {}));
var u5, Sz = ["Backspace", "Delete"];
function Ii() {
  return Ii.zero();
}
(function(e) {
  e.create = function(t) {
    t === void 0 && (t = {});
    var n = O(O({}, Y9), t), r = n.noScroll, i = n.noContextMenu;
    return O(O({ noScroll: r, noContextMenu: i, width: 0, height: 0, pixelRatio: 1 }, W9()), { dispose: k6 });
  }, e.fromElement = function(t, n) {
    n === void 0 && (n = {});
    var r = O(O({}, Y9), n), i = r.noScroll, a = r.noMiddleClickScroll, o = r.noContextMenu, s = r.noPinchZoom, u = r.noTextSelect, l = r.mask, c = r.pixelScale, d = r.preventGestures, f = t.clientWidth * _(), p = t.clientHeight * _(), g = 0, m = 0, v = xe(), h = xe(), y = xe(), x = xe(), S = xe(), b = { shift: !1, alt: !1, control: !1, meta: !1 };
    function _() {
      return window.devicePixelRatio * c;
    }
    function C() {
      return O({}, b);
    }
    var w, I, M = 0, E = !1, T = yf.create(0), P = 0, k = !1, D = W9(), B = D.drag, L = D.interactionEnd, F = D.wheel, V = D.pinch, G = D.gesture, H = D.click, q = D.move, z = D.leave, K = D.enter, Y = D.resize, Z = D.modifiers, X = D.key;
    return t.addEventListener("contextmenu", W, !1), t.addEventListener("wheel", we, !1), t.addEventListener("mousedown", Se, !1), window.addEventListener("mousemove", qe, !1), window.addEventListener("mouseup", Pe, !1), t.addEventListener("mouseenter", st, !1), t.addEventListener("mouseleave", gt, !1), t.addEventListener("touchstart", Ne, !1), t.addEventListener("touchmove", Ze, !1), t.addEventListener("touchend", Ue, !1), t.addEventListener("gesturechange", De, !1), t.addEventListener("gesturestart", Ee, !1), t.addEventListener("gestureend", rt, !1), window.addEventListener("blur", $), window.addEventListener("keyup", ce, !1), window.addEventListener("keydown", ee, !1), window.addEventListener("keypress", ae, !1), window.addEventListener("resize", ft, !1), O(O({ get noScroll() {
      return i;
    }, set noScroll(ge) {
      i = ge;
    }, get noContextMenu() {
      return o;
    }, set noContextMenu(ge) {
      o = ge;
    }, get width() {
      return f;
    }, get height() {
      return p;
    }, get pixelRatio() {
      return _();
    } }, D), { dispose: function() {
      E || (E = !0, t.removeEventListener("contextmenu", W, !1), t.removeEventListener("wheel", we, !1), t.removeEventListener("mousedown", Se, !1), window.removeEventListener("mousemove", qe, !1), window.removeEventListener("mouseup", Pe, !1), t.removeEventListener("mouseenter", st, !1), t.removeEventListener("mouseleave", gt, !1), t.removeEventListener("touchstart", Ne, !1), t.removeEventListener("touchmove", Ze, !1), t.removeEventListener("touchend", Ue, !1), t.removeEventListener("gesturechange", De, !1), t.removeEventListener("gesturestart", Ee, !1), t.removeEventListener("gestureend", rt, !1), window.removeEventListener("blur", $), window.removeEventListener("keyup", ce, !1), window.removeEventListener("keydown", ee, !1), window.removeEventListener("keypress", ae, !1), window.removeEventListener("resize", ft, !1));
    } });
    function W(ge) {
      l(ge.clientX, ge.clientY) && o && ge.preventDefault();
    }
    function J(ge) {
      b.alt = ge.altKey, b.shift = ge.shiftKey, b.control = ge.ctrlKey, b.meta = ge.metaKey;
    }
    function $() {
      (T || b.shift || b.alt || b.meta || b.control) && (T = 0, b.shift = b.alt = b.control = b.meta = !1);
    }
    function ee(ge) {
      var Je = !1;
      !b.alt && ge.altKey && (Je = !0, b.alt = !0), !b.shift && ge.shiftKey && (Je = !0, b.shift = !0), !b.control && ge.ctrlKey && (Je = !0, b.control = !0), !b.meta && ge.metaKey && (Je = !0, b.meta = !0), Je && k && Z.next(C());
    }
    function ce(ge) {
      var Je = !1;
      b.alt && !ge.altKey && (Je = !0, b.alt = !1), b.shift && !ge.shiftKey && (Je = !0, b.shift = !1), b.control && !ge.ctrlKey && (Je = !0, b.control = !1), b.meta && !ge.metaKey && (Je = !0, b.meta = !1), Je && k && Z.next(C()), Sz.includes(ge.key) && ae(ge);
    }
    function ae(ge) {
      X.next({ key: ge.key, modifiers: C() });
    }
    function he(ge) {
      var Je = ge.touches[0], Mt = ge.touches[1];
      return { clientX: (Je.clientX + Mt.clientX) / 2, clientY: (Je.clientY + Mt.clientY) / 2, pageX: (Je.pageX + Mt.pageX) / 2, pageY: (Je.pageY + Mt.pageY) / 2 };
    }
    function Oe(ge) {
      var Je = ge.touches[0].pageX - ge.touches[1].pageX, Mt = ge.touches[0].pageY - ge.touches[1].pageY;
      return Math.sqrt(Je * Je + Mt * Mt);
    }
    function Ne(ge) {
      if (ge.preventDefault(), ge.touches.length === 1) T = P = 1, Ke(ge.touches[0]);
      else if (ge.touches.length === 2) {
        T = 0, P = 2, Ke(he(ge));
        var Je = Oe(ge);
        g = Je, V.next({ distance: Je, fraction: 1, fractionDelta: 0, delta: 0, isStart: !0, buttons: T, button: P, modifiers: C() });
      } else ge.touches.length === 3 && (T = P = 8, Ke(he(ge)));
    }
    function Ue(ge) {
      Xe();
    }
    function Ze(ge) {
      if (P = 0, s && (ge.preventDefault(), ge.stopPropagation(), ge.originalEvent && (ge.originalEvent.preventDefault(), ge.originalEvent.stopPropagation())), ge.touches.length === 1) T = 1, de(ge.touches[0]);
      else if (ge.touches.length === 2) {
        var Je = Oe(ge), Mt = g - Je;
        if (Math.abs(Mt) < 4) T = 2, de(he(ge));
        else {
          T = 4, J(ge);
          var wn = g / Je;
          V.next({ delta: Mt, fraction: wn, fractionDelta: m - wn, distance: Je, isStart: !1, buttons: T, button: P, modifiers: C() }), m = wn;
        }
        g = Je;
      } else ge.touches.length === 3 && (T = 8, de(he(ge)));
    }
    function Se(ge) {
      J(ge), T = dy(ge), P = K9(ge), a && T === 4 && ge.preventDefault, Ke(ge);
    }
    function qe(ge) {
      J(ge), T = dy(ge), P = 0, de(ge);
    }
    function Pe(ge) {
      J(ge), T = dy(ge), P = K9(ge), function(Je) {
        if (M = 0, !!l(Je.clientX, Je.clientY) && (It(y, Je), xe.distance(y, v) < 4)) {
          var Mt = Je.pageX, wn = Je.pageY, tn = y[0], Te = y[1];
          H.next({ x: tn, y: Te, pageX: Mt, pageY: wn, buttons: T, button: P, modifiers: C() });
        }
      }(ge), Xe();
    }
    function Xe() {
      L.next(void 0);
    }
    function Ke(ge) {
      l(ge.clientX, ge.clientY) && (It(h, ge), xe.copy(v, h), yt(h) && (M = 1));
    }
    function de(ge) {
      var Je;
      It(y, ge);
      var Mt, wn = ge.pageX, tn = ge.pageY, Te = y[0], At = y[1], Gt = yt(y);
      if (q.next({ x: Te, y: At, pageX: wn, pageY: tn, buttons: T, button: P, modifiers: C(), inside: Gt }), M !== 0 && (u && ((Je = ge.preventDefault) === null || Je === void 0 || Je.call(ge)), xe.div(x, xe.sub(x, y, h), ((Mt = S)[0] = t.clientWidth, Mt[1] = t.clientHeight, Mt)), !(xe.magnitude(x) < sr))) {
        var Tt = M === 1;
        if (!Tt || l(ge.clientX, ge.clientY)) {
          var nn = x[0], Pt = x[1];
          B.next({ x: Te, y: At, dx: nn, dy: Pt, pageX: wn, pageY: tn, buttons: T, button: P, modifiers: C(), isStart: Tt }), xe.copy(h, y), M = 2;
        }
      }
    }
    function we(ge) {
      if (l(ge.clientX, ge.clientY)) {
        It(y, ge);
        var Je = ge.pageX, Mt = ge.pageY, wn = y[0], tn = y[1];
        i && ge.preventDefault();
        var Te = function(At) {
          var Gt = 10, Tt = 40, nn = 800, Pt = 0, Yt = 0, Rn = 0, kn = 0, Pn = 0;
          return "detail" in At && (Yt = At.detail), "wheelDelta" in At && (Yt = -At.wheelDelta / 120), "wheelDeltaY" in At && (Yt = -At.wheelDeltaY / 120), "wheelDeltaX" in At && (Pt = -At.wheelDeltaX / 120), "axis" in At && At.axis === At.HORIZONTAL_AXIS && (Pt = Yt, Yt = 0), Rn = Pt * Gt, kn = Yt * Gt, "deltaY" in At && (kn = At.deltaY), "deltaX" in At && (Rn = At.deltaX), "deltaZ" in At && (Pn = At.deltaZ), (Rn || kn || Pn) && At.deltaMode && (At.deltaMode === 1 ? (Rn *= Tt, kn *= Tt, Pn *= Tt) : (Rn *= nn, kn *= nn, Pn *= nn)), Rn && !Pt && (Pt = Rn < 1 ? -1 : 1), kn && !Yt && (Yt = kn < 1 ? -1 : 1), { spinX: Pt, spinY: Yt, dx: Rn, dy: kn, dz: Pn };
        }(ge);
        T = P = 4, (Te.dx || Te.dy || Te.dz) && F.next(O(O({ x: wn, y: tn, pageX: Je, pageY: Mt }, Te), { buttons: T, button: P, modifiers: C() }));
      }
    }
    function Ie(ge) {
      var Je, Mt;
      d && (ge.preventDefault(), (Je = ge.stopImmediatePropagation) === null || Je === void 0 || Je.call(ge), (Mt = ge.stopPropagation) === null || Mt === void 0 || Mt.call(ge));
    }
    function Ee(ge) {
      Ie(ge), w = ge.scale, I = ge.rotation, G.next({ scale: ge.scale, rotation: ge.rotation, deltaRotation: 0, deltaScale: 0, isStart: !0 });
    }
    function Le(ge, Je) {
      G.next({ scale: ge.scale, rotation: ge.rotation, deltaRotation: I - ge.rotation, deltaScale: w - ge.scale, isEnd: Je }), I = ge.rotation, w = ge.scale;
    }
    function De(ge) {
      Ie(ge), Le(ge);
    }
    function rt(ge) {
      Ie(ge), Le(ge, !0);
    }
    function st(ge) {
      k = !0, K.next(void 0);
    }
    function gt(ge) {
      k = !1, z.next(void 0);
    }
    function ft(ge) {
      Y.next({});
    }
    function yt(ge) {
      if (t instanceof Window || t instanceof Document || t === document.body) return !0;
      var Je = t.getBoundingClientRect();
      return ge[0] >= 0 && ge[1] >= 0 && ge[0] < Je.width && ge[1] < Je.height;
    }
    function It(ge, Je) {
      f = t.clientWidth * _(), p = t.clientHeight * _();
      var Mt = Je.clientX || 0, wn = Je.clientY || 0, tn = t.getBoundingClientRect();
      return ge[0] = Mt - tn.left, ge[1] = wn - tn.top, ge;
    }
  };
})(u5 || (u5 = {})), function(e) {
  e.zero = function() {
    return { x: 0, y: 0, width: 0, height: 0 };
  }, e.create = function(t, n, r, i) {
    return { x: t, y: n, width: r, height: i };
  }, e.clone = function(t) {
    return O({}, t);
  }, e.copy = function(t, n) {
    return Object.assign(t, n);
  }, e.set = function(t, n, r, i, a) {
    return t.x = n, t.y = r, t.width = i, t.height = a, t;
  }, e.toVec4 = function(t, n) {
    return t[0] = n.x, t[1] = n.y, t[2] = n.width, t[3] = n.height, t;
  }, e.equals = function(t, n) {
    return t.x === n.x && t.y === n.y && t.width === n.width && t.height === n.height;
  };
}(Ii || (Ii = {}));
var nu = Nt();
function Dp(e, t, n, r) {
  var i = n.x, a = n.y, o = n.width, s = n.height, u = t[0] - i, l = s - t[1] - 1 - a, c = t[2];
  return e[0] = 2 * u / o - 1, e[1] = 2 * l / s - 1, e[2] = 2 * c - 1, A.transformMat4(e, e, r);
}
var NT = Object.prototype.hasOwnProperty;
function Az(e, t) {
  if (!e) return !t;
  if (!t) return !1;
  var n = Object.keys(e);
  if (Object.keys(t).length !== n.length) return !1;
  for (var r = 0, i = n; r < i.length; r++) {
    var a = i[r];
    if (!NT.call(e, a) || e[a] !== t[a]) return !1;
  }
  return !0;
}
function Bl(e) {
  if (e === null || typeof e != "object") return e;
  if (e instanceof Array) {
    for (var t = [], n = 0, r = e.length; n < r; n++) t[n] = Bl(e[n]);
    return t;
  }
  if (typeof e == "object" && !("prototype" in e)) {
    t = {};
    for (var i in e) NT.call(e, i) && (t[i] = Bl(e[i]));
    return t;
  }
  throw new Error(`Can't clone, type "`.concat(typeof e, '" unsupported'));
}
function FT(e, t) {
  if (e) for (var n = 0, r = Object.keys(e); n < r.length; n++) {
    var i = r[n];
    t(e[i], i);
  }
}
var l5 = typeof setImmediate < "u" ? typeof window < "u" ? { setImmediate: function(e) {
  for (var t, n = [], r = 1; r < arguments.length; r++) n[r - 1] = arguments[r];
  return (t = window).setImmediate.apply(t, Re([e], n, !1));
}, clearImmediate: function(e) {
  return window.clearImmediate(e);
} } : { setImmediate, clearImmediate } : function() {
  var e, t, n, r, i, a, o, s, u = (e = typeof window < "u" && window, t = typeof self < "u" && typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope && self, n = typeof global < "u" && global, e || n || t), l = {}, c = typeof document < "u" ? document : void 0, d = 1;
  function f(g) {
    delete l[g];
  }
  function p(g) {
    var m = l[g];
    f(g), function(v) {
      var h = v.callback, y = v.args;
      switch (y.length) {
        case 0:
          h();
          break;
        case 1:
          h(y[0]);
          break;
        case 2:
          h(y[0], y[1]);
          break;
        case 3:
          h(y[0], y[1], y[2]);
          break;
        default:
          h.apply(void 0, y);
      }
    }(m);
  }
  return typeof process < "u" && {}.toString.call(process) === "[object process]" ? r = function(g) {
    process.nextTick(function() {
      p(g);
    });
  } : function() {
    if (u && u.postMessage && !u.importScripts) {
      var g = !0, m = u.onmessage;
      return u.onmessage = function() {
        g = !1;
      }, u.postMessage("", "*"), u.onmessage = m, g;
    }
  }() ? (o = "setImmediate$" + Math.random() + "$", s = function(g) {
    g.source === u && typeof g.data == "string" && g.data.indexOf(o) === 0 && p(+g.data.slice(o.length));
  }, window.addEventListener ? window.addEventListener("message", s, !1) : window.attachEvent("onmessage", s), r = function(g) {
    window.postMessage(o + g, "*");
  }) : typeof MessageChannel < "u" ? ((a = new MessageChannel()).port1.onmessage = function(g) {
    p(g.data);
  }, r = function(g) {
    a.port2.postMessage(g);
  }) : c && "onreadystatechange" in c.createElement("script") ? (i = c.documentElement, r = function(g) {
    var m = c.createElement("script");
    m.onreadystatechange = function() {
      p(g), m.onreadystatechange = null, i.removeChild(m), m = null;
    }, i.appendChild(m);
  }) : r = function(g) {
    setTimeout(p, 0, g);
  }, { setImmediate: function(g) {
    for (var m = [], v = 1; v < arguments.length; v++) m[v - 1] = arguments[v];
    typeof g != "function" && (g = new Function("" + g));
    var h = { callback: g, args: m };
    return l[d] = h, r(d), d++;
  }, clearImmediate: f };
}();
function wz(e) {
  l5.setImmediate(e);
}
var Qp, D6 = { setImmediate: l5.setImmediate, clearImmediate: l5.clearImmediate, immediatePromise: function() {
  return new Promise(wz);
}, delay: function(e, t) {
  return t === void 0 && (t = void 0), new Promise(function(n) {
    return setTimeout(n, e, t);
  });
} }, VT = function() {
  try {
    return !1;
  } catch {
    return !1;
  }
}(), In = function() {
  try {
    return !1;
  } catch {
    return !1;
  }
}(), fy = typeof performance < "u" && !!performance.mark && performance.measure && !VT;
function Iz(e, t, n) {
  n === void 0 && (n = 250);
  var r = function(i, a, o) {
    var s = { abortRequested: !1, treeAborted: !1, reason: "" };
    return { updateRateMs: o, lastNotified: Wr(), observer: a, abortToken: s, taskId: i.id, root: { progress: GT(i), children: [] }, tryAbort: Pz(s) };
  }(e, t, n);
  return O6(e, new Mz(r, r.root));
}
function GT(e) {
  return { taskId: e.id, taskName: e.name, message: "", startedTime: 0, canAbort: !0, isIndeterminate: !0, current: 0, max: 0 };
}
function Pz(e) {
  return function(t) {
    e.abortRequested = !0, e.reason = t || e.reason;
  };
}
function zT(e) {
  return { progress: O({}, e.progress), children: e.children.map(zT) };
}
function UT(e) {
  return e.progress.canAbort && e.children.every(UT);
}
function O6(e, t) {
  return se(this, 0, void 0, function() {
    var n, r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          Qp.markStart(e), t.node.progress.startedTime = Wr(), i.label = 1;
        case 1:
          return i.trys.push([1, 3, , 7]), [4, e.f(t)];
        case 2:
          return n = i.sent(), Qp.markEnd(e), Qp.measure(e), t.info.abortToken.abortRequested && HT(t.info), [2, n];
        case 3:
          return r = i.sent(), Xt.isAbort(r) ? (t.isAborted = !0, t.node.children.length > 0 ? [4, new Promise(function(a) {
            t.onChildrenFinished = a;
          })] : [3, 5]) : [3, 6];
        case 4:
          i.sent(), i.label = 5;
        case 5:
          e.onAbort && e.onAbort(), i.label = 6;
        case 6:
          throw r;
        case 7:
          return [2];
      }
    });
  });
}
function HT(e) {
  throw e.abortToken.treeAborted || (e.abortToken.treeAborted = !0, qT(e.root), jT(e, Wr())), Xt.Aborted(e.abortToken.reason);
}
function qT(e) {
  var t = e.progress;
  t.isIndeterminate = !0, t.canAbort = !1, t.message = "Aborting...";
  for (var n = 0, r = e.children; n < r.length; n++)
    qT(r[n]);
}
function jT(e, t) {
  e.lastNotified = t;
  var n = function(r) {
    return { root: zT(r.root), canAbort: UT(r.root), requestAbort: r.tryAbort };
  }(e);
  e.observer(n);
}
(function(e) {
  function t(r) {
    return "startTask".concat(r.id);
  }
  function n(r) {
    return "endTask".concat(r.id);
  }
  e.markStart = function(r) {
    fy && performance.mark(t(r));
  }, e.markEnd = function(r) {
    fy && performance.mark(n(r));
  }, e.measure = function(r) {
    fy && performance.measure("✳️ ".concat(r.name), t(r), n(r));
  };
})(Qp || (Qp = {}));
var Xt, X9, Z9, Mz = function() {
  function e(t, n) {
    this.isSynchronous = !1, this.isExecuting = !0, this.lastUpdatedTime = 0, this.onChildrenFinished = void 0, this.node = n, this.info = t;
  }
  return e.prototype.checkAborted = function() {
    this.info.abortToken.abortRequested && (this.isAborted = !0, HT(this.info));
  }, Object.defineProperty(e.prototype, "shouldUpdate", { get: function() {
    return this.checkAborted(), Wr() - this.lastUpdatedTime > this.info.updateRateMs;
  }, enumerable: !1, configurable: !0 }), e.prototype.updateProgress = function(t) {
    if (this.checkAborted(), t) {
      var n = this.node.progress;
      typeof t == "string" ? (n.message = t, n.isIndeterminate = !0) : (t.canAbort !== void 0 && (n.canAbort = t.canAbort), t.message !== void 0 && (n.message = t.message), t.current !== void 0 && (n.current = t.current), t.max !== void 0 && (n.max = t.max), n.isIndeterminate = n.current === void 0 || n.max === void 0, t.isIndeterminate !== void 0 && (n.isIndeterminate = t.isIndeterminate));
    }
  }, e.prototype.update = function(t, n) {
    if (this.lastUpdatedTime = Wr(), this.updateProgress(t), !n) return jT(this.info, this.lastUpdatedTime), this.checkAborted(), D6.immediatePromise();
  }, e.prototype.runChild = function(t, n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l;
      return ie(this, function(c) {
        switch (c.label) {
          case 0:
            this.updateProgress(n), r = { progress: GT(t), children: [] }, (i = this.node.children).push(r), a = new e(this.info, r), c.label = 1;
          case 1:
            return c.trys.push([1, 3, 4, 5]), [4, O6(t, a)];
          case 2:
            return [2, c.sent()];
          case 3:
            if (o = c.sent(), Xt.isAbort(o) && this.isAborted) return [2, void 0];
            throw o;
          case 4:
            if ((s = i.indexOf(r)) >= 0) {
              for (u = s, l = i.length - 1; u < l; u++) i[u] = i[u + 1];
              i.pop();
            }
            return i.length === 0 && this.onChildrenFinished && this.onChildrenFinished(), [7];
          case 5:
            return [2];
        }
      });
    });
  }, e;
}(), go = new (function() {
  function e() {
    this.shouldUpdate = !1, this.isSynchronous = !0;
  }
  return e.prototype.update = function(t, n) {
  }, e;
}())();
function C0(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s, u, l, c, d;
    return ie(this, function(f) {
      switch (f.label) {
        case 0:
          if (a = Math.max(t, 0), o = 0, s = 0, e.isSynchronous) return r(Number.MAX_SAFE_INTEGER, n), [2, n];
          u = Wr(), l = 0, c = 0, f.label = 1;
        case 1:
          return (l = r(a, n)) > 0 ? (o += l, d = Wr() - u, c += d, s += d, e.shouldUpdate ? [4, i(e, n, o)] : [3, 3]) : [3, 4];
        case 2:
          f.sent(), a = Math.round(c * o / s) + 1, u = Wr(), c = 0, f.label = 3;
        case 3:
          return [3, 1];
        case 4:
          return e.shouldUpdate ? [4, i(e, n, o)] : [3, 6];
        case 5:
          f.sent(), f.label = 6;
        case 6:
          return [2, n];
      }
    });
  });
}
function Gc(e, t) {
  return e[t] | e[t + 1] << 8;
}
function Yd(e, t) {
  return 16777216 * e[t + 3] + (e[t + 2] << 16 | e[t + 1] << 8 | e[t]);
}
function Ez(e) {
  return e.length < 2 ? "0" + e : e;
}
function Tz(e, t, n) {
  for (var r, i = "", a = 0; a < n; a++) i += "%" + Ez(e[t + a].toString(16));
  try {
    r = decodeURIComponent(i);
  } catch {
    return function(s, u, l) {
      for (var c = "", d = 0; d < l; d++) c += String.fromCharCode(s[u + d]);
      return c;
    }(e, t, n);
  }
  return r;
}
(function(e) {
  var t = function() {
    function a(o, s, u) {
      this.name = o, this.f = s, this.onAbort = u, this.id = i();
    }
    return a.prototype.run = function(o, s) {
      return s === void 0 && (s = 250), o ? Iz(this, o, s) : this.f(go);
    }, a.prototype.runAsChild = function(o, s) {
      return o.isSynchronous ? this.f(go) : function(u, l, c) {
        return u.runChild(l, c);
      }(o, this, s);
    }, a.prototype.runInContext = function(o) {
      return o.isSynchronous ? this.f(go) : function(s, u) {
        return O6(u, s);
      }(o, this);
    }, a;
  }();
  function n(a) {
    var o = a;
    return !!a && typeof o.id == "number" && typeof o.name == "string" && !!o.run;
  }
  function r(a, o, s) {
    return new t(a, o, s);
  }
  e.is = n, e.isAbort = function(a) {
    return !!a && !!a.isAborted;
  }, e.Aborted = function(a) {
    return { isAborted: !0, reason: a, toString: function() {
      return "Aborted".concat(a ? ": " + a : "");
    } };
  }, e.create = r, e.constant = function(a, o) {
    var s = this;
    return r(a, function(u) {
      return se(s, 0, void 0, function() {
        return ie(this, function(l) {
          return [2, o];
        });
      });
    });
  }, e.empty = function() {
    var a = this;
    return r("", function(o) {
      return se(a, 0, void 0, function() {
        return ie(this, function(s) {
          return [2];
        });
      });
    });
  }, e.fail = function(a, o) {
    var s = this;
    return r(a, function(u) {
      return se(s, 0, void 0, function() {
        return ie(this, function(l) {
          throw new Error(o);
        });
      });
    });
  }, e.resolveInContext = function(a, o) {
    return n(a) ? o ? a.runInContext(o) : a.run() : a;
  };
  var i = ha(0, 1073741823);
})(Xt || (Xt = {})), function(e) {
  e.Synchronous = go;
}(X9 || (X9 = {})), function(e) {
  function t(n, r) {
    r === void 0 && (r = "");
    var i = n.progress;
    if (!n.children.length) return i.isIndeterminate ? "".concat(r).concat(i.taskName, ": ").concat(i.message) : "".concat(r).concat(i.taskName, ": [").concat(i.current, "/").concat(i.max, "] ").concat(i.message);
    var a = r + "  |_ ", o = n.children.map(function(s) {
      return t(s, a);
    });
    return i.isIndeterminate ? "".concat(r).concat(i.taskName, ": ").concat(i.message, `
`).concat(o.join(`
`)) : "".concat(r).concat(i.taskName, ": [").concat(i.current, "/").concat(i.max, "] ").concat(i.message, `
`).concat(o.join(`
`));
  }
  e.format = function(n) {
    return t(n.root);
  };
}(Z9 || (Z9 = {}));
var kz = function() {
  for (var e = new Uint32Array(256), t = 0; t < 256; t++) {
    for (var n = t, r = 0; r < 8; r++) 1 & n ? n = 3988292384 ^ n >>> 1 : n >>>= 1;
    e[t] = n;
  }
  return e;
}();
function Dz(e, t, n) {
  return 4294967295 ^ function(r, i, a, o) {
    for (var s = 0; s < o; s++) r = kz[255 & (r ^ i[a + s])] ^ r >>> 8;
    return r;
  }(4294967295, e, t, n);
}
var Oo, Yf, jt = (Oo = Uint16Array, Yf = Uint32Array, { next_code: new Oo(16), bl_count: new Oo(16), ordr: [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], of0: [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, 999, 999, 999], exb: [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, 0, 0, 0], ldef: new Oo(32), df0: [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, 65535, 65535], dxb: [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, 0, 0], ddef: new Yf(32), flmap: new Oo(512), fltree: [], fdmap: new Oo(32), fdtree: [], lmap: new Oo(32768), ltree: [], ttree: [], dmap: new Oo(32768), dtree: [], imap: new Oo(512), itree: [], rev15: new Oo(32768), lhst: new Yf(286), dhst: new Yf(30), ihst: new Yf(19), lits: new Yf(15e3), strt: new Oo(65536), prev: new Oo(32768) });
function Jp(e, t, n) {
  for (var r = e.length, i = jt.rev15, a = 0; a < r; a += 2) if (e[a + 1] !== 0) for (var o = a >> 1, s = e[a + 1], u = o << 4 | s, l = t - s, c = e[a] << l, d = c + (1 << l); c !== d; )
    n[i[c] >>> 15 - t] = u, c++;
}
function $p(e, t) {
  for (var n = e.length, r = jt.bl_count, i = 0; i <= t; i++) r[i] = 0;
  for (i = 1; i < n; i += 2) r[e[i]]++;
  var a = jt.next_code, o = 0;
  r[0] = 0;
  for (var s = 1; s <= t; s++) o = o + r[s - 1] << 1, a[s] = o;
  for (var u = 0; u < n; u += 2) {
    var l = e[u + 1];
    l !== 0 && (e[u] = a[l], a[l]++);
  }
}
function Q9(e, t) {
  for (var n = jt.rev15, r = 15 - t, i = 0; i < e.length; i += 2) {
    var a = e[i] << t - e[i + 1];
    e[i] = n[a] >>> r;
  }
}
function Oz(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          if (t[0] === 3 && t[1] === 0) return [2, n || new Uint8Array(0)];
          r = function(a, o) {
            var s = o === void 0;
            return o === void 0 && (o = new Uint8Array(a.length >>> 2 << 3)), { data: a, buf: o, noBuf: s, BFINAL: 0, off: 0, pos: 0 };
          }(t, n), i.label = 1;
        case 1:
          return r.BFINAL !== 0 ? [3, 4] : e.shouldUpdate ? [4, e.update({ message: "Inflating blocks...", current: r.pos, max: t.length })] : [3, 3];
        case 2:
          i.sent(), i.label = 3;
        case 3:
          return function(a, o) {
            for (var s = a.data, u = a.noBuf, l = a.buf, c = a.BFINAL, d = a.off, f = a.pos, p = 0; c === 0 && p < o; ) {
              var g = void 0, m = void 0, v = 0, h = 0;
              c = py(s, f, 1), p += 1;
              var y = py(s, f + 1, 2);
              if (f += 3, y !== 0) {
                if (u && (l = my(l, d + (1 << 17))), y === 1) g = jt.flmap, m = jt.fdmap, v = 511, h = 31;
                else {
                  if (y !== 2) throw new Error("unknown BTYPE ".concat(y));
                  var x = kc(s, f, 5) + 257, S = kc(s, f + 5, 5) + 1, b = kc(s, f + 10, 4) + 4;
                  f += 14;
                  for (var _ = 0; _ < 38; _ += 2) jt.itree[_] = 0, jt.itree[_ + 1] = 0;
                  var C = 1;
                  for (_ = 0; _ < b; _++) {
                    var w = kc(s, f + 3 * _, 3);
                    jt.itree[1 + (jt.ordr[_] << 1)] = w, w > C && (C = w);
                  }
                  f += 3 * b, $p(jt.itree, C), Jp(jt.itree, C, jt.imap), g = jt.lmap, m = jt.dmap, f = Bz(jt.imap, (1 << C) - 1, x + S, s, f, jt.ttree);
                  var I = J9(jt.ttree, 0, x, jt.ltree);
                  v = (1 << I) - 1;
                  var M = J9(jt.ttree, x, S, jt.dtree);
                  h = (1 << M) - 1, $p(jt.ltree, I), Jp(jt.ltree, I, g), $p(jt.dtree, M), Jp(jt.dtree, M, m);
                }
                for (; ; ) {
                  var E = g[c5(s, f) & v];
                  f += 15 & E;
                  var T = E >>> 4;
                  if (!(T >>> 8)) l[d++] = T;
                  else {
                    if (T === 256) break;
                    var P = d + T - 254;
                    if (T > 264) {
                      var k = jt.ldef[T - 257];
                      P = d + (k >>> 3) + kc(s, f, 7 & k), f += 7 & k;
                    }
                    var D = m[c5(s, f) & h];
                    f += 15 & D;
                    var B = D >>> 4, L = jt.ddef[B], F = (L >>> 4) + py(s, f, 15 & L);
                    for (f += 15 & L, u && (l = my(l, d + (1 << 17))); d < P; ) l[d] = l[d++ - F], l[d] = l[d++ - F], l[d] = l[d++ - F], l[d] = l[d++ - F];
                    d = P;
                  }
                }
              } else {
                7 & f && (f += 8 - (7 & f));
                var V = 4 + (f >>> 3), G = s[V - 4] | s[V - 3] << 8;
                u && (l = my(l, d + G)), l.set(new Uint8Array(s.buffer, s.byteOffset + V, G), d), f = V + G << 3, d += G;
              }
            }
            a.buf = l, a.BFINAL = c, a.off = d, a.pos = f;
          }(r, 100), [3, 1];
        case 4:
          return [2, r.buf.length === r.off ? r.buf : r.buf.slice(0, r.off)];
      }
    });
  });
}
function my(e, t) {
  var n = e.length;
  if (t <= n) return e;
  var r = new Uint8Array(Math.max(n << 1, t));
  return r.set(e, 0), r;
}
function Bz(e, t, n, r, i, a) {
  for (var o = 0; o < n; ) {
    var s = e[c5(r, i) & t];
    i += 15 & s;
    var u = s >>> 4;
    if (u <= 15) a[o] = u, o++;
    else {
      var l = 0, c = 0;
      u === 16 ? (c = 3 + kc(r, i, 2), i += 2, l = a[o - 1]) : u === 17 ? (c = 3 + kc(r, i, 3), i += 3) : u === 18 && (c = 11 + kc(r, i, 7), i += 7);
      for (var d = o + c; o < d; ) a[o] = l, o++;
    }
  }
  return i;
}
function J9(e, t, n, r) {
  for (var i = 0, a = 0, o = r.length >>> 1; a < n; ) {
    var s = e[a + t];
    r[a << 1] = 0, r[1 + (a << 1)] = s, s > i && (i = s), a++;
  }
  for (; a < o; ) r[a << 1] = 0, r[1 + (a << 1)] = 0, a++;
  return i;
}
function kc(e, t, n) {
  return (e[t >>> 3] | e[1 + (t >>> 3)] << 8) >>> (7 & t) & (1 << n) - 1;
}
function py(e, t, n) {
  return (e[t >>> 3] | e[1 + (t >>> 3)] << 8 | e[2 + (t >>> 3)] << 16) >>> (7 & t) & (1 << n) - 1;
}
function c5(e, t) {
  return (e[t >>> 3] | e[1 + (t >>> 3)] << 8 | e[2 + (t >>> 3)] << 16) >>> (7 & t);
}
function KT(e, t, n) {
  return n === void 0 && (n = !1), se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l, c, d, f, p, g, m;
    return ie(this, function(v) {
      switch (v.label) {
        case 0:
          for (r = /* @__PURE__ */ Object.create(null), i = new Uint8Array(t), a = i.length - 4; Yd(i, a) !== 101010256; ) a--;
          o = a, o += 4, s = Gc(i, o += 4), o += 2, o += 2, u = Yd(i, o += 4), o += 4, o = u, l = 0, v.label = 1;
        case 1:
          return l < s ? (o += 4, o += 4, o += 4, o += 4, c = Yd(i, o += 4), d = Yd(i, o += 4), f = Gc(i, o += 4), p = Gc(i, o + 2), g = Gc(i, o + 4), o += 6, m = Yd(i, o += 8), o += 4, o += f + p + g, [4, Rz(e, i, m, r, c, d, n)]) : [3, 4];
        case 2:
          v.sent(), v.label = 3;
        case 3:
          return l++, [3, 1];
        case 4:
          return [2, r];
      }
    });
  });
}
function Rz(e, t, n, r, i, a, o) {
  return se(this, 0, void 0, function() {
    var s, u, l, c, d, f;
    return ie(this, function(p) {
      switch (p.label) {
        case 0:
          return n += 4, n += 2, s = Gc(t, n += 2), n += 2, n += 4, n += 4, u = Gc(t, n += 8), l = Gc(t, n += 2), c = Tz(t, n += 2, u), n += u, n += l, o ? (r[c] = { size: a, csize: i }, [2]) : (d = new Uint8Array(t.buffer, n), s !== 0 ? [3, 1] : (r[c] = new Uint8Array(d.buffer.slice(n, n + i)), [3, 4]));
        case 1:
          return s !== 8 ? [3, 3] : (f = new Uint8Array(a), [4, YT(e, d, f)]);
        case 2:
          return p.sent(), r[c] = f, [3, 4];
        case 3:
          throw new Error("unknown compression method: ".concat(s));
        case 4:
          return [2];
      }
    });
  });
}
function YT(e, t, n) {
  return se(this, 0, void 0, function() {
    return ie(this, function(r) {
      return [2, Oz(e, t, n)];
    });
  });
}
function Lz(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l, c, d;
    return ie(this, function(f) {
      switch (f.label) {
        case 0:
          if (r = t[3], i = 10, 4 & r && (a = Gc(t, i), i += a), 8 & r) {
            for (o = i; t[o] !== 0; ) ++o;
            i = o + 1;
          }
          if (16 & r) {
            for (o = i; t[o] !== 0; ) ++o;
            i = o + 1;
          }
          return 1 & r && (i += 2), s = function(p) {
            return 0 | p;
          }(Yd(t, t.length - 8)), u = Yd(t, t.length - 4), n === void 0 && (n = new Uint8Array(u)), l = new Uint8Array(t.buffer, t.byteOffset + i, t.length - i - 8), [4, YT(e, l, n)];
        case 1:
          return c = f.sent(), d = Dz(c, 0, c.length), s !== d && console.error("ungzip: checksums don't match"), [2, c];
      }
    });
  });
}
function Hh(e, t, n) {
  for (var r = 0, i = n.length; r < i; r++) {
    var a = n.charCodeAt(r);
    if (a < 128) e[t++] = a >>> 0 & 127;
    else if (a < 2048) e[t++] = a >>> 6 & 31 | 192, e[t++] = a >>> 0 & 63 | 128;
    else if (a < 65536) e[t++] = a >>> 12 & 15 | 224, e[t++] = a >>> 6 & 63 | 128, e[t++] = a >>> 0 & 63 | 128;
    else {
      if (!(a < 1114112)) throw new Error("bad codepoint " + a);
      e[t++] = a >>> 18 & 7 | 240, e[t++] = a >>> 12 & 63 | 128, e[t++] = a >>> 6 & 63 | 128, e[t++] = a >>> 0 & 63 | 128;
    }
  }
}
(function() {
  for (var e = 0; e < 32768; e++) {
    var t = e;
    t = (4278255360 & (t = (4042322160 & (t = (3435973836 & (t = (2863311530 & t) >>> 1 | (1431655765 & t) << 1)) >>> 2 | (858993459 & t) << 2)) >>> 4 | (252645135 & t) << 4)) >>> 8 | (16711935 & t) << 8, jt.rev15[e] = (t >>> 16 | t << 16) >>> 17;
  }
  function n(r, i, a) {
    for (; i-- != 0; ) r.push(0, a);
  }
  for (e = 0; e < 32; e++) jt.ldef[e] = jt.of0[e] << 3 | jt.exb[e], jt.ddef[e] = jt.df0[e] << 4 | jt.dxb[e];
  n(jt.fltree, 144, 8), n(jt.fltree, 112, 9), n(jt.fltree, 24, 7), n(jt.fltree, 8, 8), $p(jt.fltree, 9), Jp(jt.fltree, 9, jt.flmap), Q9(jt.fltree, 9), n(jt.fdtree, 32, 5), $p(jt.fdtree, 5), Jp(jt.fdtree, 5, jt.fdmap), Q9(jt.fdtree, 5), n(jt.itree, 19, 0), n(jt.ltree, 286, 0), n(jt.dtree, 30, 0), n(jt.ttree, 320, 0);
})();
var Nz = function() {
  for (var e = [], t = 0; t < 1024; t++) e[t] = String.fromCharCode(t);
  return e;
}();
function WT(e) {
  throw new Error(e);
}
var $9 = typeof TextDecoder < "u" ? new TextDecoder() : void 0;
function XT(e, t, n) {
  if ($9) {
    var r = t || n !== e.length ? e.subarray(t, t + n) : e;
    return $9.decode(r);
  }
  return function(i, a, o) {
    for (var s = Nz, u = void 0, l = 0, c = [], d = a, f = a + o; d < f; d++) {
      var p = i[d];
      128 & p ? (224 & p) == 192 ? c[l++] = s[(15 & p) << 6 | 63 & i[++d]] : (240 & p) == 224 ? c[l++] = String.fromCharCode((15 & p) << 12 | (63 & i[++d]) << 6 | 63 & i[++d]) : (248 & p) == 240 ? c[l++] = String.fromCharCode((7 & p) << 18 | (63 & i[++d]) << 12 | (63 & i[++d]) << 6 | 63 & i[++d]) : WT("Invalid byte " + p.toString(16)) : c[l++] = s[p], l === 512 && ((u = u || [])[u.length] = c.join(""), l = 0);
    }
    return u ? (l > 0 && (u[u.length] = c.slice(0, l).join("")), u.join("")) : c.slice(0, l).join("");
  }(e, t, n);
}
function ZT(e) {
  for (var t = 0, n = 0, r = e.length; n < r; n++) {
    var i = e.charCodeAt(n);
    i < 128 ? t += 1 : i < 2048 ? t += 2 : i < 65536 ? t += 3 : i < 1114112 ? t += 4 : WT("bad codepoint " + i);
  }
  return t;
}
var Bs, Fz = XMLHttpRequest;
function qh(e, t) {
  return function(n, r) {
    var i = this, a = void 0;
    return Xt.create("Read File", function(o) {
      return se(i, 0, void 0, function() {
        var s, u;
        return ie(this, function(l) {
          switch (l.label) {
            case 0:
              return l.trys.push([0, , 5, 6]), a = new FileReader(), s = r === "zip" ? Bs.None : (c = n.name, /\.gz$/i.test(c) ? Bs.Gzip : /\.zip$/i.test(c) ? Bs.Zip : Bs.None), r === "binary" || r === "zip" || s !== Bs.None ? a.readAsArrayBuffer(n) : a.readAsText(n), [4, o.update({ message: "Opening file...", canAbort: !0 })];
            case 1:
              return l.sent(), [4, QT(o, "Reading...", a)];
            case 2:
              return u = l.sent(), [4, o.update({ message: "Processing file...", canAbort: !1 })];
            case 3:
              return l.sent(), [4, zz(o, u, r, s)];
            case 4:
              return [2, l.sent()];
            case 5:
              return a = void 0, [7];
            case 6:
              return [2];
          }
          var c;
        });
      });
    }, function() {
      a && a.abort();
    });
  }(e, t);
}
function ex(e) {
  return typeof e == "string" ? nx(e, e, "string") : nx(e.title, e.url, e.type || "string", e.body, e.headers);
}
function tx(e) {
  return e ? "Failed to download data. Possible reasons: Resource is not available, or CORS is not allowed on the server." : "Failed to open file.";
}
function QT(e, t, n) {
  return new Promise(function(r, i) {
    if (function(s) {
      if (s instanceof FileReader) return s.readyState === FileReader.DONE;
      if (s instanceof XMLHttpRequest) return s.readyState === XMLHttpRequest.DONE;
      throw new Error("unknown data type");
    }(n)) {
      var a = n.error;
      a != null ? i(a ?? tx(n instanceof XMLHttpRequest)) : r(n);
    } else {
      var o = !1;
      n.onerror = function(s) {
        if (!o) {
          var u = s.target.error;
          i(u ?? tx(n instanceof XMLHttpRequest));
        }
      }, n.onprogress = function(s) {
        if (e.shouldUpdate && !o) try {
          s.lengthComputable ? e.update({ message: t, isIndeterminate: !1, current: s.loaded, max: s.total }) : e.update({ message: "".concat(t, " ").concat((s.loaded / 1024 / 1024).toFixed(2), " MB"), isIndeterminate: !0 });
        } catch (u) {
          o = !0, i(u);
        }
      }, n.onload = function(s) {
        r(n);
      };
    }
  });
}
(function(e) {
  e[e.None = 0] = "None", e[e.Gzip = 1] = "Gzip", e[e.Zip = 2] = "Zip";
})(Bs || (Bs = {}));
var Vz = /^(__MACOSX|.DS_Store)/;
function Gz(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          switch (n) {
            case Bs.None:
              return [3, 1];
            case Bs.Gzip:
              return [3, 2];
            case Bs.Zip:
              return [3, 3];
          }
          return [3, 5];
        case 1:
          return [2, t];
        case 2:
          return [2, Lz(e, t)];
        case 3:
          return [4, KT(e, t.buffer)];
        case 4:
          if (r = a.sent(), i = Object.keys(r).filter(function(o) {
            return !Vz.test(o);
          }), i.length !== 1) throw new Error("can only decompress zip files with a single entry");
          return [2, r[i[0]]];
        case 5:
          return [2];
      }
    });
  });
}
function zz(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          if (i = t.result, (a = i instanceof ArrayBuffer ? new Uint8Array(i) : i) === null) throw new Error("no data given");
          if (r === Bs.None) return [3, 4];
          if (!(a instanceof Uint8Array)) throw new Error("need Uint8Array for decompression");
          return [4, Gz(e, a, r)];
        case 1:
          return o = s.sent(), n !== "string" ? [3, 3] : [4, e.update({ message: "Decoding text..." })];
        case 2:
          return s.sent(), a = XT(o, 0, o.length), [3, 4];
        case 3:
          a = o, s.label = 4;
        case 4:
          return n === "binary" && a instanceof Uint8Array ? [2, a] : [3, 5];
        case 5:
          return n === "zip" && a instanceof Uint8Array ? [4, KT(e, a.buffer)] : [3, 7];
        case 6:
          return [2, s.sent()];
        case 7:
          if (n === "string" && typeof a == "string") return [2, a];
          if (n === "xml" && typeof a == "string") return [2, new DOMParser().parseFromString(a, "application/xml")];
          if (n === "json" && typeof a == "string") return [2, JSON.parse(a)];
          s.label = 8;
        case 8:
          throw new Error("could not get requested response data '".concat(n, "'"));
      }
    });
  });
}
var Ps, hy = function() {
  function e() {
  }
  return e.get = function() {
    return this.pool.length ? this.pool.pop() : new Fz();
  }, e.emptyFunc = function() {
  }, e.deposit = function(t) {
    this.pool.length < this.poolSize && (t.onabort = e.emptyFunc, t.onerror = e.emptyFunc, t.onload = e.emptyFunc, t.onprogress = e.emptyFunc, this.pool.push(t));
  }, e.pool = [], e.poolSize = 15, e;
}();
function nx(e, t, n, r, i) {
  var a = this, o = void 0;
  return Xt.create(e || "Download", function(s) {
    return se(a, 0, void 0, function() {
      var u, l, c, d, f, p, g;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            if ((o = hy.get()).open(r ? "post" : "get", t, !0), i) for (u = 0, l = i; u < l.length; u++) c = l[u], d = c[0], f = c[1], o.setRequestHeader(d, f);
            return o.responseType = function(v) {
              switch (v) {
                case "json":
                  return "json";
                case "xml":
                  return "document";
                case "string":
                  return "text";
                case "binary":
                case "zip":
                  return "arraybuffer";
              }
            }(n), o.send(r), [4, s.update({ message: "Waiting for server...", canAbort: !0 })];
          case 1:
            return m.sent(), [4, QT(s, "Downloading...", o)];
          case 2:
            return p = m.sent(), o = void 0, [4, s.update({ message: "Parsing response...", canAbort: !1 })];
          case 3:
            return m.sent(), g = function(v, h) {
              if (v.status >= 200 && v.status < 400) {
                var y = v.response;
                if (hy.deposit(v), (h === "binary" || h === "zip") && y instanceof ArrayBuffer) return new Uint8Array(y);
                if (h === "string" && typeof y == "string" || h === "xml" && y instanceof XMLDocument || h === "json" && typeof y == "object") return y;
                throw new Error("could not get requested response data '".concat(h, "'"));
              }
              throw hy.deposit(v), new Error("Download failed with status code ".concat(v.status));
            }(p, n), [2, g];
        }
      });
    });
  }, function() {
    o && (o.abort(), o = void 0);
  });
}
(function(e) {
  function t(n, r) {
    return O({ kind: "url", id: di.create22(), url: n }, r);
  }
  e.Url = t, e.File = function(n) {
    return { kind: "file", id: di.create22(), name: n.name, file: n };
  }, e.isUrl = function(n) {
    return (n == null ? void 0 : n.kind) === "url";
  }, e.isFile = function(n) {
    return (n == null ? void 0 : n.kind) === "file";
  }, e.Wrapper = function(n, r, i) {
    return { data: n, dispose: function() {
      i.release(r);
    } };
  }, e.getUrl = function(n) {
    return typeof n == "string" ? n : n.url;
  }, e.getUrlAsset = function(n, r, i) {
    return typeof r == "string" ? n.tryFindUrl(r, i) || t(r, { body: i }) : r;
  };
})(Ps || (Ps = {}));
var N, vl = function() {
  function e() {
    this._assets = /* @__PURE__ */ new Map();
  }
  return Object.defineProperty(e.prototype, "assets", { get: function() {
    return I6(this._assets.values());
  }, enumerable: !1, configurable: !0 }), e.prototype.tryFindUrl = function(t, n) {
    for (var r = this.assets.values(); ; ) {
      var i = r.next();
      if (i.done) return;
      var a = i.value.asset;
      if (Ps.isUrl(a) && a.url === t && (a.body || "") === (n || "")) return a;
    }
  }, e.prototype.set = function(t, n) {
    this._assets.set(t.id, { asset: t, file: n, refCount: 0 });
  }, e.prototype.get = function(t) {
    return this._assets.get(t);
  }, e.prototype.remove = function(t) {
    this._assets.delete(t);
  }, e.prototype.resolve = function(t, n, r) {
    var i = this;
    return r === void 0 && (r = !0), Ps.isUrl(t) ? Xt.create("Download ".concat(t.title || t.url), function(a) {
      return se(i, 0, void 0, function() {
        var o, s, u, l, c, d, f, p, g;
        return ie(this, function(m) {
          switch (m.label) {
            case 0:
              return this._assets.has(t.id) ? ((o = this._assets.get(t.id)).refCount++, u = (s = Ps).Wrapper, [4, qh(o.file, n).runInContext(a)]) : [3, 2];
            case 1:
              return [2, u.apply(s, [m.sent(), t, this])];
            case 2:
              return r ? [3, 4] : (c = (l = Ps).Wrapper, [4, ex(O(O({}, t), { type: n })).runInContext(a)]);
            case 3:
              return [2, c.apply(l, [m.sent(), t, this])];
            case 4:
              return [4, ex(O(O({}, t), { type: "binary" })).runInContext(a)];
            case 5:
              return d = m.sent(), f = new File([d], "raw-data"), this._assets.set(t.id, { asset: t, file: f, refCount: 1 }), g = (p = Ps).Wrapper, [4, qh(f, n).runInContext(a)];
            case 6:
              return [2, g.apply(p, [m.sent(), t, this])];
          }
        });
      });
    }) : Xt.create("Read ".concat(t.name), function(a) {
      return se(i, 0, void 0, function() {
        var o, s, u, l, c;
        return ie(this, function(d) {
          switch (d.label) {
            case 0:
              return this._assets.has(t.id) ? (o = this._assets.get(t.id), t.file = o.file, o.refCount++, u = (s = Ps).Wrapper, [4, qh(o.file, n).runInContext(a)]) : [3, 2];
            case 1:
              return [2, u.apply(s, [d.sent(), t, this])];
            case 2:
              if (!(t.file instanceof File)) throw new Error("Cannot resolve file asset '".concat(t.name, "' (").concat(t.id, ")"));
              return r && this._assets.set(t.id, { asset: t, file: t.file, refCount: 1 }), c = (l = Ps).Wrapper, [4, qh(t.file, n).runInContext(a)];
            case 3:
              return [2, c.apply(l, [d.sent(), t, this])];
          }
        });
      });
    });
  }, e.prototype.release = function(t) {
    var n = this._assets.get(t.id);
    n && (n.refCount--, n.refCount <= 0 && this._assets.delete(t.id));
  }, e;
}();
function Kg(e) {
  for (var t = -1 / 0, n = 0, r = e.length; n < r; ++n) e[n] > t && (t = e[n]);
  return t;
}
function Uz(e) {
  for (var t = 1 / 0, n = 0, r = e.length; n < r; ++n) e[n] < t && (t = e[n]);
  return t;
}
function lo(e) {
  for (var t = 1 / 0, n = -1 / 0, r = 0, i = e.length; r < i; ++r) e[r] < t && (t = e[r]), e[r] > n && (n = e[r]);
  return [t, n];
}
function hg(e, t, n) {
  t === void 0 && (t = 1), n === void 0 && (n = 0);
  for (var r = e.length, i = 0, a = n; a < r; a += t) i += e[a];
  return i;
}
function Hz(e, t, n) {
  return t === void 0 && (t = 1), n === void 0 && (n = 0), hg(e, t, n) / (e.length / t);
}
function qz(e) {
  for (var t = e.length, n = 0, r = 0; r < t; ++r) {
    var i = e[r];
    n += i * i;
  }
  return Math.sqrt(n / t);
}
function Tu(e, t) {
  for (var n = 0, r = t ? Math.min(t, e.length) : e.length; n < r; ++n) e[n] = n;
  return e;
}
function Qo(e, t) {
  return !(e.indexOf(t) >= 0) && (e.push(t), !0);
}
function gg(e, t) {
  var n = e.indexOf(t);
  if (n < 0) return !1;
  for (var r = n, i = e.length - 1; r < i; r++) e[r] = e[r + 1];
  return e.pop(), !0;
}
function Yg(e, t) {
  for (var n = 0, r = 0, i = e.length; r < i; ++r) t.includes(e[r]) && (n += 1);
  return n;
}
(function(e) {
  function t(b, _) {
    return _ && (_.label && (b.label = _.label), _.description && (b.description = _.description), _.legend && (b.legend = _.legend), _.fieldLabels && (b.fieldLabels = _.fieldLabels), _.isHidden && (b.isHidden = _.isHidden), _.shortLabel && (b.shortLabel = _.shortLabel), _.twoColumns && (b.twoColumns = _.twoColumns), _.isEssential && (b.isEssential = _.isEssential), _.category && (b.category = _.category), _.hideIf && (b.hideIf = _.hideIf), _.help && (b.help = _.help)), b;
  }
  function n(b, _, C) {
    return t({ type: "select", defaultValue: S(b, _), options: _, cycle: C == null ? void 0 : C.cycle }, C);
  }
  function r(b, _) {
    return _ && (_.min !== void 0 && (b.min = _.min), _.max !== void 0 && (b.max = _.max), _.step !== void 0 && (b.step = _.step)), b;
  }
  function i(b, _) {
    var C = t({ type: "group", defaultValue: (_ == null ? void 0 : _.customDefault) || s(b), params: b }, _);
    return _ != null && _.presets && (C.presets = _.presets), _ != null && _.isExpanded && (C.isExpanded = _.isExpanded), _ != null && _.isFlat && (C.isFlat = _.isFlat), _ != null && _.pivot && (C.pivot = _.pivot), C;
  }
  function a() {
    return s(this.element);
  }
  function o() {
    throw new Error("getValue not set. Fix runtime.");
  }
  function s(b) {
    for (var _ = {}, C = 0, w = Object.keys(b); C < w.length; C++) {
      var I = w[C];
      b[I].isOptional || (_[I] = b[I].defaultValue);
    }
    return _;
  }
  function u(b, _) {
    return function() {
      return b(_);
    };
  }
  function l(b, _, C) {
    if (_) {
      if (b.type === "value-ref") (w = _).ref ? w.getValue = u(b.resolveRef, w.ref) : w.getValue = function() {
        throw new Error("Unset ref in ValueRef value.");
      };
      else if (b.type === "data-ref")
        (w = _).ref ? w.getValue = u(C, w.ref) : w.getValue = function() {
          throw new Error("Unset ref in ValueRef value.");
        };
      else if (b.type === "group") f(b.params, _, C);
      else if (b.type === "mapped") {
        var w = _;
        l(b.map(w.name), w.params, C);
      } else if (b.type === "object-list") {
        if (!d(b.element)) return;
        for (var I = 0, M = _; I < M.length; I++) {
          var E = M[I];
          f(b.element, E, C);
        }
      }
    }
  }
  function c(b) {
    if (b.type === "value-ref" || b.type === "data-ref") return !0;
    if (b.type === "group") {
      if (d(b.params)) return !0;
    } else if (b.type === "mapped") for (var _ = 0, C = b.select.options; _ < C.length; _++) {
      var w = C[_][0];
      if (c(b.map(w))) return !0;
    }
    else if (b.type === "object-list") return d(b.element);
    return !1;
  }
  function d(b) {
    for (var _ = 0, C = Object.keys(b); _ < C.length; _++)
      if (c(b[C[_]])) return !0;
    return !1;
  }
  function f(b, _, C) {
    for (var w = 0, I = Object.keys(b); w < I.length; w++) {
      var M = I[w];
      l(b[M], _ == null ? void 0 : _[M], C);
    }
  }
  function p(b, _, C) {
    if (_ === C) return !0;
    if (typeof _ != "object" || typeof C != "object") return !1;
    for (var w = 0, I = Object.keys(b); w < I.length; w++) {
      var M = I[w];
      if (!g(b[M], _[M], C[M])) return !1;
    }
    return !0;
  }
  function g(b, _, C) {
    if (_ === C) return !0;
    if (b.type === "group") return p(b.params, _, C);
    if (b.type === "mapped") {
      var w = C;
      return (T = _).name === w.name && g(b.map(T.name), T.params, w.params);
    }
    if (b.type === "multi-select") {
      if (w = C, (T = _).length !== w.length) return !1;
      if (T.length < 10) {
        for (var I = 0, M = T.length; I < M; I++) if (T[I] !== w[I] && w.indexOf(T[I]) < 0) return !1;
      } else {
        var E = new Set(w);
        for (I = 0, M = T.length; I < M; I++) if (T[I] !== w[I] && !E.has(T[I])) return !1;
      }
      return !0;
    }
    if (b.type === "interval") return _[0] === C[0] && _[1] === C[1];
    if (b.type === "line-graph") {
      if (w = C, (T = _).length !== w.length) return !1;
      for (I = 0, M = T.length; I < M; I++) if (!xe.areEqual(T[I], w[I])) return !1;
      return !0;
    }
    if (b.type === "vec3") return A.equals(_, C);
    if (b.type === "mat4") return ne.areEqual(_, C, sr);
    if (b.type === "script")
      return w = C, (T = _).language === w.language && T.expression === w.expression;
    if (b.type === "object-list") {
      w = C;
      var T, P = (T = _).length;
      if (P !== w.length) return !1;
      for (I = 0; I < P; I++) if (!p(b.element, T[I], w[I])) return !1;
      return !0;
    }
    return typeof _ == "object" && typeof C == "object" && LT(_, C);
  }
  function m(b, _, C) {
    if (_ === void 0) return O({}, C);
    if (C === void 0) return O({}, _);
    for (var w = /* @__PURE__ */ Object.create(null), I = 0, M = Object.keys(b); I < M.length; I++) {
      var E = M[I];
      w[E] = v(b[E], _[E], C[E]);
    }
    return w;
  }
  function v(b, _, C) {
    if (_ === void 0) return typeof C != "object" || Array.isArray(C) ? C : O({}, C);
    if (C === void 0) return typeof _ != "object" || Array.isArray(_) ? _ : O({}, _);
    if (b.type === "group") return m(b.params, _, C);
    if (b.type === "mapped") {
      var w = _, I = C;
      if (w.name !== I.name) return O({}, I);
      var M = b.map(I.name);
      return { name: I.name, params: v(M, w.params, I.params) };
    }
    return b.type === "value" ? C : typeof _ == "object" && typeof C == "object" ? Array.isArray(C) ? C : O(O({}, _), C) : C;
  }
  function h(b, _) {
    for (var C = 0, w = b.options; C < w.length; C++)
      if (w[C][0] === _) return !0;
    return !1;
  }
  function y(b, _, C) {
    if (_ == null) return C ? b.defaultValue : void 0;
    if (b.type === "value") return _;
    if (b.type === "group") {
      for (var w = /* @__PURE__ */ Object.create(null), I = 0, M = Object.keys(b.params); I < M.length; I++) {
        var E = M[I], T = b.params[E];
        _[E] === void 0 ? C && (w[E] = T.defaultValue) : w[E] = y(T, _[E], C);
      }
      return w;
    }
    if (b.type === "mapped") {
      var P = _;
      return typeof P.name != "string" ? b.defaultValue : P.params === void 0 ? C ? b.defaultValue : void 0 : h(b.select, P.name) ? (T = b.map(P.name), { name: P.name, params: y(T, P.params, C) }) : b.defaultValue;
    }
    return b.type === "select" ? h(b, _) ? _ : b.defaultValue : b.type === "multi-select" ? Array.isArray(_) ? (w = _.filter(function(k) {
      return h(this, k);
    }, b), _.length > 0 && w.length === 0 ? b.defaultValue : w) : b.defaultValue : b.type === "object-list" ? Array.isArray(_) ? _.map(function(k) {
      return x(b.element, k, C ? "all" : "skip");
    }) : b.defaultValue : _;
  }
  function x(b, _, C) {
    if (typeof _ != "object" || _ === null) return C ? s(b) : _;
    for (var w = /* @__PURE__ */ Object.create(null), I = 0, M = Object.keys(b); I < M.length; I++) {
      var E = M[I], T = b[E];
      _[E] === void 0 ? C === "all" && (w[E] = T.defaultValue) : w[E] = y(T, _[E], C !== "skip");
    }
    return w;
  }
  function S(b, _) {
    for (var C = 0, w = _; C < w.length; C++)
      if (w[C][0] === b) return b;
    return _.length > 0 ? _[0][0] : void 0;
  }
  e.Essential = { isEssential: !0 }, e.Optional = function(b) {
    var _ = O({}, b);
    return _.isOptional = !0, _;
  }, e.Value = function(b, _) {
    return t({ type: "value", defaultValue: b }, _);
  }, e.Select = n, e.MultiSelect = function(b, _, C) {
    var w = t({ type: "multi-select", defaultValue: b, options: _ }, C);
    return C != null && C.emptyValue && (w.emptyValue = C.emptyValue), w;
  }, e.Boolean = function(b, _) {
    return t({ type: "boolean", defaultValue: b }, _);
  }, e.Text = function(b, _) {
    return b === void 0 && (b = ""), t({ type: "text", defaultValue: b }, _);
  }, e.Color = function(b, _) {
    var C = t({ type: "color", defaultValue: b }, _);
    return _ != null && _.isExpanded && (C.isExpanded = _.isExpanded), C;
  }, e.ColorList = function(b, _) {
    var C;
    if (typeof b == "string") {
      var w = Dl(b);
      C = { kind: w.type !== "qualitative" ? "interpolate" : "set", colors: w.list };
    } else C = b;
    return t({ type: "color-list", presetKind: (_ == null ? void 0 : _.presetKind) || "all", defaultValue: C, offsets: !!(_ != null && _.offsets) }, _);
  }, e.Vec3 = function(b, _, C) {
    return t(r({ type: "vec3", defaultValue: b }, _), C);
  }, e.Mat4 = function(b, _) {
    return t({ type: "mat4", defaultValue: b }, _);
  }, e.Url = function(b, _) {
    return t({ type: "url", defaultValue: typeof b == "string" ? Ps.Url(b) : Ps.Url(b.url, { body: b.body }) }, _);
  }, e.File = function(b) {
    var _ = t({ type: "file", defaultValue: null }, b);
    return b != null && b.accept && (_.accept = b.accept), _;
  }, e.FileList = function(b) {
    var _ = t({ type: "file-list", defaultValue: null }, b);
    return b != null && b.accept && (_.accept = b.accept), _;
  }, e.Numeric = function(b, _, C) {
    var w = t(r({ type: "number", defaultValue: b }, _), C);
    return C != null && C.immediateUpdate && (w.immediateUpdate = !0), w;
  }, e.Interval = function(b, _, C) {
    return t(r({ type: "interval", defaultValue: b }, _), C);
  }, e.LineGraph = function(b, _) {
    return t({ type: "line-graph", defaultValue: b }, _);
  }, e.Group = i, e.EmptyGroup = function(b) {
    return i({}, b);
  }, e.Mapped = function(b, _, C, w) {
    var I = S(b, _);
    return t({ type: "mapped", defaultValue: { name: I, params: C(I).defaultValue }, select: n(I, _, w), map: C }, w);
  }, e.MappedStatic = function(b, _, C) {
    var w = C != null && C.options ? C.options : Object.keys(_).map(function(M) {
      return [M, _[M].label || Su(M)];
    }), I = S(b, w);
    return t({ type: "mapped", defaultValue: { name: I, params: _[I].defaultValue }, select: n(I, w, C), map: function(M) {
      return _[M];
    } }, C);
  }, e.ObjectList = function(b, _, C) {
    return t({ type: "object-list", element: b, getLabel: _, ctor: a, defaultValue: (C == null ? void 0 : C.defaultValue) || [] }, C);
  }, e.ValueRef = function(b, _, C) {
    var w;
    return t({ type: "value-ref", defaultValue: { ref: (w = C == null ? void 0 : C.defaultRef) !== null && w !== void 0 ? w : "", getValue: o }, getOptions: b, resolveRef: _ }, C);
  }, e.DataRef = function(b) {
    var _;
    return t({ type: "data-ref", defaultValue: { ref: (_ = b == null ? void 0 : b.defaultRef) !== null && _ !== void 0 ? _ : "", getValue: o } }, b);
  }, e.Converted = function(b, _, C) {
    return { type: "converted", defaultValue: _(C.defaultValue), converted: C, fromValue: b, toValue: _ };
  }, e.Conditioned = function(b, _, C, w, I) {
    var M = Object.keys(_).map(function(E) {
      return [E, E];
    });
    return t({ type: "conditioned", select: n(C(b), M, I), defaultValue: b, conditionParams: _, conditionForValue: C, conditionedValue: w }, I);
  }, e.Script = function(b, _) {
    return t({ type: "script", defaultValue: b }, _);
  }, e.For = function(b) {
    return 0;
  }, e.getDefaultValues = s, e.resolveRefs = f, e.setDefaultValues = function(b, _) {
    for (var C = 0, w = Object.keys(b); C < w.length; C++) {
      var I = w[C];
      b[I].isOptional || (b[I].defaultValue = _[I]);
    }
  }, e.clone = function(b) {
    return Bl(b);
  }, e.validate = function(b, _) {
  }, e.areEqual = p, e.isParamEqual = g, e.merge = m, e.mergeParam = v, e.normalizeParams = x, e.objectToOptions = function(b, _) {
    for (var C = [], w = 0, I = Object.keys(b); w < I.length; w++) {
      var M = I[w];
      if (_) {
        var E = _(M, b[M]);
        C.push(typeof E == "string" ? [M, E] : [M, E[0], E[1]]);
      } else typeof b[M] == "string" ? C.push([M, b[M]]) : C.push([M, _ === null ? M : Su(M)]);
    }
    return C;
  }, e.arrayToOptions = function(b, _) {
    for (var C = [], w = 0, I = b; w < I.length; w++) {
      var M = I[w];
      _ ? C.push([M, _(M)]) : C.push([M, _ === null ? M : Su(M)]);
    }
    return C;
  }, e.optionLabel = function(b, _) {
    for (var C = 0, w = b.options; C < w.length; C++) {
      var I = w[C];
      if (I[0] === _) return I[1];
    }
    return "";
  };
})(N || (N = {}));
var d5, f5 = { backgroundColor: N.Color(Ae(0), { description: "Background color of the 3D canvas" }), pickingAlphaThreshold: N.Numeric(0.3, { min: 0, max: 1, step: 0.01 }, { description: "The minimum opacity value needed for an object to be pickable." }), interiorDarkening: N.Numeric(0.5, { min: 0, max: 1, step: 0.01 }), interiorColorFlag: N.Boolean(!0, { label: "Use Interior Color" }), interiorColor: N.Color(Ae.fromNormalizedRgb(0.3, 0.3, 0.3)), highlightColor: N.Color(Ae.fromNormalizedRgb(1, 0.4, 0.6)), selectColor: N.Color(Ae.fromNormalizedRgb(0.2, 1, 0.1)), highlightStrength: N.Numeric(0.3, { min: 0, max: 1, step: 0.1 }), selectStrength: N.Numeric(0.3, { min: 0, max: 1, step: 0.1 }), markerPriority: N.Select(1, [[1, "Highlight"], [2, "Select"]]), xrayEdgeFalloff: N.Numeric(1, { min: 0, max: 3, step: 0.1 }), light: N.ObjectList({ inclination: N.Numeric(180, { min: 0, max: 180, step: 1 }), azimuth: N.Numeric(0, { min: 0, max: 360, step: 1 }), color: N.Color(Ae.fromNormalizedRgb(1, 1, 1)), intensity: N.Numeric(0.6, { min: 0, max: 1, step: 0.01 }) }, function(e) {
  return Ae.toHexString(e.color);
}, { defaultValue: [{ inclination: 180, azimuth: 0, color: Ae.fromNormalizedRgb(1, 1, 1), intensity: 0.6 }] }), ambientColor: N.Color(Ae.fromNormalizedRgb(1, 1, 1)), ambientIntensity: N.Numeric(0.45, { min: 0, max: 1, step: 0.01 }), invalidColor: N.Color(Ae(16410214)), invalidStrength: N.Numeric(0.2, { min: 0, max: 1, step: 0.1 }) }, rx = A(), gy = A();
function ix(e, t) {
  for (var n = t || { direction: new Array(15).fill(0), color: new Array(15).fill(0) }, r = n.direction, i = n.color, a = 0, o = e.length; a < o; ++a) {
    var s = e[a];
    A.directionFromSpherical(rx, xr(s.inclination), xr(s.azimuth), 1), A.toArray(rx, r, 3 * a), A.scale(gy, Ae.toVec3Normalized(gy, s.color), s.intensity), A.toArray(gy, i, 3 * a);
  }
  return { count: e.length, direction: r, color: i };
}
function jr(e, t, n) {
  return t === void 0 && (t = ""), n === void 0 && (n = ""), jr.create(e, t, n);
}
(function(e) {
  e.create = function(t, n) {
    n === void 0 && (n = {});
    var r = t.gl, i = t.state, a = t.stats, o = N.merge(f5, N.getDefaultValues(f5), n), s = ix(o.light), u = Ii(), l = xe.create(r.drawingBufferWidth, r.drawingBufferHeight), c = Ae.toVec3Normalized(A(), o.backgroundColor), d = !1, f = t.resources.texture("image-depth", "depth", "ushort", "nearest"), p = [["tDepth", f]], g = ne(), m = ne(), v = ne(), h = ne(), y = ne(), x = ne(), S = ne(), b = A(), _ = xe(), C = A();
    A.scale(C, Ae.toArrayNormalized(o.ambientColor, C, 0), o.ambientIntensity);
    var w = { uModel: R.create(ne.identity()), uView: R.create(g), uInvView: R.create(m), uModelView: R.create(v), uInvModelView: R.create(h), uInvProjection: R.create(y), uProjection: R.create(ne()), uModelViewProjection: R.create(x), uInvModelViewProjection: R.create(S), uIsOrtho: R.create(1), uViewOffset: R.create(_), uPixelRatio: R.create(t.pixelRatio), uViewport: R.create(Ii.toVec4(Nt(), u)), uDrawingBufferSize: R.create(l), uCameraPosition: R.create(A()), uCameraDir: R.create(b), uNear: R.create(1), uFar: R.create(1e4), uFogNear: R.create(1), uFogFar: R.create(1e4), uFogColor: R.create(c), uRenderWboit: R.create(!1), uMarkingDepthTest: R.create(!1), uPickType: R.create(0), uMarkingType: R.create(0), uTransparentBackground: R.create(!1), uLightDirection: R.create(s.direction), uLightColor: R.create(s.color), uAmbientColor: R.create(C), uPickingAlphaThreshold: R.create(o.pickingAlphaThreshold), uInteriorDarkening: R.create(o.interiorDarkening), uInteriorColorFlag: R.create(o.interiorColorFlag), uInteriorColor: R.create(Ae.toVec3Normalized(A(), o.interiorColor)), uHighlightColor: R.create(Ae.toVec3Normalized(A(), o.highlightColor)), uSelectColor: R.create(Ae.toVec3Normalized(A(), o.selectColor)), uHighlightStrength: R.create(o.highlightStrength), uSelectStrength: R.create(o.selectStrength), uMarkerPriority: R.create(o.markerPriority), uXrayEdgeFalloff: R.create(o.xrayEdgeFalloff), uInvalidColor: R.create(Ae.toVec3Normalized(A(), o.invalidColor)), uInvalidStrength: R.create(o.invalidStrength) }, I = Object.entries(w), M = !0, E = function(D, B) {
      if (!D.state.disposed && D.state.visible && (D.state.pickable || B !== "pick")) {
        var L = !1;
        D.values.dLightCount.ref.value !== s.count && (R.update(D.values.dLightCount, s.count), L = !0), L && D.update();
        var F = D.getProgram(B);
        if (i.currentProgramId !== F.id && (M = !0, F.use()), M && (F.setUniforms(I), M = !1), D.values.dGeometryType.ref.value === "directVolume") {
          if (B !== "colorWboit" && B !== "colorBlended") return;
          i.disable(r.CULL_FACE), i.frontFace(r.CCW), B === "colorBlended" && (i.disable(r.DEPTH_TEST), i.depthMask(!1));
        } else D.values.uDoubleSided ? D.values.uDoubleSided.ref.value || D.values.hasReflection.ref.value ? i.disable(r.CULL_FACE) : i.enable(r.CULL_FACE) : i.disable(r.CULL_FACE), D.values.dFlipSided && D.values.dFlipSided.ref.value ? (i.frontFace(r.CW), i.cullFace(r.FRONT)) : (i.frontFace(r.CCW), i.cullFace(r.BACK));
        D.render(B, p);
      }
    }, T = function(D, B, L, F, V) {
      (function(K, Y, Z) {
        for (var X = 0, W = K.length; X < W; ++X) if (K[X][0] === Y) return void (K[X][1] = Z);
        K.push([Y, Z]);
      })(p, "tDepth", L || f), R.update(w.uModel, D.view), R.update(w.uModelView, ne.mul(v, D.view, B.view)), R.update(w.uInvModelView, ne.invert(h, v)), R.update(w.uModelViewProjection, ne.mul(x, v, B.projection)), R.update(w.uInvModelViewProjection, ne.invert(S, x)), R.updateIfChanged(w.uRenderWboit, F), R.updateIfChanged(w.uMarkingDepthTest, V), i.enable(r.SCISSOR_TEST), i.colorMask(!0, !0, !0, !0);
      var G = u.x, H = u.y, q = u.width, z = u.height;
      r.viewport(G, H, q, z), r.scissor(G, H, q, z), M = !0, i.currentRenderItemId = -1;
    }, P = function(D, B, L) {
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, L, !1, !1);
      for (var F = D.renderables, V = 0, G = F.length; V < G; ++V) {
        var H = F[V];
        H.state.opaque && E(H, "colorBlended");
      }
    }, k = function(D, B, L) {
      i.enable(r.DEPTH_TEST), T(D, B, L, !1, !1);
      var F = D.renderables;
      d ? i.blendFunc(r.ONE, r.ONE_MINUS_SRC_ALPHA) : i.blendFuncSeparate(r.SRC_ALPHA, r.ONE_MINUS_SRC_ALPHA, r.ONE, r.ONE_MINUS_SRC_ALPHA), i.enable(r.BLEND), i.depthMask(!0);
      for (var V = 0, G = F.length; V < G; ++V)
        !(H = F[V]).state.opaque && H.state.writeDepth && E(H, "colorBlended");
      for (i.depthMask(!1), V = 0, G = F.length; V < G; ++V) {
        var H;
        (H = F[V]).state.opaque || H.state.writeDepth || E(H, "colorBlended");
      }
    };
    return { clear: function(D, B) {
      i.enable(r.SCISSOR_TEST), i.enable(r.DEPTH_TEST), i.colorMask(!0, !0, !0, !0), i.depthMask(!0), d && !B ? i.clearColor(0, 0, 0, 0) : D ? i.clearColor(c[0], c[1], c[2], 1) : i.clearColor(1, 1, 1, 1), r.clear(r.COLOR_BUFFER_BIT | r.DEPTH_BUFFER_BIT);
    }, clearDepth: function() {
      i.enable(r.SCISSOR_TEST), i.enable(r.DEPTH_TEST), i.depthMask(!0), r.clear(r.DEPTH_BUFFER_BIT);
    }, update: function(D) {
      R.update(w.uView, D.view), R.update(w.uInvView, ne.invert(m, D.view)), R.update(w.uProjection, D.projection), R.update(w.uInvProjection, ne.invert(y, D.projection)), R.updateIfChanged(w.uIsOrtho, D.state.mode === "orthographic" ? 1 : 0), R.update(w.uViewOffset, D.viewOffset.enabled ? xe.set(_, 16 * D.viewOffset.offsetX, 16 * D.viewOffset.offsetY) : xe.set(_, 0, 0)), R.update(w.uCameraPosition, D.state.position), R.update(w.uCameraDir, A.normalize(b, A.sub(b, D.state.target, D.state.position))), R.updateIfChanged(w.uFar, D.far), R.updateIfChanged(w.uNear, D.near), R.updateIfChanged(w.uFogFar, D.fogFar), R.updateIfChanged(w.uFogNear, D.fogNear), R.updateIfChanged(w.uTransparentBackground, d);
    }, renderPick: function(D, B, L, F, V) {
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, F, !1, !1), R.updateIfChanged(w.uPickType, V);
      for (var G = D.renderables, H = 0, q = G.length; H < q; ++H) G[H].state.colorOnly || E(G[H], L);
    }, renderDepth: function(D, B, L) {
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, L, !1, !1);
      for (var F = D.renderables, V = 0, G = F.length; V < G; ++V) E(F[V], "depth");
    }, renderMarkingDepth: function(D, B, L) {
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, L, !1, !1), R.updateIfChanged(w.uMarkingType, 1);
      for (var F = D.renderables, V = 0, G = F.length; V < G; ++V)
        F[V].values.markerAverage.ref.value !== 1 && E(F[V], "marking");
    }, renderMarkingMask: function(D, B, L) {
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, L, !1, !!L), R.updateIfChanged(w.uMarkingType, 2);
      for (var F = D.renderables, V = 0, G = F.length; V < G; ++V)
        F[V].values.markerAverage.ref.value > 0 && E(F[V], "marking");
    }, renderBlended: function(D, B, L) {
      P(D, B, L), k(D, B, L);
    }, renderBlendedOpaque: P, renderBlendedTransparent: k, renderBlendedVolumeOpaque: function(D, B, L) {
      var F;
      i.blendFunc(r.ONE, r.ONE_MINUS_SRC_ALPHA), i.enable(r.BLEND), T(D, B, L, !1, !1);
      for (var V = D.renderables, G = 0, H = V.length; G < H; ++G) {
        var q = V[G];
        Ia(q.values.alpha.ref.value * q.state.alphaFactor, 0, 1) !== 1 || q.values.transparencyAverage.ref.value === 1 || !((F = q.values.dXrayShaded) === null || F === void 0) && F.ref.value || E(q, "colorBlended");
      }
    }, renderBlendedVolumeTransparent: function(D, B, L) {
      var F;
      i.blendFunc(r.ONE, r.ONE_MINUS_SRC_ALPHA), i.enable(r.BLEND), T(D, B, L, !1, !1);
      for (var V = D.renderables, G = 0, H = V.length; G < H; ++G) {
        var q = V[G];
        (Ia(q.values.alpha.ref.value * q.state.alphaFactor, 0, 1) < 1 || q.values.transparencyAverage.ref.value > 0 || !((F = q.values.dXrayShaded) === null || F === void 0) && F.ref.value) && E(q, "colorBlended");
      }
    }, renderWboitOpaque: function(D, B, L) {
      var F, V;
      i.disable(r.BLEND), i.enable(r.DEPTH_TEST), i.depthMask(!0), T(D, B, L, !1, !1);
      for (var G = D.renderables, H = 0, q = G.length; H < q; ++H) {
        var z = G[H];
        Ia(z.values.alpha.ref.value * z.state.alphaFactor, 0, 1) !== 1 || z.values.transparencyAverage.ref.value === 1 || z.values.dGeometryType.ref.value === "directVolume" || ((F = z.values.dPointStyle) === null || F === void 0 ? void 0 : F.ref.value) === "fuzzy" || !((V = z.values.dXrayShaded) === null || V === void 0) && V.ref.value || E(z, "colorWboit");
      }
    }, renderWboitTransparent: function(D, B, L) {
      var F, V;
      T(D, B, L, !0, !1);
      for (var G = D.renderables, H = 0, q = G.length; H < q; ++H) {
        var z = G[H];
        (Ia(z.values.alpha.ref.value * z.state.alphaFactor, 0, 1) < 1 || z.values.transparencyAverage.ref.value > 0 || z.values.dGeometryType.ref.value === "directVolume" || ((F = z.values.dPointStyle) === null || F === void 0 ? void 0 : F.ref.value) === "fuzzy" || z.values.uBackgroundColor || !((V = z.values.dXrayShaded) === null || V === void 0) && V.ref.value) && E(z, "colorWboit");
      }
    }, setProps: function(D) {
      D.backgroundColor !== void 0 && D.backgroundColor !== o.backgroundColor && (o.backgroundColor = D.backgroundColor, Ae.toVec3Normalized(c, o.backgroundColor), R.update(w.uFogColor, A.copy(w.uFogColor.ref.value, c))), D.pickingAlphaThreshold !== void 0 && D.pickingAlphaThreshold !== o.pickingAlphaThreshold && (o.pickingAlphaThreshold = D.pickingAlphaThreshold, R.update(w.uPickingAlphaThreshold, o.pickingAlphaThreshold)), D.interiorDarkening !== void 0 && D.interiorDarkening !== o.interiorDarkening && (o.interiorDarkening = D.interiorDarkening, R.update(w.uInteriorDarkening, o.interiorDarkening)), D.interiorColorFlag !== void 0 && D.interiorColorFlag !== o.interiorColorFlag && (o.interiorColorFlag = D.interiorColorFlag, R.update(w.uInteriorColorFlag, o.interiorColorFlag)), D.interiorColor !== void 0 && D.interiorColor !== o.interiorColor && (o.interiorColor = D.interiorColor, R.update(w.uInteriorColor, Ae.toVec3Normalized(w.uInteriorColor.ref.value, o.interiorColor))), D.highlightColor !== void 0 && D.highlightColor !== o.highlightColor && (o.highlightColor = D.highlightColor, R.update(w.uHighlightColor, Ae.toVec3Normalized(w.uHighlightColor.ref.value, o.highlightColor))), D.selectColor !== void 0 && D.selectColor !== o.selectColor && (o.selectColor = D.selectColor, R.update(w.uSelectColor, Ae.toVec3Normalized(w.uSelectColor.ref.value, o.selectColor))), D.highlightStrength !== void 0 && D.highlightStrength !== o.highlightStrength && (o.highlightStrength = D.highlightStrength, R.update(w.uHighlightStrength, o.highlightStrength)), D.selectStrength !== void 0 && D.selectStrength !== o.selectStrength && (o.selectStrength = D.selectStrength, R.update(w.uSelectStrength, o.selectStrength)), D.markerPriority !== void 0 && D.markerPriority !== o.markerPriority && (o.markerPriority = D.markerPriority, R.update(w.uMarkerPriority, o.markerPriority)), D.xrayEdgeFalloff !== void 0 && D.xrayEdgeFalloff !== o.xrayEdgeFalloff && (o.xrayEdgeFalloff = D.xrayEdgeFalloff, R.update(w.uXrayEdgeFalloff, o.xrayEdgeFalloff)), D.light === void 0 || id(D.light, o.light) || (o.light = D.light, Object.assign(s, ix(D.light, s)), R.update(w.uLightDirection, s.direction), R.update(w.uLightColor, s.color)), D.ambientColor !== void 0 && D.ambientColor !== o.ambientColor && (o.ambientColor = D.ambientColor, A.scale(C, Ae.toArrayNormalized(o.ambientColor, C, 0), o.ambientIntensity), R.update(w.uAmbientColor, C)), D.ambientIntensity !== void 0 && D.ambientIntensity !== o.ambientIntensity && (o.ambientIntensity = D.ambientIntensity, A.scale(C, Ae.toArrayNormalized(o.ambientColor, C, 0), o.ambientIntensity), R.update(w.uAmbientColor, C)), D.invalidColor !== void 0 && D.invalidColor !== o.invalidColor && (o.invalidColor = D.invalidColor, R.update(w.uInvalidColor, Ae.toVec3Normalized(w.uInvalidColor.ref.value, o.invalidColor))), D.invalidStrength !== void 0 && D.invalidStrength !== o.invalidStrength && (o.invalidStrength = D.invalidStrength, R.update(w.uInvalidStrength, o.invalidStrength));
    }, setViewport: function(D, B, L, F) {
      r.viewport(D, B, L, F), r.scissor(D, B, L, F), D === u.x && B === u.y && L === u.width && F === u.height || (Ii.set(u, D, B, L, F), R.update(w.uViewport, Nt.set(w.uViewport.ref.value, D, B, L, F)));
    }, setTransparentBackground: function(D) {
      d = D;
    }, setDrawingBufferSize: function(D, B) {
      D === l[0] && B === l[1] || R.update(w.uDrawingBufferSize, xe.set(l, D, B));
    }, setPixelRatio: function(D) {
      R.update(w.uPixelRatio, D);
    }, props: o, get stats() {
      return { programCount: t.stats.resourceCounts.program, shaderCount: t.stats.resourceCounts.shader, attributeCount: t.stats.resourceCounts.attribute, elementsCount: t.stats.resourceCounts.elements, framebufferCount: t.stats.resourceCounts.framebuffer, renderbufferCount: t.stats.resourceCounts.renderbuffer, textureCount: t.stats.resourceCounts.texture, vertexArrayCount: t.stats.resourceCounts.vertexArray, drawCount: a.drawCount, instanceCount: a.instanceCount, instancedDrawCount: a.instancedDrawCount };
    }, dispose: function() {
    } };
  };
})(d5 || (d5 = {})), function(e) {
  function t(r) {
    return r.triggers.map(n.format).join(" or ");
  }
  function n(r, i) {
    return n.create(r, i);
  }
  e.create = function(r, i, a) {
    return i === void 0 && (i = ""), a === void 0 && (a = ""), { triggers: r, action: i, description: a };
  }, e.Empty = { triggers: [], action: "", description: "" }, e.isEmpty = function(r) {
    return r.triggers.length === 0 || r.triggers.every(function(i) {
      return i.buttons === void 0 && i.modifiers === void 0;
    });
  }, e.match = function(r, i, a) {
    return r.triggers.some(function(o) {
      return n.match(o, i, a);
    });
  }, e.formatTriggers = t, e.format = function(r, i) {
    return i === void 0 && (i = ""), function(a, o) {
      var s = Object.keys(o), u = Object.values(o);
      return new (Function.bind.apply(Function, Re(Re([void 0], s, !1), ["return `".concat(a, "`;")], !1)))().apply(void 0, u);
    }(r.description || Su(i), { triggers: "<i>" + t(r) + "</i>" });
  }, e.Trigger = n, function(r) {
    r.create = function(i, a) {
      return { buttons: i, modifiers: a };
    }, r.Empty = {}, r.match = function(i, a, o) {
      var s = i.buttons, u = i.modifiers;
      return s !== void 0 && (s === a || yf.has(s, a)) && (!u || Z1.areEqual(u, o));
    }, r.format = function(i) {
      var a = [], o = function(u) {
        var l = [];
        return u === void 0 ? l.push("any mouse button") : u === 0 ? l.push("mouse hover") : (jh.has(u, 1) && l.push("left mouse button"), jh.has(u, 2) && l.push("right mouse button"), jh.has(u, 4) && l.push("wheel/middle mouse button"), jh.has(u, 8) && l.push("three fingers")), l.join(" + ");
      }(i.buttons);
      o && a.push(o);
      var s = function(u, l) {
        var c = [];
        return u && (u.alt && c.push("alt key"), u.control && c.push("control key"), u.meta && c.push("meta/command key"), u.shift && c.push("shift key")), c.join(" + ");
      }(i.modifiers);
      return s && a.push(s), a.join(" + ");
    };
  }(n = e.Trigger || (e.Trigger = {}));
}(jr || (jr = {}));
var Da, jh = yf;
(function(e) {
  e.create = function() {
    var t = new jz(), n = function() {
      return t.create();
    };
    return n.dispose = function() {
      return t.dispose();
    }, n.behavior = function(r) {
      return t.behavior(r);
    }, n;
  };
})(Da || (Da = {}));
var m5, jz = function() {
  function e() {
    this._eventList = [], this._disposed = !1;
  }
  return e.prototype.create = function() {
    var t = new qr();
    return this._eventList.push(t), t;
  }, e.prototype.behavior = function(t) {
    var n = new Fc(t);
    return this._eventList.push(n), n;
  }, e.prototype.dispose = function() {
    if (!this._disposed) {
      for (var t = 0, n = this._eventList; t < n.length; t++)
        n[t].complete();
      this._disposed = !0;
    }
  }, e;
}(), ic = Z1, ac = jr.Trigger, Kz = { dragRotate: jr([ac(1, ic.create())], "Rotate", "Drag using ${triggers}"), dragRotateZ: jr([ac(1, ic.create({ shift: !0 }))], "Rotate around z-axis", "Drag using ${triggers}"), dragPan: jr([ac(2, ic.create()), ac(1, ic.create({ control: !0 }))], "Pan", "Drag using ${triggers}"), dragZoom: jr.Empty, dragFocus: jr([ac(8, ic.create())], "Focus", "Drag using ${triggers}"), dragFocusZoom: jr([ac(4, ic.create())], "Focus and zoom", "Drag using ${triggers}"), scrollZoom: jr([ac(4, ic.create())], "Zoom", "Scroll using ${triggers}"), scrollFocus: jr([ac(4, ic.create({ shift: !0 }))], "Clip", "Scroll using ${triggers}"), scrollFocusZoom: jr.Empty }, JT = { noScroll: N.Boolean(!0, { isHidden: !0 }), rotateSpeed: N.Numeric(5, { min: 1, max: 10, step: 1 }), zoomSpeed: N.Numeric(7, { min: 1, max: 15, step: 1 }), panSpeed: N.Numeric(1, { min: 0.1, max: 5, step: 0.1 }), animate: N.MappedStatic("off", { off: N.EmptyGroup(), spin: N.Group({ speed: N.Numeric(1, { min: -20, max: 20, step: 1 }) }, { description: "Spin the 3D scene around the x-axis in view space" }), rock: N.Group({ speed: N.Numeric(0.3, { min: -5, max: 5, step: 0.1 }), angle: N.Numeric(10, { min: 0, max: 90, step: 1 }, { description: "How many degrees to rotate in each direction." }) }, { description: "Rock the 3D scene around the x-axis in view space" }) }), staticMoving: N.Boolean(!0, { isHidden: !0 }), dynamicDampingFactor: N.Numeric(0.2, {}, { isHidden: !0 }), minDistance: N.Numeric(0.01, {}, { isHidden: !0 }), maxDistance: N.Numeric(1e150, {}, { isHidden: !0 }), gestureScaleFactor: N.Numeric(1, {}, { isHidden: !0 }), maxWheelDelta: N.Numeric(0.02, {}, { isHidden: !0 }), bindings: N.Value(Kz, { isHidden: !0 }), autoAdjustMinMaxDistance: N.MappedStatic("on", { off: N.EmptyGroup(), on: N.Group({ minDistanceFactor: N.Numeric(0), minDistancePadding: N.Numeric(5), maxDistanceFactor: N.Numeric(10), maxDistanceMin: N.Numeric(20) }) }, { isHidden: !0 }) };
(function(e) {
  e.create = function(t, n, r) {
    r === void 0 && (r = {});
    var i = Da.create(), a = O(O({}, N.getDefaultValues(JT)), r), o = Ii.clone(n.viewport), s = !1, u = i.behavior(!1), l = i.behavior([]), c = i.behavior(!1), d = t.drag.subscribe(function(Se) {
      var qe = Se.x, Pe = Se.y, Xe = Se.pageX, Ke = Se.pageY, de = Se.buttons, we = Se.modifiers, Ie = Se.isStart, Ee = ce(qe, Pe);
      if (!(u.value && l.value.includes("drag") && (c.value || de !== 1)) && !(Ie && Ee) && !(!Ie && !v)) {
        v = !0, Ze();
        var Le = jr.match(a.bindings.dragRotate, de, we), De = jr.match(a.bindings.dragRotateZ, de, we), rt = jr.match(a.bindings.dragPan, de, we), st = jr.match(a.bindings.dragZoom, de, we), gt = jr.match(a.bindings.dragFocus, de, we), ft = jr.match(a.bindings.dragFocusZoom, de, we);
        if (function(It, ge) {
          xe.set(G, (It - 0.5 * o.width - o.x) / (0.5 * o.width), (o.height + 2 * (o.y - ge)) / o.width);
        }(Xe, Ke), function(It, ge) {
          xe.set(V, (It - o.x) / o.width, (ge - o.y) / o.height);
        }(Xe, Ke), Ie && (Le && (xe.copy(S, G), xe.copy(x, S)), De && (xe.copy(w, G), xe.copy(C, w)), (st || ft) && (xe.copy(M, V), xe.copy(E, M)), gt && (xe.copy(T, V), xe.copy(P, T)), rt && (xe.copy(k, V), xe.copy(D, k))), Le && xe.copy(S, G), De && xe.copy(w, G), (st || ft) && xe.copy(E, V), gt && xe.copy(P, V), ft) {
          var yt = A.distance(n.state.position, n.state.target);
          n.setState({ radius: yt / 5 });
        }
        rt && xe.copy(D, V);
      }
    }), f = t.interactionEnd.subscribe(function() {
      v = !1;
    }), p = t.wheel.subscribe(function(Se) {
      var qe = Se.x, Pe = Se.y, Xe = Se.spinX, Ke = Se.spinY, de = Se.dz, we = Se.buttons, Ie = Se.modifiers;
      if (!ce(qe, Pe)) {
        var Ee = function() {
          for (var Le = [], De = 0; De < arguments.length; De++) Le[De] = arguments[De];
          for (var rt = 0, st = 0, gt = 0, ft = Le.length; gt < ft; ++gt) {
            var yt = Le[gt], It = Math.abs(yt);
            It > st && (rt = yt, st = It);
          }
          return rt;
        }(0.075 * Xe, 0.075 * Ke, 1e-4 * de);
        Ee < -a.maxWheelDelta ? Ee = -a.maxWheelDelta : Ee > a.maxWheelDelta && (Ee = a.maxWheelDelta), jr.match(a.bindings.scrollZoom, we, Ie) && (E[1] += Ee), jr.match(a.bindings.scrollFocus, we, Ie) && (P[1] += Ee);
      }
    }), g = t.pinch.subscribe(function(Se) {
      var qe = Se.fractionDelta, Pe = Se.buttons, Xe = Se.modifiers;
      jr.match(a.bindings.scrollZoom, Pe, Xe) && (v = !0, E[1] += a.gestureScaleFactor * qe);
    }), m = t.gesture.subscribe(function(Se) {
      var qe = Se.deltaScale;
      v = !0, E[1] += a.gestureScaleFactor * qe;
    }), v = !1, h = A(), y = A(), x = xe(), S = xe(), b = A(), _ = 0, C = xe(), w = xe(), I = 0, M = xe(), E = xe(), T = xe(), P = xe(), k = xe(), D = xe(), B = A.clone(n.target), L = A.clone(n.position), F = A.clone(n.up), V = xe(), G = xe();
    function H() {
      var Se = t.width / t.height;
      return a.rotateSpeed * t.pixelRatio * Se;
    }
    var q = A(), z = yr(), K = A(), Y = A(), Z = A(), X = A(), W = yr(), J = xe(), $ = A(), ee = A();
    function ce(Se, qe) {
      return Se *= t.pixelRatio, qe *= t.pixelRatio, Se > o.x + o.width || t.height - qe > o.y + o.height || Se < o.x || t.height - qe < o.y;
    }
    var ae = -1;
    function he(Se) {
      var qe, Pe, Xe, Ke, de;
      ae !== Se && (ae > 0 && (a.animate.name === "spin" ? function(we) {
        if (!(a.animate.name !== "spin" || a.animate.params.speed === 0 || v)) {
          var Ie = a.animate.params.speed / 1e3;
          Oe[0] = 60 * Math.min(Math.abs(we), 125) / 1e3 * Ie, xe.add(S, x, Oe);
        }
      }(Se - ae) : a.animate.name === "rock" && function(we) {
        if (!(a.animate.name !== "rock" || a.animate.params.speed === 0 || v)) {
          var Ie = we / 1e3 * a.animate.params.speed, Ee = xr(a.animate.params.angle) / H(), Le = Math.sin(Ne * Math.PI * 2) * Ee, De = Math.sin((Ne + Ie) * Math.PI * 2) * Ee;
          Ue[0] = De - Le, xe.add(S, x, Ue), (Ne += Ie) >= 1 && (Ne = 0);
        }
      }(Se - ae)), A.sub(y, n.position, n.target), function() {
        var we = S[0] - x[0], Ie = S[1] - x[1];
        A.set(X, we, Ie, 0);
        var Ee = A.magnitude(X) * H();
        Ee ? (A.sub(y, n.position, n.target), A.normalize(K, y), A.normalize(Y, n.up), A.normalize(Z, A.cross(Z, Y, K)), A.setMagnitude(Y, Y, Ie), A.setMagnitude(Z, Z, we), A.add(X, Y, Z), A.normalize(q, A.cross(q, X, y)), yr.setAxisAngle(z, q, Ee), A.transformQuat(y, y, z), A.transformQuat(n.up, n.up, z), A.copy(b, q), _ = Ee) : !a.staticMoving && _ && (_ *= Math.sqrt(1 - a.dynamicDampingFactor), A.sub(y, n.position, n.target), yr.setAxisAngle(z, b, _), A.transformQuat(y, y, z), A.transformQuat(n.up, n.up, z)), xe.copy(x, S);
      }(), qe = w[0] - C[0], Pe = w[1] - C[1], (Xe = a.rotateSpeed * (-qe + Pe) * -0.05) ? (A.sub(y, n.position, n.target), yr.setAxisAngle(W, y, Xe), A.transformQuat(n.up, n.up, W), I = Xe) : !a.staticMoving && I && (I *= Math.sqrt(1 - a.dynamicDampingFactor), A.sub(y, n.position, n.target), yr.setAxisAngle(W, y, I), A.transformQuat(n.up, n.up, W)), xe.copy(C, w), (Ke = 1 + (E[1] - M[1]) * a.zoomSpeed) !== 1 && Ke > 0 && A.scale(y, y, Ke), a.staticMoving ? xe.copy(M, E) : M[1] += (E[1] - M[1]) * a.dynamicDampingFactor, function() {
        var we = (P[1] - T[1]) * a.zoomSpeed;
        if (we !== 0) {
          var Ie = Math.max(1, n.state.radius + n.state.radius * we);
          n.setState({ radius: Ie });
        }
        a.staticMoving ? xe.copy(T, P) : T[1] += (P[1] - T[1]) * a.dynamicDampingFactor;
      }(), function() {
        if (xe.sub(J, xe.copy(J, D), k), xe.squaredMagnitude(J)) {
          var we = t.pixelRatio * a.panSpeed;
          J[0] *= 1 / n.zoom * n.viewport.width * we, J[1] *= 1 / n.zoom * n.viewport.height * we, A.cross(ee, A.copy(ee, y), n.up), A.setMagnitude(ee, ee, J[0]), A.setMagnitude($, n.up, J[1]), A.add(ee, ee, $), A.add(n.position, n.position, ee), A.add(n.target, n.target, ee), a.staticMoving ? xe.copy(k, D) : (xe.sub(J, D, k), xe.scale(J, J, a.dynamicDampingFactor), xe.add(k, k, J));
        }
      }(), A.add(n.position, n.target, y), de = Math.min(Math.max(1e3 * n.state.radiusMax, 0.01), a.maxDistance), A.squaredMagnitude(y) > de * de && (A.setMagnitude(y, y, de), A.add(n.position, n.target, y), xe.copy(M, E), xe.copy(T, P)), A.squaredMagnitude(y) < a.minDistance * a.minDistance && (A.setMagnitude(y, y, a.minDistance), A.add(n.position, n.target, y), xe.copy(M, E), xe.copy(T, P)), A.squaredDistance(h, n.position) > sr && A.copy(h, n.position), ae = Se);
    }
    var Oe = xe.create(5e-3, 0), Ne = 0, Ue = xe.create(5e-3, 0);
    function Ze() {
      Ne = 0;
    }
    return { viewport: o, get isAnimating() {
      return a.animate.name !== "off";
    }, get props() {
      return a;
    }, setProps: function(Se) {
      var qe;
      ((qe = Se.animate) === null || qe === void 0 ? void 0 : qe.name) === "rock" && a.animate.name !== "rock" && Ze(), Object.assign(a, Se);
    }, get isEditing() {
      return u.value;
    }, get disabledInteraction() {
      return l.value;
    }, get isLockCamera() {
      return c.value;
    }, start: function(Se) {
      ae = -1, he(Se);
    }, update: he, reset: function() {
      A.copy(n.target, B), A.copy(n.position, L), A.copy(n.up, F), A.sub(y, n.position, n.target), A.copy(h, n.position);
    }, dispose: function() {
      s || (s = !0, d.unsubscribe(), p.unsubscribe(), g.unsubscribe(), m.unsubscribe(), f.unsubscribe());
    }, setEditState: function(Se) {
      u.next(Se);
    }, setLockCameraState: function(Se) {
      c.next(Se);
    }, setDisabledInteractionState: function(Se) {
      l.next(Se);
    } };
  };
})(m5 || (m5 = {}));
var $T = ha(), Yz = { apply_fog: `
float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));
float fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;
float preFogAlpha = gl_FragColor.a;
if (!uTransparentBackground) {
    if (gl_FragColor.a < 1.0) {
        // transparent objects are blended with background color
        gl_FragColor.a = fogAlpha;
    } else {
        // mix opaque objects with background color
        gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);
    }
} else {
    // pre-multiplied alpha expected for transparent background
    gl_FragColor.rgb *= fogAlpha;
    gl_FragColor.a = fogAlpha;
}
`, apply_interior_color: `
if (interior) {
    if (uInteriorColorFlag) {
        gl_FragColor.rgb = uInteriorColor;
    } else {
        gl_FragColor.rgb *= 1.0 - uInteriorDarkening;
    }
}
`, apply_light_color: `
#ifdef dIgnoreLight
    gl_FragColor = material;
#else
    #ifdef bumpEnabled
        if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0) {
            vec3 bumpNormal = perturbNormal(-vViewPosition, normal, fbm(vModelPosition * uBumpFrequency), (uBumpAmplitude * bumpiness) / uBumpFrequency);
            #ifdef enabledFragDepth
                if (!isNaN(bumpNormal.x) && !isNaN(bumpNormal.y) && !isNaN(bumpNormal.z)) {
                    normal = bumpNormal;
                }
            #else
                normal = bumpNormal;
            #endif
        }
    #endif

    vec4 color = material;

    ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));

    PhysicalMaterial physicalMaterial;
    physicalMaterial.diffuseColor = color.rgb * (1.0 - metalness);
    #ifdef enabledFragDepth
        physicalMaterial.roughness = min(max(roughness, 0.0525), 1.0);
    #else
        vec3 dxy = max(abs(dFdx(normal)), abs(dFdy(normal)));
        float geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);
        physicalMaterial.roughness = min(max(roughness, 0.0525) + geometryRoughness, 1.0);
    #endif
    physicalMaterial.specularColor = mix(vec3(0.04), color.rgb, metalness);
    physicalMaterial.specularF90 = 1.0;

    GeometricContext geometry;
    geometry.position = -vViewPosition;
    geometry.normal = normal;
    geometry.viewDir = normalize(vViewPosition);

    IncidentLight directLight;
    #pragma unroll_loop_start
    for (int i = 0; i < dLightCount; ++i) {
        directLight.direction = uLightDirection[i];
        directLight.color = uLightColor[i] * PI; // * PI for punctual light
        RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);
    }
    #pragma unroll_loop_end

    vec3 irradiance = uAmbientColor * PI; // * PI for punctual light
    RE_IndirectDiffuse_Physical(irradiance, geometry, physicalMaterial, reflectedLight);

    // indirect specular only metals
    vec3 radiance = uAmbientColor * metalness;
    vec3 iblIrradiance = uAmbientColor * metalness;
    vec3 clearcoatRadiance = vec3(0.0);
    RE_IndirectSpecular_Physical(radiance, iblIrradiance, clearcoatRadiance, geometry, physicalMaterial, reflectedLight);

    vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;

    gl_FragColor = vec4(outgoingLight, color.a);
#endif

#ifdef dXrayShaded
    gl_FragColor.a *= 1.0 - pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);
#endif
`, apply_marker_color: `
if (marker > 0.0) {
    if (marker == 4.0) {
        gl_FragColor.rgb = mix(gl_FragColor.rgb, uInvalidColor, uInvalidStrength);
        gl_FragColor.a = max(gl_FragColor.a, uInvalidStrength * 0.002); // for direct-volume rendering
    } else if ((uMarkerPriority == 1 && marker != 2.0 && marker != 6.0) || (uMarkerPriority != 1 && (marker == 1.0 || marker == 5.0 || marker == 8.0))) {
        gl_FragColor.rgb = mix(gl_FragColor.rgb, uHighlightColor, uHighlightStrength);
        gl_FragColor.a = max(gl_FragColor.a, uHighlightStrength * 0.002); // for direct-volume rendering
    } else {
        gl_FragColor.rgb = mix(gl_FragColor.rgb, uSelectColor, uSelectStrength);
        gl_FragColor.a = max(gl_FragColor.a, uSelectStrength * 0.002); // for direct-volume rendering
    }
}
`, assign_clipping_varying: `
#if dClipObjectCount != 0 && defined(dClipping)
    vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;
#endif
`, assign_color_varying: `
#if defined(dRenderVariant_color)
    #if defined(dColorType_attribute)
        vColor.rgb = aColor;
    #elif defined(dColorType_instance)
        vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;
    #elif defined(dColorType_group)
        vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;
    #elif defined(dColorType_groupInstance)
        vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;
    #elif defined(dColorType_vertex)
        vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;
    #elif defined(dColorType_vertexInstance)
        vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;
    #elif defined(dColorType_volume)
        vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;
        vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;
    #elif defined(dColorType_volumeInstance)
        vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;
        vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;
    #endif

    #ifdef dUsePalette
        vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;
    #endif

    #ifdef dOverpaint
        #if defined(dOverpaintType_groupInstance)
            vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);
        #elif defined(dOverpaintType_vertexInstance)
            vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);
        #elif defined(dOverpaintType_volumeInstance)
            vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;
            vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);
        #endif

        // pre-mix to avoid darkening due to empty overpaint
        #ifdef dColorType_uniform
            vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);
        #else
            vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);
        #endif
    #endif

    #ifdef dSubstance
        #if defined(dSubstanceType_groupInstance)
            vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);
        #elif defined(dSubstanceType_vertexInstance)
            vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);
        #elif defined(dSubstanceType_volumeInstance)
            vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;
            vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);
        #endif

        // pre-mix to avoid artifacts due to empty substance
        vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);
    #endif
#elif defined(dRenderVariant_pick)
    if (uPickType == 1) {
        vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);
    } else if (uPickType == 2) {
        vColor = vec4(packIntToRGB(aInstance), 1.0);
    } else {
        vColor = vec4(packIntToRGB(group), 1.0);
    }
#endif

#ifdef dTransparency
    vGroup = group;

    #if defined(dTransparencyType_groupInstance)
        vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;
    #elif defined(dTransparencyType_vertexInstance)
        vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;
    #elif defined(dTransparencyType_volumeInstance)
        vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;
        vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;
    #endif
#endif
`, assign_group: `
#ifdef dGeometryType_textureMesh
    float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);
#else
    float group = aGroup;
#endif
`, assign_marker_varying: `
#if defined(dRenderVariant_color) || defined(dRenderVariant_marking)
    vMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;
#endif
`, assign_material_color: `
#if defined(dRenderVariant_color) || defined(dRenderVariant_marking)
    float marker = uMarker;
    if (uMarker == -1.0) {
        marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win
    }
#endif

#if defined(dRenderVariant_color)
    #if defined(dUsePalette)
        vec4 material = vec4(texture2D(tPalette, vec2(vPaletteV, 0.5)).rgb, uAlpha);
    #elif defined(dColorType_uniform)
        vec4 material = vec4(uColor, uAlpha);
    #elif defined(dColorType_varying)
        vec4 material = vec4(vColor.rgb, uAlpha);
    #endif

    // mix material with overpaint
    #if defined(dOverpaint)
        material.rgb = mix(material.rgb, vOverpaint.rgb, vOverpaint.a);
    #endif

    float metalness = uMetalness;
    float roughness = uRoughness;
    float bumpiness = uBumpiness;
    #ifdef dSubstance
        metalness = mix(metalness, vSubstance.r, vSubstance.a);
        roughness = mix(roughness, vSubstance.g, vSubstance.a);
        bumpiness = mix(bumpiness, vSubstance.b, vSubstance.a);
    #endif
#elif defined(dRenderVariant_pick)
    vec4 material = vColor;
#elif defined(dRenderVariant_depth)
    #ifdef enabledFragDepth
        vec4 material = packDepthToRGBA(gl_FragDepthEXT);
    #else
        vec4 material = packDepthToRGBA(gl_FragCoord.z);
    #endif
#elif defined(dRenderVariant_marking)
    vec4 material;
    if(uMarkingType == 1) {
        if (marker > 0.0)
            discard;
        #ifdef enabledFragDepth
            material = packDepthToRGBA(gl_FragDepthEXT);
        #else
            material = packDepthToRGBA(gl_FragCoord.z);
        #endif
    } else {
        if (marker == 0.0)
            discard;
        float depthTest = 1.0;
        if (uMarkingDepthTest) {
            depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
        }
        bool isHighlight = intMod(marker, 2.0) > 0.1;
        float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
        float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));
        if (fogFactor == 1.0)
            discard;
        material = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0 - fogFactor);
    }
#endif

// apply screendoor transparency
#if defined(dTransparency)
    float ta = 1.0 - vTransparency;
    #if defined(dRenderVariant_colorWboit)
        if (vTransparency < 0.2) ta = 1.0; // hard cutoff looks better with wboit
    #endif

    #if defined(dRenderVariant_pick)
        if (ta < uPickingAlphaThreshold)
            discard; // ignore so the element below can be picked
    #else
        #if defined(dRenderVariant_colorBlended)
            float at = 0.0;

            // shift by view-offset during multi-sample rendering to allow for blending
            vec2 coord = gl_FragCoord.xy + uViewOffset * 0.25;

            const mat4 thresholdMatrix = mat4(
                1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,
                13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,
                4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,
                16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0
            );
            int ci = int(intMod(coord.x, 4.0));
            int ri = int(intMod(coord.y, 4.0));
            #if __VERSION__ == 100
                vec4 i = vec4(float(ci * 4 + ri));
                vec4 v = thresholdMatrix[0] * vec4(equal(i, vec4(0.0, 1.0, 2.0, 3.0))) +
                    thresholdMatrix[1] * vec4(equal(i, vec4(4.0, 5.0, 6.0, 7.0))) +
                    thresholdMatrix[2] * vec4(equal(i, vec4(8.0, 9.0, 10.0, 11.0))) +
                    thresholdMatrix[3] * vec4(equal(i, vec4(12.0, 13.0, 14.0, 15.0)));
                at = v.x + v.y + v.z + v.w;
            #else
                at = thresholdMatrix[ci][ri];
            #endif

            if (ta < 0.99 && (ta < 0.01 || ta < at)) {
                discard;
            }
        #elif defined(dRenderVariant_colorWboit)
            material.a *= ta;
        #endif
    #endif
#endif
`, assign_position: `
mat4 model = uModel * aTransform;
mat4 modelView = uView * model;
#ifdef dGeometryType_textureMesh
    vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;
#else
    vec3 position = aPosition;
#endif
vec4 position4 = vec4(position, 1.0);
// for accessing tColorGrid in vert shader and for clipping in frag shader
vModelPosition = (model * position4).xyz;
vec4 mvPosition = modelView * position4;
vViewPosition = mvPosition.xyz;
gl_Position = uProjection * mvPosition;
`, assign_size: `
#if defined(dSizeType_uniform)
    float size = uSize;
#elif defined(dSizeType_attribute)
    float size = aSize;
#elif defined(dSizeType_instance)
    float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);
#elif defined(dSizeType_group)
    float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);
#elif defined(dSizeType_groupInstance)
    float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);
#endif

#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)
    size /= 100.0; // NOTE factor also set in TypeScript
#endif

size *= uSizeFactor;
`, check_picking_alpha: `
float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);
float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));
float alpha = (1.0 - fogFactor) * uAlpha;
if (uAlpha < uPickingAlphaThreshold || alpha < 0.1)
    discard; // ignore so the element below can be picked
`, clip_instance: `
#if defined(dClipVariant_instance) && dClipObjectCount != 0
    int flag = 0;
    #if defined(dClipping)
        flag = int(floor(vClipping * 255.0 + 0.5));
    #endif

    vec4 mCenter = uModel * aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0);
    if (clipTest(vec4(mCenter.xyz, uInvariantBoundingSphere.w), flag))
        // move out of [ -w, +w ] to 'discard' in vert shader
        gl_Position.z = 2.0 * gl_Position.w;
#endif
`, clip_pixel: `
#if defined(dClipVariant_pixel) && dClipObjectCount != 0
    #if defined(dClipping)
        int clippingFlag = int(floor(vClipping * 255.0 + 0.5));
    #else
        int clippingFlag = 0;
    #endif

    if (clipTest(vec4(vModelPosition, 0.0), clippingFlag))
        discard;
#endif
`, color_frag_params: `
uniform float uMetalness;
uniform float uRoughness;
uniform float uBumpiness;
#ifdef bumpEnabled
    uniform float uBumpFrequency;
    uniform float uBumpAmplitude;
#endif

#if defined(dRenderVariant_color)
    #if defined(dColorType_uniform)
        uniform vec3 uColor;
    #elif defined(dColorType_varying)
        varying vec4 vColor;
    #endif

    #ifdef dUsePalette
        uniform sampler2D tPalette;
        varying float vPaletteV;
    #endif

    #ifdef dOverpaint
        varying vec4 vOverpaint;
    #endif

    #ifdef dSubstance
        varying vec4 vSubstance;
    #endif
#elif defined(dRenderVariant_pick)
    #if __VERSION__ == 100
        varying vec4 vColor;
    #else
        flat in vec4 vColor;
    #endif
#endif

#ifdef dTransparency
    varying float vGroup;
    varying float vTransparency;
#endif
`, color_vert_params: `
uniform float uMetalness;
uniform float uRoughness;
uniform float uBumpiness;

#if defined(dRenderVariant_color)
    #if defined(dColorType_uniform)
        uniform vec3 uColor;
    #elif defined(dColorType_attribute)
        varying vec4 vColor;
        attribute vec3 aColor;
    #elif defined(dColorType_texture)
        varying vec4 vColor;
        uniform vec2 uColorTexDim;
        uniform sampler2D tColor;
    #elif defined(dColorType_grid)
        varying vec4 vColor;
        uniform vec2 uColorTexDim;
        uniform vec3 uColorGridDim;
        uniform vec4 uColorGridTransform;
        uniform sampler2D tColorGrid;
    #endif

    #ifdef dUsePalette
        varying float vPaletteV;
    #endif

    #ifdef dOverpaint
        #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)
            varying vec4 vOverpaint;
            uniform vec2 uOverpaintTexDim;
            uniform sampler2D tOverpaint;
        #elif defined(dOverpaintType_volumeInstance)
            varying vec4 vOverpaint;
            uniform vec2 uOverpaintTexDim;
            uniform vec3 uOverpaintGridDim;
            uniform vec4 uOverpaintGridTransform;
            uniform sampler2D tOverpaintGrid;
        #endif
    #endif

    #ifdef dSubstance
        #if defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)
            varying vec4 vSubstance;
            uniform vec2 uSubstanceTexDim;
            uniform sampler2D tSubstance;
        #elif defined(dSubstanceType_volumeInstance)
            varying vec4 vSubstance;
            uniform vec2 uSubstanceTexDim;
            uniform vec3 uSubstanceGridDim;
            uniform vec4 uSubstanceGridTransform;
            uniform sampler2D tSubstanceGrid;
        #endif
    #endif
#elif defined(dRenderVariant_pick)
    #if __VERSION__ == 100
        varying vec4 vColor;
    #else
        flat out vec4 vColor;
    #endif
#endif

#ifdef dTransparency
    varying float vGroup;
    #if defined(dTransparencyType_groupInstance) || defined(dTransparencyType_vertexInstance)
        varying float vTransparency;
        uniform vec2 uTransparencyTexDim;
        uniform sampler2D tTransparency;
    #elif defined(dTransparencyType_volumeInstance)
        varying float vTransparency;
        uniform vec2 uTransparencyTexDim;
        uniform vec3 uTransparencyGridDim;
        uniform vec4 uTransparencyGridTransform;
        uniform sampler2D tTransparencyGrid;
    #endif
#endif
`, common_clip: `
#if dClipObjectCount != 0
    vec3 quaternionTransform(vec4 q, vec3 v) {
        vec3 t = 2.0 * cross(q.xyz, v);
        return v + q.w * t + cross(q.xyz, t);
    }

    vec4 computePlane(vec3 normal, vec3 inPoint) {
        return vec4(normalize(normal), -dot(normal, inPoint));
    }

    float planeSD(vec4 plane, vec3 center) {
        return -dot(plane.xyz, center - plane.xyz * -plane.w);
    }

    float sphereSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {
        return (
            length(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position) / size) - 1.0
        ) * min(min(size.x, size.y), size.z);
    }

    float cubeSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {
        vec3 d = abs(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position)) - size;
        return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));
    }

    float cylinderSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {
        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);

        vec2 d = abs(vec2(length(t.xz), t.y)) - size.xy;
        return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
    }

    float infiniteConeSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {
        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);

        float q = length(t.xy);
        return dot(size.xy, vec2(q, t.z));
    }

    float getSignedDistance(vec3 center, int type, vec3 position, vec4 rotation, vec3 scale) {
        if (type == 1) {
            vec3 normal = quaternionTransform(rotation, vec3(0.0, 1.0, 0.0));
            vec4 plane = computePlane(normal, position);
            return planeSD(plane, center);
        } else if (type == 2) {
            return sphereSD(position, rotation, scale * 0.5, center);
        } else if (type == 3) {
            return cubeSD(position, rotation, scale * 0.5, center);
        } else if (type == 4) {
            return cylinderSD(position, rotation, scale * 0.5, center);
        } else if (type == 5) {
            return infiniteConeSD(position, rotation, scale * 0.5, center);
        } else {
            return 0.1;
        }
    }

    #if __VERSION__ == 100
        // 8-bit
        int bitwiseAnd(int a, int b) {
            int d = 128;
            int result = 0;
            for (int i = 0; i < 8; ++i) {
                if (d <= 0) break;
                if (a >= d && b >= d) result += d;
                if (a >= d) a -= d;
                if (b >= d) b -= d;
                d /= 2;
            }
            return result;
        }

        bool hasBit(int mask, int bit) {
            return bitwiseAnd(mask, bit) == 0;
        }
    #else
        bool hasBit(int mask, int bit) {
            return (mask & bit) == 0;
        }
    #endif

    // flag is a bit-flag for clip-objects to ignore (note, object ids start at 1 not 0)
    bool clipTest(vec4 sphere, int flag) {
        #pragma unroll_loop_start
        for (int i = 0; i < dClipObjectCount; ++i) {
            if (flag == 0 || hasBit(flag, UNROLLED_LOOP_INDEX + 1)) {
                // TODO take sphere radius into account?
                bool test = getSignedDistance(sphere.xyz, uClipObjectType[i], uClipObjectPosition[i], uClipObjectRotation[i], uClipObjectScale[i]) <= 0.0;
                if ((!uClipObjectInvert[i] && test) || (uClipObjectInvert[i] && !test)) {
                    return true;
                }
            }
        }
        #pragma unroll_loop_end
        return false;
    }
#endif
`, common_frag_params: `
uniform int uObjectId;
uniform int uInstanceCount;
uniform int uGroupCount;

uniform int uPickType;
uniform int uMarkingType;

#if dClipObjectCount != 0
    uniform int uClipObjectType[dClipObjectCount];
    uniform bool uClipObjectInvert[dClipObjectCount];
    uniform vec3 uClipObjectPosition[dClipObjectCount];
    uniform vec4 uClipObjectRotation[dClipObjectCount];
    uniform vec3 uClipObjectScale[dClipObjectCount];

    #if defined(dClipping)
        #if __VERSION__ == 100
            varying float vClipping;
        #else
            flat in float vClipping;
        #endif
    #endif
#endif

uniform vec3 uHighlightColor;
uniform vec3 uSelectColor;
uniform float uHighlightStrength;
uniform float uSelectStrength;
uniform int uMarkerPriority;
uniform vec3 uInvalidColor;
uniform float uInvalidStrength;

#if defined(dRenderVariant_color) || defined(dRenderVariant_marking)
    uniform float uMarker;
    #if __VERSION__ == 100
        varying float vMarker;
    #else
        flat in float vMarker;
    #endif
#endif

varying vec3 vModelPosition;
varying vec3 vViewPosition;

uniform vec2 uViewOffset;

uniform float uNear;
uniform float uFar;
uniform float uIsOrtho;

uniform float uFogNear;
uniform float uFogFar;
uniform vec3 uFogColor;

uniform float uAlpha;
uniform float uPickingAlphaThreshold;
uniform bool uTransparentBackground;

uniform bool uDoubleSided;
uniform float uInteriorDarkening;
uniform bool uInteriorColorFlag;
uniform vec3 uInteriorColor;
bool interior;

uniform float uXrayEdgeFalloff;

uniform mat4 uProjection;

uniform bool uRenderWboit;
uniform bool uMarkingDepthTest;

uniform sampler2D tDepth;
uniform vec2 uDrawingBufferSize;

float getDepth(const in vec2 coords) {
    // always packed due to merged depth from primitives and volumes
    return unpackRGBAToDepth(texture2D(tDepth, coords));
}

float calcDepth(const in vec3 pos) {
    vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;
    return 0.5 + 0.5 * clipZW.x / clipZW.y;
}

// "Bump Mapping Unparametrized Surfaces on the GPU" Morten S. Mikkelsen
// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
vec3 perturbNormal(in vec3 position, in vec3 normal, in float height, in float scale) {
    vec3 sigmaS = dFdx(position);
    vec3 sigmaT = dFdy(position);

    vec3 r1 = cross(sigmaT, normal);
    vec3 r2 = cross(normal, sigmaS);
    float det = dot(sigmaS, r1);

    float bs = dFdx(height);
    float bt = dFdy(height);

    vec3 surfGrad = sign(det) * (bs * r1 + bt * r2);
    return normalize(abs(det) * normal - scale * surfGrad);
}

float hash(in float h) {
    return fract(sin(h) * 43758.5453123);
}

float noise(in vec3 x) {
    vec3 p = floor(x);
    vec3 f = fract(x);
    f = f * f * (3.0 - 2.0 * f);

    float n = p.x + p.y * 157.0 + 113.0 * p.z;
    return mix(
        mix(mix(hash(n + 0.0), hash(n + 1.0), f.x),
            mix(hash(n + 157.0), hash(n + 158.0), f.x), f.y),
        mix(mix(hash(n + 113.0), hash(n + 114.0), f.x),
            mix(hash(n + 270.0), hash(n + 271.0), f.x), f.y), f.z);
}

float fbm(in vec3 p) {
    float f = 0.0;
    f += 0.5 * noise(p);
    p *= 2.01;
    f += 0.25 * noise(p);
    p *= 2.02;
    f += 0.125 * noise(p);

    return f;
}
`, common_vert_params: `
uniform mat4 uProjection, uModel, uView;
uniform vec3 uCameraPosition;

uniform int uObjectId;
uniform int uVertexCount;
uniform int uInstanceCount;
uniform int uGroupCount;
uniform vec4 uInvariantBoundingSphere;

uniform bool uDoubleSided;
uniform int uPickType;

#if dClipObjectCount != 0
    uniform int uClipObjectType[dClipObjectCount];
    uniform bool uClipObjectInvert[dClipObjectCount];
    uniform vec3 uClipObjectPosition[dClipObjectCount];
    uniform vec4 uClipObjectRotation[dClipObjectCount];
    uniform vec3 uClipObjectScale[dClipObjectCount];

    #if defined(dClipping)
        uniform vec2 uClippingTexDim;
        uniform sampler2D tClipping;
        #if __VERSION__ == 100
            varying float vClipping;
        #else
            flat out float vClipping;
        #endif
    #endif
#endif

#if defined(dRenderVariant_color) || defined(dRenderVariant_marking)
    uniform float uMarker;
    uniform vec2 uMarkerTexDim;
    uniform sampler2D tMarker;
    #if __VERSION__ == 100
        varying float vMarker;
    #else
        flat out float vMarker;
    #endif
#endif

varying vec3 vModelPosition;
varying vec3 vViewPosition;

#if __VERSION__ == 100
    attribute float aVertex;
    #define VertexID int(aVertex)
#else
    // not using gl_VertexID but aVertex to ensure there is an active attribute with divisor 0
    // since FF 85 this is not needed anymore but lets keep it for backwards compatibility
    // https://bugzilla.mozilla.org/show_bug.cgi?id=1679693
    // see also note in src/mol-gl/webgl/render-item.ts
    attribute float aVertex;
    #define VertexID int(aVertex)
    // #define VertexID gl_VertexID
#endif
`, common: `
// TODO find a better place for these convenience defines

#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)
    #define dRenderVariant_color
#endif

#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)
    #define dColorType_texture
#endif

#if defined(dColorType_volume) || defined(dColorType_volumeInstance)
    #define dColorType_grid
#endif

#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)
    #define dColorType_varying
#endif

//

#define PI 3.14159265
#define RECIPROCAL_PI 0.31830988618
#define EPSILON 1e-6

#define saturate(a) clamp(a, 0.0, 1.0)

#if __VERSION__ == 100
    #define round(x) floor((x) + 0.5)
#endif

float intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }
vec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }
float intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }
int imod(const in int a, const in int b) { return a - b * (a / b); }

float pow2(const in float x) { return x * x; }

vec3 packIntToRGB(in float value) {
    value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;
    vec3 c = vec3(0.0);
    c.b = mod(value, 256.0);
    value = floor(value / 256.0);
    c.g = mod(value, 256.0);
    value = floor(value / 256.0);
    c.r = mod(value, 256.0);
    return c / 255.0;
}
float unpackRGBToInt(const in vec3 rgb) {
    return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;
}

vec2 packUnitIntervalToRG(const in float v) {
    vec2 enc;
    enc.xy = vec2(fract(v * 256.0), v);
    enc.y -= enc.x * (1.0 / 256.0);
    enc.xy *=  256.0 / 255.0;

    return enc;
}

float unpackRGToUnitInterval(const in vec2 enc) {
    return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));
}

vec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {
    vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);
    p = invProjection * p;
    return p.xyz / p.w;
}

const float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)
const float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)
const vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0,  256.0);
const vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);
const float ShiftRight8 = 1.0 / 256.0;

vec4 packDepthToRGBA(const in float v) {
    vec4 r = vec4(fract(v * PackFactors), v);
    r.yzw -= r.xyz * ShiftRight8; // tidy overflow
    return r * PackUpscale;
}
float unpackRGBAToDepth(const in vec4 v) {
    return dot(v, UnpackFactors);
}

vec4 sRGBToLinear(const in vec4 c) {
    return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);
}
vec4 linearTosRGB(const in vec4 c) {
    return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);
}

float linearizeDepth(const in float depth, const in float near, const in float far) {
    return (2.0 * near) / (far + near - depth * (far - near));
}

float perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {
    return (near * far) / ((far - near) * invClipZ - far);
}

float orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {
    return linearClipZ * (near - far) - near;
}

float depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {
    return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);
}

#if __VERSION__ == 100
    // transpose

    float transpose(const in float m) {
        return m;
    }

    mat2 transpose2(const in mat2 m) {
        return mat2(
            m[0][0], m[1][0],
            m[0][1], m[1][1]
        );
    }

    mat3 transpose3(const in mat3 m) {
        return mat3(
            m[0][0], m[1][0], m[2][0],
            m[0][1], m[1][1], m[2][1],
            m[0][2], m[1][2], m[2][2]
        );
    }

    mat4 transpose4(const in mat4 m) {
        return mat4(
            m[0][0], m[1][0], m[2][0], m[3][0],
            m[0][1], m[1][1], m[2][1], m[3][1],
            m[0][2], m[1][2], m[2][2], m[3][2],
            m[0][3], m[1][3], m[2][3], m[3][3]
        );
    }

    // inverse

    float inverse(const in float m) {
        return 1.0 / m;
    }

    mat2 inverse2(const in mat2 m) {
        return mat2(m[1][1],-m[0][1],
                -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);
    }

    mat3 inverse3(const in mat3 m) {
        float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
        float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
        float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];

        float b01 = a22 * a11 - a12 * a21;
        float b11 = -a22 * a10 + a12 * a20;
        float b21 = a21 * a10 - a11 * a20;

        float det = a00 * b01 + a01 * b11 + a02 * b21;

        return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),
                    b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),
                    b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;
    }

    mat4 inverse4(const in mat4 m) {
        float
            a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],
            a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],
            a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],
            a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],

            b00 = a00 * a11 - a01 * a10,
            b01 = a00 * a12 - a02 * a10,
            b02 = a00 * a13 - a03 * a10,
            b03 = a01 * a12 - a02 * a11,
            b04 = a01 * a13 - a03 * a11,
            b05 = a02 * a13 - a03 * a12,
            b06 = a20 * a31 - a21 * a30,
            b07 = a20 * a32 - a22 * a30,
            b08 = a20 * a33 - a23 * a30,
            b09 = a21 * a32 - a22 * a31,
            b10 = a21 * a33 - a23 * a31,
            b11 = a22 * a33 - a23 * a32,

            det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;

        return mat4(
            a11 * b11 - a12 * b10 + a13 * b09,
            a02 * b10 - a01 * b11 - a03 * b09,
            a31 * b05 - a32 * b04 + a33 * b03,
            a22 * b04 - a21 * b05 - a23 * b03,
            a12 * b08 - a10 * b11 - a13 * b07,
            a00 * b11 - a02 * b08 + a03 * b07,
            a32 * b02 - a30 * b05 - a33 * b01,
            a20 * b05 - a22 * b02 + a23 * b01,
            a10 * b10 - a11 * b08 + a13 * b06,
            a01 * b08 - a00 * b10 - a03 * b06,
            a30 * b04 - a31 * b02 + a33 * b00,
            a21 * b02 - a20 * b04 - a23 * b00,
            a11 * b07 - a10 * b09 - a12 * b06,
            a00 * b09 - a01 * b07 + a02 * b06,
            a31 * b01 - a30 * b03 - a32 * b00,
            a20 * b03 - a21 * b01 + a22 * b00) / det;
    }

    #define isNaN(x) ((x) != (x))
    #define isInf(x) ((x) == (x) + 1.0)
#else
    #define transpose2(m) transpose(m)
    #define transpose3(m) transpose(m)
    #define transpose4(m) transpose(m)

    #define inverse2(m) inverse(m)
    #define inverse3(m) inverse(m)
    #define inverse4(m) inverse(m)

    #define isNaN isnan
    #define isInf isinf
#endif
`, float_to_rgba: `
    // floatToRgba adapted from https://github.com/equinor/glsl-float-to-rgba
    // MIT License, Copyright (c) 2020 Equinor

    float shiftRight (float v, float amt) {
    v = floor(v) + 0.5;
    return floor(v / exp2(amt));
    }
    float shiftLeft (float v, float amt) {
        return floor(v * exp2(amt) + 0.5);
    }
    float maskLast (float v, float bits) {
        return mod(v, shiftLeft(1.0, bits));
    }
    float extractBits (float num, float from, float to) {
        from = floor(from + 0.5); to = floor(to + 0.5);
        return maskLast(shiftRight(num, from), to - from);
    }

    vec4 floatToRgba(float texelFloat, bool littleEndian) {
        if (texelFloat == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);
        float sign = texelFloat > 0.0 ? 0.0 : 1.0;
        texelFloat = abs(texelFloat);
        float exponent = floor(log2(texelFloat));
        float biased_exponent = exponent + 127.0;
        float fraction = ((texelFloat / exp2(exponent)) - 1.0) * 8388608.0;
        float t = biased_exponent / 2.0;
        float last_bit_of_biased_exponent = fract(t) * 2.0;
        float remaining_bits_of_biased_exponent = floor(t);
        float byte4 = extractBits(fraction, 0.0, 8.0) / 255.0;
        float byte3 = extractBits(fraction, 8.0, 16.0) / 255.0;
        float byte2 = (last_bit_of_biased_exponent * 128.0 + extractBits(fraction, 16.0, 23.0)) / 255.0;
        float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;
        return (
            littleEndian
                ? vec4(byte4, byte3, byte2, byte1)
                : vec4(byte1, byte2, byte3, byte4)
        );
    }
`, light_frag_params: `
#if dLightCount != 0
    uniform vec3 uLightDirection[dLightCount];
    uniform vec3 uLightColor[dLightCount];
#endif
uniform vec3 uAmbientColor;

struct PhysicalMaterial {
    vec3 diffuseColor;
    float roughness;
    vec3 specularColor;
    float specularF90;
};

struct IncidentLight {
    vec3 color;
    vec3 direction;
};

struct ReflectedLight {
    vec3 directDiffuse;
    vec3 directSpecular;
    vec3 indirectDiffuse;
    vec3 indirectSpecular;
};

struct GeometricContext {
    vec3 position;
    vec3 normal;
    vec3 viewDir;
};

vec3 BRDF_Lambert(const in vec3 diffuseColor) {
    return RECIPROCAL_PI * diffuseColor;
}

vec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {
    // Original approximation by Christophe Schlick '94
    // float fresnel = pow( 1.0 - dotVH, 5.0 );
    // Optimized variant (presented by Epic at SIGGRAPH '13)
    // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
    float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);
    return f0 * (1.0 - fresnel) + (f90 * fresnel);
}

// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
float V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {
    float a2 = pow2(alpha);
    float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));
    float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));
    return 0.5 / max(gv + gl, EPSILON);
}

// Microfacet Models for Refraction through Rough Surfaces - equation (33)
// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
// alpha is "roughness squared" in Disney’s reparameterization
float D_GGX(const in float alpha, const in float dotNH) {
    float a2 = pow2(alpha);
    float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1
    return RECIPROCAL_PI * a2 / pow2(denom);
}

// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
vec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {
    float alpha = pow2(roughness); // UE4's roughness
    vec3 halfDir = normalize( lightDir + viewDir);
    float dotNL = saturate(dot(normal, lightDir));
    float dotNV = saturate(dot(normal, viewDir));
    float dotNH = saturate(dot(normal, halfDir));
    float dotVH = saturate(dot(viewDir, halfDir));
    vec3 F = F_Schlick(f0, f90, dotVH);
    float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);
    float D = D_GGX(alpha, dotNH);
    return F * (V * D);
}

// Analytical approximation of the DFG LUT, one half of the
// split-sum approximation used in indirect specular lighting.
// via 'environmentBRDF' from "Physically Based Shading on Mobile"
// https://www.unrealengine.com/blog/physically-based-shading-on-mobile
vec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {
    float dotNV = saturate(dot(normal, viewDir));
    const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);
    const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);
    vec4 r = roughness * c0 + c1;
    float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;
    vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;
    return fab;
}

// Fdez-Agüera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"
// Approximates multiscattering in order to preserve energy.
// http://www.jcgt.org/published/0008/01/03/
void computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {
    vec2 fab = DFGApprox(normal, viewDir, roughness);
    vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;
    float Ess = fab.x + fab.y;
    float Ems = 1.0 - Ess;
    vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21
    vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);
    singleScatter += FssEss;
    multiScatter += Fms * Ems;
}

void RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
    float dotNL = saturate(dot(geometry.normal, directLight.direction));
    vec3 irradiance = dotNL * directLight.color;
    reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);
    reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);
}

void RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
    reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);
}

void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
    // Both indirect specular and indirect diffuse light accumulate here
    vec3 singleScattering = vec3(0.0);
    vec3 multiScattering = vec3(0.0);
    vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
    computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);
    vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));
    reflectedLight.indirectSpecular += radiance * singleScattering;
    reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
    reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
`, matrix_scale: `
float matrixScale(in mat4 m){
    vec4 r = m[0];
    return sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
}
`, normal_frag_params: `
varying vec3 vNormal;
`, read_from_texture: `
vec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {
    float x = intMod(i, dim.x);
    float y = floor(intDiv(i, dim.x));
    vec2 uv = (vec2(x, y) + 0.5) / dim;
    return texture2D(tex, uv);
}

vec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {
    int x = imod(i, int(dim.x));
    int y = i / int(dim.x);
    vec2 uv = (vec2(x, y) + 0.5) / dim;
    return texture2D(tex, uv);
}
`, rgba_to_float: `
    // rgbaToFloat adapted from https://github.com/ihmeuw/glsl-rgba-to-float
    // BSD 3-Clause License
    //
    // Copyright (c) 2019, Institute for Health Metrics and Evaluation All rights reserved.
    // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    //  - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    //  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    //  - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
    // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    // OF THE POSSIBILITY OF SUCH DAMAGE.

    ivec4 floatsToBytes(vec4 inputFloats, bool littleEndian) {
        ivec4 bytes = ivec4(inputFloats * 255.0);
        return (
            littleEndian
                ? bytes.abgr
                : bytes
        );
    }

    // Break the four bytes down into an array of 32 bits.
    void bytesToBits(const in ivec4 bytes, out bool bits[32]) {
        for (int channelIndex = 0; channelIndex < 4; ++channelIndex) {
            float acc = float(bytes[channelIndex]);
            for (int indexInByte = 7; indexInByte >= 0; --indexInByte) {
                float powerOfTwo = exp2(float(indexInByte));
                bool bit = acc >= powerOfTwo;
                bits[channelIndex * 8 + (7 - indexInByte)] = bit;
                acc = mod(acc, powerOfTwo);
            }
        }
    }

    // Compute the exponent of the 32-bit float.
    float getExponent(bool bits[32]) {
        const int startIndex = 1;
        const int bitStringLength = 8;
        const int endBeforeIndex = startIndex + bitStringLength;
        float acc = 0.0;
        int pow2 = bitStringLength - 1;
        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {
            acc += float(bits[bitIndex]) * exp2(float(pow2--));
        }
        return acc;
    }

    // Compute the mantissa of the 32-bit float.
    float getMantissa(bool bits[32], bool subnormal) {
        const int startIndex = 9;
        const int bitStringLength = 23;
        const int endBeforeIndex = startIndex + bitStringLength;
        // Leading/implicit/hidden bit convention:
        // If the number is not subnormal (with exponent 0), we add a leading 1 digit.
        float acc = float(!subnormal) * exp2(float(bitStringLength));
        int pow2 = bitStringLength - 1;
        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {
            acc += float(bits[bitIndex]) * exp2(float(pow2--));
        }
        return acc;
    }

    // Parse the float from its 32 bits.
    float bitsToFloat(bool bits[32]) {
        float signBit = float(bits[0]) * -2.0 + 1.0;
        float exponent = getExponent(bits);
        bool subnormal = abs(exponent - 0.0) < 0.01;
        float mantissa = getMantissa(bits, subnormal);
        float exponentBias = 127.0;
        return signBit * mantissa * exp2(exponent - exponentBias - 23.0);
    }

    float rgbaToFloat(vec4 texelRGBA, bool littleEndian) {
        ivec4 rgbaBytes = floatsToBytes(texelRGBA, littleEndian);
        bool bits[32];
        bytesToBits(rgbaBytes, bits);
        return bitsToFloat(bits);
    }
`, size_vert_params: `
#if defined(dSizeType_uniform)
    uniform float uSize;
#elif defined(dSizeType_attribute)
    attribute float aSize;
#elif defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)
    uniform vec2 uSizeTexDim;
    uniform sampler2D tSize;
#endif

uniform float uSizeFactor;
`, texture3d_from_1d_trilinear: `
vec4 texture3dFrom1dTrilinear(const in sampler2D tex, const in vec3 pos, const in vec3 gridDim, const in vec2 texDim, const in float offset) {
    float gdYZ = gridDim.z * gridDim.y;
    float gdZ = gridDim.z;
    vec3 p0 = floor(pos * gridDim);
    vec3 p1 = ceil(pos * gridDim);
    vec3 pd = (pos * gridDim - p0) / (p1 - p0);
    vec4 s000 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p0.x * gdYZ, texDim);
    vec4 s100 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p1.x * gdYZ, texDim);
    vec4 s001 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p0.x * gdYZ, texDim);
    vec4 s101 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p1.x * gdYZ, texDim);
    vec4 s010 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p0.x * gdYZ, texDim);
    vec4 s110 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p1.x * gdYZ, texDim);
    vec4 s011 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p0.x * gdYZ, texDim);
    vec4 s111 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p1.x * gdYZ, texDim);
    vec4 s00 = mix(s000, s100, pd.x);
    vec4 s01 = mix(s001, s101, pd.x);
    vec4 s10 = mix(s010, s110, pd.x);
    vec4 s11 = mix(s011, s111, pd.x);
    vec4 s0 = mix(s00, s10, pd.y);
    vec4 s1 = mix(s01, s11, pd.y);
    return mix(s0, s1, pd.z);
}
`, texture3d_from_2d_linear: `
vec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {
    float zSlice0 = floor(pos.z * gridDim.z);
    float column0 = intMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;
    float row0 = floor(intDiv(zSlice0 * gridDim.x, texDim.x));
    vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;
    vec4 color0 = texture2D(tex, coord0);

    float zSlice1 = zSlice0 + 1.0;
    float column1 = intMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;
    float row1 = floor(intDiv(zSlice1 * gridDim.x, texDim.x));
    vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;
    vec4 color1 = texture2D(tex, coord1);

    float delta0 = abs((pos.z * gridDim.z) - zSlice0);
    return mix(color0, color1, delta0);
}
`, texture3d_from_2d_nearest: `
vec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {
    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice
    float column = intMod(zSlice * gridDim.x, texDim.x) / gridDim.x;
    float row = floor(intDiv(zSlice * gridDim.x, texDim.x));
    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;
    return texture2D(tex, coord);
}
`, wboit_write: `
#if defined(dRenderVariant_colorWboit)
    if (!uRenderWboit) {
        if (preFogAlpha < 1.0) {
            discard;
        }
    } else if (uRenderWboit) {
        // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth
        if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {
            float alpha = gl_FragColor.a;
            float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);
            gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);
            // extra alpha is to handle pre-multiplied alpha
            #ifndef dGeometryType_directVolume
                gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);
            #else
                gl_FragData[1] = vec4(alpha * alpha * wboitWeight);
            #endif
        } else {
            discard;
        }
    }
#endif
` }, Wz = /^(?!\/\/)\s*#include\s+(\S+)/gm, Xz = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*\+\+i\s*\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g, Zz = /[ \t]*\/\/.*\n/g, Qz = /[ \t]*\/\*[\s\S]*?\*\//g, Jz = /\n{2,}/g;
function ax(e) {
  return e.replace(Wz, function(t, n) {
    var r = Yz[n];
    if (!r) throw new Error("empty chunk, '".concat(n, "'"));
    return r;
  }).trim().replace(Zz, `
`).replace(Qz, `
`).replace(Jz, `
`);
}
function $z(e, t, n, r) {
  for (var i = "", a = parseInt(t); a < parseInt(n); ++a) i += r.replace(/\[\s*i\s*\]/g, "[".concat(a, "]")).replace(/UNROLLED_LOOP_INDEX/g, "".concat(a));
  return i;
}
function ox(e, t) {
  return function(n) {
    return n.replace(Xz, $z);
  }(function(n, r) {
    return r.dLightCount && (n = n.replace(/dLightCount/g, "".concat(r.dLightCount.ref.value))), r.dClipObjectCount && (n = n.replace(/dClipObjectCount/g, "".concat(r.dClipObjectCount.ref.value))), n;
  }(e, t));
}
function gr(e, t, n, r, i, a) {
  return r === void 0 && (r = {}), i === void 0 && (i = {}), { id: $T(), name: e, vert: ax(t), frag: ax(n), extensions: r, outTypes: i, ignoreDefine: a };
}
function nh(e, t, n) {
  var r;
  return t.startsWith("color") ? e === "dLightCount" && !!(!((r = n.dIgnoreLight) === null || r === void 0) && r.ref.value) : ["dColorType", "dUsePalette", "dLightCount", "dOverpaintType", "dOverpaint", "dSubstanceType", "dSubstance"].includes(e);
}
function a3(e, t, n) {
  return e === "dLightCount" || nh(e, t, n);
}
var eU = gr("points", `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include size_vert_params
#include common_clip

uniform float uPixelRatio;
uniform vec4 uViewport;

attribute vec3 aPosition;
attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;

void main(){
    #include assign_group
    #include assign_color_varying
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_position
    #include assign_size

    #ifdef dPointSizeAttenuation
        gl_PointSize = size * uPixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 5.0;
    #else
        gl_PointSize = size * uPixelRatio;
    #endif
    gl_PointSize = max(1.0, gl_PointSize);

    gl_Position = uProjection * mvPosition;

    #include clip_instance
}
`, `
precision highp float;
precision highp int;

#include common
#include common_frag_params
#include color_frag_params
#include common_clip

const vec2 center = vec2(0.5);
const float radius = 0.5;

void main(){
    #include clip_pixel

    float fragmentDepth = gl_FragCoord.z;
    bool interior = false;
    #include assign_material_color

    #if defined(dPointStyle_circle)
        float dist = distance(gl_PointCoord, center);
        if (dist > radius) discard;
    #elif defined(dPointStyle_fuzzy)
        float dist = distance(gl_PointCoord, center);
        float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);
        if (fuzzyAlpha < 0.0001) discard;
    #endif

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
        gl_FragColor = material;
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        gl_FragColor = material;

        #if defined(dPointStyle_fuzzy)
            gl_FragColor.a *= fuzzyAlpha;
        #endif

        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { drawBuffers: "optional" }, {}, a3), tU = gr("spheres", `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include size_vert_params
#include common_clip

uniform mat4 uModelView;
uniform mat4 uInvProjection;

attribute vec3 aPosition;
attribute vec2 aMapping;
attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;

varying float vRadius;
varying float vRadiusSq;
varying vec3 vPoint;
varying vec3 vPointViewPosition;

#include matrix_scale

const mat4 D = mat4(
    1.0, 0.0, 0.0, 0.0,
    0.0, 1.0, 0.0, 0.0,
    0.0, 0.0, 1.0, 0.0,
    0.0, 0.0, 0.0, -1.0
);

/**
 * Compute point size and center using the technique described in:
 * "GPU-Based Ray-Casting of Quadratic Surfaces" http://dl.acm.org/citation.cfm?id=2386396
 * by Christian Sigg, Tim Weyrich, Mario Botsch, Markus Gross.
 */
void quadraticProjection(const in float radius, const in vec3 position){
    vec2 xbc, ybc;

    mat4 T = mat4(
        radius, 0.0, 0.0, 0.0,
        0.0, radius, 0.0, 0.0,
        0.0, 0.0, radius, 0.0,
        position.x, position.y, position.z, 1.0
    );

    mat4 R = transpose4(uProjection * uModelView * aTransform * T);
    float A = dot(R[3], D * R[3]);
    float B = -2.0 * dot(R[0], D * R[3]);
    float C = dot(R[0], D * R[0]);
    xbc[0] = (-B - sqrt(B * B - 4.0 * A * C)) / (2.0 * A);
    xbc[1] = (-B + sqrt(B * B - 4.0 * A * C)) / (2.0 * A);
    float sx = abs(xbc[0] - xbc[1]) * 0.5;

    A = dot(R[3], D * R[3]);
    B = -2.0 * dot(R[1], D * R[3]);
    C = dot(R[1], D * R[1]);
    ybc[0] = (-B - sqrt(B * B - 4.0 * A * C)) / (2.0 * A);
    ybc[1] = (-B + sqrt(B * B - 4.0 * A * C)) / (2.0 * A);
    float sy = abs(ybc[0] - ybc[1]) * 0.5;

    gl_Position.xy = vec2(0.5 * (xbc.x + xbc.y), 0.5 * (ybc.x + ybc.y));
    gl_Position.xy -= aMapping * vec2(sx, sy);
    gl_Position.xy *= gl_Position.w;
}


void main(void){
    #include assign_group
    #include assign_color_varying
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_size

    vRadius = size * matrixScale(uModelView);

    vec4 position4 = vec4(aPosition, 1.0);
    vec4 mvPosition = uModelView * aTransform * position4;
    mvPosition.z -= vRadius; // avoid clipping, added again in fragment shader

    gl_Position = uProjection * vec4(mvPosition.xyz, 1.0);
    quadraticProjection(size, aPosition);

    vRadiusSq = vRadius * vRadius;
    vec4 vPoint4 = uInvProjection * gl_Position;
    vPoint = vPoint4.xyz / vPoint4.w;
    vPointViewPosition = -mvPosition.xyz / mvPosition.w;

    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader

    #include clip_instance
}
`, `
precision highp float;
precision highp int;

#define bumpEnabled

#include common
#include common_frag_params
#include color_frag_params
#include light_frag_params
#include common_clip

uniform mat4 uInvView;

varying float vRadius;
varying float vRadiusSq;
varying vec3 vPoint;
varying vec3 vPointViewPosition;

vec3 cameraPos;
vec3 cameraNormal;

bool Impostor(out vec3 cameraPos, out vec3 cameraNormal){
    vec3 cameraSpherePos = -vPointViewPosition;
    cameraSpherePos.z += vRadius;

    vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);
    vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);
    vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);

    float B = dot(rayDirection, cameraSphereDir);
    float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);

    if (det < 0.0){
        discard;
        return false;
    }

    float sqrtDet = sqrt(det);
    float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);
    float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);

    cameraPos = rayDirection * negT + rayOrigin;


    if (calcDepth(cameraPos) <= 0.0) {
        cameraPos = rayDirection * posT + rayOrigin;
        interior = true;
    } else {
        interior = false;
    }

    cameraNormal = normalize(cameraPos - cameraSpherePos);
    cameraNormal *= float(!interior) * 2.0 - 1.0;

    return !interior;
}

void main(void){
    #include clip_pixel

    bool flag = Impostor(cameraPos, cameraNormal);
    if (!uDoubleSided) {
        if (interior) discard;
    }

    vec3 vViewPosition = cameraPos;
    gl_FragDepthEXT = calcDepth(vViewPosition);
    if (!flag && gl_FragDepthEXT >= 0.0) {
        gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);
    }

    vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;

    if (gl_FragDepthEXT < 0.0) discard;
    if (gl_FragDepthEXT > 1.0) discard;

    float fragmentDepth = gl_FragDepthEXT;
    #include assign_material_color

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
        gl_FragColor = material;
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        vec3 normal = -cameraNormal;
        #include apply_light_color

        #include apply_interior_color
        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { fragDepth: "required", drawBuffers: "optional" }, {}, nh), nU = gr("cylinders", `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include size_vert_params
#include common_clip

uniform mat4 uModelView;

attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;

attribute vec3 aMapping;
attribute vec3 aStart;
attribute vec3 aEnd;
attribute float aScale;
attribute float aCap;

varying mat4 vTransform;
varying vec3 vStart;
varying vec3 vEnd;
varying float vSize;
varying float vCap;

uniform float uIsOrtho;
uniform vec3 uCameraDir;

void main() {
    #include assign_group
    #include assign_color_varying
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_size

    mat4 modelTransform = uModel * aTransform;

    vTransform = aTransform;
    vStart = (modelTransform * vec4(aStart, 1.0)).xyz;
    vEnd = (modelTransform * vec4(aEnd, 1.0)).xyz;
    vSize = size * aScale;
    vCap = aCap;

    vModelPosition = (vStart + vEnd) * 0.5;
    vec3 camDir = -mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);
    vec3 dir = vEnd - vStart;
    // ensure cylinder 'dir' is pointing towards the camera
    if(dot(camDir, dir) < 0.0) dir = -dir;

    vec3 left = cross(camDir, dir);
    vec3 up = cross(left, dir);
    left = vSize * normalize(left);
    up = vSize * normalize(up);

    // move vertex in object-space from center to corner
    vModelPosition += aMapping.x * dir + aMapping.y * left + aMapping.z * up;

    vec4 mvPosition = uView * vec4(vModelPosition, 1.0);
    vViewPosition = mvPosition.xyz;
    gl_Position = uProjection * mvPosition;

    #include clip_instance
}
`, `
precision highp float;
precision highp int;

#define bumpEnabled

uniform mat4 uView;

varying mat4 vTransform;
varying vec3 vStart;
varying vec3 vEnd;
varying float vSize;
varying float vCap;

uniform vec3 uCameraDir;
uniform vec3 uCameraPosition;
uniform mat4 uInvView;

#include common
#include common_frag_params
#include color_frag_params
#include light_frag_params
#include common_clip

// adapted from https://www.shadertoy.com/view/4lcSRn
// The MIT License, Copyright 2016 Inigo Quilez
bool CylinderImpostor(
    in vec3 rayOrigin, in vec3 rayDir,
    in vec3 start, in vec3 end, in float radius,
    out vec4 intersection, out bool interior
){
    vec3 ba = end - start;
    vec3 oc = rayOrigin - start;

    float baba = dot(ba, ba);
    float bard = dot(ba, rayDir);
    float baoc = dot(ba, oc);

    float k2 = baba - bard*bard;
    float k1 = baba * dot(oc, rayDir) - baoc * bard;
    float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;

    float h = k1 * k1 - k2 * k0;
    if (h < 0.0) return false;

    bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;
    bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;

    // body outside
    h = sqrt(h);
    float t = (-k1 - h) / k2;
    float y = baoc + t * bard;
    if (y > 0.0 && y < baba) {
        interior = false;
        intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);
        return true;
    }

    if (topCap && y < 0.0) {
        // top cap
        t = -baoc / bard;
        if (abs(k1 + k2 * t) < h) {
            interior = false;
            intersection = vec4(t, ba * sign(y) / baba);
            return true;
        }
    } else if(bottomCap && y >= 0.0) {
        // bottom cap
        t = (baba - baoc) / bard;
        if (abs(k1 + k2 * t) < h) {
            interior = false;
            intersection = vec4(t, ba * sign(y) / baba);
            return true;
        }
    }

    if (uDoubleSided) {
        // body inside
        h = -h;
        t = (-k1 - h) / k2;
        y = baoc + t * bard;
        if (y > 0.0 && y < baba) {
            interior = true;
            intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);
            return true;
        }

        // TODO: handle inside caps???
    }

    return false;
}

void main() {
    #include clip_pixel

    vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);

    vec4 intersection;
    bool interior;
    bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);
    if (!hit) discard;

    vec3 vViewPosition = vModelPosition + intersection.x * rayDir;
    vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;
    gl_FragDepthEXT = calcDepth(vViewPosition);

    vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;

    if (gl_FragDepthEXT < 0.0) discard;
    if (gl_FragDepthEXT > 1.0) discard;

    float fragmentDepth = gl_FragDepthEXT;
    #include assign_material_color

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
        gl_FragColor = material;
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        mat3 normalMatrix = transpose3(inverse3(mat3(uView)));
        vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));
        #include apply_light_color

        #include apply_interior_color
        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { fragDepth: "required", drawBuffers: "optional" }, {}, nh), rU = gr("text", `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include size_vert_params
#include common_clip

uniform mat4 uModelView;

attribute vec3 aPosition;
attribute vec2 aMapping;
attribute float aDepth;
attribute vec2 aTexCoord;
attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;

uniform float uOffsetX;
uniform float uOffsetY;
uniform float uOffsetZ;

// uniform bool ortho;
uniform float uPixelRatio;
uniform vec4 uViewport;

varying vec2 vTexCoord;

#include matrix_scale

void main(void){
    #include assign_group
    #include assign_color_varying
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_size

    vTexCoord = aTexCoord;

    float scale = matrixScale(uModelView);

    float offsetX = uOffsetX * scale;
    float offsetY = uOffsetY * scale;
    float offsetZ = (uOffsetZ + aDepth * 0.95) * scale;

    vec4 position4 = vec4(aPosition, 1.0);
    vec4 mvPosition = uModelView * aTransform * position4;

    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader

    // TODO
    // #ifdef FIXED_SIZE
    //     if (ortho) {
    //         scale /= pixelRatio * ((uViewport.w / 2.0) / -uCameraPosition.z) * 0.1;
    //     } else {
    //         scale /= pixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 0.1;
    //     }
    // #endif

    vec4 mvCorner = vec4(mvPosition.xyz, 1.0);

    if (vTexCoord.x == 10.0) { // indicates background plane
        // move a bit to the back, taking distance to camera into account to avoid z-fighting
        offsetZ -= 0.001 * distance(uCameraPosition, (uProjection * mvCorner).xyz);
    }

    mvCorner.xy += aMapping * size * scale;
    mvCorner.x += offsetX;
    mvCorner.y += offsetY;

    // TODO
    // if(ortho){
    //     mvCorner.xyz += normalize(-uCameraPosition) * offsetZ;
    // } else {
    //     mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;
    // }
    mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;

    gl_Position = uProjection * mvCorner;

    vViewPosition = -mvCorner.xyz;

    #include clip_instance
}
`, `
precision highp float;
precision highp int;

#include common
#include common_frag_params
#include color_frag_params
#include common_clip

uniform sampler2D tFont;

uniform vec3 uBorderColor;
uniform float uBorderWidth;
uniform vec3 uBackgroundColor;
uniform float uBackgroundOpacity;

varying vec2 vTexCoord;

const float smoothness = 32.0;
const float gamma = 2.2;

void main2(){
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

void main(){
    #include clip_pixel

    float fragmentDepth = gl_FragCoord.z;
    bool interior = false;
    #include assign_material_color

    if (vTexCoord.x > 1.0) {
        gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);
    } else {
        // retrieve signed distance
        float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;

        // perform adaptive anti-aliasing of the edges
        float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);
        float a = smoothstep(0.5 - w, 0.5 + w, sdf);

        // gamma correction for linear attenuation
        a = pow(a, 1.0 / gamma);

        if (a < 0.5) discard;
        material.a *= a;

        // add border
        float t = 0.5 + uBorderWidth;
        if (uBorderWidth > 0.0 && sdf < t) {
            material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));
        }

        gl_FragColor = material;
    }

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { drawBuffers: "optional" }, {}, a3), iU = gr("lines", `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include size_vert_params
#include common_clip

uniform float uPixelRatio;
uniform vec4 uViewport;

attribute mat4 aTransform;
attribute float aInstance;
attribute float aGroup;

attribute vec2 aMapping;
attribute vec3 aStart;
attribute vec3 aEnd;

void trimSegment(const in vec4 start, inout vec4 end) {
    // trim end segment so it terminates between the camera plane and the near plane
    // conservative estimate of the near plane
    float a = uProjection[2][2];  // 3rd entry in 3rd column
    float b = uProjection[3][2];  // 3rd entry in 4th column
    float nearEstimate = -0.5 * b / a;
    float alpha = (nearEstimate - start.z) / (end.z - start.z);
    end.xyz = mix(start.xyz, end.xyz, alpha);
}

void main(){
    float aspect = uViewport.z / uViewport.w;

    #include assign_group
    #include assign_color_varying
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_size

    mat4 modelView = uView * uModel * aTransform;

    // camera space
    vec4 start = modelView * vec4(aStart, 1.0);
    vec4 end = modelView * vec4(aEnd, 1.0);

    // assign position
    vec4 position4 = vec4((aMapping.y < 0.5) ? aStart : aEnd, 1.0);
    vec4 mvPosition = modelView * position4;
    vViewPosition = mvPosition.xyz;

    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader

    // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
    // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
    // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
    // perhaps there is a more elegant solution -- WestLangley
    bool perspective = (uProjection[2][3] == -1.0); // 4th entry in the 3rd column
    if (perspective) {
        if (start.z < 0.0 && end.z >= 0.0) {
            trimSegment(start, end);
        } else if (end.z < 0.0 && start.z >= 0.0) {
            trimSegment(end, start);
        }
    }

    // clip space
    vec4 clipStart = uProjection * start;
    vec4 clipEnd = uProjection * end;

    // ndc space
    vec2 ndcStart = clipStart.xy / clipStart.w;
    vec2 ndcEnd = clipEnd.xy / clipEnd.w;

    // direction
    vec2 dir = ndcEnd - ndcStart;

    // account for clip-space aspect ratio
    dir.x *= aspect;
    dir = normalize(dir);

    // perpendicular to dir
    vec2 offset = vec2(dir.y, - dir.x);

    // undo aspect ratio adjustment
    dir.x /= aspect;
    offset.x /= aspect;

    // sign flip
    if (aMapping.x < 0.0) offset *= -1.0;

    // calculate linewidth
    float linewidth;
    #ifdef dLineSizeAttenuation
        linewidth = size * uPixelRatio * ((uViewport.w / 2.0) / -start.z) * 5.0;
    #else
        linewidth = size * uPixelRatio;
    #endif
    linewidth = max(1.0, linewidth);

    // adjust for linewidth
    offset *= linewidth;

    // adjust for clip-space to screen-space conversion
    offset /= uViewport.w;

    // select end
    vec4 clip = (aMapping.y < 0.5) ? clipStart : clipEnd;

    // back to clip space
    offset *= clip.w;
    clip.xy += offset;
    gl_Position = clip;

    #include clip_instance
}
`, `
precision highp float;
precision highp int;

#include common
#include common_frag_params
#include color_frag_params
#include common_clip

void main(){
    #include clip_pixel

    bool interior = false;
    float fragmentDepth = gl_FragCoord.z;
    #include assign_material_color

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
        gl_FragColor = material;
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        gl_FragColor = material;

        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { drawBuffers: "optional" }, {}, a3), sx = gr("mesh", `
precision highp float;
precision highp int;
precision highp sampler2D;

#include common
#include read_from_texture
#include common_vert_params
#include color_vert_params
#include common_clip
#include texture3d_from_2d_linear

#ifdef dGeometryType_textureMesh
    uniform vec2 uGeoTexDim;
    uniform sampler2D tPosition;
    uniform sampler2D tGroup;
    uniform sampler2D tNormal;
#else
    attribute vec3 aPosition;
    attribute float aGroup;
    attribute vec3 aNormal;
#endif
attribute mat4 aTransform;
attribute float aInstance;

varying vec3 vNormal;

void main(){
    #include assign_group
    #include assign_marker_varying
    #include assign_clipping_varying
    #include assign_position
    #include assign_color_varying
    #include clip_instance

    #ifdef dGeometryType_textureMesh
        vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;
    #else
        vec3 normal = aNormal;
    #endif
    mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));
    vec3 transformedNormal = normalize(normalMatrix * normalize(normal));
    #if defined(dFlipSided)
        if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR
            transformedNormal = -transformedNormal;
        }
    #endif
    vNormal = transformedNormal;
}
`, `
precision highp float;
precision highp int;

#define bumpEnabled

#include common
#include common_frag_params
#include color_frag_params
#include light_frag_params
#include normal_frag_params
#include common_clip

void main() {
    #include clip_pixel

    // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)
    vec3 fdx = dFdx(vViewPosition);
    vec3 fdy = dFdy(vViewPosition);
    vec3 faceNormal = normalize(cross(fdx,fdy));
    bool frontFacing = dot(vNormal, faceNormal) > 0.0;

    #if defined(dFlipSided)
        interior = frontFacing;
    #else
        interior = !frontFacing;
    #endif

    float fragmentDepth = gl_FragCoord.z;
    #include assign_material_color

    #if defined(dRenderVariant_pick)
        #include check_picking_alpha
        gl_FragColor = material;
    #elif defined(dRenderVariant_depth)
        gl_FragColor = material;
    #elif defined(dRenderVariant_marking)
        gl_FragColor = material;
    #elif defined(dRenderVariant_color)
        #if defined(dFlatShaded)
            vec3 normal = -faceNormal;
        #else
            vec3 normal = -normalize(vNormal);
            if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;
        #endif
        #include apply_light_color

        #include apply_interior_color
        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { drawBuffers: "optional" }, {}, nh), aU = gr("direct-volume", `
precision highp float;

attribute vec3 aPosition;
attribute mat4 aTransform;
attribute float aInstance;

uniform mat4 uModelView;
uniform mat4 uProjection;
uniform vec4 uInvariantBoundingSphere;

varying vec3 vOrigPos;
varying float vInstance;
varying vec4 vBoundingSphere;
varying mat4 vTransform;

uniform vec3 uBboxSize;
uniform vec3 uBboxMin;
uniform vec3 uBboxMax;
uniform vec3 uGridDim;
uniform mat4 uTransform;

uniform mat4 uUnitToCartn;

void main() {
    vec4 unitCoord = vec4(aPosition + vec3(0.5), 1.0);
    vec4 mvPosition = uModelView * aTransform * uUnitToCartn * unitCoord;

    vOrigPos = (aTransform * uUnitToCartn * unitCoord).xyz;
    vInstance = aInstance;
    vBoundingSphere = vec4(
        (aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0)).xyz,
        uInvariantBoundingSphere.w
    );
    vTransform = aTransform;

    gl_Position = uProjection * mvPosition;

    // move z position to near clip plane (but not too close to get precision issues)
    gl_Position.z = gl_Position.w - 0.01;
}
`, `
precision highp float;
precision highp int;

#include common
#include light_frag_params

#if dClipObjectCount != 0
    uniform int uClipObjectType[dClipObjectCount];
    uniform bool uClipObjectInvert[dClipObjectCount];
    uniform vec3 uClipObjectPosition[dClipObjectCount];
    uniform vec4 uClipObjectRotation[dClipObjectCount];
    uniform vec3 uClipObjectScale[dClipObjectCount];
#endif
#include common_clip

#include read_from_texture
#include texture3d_from_1d_trilinear
#include texture3d_from_2d_nearest
#include texture3d_from_2d_linear

uniform mat4 uProjection, uTransform, uModelView, uModel, uView;
uniform vec3 uCameraDir;

uniform sampler2D tDepth;
uniform vec2 uDrawingBufferSize;

varying vec3 vOrigPos;
varying float vInstance;
varying vec4 vBoundingSphere;
varying mat4 vTransform;

uniform mat4 uInvView;
uniform vec3 uGridDim;
uniform vec3 uBboxSize;
uniform sampler2D tTransferTex;
uniform float uTransferScale;
uniform float uStepScale;
uniform float uJumpLength;

uniform int uObjectId;
uniform int uVertexCount;
uniform int uInstanceCount;
uniform int uGroupCount;

uniform vec3 uHighlightColor;
uniform vec3 uSelectColor;
uniform float uHighlightStrength;
uniform float uSelectStrength;
uniform int uMarkerPriority;

uniform vec3 uInvalidColor;
uniform float uInvalidStrength;

uniform float uMarker;
uniform vec2 uMarkerTexDim;
uniform sampler2D tMarker;

uniform float uMetalness;
uniform float uRoughness;

uniform float uFogNear;
uniform float uFogFar;
uniform vec3 uFogColor;

uniform float uAlpha;
uniform float uPickingAlphaThreshold;
uniform bool uTransparentBackground;
uniform float uXrayEdgeFalloff;

uniform float uInteriorDarkening;
uniform bool uInteriorColorFlag;
uniform vec3 uInteriorColor;

uniform bool uRenderWboit;
uniform bool uDoubleSided;

uniform float uNear;
uniform float uFar;
uniform float uIsOrtho;

uniform vec3 uCellDim;
uniform vec3 uCameraPosition;
uniform mat4 uCartnToUnit;

#if __VERSION__ != 100
    // for webgl1 this is given as a 'define'
    uniform int uMaxSteps;
#endif

#if defined(dGridTexType_2d)
    precision highp sampler2D;
    uniform sampler2D tGridTex;
    uniform vec3 uGridTexDim;
#elif defined(dGridTexType_3d)
    precision highp sampler3D;
    uniform sampler3D tGridTex;
#endif

#if defined(dColorType_uniform)
    uniform vec3 uColor;
#elif defined(dColorType_texture)
    uniform vec2 uColorTexDim;
    uniform sampler2D tColor;
#endif

#ifdef dOverpaint
    #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)
        uniform vec2 uOverpaintTexDim;
        uniform sampler2D tOverpaint;
    #endif
#endif

#ifdef dUsePalette
    uniform sampler2D tPalette;
#endif

#if defined(dGridTexType_2d)
    vec4 textureVal(vec3 pos) {
        return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);
    }
    vec4 textureGroup(vec3 pos) {
        return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);
    }
#elif defined(dGridTexType_3d)
    vec4 textureVal(vec3 pos) {
        return texture(tGridTex, pos + (vec3(0.5) / uGridDim));
    }
    vec4 textureGroup(vec3 pos) {
        return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);
    }
#endif

float calcDepth(const in vec3 pos) {
    vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;
    return 0.5 + 0.5 * clipZW.x / clipZW.y;
}

float transferFunction(float value) {
    return texture2D(tTransferTex, vec2(value, 0.0)).a;
}

float getDepth(const in vec2 coords) {
    #ifdef depthTextureSupport
        if (!uRenderWboit) {
            // in case of opaque volumes (and depth texture support)
            return texture2D(tDepth, coords).r;
        } else {
            return unpackRGBAToDepth(texture2D(tDepth, coords));
        }
    #else
        return unpackRGBAToDepth(texture2D(tDepth, coords));
    #endif
}

const float gradOffset = 0.5;

vec3 v3m4(vec3 p, mat4 m) {
    return (m * vec4(p, 1.0)).xyz;
}

float preFogAlphaBlended = 0.0;

vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
    mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));
    mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);
    #if defined(dClipVariant_pixel) && dClipObjectCount != 0
        mat4 modelTransform = uModel * vTransform * uTransform;
    #endif
    mat4 modelViewTransform = uModelView * vTransform * uTransform;

    vec3 scaleVol = vec3(1.0) / uGridDim;
    vec3 pos = startLoc;
    vec4 cell;
    float prevValue = -1.0;
    float value = 0.0;
    vec4 src = vec4(0.0);
    vec4 dst = vec4(0.0);
    float fragmentDepth;

    vec3 posMin = vec3(0.0);
    vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;

    vec3 unitPos;

    vec3 nextPos;
    float nextValue;

    vec4 material;
    vec4 overpaint;
    float metalness = uMetalness;
    float roughness = uRoughness;

    vec3 gradient = vec3(1.0);
    vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);
    vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);
    vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);

    float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);
    float maxDistSq = maxDist * maxDist;

    for (int i = 0; i < uMaxSteps; ++i) {
        // break when beyond bounding-sphere or far-plane
        vec3 distVec = startLoc - pos;
        if (dot(distVec, distVec) > maxDistSq) break;

        unitPos = v3m4(pos, cartnToUnit);

        // continue when outside of grid
        if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||
            unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z
        ) {
            prevValue = value;
            pos += step;
            continue;
        }

        cell = textureVal(unitPos);
        value = cell.a; // current voxel value

        if (uJumpLength > 0.0 && value < 0.01) {
            nextPos = pos + rayDir * uJumpLength;
            nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;
            if (nextValue < 0.01) {
                prevValue = nextValue;
                pos = nextPos;
                continue;
            }
        }

        vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);
        if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))
            break;

        #if defined(dClipVariant_pixel) && dClipObjectCount != 0
            vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);
            if (clipTest(vec4(vModelPosition, 0.0), 0)) {
                prevValue = value;
                pos += step;
                continue;
            }
        #endif

        vec3 vViewPosition = mvPosition.xyz;
        material.a = transferFunction(value);

        #ifdef dPackedGroup
            float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);
        #else
            vec3 g = floor(unitPos * uGridDim + 0.5);
            // note that we swap x and z because the texture is flipped around y
            #if defined(dAxisOrder_012)
                float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210
            #elif defined(dAxisOrder_021)
                float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120
            #elif defined(dAxisOrder_102)
                float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201
            #elif defined(dAxisOrder_120)
                float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021
            #elif defined(dAxisOrder_201)
                float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102
            #elif defined(dAxisOrder_210)
                float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012
            #endif
        #endif

        #if defined(dColorType_direct) && defined(dUsePalette)
            material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;
        #elif defined(dColorType_uniform)
            material.rgb = uColor;
        #elif defined(dColorType_instance)
            material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;
        #elif defined(dColorType_group)
            material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;
        #elif defined(dColorType_groupInstance)
            material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;
        #elif defined(dColorType_vertex)
            material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;
        #elif defined(dColorType_vertexInstance)
            material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;
        #endif

        #ifdef dOverpaint
            #if defined(dOverpaintType_groupInstance)
                overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);
            #elif defined(dOverpaintType_vertexInstance)
                overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));
            #endif

            material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);
        #endif

        if (material.a >= 0.01) {
            #ifdef dPackedGroup
                // compute gradient by central differences
                gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;
                gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;
                gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;
            #else
                gradient = cell.xyz * 2.0 - 1.0;
            #endif
            vec3 normal = -normalize(normalMatrix * normalize(gradient));
            #include apply_light_color
        } else {
            gl_FragColor.rgb = material.rgb;
        }

        gl_FragColor.a = material.a * uAlpha * uTransferScale;

        float marker = uMarker;
        if (uMarker == -1.0) {
            marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
            marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
        }
        #include apply_marker_color

        preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;
        fragmentDepth = calcDepth(mvPosition.xyz);
        #include apply_fog

        src = gl_FragColor;

        if (!uTransparentBackground) {
            // done in 'apply_fog' otherwise
            src.rgb *= src.a;
        }
        dst = (1.0 - dst.a) * src + dst; // standard blending

        // break if the color is opaque enough
        if (dst.a > 0.95)
            break;

        pos += step;
    }

    return dst;
}

// TODO: support float texture for higher precision values???
// TODO: support clipping exclusion texture support

void main() {
    if (gl_FrontFacing)
        discard;

    vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);
    vec3 step = rayDir * uStepScale;

    float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;
    float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);
    vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);
    gl_FragColor = raymarch(start, step, rayDir);

    float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);
    float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);
    bool interior = false;
    #include wboit_write
}
`, { fragDepth: "optional", drawBuffers: "optional" }, {}, nh), oU = gr("image", `
precision highp float;
precision highp int;

#include common
#include common_vert_params

attribute vec3 aPosition;
attribute vec2 aUv;
attribute mat4 aTransform;
attribute float aInstance;

varying vec2 vUv;
varying float vInstance;

void main() {
    #include assign_position

    vUv = aUv;
    vInstance = aInstance;
}
`, `
precision highp float;
precision highp int;

#include common
#include read_from_texture
#include common_frag_params
#include common_clip

uniform vec2 uImageTexDim;
uniform sampler2D tImageTex;
uniform sampler2D tGroupTex;

uniform vec2 uMarkerTexDim;
uniform sampler2D tMarker;

varying vec2 vUv;
varying float vInstance;

#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)
    #define dInterpolation_cubic
#endif

#if defined(dInterpolation_cubic)
    #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)
        #if defined(dInterpolation_catmulrom)
            const float B = 0.0;
            const float C = 0.5;
        #elif defined(dInterpolation_mitchell)
            const float B = 0.333;
            const float C = 0.333;
        #endif

        float cubicFilter(float x){
            float f = x;
            if (f < 0.0) {
                f = -f;
            }
            if (f < 1.0) {
                return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +
                    (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +
                    (6.0 - 2.0 * B)) / 6.0;
            }else if (f >= 1.0 && f < 2.0){
                return ((-B - 6.0 * C) * ( f * f * f)
                    + (6.0 * B + 30.0 * C) * (f * f) +
                    (-(12.0 * B) - 48.0 * C) * f +
                    8.0 * B + 24.0 * C) / 6.0;
            }else{
                return 0.0;
            }
        }
    #elif defined(dInterpolation_bspline)
        float cubicFilter(float x) {
            float f = x;
            if (f < 0.0) {
                f = -f;
            }
            if (f >= 0.0 && f <= 1.0){
                return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);
            } else if (f > 1.0 && f <= 2.0) {
                return 1.0 / 6.0 * pow((2.0 - f), 3.0);
            }
            return 1.0;
        }
    #endif

    vec4 biCubic(sampler2D tex, vec2 texCoord) {
        vec2 texelSize = 1.0 / uImageTexDim;
        texCoord -= texelSize / 2.0;
        vec4 nSum = vec4(0.0);
        float nDenom = 0.0;
        vec2 cell = fract(texCoord * uImageTexDim);
        for (float m = -1.0; m <= 2.0; ++m) {
            for (float n = -1.0; n <= 2.0; ++n) {
                vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));
                float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);
                nSum += vecData * c;
                nDenom += c;
            }
        }
        return nSum / nDenom;
    }
#endif

void main() {
    #include clip_pixel

    #if defined(dInterpolation_cubic)
        vec4 imageData = biCubic(tImageTex, vUv);
    #else
        vec4 imageData = texture2D(tImageTex, vUv);
    #endif
    imageData.a = clamp(imageData.a, 0.0, 1.0);
    if (imageData.a > 0.9) imageData.a = 1.0;

    float fragmentDepth = gl_FragCoord.z;
    bool interior = false;

    #if defined(dRenderVariant_pick)
        if (imageData.a < 0.3)
            discard;
        if (uPickType == 1) {
            gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);
        } else if (uPickType == 2) {
            gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);
        } else {
            gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);
        }
    #elif defined(dRenderVariant_depth)
        if (imageData.a < 0.05)
            discard;
        gl_FragColor = packDepthToRGBA(gl_FragCoord.z);
    #elif defined(dRenderVariant_marking)
        float marker = uMarker;
        if (uMarker == -1.0) {
            float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);
            marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
            marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
        }
        if (uMarkingType == 1) {
            if (marker > 0.0 || imageData.a < 0.05)
                discard;
            gl_FragColor = packDepthToRGBA(gl_FragCoord.z);
        } else {
            if (marker == 0.0 || imageData.a < 0.05)
                discard;
            float depthTest = 1.0;
            if (uMarkingDepthTest) {
                depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;
            }
            bool isHighlight = intMod(marker, 2.0) > 0.1;
            gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);
        }
    #elif defined(dRenderVariant_color)
        if (imageData.a < 0.05)
            discard;
        gl_FragColor = imageData;
        gl_FragColor.a *= uAlpha;

        float marker = uMarker;
        if (uMarker == -1.0) {
            float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);
            marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
            marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
        }

        #include apply_marker_color
        #include apply_fog
        #include wboit_write
    #endif
}
`, { drawBuffers: "optional" }, {}, a3);
function ux(e, t) {
  var n;
  if (e === void 0) return "";
  var r = ((n = e.dRenderVariant) === null || n === void 0 ? void 0 : n.ref.value) || "", i = [];
  for (var a in e) if (!(t != null && t(a, r, e))) {
    var o = e[a].ref.value;
    o !== void 0 && (typeof o == "string" ? i.push("#define ".concat(a, "_").concat(o)) : typeof o == "number" ? i.push("#define ".concat(a, " ").concat(o)) : typeof o == "boolean" ? o && i.push("#define ".concat(a)) : Mi());
  }
  return i.join(`
`) + `
`;
}
var sU = `#version 300 es
#define attribute in
#define varying out
#define texture2D texture
`, uU = `
#define varying in
#define texture2D texture
#define texture2DLodEXT textureLod

#define gl_FragColor out_FragData0
#define gl_FragDepthEXT gl_FragDepth

#define depthTextureSupport
`;
function lU(e, t, n, r) {
  var i = ux(n, r.ignoreDefine), a = ux(n, r.ignoreDefine), o = Jt(e) ? sU : "", s = Jt(e) ? function(l, c, d, f) {
    var p = ["#version 300 es", "layout(location = 0) out highp ".concat(f[0] || "vec4", " out_FragData0;")];
    if (d.fragDepth && p.push("#define enabledFragDepth"), d.drawBuffers) {
      p.push("#define requiredDrawBuffers");
      for (var g = 1, m = l.getParameter(l.MAX_DRAW_BUFFERS); g < m; ++g) p.push("layout(location = ".concat(g, ") out highp ").concat(f[g] || "vec4", " out_FragData").concat(g, ";"));
    }
    return d.shaderTextureLod && p.push("#define enabledShaderTextureLod"), p.push(uU), p.join(`
`) + `
`;
  }(e, 0, r.extensions, r.outTypes) : function(l, c) {
    var d = ["#extension GL_OES_standard_derivatives : enable"];
    if (c.fragDepth) {
      if (l.fragDepth) d.push("#extension GL_EXT_frag_depth : enable"), d.push("#define enabledFragDepth");
      else if (c.fragDepth === "required") throw new Error("required 'GL_EXT_frag_depth' extension not available");
    }
    if (c.drawBuffers) {
      if (l.drawBuffers) d.push("#extension GL_EXT_draw_buffers : require"), d.push("#define requiredDrawBuffers"), d.push("#define gl_FragColor gl_FragData[0]");
      else if (c.drawBuffers === "required") throw new Error("required 'GL_EXT_draw_buffers' extension not available");
    }
    if (c.shaderTextureLod) {
      if (l.shaderTextureLod) d.push("#extension GL_EXT_shader_texture_lod : enable"), d.push("#define enabledShaderTextureLod");
      else if (c.shaderTextureLod === "required") throw new Error("required 'GL_EXT_shader_texture_lod' extension not available");
    }
    return l.depthTexture && d.push("#define depthTextureSupport"), d.join(`
`) + `
`;
  }(t, r.extensions), u = Jt(e) ? function(l) {
    return l.replace(/gl_FragData\[([0-9]+)\]/g, "out_FragData$1");
  }(r.frag) : r.frag;
  return { id: $T(), name: r.name, vert: "".concat(o).concat(i).concat(ox(r.vert, n)), frag: "".concat(s).concat(a).concat(ox(u, n)), extensions: r.extensions, outTypes: r.outTypes };
}
function cU(e, t) {
  switch (t) {
    case "b":
    case "b[]":
      return e.BOOL;
    case "f":
    case "f[]":
      return e.FLOAT;
    case "i":
    case "i[]":
      return e.INT;
    case "v2":
    case "v2[]":
      return e.FLOAT_VEC2;
    case "v3":
    case "v3[]":
      return e.FLOAT_VEC3;
    case "v4":
    case "v4[]":
      return e.FLOAT_VEC4;
    case "m3":
    case "m3[]":
      return e.FLOAT_MAT3;
    case "m4":
    case "m4[]":
      return e.FLOAT_MAT4;
    default:
      console.error("unknown uniform kind '".concat(t, "'"));
  }
}
function dU(e, t, n) {
  e.uniform1f(t, n);
}
function fU(e, t, n) {
  e.uniform1fv(t, n);
}
function mU(e, t, n) {
  e.uniform1i(t, n);
}
function pU(e, t, n) {
  e.uniform1iv(t, n);
}
function hU(e, t, n) {
  e.uniform2fv(t, n);
}
function gU(e, t, n) {
  e.uniform3fv(t, n);
}
function vU(e, t, n) {
  e.uniform4fv(t, n);
}
function yU(e, t, n) {
  e.uniformMatrix3fv(t, !1, n);
}
function bU(e, t, n) {
  e.uniformMatrix4fv(t, !1, n);
}
function lx(e) {
  switch (e) {
    case "f":
      return dU;
    case "f[]":
      return fU;
    case "i":
    case "t":
    case "b":
      return mU;
    case "i[]":
    case "t[]":
    case "b[]":
      return pU;
    case "v2":
    case "v2[]":
      return hU;
    case "v3":
    case "v3[]":
      return gU;
    case "v4":
    case "v4[]":
      return vU;
    case "m3":
    case "m3[]":
      return yU;
    case "m4":
    case "m4[]":
      return bU;
  }
}
var _U = ha();
function cx(e) {
  var t = e.createBuffer();
  if (t === null) throw new Error("Could not create WebGL buffer");
  return t;
}
function dx(e, t, n, r) {
  var i = cx(e), a = function(f, p) {
    switch (p) {
      case "static":
        return f.STATIC_DRAW;
      case "dynamic":
        return f.DYNAMIC_DRAW;
      case "stream":
        return f.STREAM_DRAW;
    }
  }(e, n), o = function(f, p) {
    switch (p) {
      case "attribute":
        return f.ARRAY_BUFFER;
      case "elements":
        return f.ELEMENT_ARRAY_BUFFER;
      case "uniform":
        return f.UNIFORM_BUFFER;
    }
  }(e, r), s = function(f, p) {
    return p instanceof Uint8Array ? f.UNSIGNED_BYTE : p instanceof Int8Array ? f.BYTE : p instanceof Uint16Array ? f.UNSIGNED_SHORT : p instanceof Int16Array ? f.SHORT : p instanceof Uint32Array ? f.UNSIGNED_INT : p instanceof Int32Array ? f.INT : p instanceof Float32Array ? f.FLOAT : void Mi();
  }(e, t), u = t.BYTES_PER_ELEMENT, l = t.length;
  function c(f) {
    e.bindBuffer(o, i), e.bufferData(o, f, a);
  }
  c(t);
  var d = !1;
  return { id: _U(), _usageHint: a, _bufferType: o, _dataType: s, _bpe: u, length: l, getBuffer: function() {
    return i;
  }, updateData: c, updateSubData: function(f, p, g) {
    e.bindBuffer(o, i), g - p === f.length ? e.bufferSubData(o, 0, f) : e.bufferSubData(o, p * u, f.subarray(p, p + g));
  }, reset: function() {
    i = cx(e), c(t);
  }, destroy: function() {
    d || (e.deleteBuffer(i), d = !0);
  } };
}
function xU(e, t, n) {
  switch (t) {
    case "int32":
      switch (n) {
        case 1:
          return e.INT;
        case 2:
          return e.INT_VEC2;
        case 3:
          return e.INT_VEC3;
        case 4:
          return e.INT_VEC4;
      }
      break;
    case "float32":
      switch (n) {
        case 1:
          return e.FLOAT;
        case 2:
          return e.FLOAT_VEC2;
        case 3:
          return e.FLOAT_VEC3;
        case 4:
          return e.FLOAT_VEC4;
        case 16:
          return e.FLOAT_MAT4;
      }
  }
  throw new Error("unknown attribute type for kind '".concat(t, "' and itemSize '").concat(n, "'"));
}
var CU = ha();
function p5(e) {
  var t = e.createProgram();
  if (t === null) throw new Error("Could not create WebGL program");
  return t;
}
function SU(e, t, n, r, i) {
  var a, o, s = i.defineValues, u = i.shaderCode, l = i.schema, c = p5(e), d = CU(), f = lU(e, n, s, u), p = r("vert", f.vert), g = r("frag", f.frag);
  function m() {
    p.attach(c), g.attach(c), e.linkProgram(c), In && function(h, y) {
      if (!h.getProgramParameter(y, h.LINK_STATUS)) throw new Error(`Could not compile WebGL program. 

`.concat(h.getProgramInfoLog(y)));
    }(e, c), a = function(h, y, x) {
      var S = {};
      return Object.keys(x).forEach(function(b) {
        var _ = x[b];
        if (_.type === "attribute") {
          var C = h.getAttribLocation(y, b);
          S[b] = C;
        } else _.type !== "uniform" && _.type !== "texture" || (C = h.getUniformLocation(y, b), S[b] = C);
      }), S;
    }(e, c, l), o = function(h) {
      var y = {};
      return Object.keys(h).forEach(function(x) {
        var S = h[x];
        S.type === "uniform" ? y[x] = lx(S.kind) : S.type === "texture" && (y[x] = lx("t"));
      }), y;
    }(l), In && (function(h, y, x) {
      for (var S = h.getProgramParameter(y, h.ACTIVE_ATTRIBUTES), b = 0; b < S; ++b) {
        var _ = h.getActiveAttrib(y, b);
        if (_) {
          var C = _.name, w = _.type;
          if (C.startsWith("__activeAttribute") || C === "gl_InstanceID" || C === "gl_VertexID") continue;
          var I = x[C];
          if (I === void 0) throw new Error("missing 'uniform' or 'texture' with name '".concat(C, "' in schema"));
          if (I.type !== "attribute") throw new Error("'".concat(C, "' must be of type 'attribute' but is '").concat(I.type, "'"));
          if (xU(h, I.kind, I.itemSize) !== w) throw new Error("unexpected attribute type for ".concat(C));
        }
      }
    }(e, c, l), function(h, y, x) {
      for (var S = h.getProgramParameter(y, h.ACTIVE_UNIFORMS), b = 0; b < S; ++b) {
        var _ = h.getActiveUniform(y, b);
        if (_) {
          var C = _.name, w = _.type;
          if (C.startsWith("__activeUniform")) continue;
          var I = x[C.replace(/[[0-9]+\]$/, "")];
          if (I === void 0) throw new Error("missing 'uniform' or 'texture' with name '".concat(C, "' in schema"));
          if (I.type === "uniform") {
            if (cU(h, I.kind) !== w) throw new Error("unexpected uniform type for ".concat(C));
          } else {
            if (I.type !== "texture") throw new Error("'".concat(C, "' must be of type 'uniform' or 'texture' but is '").concat(I.type, "'"));
            if (I.kind === "image-float32" || I.kind === "image-uint8") {
              if (w !== h.SAMPLER_2D) throw new Error("unexpected sampler type for '".concat(C, "'"));
            } else if ((I.kind === "volume-float32" || I.kind === "volume-uint8") && w !== h.SAMPLER_3D) throw new Error("unexpected sampler type for '".concat(C, "'"));
          }
        }
      }
    }(e, c, l));
  }
  m();
  var v = !1;
  return { id: d, use: function() {
    t.currentProgramId = d, e.useProgram(c);
  }, setUniforms: function(h) {
    for (var y = 0, x = h.length; y < x; ++y) {
      var S = h[y], b = S[0], _ = S[1];
      if (_) {
        var C = a[b];
        C !== null && o[b](e, C, _.ref.value);
      }
    }
  }, bindAttributes: function(h) {
    t.clearVertexAttribsState();
    for (var y = 0, x = h.length; y < x; ++y) {
      var S = h[y], b = S[0], _ = S[1], C = a[b];
      C !== -1 && _.bind(C);
    }
    t.disableUnusedVertexAttribs();
  }, bindTextures: function(h, y) {
    for (var x = 0, S = h.length; x < S; ++x) {
      var b = h[x], _ = b[0], C = b[1], w = a[_];
      w != null && (C.bind(x + y), o[_](e, w, x + y));
    }
  }, reset: function() {
    c = p5(e), m();
  }, destroy: function() {
    v || (p.destroy(), g.destroy(), e.deleteProgram(c), v = !0);
  } };
}
var AU = ha();
function Wg(e, t) {
  var n = t.type, r = t.source, i = e.createShader(n === "vert" ? e.VERTEX_SHADER : e.FRAGMENT_SHADER);
  if (i === null) throw new Error("Error creating ".concat(n, " shader"));
  if (e.shaderSource(i, r), e.compileShader(i), In && e.getShaderParameter(i, e.COMPILE_STATUS) === !1) throw console.warn("'".concat(n, "' shader info log '").concat(e.getShaderInfoLog(i), `'
`).concat(function(a) {
    for (var o = a.split(`
`), s = 0; s < o.length; ++s) o[s] = s + 1 + ": " + o[s];
    return o.join(`
`);
  }(r))), new Error("Error compiling ".concat(n, " shader"));
  return i;
}
function wU(e, t) {
  var n = Wg(e, t);
  return { id: AU(), attach: function(r) {
    e.attachShader(r, n);
  }, reset: function() {
    n = Wg(e, t);
  }, destroy: function() {
    e.deleteShader(n);
  } };
}
function Jt(e) {
  return typeof WebGL2RenderingContext < "u" && e instanceof WebGL2RenderingContext;
}
var IU = `
attribute vec4 aPosition;

void main() {
    gl_Position = aPosition;
}`, PU = `
precision mediump float;
uniform vec4 uColor;
uniform sampler2D uTexture;

void main() {
    gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;
}`, MU = new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]);
function fx(e, t) {
  var n = Wg(e, { type: "vert", source: IU }), r = Wg(e, { type: "frag", source: PU });
  if (!n || !r) return !1;
  var i = p5(e);
  e.attachShader(i, n), e.attachShader(i, r), e.linkProgram(i), e.useProgram(i);
  var a = e.getAttribLocation(i, "aPosition"), o = e.getUniformLocation(i, "uColor");
  if (!o) return In && console.log("error getting 'uColor' uniform location"), !1;
  var s = e.createBuffer();
  e.bindBuffer(e.ARRAY_BUFFER, s), e.bufferData(e.ARRAY_BUFFER, MU, e.STATIC_DRAW), e.enableVertexAttribArray(a), e.vertexAttribPointer(a, 2, e.FLOAT, !1, 0, 0);
  var u = e.createTexture(), l = new Uint8Array([255, 255, 255, 255]);
  e.bindTexture(e.TEXTURE_2D, u), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, l);
  var c = e.createTexture();
  e.bindTexture(e.TEXTURE_2D, c), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, t, null), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST);
  var d = e.createFramebuffer();
  if (e.bindFramebuffer(e.FRAMEBUFFER, d), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, c, 0), e.checkFramebufferStatus(e.FRAMEBUFFER) !== e.FRAMEBUFFER_COMPLETE) return In && console.log("error creating framebuffer for '".concat(t, "'")), !1;
  e.bindTexture(e.TEXTURE_2D, u), e.uniform4fv(o, [0, 10, 20, 1]), e.drawArrays(e.TRIANGLES, 0, 6), e.bindTexture(e.TEXTURE_2D, c), e.bindFramebuffer(e.FRAMEBUFFER, null), e.clearColor(1, 0, 0, 1), e.clear(e.COLOR_BUFFER_BIT), e.uniform4fv(o, [0, 0.1, 0.05, 1]), e.drawArrays(e.TRIANGLES, 0, 6);
  var f = new Uint8Array(4);
  if (e.readPixels(0, 0, 1, 1, e.RGBA, e.UNSIGNED_BYTE, f), f[0] !== 0 || f[1] < 248 || f[2] < 248 || f[3] < 254) return In && console.log("not able to actually render to '".concat(t, "' texture")), !1;
  if (t === e.FLOAT) {
    e.bindFramebuffer(e.FRAMEBUFFER, d);
    var p = new Float32Array(4);
    e.readPixels(0, 0, 1, 1, e.RGBA, e.FLOAT, p);
    var g = e.getError();
    if (g) return In && console.log("error reading float pixels: '".concat(rk(e, g), "'")), !1;
  }
  return !0;
}
var cf, ek = ha();
function B6(e) {
  var t = e.checkFramebufferStatus(e.FRAMEBUFFER);
  if (t !== e.FRAMEBUFFER_COMPLETE) {
    var n = function(r, i) {
      switch (i) {
        case r.FRAMEBUFFER_COMPLETE:
          return "complete";
        case r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
          return "incomplete attachment";
        case r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
          return "incomplete missing attachment";
        case r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
          return "incomplete dimensions";
        case r.FRAMEBUFFER_UNSUPPORTED:
          return "unsupported";
      }
      if (Jt(r)) switch (i) {
        case r.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
          return "incomplete multisample";
        case r.RENDERBUFFER_SAMPLES:
          return "renderbuffer samples";
      }
      return "unknown error";
    }(e, t);
    throw new Error("Framebuffer status: ".concat(n));
  }
}
function mx(e) {
  var t = e.createFramebuffer();
  if (t === null) throw new Error("Could not create WebGL framebuffer");
  return t;
}
function px(e) {
  var t = function(h) {
    if (Jt(h)) return { drawArraysInstanced: h.drawArraysInstanced.bind(h), drawElementsInstanced: h.drawElementsInstanced.bind(h), vertexAttribDivisor: h.vertexAttribDivisor.bind(h), VERTEX_ATTRIB_ARRAY_DIVISOR: h.VERTEX_ATTRIB_ARRAY_DIVISOR };
    var y = h.getExtension("ANGLE_instanced_arrays");
    return y === null ? null : { drawArraysInstanced: y.drawArraysInstancedANGLE.bind(y), drawElementsInstanced: y.drawElementsInstancedANGLE.bind(y), vertexAttribDivisor: y.vertexAttribDivisorANGLE.bind(y), VERTEX_ATTRIB_ARRAY_DIVISOR: y.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE };
  }(e);
  if (t === null) throw new Error('Could not find support for "instanced_arrays"');
  var n = function(h) {
    return Jt(h) ? {} : h.getExtension("OES_element_index_uint");
  }(e);
  if (n === null) throw new Error('Could not find support for "element_index_uint"');
  var r = function(h) {
    if (Jt(h)) return { FRAGMENT_SHADER_DERIVATIVE_HINT: h.FRAGMENT_SHADER_DERIVATIVE_HINT };
    var y = h.getExtension("OES_standard_derivatives");
    return y === null ? null : { FRAGMENT_SHADER_DERIVATIVE_HINT: y.FRAGMENT_SHADER_DERIVATIVE_HINT_OES };
  }(e);
  if (r === null) throw new Error('Could not find support for "standard_derivatives"');
  var i = function(h) {
    return Jt(h) ? {} : h.getExtension("OES_texture_float");
  }(e);
  In && i === null && console.log('Could not find support for "texture_float"');
  var a = function(h) {
    return h.getExtension("OES_texture_float_linear");
  }(e);
  In && a === null && console.log('Could not find support for "texture_float_linear"');
  var o = function(h) {
    if (Jt(h)) return { HALF_FLOAT: h.HALF_FLOAT };
    var y = h.getExtension("OES_texture_half_float");
    return y === null ? null : { HALF_FLOAT: y.HALF_FLOAT_OES };
  }(e);
  In && o === null && console.log('Could not find support for "texture_half_float"');
  var s = function(h) {
    return h.getExtension("OES_texture_half_float_linear");
  }(e);
  In && s === null && console.log('Could not find support for "texture_half_float_linear"');
  var u = function(h) {
    if (Jt(h)) return { UNSIGNED_INT_24_8: h.UNSIGNED_INT_24_8 };
    var y = h.getExtension("WEBGL_depth_texture");
    return y === null ? null : { UNSIGNED_INT_24_8: y.UNSIGNED_INT_24_8_WEBGL };
  }(e);
  In && u === null && console.log('Could not find support for "depth_texture"');
  var l = function(h) {
    if (Jt(h)) return { MIN: h.MIN, MAX: h.MAX };
    var y = h.getExtension("EXT_blend_minmax");
    return y === null ? null : { MIN: y.MIN_EXT, MAX: y.MAX_EXT };
  }(e);
  In && l === null && console.log('Could not find support for "blend_minmax"');
  var c = function(h) {
    if (Jt(h)) return { VERTEX_ARRAY_BINDING: h.VERTEX_ARRAY_BINDING, bindVertexArray: h.bindVertexArray.bind(h), createVertexArray: h.createVertexArray.bind(h), deleteVertexArray: h.deleteVertexArray.bind(h), isVertexArray: h.isVertexArray.bind(h) };
    var y = h.getExtension("OES_vertex_array_object");
    return y === null ? null : { VERTEX_ARRAY_BINDING: y.VERTEX_ARRAY_BINDING_OES, bindVertexArray: y.bindVertexArrayOES.bind(y), createVertexArray: y.createVertexArrayOES.bind(y), deleteVertexArray: y.deleteVertexArrayOES.bind(y), isVertexArray: y.isVertexArrayOES.bind(y) };
  }(e);
  In && c === null && console.log('Could not find support for "vertex_array_object"');
  var d = function(h) {
    return Jt(h) ? {} : h.getExtension("EXT_frag_depth");
  }(e);
  In && d === null && console.log('Could not find support for "frag_depth"');
  var f = function(h) {
    if (Jt(h)) return h.getExtension("EXT_color_buffer_float") === null ? null : (h.getExtension("EXT_float_blend"), { RGBA32F: h.RGBA32F });
    var y = h.getExtension("WEBGL_color_buffer_float");
    return y === null ? (h.getExtension("OES_texture_float"), fx(h, h.FLOAT) ? { RGBA32F: 34836 } : null) : (h.getExtension("EXT_float_blend"), { RGBA32F: y.RGBA32F_EXT });
  }(e);
  In && f === null && console.log('Could not find support for "color_buffer_float"');
  var p = function(h) {
    if (Jt(h)) return h.getExtension("EXT_color_buffer_half_float") === null ? null : (h.getExtension("EXT_float_blend"), { RGBA16F: h.RGBA16F });
    var y = h.getExtension("EXT_color_buffer_half_float");
    return y === null ? (h.getExtension("OES_texture_half_float"), fx(h, 36193) ? { RGBA16F: 34842 } : null) : (h.getExtension("EXT_float_blend"), { RGBA16F: y.RGBA16F_EXT });
  }(e);
  In && p === null && console.log('Could not find support for "color_buffer_half_float"');
  var g = function(h) {
    if (Jt(h)) return { drawBuffers: h.drawBuffers.bind(h), COLOR_ATTACHMENT0: h.COLOR_ATTACHMENT0, COLOR_ATTACHMENT1: h.COLOR_ATTACHMENT1, COLOR_ATTACHMENT2: h.COLOR_ATTACHMENT2, COLOR_ATTACHMENT3: h.COLOR_ATTACHMENT3, COLOR_ATTACHMENT4: h.COLOR_ATTACHMENT4, COLOR_ATTACHMENT5: h.COLOR_ATTACHMENT5, COLOR_ATTACHMENT6: h.COLOR_ATTACHMENT6, COLOR_ATTACHMENT7: h.COLOR_ATTACHMENT7, DRAW_BUFFER0: h.DRAW_BUFFER0, DRAW_BUFFER1: h.DRAW_BUFFER1, DRAW_BUFFER2: h.DRAW_BUFFER2, DRAW_BUFFER3: h.DRAW_BUFFER3, DRAW_BUFFER4: h.DRAW_BUFFER4, DRAW_BUFFER5: h.DRAW_BUFFER5, DRAW_BUFFER6: h.DRAW_BUFFER6, DRAW_BUFFER7: h.DRAW_BUFFER7, MAX_COLOR_ATTACHMENTS: h.MAX_COLOR_ATTACHMENTS, MAX_DRAW_BUFFERS: h.MAX_DRAW_BUFFERS };
    var y = h.getExtension("WEBGL_draw_buffers");
    return y === null ? null : { drawBuffers: y.drawBuffersWEBGL.bind(y), COLOR_ATTACHMENT0: y.COLOR_ATTACHMENT0_WEBGL, COLOR_ATTACHMENT1: y.COLOR_ATTACHMENT1_WEBGL, COLOR_ATTACHMENT2: y.COLOR_ATTACHMENT2_WEBGL, COLOR_ATTACHMENT3: y.COLOR_ATTACHMENT3_WEBGL, COLOR_ATTACHMENT4: y.COLOR_ATTACHMENT4_WEBGL, COLOR_ATTACHMENT5: y.COLOR_ATTACHMENT5_WEBGL, COLOR_ATTACHMENT6: y.COLOR_ATTACHMENT6_WEBGL, COLOR_ATTACHMENT7: y.COLOR_ATTACHMENT7_WEBGL, DRAW_BUFFER0: y.DRAW_BUFFER0_WEBGL, DRAW_BUFFER1: y.DRAW_BUFFER1_WEBGL, DRAW_BUFFER2: y.DRAW_BUFFER2_WEBGL, DRAW_BUFFER3: y.DRAW_BUFFER3_WEBGL, DRAW_BUFFER4: y.DRAW_BUFFER4_WEBGL, DRAW_BUFFER5: y.DRAW_BUFFER5_WEBGL, DRAW_BUFFER6: y.DRAW_BUFFER6_WEBGL, DRAW_BUFFER7: y.DRAW_BUFFER7_WEBGL, MAX_COLOR_ATTACHMENTS: y.MAX_COLOR_ATTACHMENTS_WEBGL, MAX_DRAW_BUFFERS: y.MAX_DRAW_BUFFERS_WEBGL };
  }(e);
  In && g === null && console.log('Could not find support for "draw_buffers"');
  var m = function(h) {
    return Jt(h) ? {} : h.getExtension("EXT_shader_texture_lod");
  }(e);
  In && m === null && console.log('Could not find support for "shader_texture_lod"');
  var v = function(h) {
    if (Jt(h)) return { FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: h.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, SRGB8_ALPHA8: h.SRGB8_ALPHA8, SRGB8: h.SRGB8, SRGB: h.SRGB };
    var y = h.getExtension("EXT_sRGB");
    return y === null ? null : { FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: y.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT, SRGB8_ALPHA8: y.SRGB8_ALPHA8_EXT, SRGB8: y.SRGB_ALPHA_EXT, SRGB: y.SRGB_EXT };
  }(e);
  return In && v === null && console.log('Could not find support for "sRGB"'), { instancedArrays: t, standardDerivatives: r, textureFloat: i, textureFloatLinear: a, textureHalfFloat: o, textureHalfFloatLinear: s, elementIndexUint: n, depthTexture: u, blendMinMax: l, vertexArrayObject: c, fragDepth: d, colorBufferFloat: f, colorBufferHalfFloat: p, drawBuffers: g, shaderTextureLod: m, sRGB: v };
}
function hx(e, t, n) {
  var r = /* @__PURE__ */ new Map();
  return { get: function(i) {
    var a, o, s = e(i), u = r.get(s);
    return u || (a = t(i), o === void 0 && (o = 0), u = { value: a, usageCount: o }, r.set(s, u)), u.usageCount += 1, function(l) {
      return { free: function() {
        l.usageCount -= 1;
      }, value: l.value };
    }(u);
  }, clear: function() {
    r.forEach(function(i, a) {
      i.usageCount <= 0 && (i.usageCount < 0 && console.warn("Reference usageCount below zero."), n(i.value), r.delete(a));
    });
  }, get count() {
    return r.size;
  }, dispose: function() {
    r.forEach(function(i) {
      return n(i.value);
    }), r.clear();
  } };
}
(function(e) {
  e.create = function(t, n, r) {
    return { array: t, width: n, height: r };
  }, e.flipY = function(t) {
    for (var n = t.array, r = t.width, i = t.height, a = 4 * r, o = 0, s = i / 2; o < s; ++o) for (var u = 0, l = a; u < l; ++u) {
      var c = o * a + u, d = (i - o - 1) * a + u, f = n[c];
      n[c] = n[d], n[d] = f;
    }
    return t;
  }, e.divideByAlpha = function(t) {
    for (var n = t.array, r = n instanceof Uint8Array ? 255 : 1, i = 0, a = n.length; i < a; i += 4) {
      var o = n[i + 3] / r;
      o !== 0 ? (n[i] /= o, n[i + 1] /= o, n[i + 2] /= o) : (n[i] = 0, n[i + 1] = 0, n[i + 2] = 0);
    }
    return t;
  };
})(cf || (cf = {}));
var EU = ha();
function gx(e) {
  var t = e.createRenderbuffer();
  if (t === null) throw new Error("Could not create WebGL renderbuffer");
  return t;
}
function TU(e, t, n, r, i) {
  var a = gx(e), o = function() {
    return e.bindRenderbuffer(e.RENDERBUFFER, a);
  }, s = function(d, f) {
    switch (f) {
      case "depth16":
        return d.DEPTH_COMPONENT16;
      case "stencil8":
        return d.STENCIL_INDEX8;
      case "rgba4":
        return d.RGBA4;
      case "depth-stencil":
        return d.DEPTH_STENCIL;
      case "depth32f":
        if (Jt(d)) return d.DEPTH_COMPONENT32F;
        throw new Error("WebGL2 needed for `depth32f` renderbuffer format");
    }
  }(e, t), u = function(d, f) {
    switch (f) {
      case "depth":
        return d.DEPTH_ATTACHMENT;
      case "stencil":
        return d.STENCIL_ATTACHMENT;
      case "depth-stencil":
        return d.DEPTH_STENCIL_ATTACHMENT;
      case "color0":
        return d.COLOR_ATTACHMENT0;
    }
  }(e, n);
  function l() {
    o(), e.renderbufferStorage(e.RENDERBUFFER, s, r, i);
  }
  l();
  var c = !1;
  return { id: EU(), bind: o, attachFramebuffer: function(d) {
    d.bind(), o(), e.framebufferRenderbuffer(e.FRAMEBUFFER, u, e.RENDERBUFFER, a), In && B6(e);
  }, setSize: function(d, f) {
    r = d, i = f, l();
  }, reset: function() {
    a = gx(e), l();
  }, destroy: function() {
    c || (e.deleteRenderbuffer(a), c = !0);
  } };
}
var tk = ha();
function vx(e, t, n) {
  switch (t) {
    case "alpha":
      return Jt(e) && n === "float" ? e.RED : Jt(e) && n === "int" ? e.RED_INTEGER : e.ALPHA;
    case "rgb":
      return Jt(e) && n === "int" ? e.RGB_INTEGER : e.RGB;
    case "rgba":
      return Jt(e) && n === "int" ? e.RGBA_INTEGER : e.RGBA;
    case "depth":
      return e.DEPTH_COMPONENT;
  }
}
function yx(e, t) {
  switch (t) {
    case "nearest":
      return e.NEAREST;
    case "linear":
      return e.LINEAR;
  }
}
function Kh(e, t, n) {
  switch (n) {
    case "depth":
      return e.DEPTH_ATTACHMENT;
    case "stencil":
      return e.STENCIL_ATTACHMENT;
    case "color0":
    case 0:
      return e.COLOR_ATTACHMENT0;
  }
  if (t.drawBuffers) switch (n) {
    case "color1":
    case 1:
      return t.drawBuffers.COLOR_ATTACHMENT1;
    case "color2":
    case 2:
      return t.drawBuffers.COLOR_ATTACHMENT2;
    case "color3":
    case 3:
      return t.drawBuffers.COLOR_ATTACHMENT3;
    case "color4":
    case 4:
      return t.drawBuffers.COLOR_ATTACHMENT4;
    case "color5":
    case 5:
      return t.drawBuffers.COLOR_ATTACHMENT5;
    case "color6":
    case 6:
      return t.drawBuffers.COLOR_ATTACHMENT6;
    case "color7":
    case 7:
      return t.drawBuffers.COLOR_ATTACHMENT7;
  }
  throw new Error("unknown texture attachment");
}
function bx(e) {
  return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement;
}
function _x(e, t, n) {
  return t === n.TEXTURE_3D;
}
function xx(e) {
  var t = e.createTexture();
  if (t === null) throw new Error("Could not create WebGL texture");
  return t;
}
function h5(e, t, n, r, i, a) {
  var o = tk(), s = xx(e);
  if (n.endsWith("float32") && i !== "float" || n.endsWith("float16") && i !== "fp16" || n.endsWith("uint8") && i !== "ubyte" || n.endsWith("int32") && i !== "int" || n.endsWith("depth") && i !== "ushort" && i !== "float") throw new Error("texture kind '".concat(n, "' and type '").concat(i, "' are incompatible"));
  var u = function(b, _) {
    switch (_) {
      case "image-uint8":
      case "image-float32":
      case "image-float16":
      case "image-depth":
        return b.TEXTURE_2D;
    }
    if (Jt(b)) switch (_) {
      case "image-int32":
        return b.TEXTURE_2D;
      case "volume-uint8":
      case "volume-float32":
      case "volume-float16":
        return b.TEXTURE_3D;
    }
    throw new Error("unknown texture kind '".concat(_, "'"));
  }(e, n), l = yx(e, a), c = vx(e, r, i), d = function(b, _, C) {
    if (Jt(b)) switch (_) {
      case "alpha":
        switch (C) {
          case "ubyte":
            return b.ALPHA;
          case "float":
            return b.R32F;
          case "fp16":
            return b.R16F;
          case "int":
            return b.R32I;
        }
      case "rgb":
        switch (C) {
          case "ubyte":
            return b.RGB;
          case "float":
            return b.RGB32F;
          case "fp16":
            return b.RGB16F;
          case "int":
            return b.RGB32I;
        }
      case "rgba":
        switch (C) {
          case "ubyte":
            return b.RGBA;
          case "float":
            return b.RGBA32F;
          case "fp16":
            return b.RGBA16F;
          case "int":
            return b.RGBA32I;
        }
      case "depth":
        switch (C) {
          case "ushort":
            return b.DEPTH_COMPONENT16;
          case "float":
            return b.DEPTH_COMPONENT32F;
        }
    }
    return vx(b, _, C);
  }(e, r, i), f = function(b, _, C) {
    switch (C) {
      case "ubyte":
        return b.UNSIGNED_BYTE;
      case "ushort":
        return b.UNSIGNED_SHORT;
      case "float":
        return b.FLOAT;
      case "fp16":
        if (_.textureHalfFloat) return _.textureHalfFloat.HALF_FLOAT;
        throw new Error('extension "texture_half_float" unavailable');
      case "int":
        if (Jt(b)) return b.INT;
        throw new Error('texture type "int" requires webgl2');
    }
  }(e, t, i);
  function p() {
    e.bindTexture(u, s), e.texParameteri(u, e.TEXTURE_MAG_FILTER, l), e.texParameteri(u, e.TEXTURE_MIN_FILTER, l), e.texParameteri(u, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(u, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.bindTexture(u, null);
  }
  p();
  var g, m = 0, v = 0, h = 0, y = !1;
  function x(b, _, C) {
    if (b === 0 || _ === 0 || Jt(e) && u === e.TEXTURE_3D && C === 0) throw new Error("empty textures are not allowed");
    if (m !== b || v !== _ || h !== (C || 0)) if (m = b, v = _, h = C || 0, e.bindTexture(u, s), u === e.TEXTURE_2D) e.texImage2D(u, 0, d, m, v, 0, c, f, null);
    else {
      if (!Jt(e) || u !== e.TEXTURE_3D || h === void 0) throw new Error("unknown texture target");
      e.texImage3D(u, 0, d, m, v, h, 0, c, f, null);
    }
  }
  function S(b, _) {
    if (_ === void 0 && (_ = !1), b.width === 0 || b.height === 0 || !bx(b) && Jt(e) && _x(0, u, e) && b.depth === 0) throw new Error("empty textures are not allowed");
    if (e.bindTexture(u, s), e.pixelStorei(e.UNPACK_ALIGNMENT, 1), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, e.NONE), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), bx(b)) m = b.width, v = b.height, e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !1), e.bindTexture(e.TEXTURE_2D, s), e.texImage2D(e.TEXTURE_2D, 0, d, c, f, b);
    else if (function(w, I, M) {
      return I === M.TEXTURE_2D;
    }(0, u, e)) {
      var C = b.filter ? yx(e, b.filter) : l;
      e.texParameteri(u, e.TEXTURE_MAG_FILTER, C), e.texParameteri(u, e.TEXTURE_MIN_FILTER, C), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !!b.flipY), _ ? e.texSubImage2D(u, 0, 0, 0, b.width, b.height, c, f, b.array) : (m = b.width, v = b.height, e.texImage2D(u, 0, d, m, v, 0, c, f, b.array));
    } else {
      if (!Jt(e) || !_x(0, u, e)) throw new Error("unknown texture target");
      e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !1), _ ? e.texSubImage3D(u, 0, 0, 0, 0, b.width, b.height, b.depth, c, f, b.array) : (m = b.width, v = b.height, h = b.depth, e.texImage3D(u, 0, d, m, v, h, 0, c, f, b.array));
    }
    e.bindTexture(u, null), g = b;
  }
  return x(1, 1, Jt(e) && u === e.TEXTURE_3D ? 1 : 0), { id: o, target: u, format: c, internalFormat: d, type: f, filter: l, getWidth: function() {
    return m;
  }, getHeight: function() {
    return v;
  }, getDepth: function() {
    return h;
  }, getByteCount: function() {
    return function(b, _, C, w, I) {
      var M = function(E) {
        switch (E) {
          case "alpha":
            return 1;
          case "rgb":
            return 3;
          case "rgba":
          case "depth":
            return 4;
        }
      }(b) * function(E) {
        switch (E) {
          case "ubyte":
            return 1;
          case "ushort":
          case "fp16":
            return 2;
          case "float":
          case "int":
            return 4;
        }
      }(_);
      return M * C * w * (I || 1);
    }(r, i, m, v, h);
  }, define: x, load: S, bind: function(b) {
    e.activeTexture(e.TEXTURE0 + b), e.bindTexture(u, s);
  }, unbind: function(b) {
    e.activeTexture(e.TEXTURE0 + b), e.bindTexture(u, null);
  }, attachFramebuffer: function(b, _, C) {
    if (b.bind(), u === e.TEXTURE_2D) e.framebufferTexture2D(e.FRAMEBUFFER, Kh(e, t, _), e.TEXTURE_2D, s, 0);
    else {
      if (!Jt(e) || u !== e.TEXTURE_3D) throw new Error("unknown/unsupported texture target");
      if (C === void 0) throw new Error("need `layer` to attach 3D texture");
      e.framebufferTextureLayer(e.FRAMEBUFFER, Kh(e, t, _), s, 0, C);
    }
  }, detachFramebuffer: function(b, _) {
    if (b.bind(), u === e.TEXTURE_2D) e.framebufferTexture2D(e.FRAMEBUFFER, Kh(e, t, _), e.TEXTURE_2D, null, 0);
    else {
      if (!Jt(e) || u !== e.TEXTURE_3D) throw new Error("unknown texture target");
      e.framebufferTextureLayer(e.FRAMEBUFFER, Kh(e, t, _), null, 0, 0);
    }
  }, reset: function() {
    s = xx(e), p();
    var b = [m, v, h];
    m = 0, v = 0, h = 0, x(b[0], b[1], b[2]), g && S(g);
  }, destroy: function() {
    y || (e.deleteTexture(s), y = !0);
  } };
}
function Cx(e, t, n) {
  var r = new Image();
  r.onload = function() {
    n.load(r), R.update(t, n);
  }, r.src = e;
}
function Ha(e) {
  var t, n = (t = e == null ? void 0 : e.TEXTURE_2D) !== null && t !== void 0 ? t : 3553;
  return { id: tk(), target: n, format: 0, internalFormat: 0, type: 0, filter: 0, getWidth: function() {
    return 0;
  }, getHeight: function() {
    return 0;
  }, getDepth: function() {
    return 0;
  }, getByteCount: function() {
    return 0;
  }, define: function() {
  }, load: function() {
  }, bind: function(r) {
    e && (e.activeTexture(e.TEXTURE0 + r), e.bindTexture(n, null));
  }, unbind: function(r) {
    e && (e.activeTexture(e.TEXTURE0 + r), e.bindTexture(n, null));
  }, attachFramebuffer: function() {
  }, detachFramebuffer: function() {
  }, reset: function() {
  }, destroy: function() {
  } };
}
var kU = ha();
function Sx(e) {
  var t = e.vertexArrayObject;
  if (!t) throw new Error("VertexArrayObject not supported");
  var n = t.createVertexArray();
  if (!n) throw new Error("Could not create WebGL vertex array");
  return n;
}
function Ax(e) {
  var t = e.vertexArrayObject;
  if (t === null) throw new Error("VertexArrayObject not supported");
  return t;
}
function wx(e) {
  return O(O({}, e.value), { destroy: function() {
    e.free();
  } });
}
function DU(e, t, n, r) {
  var i = { attribute: /* @__PURE__ */ new Set(), elements: /* @__PURE__ */ new Set(), framebuffer: /* @__PURE__ */ new Set(), program: /* @__PURE__ */ new Set(), renderbuffer: /* @__PURE__ */ new Set(), shader: /* @__PURE__ */ new Set(), texture: /* @__PURE__ */ new Set(), vertexArray: /* @__PURE__ */ new Set() };
  function a(l, c) {
    return i[l].add(c), n.resourceCounts[l] += 1, O(O({}, c), { destroy: function() {
      c.destroy(), i[l].delete(c), n.resourceCounts[l] -= 1;
    } });
  }
  var o = hx(function(l) {
    return JSON.stringify(l);
  }, function(l) {
    return a("shader", wU(e, l));
  }, function(l) {
    l.destroy();
  });
  function s(l, c) {
    return wx(o.get({ type: l, source: c }));
  }
  var u = hx(function(l) {
    var c, d = [l.shaderCode.id], f = ((c = l.defineValues.dRenderVariant) === null || c === void 0 ? void 0 : c.ref.value) || "";
    return Object.keys(l.defineValues).forEach(function(p) {
      var g, m;
      !((m = (g = l.shaderCode).ignoreDefine) === null || m === void 0) && m.call(g, p, f, l.defineValues) || d.push(t5(p), function(v) {
        return typeof v == "boolean" ? v ? 1 : 0 : typeof v == "number" ? 1e4 * v : t5(v);
      }(l.defineValues[p].ref.value));
    }), pa(d).toString();
  }, function(l) {
    return a("program", SU(e, t, r, s, l));
  }, function(l) {
    l.destroy();
  });
  return { attribute: function(l, c, d, f) {
    return a("attribute", function(p, g, m, v, h, y, x) {
      x === void 0 && (x = "dynamic");
      var S = m.instancedArrays, b = dx(p, v, x, "attribute"), _ = b._bufferType, C = b._dataType, w = b._bpe;
      return O(O({}, b), { bind: function(I) {
        if (p.bindBuffer(_, b.getBuffer()), h === 16) for (var M = 0; M < 4; ++M) g.enableVertexAttrib(I + M), p.vertexAttribPointer(I + M, 4, C, !1, 16 * w, 4 * M * w), S.vertexAttribDivisor(I + M, y);
        else g.enableVertexAttrib(I), p.vertexAttribPointer(I, h, C, !1, 0, 0), S.vertexAttribDivisor(I, y);
      } });
    }(e, t, r, l, c, d, f));
  }, elements: function(l, c) {
    return a("elements", function(d, f, p) {
      p === void 0 && (p = "static");
      var g = dx(d, f, p, "elements");
      return O(O({}, g), { bind: function() {
        d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, g.getBuffer());
      } });
    }(e, l, c));
  }, framebuffer: function() {
    return a("framebuffer", function(l) {
      var c = mx(l), d = !1;
      return { id: ek(), bind: function() {
        return l.bindFramebuffer(l.FRAMEBUFFER, c);
      }, reset: function() {
        c = mx(l);
      }, destroy: function() {
        d || (l.deleteFramebuffer(c), d = !0);
      } };
    }(e));
  }, program: function(l, c, d) {
    return wx(u.get({ defineValues: l, shaderCode: c, schema: d }));
  }, renderbuffer: function(l, c, d, f) {
    return a("renderbuffer", TU(e, l, c, d, f));
  }, shader: s, texture: function(l, c, d, f) {
    return a("texture", h5(e, r, l, c, d, f));
  }, vertexArray: function(l, c, d) {
    return a("vertexArray", function(f, p, g, m, v) {
      var h = kU(), y = Sx(p), x = Ax(p);
      function S() {
        x.bindVertexArray(y), v && v.bind(), g.bindAttributes(m), x.bindVertexArray(null);
      }
      S();
      var b = !1;
      return { id: h, bind: function() {
        x.bindVertexArray(y);
      }, update: S, reset: function() {
        y = Sx(p), x = Ax(p), S();
      }, destroy: function() {
        b || (v && (x.bindVertexArray(y), f.bindBuffer(f.ELEMENT_ARRAY_BUFFER, null)), x.deleteVertexArray(y), b = !0);
      } };
    }(e, r, l, c, d));
  }, getByteCounts: function() {
    var l = 0;
    i.texture.forEach(function(f) {
      l += f.getByteCount();
    });
    var c = 0;
    i.attribute.forEach(function(f) {
      c += 4 * f.length;
    });
    var d = 0;
    return i.elements.forEach(function(f) {
      d += 4 * f.length;
    }), { texture: l, attribute: c, elements: d };
  }, reset: function() {
    i.attribute.forEach(function(l) {
      return l.reset();
    }), i.elements.forEach(function(l) {
      return l.reset();
    }), i.framebuffer.forEach(function(l) {
      return l.reset();
    }), i.renderbuffer.forEach(function(l) {
      return l.reset();
    }), i.shader.forEach(function(l) {
      return l.reset();
    }), i.program.forEach(function(l) {
      return l.reset();
    }), i.vertexArray.forEach(function(l) {
      return l.reset();
    }), i.texture.forEach(function(l) {
      return l.reset();
    });
  }, destroy: function() {
    i.attribute.forEach(function(l) {
      return l.destroy();
    }), i.elements.forEach(function(l) {
      return l.destroy();
    }), i.framebuffer.forEach(function(l) {
      return l.destroy();
    }), i.renderbuffer.forEach(function(l) {
      return l.destroy();
    }), i.shader.forEach(function(l) {
      return l.destroy();
    }), i.program.forEach(function(l) {
      return l.destroy();
    }), i.vertexArray.forEach(function(l) {
      return l.destroy();
    }), i.texture.forEach(function(l) {
      return l.destroy();
    }), o.clear(), u.clear();
  } };
}
var nk = ha();
function rk(e, t) {
  switch (t) {
    case e.NO_ERROR:
      return "no error";
    case e.INVALID_ENUM:
      return "invalid enum";
    case e.INVALID_VALUE:
      return "invalid value";
    case e.INVALID_OPERATION:
      return "invalid operation";
    case e.INVALID_FRAMEBUFFER_OPERATION:
      return "invalid framebuffer operation";
    case e.OUT_OF_MEMORY:
      return "out of memory";
    case e.CONTEXT_LOST_WEBGL:
      return "context lost";
  }
  return "unknown error";
}
function ik(e) {
  var t = e.getError();
  if (t !== e.NO_ERROR) throw new Error("WebGL error: '".concat(rk(e, t), "'"));
}
function Yh(e) {
  e.bindFramebuffer(e.FRAMEBUFFER, null);
}
var ak = new Uint8Array(4);
function ok(e, t, n) {
  e.getSyncParameter(t, e.SYNC_STATUS) === e.SIGNALED ? (e.deleteSync(t), n()) : D6.setImmediate(ok, e, t, n);
}
function Ix(e, t) {
  var n = e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE, 0);
  n ? D6.setImmediate(ok, e, n, t) : (console.warn("Could not create a WebGLSync object"), e.readPixels(0, 0, 1, 1, e.RGBA, e.UNSIGNED_BYTE, ak), t());
}
var Xg, Px, Mx = !1;
function Ex(e) {
  e.bindFramebuffer(e.FRAMEBUFFER, null), e.readPixels(0, 0, 1, 1, e.RGBA, e.UNSIGNED_BYTE, ak);
}
function vy(e, t, n, r, i, a) {
  if (In && B6(e), a instanceof Uint8Array) e.readPixels(t, n, r, i, e.RGBA, e.UNSIGNED_BYTE, a);
  else if (a instanceof Float32Array) e.readPixels(t, n, r, i, e.RGBA, e.FLOAT, a);
  else {
    if (!(a instanceof Int32Array && Jt(e))) throw new Error("unsupported readPixels buffer type");
    e.readPixels(t, n, r, i, e.RGBA_INTEGER, e.INT, a);
  }
  In && ik(e);
}
function OU(e, t) {
  var n = this;
  t === void 0 && (t = {});
  var r = px(e), i = function(h) {
    var y = {}, x = h.getParameter(h.FRONT_FACE), S = h.getParameter(h.CULL_FACE_MODE), b = h.getParameter(h.DEPTH_WRITEMASK), _ = h.getParameter(h.COLOR_WRITEMASK), C = h.getParameter(h.COLOR_CLEAR_VALUE), w = h.getParameter(h.BLEND_SRC_RGB), I = h.getParameter(h.BLEND_DST_RGB), M = h.getParameter(h.BLEND_SRC_ALPHA), E = h.getParameter(h.BLEND_DST_ALPHA), T = h.getParameter(h.BLEND_EQUATION_RGB), P = h.getParameter(h.BLEND_EQUATION_ALPHA), k = h.getParameter(h.MAX_VERTEX_ATTRIBS), D = [], B = function() {
      for (var L = 0; L < k; ++L) D[L] = 0;
    };
    return B(), { currentProgramId: -1, currentMaterialId: -1, currentRenderItemId: -1, enable: function(L) {
      y[L] !== !0 && (h.enable(L), y[L] = !0);
    }, disable: function(L) {
      y[L] !== !1 && (h.disable(L), y[L] = !1);
    }, frontFace: function(L) {
      L !== x && (h.frontFace(L), x = L);
    }, cullFace: function(L) {
      L !== S && (h.cullFace(L), S = L);
    }, depthMask: function(L) {
      L !== b && (h.depthMask(L), b = L);
    }, colorMask: function(L, F, V, G) {
      L === _[0] && F === _[1] && V === _[2] && G === _[3] || (h.colorMask(L, F, V, G), _[0] = L, _[1] = F, _[2] = V, _[3] = G);
    }, clearColor: function(L, F, V, G) {
      L === C[0] && F === C[1] && V === C[2] && G === C[3] || (h.clearColor(L, F, V, G), C[0] = L, C[1] = F, C[2] = V, C[3] = G);
    }, blendFunc: function(L, F) {
      L === w && F === I && L === M && F === E || (h.blendFunc(L, F), w = L, I = F, M = L, E = F);
    }, blendFuncSeparate: function(L, F, V, G) {
      L === w && F === I && V === M && G === E || (h.blendFuncSeparate(L, F, V, G), w = L, I = F, M = V, E = G);
    }, blendEquation: function(L) {
      L === T && L === P || (h.blendEquation(L), T = L, P = L);
    }, blendEquationSeparate: function(L, F) {
      L === T && F === P || (h.blendEquationSeparate(L, F), T = L, P = F);
    }, enableVertexAttrib: function(L) {
      h.enableVertexAttribArray(L), D[L] = 1;
    }, clearVertexAttribsState: B, disableUnusedVertexAttribs: function() {
      for (var L = 0; L < k; ++L) D[L] === 0 && h.disableVertexAttribArray(L);
    }, reset: function() {
      y = {}, x = h.getParameter(h.FRONT_FACE), S = h.getParameter(h.CULL_FACE_MODE), b = h.getParameter(h.DEPTH_WRITEMASK), _ = h.getParameter(h.COLOR_WRITEMASK), C = h.getParameter(h.COLOR_CLEAR_VALUE), w = h.getParameter(h.BLEND_SRC_RGB), I = h.getParameter(h.BLEND_DST_RGB), M = h.getParameter(h.BLEND_SRC_ALPHA), E = h.getParameter(h.BLEND_DST_ALPHA), T = h.getParameter(h.BLEND_EQUATION_RGB), P = h.getParameter(h.BLEND_EQUATION_ALPHA), k = h.getParameter(h.MAX_VERTEX_ATTRIBS), D.length = 0;
      for (var L = 0; L < k; ++L) D[L] = 0;
    } };
  }(e), a = { resourceCounts: { attribute: 0, elements: 0, framebuffer: 0, program: 0, renderbuffer: 0, shader: 0, texture: 0, vertexArray: 0 }, drawCount: 0, instanceCount: 0, instancedDrawCount: 0 }, o = DU(e, i, a, r), s = { maxTextureSize: e.getParameter(e.MAX_TEXTURE_SIZE), max3dTextureSize: Jt(e) ? e.getParameter(e.MAX_3D_TEXTURE_SIZE) : 0, maxRenderbufferSize: e.getParameter(e.MAX_RENDERBUFFER_SIZE), maxDrawBuffers: r.drawBuffers ? e.getParameter(r.drawBuffers.MAX_DRAW_BUFFERS) : 0, maxTextureImageUnits: e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS), maxVertexTextureImageUnits: e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS) };
  if (s.maxVertexTextureImageUnits < 8) throw new Error('Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8');
  var u, l = !1, c = new Fc(0);
  if (Jt(e)) {
    var d = e.createBuffer(), f = void 0, p = void 0, g = !1, m = function() {
      e.bindBuffer(e.PIXEL_PACK_BUFFER, d), e.getBufferSubData(e.PIXEL_PACK_BUFFER, 0, f), e.bindBuffer(e.PIXEL_PACK_BUFFER, null), g = !1, p(), p = void 0, f = void 0;
    };
    u = function(h, y, x, S, b) {
      return new Promise(function(_, C) {
        g ? C("Can not call multiple readPixelsAsync at the same time") : (g = !0, e.bindBuffer(e.PIXEL_PACK_BUFFER, d), e.bufferData(e.PIXEL_PACK_BUFFER, x * S * 4, e.STREAM_READ), e.readPixels(h, y, x, S, e.RGBA, e.UNSIGNED_BYTE, 0), e.bindBuffer(e.PIXEL_PACK_BUFFER, null), p = _, f = b, Ix(e, m));
      });
    };
  } else u = function(h, y, x, S, b) {
    return se(n, 0, void 0, function() {
      return ie(this, function(_) {
        return vy(e, h, y, x, S, b), [2];
      });
    });
  };
  var v = /* @__PURE__ */ new Set();
  return { gl: e, isWebGL2: Jt(e), get pixelRatio() {
    return (typeof window < "u" && window.devicePixelRatio || 1) * (t.pixelScale || 1);
  }, extensions: r, state: i, stats: a, resources: o, get maxTextureSize() {
    return s.maxTextureSize;
  }, get max3dTextureSize() {
    return s.max3dTextureSize;
  }, get maxRenderbufferSize() {
    return s.maxRenderbufferSize;
  }, get maxDrawBuffers() {
    return s.maxDrawBuffers;
  }, get maxTextureImageUnits() {
    return s.maxTextureImageUnits;
  }, namedComputeRenderables: /* @__PURE__ */ Object.create(null), namedFramebuffers: /* @__PURE__ */ Object.create(null), namedTextures: /* @__PURE__ */ Object.create(null), get isContextLost() {
    return l || e.isContextLost();
  }, contextRestored: c, setContextLost: function() {
    l = !0;
  }, handleContextRestored: function(h) {
    Object.assign(r, px(e)), i.reset(), i.currentMaterialId = -1, i.currentProgramId = -1, i.currentRenderItemId = -1, o.reset(), v.forEach(function(y) {
      return y.reset();
    }), h == null || h(), l = !1, c.next(Wr());
  }, createRenderTarget: function(h, y, x, S, b) {
    var _ = function(C, w, I, M, E, T, P) {
      E === void 0 && (E = !0), T === void 0 && (T = "uint8"), P === void 0 && (P = "nearest");
      var k = w.framebuffer(), D = T === "fp16" ? w.texture("image-float16", "rgba", "fp16", P) : T === "float32" ? w.texture("image-float32", "rgba", "float", P) : w.texture("image-uint8", "rgba", "ubyte", P), B = E ? Jt(C) ? w.renderbuffer("depth32f", "depth", I, M) : w.renderbuffer("depth16", "depth", I, M) : null;
      function L() {
        D.define(I, M), D.attachFramebuffer(k, "color0"), B && B.attachFramebuffer(k);
      }
      L();
      var F = !1;
      return { id: nk(), texture: D, framebuffer: k, getWidth: function() {
        return I;
      }, getHeight: function() {
        return M;
      }, bind: function() {
        k.bind();
      }, setSize: function(V, G) {
        I === V && M === G || (I = V, M = G, D.define(I, M), B && B.setSize(I, M));
      }, reset: function() {
        L();
      }, destroy: function() {
        F || (D.destroy(), k.destroy(), B && B.destroy(), F = !0);
      } };
    }(e, o, h, y, x, S, b);
    return v.add(_), O(O({}, _), { destroy: function() {
      _.destroy(), v.delete(_);
    } });
  }, unbindFramebuffer: function() {
    return Yh(e);
  }, readPixels: function(h, y, x, S, b) {
    vy(e, h, y, x, S, b);
  }, readPixelsAsync: u, waitForGpuCommandsComplete: function() {
    return function(h) {
      return new Promise(function(y) {
        Jt(h) ? Ix(h, y) : (Mx || (console.info("Sync object not supported in WebGL"), Mx = !0), Ex(h), y());
      });
    }(e);
  }, waitForGpuCommandsCompleteSync: function() {
    return Ex(e);
  }, getDrawingBufferPixelData: function() {
    return function(h) {
      var y = h.drawingBufferWidth, x = h.drawingBufferHeight, S = new Uint8Array(y * x * 4);
      return Yh(h), h.viewport(0, 0, y, x), vy(h, 0, 0, y, x, S), cf.flipY(cf.create(S, y, x));
    }(e);
  }, clear: function(h, y, x, S) {
    Yh(e), i.enable(e.SCISSOR_TEST), i.depthMask(!0), i.colorMask(!0, !0, !0, !0), i.clearColor(h, y, x, S), e.viewport(0, 0, e.drawingBufferWidth, e.drawingBufferHeight), e.scissor(0, 0, e.drawingBufferWidth, e.drawingBufferHeight), e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT);
  }, destroy: function(h) {
    var y, x;
    o.destroy(), function(S) {
      for (var b = S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS), _ = 0; _ < b; ++_) S.activeTexture(S.TEXTURE0 + _), S.bindTexture(S.TEXTURE_2D, null), S.bindTexture(S.TEXTURE_CUBE_MAP, null), Jt(S) && (S.bindTexture(S.TEXTURE_2D_ARRAY, null), S.bindTexture(S.TEXTURE_3D, null));
      var C = S.createBuffer();
      S.bindBuffer(S.ARRAY_BUFFER, C);
      var w = S.getParameter(S.MAX_VERTEX_ATTRIBS);
      for (_ = 0; _ < w; ++_) S.vertexAttribPointer(_, 1, S.FLOAT, !1, 0, 0);
      S.bindBuffer(S.ARRAY_BUFFER, null), S.bindBuffer(S.ELEMENT_ARRAY_BUFFER, null), S.bindRenderbuffer(S.RENDERBUFFER, null), Yh(S);
    }(e), h != null && h.doNotForceWebGLContextLoss || ((y = e.getExtension("WEBGL_lose_context")) === null || y === void 0 || y.loseContext(), (x = e.getExtension("STACKGL_destroy_context")) === null || x === void 0 || x.destroy());
  } };
}
function yy(e, t) {
  return { value: e, unit: t };
}
function Us(e) {
  return e;
}
(function(e) {
  e.create = function(o, s, u) {
    var l = !!o[0].cell, c = !!o[0].velocities, d = !!o[0].forces;
    return { id: di.create22(), frames: o, hasCell: l, hasVelocities: c, hasForces: d, deltaTime: s, timeOffset: u };
  }, e.getAtomicConformation = function(o, s, u) {
    var l = o.x, c = o.y, d = o.z;
    return o.xyzOrdering.frozen ? u ? o.xyzOrdering.isIdentity ? (l = i(l, u), c = i(c, u), d = i(d, u)) : Pa(o.xyzOrdering.index, u) || (l = r(l, o.xyzOrdering.index, u), c = r(c, o.xyzOrdering.index, u), d = r(d, o.xyzOrdering.index, u)) : o.xyzOrdering.isIdentity || (l = a(l, o.xyzOrdering.index), c = a(c, o.xyzOrdering.index), d = a(d, o.xyzOrdering.index)) : u && (o.xyzOrdering.isIdentity ? (o.xyzOrdering.isIdentity = !1, o.xyzOrdering.index = u, n(l, u), n(c, u), n(d, u)) : Pa(o.xyzOrdering.index, u) || (l = r(l, o.xyzOrdering.index, u), c = r(c, o.xyzOrdering.index, u), d = r(d, o.xyzOrdering.index, u))), o.xyzOrdering.frozen = !0, { id: di.create22(), atomId: s, occupancy: Q.ofConst(1, o.elementCount, Q.Schema.int), B_iso_or_equiv: Q.ofConst(0, o.elementCount, Q.Schema.float), xyzDefined: !0, x: l, y: c, z: d };
  };
  var t = [0.123];
  function n(o, s) {
    for (var u = t, l = 0, c = o.length; l < c; l++) u[l] = o[s[l]];
    for (l = 0, c = o.length; l < c; l++) o[l] = u[l];
  }
  function r(o, s, u) {
    for (var l = new Float32Array(o.length), c = 0, d = o.length; c < d; c++) l[c] = o[s[u[c]]];
    return l;
  }
  function i(o, s) {
    for (var u = new Float32Array(o.length), l = 0, c = o.length; l < c; l++) u[l] = o[s[l]];
    return u;
  }
  function a(o, s) {
    for (var u = new Float32Array(o.length), l = 0, c = o.length; l < c; l++) u[s[l]] = o[l];
    return u;
  }
})(Xg || (Xg = {})), function(e) {
  e.create = function(t, n, r, i) {
    return { id: di.create22(), label: t, basic: n, sourceData: i, bonds: r };
  };
}(Px || (Px = {})), function(e) {
  e.getUUID = function(t) {
    return t.__key || (t.__key = di.create22()), t.__key;
  };
}(Us || (Us = {}));
var to, Rm = function() {
  function e() {
    this._list = [], this._set = /* @__PURE__ */ new Set(), this._refs = /* @__PURE__ */ new Map(), this._assets = /* @__PURE__ */ new Map();
  }
  return Object.defineProperty(e.prototype, "all", { get: function() {
    return this._list;
  }, enumerable: !1, configurable: !0 }), e.prototype.add = function(t) {
    this._set.has(t) || (this._list.push(t), this._set.add(t));
  }, e.prototype.reference = function(t, n) {
    var r = this._refs.get(t) || 0;
    r += n ? 1 : -1, this._refs.set(t, Math.max(r, 0));
  }, e.prototype.hasReference = function(t) {
    return (this._refs.get(t) || 0) > 0;
  }, e.prototype.has = function(t) {
    return this._set.has(t);
  }, e.prototype.assets = function(t, n) {
    var r = this._assets.get(t);
    if (r) for (var i = 0, a = r; i < a.length; i++)
      a[i].dispose();
    n ? this._assets.set(t, n) : this._assets.delete(t);
  }, e.prototype.dispose = function() {
    this._assets.forEach(function(t) {
      for (var n = 0, r = t; n < r.length; n++)
        r[n].dispose();
    });
  }, e;
}();
function sk(e, t, n, r, i) {
  for (var a = e.b, o = e.offset, s = [], u = 0, l = t.length; u < l; ++u) for (var c = t[u], d = o[c], f = o[c + 1]; d < f; ++d) {
    var p = a[d];
    if (!i.has(p)) {
      if (Me.has(n, p)) return !0;
      i.add(p), s[s.length] = p;
    }
  }
  return r > 1 && sk(e, s, n, r - 1, i);
}
(function(e) {
  e.areEqual = function(s, u) {
    if (s === u) return !0;
    if (s.vertexCount !== u.vertexCount || s.edgeCount !== u.edgeCount) return !1;
    for (var l = s.a, c = s.b, d = s.offset, f = u.a, p = u.b, g = u.offset, m = 0, v = s.a.length; m < v; m++) if (l[m] !== f[m]) return !1;
    for (m = 0, v = s.b.length; m < v; m++) if (c[m] !== p[m]) return !1;
    for (m = 0, v = s.offset.length; m < v; m++) if (d[m] !== g[m]) return !1;
    for (var h = 0, y = Object.keys(s.edgeProps); h < y.length; h++) {
      var x = y[h], S = s.edgeProps[x], b = u.edgeProps[x];
      if (!b) return !1;
      for (m = 0, v = S.length; m < v; m++) if (S[m] !== b[m]) return !1;
    }
    return !0;
  };
  var t = function() {
    function s(u, l, c, d, f, p) {
      this.offset = u, this.a = l, this.b = c, this.edgeCount = d, this.props = p, this.vertexCount = u.length - 1, this.edgeProps = f || {};
    }
    return s.prototype.getEdgeIndex = function(u, l) {
      var c, d;
      u < l ? (c = u, d = l) : (c = l, d = u);
      for (var f = this.offset[c], p = this.offset[c + 1]; f < p; f++) if (this.b[f] === d) return f;
      return -1;
    }, s.prototype.getDirectedEdgeIndex = function(u, l) {
      for (var c = this.offset[u], d = this.offset[u + 1]; c < d; c++) if (this.b[c] === l) return c;
      return -1;
    }, s.prototype.getVertexEdgeCount = function(u) {
      return this.offset[u + 1] - this.offset[u];
    }, s;
  }();
  function n(s, u, l, c, d, f) {
    return new t(s, u, l, c, d, f);
  }
  e.create = n;
  var r = function() {
    function s(u, l, c) {
      this.vertexCount = u, this.xs = l, this.ys = c, this.current = 0, this.curA = 0, this.curB = 0, this.edgeCount = l.length, this.offsets = new Int32Array(this.vertexCount + 1), this.bucketFill = new Int32Array(this.vertexCount);
      for (var d = new Int32Array(this.vertexCount), f = 0, p = this.xs.length; f < p; f++) d[this.xs[f]]++;
      for (f = 0, p = this.ys.length; f < p; f++) d[this.ys[f]]++;
      var g = 0;
      for (f = 0; f < this.vertexCount; f++) this.offsets[f] = g, g += d[f];
      this.offsets[this.vertexCount] = g, this.slotCount = g, this.a = new Int32Array(g), this.b = new Int32Array(g);
    }
    return s.prototype.createGraph = function(u, l) {
      return n(this.offsets, this.a, this.b, this.edgeCount, u, l);
    }, s.prototype.addNextEdge = function() {
      var u = this.xs[this.current], l = this.ys[this.current], c = this.offsets[u] + this.bucketFill[u], d = this.offsets[l] + this.bucketFill[l];
      this.a[c] = u, this.b[c] = l, this.bucketFill[u]++, this.a[d] = l, this.b[d] = u, this.bucketFill[l]++, this.current++, this.curA = c, this.curB = d;
    }, s.prototype.addAllEdges = function() {
      for (var u = 0; u < this.edgeCount; u++) this.addNextEdge();
    }, s.prototype.assignProperty = function(u, l) {
      u[this.curA] = l, u[this.curB] = l;
    }, s;
  }();
  e.EdgeBuilder = r;
  var i = function() {
    function s(u, l, c) {
      this.vertexCount = u, this.xs = l, this.ys = c, this.current = 0, this.curA = 0, this.edgeCount = l.length, this.offsets = new Int32Array(this.vertexCount + 1), this.bucketFill = new Int32Array(this.vertexCount);
      for (var d = new Int32Array(this.vertexCount), f = 0, p = this.xs.length; f < p; f++) d[this.xs[f]]++;
      var g = 0;
      for (f = 0; f < this.vertexCount; f++) this.offsets[f] = g, g += d[f];
      this.offsets[this.vertexCount] = g, this.slotCount = g, this.a = new Int32Array(g), this.b = new Int32Array(g);
    }
    return s.prototype.createGraph = function(u) {
      return n(this.offsets, this.a, this.b, this.edgeCount, u);
    }, s.prototype.addNextEdge = function() {
      var u = this.xs[this.current], l = this.ys[this.current], c = this.offsets[u] + this.bucketFill[u];
      this.a[c] = u, this.b[c] = l, this.bucketFill[u]++, this.current++, this.curA = c;
    }, s.prototype.addAllEdges = function() {
      for (var u = 0; u < this.edgeCount; u++) this.addNextEdge();
    }, s.prototype.assignProperty = function(u, l) {
      u[this.curA] = l;
    }, s;
  }();
  e.DirectedEdgeBuilder = i;
  var a = function() {
    function s(u) {
      this.vertexCount = u, this.xs = [], this.ys = [], this.included = /* @__PURE__ */ new Set();
    }
    return s.prototype.addEdge = function(u, l) {
      var c = u, d = l;
      u > l && (c = l, d = u);
      var f = as(c, d);
      return !this.included.has(f) && (this.included.add(f), this.xs[this.xs.length] = c, this.ys[this.ys.length] = d, !0);
    }, s.prototype.getGraph = function() {
      return o(this.vertexCount, this.xs, this.ys);
    }, s.prototype.getEdgeBuiler = function() {
      return new r(this.vertexCount, this.xs, this.ys);
    }, s;
  }();
  function o(s, u, l) {
    var c = new e.EdgeBuilder(s, u, l);
    return c.addAllEdges(), c.createGraph({});
  }
  e.UniqueEdgeBuilder = a, e.fromVertexPairs = o, e.induceByVertices = function(s, u) {
    for (var l = s.b, c = s.offset, d = s.vertexCount, f = s.edgeProps, p = new Int32Array(d), g = 0, m = u.length; g < m; g++) p[u[g]] = g + 1;
    var v = 0;
    for (g = 0; g < d; g++) if (p[g] !== 0) for (var h = c[g], y = c[g + 1]; h < y; h++) l[h] > g && p[l[h]] !== 0 && v++;
    var x = new Int32Array(u.length + 1), S = new Int32Array(2 * v), b = new Int32Array(2 * v), _ = new Int32Array(2 * v), C = 0, w = 0;
    for (g = 0; g < d; g++) if (p[g] !== 0) {
      var I = p[g] - 1;
      for (h = c[g], y = c[g + 1]; h < y; h++) {
        var M = p[l[h]];
        M !== 0 && (b[C] = I, _[C] = M - 1, S[C] = h, C++);
      }
      x[++w] = C;
    }
    for (var E = {}, T = 0, P = Object.keys(f); T < P.length; T++) {
      var k = P[T];
      E[k] = fG(f[k], S);
    }
    return n(x, b, _, v, E);
  }, e.connectedComponents = function(s) {
    var u = s.vertexCount;
    if (u === 0) return { componentCount: 0, componentIndex: new Int32Array(0) };
    if (s.edgeCount === 0) {
      for (var l = new Int32Array(u), c = 0, d = u; c < d; c++) l[c] = c;
      return { componentCount: u, componentIndex: l };
    }
    var f = new Int32Array(u);
    for (c = 0, d = u; c < d; c++) f[c] = -1;
    var p = 0;
    f[0] = p;
    var g = s.offset, m = s.b, v = [0], h = function(C) {
      return new gz(C);
    }(u);
    for (h.remove(0); v.length > 0; ) {
      for (var y = v.pop(), x = f[y], S = g[y], b = g[y + 1]; S < b; S++) {
        var _ = m[S];
        h.has(_) && (h.remove(_), v.push(_), f[_] = x);
      }
      v.length === 0 && h.head >= 0 && (v.push(h.head), f[h.head] = ++p, h.remove(h.head));
    }
    return { componentCount: u, componentIndex: f };
  }, e.areVertexSetsConnected = function(s, u, l, c) {
    if (Me.areIntersecting(u, l)) return !0;
    if (c < 1) return !1;
    for (var d = /* @__PURE__ */ new Set(), f = 0, p = u.length; f < p; ++f) d.add(u[f]);
    return sk(s, u, l, c, d);
  };
})(to || (to = {}));
var Au, fi, Ye, N1, BU = function() {
  function e() {
    this.map = /* @__PURE__ */ new Map(), this.applicable = /* @__PURE__ */ new Map();
  }
  return e.prototype.add = function(t, n, r) {
    this.map.set(t, n), r && this.applicable.set(t, r);
  }, e.prototype.remove = function(t) {
    this.map.delete(t), this.applicable.delete(t);
  }, e.prototype.get = function(t) {
    return this.map.get(t);
  }, e.prototype.isApplicable = function(t) {
    var n = this.applicable.get(t.sourceData.kind);
    return !n || n(t);
  }, e;
}();
function RU(e, t, n, r) {
  for (var i = new to.EdgeBuilder(r, e, t), a = new Int32Array(i.slotCount), o = new Int8Array(i.slotCount), s = new Array(i.slotCount), u = new Array(i.slotCount), l = 0, c = i.edgeCount; l < c; l++) i.addNextEdge(), i.assignProperty(a, n.key ? n.key[l] : -1), i.assignProperty(o, n.order ? n.order[l] : 1), i.assignProperty(s, n.distance ? n.distance[l] : -1), i.assignProperty(u, n.flag ? n.flag[l] : 1);
  return i.createGraph({ key: a, order: o, distance: s, flag: u });
}
function Fn(e) {
  return function(t) {
    return function(n, r) {
      var i = n.data, a = n.indices, o = n.count, s = r.valueType, u = s === "str" ? function(l) {
        return i.substring(a[2 * l], a[2 * l + 1]);
      } : s === "int" ? function(l) {
        return Qc(i, a[2 * l], a[2 * l + 1]) || 0;
      } : function(l) {
        return sf(i, a[2 * l], a[2 * l + 1]) || 0;
      };
      return { schema: r, __array: void 0, isDefined: !0, rowCount: o, value: u, valueKind: function(l) {
        return 0;
      }, toArray: function(l) {
        return Ri(o, u, l);
      }, areValuesEqual: uk(n) };
    }(e, t);
  };
}
function uk(e) {
  var t = e.data, n = e.indices;
  return function(r, i) {
    var a = n[2 * r], o = n[2 * i], s = n[2 * r + 1] - a;
    if (s !== n[2 * i + 1] - o) return !1;
    for (var u = 0; u < s; u++) if (t.charCodeAt(u + a) !== t.charCodeAt(u + o)) return !1;
    return !0;
  };
}
function LU(e) {
  for (var t = e.count, n = e.indices, r = 0; r < t; ++r) if (n[2 * r] !== n[2 * r + 1]) return !1;
  return !0;
}
function lk(e, t) {
  return { name: t, blocks: e };
}
function R6(e, t, n, r) {
  return r === void 0 && (r = []), { categoryNames: e, header: n, categories: t, saveFrames: r, getField: function(i) {
    var a = i.split("."), o = a[0], s = a[1];
    return t[o].getField(s || "");
  } };
}
function Xi(e, t, n, r) {
  return { rowCount: t, name: e, fieldNames: Re([], n, !0), getField: function(i) {
    return r[i];
  } };
}
function qd(e, t, n) {
  return function(r, i, a) {
    for (var o = /* @__PURE__ */ Object.create(null), s = 0, u = Object.keys(r); s < u.length; s++) {
      var l = u[s];
      o[l] = VU(l, r[l], i, a);
    }
    return e5.ofTables(i.header, r, o);
  }(e, t, n);
}
function by(e, t, n, r) {
  return { schema: e, __array: t.__array, isDefined: t.isDefined, rowCount: t.rowCount, value: n, valueKind: t.valueKind, areValuesEqual: t.areValuesEqual, toArray: r };
}
function NU(e, t, n) {
  var r = e.space, i = t.fieldNames.includes("".concat(n, "[0]")) || t.fieldNames.includes("".concat(n, "[0][0]")) || t.fieldNames.includes("".concat(n, "[0][0][0]")), a = i ? 0 : 1, o = t.fieldNames.includes("".concat(n, "_1")) || t.fieldNames.includes("".concat(n, "_11")) || t.fieldNames.includes("".concat(n, "_111")) ? "underscore" : "brackets", s = function(c, d, f, p) {
    var g = f ? 0 : 1;
    switch (d) {
      case 1:
        return p === "brackets" ? function(m) {
          return "".concat(c, "[").concat(m + g, "]");
        } : function(m) {
          return "".concat(c, "_").concat(m + g);
        };
      case 2:
        return p === "brackets" ? function(m, v) {
          return "".concat(c, "[").concat(m + g, "][").concat(v + g, "]");
        } : function(m, v) {
          return "".concat(c, "_").concat(m + g).concat(v + g);
        };
      case 3:
        return p === "brackets" ? function(m, v, h) {
          return "".concat(c, "[").concat(m + g, "][").concat(v + g, "][").concat(h + g, "]");
        } : function(m, v, h) {
          return "".concat(c, "_").concat(m + g).concat(v + g).concat(h + g);
        };
      default:
        throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.");
    }
  }(n, r.rank, i, o), u = t.getField(s(a, a, a)) || Q.Undefined(t.rowCount, e), l = function(c) {
    return function(d, f, p, g) {
      var m = f.create();
      if (f.rank === 1) for (var v = f.dimensions[0], h = 0; h < v; h++) {
        var y = d.getField(g(h));
        f.set(m, h, y ? y.float(p) : 0);
      }
      else if (f.rank === 2) {
        v = f.dimensions[0];
        var x = f.dimensions[1];
        for (h = 0; h < v; h++) for (var S = 0; S < x; S++) y = d.getField(g(h, S)), f.set(m, h, S, y ? y.float(p) : 0);
      } else {
        if (f.rank !== 3) throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.");
        var b = f.dimensions[0], _ = f.dimensions[1], C = f.dimensions[2];
        for (h = 0; h < b; h++) for (S = 0; S < _; S++) for (var w = 0; w < C; w++) y = d.getField(g(h, S, w)), f.set(m, h, S, w, y ? y.float(p) : 0);
      }
      return m;
    }(t, r, c, s);
  };
  return { schema: e, __array: void 0, isDefined: u.isDefined, rowCount: t.rowCount, value: l, valueKind: u.valueKind, areValuesEqual: function(c, d) {
    return wr.areEqualExact(l(c), l(d));
  }, toArray: function(c) {
    return Ri(t.rowCount, l, c);
  } };
}
(function(e) {
  e.create = function(t, n) {
    var r = t.name, i = new BU();
    return { descriptor: t, formatRegistry: i, isApplicable: function(a) {
      return i.isApplicable(a);
    }, get: function(a) {
      var o = n != null && n.asDynamic ? a._dynamicPropertyData : a._staticPropertyData;
      if (o[r]) return o[r];
      if (!a.customProperties.has(t)) {
        var s = i.get(a.sourceData.kind);
        if (s) return o[r] = s(a), a.customProperties.add(t), o[r];
      }
    }, set: function(a, o) {
      n != null && n.asDynamic ? a._dynamicPropertyData[r] = o : a._staticPropertyData[r] = o;
    }, delete: function(a) {
      n != null && n.asDynamic ? delete a._dynamicPropertyData[r] : delete a._staticPropertyData[r];
    } };
  };
})(Au || (Au = {})), function(e) {
  e.Descriptor = { name: "index_pair_bonds" }, e.Provider = Au.create(e.Descriptor, { asDynamic: !0 }), e.DefaultProps = { maxDistance: -1 }, e.fromData = function(t, n) {
    n === void 0 && (n = {});
    var r = O(O({}, e.DefaultProps), n), i = t.pairs, a = t.count;
    return { bonds: RU(i.indexA.toArray(), i.indexB.toArray(), { key: i.key && i.key.toArray(), order: i.order && i.order.toArray(), distance: i.distance && i.distance.toArray(), flag: i.flag && i.flag.toArray() }, a), maxDistance: r.maxDistance };
  };
}(fi || (fi = {})), function(e) {
  function t(n, r) {
    var i = Object.keys(r);
    return { rowCount: i.length > 0 ? r[i[0]].rowCount : 0, name: n, fieldNames: i, getField: function(a) {
      return r[a];
    } };
  }
  e.empty = function(n) {
    return { rowCount: 0, name: n, fieldNames: [], getField: function(r) {
    } };
  }, e.ofFields = t, e.ofTable = function(n, r) {
    for (var i = {}, a = 0, o = r._columns; a < o.length; a++) {
      var s = o[a];
      i[s] = Ye.ofColumn(r[s]);
    }
    return t(n, i);
  };
}(Xi || (Xi = {})), function(e) {
  function t(r) {
    var i = r.length, a = function(u) {
      var l = r[u];
      return l && l !== "." && l !== "?" ? l : "";
    }, o = function(u) {
      var l = r[u];
      return Qc(l, 0, l.length) || 0;
    }, s = function(u) {
      var l = r[u];
      return sf(l, 0, l.length) || 0;
    };
    return { __array: void 0, binaryEncoding: void 0, isDefined: !0, rowCount: i, str: a, int: o, float: s, valueKind: function(u) {
      var l = r[u], c = l.length;
      if (c > 1) return 0;
      if (c === 0) return 1;
      var d = l.charCodeAt(0);
      return d === 46 ? 1 : d === 63 ? 2 : 0;
    }, areValuesEqual: function(u, l) {
      return r[u] === r[l];
    }, toStringArray: function(u) {
      return u ? Ri(i, a, u) : r;
    }, toIntArray: function(u) {
      return Ri(i, o, u);
    }, toFloatArray: function(u) {
      return Ri(i, s, u);
    } };
  }
  function n(r) {
    var i, a, o, s = r.rowCount, u = r.valueKind, l = r.areValuesEqual, c = r.isDefined;
    switch (r.schema.valueType) {
      case "float":
      case "int":
        i = function(f) {
          return "" + r.value(f);
        }, a = r.value, o = r.value;
        break;
      case "str":
        i = r.value, a = function(f) {
          var p = r.value(f);
          return Qc(p, 0, p.length) || 0;
        }, o = function(f) {
          var p = r.value(f);
          return sf(p, 0, p.length) || 0;
        };
        break;
      case "list":
        var d = r.schema.separator;
        i = function(f) {
          return r.value(f).join(d);
        }, a = function(f) {
          return NaN;
        }, o = function(f) {
          return NaN;
        };
        break;
      default:
        throw new Error("unsupported valueType '".concat(r.schema.valueType, "'"));
    }
    return { __array: void 0, binaryEncoding: void 0, isDefined: c, rowCount: s, str: i, int: a, float: o, valueKind: u, areValuesEqual: l, toStringArray: function(f) {
      return Ri(s, i, f);
    }, toIntArray: function(f) {
      return Ri(s, a, f);
    }, toFloatArray: function(f) {
      return Ri(s, o, f);
    } };
  }
  e.ofString = function(r) {
    return t([r]);
  }, e.ofStrings = t, e.ofNumbers = function(r) {
    var i = r.length, a = function(u) {
      return "" + r[u];
    }, o = function(u) {
      return r[u];
    }, s = function(u) {
      return !u || u.array && r instanceof u.array ? r : Ri(i, o, u);
    };
    return { __array: void 0, binaryEncoding: void 0, isDefined: !0, rowCount: i, str: a, int: o, float: o, valueKind: function(u) {
      return 0;
    }, areValuesEqual: function(u, l) {
      return r[u] === r[l];
    }, toStringArray: function(u) {
      return Ri(i, a, u);
    }, toIntArray: s, toFloatArray: s };
  }, e.ofTokens = function(r) {
    var i = r.data, a = r.indices, o = r.count, s = function(c) {
      var d = i.substring(a[2 * c], a[2 * c + 1]);
      return d === "." || d === "?" ? "" : d;
    }, u = function(c) {
      return Qc(i, a[2 * c], a[2 * c + 1]) || 0;
    }, l = function(c) {
      return sf(i, a[2 * c], a[2 * c + 1]) || 0;
    };
    return { __array: void 0, binaryEncoding: void 0, isDefined: !0, rowCount: o, str: s, int: u, float: l, valueKind: function(c) {
      var d = a[2 * c], f = a[2 * c + 1] - d;
      if (f > 1) return 0;
      if (f === 0) return 1;
      var p = i.charCodeAt(d);
      return p === 46 ? 1 : p === 63 ? 2 : 0;
    }, areValuesEqual: uk(r), toStringArray: function(c) {
      return Ri(o, s, c);
    }, toIntArray: function(c) {
      return Ri(o, u, c);
    }, toFloatArray: function(c) {
      return Ri(o, l, c);
    } };
  }, e.ofColumn = n, e.ofUndefined = function(r, i) {
    return n(Q.Undefined(r, i));
  };
}(Ye || (Ye = {})), function(e) {
  function t(n) {
    return n.replace(".", "_").replace(/\[/, "_").replace(/(\[|\])/g, "");
  }
  e.canonical = t, e.equal = function(n, r) {
    return t(n) === t(r);
  }, e.create = function(n, r, i) {
    i === void 0 && (i = !1);
    var a = "".concat(n).concat(r ? ".".concat(r) : "");
    return i ? t(a) : a;
  };
}(N1 || (N1 = {}));
var lr, ck = function(e, t, n) {
  this._isDefined = n;
  var r = Object.keys(t);
  this._rowCount = e.rowCount, this._columns = r, this._schema = t;
  for (var i = /* @__PURE__ */ Object.create(null), a = function(l) {
    Object.defineProperty(o, l, { get: function() {
      if (i[l]) return i[l];
      var c = t[l];
      if (c.valueType === "list") i[l] = function(p, g, m) {
        var v = p.separator, h = p.itemParse, y = g.getField(m), x = y ? function(S) {
          return y.str(S).split(v).map(function(b) {
            return h(b.trim());
          }).filter(function(b) {
            return !!b;
          });
        } : function(S) {
          return [];
        };
        return { schema: p, __array: void 0, isDefined: !!y, rowCount: g.rowCount, value: x, valueKind: y ? y.valueKind : function() {
          return 1;
        }, areValuesEqual: function(S, b) {
          return Pa(x(S), x(b));
        }, toArray: function(S) {
          return Ri(g.rowCount, x, S);
        } };
      }(c, e, l);
      else if (c.valueType === "tensor") i[l] = NU(c, e, l);
      else {
        var d = function(p) {
          switch (p.valueType) {
            case "str":
              return function(g, m, v) {
                return by(p, g, g.str, g.toStringArray);
              };
            case "int":
              return function(g, m, v) {
                return by(p, g, g.int, g.toIntArray);
              };
            case "float":
              return function(g, m, v) {
                return by(p, g, g.float, g.toFloatArray);
              };
            case "list":
              throw new Error("Use createListColumn instead.");
            case "tensor":
              throw new Error("Use createTensorColumn instead.");
          }
        }(c), f = e.getField(l);
        i[l] = f ? d(f, e, l) : Q.Undefined(e.rowCount, c);
      }
      return i[l];
    }, enumerable: !0, configurable: !1 });
  }, o = this, s = 0, u = r; s < u.length; s++) a(u[s]);
};
function FU(e, t, n, r) {
  var i = N1.create(t, e), a = N1.canonical(i);
  if (a in n) return n[a];
  if (r && i in r) for (var o = 0, s = r[i]; o < s.length; o++) {
    var u = s[o], l = N1.canonical(u);
    if (l in n) return n[l];
  }
}
function VU(e, t, n, r) {
  var i = n.categories[e];
  if (r) {
    for (var a = function(p) {
      for (var g = /* @__PURE__ */ Object.create(null), m = 0, v = Object.keys(p.categories); m < v.length; m++) for (var h = v[m], y = 0, x = p.categories[h].fieldNames; y < x.length; y++) {
        var S = x[y];
        g[N1.create(h, S, !0)] = p.categories[h].getField(S);
      }
      return g;
    }(n), o = /* @__PURE__ */ Object.create(null), s = [], u = 0, l = 0, c = Object.keys(t); l < c.length; l++) {
      var d = c[l], f = FU(d, e, a, r);
      f && (o[d] = f, s.push(d), u = f.rowCount);
    }
    i = { rowCount: u, name: e, fieldNames: Re([], s, !0), getField: function(p) {
      return o[p];
    } };
  }
  return new ck(i || Xi.empty(e), t, !!i);
}
function _y(e, t, n) {
  for (var r = new Float32Array(e), i = 0; i < r.length; i++) r[i] = t + n * i;
  return r;
}
function GU(e) {
  return 0;
}
function xy(e) {
  return function(t) {
    return e[t];
  };
}
function o3(e) {
  return e[3] === 0 && e[7] === 0 && e[11] === 0 && e[15] === 1;
}
function zU(e, t) {
  var n = e.matrix, r = t.x, i = t.y, a = t.z, o = n[0], s = n[4], u = n[8], l = n[12];
  return o3(n) ? function(c) {
    return o * r[c] + s * i[c] + u * a[c] + l;
  } : function(c) {
    var d = r[c], f = i[c], p = a[c], g = n[3] * d + n[7] * f + n[11] * p + n[15] || 1;
    return (o * d + s * f + u * p + l) / g;
  };
}
function UU(e, t) {
  var n = e.matrix, r = t.x, i = t.y, a = t.z, o = n[1], s = n[5], u = n[9], l = n[13];
  return o3(n) ? function(c) {
    return o * r[c] + s * i[c] + u * a[c] + l;
  } : function(c) {
    var d = r[c], f = i[c], p = a[c], g = n[3] * d + n[7] * f + n[11] * p + n[15] || 1;
    return (o * d + s * f + u * p + l) / g;
  };
}
function HU(e, t) {
  var n = e.matrix, r = t.x, i = t.y, a = t.z, o = n[2], s = n[6], u = n[10], l = n[14];
  return o3(n) ? function(c) {
    return o * r[c] + s * i[c] + u * a[c] + l;
  } : function(c) {
    var d = r[c], f = i[c], p = a[c], g = n[3] * d + n[7] * f + n[11] * p + n[15] || 1;
    return (o * d + s * f + u * p + l) / g;
  };
}
(function(e) {
  function t(o, s, u) {
    var l = u || {}, c = l.assembly, d = l.ncsId, f = l.hkl, p = l.spgrOp, g = f ? A.clone(f) : A();
    p = ui(p, -1), d = d || -1;
    var m = ne.isIdentity(s), v = function(h, y) {
      if (!h) return "";
      if (h.assembly) return function(C) {
        return !!C && !!C.matrix && !!C.inverse && typeof C.name == "string";
      }(h) ? h.suffix : y ? "" : "_".concat(h.assembly.operId);
      if (h.spgrOp !== void 0 && h.hkl !== void 0 && h.spgrOp !== -1) {
        var x = h.hkl, S = x[0], b = x[1], _ = x[2];
        return "-".concat(h.spgrOp + 1, "_").concat(5 + S).concat(5 + b).concat(5 + _);
      }
      return h.ncsId !== -1 ? "_".concat(h.ncsId) : "";
    }(u, m);
    return m ? { name: o, assembly: c, matrix: s, inverse: ne.identity(), isIdentity: !0, hkl: g, spgrOp: p, ncsId: d, suffix: v } : (ne.isRotationAndTranslation(s, e.RotationTranslationEpsilon) || console.warn("Symmetry operator (".concat(o, ") should be a composition of rotation and translation.")), { name: o, assembly: c, matrix: s, inverse: ne.invert(ne(), s), isIdentity: !1, hkl: g, spgrOp: p, ncsId: d, suffix: v });
  }
  e.DefaultName = "1_555", e.Default = t(e.DefaultName, ne.identity()), e.RotationTranslationEpsilon = 5e-3, e.create = t, e.checkIfRotationAndTranslation = function(o, s) {
    for (var u = ne.identity(), l = 0; l < 3; l++) for (var c = 0; c < 3; c++) ne.setValue(u, l, c, pi.getValue(o, l, c));
    return ne.setTranslation(u, s), ne.isRotationAndTranslation(u, e.RotationTranslationEpsilon);
  }, e.ofRotationAndOffset = function(o, s, u, l) {
    for (var c = ne.identity(), d = 0; d < 3; d++) for (var f = 0; f < 3; f++) ne.setValue(c, d, f, pi.getValue(s, d, f));
    return ne.setTranslation(c, u), t(o, c, { ncsId: l });
  };
  var n = yr.identity(), r = yr(), i = yr(), a = A();
  e.lerpFromIdentity = function(o, s, u) {
    var l = s.inverse;
    if (s.isIdentity) return ne.copy(o, l);
    var c = 1 - u;
    ne.getRotation(r, l), yr.slerp(r, n, r, c);
    var d = yr.getAxisAngle(a, r);
    return ne.fromRotation(o, d, a), ne.setValue(o, 0, 3, c * ne.getValue(l, 0, 3)), ne.setValue(o, 1, 3, c * ne.getValue(l, 1, 3)), ne.setValue(o, 2, 3, c * ne.getValue(l, 2, 3)), o;
  }, e.slerp = function(o, s, u, l) {
    if (Math.abs(l) <= 1e-5) return ne.copy(o, s);
    if (Math.abs(l - 1) <= 1e-5) return ne.copy(o, u);
    ne.getRotation(r, s), ne.getRotation(i, u), yr.slerp(i, r, i, l);
    var c = yr.getAxisAngle(a, i);
    return ne.fromRotation(o, c, a), ne.setValue(o, 0, 3, si(ne.getValue(s, 0, 3), ne.getValue(u, 0, 3), l)), ne.setValue(o, 1, 3, si(ne.getValue(s, 1, 3), ne.getValue(u, 1, 3), l)), ne.setValue(o, 2, 3, si(ne.getValue(s, 2, 3), ne.getValue(u, 2, 3), l)), o;
  }, e.compose = function(o, s) {
    var u = ne.mul(ne(), s.matrix, o.matrix);
    return t(s.name, u, s);
  }, e.createMapping = function(o, s, u) {
    var l = e.createCoordinateMapper(e.Default, s), c = o.isIdentity ? l : e.createCoordinateMapper(o, s), d = function(f, p) {
      return f.isIdentity ? { x: xy(p.x), y: xy(p.y), z: xy(p.z) } : { x: zU(f, p), y: UU(f, p), z: HU(f, p) };
    }(o, s);
    return { operator: o, coordinates: s, invariantPosition: l, position: c, x: d.x, y: d.y, z: d.z, r: u || GU };
  }, e.createCoordinateMapper = function(o, s) {
    return o.isIdentity ? function(u) {
      var l = u.x, c = u.y, d = u.z;
      return function(f, p) {
        return p[0] = l[f], p[1] = c[f], p[2] = d[f], p;
      };
    }(s) : function(u, l) {
      var c = u.matrix, d = l.x, f = l.y, p = l.z;
      return o3(c) ? function(g, m) {
        var v = d[g], h = f[g], y = p[g];
        return m[0] = c[0] * v + c[4] * h + c[8] * y + c[12], m[1] = c[1] * v + c[5] * h + c[9] * y + c[13], m[2] = c[2] * v + c[6] * h + c[10] * y + c[14], m;
      } : function(g, m) {
        return m[0] = d[g], m[1] = f[g], m[2] = p[g], A.transformMat4(m, m, c), m;
      };
    }(o, s);
  };
})(lr || (lr = {}));
var Cy = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [-1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0.5], [1, 0, 0, 0.5], [-1, 0, 0, 0.5], [0, 0, 1, 0.5], [0, -1, 0, 0.5], [0, 0, -1, 0.5], [1, 0, 0, 0.25], [0, -1, 0, 0.25], [0, 0, 1, 0.25], [-1, 0, 0, 0.25], [0, 1, 0, 0.25], [0, -1, 0, 0.75], [0, 0, 1, 0.75], [0, 1, 0, 0.75], [1, 0, 0, 0.75], [-1, 0, 0, 0.75], [0, 0, -1, 0.25], [0, 0, -1, 0.75], [1, -1, 0, 0], [-1, 1, 0, 0], [0, 0, 1, 1 / 3], [0, 0, 1, 2 / 3], [1, 0, 0, 2 / 3], [0, 1, 0, 1 / 3], [0, -1, 0, 2 / 3], [1, -1, 0, 1 / 3], [-1, 1, 0, 2 / 3], [-1, 0, 0, 1 / 3], [1, 0, 0, 1 / 3], [0, 1, 0, 2 / 3], [0, -1, 0, 1 / 3], [1, -1, 0, 2 / 3], [-1, 1, 0, 1 / 3], [-1, 0, 0, 2 / 3], [0, 0, -1, 1 / 3], [0, 0, -1, 2 / 3], [0, 0, 1, 5 / 6], [0, 0, 1, 1 / 6], [0, 0, -1, 5 / 6], [0, 0, -1, 1 / 6]], qU = [[0, 1, 2], [3, 4, 5], [3, 1, 5], [3, 6, 5], [7, 6, 2], [8, 6, 5], [0, 4, 2], [0, 4, 9], [7, 10, 2], [7, 10, 9], [0, 10, 2], [8, 10, 5], [3, 1, 11], [3, 6, 11], [0, 10, 9], [8, 6, 11], [3, 4, 2], [0, 4, 5], [3, 4, 9], [7, 10, 5], [8, 4, 9], [8, 10, 9], [8, 10, 2], [0, 6, 9], [3, 10, 9], [0, 10, 11], [7, 1, 9], [8, 1, 11], [7, 4, 11], [7, 6, 9], [7, 10, 11], [3, 10, 2], [8, 1, 5], [0, 4, 11], [3, 1, 2], [3, 1, 9], [7, 4, 2], [8, 1, 2], [8, 1, 9], [3, 6, 9], [7, 4, 9], [8, 6, 2], [8, 6, 9], [3, 6, 2], [12, 13, 14], [15, 16, 14], [12, 17, 18], [15, 19, 18], [20, 13, 18], [21, 16, 18], [20, 17, 14], [21, 19, 14], [0, 1, 5], [8, 10, 11], [7, 6, 11], [7, 6, 5], [8, 4, 2], [7, 4, 5], [7, 1, 5], [7, 1, 11], [0, 10, 5], [0, 1, 11], [0, 6, 11], [0, 6, 5], [3, 10, 11], [8, 4, 11], [15, 13, 22], [12, 16, 22], [15, 17, 23], [12, 19, 23], [21, 13, 23], [20, 16, 23], [21, 17, 22], [20, 19, 22], [4, 0, 2], [1, 3, 2], [4, 0, 14], [1, 3, 18], [4, 0, 9], [1, 3, 9], [4, 0, 18], [1, 3, 14], [10, 7, 9], [6, 8, 9], [4, 7, 14], [6, 3, 18], [10, 0, 18], [1, 8, 14], [1, 3, 5], [4, 0, 5], [6, 8, 11], [10, 7, 11], [1, 3, 11], [4, 0, 11], [10, 7, 2], [6, 8, 2], [3, 10, 22], [7, 1, 23], [8, 4, 23], [0, 6, 22], [1, 0, 5], [4, 3, 5], [1, 0, 23], [4, 3, 22], [10, 7, 14], [6, 8, 18], [8, 6, 22], [7, 10, 23], [4, 3, 11], [1, 0, 11], [1, 0, 22], [4, 3, 23], [10, 7, 18], [6, 8, 14], [8, 6, 23], [7, 10, 22], [6, 7, 11], [10, 8, 11], [8, 1, 23], [0, 10, 22], [3, 6, 22], [7, 4, 23], [4, 3, 2], [1, 0, 2], [10, 8, 2], [6, 7, 2], [4, 3, 9], [1, 0, 9], [10, 8, 9], [6, 7, 9], [4, 8, 14], [6, 0, 18], [10, 3, 18], [1, 7, 14], [4, 8, 18], [6, 0, 14], [10, 3, 14], [1, 7, 18], [6, 7, 5], [10, 8, 5], [6, 8, 5], [10, 7, 5], [8, 1, 22], [0, 10, 23], [3, 6, 23], [7, 4, 22], [4, 24, 2], [25, 3, 2], [4, 24, 26], [25, 3, 27], [4, 24, 27], [25, 3, 26], [28, 29, 26], [30, 31, 26], [32, 33, 26], [34, 35, 27], [36, 37, 27], [38, 39, 27], [2, 0, 1], [1, 2, 0], [1, 25, 5], [24, 0, 5], [39, 36, 40], [35, 38, 40], [37, 34, 40], [33, 30, 41], [29, 32, 41], [31, 28, 41], [5, 3, 4], [4, 5, 3], [25, 1, 5], [0, 24, 5], [24, 4, 5], [3, 25, 5], [4, 3, 41], [25, 1, 40], [24, 4, 41], [3, 25, 40], [4, 3, 40], [25, 1, 41], [24, 4, 40], [3, 25, 41], [35, 34, 40], [37, 36, 40], [39, 38, 40], [29, 28, 41], [31, 30, 41], [33, 32, 41], [3, 5, 4], [5, 4, 3], [25, 1, 2], [0, 24, 2], [24, 4, 2], [3, 25, 2], [25, 1, 9], [0, 24, 9], [24, 4, 9], [3, 25, 9], [30, 33, 26], [32, 29, 26], [28, 31, 26], [36, 39, 27], [38, 35, 27], [34, 37, 27], [0, 2, 1], [2, 1, 0], [30, 33, 42], [32, 29, 42], [28, 31, 42], [36, 39, 43], [38, 35, 43], [34, 37, 43], [7, 9, 6], [9, 6, 7], [25, 1, 11], [0, 24, 11], [24, 4, 11], [3, 25, 11], [35, 34, 44], [37, 36, 44], [39, 38, 44], [29, 28, 45], [31, 30, 45], [33, 32, 45], [8, 11, 10], [11, 10, 8], [1, 25, 2], [24, 0, 2], [1, 25, 42], [24, 0, 43], [1, 25, 43], [24, 0, 42], [1, 25, 27], [24, 0, 26], [1, 25, 26], [24, 0, 27], [1, 25, 9], [24, 0, 9], [4, 24, 5], [25, 3, 5], [4, 24, 11], [25, 3, 11], [1, 0, 40], [4, 3, 44], [0, 24, 45], [1, 0, 41], [4, 3, 45], [0, 24, 44], [0, 24, 40], [0, 24, 41], [2, 3, 4], [5, 3, 1], [5, 0, 4], [4, 2, 3], [1, 5, 3], [4, 5, 0], [2, 7, 6], [2, 8, 10], [5, 8, 6], [5, 7, 10], [1, 9, 7], [4, 9, 8], [1, 11, 8], [4, 11, 7], [9, 0, 6], [9, 3, 10], [11, 3, 6], [11, 0, 10], [6, 2, 7], [10, 2, 8], [6, 5, 8], [10, 5, 7], [9, 7, 1], [9, 8, 4], [11, 8, 1], [11, 7, 4], [6, 9, 0], [10, 9, 3], [6, 11, 3], [10, 11, 0], [9, 7, 6], [9, 8, 10], [11, 8, 6], [11, 7, 10], [6, 9, 7], [10, 9, 8], [6, 11, 8], [10, 11, 7], [2, 3, 10], [5, 8, 1], [11, 0, 4], [10, 2, 3], [1, 5, 8], [4, 11, 0], [5, 0, 1], [2, 0, 4], [2, 3, 1], [1, 5, 0], [4, 2, 0], [1, 2, 3], [11, 8, 10], [11, 7, 6], [9, 7, 10], [9, 8, 6], [10, 11, 8], [6, 11, 7], [10, 9, 7], [6, 9, 8], [5, 8, 10], [5, 7, 6], [2, 7, 10], [2, 8, 6], [4, 11, 8], [1, 11, 7], [4, 9, 7], [1, 9, 8], [11, 3, 10], [11, 0, 6], [9, 0, 10], [9, 3, 6], [10, 5, 8], [6, 5, 7], [10, 2, 7], [6, 2, 8], [11, 8, 4], [11, 7, 1], [9, 7, 4], [9, 8, 1], [10, 11, 3], [6, 11, 0], [10, 9, 0], [6, 9, 3], [22, 15, 13], [22, 12, 16], [14, 12, 13], [14, 15, 16], [13, 22, 15], [16, 22, 12], [13, 14, 12], [16, 14, 15], [22, 21, 17], [22, 20, 19], [14, 20, 17], [14, 21, 19], [13, 23, 21], [16, 23, 20], [13, 18, 20], [16, 18, 21], [23, 15, 17], [23, 12, 19], [18, 12, 17], [18, 15, 19], [17, 22, 21], [19, 22, 20], [17, 14, 20], [19, 14, 21], [23, 21, 13], [23, 20, 16], [18, 20, 13], [18, 21, 16], [17, 23, 15], [19, 23, 12], [17, 18, 12], [19, 18, 15], [5, 0, 6], [2, 7, 4], [9, 3, 1], [6, 5, 0], [4, 2, 7], [1, 9, 3], [0, 2, 4], [3, 2, 1], [0, 5, 1], [2, 1, 3], [2, 4, 0], [5, 1, 0], [7, 9, 10], [8, 9, 6], [7, 11, 6], [9, 6, 8], [9, 10, 7], [11, 6, 7], [1, 7, 11], [4, 8, 11], [1, 8, 9], [4, 7, 9], [0, 9, 10], [3, 9, 6], [3, 11, 10], [0, 11, 6], [2, 6, 8], [2, 10, 7], [5, 6, 7], [5, 10, 8], [6, 0, 11], [10, 3, 11], [6, 3, 9], [10, 0, 9], [7, 2, 10], [8, 2, 6], [8, 5, 10], [7, 5, 6], [9, 1, 8], [9, 4, 7], [11, 1, 7], [11, 4, 8], [7, 9, 4], [8, 9, 1], [8, 11, 4], [7, 11, 1], [9, 6, 3], [9, 10, 0], [11, 6, 0], [11, 10, 3], [19, 12, 23], [13, 15, 22], [16, 21, 18], [17, 20, 14], [20, 14, 17], [21, 18, 16], [15, 22, 13], [12, 23, 19], [18, 16, 21], [14, 17, 20], [23, 19, 12], [22, 13, 15], [19, 20, 22], [13, 21, 23], [16, 15, 14], [17, 12, 18], [20, 18, 13], [21, 14, 19], [15, 23, 17], [12, 22, 16], [18, 19, 15], [14, 13, 12], [23, 16, 20], [22, 17, 21], [16, 12, 22], [17, 15, 23], [19, 21, 14], [13, 20, 18], [12, 14, 13], [15, 18, 19], [21, 22, 17], [20, 23, 16], [14, 16, 15], [18, 17, 12], [22, 19, 20], [23, 13, 21], [16, 20, 23], [17, 21, 22], [19, 15, 18], [13, 12, 14], [12, 18, 17], [15, 14, 16], [21, 23, 13], [20, 22, 19], [14, 19, 21], [18, 13, 20], [22, 16, 12], [23, 17, 15], [19, 12, 22], [17, 21, 23], [16, 15, 18], [13, 20, 14], [20, 14, 13], [15, 18, 16], [21, 23, 17], [12, 22, 19], [18, 16, 15], [14, 13, 20], [22, 19, 12], [23, 17, 21], [3, 2, 4], [3, 5, 1], [0, 5, 4], [2, 4, 3], [5, 1, 3], [5, 4, 0], [1, 7, 9], [4, 8, 9], [1, 8, 11], [4, 7, 11], [0, 9, 6], [3, 9, 10], [3, 11, 6], [0, 11, 10], [2, 6, 7], [2, 10, 8], [5, 6, 8], [5, 10, 7], [6, 0, 9], [10, 3, 9], [6, 3, 11], [10, 0, 11], [7, 2, 6], [8, 2, 10], [8, 5, 6], [7, 5, 10], [9, 1, 7], [9, 4, 8], [11, 1, 8], [11, 4, 7], [7, 9, 1], [8, 9, 4], [8, 11, 1], [7, 11, 4], [9, 6, 0], [9, 10, 3], [11, 6, 3], [11, 10, 0], [8, 9, 10], [8, 11, 6], [7, 11, 10], [9, 10, 8], [11, 6, 8], [11, 10, 7], [6, 0, 2], [10, 3, 2], [6, 3, 5], [10, 0, 5], [7, 2, 1], [8, 2, 4], [8, 5, 1], [7, 5, 4], [9, 1, 0], [9, 4, 3], [11, 1, 3], [11, 4, 0], [1, 7, 2], [4, 8, 2], [1, 8, 5], [4, 7, 5], [0, 9, 1], [3, 9, 4], [3, 11, 1], [0, 11, 4], [2, 6, 0], [2, 10, 3], [5, 6, 3], [5, 10, 0], [0, 2, 6], [3, 2, 10], [3, 5, 6], [0, 5, 10], [2, 1, 7], [2, 4, 8], [5, 1, 8], [5, 4, 7], [16, 12, 14], [13, 21, 18], [19, 15, 23], [17, 20, 22], [12, 14, 16], [21, 18, 13], [15, 23, 19], [20, 22, 17], [14, 16, 12], [18, 13, 21], [23, 19, 15], [22, 17, 20], [19, 20, 18], [17, 15, 14], [16, 21, 22], [13, 12, 23], [20, 18, 19], [15, 14, 17], [21, 22, 16], [12, 23, 13], [18, 19, 20], [14, 17, 15], [22, 16, 21], [23, 13, 12], [6, 0, 5], [10, 3, 5], [6, 3, 2], [10, 0, 2], [7, 2, 4], [8, 2, 1], [8, 5, 4], [7, 5, 1], [9, 1, 3], [9, 4, 0], [11, 1, 0], [11, 4, 3], [1, 7, 5], [4, 8, 5], [1, 8, 2], [4, 7, 2], [0, 9, 4], [3, 9, 1], [3, 11, 4], [0, 11, 1], [2, 6, 3], [2, 10, 0], [5, 6, 0], [5, 10, 3], [0, 2, 10], [3, 2, 6], [3, 5, 10], [0, 5, 6], [2, 1, 8], [2, 4, 7], [5, 1, 7], [5, 4, 8], [21, 17, 23], [20, 16, 22], [12, 13, 18], [15, 19, 14], [23, 21, 17], [22, 20, 16], [18, 12, 13], [14, 15, 19], [17, 23, 21], [16, 22, 20], [13, 18, 12], [19, 14, 15], [21, 13, 22], [20, 19, 23], [12, 17, 14], [15, 16, 18], [23, 15, 13], [22, 12, 19], [18, 20, 17], [14, 21, 16], [17, 22, 15], [16, 23, 12], [13, 14, 20], [19, 18, 21], [15, 17, 22], [12, 16, 23], [20, 13, 14], [21, 19, 18], [22, 21, 13], [23, 20, 19], [14, 12, 17], [18, 15, 16], [13, 23, 15], [19, 22, 12], [17, 18, 20], [16, 14, 21], [15, 13, 23], [12, 19, 22], [20, 17, 18], [21, 16, 14], [22, 15, 17], [23, 12, 16], [14, 20, 13], [18, 21, 19], [13, 22, 21], [19, 23, 20], [17, 14, 12], [16, 18, 15], [6, 5, 3], [4, 9, 3], [9, 3, 4], [5, 7, 4], [4, 5, 7], [5, 3, 6]], jU = [[0], [0, 1], [0, 2], [0, 3], [0, 2, 4, 5], [0, 6], [0, 7], [0, 6, 4, 8], [0, 7, 4, 9], [0, 6, 2, 1], [0, 3, 1, 10], [0, 6, 2, 1, 4, 8, 5, 11], [0, 12, 1, 7], [0, 1, 13, 14], [0, 12, 1, 7, 4, 15, 11, 9], [0, 16, 2, 17], [0, 18, 12, 17], [0, 16, 5, 19], [0, 20, 13, 19], [0, 18, 12, 17, 4, 21, 15, 19], [0, 16, 2, 17, 4, 22, 5, 19], [0, 16, 2, 17, 23, 24, 13, 25, 26, 20, 27, 28, 4, 22, 5, 19], [0, 16, 17, 2, 29, 21, 30, 15], [0, 20, 13, 19, 29, 31, 32, 33], [0, 16, 6, 34], [0, 18, 7, 34], [0, 16, 7, 35], [0, 16, 36, 37], [0, 18, 36, 38], [0, 16, 14, 39], [0, 20, 40, 34], [0, 16, 8, 41], [0, 18, 8, 42], [0, 16, 9, 42], [0, 16, 6, 34, 4, 22, 8, 41], [0, 18, 7, 34, 4, 21, 9, 41], [0, 16, 7, 35, 4, 22, 9, 42], [0, 16, 6, 34, 23, 24, 14, 39], [0, 16, 10, 43, 23, 24, 7, 35], [0, 16, 36, 37, 23, 24, 9, 42], [0, 16, 8, 41, 23, 24, 40, 38], [0, 16, 6, 34, 23, 24, 14, 39, 26, 20, 40, 38, 4, 22, 8, 41], [0, 16, 44, 45, 23, 24, 46, 47, 26, 20, 48, 49, 4, 22, 50, 51], [0, 16, 6, 34, 29, 21, 9, 42], [0, 16, 8, 41, 29, 21, 7, 35], [0, 16, 36, 37, 29, 21, 14, 39], [0, 16, 2, 17, 1, 52, 6, 34], [0, 16, 2, 17, 53, 54, 9, 42], [0, 16, 12, 33, 1, 52, 7, 35], [0, 16, 2, 17, 11, 55, 8, 41], [0, 56, 2, 57, 1, 58, 6, 37], [0, 56, 15, 25, 1, 58, 9, 39], [0, 20, 27, 17, 1, 59, 40, 34], [0, 56, 12, 28, 1, 58, 7, 38], [0, 16, 5, 19, 1, 52, 8, 41], [0, 22, 13, 28, 1, 55, 14, 38], [0, 18, 13, 60, 1, 61, 14, 43], [0, 16, 15, 30, 1, 52, 9, 42], [0, 16, 5, 19, 11, 55, 6, 34], [0, 21, 12, 19, 1, 54, 7, 41], [0, 20, 13, 19, 1, 59, 14, 41], [0, 20, 3, 30, 1, 59, 10, 42], [0, 18, 12, 17, 1, 61, 7, 34, 4, 21, 15, 19, 11, 54, 9, 41], [0, 24, 13, 17, 1, 62, 14, 34, 4, 20, 27, 19, 11, 59, 40, 41], [0, 16, 2, 17, 1, 52, 6, 34, 4, 22, 5, 19, 11, 55, 8, 41], [0, 16, 12, 33, 1, 52, 7, 35, 4, 22, 15, 30, 11, 55, 9, 42], [0, 31, 3, 17, 1, 63, 10, 34, 4, 56, 32, 19, 11, 58, 36, 41], [0, 22, 2, 19, 64, 59, 14, 38, 4, 16, 5, 17, 65, 62, 40, 39], [0, 16, 2, 17, 1, 52, 6, 34, 23, 24, 13, 25, 64, 62, 14, 39, 26, 20, 27, 28, 65, 59, 40, 38, 4, 22, 5, 19, 11, 55, 8, 41], [0, 16, 2, 17, 66, 67, 44, 45, 23, 24, 13, 25, 68, 69, 46, 47, 26, 20, 27, 28, 70, 71, 48, 49, 4, 22, 5, 19, 72, 73, 50, 51], [0, 16, 2, 17, 1, 52, 6, 34, 29, 21, 15, 30, 53, 54, 9, 42], [0, 16, 5, 19, 1, 52, 8, 41, 29, 21, 12, 33, 53, 54, 7, 35], [0, 20, 13, 19, 1, 59, 14, 41, 29, 31, 32, 33, 53, 63, 36, 35], [0, 31, 3, 17, 1, 63, 10, 34, 29, 20, 27, 30, 53, 59, 40, 42], [0, 16, 74, 75], [0, 18, 76, 77], [0, 16, 78, 79], [0, 18, 80, 81], [0, 16, 74, 75, 29, 21, 82, 83], [0, 21, 84, 85, 29, 16, 86, 87], [0, 16, 88, 89], [0, 16, 88, 89, 29, 21, 90, 91], [0, 16, 74, 75, 1, 52, 88, 89], [0, 16, 78, 79, 1, 52, 92, 93], [0, 16, 94, 95, 11, 55, 88, 89], [0, 16, 82, 83, 53, 54, 88, 89], [0, 16, 74, 75, 1, 52, 88, 89, 29, 21, 82, 83, 53, 54, 90, 91], [0, 21, 84, 85, 96, 97, 88, 91, 29, 16, 86, 87, 98, 99, 90, 89], [0, 16, 74, 75, 2, 17, 100, 101], [0, 16, 94, 95, 5, 19, 100, 101], [0, 18, 76, 77, 2, 33, 102, 103], [0, 18, 104, 105, 106, 107, 100, 108], [0, 16, 78, 79, 2, 17, 109, 108], [0, 16, 82, 83, 15, 30, 100, 101], [0, 18, 80, 81, 2, 33, 110, 111], [0, 18, 112, 113, 114, 115, 100, 108], [0, 16, 74, 75, 2, 17, 100, 101, 29, 21, 82, 83, 15, 30, 116, 117], [0, 21, 84, 85, 118, 119, 116, 101, 29, 16, 86, 87, 120, 121, 100, 117], [0, 16, 74, 75, 6, 34, 122, 123], [0, 16, 74, 75, 8, 41, 124, 125], [0, 16, 78, 79, 7, 35, 122, 123], [0, 16, 82, 83, 9, 42, 122, 123], [0, 16, 74, 75, 7, 35, 126, 127], [0, 16, 74, 75, 9, 42, 128, 129], [0, 16, 78, 79, 6, 34, 126, 127], [0, 16, 78, 79, 8, 41, 128, 129], [0, 16, 74, 75, 6, 34, 122, 123, 29, 21, 82, 83, 9, 42, 128, 129], [0, 16, 74, 75, 7, 35, 126, 127, 29, 21, 82, 83, 8, 41, 124, 125], [0, 21, 84, 85, 6, 42, 130, 131, 29, 16, 86, 87, 9, 34, 132, 133], [0, 21, 84, 85, 7, 41, 134, 135, 29, 16, 86, 87, 8, 35, 136, 137], [0, 16, 89, 88, 2, 17, 122, 123], [0, 16, 89, 88, 12, 33, 126, 127], [0, 16, 89, 88, 5, 19, 124, 125], [0, 16, 89, 88, 15, 30, 128, 129], [0, 16, 88, 89, 6, 34, 100, 101], [0, 16, 89, 88, 7, 35, 109, 108], [0, 16, 89, 88, 8, 41, 138, 139], [0, 16, 89, 88, 9, 42, 116, 117], [0, 16, 89, 88, 6, 34, 100, 101, 29, 21, 91, 90, 9, 42, 116, 117], [0, 16, 89, 88, 7, 35, 109, 108, 29, 21, 91, 90, 8, 41, 138, 139], [0, 16, 89, 88, 2, 17, 122, 123, 29, 21, 91, 90, 15, 30, 128, 129], [0, 16, 89, 88, 118, 121, 132, 131, 29, 21, 91, 90, 120, 119, 130, 133], [0, 16, 74, 75, 2, 17, 100, 101, 1, 52, 88, 89, 6, 34, 122, 123], [0, 16, 74, 75, 12, 33, 109, 108, 1, 52, 88, 89, 7, 35, 126, 127], [0, 16, 74, 75, 2, 17, 100, 101, 11, 55, 140, 141, 8, 41, 124, 125], [0, 16, 74, 75, 2, 17, 100, 101, 53, 54, 90, 91, 9, 42, 128, 129], [0, 16, 74, 75, 5, 19, 138, 139, 1, 52, 88, 89, 8, 41, 124, 125], [0, 16, 74, 75, 15, 30, 116, 117, 1, 52, 88, 89, 9, 42, 128, 129], [0, 16, 94, 95, 5, 19, 100, 101, 11, 55, 88, 89, 6, 34, 124, 125], [0, 16, 94, 95, 15, 30, 109, 108, 11, 55, 88, 89, 7, 35, 128, 129], [0, 16, 78, 79, 2, 17, 109, 108, 1, 52, 92, 93, 6, 34, 126, 127], [0, 16, 78, 79, 12, 33, 100, 101, 1, 52, 92, 93, 7, 35, 122, 123], [0, 16, 82, 83, 12, 33, 138, 139, 53, 54, 88, 89, 8, 41, 126, 127], [0, 16, 82, 83, 2, 17, 116, 117, 53, 54, 88, 89, 9, 42, 122, 123], [0, 16, 78, 79, 5, 19, 116, 117, 1, 52, 92, 93, 8, 41, 128, 129], [0, 16, 82, 83, 15, 30, 100, 101, 1, 52, 90, 91, 9, 42, 122, 123], [0, 16, 82, 83, 15, 30, 100, 101, 53, 54, 88, 89, 6, 34, 128, 129], [0, 16, 82, 83, 5, 19, 109, 108, 53, 54, 88, 89, 7, 35, 124, 125], [0, 16, 74, 75, 2, 17, 100, 101, 1, 52, 88, 89, 6, 34, 122, 123, 29, 21, 82, 83, 15, 30, 116, 117, 53, 54, 90, 91, 9, 42, 128, 129], [0, 16, 74, 75, 12, 33, 109, 108, 1, 52, 88, 89, 7, 35, 126, 127, 29, 21, 82, 83, 5, 19, 138, 139, 53, 54, 90, 91, 8, 41, 124, 125], [0, 21, 84, 85, 118, 119, 116, 101, 96, 97, 88, 91, 9, 34, 132, 133, 29, 16, 86, 87, 120, 121, 100, 117, 98, 99, 90, 89, 6, 42, 130, 131], [0, 21, 84, 85, 142, 143, 138, 108, 96, 97, 88, 91, 8, 35, 136, 137, 29, 16, 86, 87, 144, 145, 109, 139, 98, 99, 90, 89, 7, 41, 134, 135], [0, 146, 147], [0, 148, 149], [0, 150, 151], [0, 146, 147, 152, 153, 154, 155, 156, 157], [0, 158, 159], [0, 146, 147, 1, 160, 161], [0, 146, 147, 1, 160, 161, 152, 153, 154, 162, 163, 164, 155, 156, 157, 165, 166, 167], [0, 158, 159, 1, 168, 169], [0, 146, 147, 101, 170, 171], [0, 146, 147, 100, 172, 173], [0, 148, 149, 174, 175, 171], [0, 148, 149, 100, 176, 177], [0, 150, 151, 178, 179, 171], [0, 150, 151, 100, 180, 181], [0, 146, 147, 100, 172, 173, 152, 153, 154, 182, 183, 184, 155, 156, 157, 185, 186, 187], [0, 158, 159, 101, 188, 189], [0, 146, 147, 122, 190, 191], [0, 146, 147, 123, 192, 193], [0, 146, 147, 126, 194, 195], [0, 146, 147, 127, 196, 197], [0, 146, 147, 122, 190, 191, 152, 153, 154, 198, 199, 200, 155, 156, 157, 201, 202, 203], [0, 158, 159, 123, 204, 205], [0, 146, 147, 126, 194, 195, 152, 153, 154, 206, 207, 208, 155, 156, 157, 209, 210, 211], [0, 158, 159, 129, 212, 213], [0, 146, 147, 101, 170, 171, 1, 160, 161, 123, 192, 193], [0, 146, 147, 108, 214, 215, 1, 160, 161, 127, 196, 197], [0, 146, 147, 100, 172, 173, 1, 160, 161, 122, 190, 191], [0, 146, 147, 109, 216, 217, 1, 160, 161, 126, 194, 195], [0, 146, 147, 100, 172, 173, 1, 160, 161, 122, 190, 191, 152, 153, 154, 182, 183, 184, 162, 163, 164, 198, 199, 200, 155, 156, 157, 185, 186, 187, 165, 166, 167, 201, 202, 203], [0, 158, 159, 101, 188, 189, 1, 168, 169, 123, 204, 205], [0, 146, 147, 109, 216, 217, 1, 160, 161, 126, 194, 195, 152, 153, 154, 218, 219, 220, 162, 163, 164, 206, 207, 208, 155, 156, 157, 221, 222, 223, 165, 166, 167, 209, 210, 211], [0, 158, 159, 117, 224, 225, 1, 168, 169, 129, 212, 213], [0, 146, 147, 16, 226, 227], [0, 148, 149, 18, 228, 229], [0, 150, 151, 18, 230, 231], [0, 150, 151, 16, 232, 233], [0, 148, 149, 16, 234, 235], [0, 146, 147, 18, 236, 237], [0, 146, 147, 52, 238, 239], [0, 146, 147, 16, 226, 227, 1, 160, 161, 52, 238, 239], [0, 146, 147, 18, 236, 237, 1, 160, 161, 61, 240, 241], [0, 146, 147, 16, 226, 227, 100, 172, 173, 101, 170, 171], [0, 148, 149, 18, 228, 229, 242, 172, 181, 243, 214, 244], [0, 150, 151, 18, 230, 231, 245, 172, 177, 246, 214, 247], [0, 150, 151, 16, 232, 233, 245, 172, 177, 174, 170, 248], [0, 148, 149, 16, 234, 235, 242, 172, 181, 178, 170, 249], [0, 146, 147, 18, 236, 237, 100, 172, 173, 108, 214, 215], [0, 146, 147, 16, 226, 227, 122, 190, 191, 123, 192, 193], [0, 146, 147, 16, 226, 227, 126, 194, 195, 127, 196, 197], [0, 146, 147, 18, 236, 237, 126, 194, 195, 123, 192, 193], [0, 146, 147, 18, 236, 237, 122, 190, 191, 127, 196, 197], [0, 146, 147, 52, 238, 239, 122, 190, 191, 101, 170, 171], [0, 146, 147, 61, 240, 241, 126, 194, 195, 101, 170, 171], [0, 146, 147, 52, 238, 239, 100, 172, 173, 123, 192, 193], [0, 146, 147, 61, 240, 241, 100, 172, 173, 127, 196, 197], [0, 146, 147, 16, 226, 227, 100, 172, 173, 101, 170, 171, 1, 160, 161, 52, 239, 238, 122, 190, 191, 123, 192, 193], [0, 146, 147, 16, 226, 227, 109, 216, 217, 108, 214, 215, 1, 160, 161, 52, 239, 238, 126, 194, 195, 127, 196, 197], [0, 146, 147, 18, 236, 237, 109, 216, 217, 101, 170, 171, 1, 160, 161, 61, 241, 240, 126, 194, 195, 123, 192, 193], [0, 146, 147, 18, 236, 237, 100, 172, 173, 108, 214, 215, 1, 160, 161, 61, 241, 240, 122, 190, 191, 127, 196, 197], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 29, 21, 15, 30, 280, 281, 282, 283, 284, 285, 286, 287], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 29, 31, 32, 33, 280, 288, 289, 290, 284, 291, 292, 293], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 53, 54, 9, 42, 300, 301, 302, 303, 304, 305, 306, 307], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 64, 62, 14, 39, 308, 309, 310, 311, 312, 313, 314, 315, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 65, 59, 40, 38, 316, 317, 318, 319, 320, 321, 322, 323, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 11, 55, 8, 41, 324, 325, 326, 327, 328, 329, 330, 331], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 66, 67, 44, 45, 332, 333, 334, 335, 336, 337, 338, 339, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 68, 69, 46, 47, 340, 341, 342, 343, 344, 345, 346, 347, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 70, 71, 48, 49, 348, 349, 350, 351, 352, 353, 354, 355, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 72, 73, 50, 51, 356, 357, 358, 359, 360, 361, 362, 363], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 29, 21, 15, 30, 280, 281, 282, 283, 284, 285, 286, 287, 53, 54, 9, 42, 300, 301, 302, 303, 304, 305, 306, 307], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 1, 59, 14, 41, 168, 325, 318, 311, 169, 313, 330, 323], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 1, 59, 14, 41, 168, 325, 318, 311, 169, 313, 330, 323, 29, 31, 32, 33, 280, 288, 289, 290, 284, 291, 292, 293, 53, 63, 36, 35, 300, 364, 365, 366, 304, 367, 368, 369], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 138, 139, 95, 94, 406, 407, 408, 409, 410, 411, 412, 413], [0, 24, 5, 28, 158, 265, 258, 275, 159, 277, 270, 263, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 23, 16, 27, 19, 256, 273, 251, 267, 260, 269, 278, 255, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 26, 22, 13, 17, 264, 250, 274, 259, 268, 261, 254, 279, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 4, 20, 2, 25, 272, 257, 266, 252, 276, 253, 262, 271, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 29, 21, 15, 30, 280, 281, 282, 283, 284, 285, 286, 287, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 450, 415, 440, 429, 454, 431, 420, 445, 458, 447, 436, 425], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 29, 31, 32, 33, 280, 288, 289, 290, 284, 291, 292, 293, 450, 415, 440, 429, 454, 431, 420, 445, 458, 447, 436, 425], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 123, 122, 88, 89, 204, 474, 475, 476, 205, 477, 478, 479], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 123, 122, 88, 89, 204, 474, 475, 476, 205, 477, 478, 479, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 125, 124, 140, 141, 504, 505, 506, 507, 508, 509, 510, 511], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 123, 122, 88, 89, 204, 474, 475, 476, 205, 477, 478, 479, 29, 21, 15, 30, 280, 281, 282, 283, 284, 285, 286, 287, 129, 128, 90, 91, 212, 512, 513, 514, 213, 515, 516, 517], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 129, 128, 90, 91, 212, 512, 513, 514, 213, 515, 516, 517], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 129, 128, 90, 91, 212, 512, 513, 514, 213, 515, 516, 517, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 127, 126, 92, 93, 542, 543, 544, 545, 546, 547, 548, 549], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 29, 31, 32, 33, 280, 288, 289, 290, 284, 291, 292, 293, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 122, 123, 89, 88, 475, 476, 204, 474, 479, 478, 477, 205], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 53, 54, 9, 42, 300, 301, 302, 303, 304, 305, 306, 307, 128, 129, 91, 90, 513, 514, 212, 512, 517, 516, 515, 213], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 128, 129, 91, 90, 513, 514, 212, 512, 517, 516, 515, 213], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225, 53, 54, 9, 42, 300, 301, 302, 303, 304, 305, 306, 307, 122, 123, 89, 88, 475, 476, 204, 474, 479, 478, 477, 205], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 122, 123, 89, 88, 475, 476, 204, 474, 479, 478, 477, 205, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 64, 62, 14, 39, 308, 309, 310, 311, 312, 313, 314, 315, 481, 480, 483, 482, 486, 487, 484, 485, 491, 490, 489, 488, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 65, 59, 40, 38, 316, 317, 318, 319, 320, 321, 322, 323, 493, 492, 495, 494, 498, 499, 496, 497, 503, 502, 501, 500, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 138, 139, 95, 94, 406, 407, 408, 409, 410, 411, 412, 413, 11, 55, 8, 41, 324, 325, 326, 327, 328, 329, 330, 331, 124, 125, 141, 140, 506, 507, 504, 505, 511, 510, 509, 508], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 128, 129, 91, 90, 513, 514, 212, 512, 517, 516, 515, 213, 23, 24, 13, 25, 256, 257, 258, 259, 260, 261, 262, 263, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 64, 62, 14, 39, 308, 309, 310, 311, 312, 313, 314, 315, 519, 518, 521, 520, 524, 525, 522, 523, 529, 528, 527, 526, 26, 20, 27, 28, 264, 265, 266, 267, 268, 269, 270, 271, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 65, 59, 40, 38, 316, 317, 318, 319, 320, 321, 322, 323, 531, 530, 533, 532, 536, 537, 534, 535, 541, 540, 539, 538, 4, 22, 5, 19, 272, 273, 274, 275, 276, 277, 278, 279, 109, 108, 79, 78, 598, 599, 600, 601, 602, 603, 604, 605, 11, 55, 8, 41, 324, 325, 326, 327, 328, 329, 330, 331, 126, 127, 93, 92, 544, 545, 542, 543, 549, 548, 547, 546], [0, 24, 5, 28, 158, 265, 258, 275, 159, 277, 270, 263, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 66, 69, 50, 49, 332, 349, 342, 359, 336, 361, 354, 347, 493, 123, 483, 140, 498, 507, 204, 485, 503, 490, 509, 205, 23, 16, 27, 19, 256, 273, 251, 267, 260, 269, 278, 255, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 68, 67, 48, 51, 340, 357, 334, 351, 344, 353, 362, 339, 124, 480, 89, 494, 506, 499, 484, 474, 511, 478, 501, 488, 26, 22, 13, 17, 264, 250, 274, 259, 268, 261, 254, 279, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 70, 73, 46, 45, 348, 333, 358, 343, 352, 345, 338, 363, 122, 492, 141, 482, 475, 487, 496, 505, 479, 510, 489, 500, 4, 20, 2, 25, 272, 257, 266, 252, 276, 253, 262, 271, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 72, 71, 44, 47, 356, 341, 350, 335, 360, 337, 346, 355, 481, 125, 495, 88, 486, 476, 504, 497, 491, 502, 477, 508], [0, 24, 5, 28, 158, 265, 258, 275, 159, 277, 270, 263, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 531, 129, 521, 92, 536, 545, 212, 523, 541, 528, 547, 213, 23, 16, 27, 19, 256, 273, 251, 267, 260, 269, 278, 255, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 126, 518, 91, 532, 544, 537, 522, 512, 549, 516, 539, 526, 26, 22, 13, 17, 264, 250, 274, 259, 268, 261, 254, 279, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 128, 530, 93, 520, 513, 525, 534, 543, 517, 548, 527, 538, 4, 20, 2, 25, 272, 257, 266, 252, 276, 253, 262, 271, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 519, 127, 533, 90, 524, 514, 542, 535, 529, 540, 515, 546], [0, 16, 2, 17, 158, 250, 251, 252, 159, 253, 254, 255, 100, 101, 75, 74, 370, 371, 188, 372, 373, 374, 375, 189, 1, 52, 6, 34, 168, 294, 295, 296, 169, 297, 298, 299, 122, 123, 89, 88, 475, 476, 204, 474, 479, 478, 477, 205, 29, 21, 15, 30, 280, 281, 282, 283, 284, 285, 286, 287, 116, 117, 83, 82, 376, 377, 224, 378, 379, 380, 381, 225, 53, 54, 9, 42, 300, 301, 302, 303, 304, 305, 306, 307, 128, 129, 91, 90, 513, 514, 212, 512, 517, 516, 515, 213], [0, 20, 13, 19, 158, 273, 266, 259, 159, 261, 278, 271, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 1, 59, 14, 41, 168, 325, 318, 311, 169, 313, 330, 323, 551, 550, 553, 552, 556, 557, 554, 555, 561, 560, 559, 558, 29, 31, 32, 33, 280, 288, 289, 290, 284, 291, 292, 293, 450, 415, 440, 429, 454, 431, 420, 445, 458, 447, 436, 425, 53, 63, 36, 35, 300, 364, 365, 366, 304, 367, 368, 369, 563, 562, 565, 564, 568, 569, 566, 567, 573, 572, 571, 570], [0, 16], [0, 18], [0, 16, 26, 20], [0, 2, 23, 13], [0, 3, 4, 32], [0, 2, 29, 15], [0, 3, 29, 27], [0, 52], [0, 63], [0, 52, 26, 59], [0, 63, 26, 54], [0, 52, 16, 1], [0, 18, 1, 61], [0, 52, 16, 1, 26, 59, 20, 65], [0, 31, 1, 63], [0, 1, 24, 62], [0, 15, 1, 9], [0, 5, 1, 8], [0, 31, 1, 63, 26, 21, 65, 54], [0, 2, 57, 56], [0, 60, 3, 16], [0, 22, 57, 3], [0, 2, 28, 20], [0, 17, 13, 24], [0, 20, 19, 13, 4, 24, 17, 27], [0, 22, 57, 3, 4, 16, 60, 32], [0, 22, 57, 3, 23, 20, 30, 12, 26, 24, 33, 15, 4, 16, 60, 32], [0, 22, 57, 3, 29, 18, 27, 25], [0, 22, 3, 57, 1, 55, 10, 37], [0, 22, 385, 396, 3, 57, 109, 117], [0, 22, 57, 3, 159, 279, 654, 655, 158, 274, 656, 657, 29, 18, 25, 27, 284, 658, 262, 269, 280, 659, 257, 267]], S0 = { "P 1": 0, "P -1": 1, "P 1 2 1": 2, "P 1 21 1": 3, "C 1 2 1": 4, "P 1 m 1": 5, "P 1 c 1": 6, "C 1 m 1": 7, "C 1 c 1": 8, "P 1 2/m 1": 9, "P 1 21/m 1": 10, "C 1 2/m 1": 11, "P 1 2/c 1": 12, "P 1 21/c 1": 13, "C 1 2/c 1": 14, "P 2 2 2": 15, "P 2 2 21": 16, "P 21 21 2": 17, "P 21 21 21": 18, "C 2 2 21": 19, "C 2 2 2": 20, "F 2 2 2": 21, "I 2 2 2": 22, "I 21 21 21": 23, "P m m 2": 24, "P m c 21": 25, "P c c 2": 26, "P m a 2": 27, "P c a 21": 28, "P n c 2": 29, "P m n 21": 30, "P b a 2": 31, "P n a 21": 32, "P n n 2": 33, "C m m 2": 34, "C m c 21": 35, "C c c 2": 36, "A m m 2": 37, "A b m 2": 38, "A m a 2": 39, "A b a 2": 40, "F m m 2": 41, "F d d 2": 42, "I m m 2": 43, "I b a 2": 44, "I m a 2": 45, "P 2/m 2/m 2/m": 46, "P m m m": 46, "P 2/n 2/n 2/n": 47, "P n n n": 47, "P 2/c 2/c 2/m": 48, "P c c m": 48, "P 2/b 2/a 2/n": 49, "P b a n": 49, "P 21/m 2/m 2/a": 50, "P m m a": 50, "P 2/n 21/n 2/a": 51, "P n n a": 51, "P 2/m 2/n 21/a": 52, "P m n a": 52, "P 21/c 2/c 2/a": 53, "P c c a": 53, "P 21/b 21/a 2/m": 54, "P b a m": 54, "P 21/c 21/c 2/n": 55, "P c c n": 55, "P 2/b 21/c 21/m": 56, "P b c m": 56, "P 21/n 21/n 2/m": 57, "P n n m": 57, "P 21/m 21/m 2/n": 58, "P m m n": 58, "P 21/b 2/c 21/n": 59, "P b c n": 59, "P 21/b 21/c 21/a": 60, "P b c a": 60, "P 21/n 21/m 21/a": 61, "P n m a": 61, "C 2/m 2/c 21/m": 62, "C m c m": 62, "C 2/m 2/c 21/a": 63, "C m c a": 63, "C 2/m 2/m 2/m": 64, "C m m m": 64, "C 2/c 2/c 2/m": 65, "C c c m": 65, "C 2/m 2/m 2/a": 66, "C m m a": 66, "C 2/c 2/c 2/a": 67, "C c c a": 67, "F 2/m 2/m 2/m": 68, "F m m m": 68, "F 2/d 2/d 2/d": 69, "F d d d": 69, "I 2/m 2/m 2/m": 70, "I m m m": 70, "I 2/b 2/a 2/m": 71, "I b a m": 71, "I 21/b 21/c 21/a": 72, "I b c a": 72, "I 21/m 21/m 21/a": 73, "I m m a": 73, "P 4": 74, "P 41": 75, "P 42": 76, "P 43": 77, "I 4": 78, "I 41": 79, "P -4": 80, "I -4": 81, "P 4/m": 82, "P 42/m": 83, "P 4/n": 84, "P 42/n": 85, "I 4/m": 86, "I 41/a": 87, "P 4 2 2": 88, "P 4 21 2": 89, "P 41 2 2": 90, "P 41 21 2": 91, "P 42 2 2": 92, "P 42 21 2": 93, "P 43 2 2": 94, "P 43 21 2": 95, "I 4 2 2": 96, "I 41 2 2": 97, "P 4 m m": 98, "P 4 b m": 99, "P 42 c m": 100, "P 42 n m": 101, "P 4 c c": 102, "P 4 n c": 103, "P 42 m c": 104, "P 42 b c": 105, "I 4 m m": 106, "I 4 c m": 107, "I 41 m d": 108, "I 41 c d": 109, "P -4 2 m": 110, "P -4 2 c": 111, "P -4 21 m": 112, "P -4 21 c": 113, "P -4 m 2": 114, "P -4 c 2": 115, "P -4 b 2": 116, "P -4 n 2": 117, "I -4 m 2": 118, "I -4 c 2": 119, "I -4 2 m": 120, "I -4 2 d": 121, "P 4/m 2/m 2/m": 122, "P4/m m m": 122, "P 4/m 2/c 2/c": 123, "P4/m c c": 123, "P 4/n 2/b 2/m": 124, "P4/n b m": 124, "P 4/n 2/n 2/c": 125, "P4/n n c": 125, "P 4/m 21/b 2/m": 126, "P4/m b m": 126, "P 4/m 21/n 2/c": 127, "P4/m n c": 127, "P 4/n 21/m 2/m": 128, "P4/n m m": 128, "P 4/n 2/c 2/c": 129, "P4/n c c": 129, "P 42/m 2/m 2/c": 130, "P42/m m c": 130, "P 42/m 2/c 2/m": 131, "P42/m c m": 131, "P 42/n 2/b 2/c": 132, "P42/n b c": 132, "P 42/n 2/n 2/m": 133, "P42/n n m": 133, "P 42/m 21/b 2/c": 134, "P42/m b c": 134, "P 42/m 21/n 2/m": 135, "P42/m n m": 135, "P 42/n 21/m 2/c": 136, "P42/n m c": 136, "P 42/n 21/c 2/m": 137, "P42/n c m": 137, "I 4/m 2/m 2/m": 138, "I4/m m m": 138, "I 4/m 2/c 2/m": 139, "I4/m c m": 139, "I 41/a 2/m 2/d": 140, "I41/a m d": 140, "I 41/a 2/c 2/d": 141, "I41/a c d": 141, "P 3": 142, "P 31": 143, "P 32": 144, "H 3": 145, "R 3": 146, "P -3": 147, "H -3": 148, "R -3": 149, "P 3 1 2": 150, "P 3 2 1": 151, "P 31 1 2": 152, "P 31 2 1": 153, "P 32 1 2": 154, "P 32 2 1": 155, "H 3 2": 156, "R 3 2": 157, "P 3 m 1": 158, "P 3 1 m": 159, "P 3 c 1": 160, "P 3 1 c": 161, "H 3 m": 162, "R 3 m": 163, "H 3 c": 164, "R 3 c": 165, "P -3 1 2/m": 166, "P -3 1 m": 166, "P -3 1 2/c": 167, "P -3 1 c": 167, "P -3 2/m 1": 168, "P -3 m 1": 168, "P -3 2/c 1": 169, "P -3 c 1": 169, "H -3 2/m": 170, "H -3 m": 170, "R -3 2/m": 171, "R -3 m": 171, "H -3 2/c": 172, "H -3 c": 172, "R -3 2/c": 173, "R -3 c": 173, "P 6": 174, "P 61": 175, "P 65": 176, "P 62": 177, "P 64": 178, "P 63": 179, "P -6": 180, "P 6/m": 181, "P 63/m": 182, "P 6 2 2": 183, "P 61 2 2": 184, "P 65 2 2": 185, "P 62 2 2": 186, "P 64 2 2": 187, "P 63 2 2": 188, "P 6 m m": 189, "P 6 c c": 190, "P 63 c m": 191, "P 63 m c": 192, "P -6 m 2": 193, "P -6 c 2": 194, "P -6 2 m": 195, "P -6 2 c": 196, "P 6/m 2/m 2/m": 197, "P 6/m m m": 197, "P 6/m 2/c 2/c": 198, "P 6/m c c": 198, "P 63/m 2/c 2/m": 199, "P 63/m c m": 199, "P 63/m 2/m 2/c": 200, "P 63/m m c": 200, "P 2 3": 201, "F 2 3": 202, "I 2 3": 203, "P 21 3": 204, "I 21 3": 205, "P 2/m -3": 206, "P m -3": 206, "P 2/n -3": 207, "P n -3": 207, "F 2/m -3": 208, "F m -3": 208, "F 2/d -3": 209, "F d -3": 209, "I 2/m -3": 210, "I m -3": 210, "P 21/a -3": 211, "P a -3": 211, "I 21/a -3": 212, "I a -3": 212, "P 4 3 2": 213, "P 42 3 2": 214, "F 4 3 2": 215, "F 41 3 2": 216, "I 4 3 2": 217, "P 43 3 2": 218, "P 41 3 2": 219, "I 41 3 2": 220, "P -4 3 m": 221, "F -4 3 m": 222, "I -4 3 m": 223, "P -4 3 n": 224, "F -4 3 c": 225, "I -4 3 d": 226, "P 4/m -3 2/m": 227, "P m -3 m": 227, "P 4/n -3 2/n": 228, "P n -3 n": 228, "P 42/m -3 2/n": 229, "P m -3 n": 229, "P 42/n -3 2/m": 230, "P n -3 m": 230, "F 4/m -3 2/m": 231, "F m -3 m": 231, "F 4/m -3 2/c": 232, "F m -3 c": 232, "F 41/d -3 2/m": 233, "F d -3 m": 233, "F 41/d -3 2/c": 234, "F d -3 c": 234, "I 4/m -3 2/m": 235, "I m -3 m": 235, "I 41/a -3 2/d": 236, "I a -3 d": 236, "P 1 1 2": 237, "P 1 1 21": 238, "B 1 1 2": 239, "B 2": 239, "A 1 2 1": 240, "C 1 21 1": 241, "I 1 2 1": 242, "I 2": 242, "I 1 21 1": 243, "P 1 1 m": 244, "P 1 1 b": 245, "B 1 1 m": 246, "B 1 1 b": 247, "P 1 1 2/m": 248, "P 1 1 21/m": 249, "B 1 1 2/m": 250, "P 1 1 2/b": 251, "P 1 1 21/b": 252, "P 1 21/n 1": 253, "P 1 21/a 1": 254, "B 1 1 2/b": 255, "P 21 2 2": 256, "P 2 21 2": 257, "P 21 21 2 (a)": 258, "P 21 2 21": 259, "P 2 21 21": 260, "C 2 2 21a)": 261, "C 2 2 2a": 262, "F 2 2 2a": 263, "I 2 2 2a": 264, "P 21/m 21/m 2/n a": 265, "P 42 21 2a": 266, "I 2 3a": 267 };
function KU(e) {
  if (e < 146) return e + 1;
  if (e === 146) return 1146;
  if (e < 149) return e + 1 - 1;
  if (e === 149) return 1148;
  if (e < 157) return e + 1 - 2;
  if (e === 157) return 1155;
  if (e < 163) return e + 1 - 3;
  if (e === 163) return 1160;
  if (e < 165) return e + 1 - 4;
  if (e === 165) return 1161;
  if (e < 171) return e + 1 - 5;
  if (e === 171) return 1166;
  if (e < 173) return e + 1 - 6;
  if (e === 173) return 1167;
  if (e < 237) return e + 1 - 7;
  if (e === 237) return 1003;
  if (e === 238) return 1004;
  if (e === 239) return 1005;
  if (e === 240) return 2005;
  if (e === 241) return 3005;
  if (e === 242) return 4005;
  if (e === 243) return 5005;
  if (e === 244) return 1006;
  if (e === 245) return 1007;
  if (e === 246) return 1008;
  if (e === 247) return 1009;
  if (e === 248) return 1010;
  if (e === 249) return 1011;
  if (e === 250) return 1012;
  if (e === 251) return 1013;
  if (e === 252) return 1014;
  if (e === 253) return 2014;
  if (e === 254) return 3014;
  if (e === 255) return 1015;
  if (e === 256) return 1017;
  if (e === 257) return 2017;
  if (e === 258) return 1018;
  if (e === 259) return 2018;
  if (e === 260) return 3018;
  if (e === 261) return 1020;
  if (e === 262) return 1021;
  if (e === 263) return 1022;
  if (e === 264) return 1023;
  if (e === 265) return 1059;
  if (e === 266) return 1094;
  if (e === 267) return 1197;
  throw new Error("unknown spacegroup index '".concat(e, "'"));
}
var os, za, ad, Jr, dk = function() {
  for (var e = /* @__PURE__ */ Object.create(null), t = 0, n = Object.keys(S0); t < n.length; t++) {
    var r = n[t];
    e[S0[r]] = r;
  }
  return e;
}(), YU = function() {
  for (var e = /* @__PURE__ */ Object.create(null), t = 0, n = Object.keys(S0); t < n.length; t++) {
    var r = n[t], i = S0[r];
    e[i] = KU(i);
  }
  return e;
}();
function Tx(e) {
  var t = typeof e == "number" ? function(n) {
    switch (n) {
      case 1146:
        return 146;
      case 1148:
        return 149;
      case 1155:
        return 157;
      case 1160:
        return 163;
      case 1161:
        return 165;
      case 1166:
        return 171;
      case 1167:
        return 173;
      case 1003:
        return 237;
      case 1004:
        return 238;
      case 1005:
        return 239;
      case 2005:
        return 240;
      case 3005:
        return 241;
      case 4005:
        return 242;
      case 5005:
        return 243;
      case 1006:
        return 244;
      case 1007:
        return 245;
      case 1008:
        return 246;
      case 1009:
        return 247;
      case 1010:
        return 248;
      case 1011:
        return 249;
      case 1012:
        return 250;
      case 1013:
        return 251;
      case 1014:
        return 252;
      case 2014:
        return 253;
      case 3014:
        return 254;
      case 1015:
        return 255;
      case 1017:
        return 256;
      case 2017:
        return 257;
      case 1018:
        return 258;
      case 2018:
        return 259;
      case 3018:
        return 260;
      case 1020:
        return 261;
      case 1021:
        return 262;
      case 1022:
        return 263;
      case 1023:
        return 264;
      case 1059:
        return 265;
      case 1094:
        return 266;
      case 1197:
        return 267;
    }
    var r = 0;
    return n > 146 && ++r, n > 148 && ++r, n > 155 && ++r, n > 160 && ++r, n > 161 && ++r, n > 166 && ++r, n > 167 && ++r, n - 1 + r;
  }(e) : S0[e];
  return t === void 0 || dk[t] === void 0 ? -1 : t;
}
function fl() {
  return fl.empty();
}
function Sy(e, t, n, r) {
  r = e[t], e[t] = e[n], e[n] = r;
}
function WU(e, t) {
  return (e = Math.abs(e)) > (t = Math.abs(t)) ? (t /= e, e * Math.sqrt(1 + t * t)) : t > 0 ? (e /= t, t * Math.sqrt(1 + e * e)) : 0;
}
(function(e) {
  function t(n, r, i) {
    var a = Tx(n);
    if (a < 0) return console.warn("Unknown spacegroup '".concat(n, "', returning a 'P 1' with cellsize [1, 1, 1]")), e.Zero;
    var o = r[0] * r[1] * r[2], s = i[0], u = i[1], l = i[2], c = r[0], d = r[1], f = r[2], p = Math.cos(u), g = (Math.cos(s) - Math.cos(u) * Math.cos(l)) / Math.sin(l), m = Math.sqrt(1 - p * p - g * g), v = [c, 0, 0], h = [Math.cos(l) * d, Math.sin(l) * d, 0], y = [p * f, g * f, m * f], x = ne.ofRows([[v[0], h[0], y[0], 0], [0, h[1], y[1], 0], [0, 0, y[2], 0], [0, 0, 0, 1]]);
    return { index: a, size: r, volume: o, anglesInRadians: i, toFractional: ne.invert(ne.zero(), x), fromFractional: x };
  }
  e.Zero = t("P 1", A.create(1, 1, 1), A.create(Math.PI / 2, Math.PI / 2, Math.PI / 2)), e.isZero = function(n) {
    return !n || n.index === 0 && n.size[0] === 1 && n.size[1] === 1 && n.size[1] === 1;
  }, e.create = t, e.createMaterial = function(n, r, i, a, o, s) {
    var u = Tx(n);
    return u < 0 ? (console.warn("Unknown spacegroup '".concat(n, "', returning a 'P 1' with cellsize [1, 1, 1]")), e.Zero) : { index: u, size: r, volume: a, anglesInRadians: i, toFractional: o, fromFractional: s };
  };
})(os || (os = {})), function(e) {
  function t(f) {
    var p = jU[f.index].map(function(g) {
      return v = Cy[(m = qU[g])[0]], h = Cy[m[1]], y = Cy[m[2]], ne.ofRows([v, h, y, [0, 0, 0, 1]]);
      var m, v, h, y;
    });
    return { name: dk[f.index], num: YU[f.index], cell: f, operators: p };
  }
  e.ZeroP1 = t(os.Zero), e.create = t;
  var n = A(), r = ne();
  function i(f, p, g, m, v, h) {
    return A.set(n, g, m, v), ne.fromTranslation(r, n), ne.mul(h, ne.mul(h, ne.mul(h, f.cell.fromFractional, r), f.operators[p]), f.cell.toFractional);
  }
  e.setOperatorMatrix = i, e.getSymmetryOperator = function(f, p, g, m, v) {
    var h = i(f, p, g, m, v, ne.zero());
    return lr.create("".concat(p + 1, "_").concat(5 + g).concat(5 + m).concat(5 + v), h, { hkl: A.create(g, m, v), spgrOp: p });
  };
  var a = A(), o = A(), s = A(), u = A();
  function l(f, p, g) {
    var m = [];
    if (f > 0 ? m.push("+X") : f < 0 && m.push("-X"), p > 0 ? m.push("+Y") : p < 0 && m.push("-Y"), g > 0 ? m.push("+Z") : g < 0 && m.push("-Z"), m.length === 1) return m[0].charAt(0) === "+" ? m[0].substr(1) : m[0];
    if (m.length === 2) {
      var v = m[0].charAt(0), h = m[1].charAt(0);
      if (v === "+") return "".concat(m[0].substr(1)).concat(m[1]);
      if (h === "+") return "".concat(m[1].substr(1)).concat(m[0]);
    }
    throw new Error("unknown rotation '".concat(m, "', ").concat(f, " ").concat(p, " ").concat(g));
  }
  function c(f) {
    switch (f) {
      case 0.5:
        return "1/2";
      case 1 / 4:
        return "1/4";
      case 3 / 4:
        return "3/4";
      case 1 / 3:
        return "1/3";
      case 2 / 3:
        return "2/3";
      case 1 / 6:
        return "1/6";
      case 5 / 6:
        return "5/6";
    }
    return "";
  }
  function d(f, p) {
    return p === "" ? f : f.length > 2 ? "".concat(f, "+").concat(p) : f.charAt(0) === "-" ? "".concat(p).concat(f) : "".concat(p, "+").concat(f);
  }
  e.getSymmetryOperatorRef = function(f, p, g, m, v, h) {
    var y = ne.zero();
    A.set(n, g, m, v), A.floor(a, h), ne.copy(y, f.operators[p]), A.floor(o, A.transformMat4(o, h, y)), ne.getTranslation(u, y), A.sub(u, u, o), A.add(u, u, a), A.add(u, u, n), ne.setTranslation(y, u), ne.mul(y, f.cell.fromFractional, y), ne.mul(y, y, f.cell.toFractional), A.sub(s, o, a);
    var x = g - s[0], S = m - s[1], b = v - s[2];
    return lr.create("".concat(p + 1, "_").concat(5 + x).concat(5 + S).concat(5 + b), y, { hkl: A.create(x, S, b), spgrOp: p });
  }, e.getOperatorXyz = function(f) {
    return [d(l(f[0], f[4], f[8]), c(f[12])), d(l(f[1], f[5], f[9]), c(f[13])), d(l(f[2], f[6], f[10]), c(f[14]))].join(",");
  };
}(za || (za = {})), function(e) {
  e.add = function(t, n, r) {
    t.squaredDistances[t.count] = r, t.indices[t.count++] = n;
  }, e.reset = function(t) {
    t.count = 0;
  }, e.create = function() {
    return { count: 0, indices: [], squaredDistances: [] };
  }, e.copy = function(t, n) {
    for (var r = 0; r < n.count; ++r) t.indices[r] = n.indices[r], t.squaredDistances[r] = n.squaredDistances[r];
    return t.count = n.count, t;
  };
}(ad || (ad = {})), function(e) {
  function t() {
    return { origin: A(), dirA: A(), dirB: A(), dirC: A() };
  }
  function n(o, s) {
    return A.copy(o.origin, s.origin), A.copy(o.dirA, s.dirA), A.copy(o.dirB, s.dirB), A.copy(o.dirC, s.dirC), o;
  }
  function r(o, s) {
    return A.set(o, 2 * A.magnitude(s.dirA), 2 * A.magnitude(s.dirB), 2 * A.magnitude(s.dirC));
  }
  e.create = function(o, s, u, l) {
    return { origin: o, dirA: s, dirB: u, dirC: l };
  }, e.empty = t, e.copy = n, e.clone = function(o) {
    return n(t(), o);
  }, e.size = r;
  var i = A();
  e.volume = function(o) {
    return r(i, o), i[0] * i[1] * i[2];
  }, e.normalize = function(o, s) {
    return A.copy(o.origin, s.origin), A.normalize(o.dirA, s.dirA), A.normalize(o.dirB, s.dirB), A.normalize(o.dirC, s.dirC), o;
  };
  var a = pi();
  e.transform = function(o, s, u) {
    A.transformMat4(o.origin, s.origin, u);
    var l = pi.directionTransform(a, u);
    return A.transformMat3(o.dirA, s.dirA, l), A.transformMat3(o.dirB, s.dirB, l), A.transformMat3(o.dirC, s.dirC, l), o;
  }, e.scale = function(o, s, u) {
    return A.scale(o.dirA, s.dirA, u), A.scale(o.dirB, s.dirB, u), A.scale(o.dirC, s.dirC, u), o;
  };
}(fl || (fl = {})), function(e) {
  e.create = function(t, n, r) {
    r === void 0 && (r = Float32Array);
    var i = t * n;
    return { data: new r(i), size: i, cols: t, rows: n };
  }, e.get = function(t, n, r) {
    return t.data[t.rows * r + n];
  }, e.set = function(t, n, r, i) {
    return t.data[t.rows * r + n] = i, t;
  }, e.add = function(t, n, r, i) {
    return t.data[t.rows * r + n] += i, t;
  }, e.makeZero = function(t) {
    return t.data.fill(0), t;
  }, e.clone = function(t) {
    return { data: t.data.slice(), size: t.size, cols: t.cols, rows: t.rows };
  }, e.fromArray = function(t, n, r) {
    return { data: t, size: n * r, cols: n, rows: r };
  }, e.transpose = function(t, n) {
    if (t.cols !== n.rows || t.rows !== n.cols) throw new Error("transpose: matrix dimensions incompatible");
    if (t.data === n.data) throw new Error("transpose: matrices share memory");
    for (var r = n.rows, i = n.cols, a = n.data, o = t.data, s = 0, u = 0, l = 0; s < r; l += 1, u += i, ++s) for (var c = l, d = 0; d < i; c += r, d++) o[c] = a[u + d];
    return t;
  }, e.multiplyABt = function(t, n, r) {
    for (var i = n.cols, a = n.rows, o = r.rows, s = n.data, u = r.data, l = t.data, c = 0, d = 0, f = 0; c < a; d += i, c++) for (var p = 0, g = 0; g < o; f++, g++) {
      for (var m = 0, v = d, h = 0; h < i; v++, p++, h++) m += s[v] * u[p];
      l[f] = m;
    }
    return t;
  }, e.meanRows = function(t) {
    for (var n = t.rows, r = t.cols, i = t.data, a = new Array(r), o = 0; o < r; ++o) a[o] = 0;
    for (var s = 0, u = 0; s < n; ++s) for (o = 0; o < r; ++o, ++u) a[o] += i[u];
    for (o = 0; o < r; ++o) a[o] /= n;
    return a;
  }, e.subRows = function(t, n) {
    for (var r = t.rows, i = t.cols, a = t.data, o = 0, s = 0; o < r; ++o) for (var u = 0; u < i; ++u, ++s) a[s] -= n[u];
    return t;
  };
}(Jr || (Jr = {}));
var Jc, XU = 1192092896e-16, ZU = 1e-37;
function QU(e, t, n, r) {
  var i = 0, a = 0, o = e.rows, s = e.cols, u = o, l = s;
  u < l && (i = 1, a = u, u = l, l = a);
  var c = Jr.create(u, u), d = Jr.create(1, l), f = Jr.create(l, l);
  if (i === 0) Jr.transpose(c, e);
  else {
    for (a = 0; a < s * o; a++) c.data[a] = e.data[a];
    for (; a < l * u; a++) c.data[a] = 0;
  }
  if (function(p, g, m, v, h, y, x, S) {
    for (var b = 2 * XU, _ = ZU, C = 0, w = 0, I = 0, M = 0, E = Math.max(y, 30), T = 0, P = 0, k = 0, D = 0, B = 0, L = 0, F = 0, V = 0, G = 0, H = 0, q = 0, z = 0, K = 0, Y = 0, Z = 0, X = 0, W = 0, J = 4660, $ = 0, ee = 0, ce = 0, ae = new Float64Array(x << 3); C < x; C++) {
      for (I = 0, q = 0; I < y; I++) q += (V = p[C * g + I]) * V;
      if (ae[C] = q, v) {
        for (I = 0; I < x; I++) v[C * h + I] = 0;
        v[C * h + C] = 1;
      }
    }
    for (; M < E; M++) {
      for (B = 0, C = 0; C < x - 1; C++) for (w = C + 1; w < x; w++) {
        for (T = C * g | 0, P = w * g | 0, Z = ae[C], X = 0, W = ae[w], I = 2, X += p[T] * p[P], X += p[T + 1] * p[P + 1]; I < y; I++) X += p[T + I] * p[P + I];
        if (!(Math.abs(X) <= b * Math.sqrt(Z * W))) {
          for (K = WU(X *= 2, z = Z - W), z < 0 ? (Y = 0.5 * (K - z), L = X / (K * (F = Math.sqrt(Y / K)) * 2)) : F = X / (K * (L = Math.sqrt((K + z) / (2 * K))) * 2), Z = 0, W = 0, I = 2, G = L * p[T] + F * p[P], H = -F * p[T] + L * p[P], p[T] = G, p[P] = H, Z += G * G, W += H * H, G = L * p[T + 1] + F * p[P + 1], H = -F * p[T + 1] + L * p[P + 1], p[T + 1] = G, p[P + 1] = H, Z += G * G, W += H * H; I < y; I++) G = L * p[T + I] + F * p[P + I], H = -F * p[T + I] + L * p[P + I], p[T + I] = G, p[P + I] = H, Z += G * G, W += H * H;
          if (ae[C] = Z, ae[w] = W, B = 1, v) for (D = w * h | 0, I = 2, G = L * v[k = C * h | 0] + F * v[D], H = -F * v[k] + L * v[D], v[k] = G, v[D] = H, G = L * v[k + 1] + F * v[D + 1], H = -F * v[k + 1] + L * v[D + 1], v[k + 1] = G, v[D + 1] = H; I < x; I++) G = L * v[k + I] + F * v[D + I], H = -F * v[k + I] + L * v[D + I], v[k + I] = G, v[D + I] = H;
        }
      }
      if (B === 0) break;
    }
    for (C = 0; C < x; C++) {
      for (I = 0, q = 0; I < y; I++) q += (V = p[C * g + I]) * V;
      ae[C] = Math.sqrt(q);
    }
    for (C = 0; C < x - 1; C++) {
      for (w = C, I = C + 1; I < x; I++) ae[w] < ae[I] && (w = I);
      if (C !== w && (Sy(ae, C, w, q), v)) {
        for (I = 0; I < y; I++) Sy(p, C * g + I, w * g + I, V);
        for (I = 0; I < x; I++) Sy(v, C * h + I, w * h + I, V);
      }
    }
    for (C = 0; C < x; C++) m[C] = ae[C];
    if (v) for (C = 0; C < S; C++) {
      for (q = C < x ? ae[C] : 0; q <= _; ) {
        for (ee = 1 / y, I = 0; I < y; I++) $ = 256 & (J = 214013 * J + 2531011) >> 16 ? ee : -ee, p[C * g + I] = $;
        for (M = 0; M < 2; M++) for (w = 0; w < C; w++) {
          for (q = 0, I = 0; I < y; I++) q += p[C * g + I] * p[w * g + I];
          for (ce = 0, I = 0; I < y; I++) V = p[C * g + I] - q * p[w * g + I], p[C * g + I] = V, ce += Math.abs(V);
          for (ce = ce ? 1 / ce : 0, I = 0; I < y; I++) p[C * g + I] *= ce;
        }
        for (q = 0, I = 0; I < y; I++) q += (V = p[C * g + I]) * V;
        q = Math.sqrt(q);
      }
      for (F = 1 / q, I = 0; I < y; I++) p[C * g + I] *= F;
    }
  }(c.data, u, d.data, f.data, l, u, l, u), t) {
    for (a = 0; a < l; a++) t.data[a] = d.data[a];
    for (; a < s; a++) t.data[a] = 0;
  }
  i === 0 ? (n && Jr.transpose(n, c), r && Jr.transpose(r, f)) : (n && Jr.transpose(n, f), r && Jr.transpose(r, c));
}
function pe() {
  return pe.zero();
}
function qn() {
  return qn.zero();
}
function bf(e, t, n) {
  return new JU(e, t, n);
}
(function(e) {
  function t(s) {
    if (s.length === 3) return fl.create(A.fromArray(A(), s, 0), A.create(1, 0, 0), A.create(0, 1, 0), A.create(0, 1, 0));
    var u = Jr.fromArray(s, 3, s.length / 3), l = u.rows, c = l / 3, d = Jr.create(3, 3), f = Jr.create(1, 3), p = Jr.create(3, 3), g = Jr.create(3, 3), m = Jr.meanRows(u), v = Jr.subRows(Jr.clone(u), m), h = Jr.transpose(Jr.create(l, 3), v);
    Jr.multiplyABt(d, h, h), QU(d, f, p, g);
    var y = A.create(m[0], m[1], m[2]), x = A.create(p.data[0], p.data[3], p.data[6]), S = A.create(p.data[1], p.data[4], p.data[7]), b = A.create(p.data[2], p.data[5], p.data[8]);
    return A.scale(x, x, Math.sqrt(f.data[0] / c)), A.scale(S, S, Math.sqrt(f.data[1] / c)), A.scale(b, b, Math.sqrt(f.data[2] / c)), fl.create(y, x, S, b);
  }
  e.ofPositions = function(s) {
    var u = t(s);
    return { momentsAxes: u, boxAxes: o(s, u) };
  }, e.calculateMomentsAxes = t;
  var n = A(), r = A(), i = A(), a = A();
  function o(s, u) {
    if (s.length === 3) return fl.clone(u);
    for (var l = -1 / 0, c = -1 / 0, d = -1 / 0, f = -1 / 0, p = -1 / 0, g = -1 / 0, m = A(), v = A(), h = u.origin, y = A.normalize(r, u.dirA), x = A.normalize(i, u.dirB), S = A.normalize(a, u.dirC), b = 0, _ = s.length; b < _; b += 3) {
      A.projectPointOnVector(m, A.fromArray(m, s, b), y, h);
      var C = A.dot(y, A.normalize(v, A.sub(v, m, h))), w = A.distance(m, h);
      C > 0 ? w > l && (l = w) : w > c && (c = w), A.projectPointOnVector(m, A.fromArray(m, s, b), x, h);
      var I = A.dot(x, A.normalize(v, A.sub(v, m, h))), M = A.distance(m, h);
      I > 0 ? M > d && (d = M) : M > f && (f = M), A.projectPointOnVector(m, A.fromArray(m, s, b), S, h);
      var E = A.dot(S, A.normalize(v, A.sub(v, m, h))), T = A.distance(m, h);
      E > 0 ? T > p && (p = T) : T > g && (g = T);
    }
    var P = A.setMagnitude(A(), y, (l + c) / 2), k = A.setMagnitude(A(), x, (d + f) / 2), D = A.setMagnitude(A(), S, (p + g) / 2), B = A(), L = function(F, V, G) {
      A.copy(n, h), A.scaleAndAdd(n, n, y, F), A.scaleAndAdd(n, n, x, V), A.scaleAndAdd(n, n, S, G), A.add(B, B, n);
    };
    return L(l, d, p), L(l, d, -g), L(l, -f, -g), L(l, -f, p), L(-c, -f, -g), L(-c, -f, p), L(-c, d, p), L(-c, d, -g), A.scale(B, B, 1 / 8), fl.create(B, P, k, D);
  }
  e.calculateBoxAxes = o;
})(Jc || (Jc = {})), function(e) {
  function t(s) {
    return s.extrema !== void 0;
  }
  function n(s, u) {
    return { center: s, radius: u };
  }
  function r(s, u) {
    var l;
    return s.extrema !== void 0 ? (s.extrema.length = 0, (l = s.extrema).push.apply(l, u)) : s.extrema = u, s;
  }
  e.hasExtrema = t, e.create = n, e.zero = function() {
    return { center: A(), radius: 0 };
  }, e.clone = function(s) {
    var u = n(A.clone(s.center), s.radius);
    return t(s) && (u.extrema = s.extrema.map(function(l) {
      return A.clone(l);
    })), u;
  }, e.set = function(s, u, l) {
    return A.copy(s.center, u), s.radius = l, s;
  }, e.copy = function(s, u) {
    return A.copy(s.center, u.center), s.radius = u.radius, t(u) && r(s, u.extrema.map(function(l) {
      return A.clone(l);
    })), s;
  }, e.setExtrema = r, e.computeBounding = function(s) {
    for (var u = s.x, l = s.y, c = s.z, d = s.indices, f = 0, p = 0, g = 0, m = 0, v = _e.size(d), h = 0; h < v; h++)
      f += u[y = _e.getAt(d, h)], p += l[y], g += c[y];
    for (v > 0 && (f /= v, p /= v, g /= v), h = 0; h < v; h++) {
      var y, x = u[y = _e.getAt(d, h)] - f, S = l[y] - p, b = c[y] - g, _ = x * x + S * S + b * b;
      _ > m && (m = _);
    }
    return { center: A.create(f, p, g), radius: Math.sqrt(m) };
  }, e.transform = function(s, u, l) {
    return A.transformMat4(s.center, u.center, l), s.radius = u.radius * ne.getMaxScaleOnAxis(l), t(u) && r(s, u.extrema.map(function(c) {
      return A.transformMat4(A(), c, l);
    })), s;
  }, e.translate = function(s, u, l) {
    return A.add(s.center, u.center, l), t(u) && r(s, u.extrema.map(function(c) {
      return A.add(A(), c, l);
    })), s;
  }, e.toArray = function(s, u, l) {
    A.toArray(s.center, u, l), u[l + 3] = s.radius;
  }, e.fromArray = function(s, u, l) {
    return A.fromArray(s.center, u, l), s.radius = u[l + 3], s;
  }, e.fromBox3D = function(s, u) {
    return A.scale(s.center, A.add(s.center, u.max, u.min), 0.5), s.radius = A.distance(s.center, u.max), e.setExtrema(s, [A.create(u.min[0], u.min[1], u.min[2]), A.create(u.max[0], u.max[1], u.max[2]), A.create(u.max[0], u.min[1], u.min[2]), A.create(u.min[0], u.max[1], u.max[2]), A.create(u.min[0], u.min[1], u.max[2]), A.create(u.max[0], u.min[1], u.max[2]), A.create(u.max[0], u.max[1], u.min[2]), A.create(u.min[0], u.max[1], u.min[2])]), s;
  }, e.fromAxes3D = function(s, u) {
    return A.copy(s.center, u.origin), s.radius = Math.max(A.magnitude(u.dirA), A.magnitude(u.dirB), A.magnitude(u.dirC)), s;
  };
  var i = A();
  e.fromDimensionsAndTransform = function(s, u, l) {
    var c = u[0], d = u[1], f = u[2], p = A.create(0, 0, 0);
    A.transformMat4(p, p, l);
    var g = A.create(c, d, f);
    A.transformMat4(g, g, l);
    var m = A.create(c, 0, 0);
    A.transformMat4(m, m, l);
    var v = A.create(0, d, f);
    A.transformMat4(v, v, l);
    var h = A.create(0, 0, f);
    A.transformMat4(h, h, l);
    var y = A.create(c, 0, f);
    A.transformMat4(y, y, l);
    var x = A.create(c, d, 0);
    A.transformMat4(x, x, l);
    var S = A.create(0, d, 0);
    A.transformMat4(S, S, l), A.add(i, p, g), A.scale(i, i, 0.5);
    var b = Math.max(A.distance(p, g), A.distance(m, v));
    return e.set(s, i, b / 2), e.setExtrema(s, [p, g, m, v, h, y, x, S]), s;
  };
  var a = A();
  e.addVec3 = function(s, u, l) {
    return A.distance(u.center, l) < u.radius ? e.copy(s, u) : (A.sub(a, u.center, l), A.sub(a, u.center, a), A.setMagnitude(a, a, u.radius), A.scale(s.center, A.add(a, a, l), 0.5), s.radius = A.distance(s.center, l), s);
  }, e.expandBySphere = function(s, u, l) {
    return A.copy(s.center, u.center), s.radius = Math.max(u.radius, A.distance(u.center, l.center) + l.radius), t(u) && t(l) && r(s, Re(Re([], u.extrema.map(function(c) {
      return A.clone(c);
    }), !0), l.extrema.map(function(c) {
      return A.clone(c);
    }), !0)), s;
  };
  var o = A();
  e.expand = function(s, u, l) {
    var c, d;
    if (A.copy(s.center, u.center), s.radius = u.radius + l, u.radius < 1e-12 || ((d = (c = u.extrema) === null || c === void 0 ? void 0 : c.length) !== null && d !== void 0 ? d : 0) <= 1) return s.extrema = void 0, s;
    if (t(u)) {
      for (var f = new Float32Array(3 * u.extrema.length), p = 0; p < u.extrema.length; p++) A.toArray(u.extrema[p], f, 3 * p);
      var g = Jc.calculateMomentsAxes(f);
      fl.scale(g, fl.normalize(g, g), l), r(s, u.extrema.map(function(m) {
        A.normalize(o, A.sub(o, m, u.center));
        var v = A.clone(m), h = A.dot(o, g.dirA) < 0 ? -1 : 1;
        A.scaleAndAdd(v, v, g.dirA, h);
        var y = A.dot(o, g.dirB) < 0 ? -1 : 1;
        A.scaleAndAdd(v, v, g.dirB, y);
        var x = A.dot(o, g.dirC) < 0 ? -1 : 1;
        return A.scaleAndAdd(v, v, g.dirC, x), A.distance(s.center, v) > s.radius && (u.extrema.length >= 14 && A.normalize(o, A.sub(o, v, u.center)), A.scaleAndAdd(v, s.center, o, s.radius)), v;
      }));
    }
    return s;
  }, e.exactEquals = function(s, u) {
    return s.radius === u.radius && A.exactEquals(s.center, u.center);
  }, e.equals = function(s, u) {
    var l = s.radius, c = u.radius;
    return Math.abs(l - c) <= sr * Math.max(1, Math.abs(l), Math.abs(c)) && A.equals(s.center, u.center);
  }, e.includes = function(s, u) {
    if (t(u)) {
      for (var l = 0, c = u.extrema; l < c.length; l++) {
        var d = c[l];
        if (A.distance(s.center, d) > s.radius) return !1;
      }
      return !0;
    }
    return A.distance(s.center, u.center) + u.radius <= s.radius;
  }, e.overlaps = function(s, u) {
    return A.distance(s.center, u.center) <= s.radius + u.radius;
  }, e.distance = function(s, u) {
    return A.distance(s.center, u.center) - s.radius + u.radius;
  };
}(pe || (pe = {})), function(e) {
  function t() {
    return { min: A(), max: A() };
  }
  function n(l, c) {
    return A.copy(l.min, c.min), A.copy(l.max, c.max), l;
  }
  function r(l, c) {
    e.setEmpty(l);
    for (var d = 0, f = c.length; d < f; d++) e.add(l, c[d]);
    return l;
  }
  function i(l, c) {
    return A.sub(l, c.max, c.min);
  }
  e.create = function(l, c) {
    return { min: l, max: c };
  }, e.zero = t, e.copy = n, e.clone = function(l) {
    return n(t(), l);
  }, e.fromSphere3D = function(l, c) {
    if (pe.hasExtrema(c) && c.extrema.length >= 14) return r(l, c.extrema);
    var d = A.create(c.radius, c.radius, c.radius);
    return A.sub(l.min, c.center, d), A.add(l.max, c.center, d), l;
  }, e.fromVec3Array = r, e.computeBounding = function(l) {
    for (var c = A.create(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), d = A.create(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), f = l.x, p = l.y, g = l.z, m = l.indices, v = 0, h = _e.size(m); v < h; v++) {
      var y = _e.getAt(m, v);
      c[0] = Math.min(f[y], c[0]), c[1] = Math.min(p[y], c[1]), c[2] = Math.min(g[y], c[2]), d[0] = Math.max(f[y], d[0]), d[1] = Math.max(p[y], d[1]), d[2] = Math.max(g[y], d[2]);
    }
    return { min: c, max: d };
  }, e.size = i;
  var a = A();
  function o(l) {
    return A.set(l.min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), A.set(l.max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), l;
  }
  function s(l, c) {
    return A.min(l.min, l.min, c), A.max(l.max, l.max, c), l;
  }
  e.volume = function(l) {
    return i(a, l), a[0] * a[1] * a[2];
  }, e.setEmpty = o, e.add = s, e.expand = function(l, c, d) {
    return A.sub(l.min, c.min, d), A.add(l.max, c.max, d), l;
  }, e.scale = function(l, c, d) {
    return A.scale(l.min, c.min, d), A.scale(l.max, c.max, d), l;
  };
  var u = A();
  e.transform = function(l, c, d) {
    var f = c.min, p = f[0], g = f[1], m = f[2], v = c.max, h = v[0], y = v[1], x = v[2];
    return o(l), s(l, A.transformMat4(u, A.set(u, p, g, m), d)), s(l, A.transformMat4(u, A.set(u, p, g, x), d)), s(l, A.transformMat4(u, A.set(u, p, y, m), d)), s(l, A.transformMat4(u, A.set(u, p, y, x), d)), s(l, A.transformMat4(u, A.set(u, h, g, m), d)), s(l, A.transformMat4(u, A.set(u, h, g, x), d)), s(l, A.transformMat4(u, A.set(u, h, y, m), d)), s(l, A.transformMat4(u, A.set(u, h, y, x), d)), l;
  }, e.containsVec3 = function(l, c) {
    return !(c[0] < l.min[0] || c[0] > l.max[0] || c[1] < l.min[1] || c[1] > l.max[1] || c[2] < l.min[2] || c[2] > l.max[2]);
  };
}(qn || (qn = {}));
var He, JU = function() {
  function e(t, n, r) {
    var i = function(a, o, s) {
      var u, l, c = qn.expand(qn(), o.box, A.create(0.5, 0.5, 0.5)), d = a.indices, f = qn.size(A.zero(), c), p = _e.size(d), g = typeof s == "number" ? s : 32, m = Array.isArray(s) && s;
      if (m) l = [Math.ceil(f[0] / m[0]), Math.ceil(f[1] / m[1]), Math.ceil(f[2] / m[2])], u = m;
      else if (p > 0) {
        var v = Math.ceil(p / g), h = Math.pow(v / (f[0] * f[1] * f[2]), 1 / 3);
        l = [Math.ceil(f[0] * h), Math.ceil(f[1] * h), Math.ceil(f[2] * h)], u = [f[0] / l[0], f[1] / l[1], f[2] / l[2]];
      } else u = f, l = [1, 1, 1];
      var y = { x: a.x, y: a.y, z: a.z, indices: d, radius: a.radius }, x = { size: l, data: y, expandedBox: c, boundingBox: o.box, boundingSphere: o.sphere, elementCount: p, delta: u };
      return function(S) {
        for (var b = S.expandedBox, _ = S.size, C = _[0], w = _[1], I = _[2], M = S.data, E = M.x, T = M.y, P = M.z, k = M.radius, D = M.indices, B = S.elementCount, L = S.delta, F = C * w * I, V = b.min, G = V[0], H = V[1], q = V[2], z = 0, K = 0, Y = new Uint32Array(F), Z = new Int32Array(B), X = 0; X < B; X++) {
          var W = _e.getAt(D, X), J = (Math.floor((E[W] - G) / L[0]) * w + Math.floor((T[W] - H) / L[1])) * I + Math.floor((P[W] - q) / L[2]);
          (Y[J] += 1) === 1 && (K += 1), Z[X] = J;
        }
        if (k) for (X = 0; X < B; X++)
          k[W = _e.getAt(D, X)] > z && (z = k[W]);
        for (var $ = new Int32Array(K), ee = (W = 0, 0); W < F; W++) {
          var ce = Y[W];
          ce > 0 && (Y[W] = ee + 1, $[ee] = ce, ee += 1);
        }
        var ae = new Uint32Array(K);
        for (W = 1; W < K; ++W) ae[W] += ae[W - 1] + $[W - 1];
        var he = new Int32Array(K), Oe = new Int32Array(B);
        for (W = 0; W < B; W++) {
          var Ne = Y[Z[W]];
          if (Ne > 0) {
            var Ue = Ne - 1;
            Oe[ae[Ue] + he[Ue]] = W, he[Ue] += 1;
          }
        }
        return { size: S.size, bucketArray: Oe, bucketCounts: $, bucketOffset: ae, grid: Y, delta: L, min: S.expandedBox.min, data: S.data, maxRadius: z, expandedBox: S.expandedBox, boundingBox: S.boundingBox, boundingSphere: S.boundingSphere };
      }(x);
    }(t, n, r);
    this.ctx = { grid: i, x: 0.1, y: 0.1, z: 0.1, radius: 0.1, isCheck: !1 }, this.boundary = { box: i.boundingBox, sphere: i.boundingSphere }, this.buckets = { offset: i.bucketOffset, count: i.bucketCounts, array: i.bucketArray }, this.result = ad.create();
  }
  return e.prototype.find = function(t, n, r, i, a) {
    this.ctx.x = t, this.ctx.y = n, this.ctx.z = r, this.ctx.radius = i, this.ctx.isCheck = !1;
    var o = a ?? this.result;
    return kx(this.ctx, o), o;
  }, e.prototype.check = function(t, n, r, i) {
    return this.ctx.x = t, this.ctx.y = n, this.ctx.z = r, this.ctx.radius = i, this.ctx.isCheck = !0, kx(this.ctx, this.result);
  }, e;
}();
function kx(e, t) {
  var n = e.grid, r = n.min, i = n.size, a = i[0], o = i[1], s = i[2], u = n.bucketOffset, l = n.bucketCounts, c = n.bucketArray, d = n.grid, f = n.data, p = f.x, g = f.y, m = f.z, v = f.indices, h = f.radius, y = n.delta, x = n.maxRadius, S = e.radius, b = e.isCheck, _ = e.x, C = e.y, w = e.z, I = S + x, M = I * I;
  ad.reset(t);
  var E = Math.max(0, Math.floor((_ - I - r[0]) / y[0])), T = Math.max(0, Math.floor((C - I - r[1]) / y[1])), P = Math.max(0, Math.floor((w - I - r[2]) / y[2])), k = Math.min(a - 1, Math.floor((_ + I - r[0]) / y[0])), D = Math.min(o - 1, Math.floor((C + I - r[1]) / y[1])), B = Math.min(s - 1, Math.floor((w + I - r[2]) / y[2]));
  if (E > k || T > D || P > B) return !1;
  for (var L = E; L <= k; L++) for (var F = T; F <= D; F++) for (var V = P; V <= B; V++) {
    var G = d[(L * o + F) * s + V];
    if (G !== 0) for (var H = G - 1, q = u[H], z = q + l[H], K = q; K < z; K++) {
      var Y = _e.getAt(v, c[K]), Z = p[Y] - _, X = g[Y] - C, W = m[Y] - w, J = Z * Z + X * X + W * W;
      if (J <= M) {
        if (x > 0 && Math.sqrt(J) - h[Y] > S) continue;
        if (b) return !0;
        ad.add(t, c[K], J);
      }
    }
  }
  return t.count > 0;
}
(function(e) {
  function t(i, a, o) {
    return { kind: "element-location", structure: i, unit: a, element: o || 0 };
  }
  e.create = t, e.clone = function(i) {
    return t(i.structure, i.unit, i.element);
  }, e.set = function(i, a, o, s) {
    return a && (i.structure = a), o && (i.unit = o), s !== void 0 && (i.element = s), i;
  }, e.copy = function(i, a) {
    return i.unit = a.unit, i.element = a.element, i;
  }, e.is = function(i) {
    return !!i && i.kind === "element-location";
  }, e.areEqual = function(i, a) {
    return i.unit === a.unit && i.element === a.element;
  };
  var n = A.zero(), r = A.zero();
  e.distance = function(i, a) {
    return i.unit.conformation.position(i.element, n), a.unit.conformation.position(a.element, r), A.distance(n, r);
  }, e.residueIndex = function(i) {
    return i.unit.model.atomicHierarchy.residueAtomSegments.index[i.element];
  }, e.chainIndex = function(i) {
    return i.unit.model.atomicHierarchy.chainAtomSegments.index[i.element];
  };
})(He || (He = {}));
var $U = function() {
  function e(t, n) {
    this.getHash = t, this.areEqual = n, this.size = 0, this.byHash = /* @__PURE__ */ new Map();
  }
  return e.prototype.add = function(t) {
    var n = this.getHash(t);
    if (this.byHash.has(n)) {
      for (var r = this.byHash.get(n), i = 0, a = r.length; i < a; i++) if (this.areEqual(t, r[i])) return !1;
      return r[r.length] = t, this.size++, !0;
    }
    return this.byHash.set(n, [t]), this.size++, !0;
  }, e.prototype.has = function(t) {
    var n = this.getHash(t);
    if (!this.byHash.has(n)) return !1;
    for (var r = this.byHash.get(n), i = 0, a = r.length; i < a; i++) if (this.areEqual(t, r[i])) return !0;
    return !1;
  }, e;
}();
function L6(e, t) {
  return new $U(e, t);
}
function Dx() {
  return new eH();
}
function Ox(e) {
  return { previous: null, next: null, inList: !0, value: e };
}
var or, ue, Vi, ct, mn, eH = function() {
  function e() {
    this.count = 0, this.first = null, this.last = null;
  }
  return e.prototype.addFirst = function(t) {
    var n = Ox(t);
    return n.inList = !0, this.first && (this.first.previous = n), n.next = this.first, this.first = n, this.count++, this.last || (this.last = n), n;
  }, e.prototype.addLast = function(t) {
    var n = Ox(t);
    return this.last !== null && (this.last.next = n), n.previous = this.last, this.last = n, this.first === null && (this.first = n), n.inList = !0, this.count++, n;
  }, e.prototype.removeFirst = function() {
    var t = this.first;
    if (t) return this.remove(t), t.value;
  }, e.prototype.removeLast = function() {
    var t = this.last;
    if (t) return this.remove(t), t.value;
  }, e.prototype.remove = function(t) {
    t.inList && (t.inList = !1, t.previous !== null ? t.previous.next = t.next : t.previous === null && (this.first = t.next), t.next !== null ? t.next.previous = t.previous : t.next === null && (this.last = t.previous), t.next = null, t.previous = null, this.count--);
  }, e.prototype.find = function(t) {
    for (var n = this.first; n !== null; ) {
      if (n.value === t) return n;
      n = n.next;
    }
  }, e;
}();
function Ge(e, t) {
  var n = t || {}, r = n.description, i = r === void 0 ? void 0 : r, a = n.isOptional, o = a !== void 0 && a, s = n.isRest, u = s !== void 0 && s, l = n.defaultValue;
  return { type: e, isOptional: o, isRest: u, defaultValue: l === void 0 ? void 0 : l, description: i };
}
function Op(e, t, n, r) {
  var i = function(a) {
    return Vi.Apply(Vi.Symbol(i.id), a);
  };
  return i.info = { namespace: "", name: e, description: r }, i.id = "", i.args = t, i.type = n, i;
}
function Zg(e) {
  var t = e;
  return typeof t == "function" && !!t.info && !!t.args && typeof t.info.namespace == "string" && !!t.type;
}
function vt(e, t, n) {
  return Op("", e, t, n);
}
function fk(e) {
  pk("", "", e);
}
function mk(e) {
  var t = [];
  return hk(e, t), t;
}
function Bx(e) {
  var t = /([a-z])([A-Z])([a-z]|$)/g;
  return e.replace(t, function(n, r, i, a) {
    return "".concat(r, "-").concat(i.toLocaleLowerCase()).concat(a);
  }).replace(t, function(n, r, i, a) {
    return "".concat(r, "-").concat(i.toLocaleLowerCase()).concat(a);
  });
}
function pk(e, t, n) {
  if (Zg(n)) return n.info.namespace = e, n.info.name = n.info.name || Bx(t), void (n.id = "".concat(n.info.namespace, ".").concat(n.info.name));
  for (var r = "".concat(n["@namespace"] || Bx(t)), i = e ? "".concat(e, ".").concat(r) : r, a = 0, o = Object.keys(n); a < o.length; a++) {
    var s = o[a];
    (typeof n[s] == "object" || Zg(n[s])) && pk(i, s, n[s]);
  }
}
function hk(e, t) {
  if (Zg(e)) t.push(e);
  else for (var n = 0, r = Object.keys(e); n < r.length; n++) {
    var i = r[n];
    (typeof e[i] == "object" || Zg(e[i])) && hk(e[i], t);
  }
}
function xi(e, t) {
  return vt(ct.Dictionary({ 0: Ge(e) }), e, t);
}
function oc(e, t) {
  return vt(ct.List(e, { nonEmpty: !0 }), e, t);
}
function ru(e, t, n) {
  return vt(ct.Dictionary({ 0: Ge(e), 1: Ge(e) }), t, n);
}
(function(e) {
  e.create = function() {
    return { keys: /* @__PURE__ */ new Set(), array: [] };
  }, e.add = function(t, n, r) {
    var i = t.keys, a = t.array;
    return !i.has(n) && (i.add(n), a[a.length] = r, !0);
  }, e.has = function(t, n) {
    return t.keys.has(n);
  };
})(or || (or = {})), function(e) {
  function t(r, i, a) {
    return { kind: "value", namespace: r, name: i, parent: a };
  }
  function n(r, i, a, o) {
    for (var s = /* @__PURE__ */ Object.create(null), u = 0, l = o; u < l.length; u++)
      s[l[u]] = !0;
    return { kind: "oneof", namespace: r, name: i, type: a, values: s };
  }
  e.Variable = function(r, i, a) {
    return { kind: "variable", name: r, type: i, isConstraint: a };
  }, e.Value = t, e.Container = function(r, i, a, o) {
    return { kind: "container", namespace: r, name: i, child: a, alias: o };
  }, e.Union = function(r) {
    return { kind: "union", types: r };
  }, e.OneOf = n, e.Any = { kind: "any" }, e.AnyValue = { kind: "any-value" }, e.Num = t("", "Number"), e.Str = t("", "String"), e.Bool = n("", "Bool", e.Str, ["true", "false"]), e.oneOfValues = function(r) {
    var i = r.values;
    return Object.keys(i).sort();
  };
}(ue || (ue = {})), function(e) {
  function t(r) {
    return !!r && !!r.head && typeof r == "object";
  }
  function n(r) {
    return !!r && typeof r.name == "string";
  }
  e.Symbol = function(r) {
    return { name: r };
  }, e.Apply = function(r, i) {
    return i ? { head: r, args: i } : { head: r };
  }, e.isArgumentsArray = function(r) {
    return !!r && Array.isArray(r);
  }, e.isArgumentsMap = function(r) {
    return !!r && !Array.isArray(r);
  }, e.isLiteral = function(r) {
    return !t(r) && !n(r);
  }, e.isApply = t, e.isSymbol = n;
}(Vi || (Vi = {})), function(e) {
  function t(n) {
    return { kind: "dictionary", map: n, "@type": 0 };
  }
  e.None = t({}), e.Dictionary = t, e.List = function(n, r) {
    var i = (r || {}).nonEmpty;
    return { kind: "list", type: n, nonEmpty: i !== void 0 && i, "@type": 0 };
  };
}(ct || (ct = {})), function(e) {
  e.AnyVar = ue.Variable("a", ue.Any), e.AnyValueVar = ue.Variable("a", ue.Any), e.ConstrainedVar = ue.Variable("a", ue.Any, !0), e.Regex = ue.Value("Core", "Regex"), e.Set = function(t) {
    return ue.Container("Core", "Set", t || e.AnyValueVar);
  }, e.List = function(t) {
    return ue.Container("Core", "List", t || e.AnyVar);
  }, e.Fn = function(t, n) {
    return ue.Container("Core", "Fn", t || e.AnyVar, n);
  }, e.Flags = function(t, n) {
    return ue.Container("Core", "Flags", t, n);
  }, e.BitFlags = e.Flags(ue.Num, "BitFlags");
}(mn || (mn = {})), ct.Dictionary({ 0: Ge(ue.Num), 1: Ge(ue.Num) }), Ge(ue.Str);
var N6 = { "@header": "Language Primitives", type: { "@header": "Types", bool: vt(ct.Dictionary({ 0: Ge(ue.AnyValue) }), ue.Bool, "Convert a value to boolean."), num: vt(ct.Dictionary({ 0: Ge(ue.AnyValue) }), ue.Num, "Convert a value to number."), str: vt(ct.Dictionary({ 0: Ge(ue.AnyValue) }), ue.Str, "Convert a value to string."), regex: vt(ct.Dictionary({ 0: Ge(ue.Str, { description: "Expression" }), 1: Ge(ue.Str, { isOptional: !0, description: "Flags, e.g. 'i' for ignore case" }) }), mn.Regex, "Creates a regular expression from a string using the ECMAscript syntax."), list: vt(ct.List(mn.AnyVar), mn.List()), set: vt(ct.List(mn.AnyValueVar), mn.Set()), bitflags: vt(ct.Dictionary({ 0: Ge(ue.Num) }), mn.BitFlags, "Interpret a number as bitflags."), compositeKey: vt(ct.List(ue.AnyValue), ue.AnyValue) }, logic: { "@header": "Logic", not: xi(ue.Bool), and: oc(ue.Bool), or: oc(ue.Bool) }, ctrl: { "@header": "Control", eval: vt(ct.Dictionary({ 0: Ge(mn.Fn(mn.AnyVar)) }), mn.AnyVar, "Evaluate a function."), fn: vt(ct.Dictionary({ 0: Ge(mn.AnyVar) }), mn.Fn(mn.AnyVar), 'Wrap an expression to a "lazy" function.'), if: vt(ct.Dictionary({ 0: Ge(ue.Bool, { description: "Condition" }), 1: Ge(ue.Variable("a", ue.Any), { description: "If true" }), 2: Ge(ue.Variable("b", ue.Any), { description: "If false" }) }), ue.Union([ue.Variable("a", ue.Any), ue.Variable("b", ue.Any)])), assoc: vt(ct.Dictionary({ 0: Ge(ue.Str, { description: "Name" }), 1: Ge(ue.Variable("a", ue.Any), { description: "Value to assign" }) }), ue.Variable("a", ue.Any)) }, rel: { "@header": "Relational", eq: ru(ue.Variable("a", ue.AnyValue, !0), ue.Bool), neq: ru(ue.Variable("a", ue.AnyValue, !0), ue.Bool), lt: ru(ue.Num, ue.Bool), lte: ru(ue.Num, ue.Bool), gr: ru(ue.Num, ue.Bool), gre: ru(ue.Num, ue.Bool), inRange: vt(ct.Dictionary({ 0: Ge(ue.Num, { description: "Value to test" }), 1: Ge(ue.Num, { description: "Minimum value" }), 2: Ge(ue.Num, { description: "Maximum value" }) }), ue.Bool, "Check if the value of the 1st argument is >= 2nd and <= 3rd.") }, math: { "@header": "Math", add: oc(ue.Num), sub: oc(ue.Num), mult: oc(ue.Num), div: ru(ue.Num, ue.Num), pow: ru(ue.Num, ue.Num), mod: ru(ue.Num, ue.Num), min: oc(ue.Num), max: oc(ue.Num), floor: xi(ue.Num), ceil: xi(ue.Num), roundInt: xi(ue.Num), abs: xi(ue.Num), sqrt: xi(ue.Num), cbrt: xi(ue.Num), sin: xi(ue.Num), cos: xi(ue.Num), tan: xi(ue.Num), asin: xi(ue.Num), acos: xi(ue.Num), atan: xi(ue.Num), sinh: xi(ue.Num), cosh: xi(ue.Num), tanh: xi(ue.Num), exp: xi(ue.Num), log: xi(ue.Num), log10: xi(ue.Num), atan2: ru(ue.Num, ue.Num) }, str: { "@header": "Strings", concat: oc(ue.Str), match: vt(ct.Dictionary({ 0: Ge(mn.Regex), 1: Ge(ue.Str) }), ue.Bool) }, list: { "@header": "Lists", getAt: vt(ct.Dictionary({ 0: Ge(mn.List()), 1: Ge(ue.Num) }), mn.AnyVar), equal: vt(ct.Dictionary({ 0: Ge(mn.List()), 1: Ge(mn.List()) }), ue.Bool) }, set: { "@header": "Sets", has: vt(ct.Dictionary({ 0: Ge(mn.Set(mn.ConstrainedVar)), 1: Ge(mn.ConstrainedVar) }), ue.Bool, "Check if the the 1st argument includes the value of the 2nd."), isSubset: vt(ct.Dictionary({ 0: Ge(mn.Set(mn.ConstrainedVar)), 1: Ge(mn.Set(mn.ConstrainedVar)) }), ue.Bool, "Check if the the 1st argument is a subset of the 2nd.") }, flags: { "@header": "Flags", hasAny: vt(ct.Dictionary({ 0: Ge(mn.Flags(mn.ConstrainedVar)), 1: Ge(mn.Flags(mn.ConstrainedVar)) }), ue.Bool, "Check if the the 1st argument has at least one of the 2nd one's flags."), hasAll: vt(ct.Dictionary({ 0: Ge(mn.Flags(mn.ConstrainedVar)), 1: Ge(mn.Flags(mn.ConstrainedVar)) }), ue.Bool, "Check if the the 1st argument has all 2nd one's flags.") } };
fk(N6);
var $e, tH = mk(N6);
function fn(e, t) {
  return vt(ct.Dictionary({ 0: Ge($e.ElementReference, { isOptional: !0, defaultValue: "slot.current-atom" }) }), e, t);
}
function Jm(e, t) {
  return vt(ct.None, e, t);
}
(function() {
  for (var e = /* @__PURE__ */ Object.create(null), t = 0, n = tH; t < n.length; t++) {
    var r = n[t];
    e[r.id] = r;
  }
})(), function(e) {
  e.ElementSymbol = ue.Value("Structure", "ElementSymbol"), e.AtomName = ue.Value("Structure", "AtomName"), e.BondFlag = ue.OneOf("Structure", "BondFlag", ue.Str, ["covalent", "metallic", "ion", "hydrogen", "sulfide", "computed", "aromatic"]), e.BondFlags = mn.Flags(e.BondFlag, "BondFlags"), e.SecondaryStructureFlag = ue.OneOf("Structure", "SecondaryStructureFlag", ue.Str, ["alpha", "beta", "3-10", "pi", "sheet", "strand", "helix", "turn", "none"]), e.SecondaryStructureFlags = mn.Flags(e.SecondaryStructureFlag, "SecondaryStructureFlag"), e.RingFingerprint = ue.Value("Structure", "RingFingerprint"), e.EntityType = ue.OneOf("Structure", "EntityType", ue.Str, ["polymer", "non-polymer", "water", "branched"]), e.EntitySubtype = ue.OneOf("Structure", "EntitySubtype", ue.Str, ["other", "polypeptide(D)", "polypeptide(L)", "polydeoxyribonucleotide", "polyribonucleotide", "polydeoxyribonucleotide/polyribonucleotide hybrid", "cyclic-pseudo-peptide", "peptide nucleic acid", "oligosaccharide"]), e.ObjectPrimitive = ue.OneOf("Structure", "ObjectPrimitive", ue.Str, ["atomistic", "sphere", "gaussian", "other"]), e.ResidueId = ue.Value("Structure", "ResidueId"), e.ElementSet = ue.Value("Structure", "ElementSet"), e.ElementSelection = ue.Value("Structure", "ElementSelection"), e.ElementReference = ue.Value("Structure", "ElementReference"), e.ElementSelectionQuery = mn.Fn(e.ElementSelection, "ElementSelectionQuery");
}($e || ($e = {}));
var te = { core: N6, structureQuery: { "@header": "Structure Queries", type: { "@header": "Types", elementSymbol: vt(ct.Dictionary({ 0: Ge(ue.Str) }), $e.ElementSymbol, "Create element symbol representation from a string value."), atomName: vt(ct.Dictionary({ 0: Ge(ue.AnyValue) }), $e.AtomName, "Convert a value to an atom name."), entityType: vt(ct.Dictionary({ 0: Ge($e.EntityType) }), $e.EntityType, "Create normalized representation of entity type: ".concat(ue.oneOfValues($e.EntityType).join(", "), ".")), bondFlags: vt(ct.List($e.BondFlag), $e.BondFlags, "Create bond flags representation from a list of strings. Allowed flags: ".concat(ue.oneOfValues($e.BondFlag).join(", "), ".")), ringFingerprint: vt(ct.List($e.ElementSymbol, { nonEmpty: !0 }), $e.RingFingerprint, "Create ring fingerprint from the supplied atom element list."), secondaryStructureFlags: vt(ct.List($e.SecondaryStructureFlag), $e.SecondaryStructureFlags, "Create secondary structure flags representation from a list of strings. Allowed flags: ".concat(ue.oneOfValues($e.SecondaryStructureFlag).join(", "), ".")), authResidueId: vt(ct.Dictionary({ 0: Ge(ue.Str, { description: "auth_asym_id" }), 1: Ge(ue.Num, { description: "auth_seq_id" }), 2: Ge(ue.Str, { description: "pdbx_PDB_ins_code", isOptional: !0 }) }), $e.ResidueId, 'Residue identifier based on "auth_" annotation.'), labelResidueId: vt(ct.Dictionary({ 0: Ge(ue.Str, { description: "label_entity_id" }), 1: Ge(ue.Str, { description: "label_asym_id" }), 2: Ge(ue.Num, { description: "label_seq_id" }), 3: Ge(ue.Str, { description: "pdbx_PDB_ins_code", isOptional: !0 }) }), $e.ResidueId, `Residue identifier based on mmCIF's "label_" annotation.`) }, slot: { "@header": "Iteration Slots", element: vt(ct.None, $e.ElementReference, "A reference to the current element."), elementSetReduce: vt(ct.None, ue.Variable("a", ue.AnyValue, !0), "Current value of the element set reducer.") }, generator: { "@header": "Generators", all: vt(ct.None, $e.ElementSelectionQuery, "The entire structure."), atomGroups: vt(ct.Dictionary({ "entity-test": Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test for the 1st atom of every entity" }), "chain-test": Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test for the 1st atom of every chain" }), "residue-test": Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test for the 1st atom every residue" }), "atom-test": Ge(ue.Bool, { isOptional: !0, defaultValue: !0 }), "group-by": Ge(ue.Any, { isOptional: !0, defaultValue: "atom-key", description: "Group atoms to sets based on this property. Default: each atom has its own set" }) }), $e.ElementSelectionQuery, "Return all atoms for which the tests are satisfied, grouped into sets."), bondedAtomicPairs: vt(ct.Dictionary({ 0: Ge(ue.Bool, { isOptional: !0, defaultValue: "true for covalent bonds", description: "Test each bond with this predicate. Each bond is visited twice with swapped atom order." }) }), $e.ElementSelectionQuery, "Return all pairs of atoms for which the test is satisfied."), rings: vt(ct.Dictionary({ fingerprint: Ge($e.RingFingerprint, { isOptional: !0 }), "only-aromatic": Ge(ue.Bool, { isOptional: !0, defaultValue: !1 }) }), $e.ElementSelectionQuery, "Return all rings or those with the specified fingerprint and/or only aromatic rings."), queryInSelection: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), query: Ge($e.ElementSelectionQuery), "in-complement": Ge(ue.Bool, { isOptional: !0, defaultValue: !1 }) }), $e.ElementSelectionQuery, "Executes query only on atoms that are in the source selection."), empty: vt(ct.None, $e.ElementSelectionQuery, "Nada.") }, modifier: { "@header": "Selection Modifications", queryEach: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), query: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Query every atom set in the input selection separately."), intersectBy: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), by: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Intersect each atom set from the first sequence from atoms in the second one."), exceptBy: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), by: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Remove all atoms from 'selection' that occur in 'by'."), unionBy: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), by: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "For each atom set A in the orginal sequence, combine all atoms sets in the target selection that intersect with A."), union: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Collects all atom sets in the sequence into a single atom set."), cluster: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), "min-distance": Ge(ue.Num, { isOptional: !0, defaultValue: 0 }), "max-distance": Ge(ue.Num), "min-size": Ge(ue.Num, { description: "Minimal number of sets to merge, must be at least 2", isOptional: !0, defaultValue: 2 }), "max-size": Ge(ue.Num, { description: "Maximal number of sets to merge, if not set, no limit", isOptional: !0 }) }), $e.ElementSelectionQuery, "Combines atom sets that have mutual distance in the interval [min-radius, max-radius]. Minimum/maximum size determines how many atom sets can be combined."), includeSurroundings: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), radius: Ge(ue.Num), "atom-radius": Ge(ue.Num, { isOptional: !0, defaultValue: 0, description: "Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding." }), "as-whole-residues": Ge(ue.Bool, { isOptional: !0 }) }), $e.ElementSelectionQuery, "For each atom set in the selection, include all surrouding atoms/residues that are within the specified radius."), surroundingLigands: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), radius: Ge(ue.Num), "include-water": Ge(ue.Bool, { isOptional: !0, defaultValue: !0 }) }), $e.ElementSelectionQuery, "Find all ligands components around the source query."), includeConnected: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), "bond-test": Ge(ue.Bool, { isOptional: !0, defaultValue: "true for covalent bonds" }), "layer-count": Ge(ue.Num, { isOptional: !0, defaultValue: 1, description: "Number of bonded layers to include." }), "fixed-point": Ge(ue.Bool, { isOptional: !0, defaultValue: !1, description: "Continue adding layers as long as new connections exist." }), "as-whole-residues": Ge(ue.Bool, { isOptional: !0 }) }), $e.ElementSelectionQuery, "Pick all atom sets that are connected to the target."), wholeResidues: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Expand the selection to whole residues."), expandProperty: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), property: Ge(ue.AnyValue) }), $e.ElementSelectionQuery, "To each atom set in the selection, add all atoms that have the same property value that was already present in the set.") }, filter: { "@header": "Selection Filters", pick: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), test: Ge(ue.Bool) }), $e.ElementSelectionQuery, "Pick all atom sets that satisfy the test."), first: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Take the 1st atom set in the sequence."), withSameAtomProperties: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), source: Ge($e.ElementSelectionQuery), property: Ge(ue.Any) }), $e.ElementSelectionQuery, "Pick all atom sets for which the set of given atom properties is a subset of the source properties."), intersectedBy: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), by: Ge($e.ElementSelectionQuery) }), $e.ElementSelectionQuery, "Pick all atom sets that have non-zero intersection with the target."), within: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), target: Ge($e.ElementSelectionQuery), "min-radius": Ge(ue.Num, { isOptional: !0, defaultValue: 0 }), "max-radius": Ge(ue.Num), "atom-radius": Ge(ue.Num, { isOptional: !0, defaultValue: 0, description: "Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding." }), invert: Ge(ue.Bool, { isOptional: !0, defaultValue: !1, description: "If true, pick only atom sets that are further than the specified radius." }) }), $e.ElementSelectionQuery, "Pick all atom sets from selection that have any atom within the radius of any atom from target."), isConnectedTo: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery), target: Ge($e.ElementSelectionQuery), "bond-test": Ge(ue.Bool, { isOptional: !0, defaultValue: "true for covalent bonds" }), disjunct: Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "If true, there must exist a bond to an atom that lies outside the given atom set to pass test." }), invert: Ge(ue.Bool, { isOptional: !0, defaultValue: !1, description: "If true, return atom sets that are not connected." }) }), $e.ElementSelectionQuery, "Pick all atom sets that are connected to the target.") }, combinator: { "@header": "Selection Combinators", intersect: vt(ct.List($e.ElementSelectionQuery), $e.ElementSelectionQuery, "Return all unique atom sets that appear in all of the source selections."), merge: vt(ct.List($e.ElementSelectionQuery), $e.ElementSelectionQuery, "Merges multiple selections into a single one. Only unique atom sets are kept."), distanceCluster: vt(ct.Dictionary({ matrix: Ge(mn.List(mn.List(ue.Num)), { description: "Distance matrix, represented as list of rows (num[][])). Lower triangle is min distance, upper triangle is max distance." }), selections: Ge(mn.List($e.ElementSelectionQuery), { description: "A list of held selections." }) }), $e.ElementSelectionQuery, "Pick combinations of atom sets from the source sequences that are mutually within distances specified by a matrix.") }, atomSet: { "@header": "Atom Sets", atomCount: vt(ct.None, ue.Num), countQuery: vt(ct.Dictionary({ 0: Ge($e.ElementSelectionQuery) }), ue.Num, "Counts the number of occurences of a specific query inside the current atom set."), reduce: vt(ct.Dictionary({ initial: Ge(ue.Variable("a", ue.AnyValue, !0), { description: "Initial value assigned to slot.atom-set-reduce. Current atom is set to the 1st atom of the current set for this." }), value: Ge(ue.Variable("a", ue.AnyValue, !0), { description: "Expression executed for each atom in the set" }) }), ue.Variable("a", ue.AnyValue, !0), "Execute the value expression for each atom in the current atom set and return the result. Works the same way as Array.reduce in JavaScript (``result = value(value(...value(initial)))``)"), propertySet: vt(ct.Dictionary({ 0: Ge(mn.ConstrainedVar) }), mn.Set(mn.ConstrainedVar), "Returns a set with all values of the given property in the current atom set.") }, atomProperty: { "@header": "Atom Properties", core: { "@header": "Core Properties", elementSymbol: fn($e.ElementSymbol), vdw: fn(ue.Num, "Van der Waals radius"), mass: fn(ue.Num, "Atomic weight"), atomicNumber: fn(ue.Num, "Atomic number"), x: fn(ue.Num, "Cartesian X coordinate"), y: fn(ue.Num, "Cartesian Y coordinate"), z: fn(ue.Num, "Cartesian Z coordinate"), atomKey: fn(ue.AnyValue, "Unique value for each atom. Main use case is grouping of atoms."), bondCount: vt(ct.Dictionary({ 0: Ge($e.ElementReference, { isOptional: !0, defaultValue: "slot.current-atom" }), flags: Ge($e.BondFlags, { isOptional: !0, defaultValue: "covalent" }) }), ue.Num, "Number of bonds (by default only covalent bonds are counted)."), sourceIndex: fn(ue.Num, "Index of the atom/element in the input file."), operatorName: fn(ue.Str, "Name of the symmetry operator applied to this element."), modelIndex: fn(ue.Num, "Index of the model in the input file."), modelLabel: fn(ue.Str, "Label/header of the model in the input file.") }, topology: { connectedComponentKey: fn(ue.AnyValue, "Unique value for each connected component.") }, macromolecular: { "@header": "Macromolecular Properties (derived from the mmCIF format)", authResidueId: fn($e.ResidueId, "type.auth-residue-id symbol executed on current atom's residue"), labelResidueId: fn($e.ResidueId, "type.label-residue-id symbol executed on current atom's residue"), residueKey: fn(ue.AnyValue, "Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms"), chainKey: fn(ue.AnyValue, "Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms"), entityKey: fn(ue.AnyValue, "Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms"), isHet: fn(ue.Bool, "Equivalent to atom_site.group_PDB !== ATOM"), id: fn(ue.Num, "_atom_site.id"), label_atom_id: fn($e.AtomName), label_alt_id: fn(ue.Str), label_comp_id: fn(ue.Str), label_asym_id: fn(ue.Str), label_entity_id: fn(ue.Str), label_seq_id: fn(ue.Num), auth_atom_id: fn($e.AtomName), auth_comp_id: fn(ue.Str), auth_asym_id: fn(ue.Str), auth_seq_id: fn(ue.Num), pdbx_PDB_ins_code: fn(ue.Str), pdbx_formal_charge: fn(ue.Num), occupancy: fn(ue.Num), B_iso_or_equiv: fn(ue.Num), entityType: fn($e.EntityType, "Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water)"), entitySubtype: fn($e.EntitySubtype, "Subtype of the entity as defined in mmCIF _entity_poly.type and _pdbx_entity_branch.type (other, polypeptide(D), polypeptide(L), polydeoxyribonucleotide, polyribonucleotide, polydeoxyribonucleotide/polyribonucleotide hybrid, cyclic-pseudo-peptide, peptide nucleic acid, oligosaccharide)"), entityPrdId: fn(ue.Str, "The PRD ID of the entity."), entityDescription: fn(mn.List(ue.Str)), objectPrimitive: fn($e.ObjectPrimitive, "Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)"), secondaryStructureKey: fn(ue.AnyValue, "Unique value for each secondary structure element."), secondaryStructureFlags: fn($e.SecondaryStructureFlags), isModified: fn(ue.Bool, "True if the atom belongs to modification of a standard residue."), modifiedParentName: fn(ue.Str, "'3-letter' code of the modifed parent residue."), isNonStandard: fn(ue.Bool, "True if this is a non-standard residue."), chemCompType: fn(ue.Str, "Type of the chemical component as defined in mmCIF.") } }, bondProperty: { "@header": "Bond Properties", flags: Jm($e.BondFlags), order: Jm(ue.Num), length: Jm(ue.Num), atomA: Jm($e.ElementReference), atomB: Jm($e.ElementReference) } }, internal: { "@header": "Internal Queries", generator: { "@header": "Generators", bundleElement: vt(ct.Dictionary({ groupedUnits: Ge(ue.Any), set: Ge(ue.Any), ranges: Ge(ue.Any) }), ue.Any), bundle: vt(ct.Dictionary({ elements: Ge(ue.Any) }), $e.ElementSelectionQuery, "A selection with single structure containing represented by the bundle."), current: vt(ct.None, $e.ElementSelectionQuery, "Current selection provided by the query context. Avoid using this in State Transforms.") } } };
fk(te);
var Ct, nH = mk(te);
(function() {
  for (var e = /* @__PURE__ */ Object.create(null), t = 0, n = nH; t < n.length; t++) {
    var r = n[t];
    e[r.id] = r;
  }
})(), function(e) {
  e.core = te.core, e.struct = te.structureQuery, e.internal = te.internal, e.atomName = function(u) {
    return e.struct.type.atomName([u]);
  }, e.es = function(u) {
    return e.struct.type.elementSymbol([u]);
  }, e.list = function() {
    for (var u = [], l = 0; l < arguments.length; l++) u[l] = arguments[l];
    return e.core.type.list(u);
  }, e.set = function() {
    for (var u = [], l = 0; l < arguments.length; l++) u[l] = arguments[l];
    return e.core.type.set(u);
  }, e.re = function(u, l) {
    return e.core.type.regex([u, l]);
  }, e.fn = function(u) {
    return e.core.ctrl.fn([u]);
  }, e.evaluate = function(u) {
    return e.core.ctrl.eval([u]);
  };
  var t = e.struct.atomProperty.core, n = e.struct.atomProperty.macromolecular, r = e.struct.atomProperty.topology;
  function i(u) {
    return t[u]();
  }
  function a(u) {
    return r[u]();
  }
  function o(u) {
    return n[u]();
  }
  e.acp = i, e.atp = a, e.ammp = o;
  var s = e.struct.atomSet.propertySet;
  e.acpSet = function(u) {
    return s([i(u)]);
  }, e.atpSet = function(u) {
    return s([a(u)]);
  }, e.ammpSet = function(u) {
    return s([o(u)]);
  };
}(Ct || (Ct = {}));
var Bo, Ro, rH = /* @__PURE__ */ new Set(["145", "147", "149", "289", "291", "293", "445", "475", "491", "510", "604", "045", "05L", "07E", "07Y", "08U", "09X", "0AT", "0BD", "0H0", "0HX", "0LP", "0MK", "0NZ", "0TS", "0UB", "0V4", "0WK", "0XY", "0YT", "10M", "12E", "14T", "15L", "16F", "16G", "16O", "17T", "18D", "18O", "18T", "1AR", "1BW", "1CF", "1FT", "1GL", "1GN", "1JB", "1LL", "1NA", "1S3", "1S4", "1SD", "1X4", "20S", "20X", "22O", "22S", "23V", "24S", "25E", "26M", "26O", "26Q", "26R", "26V", "26W", "26Y", "27C", "2DG", "2DR", "2F8", "2FG", "2FL", "2FP", "2GL", "2GS", "2H5", "2HA", "2M4", "2M5", "2M8", "2OS", "2WP", "2WS", "32O", "34V", "38J", "3BU", "3CM", "3DO", "3DY", "3FM", "3GR", "3HD", "3J3", "3J4", "3LJ", "3LR", "3MF", "3MG", "3MK", "3R3", "3S6", "3SA", "3YW", "40J", "42D", "44S", "46D", "46M", "46Z", "48Z", "49A", "49S", "49T", "49V", "4AM", "4CQ", "4GC", "4GL", "4GP", "4JA", "4N2", "4NN", "4QY", "4R1", "4RS", "4SG", "4U0", "4U1", "4U2", "4UZ", "4V5", "50A", "51N", "56N", "57S", "5DI", "5GF", "5GO", "5II", "5KQ", "5KS", "5KT", "5KV", "5L2", "5L3", "5LS", "5LT", "5MM", "5N6", "5QP", "5RP", "5SA", "5SP", "5TH", "5TJ", "5TK", "5TM", "61J", "62I", "64K", "66O", "6BG", "6C2", "6DM", "6GB", "6GP", "6GR", "6K3", "6KH", "6KL", "6KS", "6KU", "6KW", "6LA", "6LS", "6LW", "6MJ", "6MN", "6PG", "6PY", "6PZ", "6S2", "6SA", "6UD", "6Y6", "6YR", "6ZC", "73E", "79J", "7CV", "7D1", "7GP", "7JZ", "7K2", "7K3", "7NU", "7SA", "83Y", "89Y", "8B7", "8B9", "8EX", "8GA", "8GG", "8GP", "8LM", "8LR", "8OQ", "8PK", "8S0", "8YV", "95Z", "96O", "9AM", "9C1", "9CD", "9GP", "9KJ", "9MR", "9OK", "9PG", "9QG", "9QZ", "9S7", "9SG", "9SJ", "9SM", "9SP", "9T1", "9T7", "9VP", "9WJ", "9WN", "9WZ", "9YW", "A0K", "A1Q", "A2G", "A5C", "A6P", "AAL", "AAO", "ABC", "ABD", "ABE", "ABF", "ABL", "AC1", "ACG", "ACR", "ACX", "ADA", "ADG", "ADR", "AF1", "AFD", "AFL", "AFO", "AFP", "AFR", "AGC", "AGH", "AGL", "AGR", "AH2", "AH8", "AHG", "AHM", "AHR", "AIG", "ALL", "ALX", "AMG", "AMN", "AMU", "AMV", "ANA", "AOG", "AOS", "AQA", "ARA", "ARB", "ARE", "ARI", "ARW", "ASC", "ASG", "ASO", "AXP", "AXR", "AY9", "AZC", "B0D", "B16", "B1H", "B1N", "B2G", "B4G", "B6D", "B7G", "B8D", "B9D", "BBK", "BBV", "BCD", "BCW", "BDF", "BDG", "BDP", "BDR", "BDZ", "BEM", "BFN", "BFP", "BG6", "BG8", "BGC", "BGL", "BGN", "BGP", "BGS", "BHG", "BM3", "BM7", "BMA", "BMX", "BND", "BNG", "BNX", "BO1", "BOG", "BQY", "BRI", "BS7", "BTG", "BTU", "BWG", "BXF", "BXP", "BXX", "BXY", "BZD", "C3B", "C3G", "C3X", "C4B", "C4W", "C4X", "C5X", "CAP", "CBF", "CBI", "CBK", "CDR", "CE5", "CE6", "CE8", "CEG", "CEX", "CEY", "CEZ", "CGF", "CJB", "CKB", "CKP", "CNP", "CR1", "CR6", "CRA", "CT3", "CTO", "CTR", "CTT", "D0N", "D1M", "D5E", "D6G", "DAF", "DAG", "DAN", "DDA", "DDB", "DDL", "DEG", "DEL", "DFR", "DFX", "DG0", "DGC", "DGD", "DGM", "DGO", "DGS", "DGU", "DIG", "DJB", "DJE", "DK4", "DKX", "DKZ", "DL6", "DLD", "DLF", "DLG", "DMU", "DNO", "DO8", "DOM", "DP5", "DPC", "DQQ", "DQR", "DR2", "DR3", "DR4", "DR5", "DRI", "DSR", "DT6", "DVC", "DYM", "E3M", "E4P", "E5G", "EAG", "EBG", "EBQ", "EEN", "EEQ", "EGA", "EJT", "EMP", "EMZ", "EPG", "EQP", "EQV", "ERE", "ERI", "ETT", "EUS", "F1P", "F1X", "F55", "F58", "F6P", "F8X", "FBP", "FCA", "FCB", "FCT", "FDP", "FDQ", "FFC", "FFX", "FIF", "FIX", "FK9", "FKD", "FMF", "FMO", "FNG", "FNY", "FRU", "FSA", "FSI", "FSM", "FSR", "FSW", "FU4", "FUB", "FUC", "FUD", "FUF", "FUL", "FUY", "FVQ", "FX1", "FYJ", "G0S", "G16", "G1P", "G20", "G28", "G2F", "G3F", "G3I", "G4D", "G4S", "G6D", "G6P", "G6S", "G7P", "G8Z", "GAA", "GAC", "GAD", "GAF", "GAL", "GAT", "GBH", "GC1", "GC4", "GC9", "GCB", "GCD", "GCN", "GCO", "GCS", "GCT", "GCU", "GCV", "GCW", "GDA", "GDL", "GE1", "GE3", "GFP", "GIV", "GL0", "GL1", "GL2", "GL4", "GL5", "GL6", "GL7", "GL9", "GLA", "GLB", "GLC", "GLD", "GLF", "GLG", "GLO", "GLP", "GLS", "GLT", "GLW", "GM0", "GMB", "GMH", "GMT", "GMZ", "GN1", "GN4", "GNS", "GNX", "GP0", "GP1", "GP4", "GPH", "GPK", "GPM", "GPO", "GPQ", "GPU", "GPV", "GPW", "GQ1", "GRF", "GRX", "GS1", "GS4", "GS9", "GSA", "GSD", "GTE", "GTH", "GTK", "GTM", "GTR", "GU0", "GU1", "GU2", "GU3", "GU4", "GU5", "GU6", "GU8", "GU9", "GUF", "GUL", "GUP", "GUZ", "GXL", "GXV", "GYE", "GYG", "GYP", "GYU", "GYV", "GZL", "H1M", "H1S", "H2P", "H3S", "H53", "H6Q", "H6Z", "HBZ", "HD4", "HDL", "HMS", "HNV", "HNW", "HSG", "HSH", "HSJ", "HSQ", "HSR", "HSU", "HSX", "HSY", "HSZ", "HTG", "HTM", "I57", "IAB", "IDC", "IDF", "IDG", "IDR", "IDS", "IDT", "IDU", "IDX", "IDY", "IEM", "IN1", "IPT", "ISD", "ISL", "ISX", "IXD", "J5B", "JFZ", "JHM", "JLT", "JRV", "JS2", "JSV", "JV4", "JVA", "JVS", "JZR", "K5B", "K99", "KBA", "KBG", "KD5", "KDA", "KDB", "KDD", "KDE", "KDF", "KDM", "KDN", "KDO", "KDR", "KFN", "KG1", "KGM", "KHP", "KME", "KO1", "KO2", "KOT", "KTU", "L1L", "L6S", "L6T", "LAG", "LAH", "LAI", "LAK", "LAO", "LAT", "LB2", "LBS", "LBT", "LCN", "LDY", "LEC", "LER", "LFC", "LFR", "LGC", "LGU", "LKA", "LKS", "LM2", "LMO", "LMT", "LMU", "LNV", "LOG", "LOX", "LPK", "LRH", "LSM", "LTG", "LTM", "LVO", "LVZ", "LXB", "LXC", "LXZ", "LZ0", "M1F", "M1P", "M2F", "M3M", "M3N", "M55", "M6D", "M6P", "M7B", "M7P", "M8C", "MA1", "MA2", "MA3", "MA8", "MAB", "MAF", "MAG", "MAL", "MAN", "MAT", "MAV", "MAW", "MBE", "MBF", "MBG", "MCU", "MDA", "MDP", "MFA", "MFB", "MFU", "MG5", "MGA", "MGC", "MGL", "MGS", "MJJ", "MLB", "MLR", "MMA", "MMN", "MN0", "MNA", "MQG", "MQT", "MRH", "MRP", "MSX", "MTT", "MUB", "MUG", "MUR", "MVP", "MXY", "MXZ", "MYG", "N1L", "N9S", "NA1", "NAA", "NAG", "NBG", "NBX", "NBY", "NDG", "NED", "NFG", "NG1", "NG6", "NGA", "NGB", "NGC", "NGE", "NGF", "NGK", "NGL", "NGR", "NGS", "NGY", "NGZ", "NHF", "NLC", "NM6", "NM9", "NNG", "NPF", "NSQ", "NT1", "NTF", "NTO", "NTP", "NXD", "NYT", "O1G", "OAK", "OEL", "OI7", "OPM", "ORP", "OSU", "OTG", "OTN", "OTU", "OX2", "P53", "P6P", "P8E", "PA1", "PA5", "PAV", "PDX", "PH5", "PKM", "PNA", "PNG", "PNJ", "PNW", "PPC", "PRP", "PSG", "PSJ", "PSV", "PTQ", "PUF", "PZU", "QDK", "QIF", "QKH", "QPS", "QV4", "R1P", "R1X", "R2B", "R2G", "R5P", "RAA", "RAE", "RAF", "RAM", "RAO", "RAT", "RB5", "RBL", "RCD", "RDP", "REL", "RER", "RF5", "RG1", "RGG", "RHA", "RHC", "RI2", "RIB", "RIP", "RM4", "RNS", "RNT", "ROB", "ROR", "RP3", "RP5", "RP6", "RPA", "RR7", "RRJ", "RRY", "RST", "RTG", "RTV", "RUB", "RUG", "RUU", "RV7", "RVG", "RVM", "RWI", "RY7", "RZM", "S6P", "S7P", "S81", "SA0", "SCG", "SCR", "SDD", "SDY", "SEJ", "SF6", "SF9", "SFJ", "SFU", "SG4", "SG5", "SG6", "SG7", "SGA", "SGC", "SGD", "SGN", "SGS", "SHB", "SHD", "SHG", "SI3", "SIA", "SID", "SIO", "SIZ", "SLB", "SLM", "SLT", "SMD", "SN5", "SNG", "SOE", "SOG", "SOL", "SOR", "SR1", "SSG", "SSH", "STW", "STZ", "SUC", "SUP", "SUS", "SWE", "SZZ", "T68", "T6D", "T6P", "T6T", "TA6", "TAG", "TCB", "TCG", "TDG", "TEU", "TF0", "TFU", "TGA", "TGK", "TGR", "TGY", "TH1", "TM5", "TM6", "TM9", "TMR", "TMX", "TNX", "TOA", "TOC", "TQY", "TRE", "TRV", "TS8", "TT7", "TTV", "TTZ", "TU4", "TUG", "TUJ", "TUP", "TUR", "TVD", "TVG", "TVM", "TVS", "TVV", "TVY", "TW7", "TWA", "TWD", "TWG", "TWJ", "TWY", "TXB", "TYV", "U1Y", "U2A", "U2D", "U63", "U8V", "U97", "U9A", "U9D", "U9G", "U9J", "U9M", "UAP", "UCD", "UDC", "UEA", "V3M", "V3P", "V71", "VG1", "VJ1", "VJ4", "VKN", "VTB", "W9T", "WIA", "WOO", "WUN", "WZ1", "WZ2", "WZ4", "X0X", "X1P", "X1X", "X2F", "X2Y", "X34", "X4S", "X5S", "X6X", "X6Y", "XBP", "XDP", "XDX", "XGP", "XIL", "XKJ", "XLF", "XLS", "XMM", "XS2", "XUL", "XXM", "XXR", "XXX", "XYB", "XYF", "XYL", "XYP", "XYS", "XYT", "XYZ", "YDR", "YIO", "YJM", "YKR", "YO5", "YX0", "YX1", "YYB", "YYH", "YYJ", "YYK", "YYM", "YYQ", "YYR", "YZ0", "Z0F", "Z15", "Z16", "Z2D", "Z2T", "Z3K", "Z3L", "Z3Q", "Z3U", "Z4K", "Z4R", "Z4S", "Z4U", "Z4V", "Z4W", "Z4Y", "Z57", "Z5J", "Z5L", "Z61", "Z6H", "Z6J", "Z6W", "Z8H", "Z8T", "Z9D", "Z9E", "Z9H", "Z9K", "Z9L", "Z9M", "Z9N", "Z9W", "ZB0", "ZB1", "ZB2", "ZB3", "ZCD", "ZCZ", "ZD0", "ZDC", "ZDM", "ZDO", "ZEE", "ZEL", "ZGE", "ZMR", "UMQ", "SQD"]), ut = { Blue: 37052, Green: 42577, Yellow: 16765952, Orange: 16021792, Pink: 16162465, Purple: 10830745, LightBlue: 9424105, Brown: 10582605, Red: 15539236, Secondary: 15854817 };
(Bo = {})[0] = "Hexose", Bo[1] = "HexNAc", Bo[2] = "Hexosamine", Bo[3] = "Hexuronate", Bo[4] = "Deoxyhexose", Bo[5] = "DeoxyhexNAc", Bo[6] = "Di-deoxyhexose", Bo[7] = "Pentose", Bo[8] = "Deoxynonulosonate", Bo[9] = "Di-deoxynonulosonate", Bo[10] = "Unknown", Bo[11] = "Assigned", (Ro = {})[0] = 0, Ro[1] = 1, Ro[2] = 2, Ro[3] = 3, Ro[4] = 4, Ro[5] = 5, Ro[6] = 6, Ro[7] = 7, Ro[8] = 8, Ro[9] = 9, Ro[10] = 10, Ro[11] = 11;
var sc, gk = { abbr: "Unk", name: "Unknown", color: ut.Secondary, type: 10 }, Qg = [{ abbr: "Glc", name: "Glucose", color: ut.Blue, type: 0 }, { abbr: "Man", name: "Mannose", color: ut.Green, type: 0 }, { abbr: "Gal", name: "Galactose", color: ut.Yellow, type: 0 }, { abbr: "Gul", name: "Gulose", color: ut.Orange, type: 0 }, { abbr: "Alt", name: "Altrose", color: ut.Pink, type: 0 }, { abbr: "All", name: "Allose", color: ut.Purple, type: 0 }, { abbr: "Tal", name: "Talose", color: ut.LightBlue, type: 0 }, { abbr: "Ido", name: "Idose", color: ut.Brown, type: 0 }, { abbr: "GlcNAc", name: "N-Acetyl Glucosamine", color: ut.Blue, type: 1 }, { abbr: "ManNAc", name: "N-Acetyl Mannosamine", color: ut.Green, type: 1 }, { abbr: "GalNAc", name: "N-Acetyl Galactosamine", color: ut.Yellow, type: 1 }, { abbr: "GulNAc", name: "N-Acetyl Gulosamine", color: ut.Orange, type: 1 }, { abbr: "AltNAc", name: "N-Acetyl Altrosamine", color: ut.Pink, type: 1 }, { abbr: "AllNAc", name: "N-Acetyl Allosamine", color: ut.Purple, type: 1 }, { abbr: "TalNAc", name: "N-Acetyl Talosamine", color: ut.LightBlue, type: 1 }, { abbr: "IdoNAc", name: "N-Acetyl Idosamine", color: ut.Brown, type: 1 }, { abbr: "GlcN", name: "Glucosamine", color: ut.Blue, type: 2 }, { abbr: "ManN", name: "Mannosamine", color: ut.Green, type: 2 }, { abbr: "GalN", name: "Galactosamine", color: ut.Yellow, type: 2 }, { abbr: "GulN", name: "Gulosamine", color: ut.Orange, type: 2 }, { abbr: "AltN", name: "Altrosamine", color: ut.Pink, type: 2 }, { abbr: "AllN", name: "Allosamine", color: ut.Purple, type: 2 }, { abbr: "TalN", name: "Talosamine", color: ut.LightBlue, type: 2 }, { abbr: "IdoN", name: "Idosamine", color: ut.Brown, type: 2 }, { abbr: "GlcA", name: "Glucuronic Acid", color: ut.Blue, type: 3 }, { abbr: "ManA", name: "Mannuronic Acid", color: ut.Green, type: 3 }, { abbr: "GalA", name: "Galacturonic Acid", color: ut.Yellow, type: 3 }, { abbr: "GulA", name: "Guluronic Acid", color: ut.Orange, type: 3 }, { abbr: "AltA", name: "Altruronic Acid", color: ut.Pink, type: 3 }, { abbr: "AllA", name: "Alluronic Acid", color: ut.Purple, type: 3 }, { abbr: "TalA", name: "Taluronic Acid", color: ut.LightBlue, type: 3 }, { abbr: "IdoA", name: "Iduronic Acid", color: ut.Brown, type: 3 }, { abbr: "Qui", name: "Quinovose", color: ut.Blue, type: 4 }, { abbr: "Rha", name: "Rhamnose", color: ut.Green, type: 4 }, { abbr: "6dGul", name: "6-Deoxy Gulose", color: ut.Orange, type: 4 }, { abbr: "6dAlt", name: "6-Deoxy Altrose", color: ut.Pink, type: 4 }, { abbr: "6dTal", name: "6-Deoxy Talose", color: ut.LightBlue, type: 4 }, { abbr: "Fuc", name: "Fucose", color: ut.Red, type: 4 }, { abbr: "QuiNAc", name: "N-Acetyl Quinovosamine", color: ut.Blue, type: 5 }, { abbr: "RhaNAc", name: "N-Acetyl Rhamnosamine", color: ut.Green, type: 5 }, { abbr: "6dAltNAc", name: "N-Acetyl 6-Deoxy Altrosamine", color: ut.Pink, type: 5 }, { abbr: "6dTalNAc", name: "N-Acetyl 6-Deoxy Talosamine", color: ut.LightBlue, type: 5 }, { abbr: "FucNAc", name: "N-Acetyl Fucosamine", color: ut.Red, type: 5 }, { abbr: "Oli", name: "Olivose", color: ut.Blue, type: 6 }, { abbr: "Tyv", name: "Tyvelose", color: ut.Green, type: 6 }, { abbr: "Abe", name: "Abequose", color: ut.Orange, type: 6 }, { abbr: "Par", name: "Paratose", color: ut.Pink, type: 6 }, { abbr: "Dig", name: "Digitoxose", color: ut.Purple, type: 6 }, { abbr: "Col", name: "Colitose", color: ut.LightBlue, type: 6 }, { abbr: "Ara", name: "Arabinose", color: ut.Green, type: 7 }, { abbr: "Lyx", name: "Lyxose", color: ut.Yellow, type: 7 }, { abbr: "Xyl", name: "Xylose", color: ut.Orange, type: 7 }, { abbr: "Rib", name: "Ribose", color: ut.Pink, type: 7 }, { abbr: "Kdn", name: "Keto-Deoxy Nonulonic Acid", color: ut.Green, type: 8 }, { abbr: "Neu5Ac", name: "N-Acetyl Neuraminic Acid", color: ut.Purple, type: 8 }, { abbr: "Neu5Gc", name: "N-Glycolyl Neuraminic Acid", color: ut.LightBlue, type: 8 }, { abbr: "Neu", name: "Neuraminic Acid", color: ut.Brown, type: 8 }, { abbr: "Sia", name: "Sialic acid", color: ut.Red, type: 8 }, { abbr: "Pse", name: "Pseudaminic Acid", color: ut.Green, type: 9 }, { abbr: "Leg", name: "Legionaminic Acid", color: ut.Yellow, type: 9 }, { abbr: "Aci", name: "Acinetaminic Acid", color: ut.Pink, type: 9 }, { abbr: "4eLeg", name: "4-Epilegionaminic Acid", color: ut.LightBlue, type: 9 }, { abbr: "Bac", name: "Bacillosamine", color: ut.Blue, type: 10 }, { abbr: "LDmanHep", name: "L-Glycero-D-Manno Heptose", color: ut.Green, type: 10 }, { abbr: "Kdo", name: "Keto-Deoxy Octulonic Acid", color: ut.Yellow, type: 10 }, { abbr: "Dha", name: "3-Deoxy Lyxo-Heptulosaric Acid", color: ut.Orange, type: 10 }, { abbr: "DDmanHep", name: "D-Glycero-D-Manno-Heptose", color: ut.Pink, type: 10 }, { abbr: "MurNAc", name: "N-Acetyl Muramic Acid", color: ut.Purple, type: 10 }, { abbr: "MurNGc", name: "N-Glycolyl Muramic Acid", color: ut.LightBlue, type: 10 }, { abbr: "Mur", name: "Muramic Acid", color: ut.Brown, type: 10 }, { abbr: "Api", name: "Apicose", color: ut.Green, type: 11 }, { abbr: "Fru", name: "Fructose", color: ut.Green, type: 11 }, { abbr: "Tag", name: "Tagatose", color: ut.Yellow, type: 11 }, { abbr: "Sor", name: "Sorbose", color: ut.Orange, type: 11 }, { abbr: "Psi", name: "Psicose", color: ut.Pink, type: 11 }], iH = function() {
  for (var e = /* @__PURE__ */ new Map(), t = 0, n = Qg.length; t < n; ++t) {
    var r = Qg[t];
    e.set(r.abbr, r);
  }
  return e;
}(), aH = [["Glc-family", ut.Blue], ["Man-family", ut.Green], ["Gal-family", ut.Yellow], ["Gul-family", ut.Orange], ["Alt-family", ut.Pink], ["All-family", ut.Purple], ["Tal-family", ut.LightBlue], ["Ido-family", ut.Brown], ["Fuc-family", ut.Red], ["Generic/Unknown/Secondary", ut.Secondary]], oH = { Glc: ["GLC", "BGC", "Z8T", "TRE", "MLR"], Man: ["MAN", "BMA"], Gal: ["GLA", "GAL", "GZL", "GXL", "GIV"], Gul: ["4GL", "GL0", "GUP", "Z8H"], Alt: ["Z6H", "3MK", "SHD"], All: ["AFD", "ALL", "WOO", "Z2D"], Tal: ["ZEE", "A5C", "SDY"], Ido: ["ZCD", "Z0F", "4N2"], GlcNAc: ["NDG", "NAG", "NGZ"], ManNAc: ["BM3", "BM7"], GalNAc: ["A2G", "NGA", "YYQ"], GulNAc: ["LXB"], AltNAc: [], AllNAc: ["NAA"], TalNAc: [], IdoNAc: ["LXZ", "HSQ"], GlcN: ["PA1", "GCS"], ManN: ["95Z"], GalN: ["X6X", "1GN"], GulN: [], AltN: [], AllN: [], TalN: [], IdoN: [], GlcA: ["GCU", "BDP"], ManA: ["MAV", "BEM"], GalA: ["ADA", "GTR", "GTK"], GulA: ["LGU"], AltA: [], AllA: [], TalA: ["X1X", "X0X"], IdoA: ["IDR"], Qui: ["G6D", "YYK"], Rha: ["RAM", "RM4", "XXR"], "6dGul": ["66O"], "6dAlt": [], "6dTal": [], Fuc: ["FUC", "FUL", "FCA", "FCB", "GYE"], QuiNAc: ["Z9W"], RhaNAc: [], "6dAltNAc": [], "6dTalNAc": [], FucNAc: ["49T"], Oli: ["DDA", "RAE", "Z5J"], Tyv: ["TYV"], Abe: ["ABE"], Par: ["PZU"], Dig: ["Z3U"], Col: [], Ara: ["64K", "ARA", "ARB", "AHR", "FUB", "BXY", "BXX", "SEJ"], Lyx: ["LDY", "Z4W"], Xyl: ["XYS", "XYP", "XYZ", "HSY", "LXC"], Rib: ["YYM", "RIP", "RIB", "BDR", "0MK", "Z6J", "32O"], Kdn: ["KDM", "KDN"], Neu5Ac: ["SIA", "SLB"], Neu5Gc: ["NGC", "NGE"], Neu: [], Sia: [], Pse: [], Leg: [], Aci: [], "4eLeg": [], Bac: [], LDmanHep: ["GMH"], Kdo: ["KDO"], Dha: [], DDmanHep: ["289"], MurNAc: ["MUB", "AMU"], MurNGc: [], Mur: ["1S4", "MUR"], Api: ["XXM"], Fru: ["BDF", "Z9N", "FRU", "LFR"], Tag: ["T6T"], Sor: ["SOE", "UEA"], Psi: ["PSV", "SF6", "SF9", "TTV"] }, sH = { Glc: ["AGLC", "BGLC"], GlcNAc: ["AGLCNA", "BGLCNA", "BGLCN0"], GlcA: ["AGLCA", "BGLCA", "BGLCA0"], Man: ["AMAN", "BMAN"], Rha: ["ARHM", "BRHM"], Ara: ["AARB", "BARB"], Gal: ["AGAL", "BGAL"], GalNAc: ["AGALNA", "BGALNA"], Gul: ["AGUL", "BGUL"], Alt: ["AALT", "BALT"], All: ["AALL", "BALL"], Tal: ["ATAL", "BTAL"], Ido: ["AIDO", "BIDO"], IdoA: ["AIDOA", "BIDOA"], Fuc: ["AFUC", "BFUC"], Lyx: ["ALYF", "BLYF"], Xyl: ["AXYL", "BXYL", "AXYF", "BXYF"], Rib: ["ARIB", "BRIB"], Fru: ["AFRU", "BFRU"], Neu5Ac: ["ANE5AC", "BNE5AC"] }, $c = function() {
  for (var e = /* @__PURE__ */ new Map(), t = 0, n = Qg.length; t < n; ++t) {
    var r = Qg[t], i = oH[r.abbr];
    if (i) for (var a = 0, o = i.length; a < o; ++a) e.set(i[a], r);
    var s = sH[r.abbr];
    if (s) for (a = 0, o = s.length; a < o; ++a) e.set(s[a], r);
  }
  return rH.forEach(function(u) {
    e.has(u) || e.set(u, gk);
  }), e;
}(), vk = /* @__PURE__ */ new Set(["DAPC", "DBPC", "DFPC", "DGPC", "DIPC", "DLPC", "DNPC", "DOPC", "DPPC", "DRPC", "DTPC", "DVPC", "DXPC", "DYPC", "LPPC", "PAPC", "PEPC", "PGPC", "PIPC", "POPC", "PRPC", "PUPC", "DAPE", "DBPE", "DFPE", "DGPE", "DIPE", "DLPE", "DNPE", "DOPE", "DPPE", "DRPE", "DTPE", "DUPE", "DVPE", "DXPE", "DYPE", "LPPE", "PAPE", "PGPE", "PIPE", "POPE", "PQPE", "PRPE", "PUPE", "DAPS", "DBPS", "DFPS", "DGPS", "DIPS", "DLPS", "DNPS", "DOPS", "DPPS", "DRPS", "DTPS", "DUPS", "DVPS", "DXPS", "DYPS", "LPPS", "PAPS", "PGPS", "PIPS", "POPS", "PQPS", "PRPS", "PUPS", "DAPG", "DBPG", "DFPG", "DGPG", "DIPG", "DLPG", "DNPG", "DOPG", "DPPG", "DRPG", "DTPG", "DVPG", "DXPG", "DYPG", "LPPG", "PAPG", "PGPG", "PIPG", "POPG", "PRPG", "DAPA", "DBPA", "DFPA", "DGPA", "DIPA", "DLPA", "DNPA", "DOPA", "DPPA", "DRPA", "DTPA", "DVPA", "DXPA", "DYPA", "LPPA", "PAPA", "PGPA", "PIPA", "POPA", "PRPA", "PUPA", "DPP", "DPPI", "PAPI", "PIPI", "POP", "POPI", "PUPI", "PVP", "PVPI", "PADG", "PIDG", "PODG", "PUDG", "PVDG", "APC", "CPC", "IPC", "LPC", "OPC", "PPC", "TPC", "UPC", "VPC", "BNSM", "DBSM", "DPSM", "DXSM", "PGSM", "PNSM", "POSM", "PVSM", "XNSM", "DPCE", "DXCE", "PNCE", "XNCE", "DMPC"]), rh = /* @__PURE__ */ new Set(["118", "119", "543", "1AL", "1CU", "2FK", "2HP", "2OF", "3CO", "3MT", "3NI", "3OF", "3P8", "4MO", "4PU", "4TI", "6MO", "ACT", "AG", "AL", "ALF", "AM", "ATH", "AU", "AU3", "AUC", "AZI", "BA", "BCT", "BEF", "BF4", "BO4", "BR", "BS3", "BSY", "CA", "CAC", "CD", "CD1", "CD3", "CD5", "CE", "CF", "CHT", "CL", "CO", "CO3", "CO5", "CON", "CR", "CS", "CSB", "CU", "CU1", "CU3", "CUA", "CUZ", "CYN", "DME", "DMI", "DSC", "DTI", "DY", "E4N", "EDR", "EMC", "ER3", "EU", "EU3", "F", "FE", "FE2", "FPO", "GA", "GD3", "GEP", "HAI", "HG", "HGC", "IN", "IOD", "IR", "IR3", "IRI", "IUM", "K", "KO4", "LA", "LCO", "LCP", "LI", "LU", "MAC", "MG", "MH2", "MH3", "MLI", "MMC", "MN", "MN3", "MN5", "MN6", "MO1", "MO2", "MO3", "MO4", "MO5", "MO6", "MOO", "MOS", "MOW", "MW1", "MW2", "MW3", "NA", "NA2", "NA5", "NA6", "NAO", "NAW", "ND", "NET", "NH4", "NI", "NI1", "NI2", "NI3", "NO2", "NO3", "NRU", "O4M", "OAA", "OC1", "OC2", "OC3", "OC4", "OC5", "OC6", "OC7", "OC8", "OCL", "OCM", "OCN", "OCO", "OF1", "OF2", "OF3", "OH", "OS", "OS4", "OXL", "PB", "PBM", "PD", "PDV", "PER", "PI", "PO3", "PO4", "PR", "PT", "PT4", "PTN", "RB", "RH3", "RHD", "RU", "SB", "SCN", "SE4", "SEK", "SM", "SMO", "SO3", "SO4", "SR", "T1A", "TB", "TBA", "TCN", "TEA", "TH", "THE", "TL", "TMA", "TRA", "UNX", "V", "VN3", "VO4", "W", "WO5", "Y1", "YB", "YB2", "YH", "YT3", "ZCM", "ZN", "ZN2", "ZN3", "ZNO", "ZO3", "ZR", "NCO", "OHX"]), uH = function() {
  for (var e = /* @__PURE__ */ Object.create(null), t = [], n = 65; n <= 90; n++) t[t.length] = String.fromCharCode(n);
  for (n = 97; n <= 122; n++) t[t.length] = String.fromCharCode(n);
  for (n = 48; n <= 57; n++) t[t.length] = String.fromCharCode(n);
  for (var r = 0, i = t; r < i.length; r++) {
    var a = i[r];
    e[a] = a.toUpperCase();
    for (var o = 0, s = t; o < s.length; o++) {
      var u = s[o];
      e[a + u] = (a + u).toUpperCase();
      for (var l = 0, c = t; l < c.length; l++) {
        var d = c[l];
        e[a + u + d] = (a + u + d).toUpperCase();
      }
    }
  }
  return e;
}();
function Q1(e) {
  return uH[e] || e.toUpperCase();
}
new Map([[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"], [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"], [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"], [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"], [103, "Lr"], [104, "Rf"], [105, "Db"], [106, "Sg"], [107, "Bh"], [108, "Hs"], [109, "Mt"], [110, "Ds"], [111, "Rg"], [112, "Cn"], [113, "Uut"], [114, "Fl"], [115, "Uup"], [116, "Lv"], [117, "Uus"], [118, "Uuo"]].map(function(e) {
  return [e[0], Q1(e[1])];
}));
var gn, cn, lH = ((sc = {})[0] = { trace: /* @__PURE__ */ new Set(), directionFrom: /* @__PURE__ */ new Set(), directionTo: /* @__PURE__ */ new Set(), backboneStart: /* @__PURE__ */ new Set(), backboneEnd: /* @__PURE__ */ new Set(), coarseBackbone: /* @__PURE__ */ new Set() }, sc[1] = { trace: /* @__PURE__ */ new Set(["CA"]), directionFrom: /* @__PURE__ */ new Set(["C"]), directionTo: /* @__PURE__ */ new Set(["O", "OC1", "O1", "OX1", "OXT", "OT1"]), backboneStart: /* @__PURE__ */ new Set(["N"]), backboneEnd: /* @__PURE__ */ new Set(["C"]), coarseBackbone: /* @__PURE__ */ new Set(["CA", "BB", "CA1"]) }, sc[2] = { trace: /* @__PURE__ */ new Set(["CA"]), directionFrom: /* @__PURE__ */ new Set(["C"]), directionTo: /* @__PURE__ */ new Set(["O"]), backboneStart: /* @__PURE__ */ new Set(["N"]), backboneEnd: /* @__PURE__ */ new Set(["CD"]), coarseBackbone: /* @__PURE__ */ new Set(["CA"]) }, sc[3] = { trace: /* @__PURE__ */ new Set(["CA"]), directionFrom: /* @__PURE__ */ new Set(["C"]), directionTo: /* @__PURE__ */ new Set(["O"]), backboneStart: /* @__PURE__ */ new Set(["N"]), backboneEnd: /* @__PURE__ */ new Set(["CG"]), coarseBackbone: /* @__PURE__ */ new Set(["CA"]) }, sc[4] = { trace: /* @__PURE__ */ new Set(["O3'", "O3*"]), directionFrom: /* @__PURE__ */ new Set(["C4'", "C4*"]), directionTo: /* @__PURE__ */ new Set(["C3'", "C3*"]), backboneStart: /* @__PURE__ */ new Set(["P"]), backboneEnd: /* @__PURE__ */ new Set(["O3'", "O3*"]), coarseBackbone: /* @__PURE__ */ new Set(["P"]) }, sc[5] = { trace: /* @__PURE__ */ new Set(["O3'", "O3*"]), directionFrom: /* @__PURE__ */ new Set(["C3'", "C3*"]), directionTo: /* @__PURE__ */ new Set(["C1'", "C1*"]), backboneStart: /* @__PURE__ */ new Set(["P"]), backboneEnd: /* @__PURE__ */ new Set(["O3'", "O3*"]), coarseBackbone: /* @__PURE__ */ new Set(["P"]) }, sc[6] = { trace: /* @__PURE__ */ new Set(["N4'", "N4*"]), directionFrom: /* @__PURE__ */ new Set(["N4'", "N4*"]), directionTo: /* @__PURE__ */ new Set(["C7'", "C7*"]), backboneStart: /* @__PURE__ */ new Set(["N1'", "N1*"]), backboneEnd: /* @__PURE__ */ new Set(["C'", "C*"]), coarseBackbone: /* @__PURE__ */ new Set(["P"]) }, sc), F6 = /* @__PURE__ */ new Set(["CA", "C", "N", "O", "O1", "O2", "OC1", "OC2", "OT1", "OT2", "OX1", "OXT", "H", "H1", "H2", "H3", "HA", "HN", "HXT", "BB"]), cH = /* @__PURE__ */ new Set(["P", "OP1", "OP2", "HOP2", "HOP3", "O2'", "O3'", "O4'", "O5'", "C1'", "C2'", "C3'", "C4'", "C5'", "H1'", "H2'", "H2''", "HO2'", "H3'", "H4'", "H5'", "H5''", "HO3'", "HO5'", "O2*", "O3*", "O4*", "O5*", "C1*", "C2*", "C3*", "C4*", "C5*"]), yk = /* @__PURE__ */ new Set(["D-PEPTIDE LINKING", "D-PEPTIDE NH3 AMINO TERMINUS", "D-PEPTIDE COOH CARBOXY TERMINUS", "D-GAMMA-PEPTIDE, C-DELTA LINKING", "D-BETA-PEPTIDE, C-GAMMA LINKING"]), bk = /* @__PURE__ */ new Set(["L-PEPTIDE LINKING", "L-PEPTIDE NH3 AMINO TERMINUS", "L-PEPTIDE COOH CARBOXY TERMINUS", "L-GAMMA-PEPTIDE, C-DELTA LINKING", "L-BETA-PEPTIDE, C-GAMMA LINKING"]), dH = /* @__PURE__ */ new Set(["D-GAMMA-PEPTIDE, C-DELTA LINKING", "L-GAMMA-PEPTIDE, C-DELTA LINKING"]), fH = /* @__PURE__ */ new Set(["D-BETA-PEPTIDE, C-GAMMA LINKING", "L-BETA-PEPTIDE, C-GAMMA LINKING"]), mH = /* @__PURE__ */ new Set(["D-PEPTIDE NH3 AMINO TERMINUS", "D-PEPTIDE COOH CARBOXY TERMINUS", "L-PEPTIDE NH3 AMINO TERMINUS", "L-PEPTIDE COOH CARBOXY TERMINUS"]), _k = /* @__PURE__ */ new Set(["PEPTIDE LINKING", "PEPTIDE-LIKE"]), pH = ka.unionMany(yk, bk, _k), xk = /* @__PURE__ */ new Set(["DNA LINKING", "L-DNA LINKING", "DNA OH 5 PRIME TERMINUS", "DNA OH 3 PRIME TERMINUS"]), Ck = /* @__PURE__ */ new Set(["RNA LINKING", "L-RNA LINKING", "RNA OH 5 PRIME TERMINUS", "RNA OH 3 PRIME TERMINUS"]), Sk = /* @__PURE__ */ new Set(["D-SACCHARIDE, BETA LINKING", "L-SACCHARIDE, BETA LINKING", "D-SACCHARIDE, ALPHA LINKING", "L-SACCHARIDE, ALPHA LINKING", "L-SACCHARIDE", "D-SACCHARIDE", "SACCHARIDE", "D-SACCHARIDE 1,4 AND 1,4 LINKING", "L-SACCHARIDE 1,4 AND 1,4 LINKING", "D-SACCHARIDE 1,4 AND 1,6 LINKING", "L-SACCHARIDE 1,4 AND 1,6 LINKING"]), hH = /* @__PURE__ */ new Set(["NON-POLYMER", "OTHER"]), gH = /* @__PURE__ */ new Set(["ION"]), vH = /* @__PURE__ */ new Set(["LIPID"]), Lm = /* @__PURE__ */ new Set(["SOL", "WAT", "HOH", "H2O", "W", "DOD", "D3O", "TIP", "TIP3", "TIP4", "SPC"]), Ak = /* @__PURE__ */ new Set(["HIS", "ARG", "LYS", "ILE", "PHE", "LEU", "TRP", "ALA", "MET", "PRO", "CYS", "ASN", "VAL", "GLY", "SER", "GLN", "TYR", "ASP", "GLU", "THR", "SEC", "PYL", "UNK", "MSE", "SEP", "TPO", "PTR", "PCA", "HSD", "HSE", "HSP", "LSN", "ASPP", "GLUP", "HID", "HIE", "HIP", "LYN", "ASH", "GLH", "ACE", "NME"]), wk = /* @__PURE__ */ new Set(["DAL", "DAR", "DSG", "DAS", "DCY", "DGL", "DGN", "DHI", "DIL", "DLE", "DLY", "MED", "DPN", "DPR", "DSN", "DTH", "DTR", "DTY", "DVA", "DNE"]), ih = ka.unionMany(Ak, wk), s3 = /* @__PURE__ */ new Set(["A", "C", "T", "G", "I", "U", "N"]), u3 = /* @__PURE__ */ new Set(["DA", "DC", "DT", "DG", "DI", "DU", "DN"]), V6 = /* @__PURE__ */ new Set(["APN", "CPN", "TPN", "GPN"]), yH = /* @__PURE__ */ new Set(["A", "G", "I", "DA", "DG", "DI", "APN", "GPN"]), bH = /* @__PURE__ */ new Set(["C", "T", "U", "DC", "DT", "DU", "CPN", "TPN"]), G6 = ka.unionMany(s3, u3, V6), Ik = function(e) {
  return yH.has(e.toUpperCase());
}, Pk = function(e) {
  return bH.has(e.toUpperCase());
}, z6 = ka.unionMany(ih, G6);
function ah(e, t) {
  return e = e.toUpperCase(), t = t.toUpperCase(), V6.has(t) ? 8 : pH.has(e) ? 5 : Ck.has(e) ? 6 : xk.has(e) ? 7 : Sk.has(e) ? 9 : Lm.has(t) ? 2 : rh.has(t) ? 3 : vk.has(t) ? 4 : hH.has(e) ? $c.has(t) ? 9 : ih.has(t) ? 5 : s3.has(t) ? 6 : u3.has(t) ? 7 : 1 : 0;
}
function _H(e, t) {
  return e = e.toUpperCase(), t === 5 ? dH.has(e) ? 2 : fH.has(e) ? 3 : mH.has(e) ? 0 : 1 : t === 6 ? 4 : t === 7 ? 5 : t === 8 ? 6 : 0;
}
function Mk(e) {
  return e = e.toUpperCase(), ih.has(e) ? "peptide linking" : s3.has(e) ? "RNA linking" : u3.has(e) ? "DNA linking" : $c.has(e) ? "saccharide" : "other";
}
function xH(e) {
  return e = e.toUpperCase(), Lm.has(e) ? "water" : z6.has(e) ? "polymer" : $c.has(e) ? "branched" : "non-polymer";
}
function CH(e, t) {
  return e = e.toUpperCase(), t = t.toUpperCase(), bk.has(t) ? "polypeptide(L)" : yk.has(t) ? "polypeptide(D)" : Ck.has(t) ? "polyribonucleotide" : xk.has(t) ? "polydeoxyribonucleotide" : Sk.has(t) || $c.has(e) ? "oligosaccharide" : V6.has(e) ? "peptide nucleic acid" : Ak.has(e) ? "polypeptide(L)" : wk.has(e) ? "polypeptide(D)" : s3.has(e) ? "polyribonucleotide" : u3.has(e) ? "polydeoxyribonucleotide" : gH.has(t) || rh.has(e) ? "ion" : vH.has(t) || vk.has(e) ? "lipid" : _k.has(t) ? "peptide-like" : "other";
}
function U6(e) {
  return Nm(e) || Ek(e);
}
function Nm(e) {
  return e === 7 || e === 6 || e === 8;
}
function Ek(e) {
  return e === 5;
}
(function(e) {
  e.is = Qi.has, e.create = Qi.create, e.SecondaryStructureMmcif = { HELX_LH_27_P: 1058, HELX_LH_3T_P: 2082, HELX_LH_AL_P: 4130, HELX_LH_A_N: 524321, HELX_LH_B_N: 1048609, HELX_LH_GA_P: 8226, HELX_LH_N: 33, HELX_LH_OM_P: 16418, HELX_LH_OT_N: 131105, HELX_LH_OT_P: 546, HELX_LH_P: 34, HELX_LH_PI_P: 32802, HELX_LH_PP_P: 65570, HELX_LH_Z_N: 262177, HELX_N: 1, HELX_OT_N: 1, HELX_OT_P: 2, HELX_P: 2, HELX_RH_27_P: 1090, HELX_RH_3T_P: 2114, HELX_RH_AL_P: 4162, HELX_RH_A_N: 524353, HELX_RH_B_N: 1048641, HELX_RH_GA_P: 8258, HELX_RH_N: 65, HELX_RH_OM_P: 16450, HELX_RH_OT_N: 131137, HELX_RH_OT_P: 578, HELX_RH_P: 66, HELX_RH_PI_P: 32834, HELX_RH_PP_P: 65602, HELX_RH_Z_N: 262209, STRN: 4194308, TURN_OT_P: 33554448, TURN_P: 16, TURN_TY1P_P: 67109136, TURN_TY1_P: 67109008, TURN_TY2P_P: 134218e3, TURN_TY2_P: 134217872, TURN_TY3P_P: 268435728, TURN_TY3_P: 268435600 }, e.SecondaryStructurePdb = { 1: 4162, 2: 16450, 3: 32834, 4: 8258, 5: 2114, 6: 4130, 7: 16418, 8: 8226, 9: 1026, 10: 65538 }, e.SecondaryStructureStride = { H: 4098, G: 2050, I: 32770, E: 8388612, B: 4194308, T: 16, C: 536870912 }, e.SecondaryStructureDssp = { H: 4098, B: 4194308, E: 8388612, G: 2050, I: 32770, T: 16, S: 8 };
})(gn || (gn = {})), function(e) {
  function t(n) {
    switch (n) {
      case "covalent":
        return 1;
      case "metal-coordination":
        return 2;
      case "hydrogen-bond":
        return 4;
      case "disulfide":
        return 8;
      case "aromatic":
        return 16;
      case "computed":
        return 32;
    }
  }
  e.is = Qi.has, e.create = function(n) {
    return Qi.create(n);
  }, e.isCovalent = function(n) {
    return !!(1 & n);
  }, e.isAll = function(n) {
    return n === Math.pow(2, 6) - 1;
  }, e.Names = { covalent: 1, "metal-coordination": 2, "hydrogen-bond": 4, disulfide: 8, aromatic: 16, computed: 32 }, e.isName = function(n) {
    return n in e.Names;
  }, e.fromName = t, e.fromNames = function(n) {
    for (var r = 0, i = 0, a = n.length; i < a; ++i) r |= t(n[i]);
    return r;
  };
}(cn || (cn = {}));
var Ay = { ALA: [0.17, 0.5, 0.33], ARG: [0.81, 1.81, 1], ASN: [0.42, 0.85, 0.43], ASP: [1.23, 3.64, 2.41], ASH: [-0.07, 0.43, 0.5], CYS: [-0.24, -0.02, 0.22], GLN: [0.58, 0.77, 0.19], GLU: [2.02, 3.63, 1.61], GLH: [-0.01, 0.11, 0.12], GLY: [0.01, 1.15, 1.14], HIS: [0.17, 0.11, -0.06], ILE: [-0.31, -1.12, -0.81], LEU: [-0.56, -1.25, -0.69], LYS: [0.99, 2.8, 1.81], MET: [-0.23, -0.67, -0.44], PHE: [-1.13, -1.71, -0.58], PRO: [0.45, 0.14, -0.31], SER: [0.13, 0.46, 0.33], THR: [0.14, 0.25, 0.11], TRP: [-1.85, -2.09, -0.24], TYR: [-0.94, -0.71, 0.23], VAL: [0.07, -0.46, -0.53], HSD: [0.17, 0.11, -0.06], HSE: [0.17, 0.11, -0.06], HSP: [0.96, 2.33, 1.37], HID: [0.17, 0.11, -0.06], HIE: [0.17, 0.11, -0.06], HIP: [0.96, 2.33, 1.37] }, J1 = function() {
  function e() {
    this.count = 0, this.center = A(), this.radiusSq = 0;
  }
  return e.prototype.reset = function() {
    A.set(this.center, 0, 0, 0), this.radiusSq = 0, this.count = 0;
  }, e.prototype.includeStep = function(t) {
    A.add(this.center, this.center, t), this.count++;
  }, e.prototype.finishedIncludeStep = function() {
    this.count !== 0 && A.scale(this.center, this.center, 1 / this.count);
  }, e.prototype.radiusStep = function(t) {
    var n = A.squaredDistance(t, this.center);
    n > this.radiusSq && (this.radiusSq = n);
  }, e.prototype.radiusSphereStep = function(t, n) {
    var r = A.distance(t, this.center) + n, i = r * r;
    i > this.radiusSq && (this.radiusSq = i);
  }, e.prototype.getSphere = function(t) {
    return t || (t = pe()), A.copy(t.center, this.center), t.radius = Math.sqrt(this.radiusSq), t;
  }, e.prototype.getCount = function() {
    return this.count;
  }, e;
}();
(function(e) {
  var t = new e(), n = A(), r = A();
  e.fromArrays = function(i, a) {
    var o = i.x, s = i.y, u = i.z;
    t.reset();
    for (var l = o.length, c = 0; c < l; c++) A.set(n, o[c], s[c], u[c]), t.includeStep(n);
    for (t.finishedIncludeStep(), c = 0; c < l; c++) A.set(n, o[c], s[c], u[c]), t.radiusStep(n);
    return A.copy(a.center, t.center), a.radius = Math.sqrt(t.radiusSq), a;
  }, e.fromProvider = function(i, a, o) {
    t.reset();
    for (var s = 0; s < i; s++) a(s, n), t.includeStep(n);
    for (t.finishedIncludeStep(), s = 0; s < i; s++) a(s, n), t.radiusStep(n);
    return A.copy(o.center, t.center), o.radius = Math.sqrt(t.radiusSq), o;
  }, e.fromPairProvider = function(i, a, o) {
    t.reset();
    for (var s = 0; s < i; s++) a(s, n, r), t.includeStep(n), t.includeStep(r);
    for (t.finishedIncludeStep(), s = 0; s < i; s++) a(s, n, r), t.radiusStep(n), t.radiusStep(r);
    return A.copy(o.center, t.center), o.radius = Math.sqrt(t.radiusSq), o;
  };
})(J1 || (J1 = {}));
var _f = function() {
  function e(t) {
    this.map = t;
    var n = 0, r = [], i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
    this.map.forEach(function(o) {
      o.forEach(function(s) {
        n += s.edgeCount, s.connectedIndices.forEach(function(u) {
          s.getEdges(u).forEach(function(l) {
            var c = s.unitA, d = s.unitB, f = e.getEdgeKey(u, c, l.indexB, d);
            i.set(f, r.length);
            var p = e.getVertexKey(u, c), g = a.get(p);
            g === void 0 ? a.set(p, [r.length]) : g.push(r.length), r.push(O(O({}, l), { indexA: u, unitA: c, unitB: d }));
          });
        });
      });
    }), this.edgeCount = n, this.edges = r, this.edgeKeyIndex = i, this.vertexKeyIndex = a;
  }
  return e.prototype.getConnectedUnits = function(t) {
    return this.map.has(t) ? this.map.get(t) : Tk;
  }, e.prototype.getEdgeIndex = function(t, n, r, i) {
    var a = e.getEdgeKey(t, n, r, i), o = this.edgeKeyIndex.get(a);
    return o !== void 0 ? o : -1;
  }, e.prototype.hasEdge = function(t, n, r, i) {
    return this.getEdgeIndex(t, n, r, i) !== -1;
  }, e.prototype.getEdge = function(t, n, r, i) {
    var a = this.getEdgeIndex(t, n, r, i);
    return a !== -1 ? this.edges[a] : void 0;
  }, e.prototype.getEdgeIndices = function(t, n) {
    return this.vertexKeyIndex.get(e.getVertexKey(t, n)) || [];
  }, e;
}();
(function(e) {
  var t = function() {
    function i(a, o, s, u, l) {
      this.unitA = a, this.unitB = o, this.edgeCount = s, this.connectedIndices = u, this.edgeMap = l;
    }
    return i.prototype.hasEdges = function(a) {
      return this.edgeMap.has(a);
    }, i.prototype.getEdges = function(a) {
      return this.edgeMap.has(a) ? this.edgeMap.get(a) : Tk;
    }, Object.defineProperty(i.prototype, "areUnitsOrdered", { get: function() {
      return this.unitA < this.unitB;
    }, enumerable: !1, configurable: !0 }), i;
  }();
  function n(i, a, o) {
    i.has(a) ? i.get(a).push(o) : i.set(a, [o]);
  }
  e.UnitPairEdges = t, e.getEdgeKey = function(i, a, o, s) {
    return "".concat(i, "|").concat(a, "|").concat(o, "|").concat(s);
  }, e.getVertexKey = function(i, a) {
    return "".concat(i, "|").concat(a);
  };
  var r = function() {
    function i() {
      this.map = /* @__PURE__ */ new Map();
    }
    return i.prototype.startUnitPair = function(a, o) {
      this.uA = a, this.uB = o, this.mapAB = /* @__PURE__ */ new Map(), this.mapBA = /* @__PURE__ */ new Map(), this.linkedA = or.create(), this.linkedB = or.create(), this.linkCount = 0;
    }, i.prototype.finishUnitPair = function() {
      this.linkCount !== 0 && (n(this.map, this.uA, new t(this.uA, this.uB, this.linkCount, this.linkedA.array, this.mapAB)), n(this.map, this.uB, new t(this.uB, this.uA, this.linkCount, this.linkedB.array, this.mapBA)));
    }, i.prototype.add = function(a, o, s) {
      n(this.mapAB, a, { indexB: o, props: s }), n(this.mapBA, o, { indexB: a, props: s }), or.add(this.linkedA, a, a), or.add(this.linkedB, o, o), this.linkCount += 1;
    }, i.prototype.getMap = function() {
      return this.map;
    }, i;
  }();
  e.Builder = r;
})(_f || (_f = {}));
var g5, Tk = [];
(function(e) {
  e.Empty = to.create([], [], [], 0, { flags: [], order: [] });
})(g5 || (g5 = {}));
var Jg = function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  return Zi(t, e), t.prototype.getBondFromLocation = function(n) {
    return ve.isAtomic(n.aUnit) && ve.isAtomic(n.bUnit) ? this.getEdge(n.aIndex, n.aUnit.id, n.bIndex, n.bUnit.id) : void 0;
  }, t.prototype.getBondIndexFromLocation = function(n) {
    return ve.isAtomic(n.aUnit) && ve.isAtomic(n.bUnit) ? this.getEdgeIndex(n.aIndex, n.aUnit.id, n.bIndex, n.bUnit.id) : -1;
  }, t;
}(_f);
(function(e) {
  var t = function(n) {
    function r() {
      return n !== null && n.apply(this, arguments) || this;
    }
    return Zi(r, n), r;
  }(_f.UnitPairEdges);
  e.UnitPairBonds = t;
})(Jg || (Jg = {}));
var kk = { forceCompute: !1, noCompute: !1, maxRadius: 4 }, A0 = { H: 0, h: 0, D: 0, d: 0, T: 0, t: 0, He: 2, HE: 2, he: 2, Li: 3, LI: 3, li: 3, Be: 4, BE: 4, be: 4, B: 5, b: 5, C: 6, c: 6, N: 7, n: 7, O: 8, o: 8, F: 9, f: 9, Ne: 10, NE: 10, ne: 10, Na: 11, NA: 11, na: 11, Mg: 12, MG: 12, mg: 12, Al: 13, AL: 13, al: 13, Si: 14, SI: 14, si: 14, P: 15, p: 15, S: 16, s: 16, Cl: 17, CL: 17, cl: 17, Ar: 18, AR: 18, ar: 18, K: 19, k: 19, Ca: 20, CA: 20, ca: 20, Sc: 21, SC: 21, sc: 21, Ti: 22, TI: 22, ti: 22, V: 23, v: 23, Cr: 24, CR: 24, cr: 24, Mn: 25, MN: 25, mn: 25, Fe: 26, FE: 26, fe: 26, Co: 27, CO: 27, co: 27, Ni: 28, NI: 28, ni: 28, Cu: 29, CU: 29, cu: 29, Zn: 30, ZN: 30, zn: 30, Ga: 31, GA: 31, ga: 31, Ge: 32, GE: 32, ge: 32, As: 33, AS: 33, as: 33, Se: 34, SE: 34, se: 34, Br: 35, BR: 35, br: 35, Kr: 36, KR: 36, kr: 36, Rb: 37, RB: 37, rb: 37, Sr: 38, SR: 38, sr: 38, Y: 39, y: 39, Zr: 40, ZR: 40, zr: 40, Nb: 41, NB: 41, nb: 41, Mo: 42, MO: 42, mo: 42, Tc: 43, TC: 43, tc: 43, Ru: 44, RU: 44, ru: 44, Rh: 45, RH: 45, rh: 45, Pd: 46, PD: 46, pd: 46, Ag: 47, AG: 47, ag: 47, Cd: 48, CD: 48, cd: 48, In: 49, IN: 49, in: 49, Sn: 50, SN: 50, sn: 50, Sb: 51, SB: 51, sb: 51, Te: 52, TE: 52, te: 52, I: 53, i: 53, Xe: 54, XE: 54, xe: 54, Cs: 55, CS: 55, cs: 55, Ba: 56, BA: 56, ba: 56, La: 57, LA: 57, la: 57, Ce: 58, CE: 58, ce: 58, Pr: 59, PR: 59, pr: 59, Nd: 60, ND: 60, nd: 60, Pm: 61, PM: 61, pm: 61, Sm: 62, SM: 62, sm: 62, Eu: 63, EU: 63, eu: 63, Gd: 64, GD: 64, gd: 64, Tb: 65, TB: 65, tb: 65, Dy: 66, DY: 66, dy: 66, Ho: 67, HO: 67, ho: 67, Er: 68, ER: 68, er: 68, Tm: 69, TM: 69, tm: 69, Yb: 70, YB: 70, yb: 70, Lu: 71, LU: 71, lu: 71, Hf: 72, HF: 72, hf: 72, Ta: 73, TA: 73, ta: 73, W: 74, w: 74, Re: 75, RE: 75, re: 75, Os: 76, OS: 76, os: 76, Ir: 77, IR: 77, ir: 77, Pt: 78, PT: 78, pt: 78, Au: 79, AU: 79, au: 79, Hg: 80, HG: 80, hg: 80, Tl: 81, TL: 81, tl: 81, Pb: 82, PB: 82, pb: 82, Bi: 83, BI: 83, bi: 83, Po: 84, PO: 84, po: 84, At: 85, AT: 85, at: 85, Rn: 86, RN: 86, rn: 86, Fr: 87, FR: 87, fr: 87, Ra: 88, RA: 88, ra: 88, Ac: 89, AC: 89, ac: 89, Th: 90, TH: 90, th: 90, Pa: 91, PA: 91, pa: 91, U: 92, u: 92, Np: 93, NP: 93, np: 93, Pu: 94, PU: 94, pu: 94, Am: 95, AM: 95, am: 95, Cm: 96, CM: 96, cm: 96, Bk: 97, BK: 97, bk: 97, Cf: 98, CF: 98, cf: 98, Es: 99, ES: 99, es: 99, Fm: 100, FM: 100, fm: 100, Md: 101, MD: 101, md: 101, No: 102, NO: 102, no: 102, Lr: 103, LR: 103, lr: 103, Rf: 104, RF: 104, rf: 104, Db: 105, DB: 105, db: 105, Sg: 106, SG: 106, sg: 106, Bh: 107, BH: 107, bh: 107, Hs: 108, HS: 108, hs: 108, Mt: 109, MT: 109, mt: 109, NH: 113 }, SH = { 0: 1.42, 1: 1.42, 3: 2.7, 4: 2.7, 6: 1.75, 7: 1.6, 8: 1.52, 11: 2.7, 12: 2.7, 13: 2.7, 14: 1.9, 15: 2, 16: 1.9, 17: 1.8, 19: 2.7, 20: 2.7, 21: 2.7, 22: 2.7, 23: 2.7, 24: 2.7, 25: 2.7, 26: 2.7, 27: 2.7, 28: 2.7, 29: 2.7, 30: 2.7, 31: 2.7, 33: 2.68, 37: 2.7, 38: 2.7, 39: 2.7, 40: 2.7, 41: 2.7, 42: 2.7, 43: 2.7, 44: 2.7, 45: 2.7, 46: 2.7, 47: 2.7, 48: 2.7, 49: 2.7, 50: 2.7, 55: 2.7, 56: 2.7, 57: 2.7, 58: 2.7, 59: 2.7, 60: 2.7, 61: 2.7, 62: 2.7, 63: 2.7, 64: 2.7, 65: 2.7, 66: 2.7, 67: 2.7, 68: 2.7, 69: 2.7, 70: 2.7, 71: 2.7, 72: 2.7, 73: 2.7, 74: 2.7, 75: 2.7, 76: 2.7, 77: 2.7, 78: 2.7, 79: 2.7, 80: 2.7, 81: 2.7, 82: 2.7, 83: 2.7, 87: 2.7, 88: 2.7, 89: 2.7, 90: 2.7, 91: 2.7, 92: 2.7, 93: 2.7, 94: 2.7, 95: 2.7, 96: 2.7, 97: 2.7, 98: 2.7, 99: 2.7, 100: 2.7, 101: 2.7, 102: 2.7, 103: 2.7, 104: 2.7, 105: 2.7, 106: 2.7, 107: 2.7, 108: 2.7, 109: 2.88 }, Dk = { 0: 0.8, 20: 1.31, 27: 1.2, 35: 1.15, 44: 1.25, 54: 1, 60: 1.84, 72: 1.88, 84: 1.75, 85: 1.56, 86: 1.76, 98: 1.6, 99: 1.68, 100: 1.63, 112: 1.6, 113: 1.59, 114: 1.36, 129: 1.45, 135: 1.47, 144: 1.6, 152: 1.45, 170: 1.4, 180: 1.55, 202: 2.4, 222: 2.24, 224: 1.91, 225: 1.98, 243: 2.02, 269: 2, 293: 1.9, 316: 1.8, 420: 2.37, 480: 2.3, 512: 2.3, 544: 2.3, 612: 2.1, 629: 1.54, 665: 1, 813: 2.6, 854: 2.27, 894: 1.93, 896: 2.1, 937: 2.05, 938: 2.06, 981: 1.62, 1258: 2.68, 1309: 2.33, 1484: 1, 1763: 2.14, 1823: 2.48, 1882: 2.1, 1944: 1.72, 2380: 2.34, 3367: 2.44, 3733: 2.11, 3819: 2.6, 3821: 2.36, 4736: 2.75, 5724: 2.73, 5959: 2.63, 6519: 2.84, 6750: 2.87, 8991: 2.81 }, Ok = { 14: 1.71649, 20: 1.59646, 27: 1.2, 35: 1.2, 44: 1.2, 54: 1.1, 60: 1.85846, 62: 2.66213, 73: 2.10649, 74: 2.60087, 77: 2.79942, 84: 1.89002, 85: 1.93846, 86: 1.98749, 87: 2.34276, 90: 2.24293, 98: 1.79202, 99: 1.82746, 100: 1.88749, 104: 1.90646, 112: 1.8826, 113: 1.97249, 114: 1.76646, 119: 1.82002, 128: 1.81746, 129: 1.76002, 135: 1.45998, 144: 1.7, 145: 1.82646, 152: 1.42998, 170: 1.5, 182: 3.12942, 201: 2.95693, 202: 2.56293, 205: 2.55649, 206: 3.02481, 209: 3.21942, 221: 2.80398, 222: 2.41824, 223: 2.24646, 224: 2.23302, 225: 2.37646, 226: 2.43649, 227: 2.91814, 230: 2.69295, 243: 2.29093, 244: 2.1074, 245: 2.12002, 246: 1.93998, 247: 2.27646, 248: 2.36649, 252: 2.24291, 266: 2.00146, 267: 1.99002, 268: 1.97146, 269: 2.15002, 270: 2.19646, 275: 1.76642, 290: 1.93002, 291: 2.08646, 292: 2.28849, 293: 2.11002, 299: 1.73642, 315: 2.01002, 316: 1.8, 317: 2.20646, 324: 1.67642, 341: 1.95002, 342: 2.16646, 350: 1.70642, 366: 3.47942, 368: 2.14646, 370: 3.41942, 377: 1.68642, 393: 3.00293, 394: 3.57685, 397: 3.25142, 398: 3.00295, 405: 1.9278, 420: 2.6, 421: 2.69646, 422: 2.89293, 423: 3.39412, 425: 3.11142, 426: 2.83062, 427: 2.54291, 434: 1.44998, 450: 2.58002, 451: 2.66646, 452: 2.79293, 455: 2.70495, 456: 2.42029, 457: 2.08642, 464: 1.81649, 480: 2.48381, 481: 2.47602, 482: 2.48846, 486: 2.32291, 487: 2.35391, 488: 2.38329, 495: 2.13293, 512: 2.57646, 513: 2.38002, 518: 2.86293, 519: 2.84939, 520: 2.5152, 527: 1.55998, 544: 2.2, 545: 2.28746, 551: 2.87293, 552: 2.44293, 553: 2.56193, 554: 2.25191, 560: 1.59998, 578: 2.37002, 585: 2.45293, 586: 2.51652, 587: 2.48193, 588: 2.19691, 612: 2.14296, 614: 3.44942, 620: 2.41093, 621: 2.44693, 622: 2.36293, 629: 1.58998, 649: 3.79285, 650: 3.41295, 656: 2.36293, 657: 2.40493, 658: 2.30649, 659: 2.32649, 685: 3.65976, 686: 3.31295, 687: 2.96291, 693: 2.35293, 694: 2.28149, 695: 2.49295, 723: 3.23295, 724: 2.88391, 725: 2.51642, 731: 2.20249, 732: 2.47295, 733: 2.43293, 736: 2.60649, 737: 3.2433, 740: 3.43645, 762: 2.92291, 763: 2.74646, 764: 2.46642, 770: 2.46295, 771: 2.41693, 772: 1.96, 774: 2.42646, 775: 2.57649, 776: 3.11654, 779: 2.87295, 802: 3.02293, 803: 2.82293, 804: 2.42642, 810: 2.38293, 811: 2.18646, 812: 1.92998, 813: 2.38646, 814: 2.40646, 815: 2.50649, 819: 2.46649, 843: 3.15293, 844: 2.72491, 845: 2.39642, 851: 2.14646, 852: 2.09802, 854: 2.01998, 855: 2.33646, 860: 2.29004, 885: 2.80293, 886: 2.93293, 887: 2.42642, 893: 2.01002, 894: 2.24546, 895: 2.1, 896: 2.26002, 902: 1.90642, 928: 2.84593, 929: 2.83793, 930: 2.36642, 936: 2.15646, 937: 2.16102, 945: 1.83701, 972: 2.86293, 973: 2.65293, 974: 2.31998, 980: 2.08002, 981: 2.35646, 1017: 2.74593, 1018: 2.58649, 1019: 2.65649, 1023: 3.64942, 1025: 2.20646, 1027: 3.79645, 1034: 1.65998, 1063: 2.62649, 1064: 2.76095, 1065: 2.86293, 1068: 3.09293, 1069: 3.71593, 1071: 2.67549, 1072: 3.43945, 1073: 3.09295, 1080: 1.59998, 1110: 2.75295, 1111: 2.80293, 1112: 2.46998, 1114: 2.75646, 1115: 3.03293, 1116: 3.57715, 1118: 3.37645, 1119: 2.98095, 1120: 2.77649, 1127: 1.51998, 1158: 2.72293, 1159: 2.61946, 1160: 2.36998, 1161: 2.66002, 1162: 2.72646, 1163: 2.99293, 1166: 2.88195, 1167: 2.62549, 1168: 2.65004, 1175: 1.65642, 1207: 2.52646, 1208: 2.56702, 1209: 2.29998, 1210: 2.61002, 1211: 2.65646, 1215: 2.51049, 1216: 3.09651, 1217: 2.46046, 1224: 2.52295, 1257: 2.49002, 1258: 2.84649, 1259: 2.69646, 1260: 2.55002, 1265: 2.99651, 1266: 2.45329, 1267: 2.4735, 1274: 1.87642, 1308: 2.61646, 1309: 2.81649, 1310: 2.44293, 1316: 2.35646, 1317: 2.3475, 1325: 2.00642, 1360: 2.57002, 1361: 2.21998, 1368: 2.2998, 1369: 2.22446, 1370: 2.2626, 1377: 2.81998, 1411: 3.94942, 1413: 2.33296, 1415: 3.50645, 1421: 2.24219, 1422: 2.22646, 1423: 2.2626, 1424: 2.33649, 1430: 1.87998, 1464: 3.48295, 1465: 4.00186, 1468: 3.97645, 1469: 3.43295, 1475: 2.57646, 1476: 2.24946, 1477: 2.40451, 1518: 3.04291, 1519: 3.42295, 1520: 3.8513, 1522: 3.86664, 1523: 3.51295, 1524: 3.17649, 1530: 2.16646, 1531: 2.39849, 1532: 2.00642, 1573: 2.87642, 1574: 3.00291, 1575: 3.36995, 1578: 3.37295, 1579: 3.08649, 1580: 3.02004, 1586: 2.34649, 1587: 2.81139, 1588: 2.82295, 1592: 3.42496, 1595: 3.55942, 1629: 2.54642, 1630: 2.53642, 1631: 2.94291, 1635: 3.00649, 1636: 2.91004, 1637: 2.61642, 1643: 2.76939, 1644: 2.76695, 1645: 2.18642, 1648: 2.81649, 1649: 3.37676, 1652: 3.08295, 1686: 2.49642, 1687: 2.48642, 1688: 3.20293, 1693: 3.33651, 1694: 2.74, 1695: 2.54701, 1701: 2.67395, 1702: 2.46491, 1703: 2.7152, 1705: 2.65646, 1706: 2.70649, 1710: 2.77293, 1744: 2.51642, 1745: 2.44642, 1746: 2.87329, 1752: 2.76291, 1753: 2.80067, 1760: 2.35491, 1761: 2.82146, 1762: 2.56446, 1763: 2.25998, 1764: 2.55646, 1769: 2.34644, 1803: 2.50642, 1804: 2.47642, 1805: 2.97293, 1812: 2.80447, 1814: 2.33998, 1820: 2.63793, 1821: 2.45237, 1822: 2.16998, 1823: 2.16998, 1829: 2.62649, 1863: 2.43642, 1864: 2.43642, 1865: 3.05293, 1873: 2.56002, 1874: 2.6426, 1875: 2.43998, 1881: 2.35646, 1882: 2.3334, 1924: 2.28998, 1925: 2.39642, 1926: 2.8952, 1935: 2.70646, 1936: 2.19998, 1937: 2.46998, 1943: 2.22002, 1944: 2.47646, 1986: 2.71895, 1987: 2.18998, 1988: 2.33642, 1998: 2.62646, 1999: 2.69649, 2e3: 2.37642, 2006: 3.18295, 2007: 2.63451, 2008: 3.94942, 2015: 2.56649, 2049: 2.95293, 2050: 2.76295, 2051: 2.80649, 2062: 2.65649, 2063: 3.08839, 2064: 3.20295, 2068: 3.95459, 2070: 2.62649, 2071: 3.53642, 2072: 3.33295, 2079: 2.18898, 2112: 2.6, 2113: 2.38998, 2114: 2.93293, 2115: 2.89295, 2127: 3.05939, 2128: 3.16695, 2129: 2.68642, 2132: 3.24293, 2133: 3.88251, 2135: 3.49942, 2136: 3.14795, 2137: 3.05293, 2144: 2.13, 2178: 2.47998, 2179: 3.41295, 2180: 2.86293, 2193: 3.09295, 2194: 2.93291, 2195: 2.60642, 2197: 2.93646, 2198: 3.17293, 2201: 3.05095, 2202: 2.90983, 2203: 2.78549, 2210: 2.51649, 2245: 2.70002, 2246: 2.6426, 2260: 3.52939, 2261: 3.15293, 2262: 2.56998, 2263: 2.84002, 2264: 2.86646, 2268: 2.79293, 2269: 2.86393, 2270: 2.90649, 2277: 2.09, 2312: 2.98649, 2313: 2.34998, 2328: 3.13111, 2329: 3.05, 2330: 2.56998, 2331: 2.76002, 2336: 2.75452, 2337: 2.74449, 2338: 3.01293, 2345: 2.11898, 2380: 2.93649, 2381: 2.80646, 2397: 2.80646, 2398: 2.79002, 2399: 2.44998, 2405: 2.62945, 2406: 2.8587, 2414: 2.06, 2450: 2.78002, 2467: 2.73906, 2468: 2.40998, 2475: 2.73452, 2477: 3.02351, 2484: 2.45649, 2522: 4.04645, 2538: 3.33295, 2540: 3.64194, 2546: 2.55233, 2547: 2.88251, 2548: 2.95549, 2555: 2.42649, 2593: 4.13773, 2594: 3.62295, 2608: 4.23284, 2611: 4.24942, 2612: 3.48295, 2618: 2.60649, 2619: 2.94249, 2620: 2.42, 2627: 2.42649, 2665: 4.05498, 2666: 3.58295, 2667: 3.24649, 2680: 3.62295, 2681: 4.11717, 2683: 3.91042, 2684: 3.66195, 2685: 3.32293, 2691: 2.83549, 2692: 2.76651, 2693: 2.80649, 2700: 1.93642, 2739: 3.54295, 2740: 3.21649, 2741: 3.07004, 2753: 3.20291, 2754: 3.58295, 2757: 3.55295, 2758: 3.35593, 2759: 3.00644, 2765: 3.15651, 2766: 2.65549, 2767: 2.38, 2774: 1.91642, 2814: 3.15649, 2815: 3.03004, 2816: 2.69642, 2824: 3.14729, 2827: 2.95642, 2828: 3.15291, 2832: 3.33452, 2833: 3.36293, 2834: 3.28649, 2840: 2.54249, 2841: 2.65651, 2842: 2.41898, 2849: 1.80998, 2890: 2.98004, 2891: 2.66642, 2892: 2.62701, 2902: 2.72642, 2903: 3.08291, 2908: 3.25293, 2909: 3.20649, 2916: 2.52944, 2917: 2.67047, 2918: 2.36, 2925: 1.79998, 2967: 3.07646, 2968: 2.59701, 2975: 3.13629, 2978: 2.67642, 2979: 2.66642, 2985: 3.12749, 2986: 3.42712, 2993: 2.56159, 2994: 2.63651, 2995: 2.74649, 3045: 2.8535, 3047: 2.40998, 3055: 2.70642, 3056: 3.19293, 3063: 3.22493, 3065: 3.23649, 3071: 2.51049, 3072: 2.60649, 3073: 2.84851, 3080: 1.80998, 3125: 2.69451, 3126: 2.41998, 3133: 2.68642, 3134: 3.23293, 3142: 3.41233, 3143: 3.15649, 3144: 2.85898, 3150: 2.51649, 3151: 2.74551, 3152: 2.71649, 3159: 1.44998, 3204: 2.30998, 3205: 2.37998, 3206: 2.34998, 3212: 2.61642, 3213: 3.1552, 3222: 3.08749, 3223: 3.37949, 3224: 2.81, 3230: 2.50649, 3231: 2.57749, 3232: 2.24642, 3239: 1.41998, 3285: 2.7126, 3286: 2.26998, 3287: 2.45642, 3292: 2.47998, 3293: 2.52878, 3303: 3.32549, 3304: 3.13649, 3305: 3.19649, 3311: 2.48249, 3312: 2.37946, 3313: 2.16642, 3320: 1.86642, 3367: 2.80649, 3368: 3.2, 3369: 3.29295, 3373: 2.87649, 3374: 3.00649, 3385: 3.06349, 3386: 3.11649, 3387: 2.77, 3393: 3.18291, 3394: 2.74646, 3395: 2.10998, 3402: 2.35644, 3450: 2.37642, 3451: 3.26295, 3452: 2.66642, 3455: 3.16293, 3456: 3.01795, 3468: 3.04349, 3469: 2.823, 3470: 2.79898, 3476: 2.2539, 3477: 2.20102, 3478: 2.10998, 3485: 2.27644, 3534: 3.21295, 3535: 2.62642, 3536: 2.77642, 3538: 2.58998, 3539: 3.07293, 3552: 3.01945, 3553: 3.13547, 3554: 2.75, 3560: 2.03, 3561: 2.3426, 3569: 2.12642, 3619: 3.05329, 3620: 2.96646, 3621: 2.64998, 3622: 2.60998, 3623: 2.91646, 3637: 3.05159, 3638: 3.27651, 3639: 3.13649, 3645: 2.16002, 3646: 2.23, 3647: 2.10998, 3648: 2.36649, 3705: 3.2152, 3706: 3.05646, 3707: 3.10646, 3708: 2.54998, 3723: 2.99944, 3724: 3.05649, 3725: 3.13649, 3731: 2.07746, 3732: 2.27746, 3733: 2.41649, 3792: 2.96646, 3793: 2.57998, 3794: 3.03646, 3810: 2.98944, 3811: 3.03649, 3812: 3.11649, 3818: 2.15002, 3819: 2.40649, 3820: 2.3826, 3880: 2.90002, 3881: 2.58998, 3898: 2.98249, 3899: 3.03649, 3900: 2.63642, 3906: 2.54002, 3907: 2.34646, 3908: 2.17642, 3971: 4.15942, 3987: 2.96944, 3988: 2.64642, 3989: 2.62642, 3995: 2.34646, 3996: 2.86939, 3997: 2.59644, 4057: 4.28802, 4060: 4.21655, 4061: 3.69, 4077: 2.75646, 4078: 2.8439, 4079: 2.50998, 4085: 2.88293, 4086: 3.36945, 4087: 3.0967, 4147: 3.73295, 4148: 4.33462, 4150: 4.06942, 4151: 3.74295, 4152: 3.51293, 4168: 2.6739, 4169: 2.43998, 4170: 2.50998, 4176: 3.26942, 4177: 3.04096, 4178: 2.56329, 4185: 2.67649, 4238: 3.40649, 4239: 3.74295, 4242: 3.74295, 4243: 3.45293, 4244: 3.08644, 4260: 2.47, 4261: 2.61998, 4268: 2.92045, 4269: 2.6608, 4330: 3.17004, 4331: 3.37649, 4335: 3.43293, 4336: 3.04644, 4337: 3.35649, 4353: 3.44712, 4354: 2.56002, 4355: 2.50998, 4361: 2.55291, 4362: 2.64646, 4370: 2.27644, 4423: 2.85642, 4424: 3.19004, 4429: 3.40452, 4430: 3.32649, 4447: 2.54002, 4448: 2.42998, 4449: 2.23998, 4455: 2.83646, 4517: 2.79701, 4518: 3.1439, 4524: 3.27649, 4525: 3.42293, 4542: 2.56746, 4543: 2.76649, 4544: 2.18998, 4613: 2.74701, 4620: 3.37293, 4622: 3.30649, 4638: 2.75646, 4639: 2.8326, 4640: 2.57642, 4708: 2.58998, 4717: 3.18233, 4718: 3.27649, 4719: 2.93898, 4735: 2.88295, 4736: 3.42093, 4737: 3.01644, 4805: 2.59998, 4806: 2.52998, 4815: 3.26649, 4816: 2.89898, 4817: 3.18, 4833: 3.24939, 4834: 3.66442, 4835: 2.94644, 4842: 2.7326, 4843: 2.94649, 4903: 2.52998, 4904: 2.52998, 4914: 3.46549, 4915: 2.85, 4916: 3.26649, 4932: 3.72942, 4933: 3.40395, 4934: 2.78642, 4940: 2.58646, 4941: 2.77349, 5002: 2.66642, 5003: 2.96649, 5014: 3.19945, 5015: 3.23649, 5016: 3.14, 5032: 3.39295, 5033: 3.13291, 5040: 2.68945, 5041: 2.63383, 5042: 2.78649, 5102: 3.45295, 5103: 2.53642, 5115: 3.18649, 5116: 2.81, 5117: 2.87898, 5133: 3.04291, 5141: 2.54437, 5142: 2.94295, 5203: 2.84642, 5204: 3.46295, 5217: 3.16945, 5218: 2.84898, 5219: 3.18, 5243: 2.80293, 5244: 2.63646, 5305: 2.91642, 5306: 3.19291, 5320: 3.20159, 5321: 3.18649, 5322: 3.22649, 5346: 2.59233, 5347: 2.68329, 5408: 2.82998, 5409: 3.52293, 5424: 3.14945, 5425: 3.18649, 5426: 3.19649, 5450: 2.58233, 5451: 2.71649, 5512: 2.80998, 5513: 3.21646, 5529: 3.13945, 5530: 3.16649, 5531: 3.19649, 5555: 2.61945, 5556: 2.79291, 5618: 3.13702, 5635: 3.12945, 5636: 3.16649, 5637: 2.71642, 5655: 3.33649, 5661: 2.68291, 5662: 2.64329, 5724: 2.4, 5742: 3.11945, 5743: 2.67642, 5744: 2.70642, 5760: 3.08646, 5761: 3.24649, 5768: 2.54233, 5769: 2.63291, 5833: 4.4631, 5850: 2.62642, 5851: 2.66642, 5852: 2.58998, 5868: 3.15945, 5870: 2.94644, 5876: 2.53233, 5877: 2.70139, 5941: 4.40942, 5942: 3.94295, 5959: 2.60642, 5960: 2.55998, 5961: 2.61998, 5977: 3.01437, 5978: 3.25293, 6051: 3.99295, 6052: 3.65293, 6069: 2.49998, 6070: 2.54998, 6087: 3.24452, 6088: 3.2, 6162: 3.64293, 6163: 3.22644, 6180: 2.70002, 6182: 2.58998, 6198: 3.07233, 6199: 3.3, 6274: 3.62452, 6275: 3.50649, 6292: 2.72002, 6293: 2.55998, 6294: 2.30998, 6310: 3.05233, 6387: 3.49649, 6388: 3.60293, 6405: 2.49998, 6406: 2.23998, 6407: 2.26998, 6423: 3.08945, 6501: 3.59452, 6519: 2.94191, 6520: 2.22998, 6521: 2.65642, 6537: 3.18291, 6617: 3.46649, 6634: 2.77646, 6635: 2.82642, 6636: 3.09644, 6652: 3.02291, 6732: 3.44649, 6733: 3.08898, 6750: 3.09293, 6751: 3.00644, 6752: 3.02644, 6768: 3.01291, 6849: 3.69549, 6850: 3.24, 6867: 3.80942, 6868: 3.55295, 6869: 2.87642, 6967: 3.41945, 6968: 3.42649, 6985: 3.62451, 6986: 3.5, 7086: 3.40945, 7087: 3.22, 7104: 3.17993, 7206: 3.39945, 7207: 3.03898, 7327: 3.44159, 7328: 3.22, 7449: 3.38945, 7450: 3.37649, 7494: 3.08895, 7572: 3.37945, 7573: 3.36649, 7616: 2.99195, 7696: 3.37945, 7697: 3.35649, 7716: 3.40649, 7821: 3.36945, 7822: 2.87642, 7839: 3.22726, 7840: 3.36649, 7947: 2.83642, 7948: 2.85642, 7965: 3.31945, 7967: 3.02644, 8074: 2.81642, 8075: 2.75998, 8092: 3.18437, 8093: 3.00644, 8202: 2.70998, 8203: 2.74998, 8220: 3.39452, 8331: 2.65998, 8349: 3.21233, 8462: 2.75998, 8479: 3.19233, 8592: 2.70998, 8593: 2.49998, 8610: 3.22944, 8628: 3.48195, 8724: 2.41998, 8725: 2.45998, 8857: 3.21295, 8858: 2.76642, 8875: 3.15233, 8991: 3.33293, 8992: 3.23644, 9009: 3.14233, 9126: 3.94142, 9127: 3.14644, 9262: 3.69562, 9263: 3.02642, 9399: 3.38291, 10243: 3.54649, 10386: 3.56649, 10532: 3.16644, 10677: 3.62452, 10824: 3.44233, 10972: 3.43233, 12960: 3.1952 }, Rx = 2.001, $g = function() {
  for (var e = /* @__PURE__ */ new Set(), t = 0, n = ["LI", "NA", "K", "RB", "CS", "FR", "BE", "MG", "CA", "SR", "BA", "RA", "AL", "GA", "IN", "SN", "TL", "PB", "BI", "SC", "TI", "V", "CR", "MN", "FE", "CO", "NI", "CU", "ZN", "Y", "ZR", "NB", "MO", "TC", "RU", "RH", "PD", "AG", "CD", "LA", "HF", "TA", "W", "RE", "OS", "IR", "PT", "AU", "HG", "AC", "RF", "DB", "SG", "BH", "HS", "MT", "CE", "PR", "ND", "PM", "SM", "EU", "GD", "TB", "DY", "HO", "ER", "TM", "YB", "LU", "TH", "PA", "U", "NP", "PU", "AM", "CM", "BK", "CF", "ES", "FM", "MD", "NO", "LR"]; t < n.length; t++) {
    var r = n[t];
    e.add(A0[r]);
  }
  return e;
}();
function Bk(e, t) {
  return e < t ? (e + t) * (e + t + 1) / 2 + t : (e + t) * (e + t + 1) / 2 + e;
}
function zc(e) {
  var t = A0[e];
  return t === void 0 ? -1 : t;
}
function E1(e) {
  if (e < 0) return Rx;
  var t = SH[e];
  return t === void 0 ? Rx : t;
}
function v5(e, t, n, r, i) {
  var a = function(o, s, u) {
    if (o < 0 || s < 0) return -1;
    var l = (u ? Ok : Dk)[Bk(o, s)];
    return l === void 0 ? -1 : l;
  }(e, t, i);
  return a > 0 ? a : t < 0 ? n : (n + r) / 1.95;
}
var AH = A0.H;
function Uc(e) {
  return e === AH;
}
var wH = /* @__PURE__ */ new Map([["HIS|CD2|CG", 2], ["HIS|CE1|ND1", 2], ["ARG|CZ|NH2", 2], ["PHE|CE1|CZ", 2], ["PHE|CD2|CE2", 2], ["PHE|CD1|CG", 2], ["TRP|CD1|CG", 2], ["TRP|CD2|CE2", 2], ["TRP|CE3|CZ3", 2], ["TRP|CH2|CZ2", 2], ["ASN|CG|OD1", 2], ["GLN|CD|OE1", 2], ["TYR|CD1|CG", 2], ["TYR|CD2|CE2", 2], ["TYR|CE1|CZ", 2], ["ASP|CG|OD1", 2], ["GLU|CD|OE1", 2], ["G|C8|N7", 2], ["G|C4|C5", 2], ["G|C2|N3", 2], ["G|C6|O6", 2], ["C|C4|N3", 2], ["C|C5|C6", 2], ["C|C2|O2", 2], ["A|C2|N3", 2], ["A|C6|N1", 2], ["A|C4|C5", 2], ["A|C8|N7", 2], ["U|C5|C6", 2], ["U|C2|O2", 2], ["U|C4|O4", 2], ["DG|C8|N7", 2], ["DG|C4|C5", 2], ["DG|C2|N3", 2], ["DG|C6|O6", 2], ["DC|C4|N3", 2], ["DC|C5|C6", 2], ["DC|C2|O2", 2], ["DA|C2|N3", 2], ["DA|C6|N1", 2], ["DA|C4|C5", 2], ["DA|C8|N7", 2], ["DT|C5|C6", 2], ["DT|C2|O2", 2], ["DT|C4|O4", 2]]);
function IH(e, t, n) {
  var r;
  return t = (r = t < n ? [t, n] : [n, t])[0], n = r[1], ih.has(e) && t === "C" && n === "O" || G6.has(e) && t === "OP1" && n === "P" ? 2 : wH.get("".concat(e, "|").concat(t, "|").concat(n)) || 1;
}
var PH = /* @__PURE__ */ new Map([["LYS|NZ|RET|C15", 2]]);
function Rk(e, t, n, r) {
  var i, a;
  return e > n && (e = (i = [n, e])[0], n = i[1], t = (a = [r, t])[0], r = a[1]), PH.get("".concat(e, "|").concat(t, "|").concat(n, "|").concat(r)) || 1;
}
var md = Q.Schema, j = md.str, oe = md.int, zt = md.float, wy = md.coord, tt = md.Aliased, uc = md.Matrix, Wh = md.Vector, xd = md.List, Zt = { atom_site: { auth_asym_id: j, auth_atom_id: j, auth_comp_id: j, auth_seq_id: oe, B_iso_or_equiv: zt, Cartn_x: wy, Cartn_y: wy, Cartn_z: wy, group_PDB: tt(j), id: oe, label_alt_id: j, label_asym_id: j, label_atom_id: j, label_comp_id: j, label_entity_id: j, label_seq_id: oe, occupancy: zt, type_symbol: j, pdbx_PDB_ins_code: j, pdbx_PDB_model_num: oe, pdbx_formal_charge: oe, pdbx_label_index: oe, pdbx_sifts_xref_db_name: j, pdbx_sifts_xref_db_acc: j, pdbx_sifts_xref_db_num: j, pdbx_sifts_xref_db_res: j, ihm_model_id: oe, cdr: oe, em_confidence: j }, atom_site_anisotrop: { id: oe, type_symbol: j, U: uc(3, 3), U_esd: uc(3, 3), pdbx_auth_seq_id: j, pdbx_auth_asym_id: j, pdbx_auth_atom_id: j, pdbx_auth_comp_id: j, pdbx_label_seq_id: oe, pdbx_label_alt_id: j, pdbx_label_asym_id: j, pdbx_label_atom_id: j, pdbx_label_comp_id: j, pdbx_PDB_ins_code: j }, atom_sites: { entry_id: j, fract_transf_matrix: uc(3, 3), fract_transf_vector: Wh(3) }, audit_author: { name: j, pdbx_ordinal: oe, identifier_ORCID: j }, audit_conform: { dict_location: j, dict_name: j, dict_version: j }, cell: { angle_alpha: zt, angle_beta: zt, angle_gamma: zt, entry_id: j, length_a: zt, length_b: zt, length_c: zt, Z_PDB: oe, pdbx_unique_axis: j }, chem_comp: { formula: j, formula_weight: zt, id: j, mon_nstd_flag: tt(j), name: j, type: tt(j), pdbx_synonyms: xd(";", function(e) {
  return e;
}) }, chem_comp_bond: { atom_id_1: j, atom_id_2: j, comp_id: j, value_order: tt(j), pdbx_ordinal: oe, pdbx_stereo_config: tt(j), pdbx_aromatic_flag: tt(j) }, citation: { book_publisher: j, country: j, id: j, journal_abbrev: j, journal_id_ASTM: j, journal_id_CSD: j, journal_id_ISSN: j, journal_volume: j, page_first: j, page_last: j, title: j, year: oe, pdbx_database_id_DOI: j, pdbx_database_id_PubMed: oe }, citation_author: { citation_id: j, name: j, ordinal: oe }, database_2: { database_id: tt(j), database_code: j }, entity: { details: j, formula_weight: zt, id: j, src_method: tt(j), type: tt(j), pdbx_description: xd(",", function(e) {
  return e;
}), pdbx_number_of_molecules: oe, pdbx_mutation: j, pdbx_fragment: j, pdbx_ec: xd(",", function(e) {
  return e;
}) }, entity_poly: { entity_id: j, nstd_linkage: tt(j), nstd_monomer: tt(j), type: tt(j), pdbx_strand_id: xd(",", function(e) {
  return e;
}), pdbx_seq_one_letter_code: j, pdbx_seq_one_letter_code_can: j, pdbx_target_identifier: j }, entity_poly_seq: { entity_id: j, hetero: tt(j), mon_id: j, num: oe }, entry: { id: j }, exptl: { entry_id: j, method: tt(j) }, software: { classification: j, date: j, description: j, name: j, type: tt(j), version: j, pdbx_ordinal: oe }, struct: { entry_id: j, title: j, pdbx_descriptor: j }, struct_asym: { details: j, entity_id: j, id: j, pdbx_modified: j, pdbx_blank_PDB_chainid_flag: tt(j) }, struct_conf: { beg_label_asym_id: j, beg_label_comp_id: j, beg_label_seq_id: oe, beg_auth_asym_id: j, beg_auth_comp_id: j, beg_auth_seq_id: oe, conf_type_id: tt(j), details: j, end_label_asym_id: j, end_label_comp_id: j, end_label_seq_id: oe, end_auth_asym_id: j, end_auth_comp_id: j, end_auth_seq_id: oe, id: j, pdbx_beg_PDB_ins_code: j, pdbx_end_PDB_ins_code: j, pdbx_PDB_helix_class: j, pdbx_PDB_helix_length: oe, pdbx_PDB_helix_id: j }, struct_conn: { conn_type_id: tt(j), details: j, id: j, ptnr1_label_asym_id: j, ptnr1_label_atom_id: j, ptnr1_label_comp_id: j, ptnr1_label_seq_id: oe, ptnr1_auth_asym_id: j, ptnr1_auth_comp_id: j, ptnr1_auth_seq_id: oe, ptnr1_symmetry: j, ptnr2_label_asym_id: j, ptnr2_label_atom_id: j, ptnr2_label_comp_id: j, ptnr2_label_seq_id: oe, ptnr2_auth_asym_id: j, ptnr2_auth_comp_id: j, ptnr2_auth_seq_id: oe, ptnr2_symmetry: j, pdbx_ptnr1_PDB_ins_code: j, pdbx_ptnr1_label_alt_id: j, pdbx_ptnr1_standard_comp_id: j, pdbx_ptnr2_PDB_ins_code: j, pdbx_ptnr2_label_alt_id: j, pdbx_ptnr3_PDB_ins_code: j, pdbx_ptnr3_label_alt_id: j, pdbx_ptnr3_label_asym_id: j, pdbx_ptnr3_label_atom_id: j, pdbx_ptnr3_label_comp_id: j, pdbx_ptnr3_label_seq_id: oe, pdbx_PDB_id: j, pdbx_dist_value: zt, pdbx_value_order: tt(j) }, struct_conn_type: { criteria: j, id: tt(j), reference: j }, struct_keywords: { entry_id: j, text: xd(",", function(e) {
  return e;
}), pdbx_keywords: j }, struct_ncs_oper: { code: tt(j), details: j, id: oe, matrix: uc(3, 3), vector: Wh(3) }, struct_sheet_range: { beg_label_asym_id: j, beg_label_comp_id: j, beg_label_seq_id: oe, end_label_asym_id: j, end_label_comp_id: j, end_label_seq_id: oe, beg_auth_asym_id: j, beg_auth_comp_id: j, beg_auth_seq_id: oe, end_auth_asym_id: j, end_auth_comp_id: j, end_auth_seq_id: oe, id: j, sheet_id: j, pdbx_beg_PDB_ins_code: j, pdbx_end_PDB_ins_code: j }, struct_site: { details: j, id: j, pdbx_num_residues: oe, pdbx_evidence_code: j, pdbx_auth_asym_id: j, pdbx_auth_comp_id: j, pdbx_auth_seq_id: j, pdbx_auth_ins_code: j }, struct_site_gen: { details: j, id: j, label_alt_id: j, label_asym_id: j, label_atom_id: j, label_comp_id: j, label_seq_id: oe, auth_asym_id: j, auth_comp_id: j, auth_seq_id: j, site_id: j, symmetry: j, pdbx_auth_ins_code: j, pdbx_num_res: oe }, symmetry: { entry_id: j, cell_setting: tt(j), Int_Tables_number: oe, space_group_name_Hall: j, "space_group_name_H-M": j }, pdbx_database_status: { status_code: tt(j), status_code_sf: tt(j), status_code_mr: tt(j), entry_id: j, recvd_initial_deposition_date: j, SG_entry: tt(j), deposit_site: tt(j), process_site: tt(j), status_code_cs: tt(j), methods_development_category: tt(j), pdb_format_compatible: tt(j) }, pdbx_nonpoly_scheme: { asym_id: j, entity_id: j, mon_id: j, pdb_strand_id: j, ndb_seq_num: j, pdb_seq_num: j, auth_seq_num: j, pdb_mon_id: j, auth_mon_id: j, pdb_ins_code: j }, pdbx_database_related: { db_name: j, details: j, db_id: j, content_type: tt(j) }, pdbx_entity_nonpoly: { entity_id: j, comp_id: j, name: j }, pdbx_chem_comp_synonyms: { name: j, comp_id: j, provenance: tt(j) }, pdbx_chem_comp_identifier: { comp_id: j, identifier: j, type: tt(j), program: j, program_version: j }, pdbx_unobs_or_zero_occ_residues: { id: oe, polymer_flag: tt(j), occupancy_flag: tt(oe), PDB_model_num: oe, auth_asym_id: j, auth_comp_id: j, auth_seq_id: j, PDB_ins_code: j, label_asym_id: j, label_comp_id: j, label_seq_id: oe }, pdbx_struct_mod_residue: { id: oe, auth_asym_id: j, auth_comp_id: j, auth_seq_id: oe, PDB_ins_code: j, label_asym_id: j, label_comp_id: j, label_seq_id: oe, parent_comp_id: j, details: j }, pdbx_struct_oper_list: { id: j, type: tt(j), name: j, symmetry_operation: j, matrix: uc(3, 3), vector: Wh(3) }, pdbx_struct_assembly: { method_details: j, oligomeric_details: j, oligomeric_count: oe, details: j, id: j }, pdbx_struct_assembly_gen: { asym_id_list: xd(",", function(e) {
  return e;
}), assembly_id: j, oper_expression: j }, pdbx_reference_entity_list: { prd_id: j, ref_entity_id: j, type: tt(j), details: j, component_id: oe }, pdbx_reference_entity_link: { link_id: oe, prd_id: j, details: j, ref_entity_id_1: j, ref_entity_id_2: j, entity_seq_num_1: oe, entity_seq_num_2: oe, comp_id_1: j, comp_id_2: j, atom_id_1: j, atom_id_2: j, value_order: tt(j), component_1: oe, component_2: oe, link_class: tt(j) }, pdbx_reference_entity_poly_link: { link_id: oe, prd_id: j, ref_entity_id: j, component_id: oe, entity_seq_num_1: oe, entity_seq_num_2: oe, comp_id_1: j, comp_id_2: j, atom_id_1: j, atom_id_2: j, value_order: tt(j) }, pdbx_molecule: { prd_id: j, instance_id: oe, asym_id: j }, pdbx_molecule_features: { prd_id: j, class: tt(j), type: tt(j), name: j, details: j }, entity_src_nat: { entity_id: j, pdbx_organism_scientific: j, pdbx_plasmid_name: j, pdbx_src_id: oe, pdbx_beg_seq_num: oe, pdbx_end_seq_num: oe }, entity_src_gen: { entity_id: j, pdbx_gene_src_gene: xd(",", function(e) {
  return e;
}), pdbx_gene_src_scientific_name: j, plasmid_name: j, pdbx_src_id: oe, pdbx_beg_seq_num: oe, pdbx_end_seq_num: oe }, pdbx_entity_src_syn: { organism_scientific: j, entity_id: j, pdbx_src_id: oe, pdbx_beg_seq_num: oe, pdbx_end_seq_num: oe }, pdbx_entity_branch_descriptor: { entity_id: j, descriptor: j, type: tt(j), program: j, program_version: j, ordinal: oe }, pdbx_entity_instance_feature: { details: j, feature_type: tt(j), auth_asym_id: j, asym_id: j, auth_seq_num: j, seq_num: oe, comp_id: j, auth_comp_id: j, ordinal: oe }, pdbx_entity_branch_list: { entity_id: j, hetero: tt(j), comp_id: j, num: oe }, pdbx_entity_branch_link: { link_id: oe, details: j, entity_id: j, entity_branch_list_num_1: oe, entity_branch_list_num_2: oe, comp_id_1: j, comp_id_2: j, atom_id_1: j, leaving_atom_id_1: j, atom_stereo_config_1: tt(j), atom_id_2: j, leaving_atom_id_2: j, atom_stereo_config_2: tt(j), value_order: tt(j) }, pdbx_entity_branch: { entity_id: j, type: tt(j) }, pdbx_branch_scheme: { entity_id: j, hetero: tt(j), asym_id: j, mon_id: j, num: oe, pdb_asym_id: j, pdb_seq_num: j, pdb_mon_id: j, auth_asym_id: j, auth_seq_num: j, auth_mon_id: j }, pdbx_chem_comp_related: { comp_id: j, related_comp_id: j, relationship_type: tt(j), details: j }, ihm_starting_model_details: { starting_model_id: j, entity_id: j, entity_description: j, asym_id: j, entity_poly_segment_id: oe, starting_model_source: tt(j), starting_model_auth_asym_id: j, starting_model_sequence_offset: oe, dataset_list_id: oe }, ihm_starting_comparative_models: { id: oe, starting_model_id: j, starting_model_auth_asym_id: j, starting_model_seq_id_begin: oe, starting_model_seq_id_end: oe, template_auth_asym_id: j, template_seq_id_begin: oe, template_seq_id_end: oe, template_sequence_identity: zt, template_sequence_identity_denominator: tt(oe), template_dataset_list_id: oe, alignment_file_id: oe }, ihm_starting_model_seq_dif: { id: oe, entity_id: j, asym_id: j, seq_id: oe, comp_id: j, starting_model_id: j, db_asym_id: j, db_seq_id: oe, db_comp_id: j, details: j }, ihm_model_representation: { id: oe, name: j, details: j }, ihm_model_representation_details: { id: oe, representation_id: oe, entity_poly_segment_id: oe, entity_id: j, entity_description: j, entity_asym_id: j, model_object_primitive: tt(j), starting_model_id: j, model_mode: tt(j), model_granularity: tt(j), model_object_count: oe }, ihm_struct_assembly_details: { id: oe, assembly_id: oe, parent_assembly_id: oe, entity_description: j, entity_id: j, asym_id: j, entity_poly_segment_id: oe }, ihm_struct_assembly: { id: oe, name: j, description: j }, ihm_modeling_protocol: { id: oe, num_steps: oe, protocol_name: j }, ihm_modeling_protocol_details: { id: oe, protocol_id: oe, step_id: oe, struct_assembly_id: oe, dataset_group_id: oe, struct_assembly_description: j, step_name: j, step_method: j, num_models_begin: oe, num_models_end: oe, multi_scale_flag: tt(j), multi_state_flag: tt(j), ordered_flag: tt(j), script_file_id: oe, software_id: oe }, ihm_multi_state_modeling: { state_id: oe, state_group_id: oe, population_fraction: zt, population_fraction_sd: zt, state_type: j, state_name: j, experiment_type: tt(j), details: j }, ihm_modeling_post_process: { id: oe, protocol_id: oe, analysis_id: oe, step_id: oe, type: tt(j), feature: tt(j), num_models_begin: oe, num_models_end: oe }, ihm_ensemble_info: { ensemble_id: oe, ensemble_name: j, post_process_id: oe, model_group_id: oe, ensemble_clustering_method: tt(j), ensemble_clustering_feature: tt(j), num_ensemble_models: oe, num_ensemble_models_deposited: oe, ensemble_precision_value: zt, ensemble_file_id: oe }, ihm_model_list: { model_id: oe, model_name: j, assembly_id: oe, protocol_id: oe, representation_id: oe }, ihm_model_group: { id: oe, name: j, details: j }, ihm_model_group_link: { model_id: oe, group_id: oe }, ihm_model_representative: { id: oe, model_group_id: oe, model_id: oe, selection_criteria: tt(j) }, ihm_dataset_list: { id: oe, data_type: tt(j), database_hosted: tt(j) }, ihm_dataset_group: { id: oe, name: j, application: tt(j), details: j }, ihm_dataset_group_link: { dataset_list_id: oe, group_id: oe }, ihm_related_datasets: { dataset_list_id_derived: oe, dataset_list_id_primary: oe }, ihm_dataset_related_db_reference: { id: oe, dataset_list_id: oe, db_name: tt(j), accession_code: j, version: j, details: j }, ihm_external_reference_info: { reference_id: oe, reference_provider: j, reference_type: tt(j), reference: j, refers_to: tt(j), associated_url: j }, ihm_external_files: { id: oe, reference_id: oe, file_path: j, content_type: tt(j), file_size_bytes: zt, details: j }, ihm_dataset_external_reference: { id: oe, dataset_list_id: oe, file_id: oe }, ihm_localization_density_files: { id: oe, file_id: oe, ensemble_id: oe, entity_id: j, entity_poly_segment_id: oe, asym_id: j }, ihm_predicted_contact_restraint: { id: oe, group_id: oe, entity_id_1: j, entity_id_2: j, asym_id_1: j, asym_id_2: j, comp_id_1: j, comp_id_2: j, seq_id_1: oe, seq_id_2: oe, rep_atom_1: tt(j), rep_atom_2: tt(j), distance_lower_limit: zt, distance_upper_limit: zt, probability: zt, restraint_type: tt(j), model_granularity: tt(j), dataset_list_id: oe, software_id: oe }, ihm_cross_link_list: { id: oe, group_id: oe, entity_description_1: j, entity_description_2: j, entity_id_1: j, entity_id_2: j, comp_id_1: j, comp_id_2: j, seq_id_1: oe, seq_id_2: oe, linker_type: tt(j), dataset_list_id: oe }, ihm_cross_link_restraint: { id: oe, group_id: oe, entity_id_1: j, entity_id_2: j, asym_id_1: j, asym_id_2: j, comp_id_1: j, comp_id_2: j, seq_id_1: oe, seq_id_2: oe, atom_id_1: j, atom_id_2: j, restraint_type: tt(j), conditional_crosslink_flag: tt(j), model_granularity: tt(j), distance_threshold: zt, psi: zt, sigma_1: zt, sigma_2: zt }, ihm_cross_link_result_parameters: { id: oe, restraint_id: oe, model_id: oe, psi: zt, sigma_1: zt, sigma_2: zt }, ihm_2dem_class_average_restraint: { id: oe, dataset_list_id: oe, number_raw_micrographs: oe, pixel_size_width: zt, pixel_size_height: zt, image_resolution: zt, image_segment_flag: tt(j), number_of_projections: oe, struct_assembly_id: oe, details: j }, ihm_2dem_class_average_fitting: { id: oe, restraint_id: oe, model_id: oe, cross_correlation_coefficient: zt, rot_matrix: uc(3, 3), tr_vector: Wh(3) }, ihm_3dem_restraint: { id: oe, dataset_list_id: oe, model_id: oe, struct_assembly_id: oe, fitting_method: j, number_of_gaussians: oe, cross_correlation_coefficient: zt }, ihm_sas_restraint: { id: oe, dataset_list_id: oe, model_id: oe, struct_assembly_id: oe, profile_segment_flag: tt(j), fitting_atom_type: j, fitting_method: j, fitting_state: tt(j), radius_of_gyration: zt, chi_value: zt, details: j }, ihm_starting_model_coord: { ordinal_id: oe, starting_model_id: j, group_PDB: tt(j), id: oe, type_symbol: j, entity_id: j, atom_id: j, comp_id: j, seq_id: oe, asym_id: j, Cartn_x: zt, Cartn_y: zt, Cartn_z: zt, B_iso_or_equiv: zt }, ihm_sphere_obj_site: { id: oe, entity_id: j, seq_id_begin: oe, seq_id_end: oe, asym_id: j, Cartn_x: zt, Cartn_y: zt, Cartn_z: zt, object_radius: zt, rmsf: zt, model_id: oe }, ihm_gaussian_obj_site: { id: oe, entity_id: j, seq_id_begin: oe, seq_id_end: oe, asym_id: j, mean_Cartn_x: zt, mean_Cartn_y: zt, mean_Cartn_z: zt, weight: zt, covariance_matrix: uc(3, 3), model_id: oe }, ihm_gaussian_obj_ensemble: { id: oe, entity_id: j, seq_id_begin: oe, seq_id_end: oe, asym_id: j, mean_Cartn_x: zt, mean_Cartn_y: zt, mean_Cartn_z: zt, weight: zt, covariance_matrix: uc(3, 3), ensemble_id: oe }, ihm_feature_list: { feature_id: oe, feature_type: tt(j), entity_type: tt(j) }, ihm_poly_residue_feature: { ordinal_id: oe, feature_id: oe, entity_id: j, asym_id: j, comp_id_begin: j, comp_id_end: j, seq_id_begin: oe, seq_id_end: oe }, ihm_derived_distance_restraint: { id: oe, group_id: oe, feature_id_1: oe, feature_id_2: oe, group_conditionality: tt(j), random_exclusion_fraction: zt, distance_upper_limit: zt, restraint_type: tt(j), dataset_list_id: oe }, ma_model_list: { ordinal_id: oe, model_id: oe, model_group_id: oe, model_name: j, model_group_name: j, model_type: tt(j), data_id: oe }, ma_target_entity: { entity_id: j, data_id: oe, origin: tt(j) }, ma_target_entity_instance: { asym_id: j, entity_id: j, details: j }, ma_target_ref_db_details: { target_entity_id: j, db_name: tt(j), db_code: j, db_accession: j, seq_db_isoform: j, seq_db_align_begin: j, seq_db_align_end: j, ncbi_taxonomy_id: j, organism_scientific: j }, ma_data: { id: oe, content_type: tt(j), content_type_other_details: j, name: j }, ma_software_group: { ordinal_id: oe, group_id: oe, software_id: oe }, ma_qa_metric: { id: oe, name: j, type: tt(j), mode: tt(j), software_group_id: oe }, ma_qa_metric_global: { ordinal_id: oe, model_id: oe, metric_id: oe, metric_value: zt }, ma_qa_metric_local: { ordinal_id: oe, model_id: oe, label_asym_id: j, label_seq_id: oe, label_comp_id: j, metric_id: oe, metric_value: zt } }, MH = new Uint16Array(new Uint8Array([18, 52]).buffer)[0] === 13330;
function ev(e) {
  for (var t = e.data, n = e.encoding.length - 1; n >= 0; n--) t = EH(t, e.encoding[n]);
  return t;
}
function EH(e, t) {
  switch (t.kind) {
    case "ByteArray":
      switch (t.type) {
        case 4:
          return e;
        case 1:
          return function(n) {
            return new Int8Array(n.buffer, n.byteOffset);
          }(e);
        case 2:
          return function(n) {
            return Wf(n, 2, Int16Array);
          }(e);
        case 5:
          return function(n) {
            return Wf(n, 2, Uint16Array);
          }(e);
        case 3:
          return function(n) {
            return Wf(n, 4, Int32Array);
          }(e);
        case 6:
          return function(n) {
            return Wf(n, 4, Uint32Array);
          }(e);
        case 32:
          return function(n) {
            return Wf(n, 4, Float32Array);
          }(e);
        case 33:
          return function(n) {
            return Wf(n, 8, Float64Array);
          }(e);
        default:
          Mi(t.type);
      }
    case "FixedPoint":
      return function(n, r) {
        for (var i = n.length, a = Nx(r.srcType, i), o = 1 / r.factor, s = 0; s < i; s++) a[s] = o * n[s];
        return a;
      }(e, t);
    case "IntervalQuantization":
      return function(n, r) {
        for (var i = n.length, a = Nx(r.srcType, i), o = (r.max - r.min) / (r.numSteps - 1), s = r.min, u = 0; u < i; u++) a[u] = s + o * n[u];
        return a;
      }(e, t);
    case "RunLength":
      return function(n, r) {
        for (var i = Lx(r.srcType, r.srcSize), a = 0, o = 0, s = n.length; o < s; o += 2) for (var u = n[o], l = n[o + 1], c = 0; c < l; ++c) i[a++] = u;
        return i;
      }(e, t);
    case "Delta":
      return function(n, r) {
        var i = n.length, a = Lx(r.srcType, i);
        if (!i) return n;
        a[0] = n[0] + (0 | r.origin);
        for (var o = 1; o < i; ++o) a[o] = n[o] + a[o - 1];
        return a;
      }(e, t);
    case "IntegerPacking":
      return function(n, r) {
        return n.length === r.srcSize ? n : r.isUnsigned ? function(i, a) {
          for (var o = a.byteCount === 1 ? 255 : 65535, s = i.length, u = new Int32Array(a.srcSize), l = 0, c = 0; l < s; ) {
            for (var d = 0, f = i[l]; f === o; ) d += f, f = i[++l];
            d += f, u[c] = d, l++, c++;
          }
          return u;
        }(n, r) : function(i, a) {
          for (var o = a.byteCount === 1 ? 127 : 32767, s = -o - 1, u = i.length, l = new Int32Array(a.srcSize), c = 0, d = 0; c < u; ) {
            for (var f = 0, p = i[c]; p === o || p === s; ) f += p, p = i[++c];
            f += p, l[d] = f, c++, d++;
          }
          return l;
        }(n, r);
      }(e, t);
    case "StringArray":
      return function(n, r) {
        var i = ev({ encoding: r.offsetEncoding, data: r.offsets }), a = ev({ encoding: r.dataEncoding, data: n }), o = r.stringData, s = new Array(i.length);
        s[0] = "";
        for (var u = 1, l = i.length; u < l; u++) s[u] = o.substring(i[u - 1], i[u]);
        var c = 0, d = new Array(a.length);
        for (u = 0, l = a.length; u < l; u++) d[c++] = s[a[u] + 1];
        return d;
      }(e, t);
  }
}
function Lx(e, t) {
  switch (e) {
    case 1:
      return new Int8Array(t);
    case 2:
      return new Int16Array(t);
    case 3:
      return new Int32Array(t);
    case 4:
      return new Uint8Array(t);
    case 5:
      return new Uint16Array(t);
    case 6:
      return new Uint32Array(t);
    default:
      Mi();
  }
}
function Nx(e, t) {
  switch (e) {
    case 32:
      return new Float32Array(t);
    case 33:
      return new Float64Array(t);
    default:
      Mi();
  }
}
function Wf(e, t, n) {
  return new n(MH ? e.buffer : function(r, i) {
    for (var a = new ArrayBuffer(r.length), o = new Uint8Array(a), s = 0, u = r.length; s < u; s += i) for (var l = 0; l < i; l++) o[s + i - l - 1] = r[s + l];
    return a;
  }(e, t));
}
var Mc, Bp, y5;
function TH(e, t, n) {
  var r, i = 1;
  for (r = 0; r < t; r++) {
    var a = i * e;
    if (Math.abs(Math.round(a) - a) <= n) return r;
    i *= 10;
  }
  return -1;
}
function Fx(e, t) {
  return parseFloat(e.toPrecision(t));
}
function b5(e) {
  return Bp.classify(e);
}
(function(e) {
  e.getDataType = function(t) {
    return t instanceof Int8Array ? 1 : t instanceof Int16Array ? 2 : t instanceof Int32Array ? 3 : t instanceof Uint8Array ? 4 : t instanceof Uint16Array ? 5 : t instanceof Uint32Array ? 6 : t instanceof Float32Array ? 32 : t instanceof Float64Array ? 33 : 3;
  }, e.isSignedIntegerDataType = function(t) {
    if (t instanceof Int8Array || t instanceof Int16Array || t instanceof Int32Array) return !0;
    for (var n = 0, r = t.length; n < r; n++) if (n < 0) return !1;
    return !0;
  };
})(Mc || (Mc = {})), function(e) {
  function t(c, d) {
    return c >= 0 ? Math.ceil((c + 1) / d) : Math.ceil((c + 1) / (-d - 1));
  }
  function n(c, d, f) {
    var p = c.limit8, g = c.limit16;
    d.pack8 += t(f, p), d.pack16 += t(f, g), d.count += 1;
  }
  function r(c, d) {
    c.pack8 += t(d, 127), c.pack16 += t(d, 32767), c.count += 1;
  }
  function i(c) {
    return 4 * c.count < 2 * c.pack16 ? { length: 4 * c.count, elem: 4 } : 2 * c.pack16 < c.pack8 ? { length: 2 * c.pack16, elem: 2 } : { length: c.pack8, elem: 1 };
  }
  function a(c, d) {
    for (var f = { pack8: 0, pack16: 0, count: 0 }, p = 0, g = c.length; p < g; p++) n(d, f, c[p]);
    return O(O({}, i(f)), { kind: "pack" });
  }
  function o(c, d) {
    for (var f = { pack8: 0, pack16: 0, count: 0 }, p = c[0], g = 1, m = c.length; g < m; g++) r(f, c[g] - p), p = c[g];
    return O(O({}, i(f)), { kind: "delta" });
  }
  function s(c, d) {
    for (var f = { pack8: 0, pack16: 0, count: 0 }, p = 1, g = 1, m = c.length; g < m; g++) c[g - 1] !== c[g] ? (n(d, f, c[g - 1]), n(d, f, p), p = 1) : p++;
    return n(d, f, c[c.length - 1]), n(d, f, p), O(O({}, i(f)), { kind: "rle" });
  }
  function u(c, d) {
    for (var f = { pack8: 0, pack16: 0, count: 0 }, p = 1, g = 0, m = 0, v = 1, h = c.length; v < h; v++) {
      var y = c[v] - g;
      m !== y ? (r(f, m), r(f, p), p = 1) : p++, m = y, g = c[v];
    }
    return r(f, m), r(f, p), O(O({}, i(f)), { kind: "delta-rle" });
  }
  function l(c) {
    var d = function(p) {
      for (var g = !1, m = 0, v = p.length; m < v; m++) if (p[m] < 0) {
        g = !0;
        break;
      }
      return g ? { signed: g, limit8: 127, limit16: 32767 } : { signed: g, limit8: 255, limit16: 65535 };
    }(c), f = [a(c, d), s(c, d), o(c), u(c)];
    return f.sort(function(p, g) {
      return p.length - g.length;
    }), f;
  }
  e.getSize = l, e.classify = function(c) {
    if (c.length < 2) return an.by(an.byteArray);
    switch (l(c)[0].kind) {
      case "pack":
        return an.by(an.integerPacking);
      case "rle":
        return an.by(an.runLength).and(an.integerPacking);
      case "delta":
        return an.by(an.delta).and(an.integerPacking);
      case "delta-rle":
        return an.by(an.delta).and(an.runLength).and(an.integerPacking);
      default:
        Mi();
    }
  };
}(Bp || (Bp = {})), function(e) {
  e.classify = function(t) {
    var n = function(d, f, p) {
      for (var g = 1, m = 0, v = 0, h = d.length; v < h; v++) {
        if (g >= 0) {
          var y = TH(d[v], f, p);
          y < 0 ? g = -1 : y > g && (g = y);
        }
        var x = Math.abs(d[v]);
        if (x > p) {
          var S = Math.floor(Math.log10(Math.abs(x))) + 1;
          S > m && (m = S);
        }
      }
      return { mantissaDigits: g, integerDigits: m };
    }(t, 4, 1e-6), r = n.mantissaDigits, i = n.integerDigits;
    if (r < 0 || r + i > 10) return an.by(an.byteArray);
    if (r === 0) return Bp.classify(t);
    for (var a = function(d) {
      for (var f = 1, p = 0; p < d; p++) f *= 10;
      return f;
    }(r), o = new Int32Array(t.length), s = 0, u = t.length; s < u; s++) o[s] = Math.round(a * t[s]);
    var l = Bp.getSize(o)[0], c = an.by(an.fixedPoint(a));
    switch (l.kind) {
      case "pack":
        return c.and(an.integerPacking);
      case "rle":
        return c.and(an.runLength).and(an.integerPacking);
      case "delta":
        return c.and(an.delta).and(an.integerPacking);
      case "delta-rle":
        return c.and(an.delta).and(an.runLength).and(an.integerPacking);
      default:
        Mi();
    }
  };
}(y5 || (y5 = {}));
var Hc, an, _5, ho, x5, Vx = function() {
  function e(t) {
    this.providers = t;
  }
  return e.prototype.and = function(t) {
    return new e(this.providers.concat([t]));
  }, e.prototype.encode = function(t) {
    for (var n = [], r = 0, i = this.providers; r < i.length; r++) {
      var a = (0, i[r])(t);
      if (!a.encodings.length) throw new Error("Encodings must be non-empty.");
      t = a.data;
      for (var o = 0, s = a.encodings; o < s.length; o++) {
        var u = s[o];
        n.push(u);
      }
    }
    if (!(t instanceof Uint8Array)) throw new Error("The encoding must result in a Uint8Array. Fix your encoding chain.");
    return { encoding: n, data: t };
  }, e;
}();
function Iy(e) {
  return function(t, n) {
    return n[e].value(t);
  };
}
function kH(e) {
  return function(t, n) {
    return n[e].value(t).join(n[e].schema.separator);
  };
}
function Py(e) {
  for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
  return function(r, i) {
    var a;
    return (a = i[e].schema.space).get.apply(a, Re([i[e].value(r)], t, !1));
  };
}
function Rp(e) {
  return function(t, n) {
    return n[e].valueKind(t);
  };
}
function DH(e, t) {
  var n = [], r = Rp(e);
  if (t.rank === 1) for (var i = t.dimensions[0], a = 0; a < i; a++) {
    var o = "".concat(e, "[").concat(a + 1, "]");
    n.push({ name: o, type: 2, value: Py(e, a), valueKind: r });
  }
  else if (t.rank === 2) {
    i = t.dimensions[0];
    var s = t.dimensions[1];
    for (a = 0; a < i; a++) for (var u = 0; u < s; u++) {
      var l = "".concat(e, "[").concat(a + 1, "][").concat(u + 1, "]");
      n.push({ name: l, type: 2, value: Py(e, a, u), valueKind: r });
    }
  } else {
    if (t.rank !== 3) throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.");
    var c = t.dimensions[0], d = t.dimensions[1], f = t.dimensions[2];
    for (a = 0; a < c; a++) for (u = 0; u < d; u++) for (var p = 0; p < f; p++) {
      var g = "".concat(e, "[").concat(a + 1, "][").concat(u + 1, "][").concat(p + 1, "]");
      n.push({ name: g, type: 2, value: Py(e, a, u, p), valueKind: r });
    }
  }
  return n;
}
function Gx(e) {
  for (var t = [], n = 0, r = Object.keys(e); n < r.length; n++) {
    var i = r[n], a = e[i];
    a.valueType === "int" ? t.push({ name: i, type: 1, value: Iy(i), valueKind: Rp(i) }) : a.valueType === "float" ? t.push({ name: i, type: 2, value: Iy(i), valueKind: Rp(i) }) : a.valueType === "str" ? t.push({ name: i, type: 0, value: Iy(i), valueKind: Rp(i) }) : a.valueType === "list" ? t.push({ name: i, type: 0, value: kH(i), valueKind: Rp(i) }) : a.valueType === "tensor" ? t.push.apply(t, DH(i, a.space)) : Mi(a.valueType);
  }
  return t;
}
function C5(e) {
  return e.fields.some(function(t) {
    return !!t.shouldInclude;
  }) ? e.fields.filter(function(t) {
    return !t.shouldInclude || e.source.some(function(n) {
      return t.shouldInclude(n.data);
    });
  }) : e.fields;
}
function Lk(e, t) {
  var n = e.instance(t), r = n.source.filter(function(o) {
    return o.rowCount > 0;
  });
  if (!r.length) return { instance: n, rowCount: 0, source: [] };
  var i = r.reduce(function(o, s) {
    return o + s.rowCount;
  }, 0), a = r.map(function(o) {
    return { data: o.data, keys: function() {
      return o.keys ? o.keys() : jg.Range(0, o.rowCount - 1);
    }, rowCount: o.rowCount };
  });
  return { instance: n, rowCount: i, source: a };
}
(function(e) {
  function t(r) {
    return new Vx([r]);
  }
  function n(r) {
    switch (r.kind) {
      case "ByteArray":
        return an.byteArray;
      case "FixedPoint":
        return an.fixedPoint(r.factor);
      case "IntervalQuantization":
        return an.intervalQuantizaiton(r.min, r.max, r.numSteps);
      case "RunLength":
        return an.runLength;
      case "Delta":
        return an.delta;
      case "IntegerPacking":
        return an.integerPacking;
      case "StringArray":
        return an.stringArray;
    }
  }
  e.by = t, e.fromEncoding = function(r) {
    for (var i = t(n(r[0])), a = 1; a < r.length; a++) i = i.and(n(r[a]));
    return i;
  };
})(Hc || (Hc = {})), function(e) {
  var t, n;
  e.by = function(s) {
    return new Vx([s]);
  };
  var r = ((t = {})[2] = function(s, u, l) {
    s.setInt16(2 * u, l, !0);
  }, t[5] = function(s, u, l) {
    s.setUint16(2 * u, l, !0);
  }, t[3] = function(s, u, l) {
    s.setInt32(4 * u, l, !0);
  }, t[6] = function(s, u, l) {
    s.setUint32(4 * u, l, !0);
  }, t[32] = function(s, u, l) {
    s.setFloat32(4 * u, l, !0);
  }, t[33] = function(s, u, l) {
    s.setFloat64(8 * u, l, !0);
  }, t), i = ((n = {})[2] = 2, n[5] = 2, n[3] = 4, n[6] = 4, n[32] = 4, n[33] = 8, n);
  function a(s) {
    var u = Mc.getDataType(s);
    if (u === 1) return function(g) {
      return { encodings: [{ kind: "ByteArray", type: 1 }], data: new Uint8Array(g.buffer, g.byteOffset) };
    }(s);
    if (u === 4) return /* @__PURE__ */ function(g) {
      return { encodings: [{ kind: "ByteArray", type: 4 }], data: g };
    }(s);
    for (var l = new Uint8Array(s.length * i[u]), c = r[u], d = new DataView(l.buffer), f = 0, p = s.length; f < p; f++) c(d, f, s[f]);
    return { encodings: [{ kind: "ByteArray", type: u }], data: l };
  }
  function o(s, u) {
    for (var l = -u - 1, c = 0, d = 0, f = s.length; d < f; d++) {
      var p = s[d];
      p === 0 ? c += 1 : p > 0 ? (c += Math.ceil(p / u), p % u == 0 && (c += 1)) : (c += Math.ceil(p / l), p % l == 0 && (c += 1));
    }
    return c;
  }
  e.byteArray = a, e.fixedPoint = function(s) {
    return function(u) {
      return function(l, c) {
        for (var d = Mc.getDataType(l), f = new Int32Array(l.length), p = 0, g = l.length; p < g; p++) f[p] = Math.round(l[p] * c);
        return { encodings: [{ kind: "FixedPoint", factor: c, srcType: d }], data: f };
      }(u, s);
    };
  }, e.intervalQuantizaiton = function(s, u, l, c) {
    return c === void 0 && (c = Int32Array), function(d) {
      return function(f, p, g, m, v) {
        var h = Mc.getDataType(f);
        if (!f.length) return { encodings: [{ kind: "IntervalQuantization", min: p, max: g, numSteps: m, srcType: h }], data: new Int32Array(0) };
        if (g < p) {
          var y = p;
          p = g, g = y;
        }
        for (var x = (g - p) / (m - 1), S = new v(f.length), b = 0, _ = f.length; b < _; b++) {
          var C = f[b];
          S[b] = C <= p ? 0 : C >= g ? m - 1 : 0 | Math.round((C - p) / x);
        }
        return { encodings: [{ kind: "IntervalQuantization", min: p, max: g, numSteps: m, srcType: h }], data: S };
      }(d, s, u, l, c);
    };
  }, e.runLength = function(s) {
    var u = Mc.getDataType(s);
    if (u === void 0 && (s = new Int32Array(s), u = 3), !s.length) return { encodings: [{ kind: "RunLength", srcType: u, srcSize: 0 }], data: new Int32Array(0) };
    for (var l = 2, c = 1, d = s.length; c < d; c++) s[c - 1] !== s[c] && (l += 2);
    var f = new Int32Array(l), p = 0, g = 1;
    for (c = 1, d = s.length; c < d; c++) s[c - 1] !== s[c] ? (f[p] = s[c - 1], f[p + 1] = g, g = 1, p += 2) : ++g;
    return f[p] = s[s.length - 1], f[p + 1] = g, { encodings: [{ kind: "RunLength", srcType: u, srcSize: s.length }], data: f };
  }, e.delta = function(s) {
    if (!Mc.isSignedIntegerDataType(s)) throw new Error("Only signed integer types can be encoded using delta encoding.");
    var u = Mc.getDataType(s);
    if (u === void 0 && (s = new Int32Array(s), u = 3), !s.length) return { encodings: [{ kind: "Delta", origin: 0, srcType: u }], data: new s.constructor(0) };
    var l = new s.constructor(s.length), c = s[0];
    l[0] = s[0];
    for (var d = 1, f = s.length; d < f; d++) l[d] = s[d] - s[d - 1];
    return l[0] = 0, { encodings: [{ kind: "Delta", origin: c, srcType: u }], data: l };
  }, e.integerPacking = function(s) {
    var u = function(l) {
      var c = function(p) {
        for (var g = 0, m = p.length; g < m; g++) if (p[g] < 0) return !0;
        return !1;
      }(l), d = o(l, c ? 127 : 255), f = o(l, c ? 32767 : 65535);
      return 4 * l.length < 2 * f ? { isSigned: c, size: l.length, bytesPerElement: 4 } : 2 * f < d ? { isSigned: c, size: f, bytesPerElement: 2 } : { isSigned: c, size: d, bytesPerElement: 1 };
    }(s);
    return u.bytesPerElement === 4 ? a(s) : function(l, c) {
      for (var d = c.isSigned ? c.bytesPerElement === 1 ? 127 : 32767 : c.bytesPerElement === 1 ? 255 : 65535, f = -d - 1, p = l.length, g = c.isSigned ? c.bytesPerElement === 1 ? new Int8Array(c.size) : new Int16Array(c.size) : c.bytesPerElement === 1 ? new Uint8Array(c.size) : new Uint16Array(c.size), m = 0, v = 0; v < p; v++) {
        var h = l[v];
        if (h >= 0) for (; h >= d; ) g[m] = d, ++m, h -= d;
        else for (; h <= f; ) g[m] = f, ++m, h -= f;
        g[m] = h, ++m;
      }
      var y = a(g);
      return { encodings: [{ kind: "IntegerPacking", byteCount: c.bytesPerElement, isUnsigned: !c.isSigned, srcSize: p }, y.encodings[0]], data: y.data };
    }(s, u);
  }, e.stringArray = function(s) {
    var u = /* @__PURE__ */ Object.create(null), l = [], c = new Int32Array(s.length), d = be.create(Int32Array, 1, Math.min(1024, s.length < 32 ? s.length + 1 : Math.round(s.length / 8) + 1));
    be.add(d, 0);
    for (var f = 0, p = 0, g = 0, m = s; g < m.length; g++) {
      var v = m[g];
      if (v != null) {
        var h = u[v];
        h === void 0 && (f += v.length, l[h = l.length] = v, u[v] = h, be.add(d, f)), c[p++] = h;
      } else c[p++] = -1;
    }
    var y = be.compact(d), x = b5(y).encode(y), S = b5(c).encode(c);
    return { encodings: [{ kind: "StringArray", dataEncoding: S.encoding, stringData: l.join(""), offsetEncoding: x.encoding, offsets: x.data }], data: S.data };
  };
}(an || (an = {})), function(e) {
  function t(r, i, a) {
    return { name: r, type: 1, value: i, valueKind: a && a.valueKind, defaultFormat: a ? { encoder: a.encoder, typedArray: a.typedArray } : void 0, shouldInclude: a && a.shouldInclude };
  }
  e.str = function(r, i, a) {
    return { name: r, type: 0, value: i, valueKind: a && a.valueKind, defaultFormat: a && a.encoder ? { encoder: a.encoder } : void 0, shouldInclude: a && a.shouldInclude };
  }, e.int = t, e.float = function(r, i, a) {
    return { name: r, type: 2, value: i, valueKind: a && a.valueKind, defaultFormat: a ? { encoder: a.encoder, typedArray: a.typedArray, digitCount: a.digitCount !== void 0 ? a.digitCount : void 0 } : void 0, shouldInclude: a && a.shouldInclude };
  }, e.index = function(r) {
    return t(r, function(i, a, o) {
      return o + 1;
    }, { typedArray: Int32Array, encoder: an.by(an.delta).and(an.runLength).and(an.integerPacking) });
  };
  var n = function() {
    function r() {
      this.fields = [];
    }
    return r.prototype.index = function(i) {
      return this.fields.push(e.index(i)), this;
    }, r.prototype.str = function(i, a, o) {
      return this.fields.push(e.str(i, a, o)), this;
    }, r.prototype.int = function(i, a, o) {
      return this.fields.push(e.int(i, a, o)), this;
    }, r.prototype.vec = function(i, a, o) {
      for (var s = 0; s < a.length; s++) this.fields.push(e.int("".concat(i, "[").concat(s + 1, "]"), a[s], o));
      return this;
    }, r.prototype.float = function(i, a, o) {
      return this.fields.push(e.float(i, a, o)), this;
    }, r.prototype.many = function(i) {
      for (var a = 0; a < i.length; a++) this.fields.push(i[a]);
      return this;
    }, r.prototype.add = function(i) {
      return this.fields.push(i), this;
    }, r.prototype.getFields = function() {
      return this.fields;
    }, r;
  }();
  e.Builder = n, e.build = function() {
    return new n();
  };
}(_5 || (_5 = {})), function(e) {
  e.Empty = { fields: [], source: [] }, e.filterOf = function(t) {
    for (var n = [], r = [], i = [], a = [], o = 0, s = t.split(/[\r\n]+/); o < s.length; o++) {
      var u = s[o];
      if ((u = u.trim()).length !== 0) {
        var l = /^!/.test(u);
        l && (u = u.substr(1));
        var c = u.split(/\./), d = c[1], f = l ? d ? a : r : d ? i : n;
        f[f.length] = u, d && !n.includes(c[0]) && (n[n.length] = c[0]);
      }
    }
    var p = i.map(function(g) {
      return g.split(".")[0];
    });
    return { includeCategory: function(g) {
      return !r.includes(g) && (n.length <= 0 || n.indexOf(g) !== -1);
    }, includeField: function(g, m) {
      var v = g + "." + m;
      return !a.includes(v) && (!p.includes(g) || i.includes(v));
    } };
  }, e.DefaultFilter = { includeCategory: function(t) {
    return !0;
  }, includeField: function(t, n) {
    return !0;
  } }, e.DefaultFormatter = { getFormat: function(t, n) {
  } }, e.ofTable = function(t, n) {
    return n ? { fields: Gx(t._schema), source: [{ data: t, rowCount: n.length, keys: function() {
      return jg.Array(n);
    } }] } : { fields: Gx(t._schema), source: [{ data: t, rowCount: t._rowCount }] };
  };
}(ho || (ho = {})), function(e) {
  function t(n, r, i) {
    n.startDataBlock(r);
    for (var a = function(u) {
      n.writeCategory({ name: u, instance: function() {
        return ho.ofTable(i[u]);
      } });
    }, o = 0, s = i._tableNames; o < s.length; o++)
      a(s[o]);
  }
  e.writeDatabase = t, e.writeDatabaseCollection = function(n, r) {
    for (var i = 0, a = Object.keys(r); i < a.length; i++) {
      var o = a[i];
      t(n, o, r[o]);
    }
  };
}(x5 || (x5 = {}));
var OH = function() {
  function e() {
    this.builder = Sn.create(), this.encoded = !1, this.dataBlockCreated = !1, this.filter = ho.DefaultFilter, this.formatter = ho.DefaultFormatter, this.isBinary = !1, this.binaryEncodingProvider = void 0;
  }
  return e.prototype.setFilter = function(t) {
    this.filter = t || ho.DefaultFilter;
  }, e.prototype.isCategoryIncluded = function(t) {
    return this.filter.includeCategory(t);
  }, e.prototype.setFormatter = function(t) {
    this.formatter = t || ho.DefaultFormatter;
  }, e.prototype.startDataBlock = function(t) {
    this.dataBlockCreated = !0, Sn.write(this.builder, "data_".concat((t || "").replace(/[ \n\t]/g, "").toUpperCase(), `
#
`));
  }, e.prototype.writeCategory = function(t, n, r) {
    if (this.encoded) throw new Error("The writer contents have already been encoded, no more writing.");
    if (!this.dataBlockCreated) throw new Error("No data block created.");
    if (r != null && r.ignoreFilter || this.filter.includeCategory(t.name)) {
      var i = Lk(t, n), a = i.instance, o = i.rowCount, s = i.source;
      o && (o === 1 ? function(u, l, c, d, f, p) {
        var g = C5(l), m = c[0], v = m.data, h = g.reduce(function(_, C) {
          return f.includeField(u.name, C.name) ? Math.max(_, C.name.length) : 0;
        }, 0);
        if (h !== 0) {
          h += u.name.length + 6;
          for (var y = m.keys().move(), x = Ux(u.name, l.fields, p), S = 0; S < g.length; S++) {
            var b = g[S];
            f.includeField(u.name, b.name) && (Sn.writePadRight(d, "_".concat(u.name, ".").concat(b.name), h), zx(d, v, y, b, x[S], 0) || Sn.newline(d));
          }
          Sn.write(d, `#
`);
        }
      }(t, a, s, this.builder, this.filter, this.formatter) : function(u, l, c, d, f, p) {
        var g = C5(l), m = f === ho.DefaultFilter ? g : g.filter(function(E) {
          return f.includeField(u.name, E.name);
        }), v = m.length;
        if (v !== 0) {
          var h = Ux(u.name, m, p);
          Hx(d, "loop_");
          for (var y = 0; y < v; y++) Hx(d, "_".concat(u.name, ".").concat(m[y].name));
          for (var x = 0, S = 0; S < c.length; S++) {
            var b = c[S], _ = b.data;
            if (b.rowCount !== 0) for (var C = b.keys(); C.hasNext; ) {
              for (var w = C.move(), I = !1, M = 0; M < v; M++) I = zx(d, _, w, m[M], h[M], x);
              I || Sn.newline(d), x++;
            }
          }
          Sn.write(d, `#
`);
        }
      }(t, a, s, this.builder, this.filter, this.formatter));
    }
  }, e.prototype.encode = function() {
    this.encoded = !0;
  }, e.prototype.writeTo = function(t) {
    for (var n = Sn.getChunks(this.builder), r = 0, i = n.length; r < i; r++) t.writeString(n[r]);
  }, e.prototype.getSize = function() {
    return Sn.getSize(this.builder);
  }, e.prototype.getData = function() {
    return Sn.getString(this.builder);
  }, e;
}();
function zx(e, t, n, r, i, a) {
  var o, s = r.valueKind, u = s ? s(n, t) : 0;
  if (u !== 0) u === 1 ? function(d) {
    Sn.writeSafe(d, ". ");
  }(e) : function(d) {
    Sn.writeSafe(d, "? ");
  }(e);
  else {
    var l = r.value(n, t, a), c = r.type;
    if (c === 0) return typeof (o = l) == "string" && o.indexOf(`
`) >= 0 ? (Xh(e, l), !0) : function(d, f) {
      if (!f) return Sn.writeSafe(d, ". "), !1;
      for (var p = f.charCodeAt(0), g = !1, m = 0, v = !1, h = !1, y = 0, x = f.length - 1; y <= x; y++)
        switch (f.charCodeAt(y)) {
          case 9:
          case 32:
            g = !0;
            break;
          case 10:
            return Xh(d, f), !0;
          case 34:
            if (y && y === x) break;
            if (v) return Xh(d, f), !0;
            h = !0, g = !0, m = 0;
            break;
          case 39:
            if (y && y === x) break;
            if (h) return Xh(d, f), !0;
            v = !0, g = !0, m = 1;
        }
      return g || p !== 35 && p !== 36 && p !== 59 && p !== 91 && p !== 93 && p !== 95 || (g = !0), g ? (Sn.writeSafe(d, m ? '"' : "'"), Sn.writeSafe(d, f), Sn.writeSafe(d, m ? '" ' : "' ")) : (Sn.writeSafe(d, f), Sn.writeSafe(d, " ")), !1;
    }(e, l);
    c === 1 ? function(d, f) {
      Sn.writeInteger(d, f), Sn.whitespace1(d);
    }(e, l) : function(d, f, p) {
      Sn.writeFloat(d, f, p), Sn.whitespace1(d);
    }(e, l, i);
  }
  return !1;
}
function Ux(e, t, n) {
  for (var r, i = [], a = 0, o = t; a < o.length; a++) {
    var s = o[a], u = n.getFormat(e, s.name);
    u && u.digitCount !== void 0 ? i[i.length] = s.type === 2 ? Math.pow(10, Math.max(0, Math.min(u.digitCount, 15))) : 0 : i[i.length] = s.type === 2 ? Math.pow(10, (r = s).defaultFormat && r.defaultFormat.digitCount !== void 0 ? Math.max(0, Math.min(r.defaultFormat.digitCount, 16)) : 6) : 0;
  }
  return i;
}
function Hx(e, t) {
  Sn.write(e, t), Sn.newline(e);
}
function Xh(e, t) {
  Sn.writeSafe(e, `
;` + t), Sn.writeSafe(e, `
;
`);
}
function BH(e) {
  var t = new ArrayBuffer(vg(e)), n = new DataView(t), r = new Uint8Array(t);
  return yg(e, n, r, 0), r;
}
function vg(e) {
  var t = typeof e;
  if (t === "string") {
    var n = ZT(e);
    if (n < 32) return 1 + n;
    if (n < 256) return 2 + n;
    if (n < 65536) return 3 + n;
    if (n < 4294967296) return 5 + n;
  }
  if (e instanceof Uint8Array) {
    var r = e.byteLength;
    if (r < 256) return 2 + r;
    if (r < 65536) return 3 + r;
    if (r < 4294967296) return 5 + r;
  }
  if (t === "number") {
    if (Math.floor(e) !== e) return 9;
    if (e >= 0) {
      if (e < 128) return 1;
      if (e < 256) return 2;
      if (e < 65536) return 3;
      if (e < 4294967296) return 5;
      throw new Error("Number too big 0x" + e.toString(16));
    }
    if (e >= -32) return 1;
    if (e >= -128) return 2;
    if (e >= -32768) return 3;
    if (e >= -2147483648) return 5;
    throw new Error("Number too small -0x" + e.toString(16).substr(1));
  }
  if (t === "boolean" || e == null) return 1;
  if (t === "object") {
    var i, a = 0;
    if (Array.isArray(e)) {
      i = e.length;
      for (var o = 0; o < i; o++) a += vg(e[o]);
    } else {
      var s = Object.keys(e);
      for (i = s.length, o = 0; o < i; o++) {
        var u = s[o];
        a += vg(u) + vg(e[u]);
      }
    }
    if (i < 16) return 1 + a;
    if (i < 65536) return 3 + a;
    if (i < 4294967296) return 5 + a;
    throw new Error("Array or object too long 0x" + i.toString(16));
  }
  throw new Error("Unknown type " + t);
}
function yg(e, t, n, r) {
  var i = typeof e;
  if (i === "string") {
    var a = ZT(e);
    if (a < 32) return t.setUint8(r, 160 | a), Hh(n, r + 1, e), 1 + a;
    if (a < 256) return t.setUint8(r, 217), t.setUint8(r + 1, a), Hh(n, r + 2, e), 2 + a;
    if (a < 65536) return t.setUint8(r, 218), t.setUint16(r + 1, a), Hh(n, r + 3, e), 3 + a;
    if (a < 4294967296) return t.setUint8(r, 219), t.setUint32(r + 1, a), Hh(n, r + 5, e), 5 + a;
  }
  if (e instanceof Uint8Array) {
    var o = e.byteLength, s = new Uint8Array(t.buffer);
    if (o < 256) return t.setUint8(r, 196), t.setUint8(r + 1, o), s.set(e, r + 2), 2 + o;
    if (o < 65536) return t.setUint8(r, 197), t.setUint16(r + 1, o), s.set(e, r + 3), 3 + o;
    if (o < 4294967296) return t.setUint8(r, 198), t.setUint32(r + 1, o), s.set(e, r + 5), 5 + o;
  }
  if (i === "number") {
    if (!isFinite(e)) throw new Error("Number not finite: " + e);
    if (Math.floor(e) !== e) return t.setUint8(r, 203), t.setFloat64(r + 1, e), 9;
    if (e >= 0) {
      if (e < 128) return t.setUint8(r, e), 1;
      if (e < 256) return t.setUint8(r, 204), t.setUint8(r + 1, e), 2;
      if (e < 65536) return t.setUint8(r, 205), t.setUint16(r + 1, e), 3;
      if (e < 4294967296) return t.setUint8(r, 206), t.setUint32(r + 1, e), 5;
      throw new Error("Number too big 0x" + e.toString(16));
    }
    if (e >= -32) return t.setInt8(r, e), 1;
    if (e >= -128) return t.setUint8(r, 208), t.setInt8(r + 1, e), 2;
    if (e >= -32768) return t.setUint8(r, 209), t.setInt16(r + 1, e), 3;
    if (e >= -2147483648) return t.setUint8(r, 210), t.setInt32(r + 1, e), 5;
    throw new Error("Number too small -0x" + (-e).toString(16).substr(1));
  }
  if (e == null) return t.setUint8(r, 192), 1;
  if (i === "boolean") return t.setUint8(r, e ? 195 : 194), 1;
  if (i === "object") {
    var u, l = 0, c = Array.isArray(e), d = void 0;
    if ((u = c ? e.length : (d = Object.keys(e)).length) < 16 ? (t.setUint8(r, u | (c ? 144 : 128)), l = 1) : u < 65536 ? (t.setUint8(r, c ? 220 : 222), t.setUint16(r + 1, u), l = 3) : u < 4294967296 && (t.setUint8(r, c ? 221 : 223), t.setUint32(r + 1, u), l = 5), c) for (var f = 0; f < u; f++) l += yg(e[f], t, n, r + l);
    else {
      f = 0;
      for (var p = d.length; f < p; f++) {
        var g = d[f];
        l += yg(g, t, n, r + l), l += yg(e[g], t, n, r + l);
      }
    }
    return l;
  }
  throw new Error("Unknown type " + i);
}
var Ci, w0, wu, RH = function() {
  function e(t, n, r) {
    this.autoClassify = r, this.dataBlocks = [], this.filter = ho.DefaultFilter, this.formatter = ho.DefaultFormatter, this.isBinary = !0, this.binaryEncodingProvider = void 0, this.binaryEncodingProvider = n, this.data = { encoder: t, version: "0.3.0", dataBlocks: this.dataBlocks };
  }
  return e.prototype.setFilter = function(t) {
    this.filter = t || ho.DefaultFilter;
  }, e.prototype.isCategoryIncluded = function(t) {
    return this.filter.includeCategory(t);
  }, e.prototype.setFormatter = function(t) {
    this.formatter = t || ho.DefaultFormatter;
  }, e.prototype.startDataBlock = function(t) {
    this.dataBlocks.push({ header: (t || "").replace(/[ \n\t]/g, "").toUpperCase(), categories: [] });
  }, e.prototype.writeCategory = function(t, n, r) {
    if (!this.data) throw new Error("The writer contents have already been encoded, no more writing.");
    if (!this.dataBlocks.length) throw new Error("No data block created.");
    if (r != null && r.ignoreFilter || this.filter.includeCategory(t.name)) {
      var i = Lk(t, n), a = i.instance, o = i.rowCount, s = i.source;
      if (o) {
        for (var u = { name: "_" + t.name, columns: [], rowCount: o }, l = 0, c = C5(a); l < c.length; l++) {
          var d = c[l];
          if (this.filter.includeField(t.name, d.name)) {
            var f = this.formatter.getFormat(t.name, d.name);
            u.columns.push(NH(t.name, d, s, o, f, this.binaryEncodingProvider, this.autoClassify));
          }
        }
        u.columns.length && this.dataBlocks[this.dataBlocks.length - 1].categories.push(u);
      }
    }
  }, e.prototype.encode = function() {
    this.encodedData || (this.encodedData = BH(this.data), this.data = null, this.dataBlocks = null);
  }, e.prototype.writeTo = function(t) {
    t.writeBinary(this.encodedData);
  }, e.prototype.getData = function() {
    return this.encode(), this.encodedData;
  }, e.prototype.getSize = function() {
    return this.encodedData.length;
  }, e;
}();
function LH(e, t) {
  return e === 0 ? Hc.by(an.stringArray) : e === 1 ? b5(t) : (n = t, y5.classify(n));
  var n;
}
function NH(e, t, n, r, i, a, o) {
  var s = function(m, v, h, y) {
    for (var x = m.type === 0, S = new v(h), b = new Uint8Array(h), _ = m.valueKind, C = m.value, w = !0, I = 0, M = 0; M < y.length; M++) for (var E = y[M].data, T = y[M].keys(); T.hasNext; ) {
      var P = T.move(), k = _ ? _(P, E) : 0;
      if (k !== 0) b[I] = k, x && (S[I] = ""), w = !1;
      else {
        var D = C(P, E, I);
        typeof D != "string" || D ? b[I] = 0 : (b[I] = 1, w = !1), S[I] = D;
      }
      I++;
    }
    return { array: S, allPresent: w, mask: b };
  }(t, function(m, v) {
    return v && v.typedArray ? v.typedArray : m.defaultFormat && m.defaultFormat.typedArray ? m.defaultFormat.typedArray : m.type === 0 ? Array : m.type === 1 ? Int32Array : Float64Array;
  }(t, i), r, n), u = s.array, l = s.allPresent, c = s.mask, d = function(m, v, h, y) {
    return h && h.encoder ? h.encoder : v.defaultFormat && v.defaultFormat.encoder ? v.defaultFormat.encoder : y ? y.get(m, v.name) : void 0;
  }(e, t, i, a);
  d || (d = o ? LH(t.type, u) : function(m) {
    return m === 0 ? Hc.by(an.stringArray) : Hc.by(an.byteArray);
  }(t.type));
  var f = d.encode(u), p = void 0;
  if (!l) {
    var g = Hc.by(an.runLength).and(an.byteArray).encode(c);
    p = g.data.length < c.length ? g : Hc.by(an.byteArray).encode(c);
  }
  return { name: t.name, data: f, mask: p };
}
function Zh(e, t, n, r, i, a) {
  for (var o = new to.EdgeBuilder(i, e, t), s = new Uint16Array(o.slotCount), u = new Int8Array(o.slotCount), l = 0, c = o.edgeCount; l < c; l++) o.addNextEdge(), o.assignProperty(s, r[l]), o.assignProperty(u, n[l]);
  return o.createGraph({ flags: s, order: u }, { canRemap: a });
}
(function(e) {
  e.Encoder = x5, e.Category = ho, e.Field = _5, e.Encoding = an, e.createEncoder = function(r) {
    var i = r || {}, a = i.binary, o = a !== void 0 && a, s = i.encoderName;
    return o ? new RH(s === void 0 ? "mol*" : s, r ? r.binaryEncodingPovider : void 0, !!r && !!r.binaryAutoClassifyEncoding) : new OH();
  }, e.fields = function() {
    return e.Field.build();
  };
  var t = e.Encoding;
  function n(r) {
    var i = r.precision;
    if (i !== void 0) {
      var a = Math.pow(10, i), o = t.by(t.fixedPoint(a));
      switch (r.encoding) {
        case "pack":
          return o.and(t.integerPacking);
        case "rle":
          return o.and(t.runLength).and(t.integerPacking);
        case "delta":
          return o.and(t.delta).and(t.integerPacking);
        case "delta-rle":
          return o.and(t.delta).and(t.runLength).and(t.integerPacking);
      }
    } else switch (r.encoding) {
      case "pack":
        return t.by(t.integerPacking);
      case "rle":
        return t.by(t.runLength).and(t.integerPacking);
      case "delta":
        return t.by(t.delta).and(t.integerPacking);
      case "delta-rle":
        return t.by(t.delta).and(t.runLength).and(t.integerPacking);
    }
    throw new Error("cannot be reached");
  }
  e.Encodings = { deltaRLE: t.by(t.delta).and(t.runLength).and(t.integerPacking), fixedPoint2: t.by(t.fixedPoint(100)).and(t.delta).and(t.integerPacking), fixedPoint3: t.by(t.fixedPoint(1e3)).and(t.delta).and(t.integerPacking) }, e.categoryInstance = function(r, i) {
    return { fields: r, source: [i] };
  }, e.createEncodingProviderFromCifFrame = function(r) {
    return { get: function(i, a) {
      var o = r.categories[i];
      if (o) {
        var s = o.getField(a);
        return s && s.binaryEncoding ? Hc.fromEncoding(s.binaryEncoding) : void 0;
      }
    } };
  }, e.createEncodingProviderFromJsonConfig = function(r) {
    return { get: function(i, a) {
      for (var o = 0; o < r.length; o++) {
        var s = r[o];
        if (s.categoryName === i && s.columnName === a) return n(s);
      }
    } };
  };
})(Ci || (Ci = {})), function(e) {
  e.Descriptor = { name: "chem_comp_bond", cifExport: { prefix: "", categories: [{ name: "chem_comp_bond", instance: function(n) {
    var r = e.Provider.get(n.firstModel);
    if (!r) return Ci.Category.Empty;
    var i = r.data;
    if (!i) return Ci.Category.Empty;
    for (var a = n.structures[0].uniqueResidueNames, o = i.comp_id, s = i._rowCount, u = [], l = 0; l < s; l++) a.has(o.value(l)) && (u[u.length] = l);
    return Ci.Category.ofTable(i, u);
  } }] } }, e.Provider = Au.create(e.Descriptor), e.chemCompBondFromTable = function(n, r) {
    return On.pick(r, Zt.chem_comp_bond, function(i) {
      return n.properties.chemicalComponentMap.has(r.comp_id.value(i));
    });
  }, e.getEntriesFromChemCompBond = function(n) {
    var r = /* @__PURE__ */ new Map();
    function i(S) {
      if (r.has(S)) return r.get(S);
      var b = new t(S);
      return r.set(S, b), b;
    }
    for (var a = n.comp_id, o = n.atom_id_1, s = n.atom_id_2, u = n.value_order, l = n.pdbx_aromatic_flag, c = n._rowCount, d = i(a.value(0)), f = 0; f < c; f++) {
      var p = a.value(f), g = o.value(f), m = s.value(f), v = u.value(f), h = l.value(f) === "Y";
      d.id !== p && (d = i(p));
      var y = 1, x = 1;
      switch (h && (y |= 16), v.toLowerCase()) {
        case "delo":
          y |= 16;
          break;
        case "doub":
          x = 2;
          break;
        case "trip":
          x = 3;
          break;
        case "quad":
          x = 4;
      }
      d.add(g, m, x, y);
    }
    return r;
  };
  var t = function() {
    function n(r) {
      this.id = r, this.map = /* @__PURE__ */ new Map();
    }
    return n.prototype.add = function(r, i, a, o, s) {
      s === void 0 && (s = !0);
      var u = this.map.get(r);
      if (u !== void 0)
        u.get(i) === void 0 && u.set(i, { order: a, flags: o });
      else {
        var l = /* @__PURE__ */ new Map();
        l.set(i, { order: a, flags: o }), this.map.set(r, l);
      }
      s && this.add(i, r, a, o, !1);
    }, n;
  }();
  e.Entry = t;
}(w0 || (w0 = {})), function(e) {
  function t(n, r) {
    for (var i = n.units, a = 0, o = i.length; a < o; a++) if (Me.indexOf(i[a].elements, r) >= 0) return !0;
    return !1;
  }
  e.Descriptor = { name: "struct_conn", cifExport: { prefix: "", categories: [{ name: "struct_conn", instance: function(n) {
    var r = e.Provider.get(n.firstModel);
    if (!r || r.entries.length === 0) return Ci.Category.Empty;
    for (var i = n.structures[0], a = [], o = 0, s = r.entries; o < s.length; o++) {
      var u = s[o];
      t(i, u.partnerA.atomIndex) && t(i, u.partnerB.atomIndex) && (a[a.length] = u.rowIndex);
    }
    return Ci.Category.ofTable(r.data, a);
  } }] } }, e.Provider = Au.create(e.Descriptor), e.isExhaustive = function(n) {
    var r = e.Provider.get(n);
    return !!r && r.data.id.rowCount / n.atomicConformation.atomId.rowCount > 0.95;
  }, e.getAtomIndexFromEntries = function(n) {
    for (var r = /* @__PURE__ */ new Map(), i = 0, a = n; i < a.length; i++) {
      var o = a[i], s = o.partnerA.atomIndex, u = o.partnerB.atomIndex;
      r.has(s) ? r.get(s).push(o) : r.set(s, [o]), r.has(u) ? r.get(u).push(o) : r.set(u, [o]);
    }
    return r;
  }, e.getEntriesFromStructConn = function(n, r) {
    for (var i = n.conn_type_id, a = n.pdbx_dist_value, o = n.pdbx_value_order, s = { label_asym_id: n.ptnr1_label_asym_id, label_seq_id: n.ptnr1_label_seq_id, auth_seq_id: n.ptnr1_auth_seq_id, label_atom_id: n.ptnr1_label_atom_id, label_alt_id: n.pdbx_ptnr1_label_alt_id, ins_code: n.pdbx_ptnr1_PDB_ins_code, symmetry: n.ptnr1_symmetry }, u = { label_asym_id: n.ptnr2_label_asym_id, label_seq_id: n.ptnr2_label_seq_id, auth_seq_id: n.ptnr2_auth_seq_id, label_atom_id: n.ptnr2_label_atom_id, label_alt_id: n.pdbx_ptnr2_label_alt_id, ins_code: n.pdbx_ptnr2_PDB_ins_code, symmetry: n.ptnr2_symmetry }, l = function(h, y) {
      if (y.label_asym_id.valueKind(h) === 0) {
        var x = y.label_asym_id.value(h), S = r.atomicHierarchy.index.findEntity(x);
        if (!(S < 0)) {
          var b = r.atomicHierarchy.index.findResidue(r.entities.data.id.value(S), x, y.auth_seq_id.value(h), y.ins_code.value(h));
          if (!(b < 0)) {
            var _ = y.label_atom_id.value(h);
            if (_) {
              var C = r.atomicHierarchy.index.findAtomOnResidue(b, _, y.label_alt_id.value(h));
              if (!(C < 0)) return { residueIndex: b, atomIndex: C, symmetry: y.symmetry.value(h) };
            }
          }
        }
      }
    }, c = [], d = 0; d < n._rowCount; d++) {
      var f = l(d, s), p = l(d, u);
      if (f !== void 0 && p !== void 0) {
        var g = i.value(d), m = 0, v = 1;
        switch ((o.value(d) || "").toLowerCase()) {
          case "sing":
            v = 1;
            break;
          case "doub":
            v = 2;
            break;
          case "trip":
            v = 3;
            break;
          case "quad":
            v = 4;
            break;
          default:
            v = Rk(n.ptnr1_label_comp_id.value(d), n.ptnr1_label_atom_id.value(d), n.ptnr2_label_comp_id.value(d), n.ptnr2_label_atom_id.value(d));
        }
        switch (g) {
          case "covale":
            m = 1;
            break;
          case "disulf":
            m = 9;
            break;
          case "hydrog":
            m = 4;
            break;
          case "metalc":
            m = 2;
        }
        c.push({ rowIndex: d, flags: m, order: v, distance: a.value(d), partnerA: f, partnerB: p });
      }
    }
    return c;
  };
}(wu || (wu = {}));
var qx = A(), jx = A();
function FH(e, t, n) {
  return e.conformation.position(t, qx), e.conformation.position(n, jx), A.distance(qx, jx);
}
var VH = /* @__PURE__ */ new Set();
function GH(e, t) {
  var n = O(O({}, kk), t);
  return n.noCompute || nr.isCoarseGrained(e.model) ? g5.Empty : nr.isMaterial(e.model) && (n.isMaterial = !0, fi.Provider.get(e.model)) ? function(r) {
    var i = fi.Provider.get(r.model);
    return i ? Zh(Array.from(i.bonds.a || []), Array.from(i.bonds.b || []), Array.from(i.bonds.edgeProps.order || []), Array.from(i.bonds.edgeProps.flag || []), i.bonds.vertexCount, !1) : Zh([], [], [], [], 0, !1);
  }(e) : !n.forceCompute && fi.Provider.get(e.model) ? function(r) {
    for (var i = fi.Provider.get(r.model), a = r.elements, o = r.model.atomicHierarchy.atoms.type_symbol, s = r.elements.length, u = i.bonds, l = u.offset, c = u.b, d = u.edgeProps, f = d.order, p = d.distance, g = d.flag, m = r.model.atomicHierarchy.atomSourceIndex, v = nr.getInvertedAtomSourceIndex(r.model).invertedIndex, h = [], y = [], x = [], S = [], b = 0; b < s; b++) for (var _ = a[b], C = zc(o.value(_)), w = Uc(C), I = m.value(_), M = l[I], E = l[I + 1]; M < E; ++M) {
      var T = v[c[M]];
      if (!(_ >= T)) {
        var P = Me.indexOf(r.elements, T);
        if (!(P < 0)) {
          var k = zc(o.value(T)), D = p[M], B = FH(r, _, T), L = !1;
          r.model.sourceData.kind === "mol" || r.model.sourceData.kind === "sdf" || r.model.sourceData.kind === "mol2" ? L = !0 : D >= 0 ? L = Ar(B, D, 0.3) : C === -1 || k === -1 ? L = !0 : w && Uc(k) && (L = !1), L && (h[h.length] = b, y[y.length] = P, S[S.length] = f[M], x[x.length] = g[M]);
        }
      }
    }
    return Zh(h, y, S, x, s, !1);
  }(e) : function(r, i) {
    for (var a = i.maxRadius, o = i.isMaterial, s = r.model.atomicConformation, u = s.x, l = s.y, c = s.z, d = r.elements.length, f = r.elements, p = r.residueIndex, g = r.chainIndex, m = r.model.atomicHierarchy.atoms, v = m.type_symbol, h = m.label_atom_id, y = m.label_alt_id, x = m.label_comp_id, S = r.model.atomicHierarchy.residues.label_seq_id, b = r.model.atomicHierarchy.index, _ = r.model.sequence.byEntityKey, C = r.lookup3d, w = wu.Provider.get(r.model), I = w0.Provider.get(r.model), M = wu.isExhaustive(r.model), E = [], T = [], P = [], k = [], D = -1, B = void 0, L = !0, F = !0, V = !0, G = VH, H = 0; H < d; H++) {
      var q = f[H], z = v.value(q);
      L && z !== "H" && z !== "O" && (L = !1);
      var K = i.forceCompute ? void 0 : w && w.byAtomIndex.get(q), Y = !1;
      if (K) for (var Z = 0, X = K; Z < X.length; Z++) {
        var W = X[Z], J = W.partnerA, $ = W.partnerB;
        if (J.symmetry === $.symmetry) {
          var ee = J.atomIndex === q ? $ : J;
          (Le = Me.indexOf(r.elements, ee.atomIndex)) < 0 || f[Le] < q || (E[E.length] = H, T[T.length] = Le, P[P.length] = W.flags, k[k.length] = W.order, Y || G.clear(), Y = !0, G.add(Le));
        }
      }
      if (!M) {
        var ce = p[q], ae = S.value(ce), he = x.value(q);
        if (!i.forceCompute && ce !== D) if (I && I.entries.has(he)) {
          var Oe = _[b.getEntityFromChain(g[q])];
          B = Oe && Oe.sequence.microHet.has(ae) ? void 0 : I.entries.get(he).map;
        } else B = void 0;
        D = ce;
        for (var Ne = zc(z), Ue = h.value(q), Ze = B ? B.get(Ue) : void 0, Se = C.find(u[q], l[q], c[q], a), qe = Se.indices, Pe = Se.count, Xe = Se.squaredDistances, Ke = Uc(Ne), de = E1(Ne), we = y.value(q), Ie = $g.has(Ne), Ee = 0; Ee < Pe; Ee++) {
          var Le = qe[Ee];
          if (!Y || !G.has(Le)) {
            var De = f[Le];
            if (!(De <= q)) {
              var rt = y.value(De);
              if (!we || !rt || we === rt) {
                var st = zc(v.value(De)), gt = Uc(st);
                if (!Ke || !gt) {
                  var ft = (Ie || $g.has(st)) && !(Ke || gt), yt = p[De];
                  if (ce === yt && Ze) {
                    var It = Ze.get(h.value(De));
                    if (It) {
                      E[E.length] = H, T[T.length] = Le, k[k.length] = It.order;
                      var ge = It.flags;
                      ft && (o ? ge = 33 : (1 | ge && (ge ^= 1), ge |= 2)), P[P.length] = ge;
                    }
                  } else {
                    var Je = Math.sqrt(Xe[Ee]);
                    if (Je !== 0 && Je <= v5(Ne, st, de, E1(st), o)) {
                      E[E.length] = H, T[T.length] = Le, k[k.length] = IH(he, Ue, h.value(De)), P[P.length] = 32 | (ft && !o ? 2 : 1);
                      var Mt = S.value(yt);
                      ae === Mt && (F = !1), Math.abs(ae - Mt) > 1 && (V = !1);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return Zh(E, T, k, P, d, L || F && V);
  }(e, n);
}
var Kx = A(), Yx = A();
function Wx(e, t, n, r) {
  return e.conformation.position(t, Kx), n.conformation.position(r, Yx), A.distance(Kx, Yx);
}
var zH = ne(), Cd = A(), pt, UH = O(O({}, kk), { ignoreWater: !0, ignoreIon: !0 });
function HH(e, t) {
  var n = new _f.Builder(), r = e.models.some(function(i) {
    return fi.Provider.get(i);
  });
  return t.noCompute || e.isCoarseGrained && !r || ze.eachUnitPair(e, function(i, a) {
    (function(o, s, u, l) {
      var c = u.maxRadius, d = o.elements, f = o.residueIndex, p = o.model.atomicConformation, g = p.x, m = p.y, v = p.z, h = s.elements, y = s.residueIndex, x = o.elements.length, S = o.model.atomicHierarchy.atoms, b = S.type_symbol, _ = S.label_alt_id, C = S.label_atom_id, w = S.label_comp_id, I = s.model.atomicHierarchy.atoms, M = I.type_symbol, E = I.label_alt_id, T = I.label_atom_id, P = I.label_comp_id, k = o.model.atomicHierarchy.residues.auth_seq_id, D = s.model.atomicHierarchy.residues.auth_seq_id, B = o.model.atomicConformation.occupancy, L = s.model.atomicConformation.occupancy, F = B.isDefined && L.isDefined, V = o.model === s.model && wu.Provider.get(o.model), G = !u.forceCompute && o.model === s.model && fi.Provider.get(o.model), H = o.model.atomicHierarchy.atomSourceIndex, q = (G ? nr.getInvertedAtomSourceIndex(s.model) : { invertedIndex: void 0 }).invertedIndex, z = o.model === s.model && wu.isExhaustive(o.model), K = ne.mul(zH, s.conformation.operator.inverse, o.conformation.operator.matrix), Y = !ne.isIdentity(K), Z = s.boundary.sphere, X = Z.center, W = Z.radius, J = (W + c) * (W + c);
      l.startUnitPair(o.id, s.id);
      for (var $ = 0; $ < x; $++) {
        var ee = d[$];
        if (A.set(Cd, g[ee], m[ee], v[ee]), Y && A.transformMat4(Cd, Cd, K), !(A.squaredDistance(Cd, X) > J)) if (u.forceCompute || !G) {
          var ce = u.forceCompute ? void 0 : V && V.byAtomIndex.get(ee);
          if (ce && ce.length) {
            for (var ae = !1, he = 0, Oe = ce; he < Oe.length; he++) {
              var Ne = Oe[he], Ue = Ne.partnerA, Ze = Ne.partnerB, Se = Ue.atomIndex === ee ? Ze : Ue;
              (kn = Me.indexOf(s.elements, Se.atomIndex)) < 0 || Wx(o, ee, s, Se.atomIndex) > c || (l.add($, kn, { order: Ne.order, flag: Ne.flags }), ae = !0);
            }
            if (ae) continue;
          }
          if (!z) {
            var qe = B.value(ee), Pe = s.lookup3d.find(Cd[0], Cd[1], Cd[2], c), Xe = Pe.indices, Ke = Pe.count, de = Pe.squaredDistances;
            if (Ke !== 0) for (var we = zc(b.value(ee)), Ie = Uc(we), Ee = E1(we), Le = _.value(ee), De = $g.has(we), rt = C.value(ee), st = w.value(f[ee]), gt = 0; gt < Ke; gt++) {
              Pn = h[kn = Xe[gt]];
              var ft = E.value(Pn);
              if (!(Le && ft && Le !== ft || F && L.value(Pn) < 1 && qe < 1 && k.value(ee) === D.value(Pn))) {
                var yt = Uc(br = zc(M.value(Pn)));
                if (!Ie || !yt) {
                  var It = (De || $g.has(br)) && !(Ie || yt);
                  if (!It && (dr = Math.sqrt(de[gt])) !== 0 && dr <= v5(we, br, Ee, E1(br))) {
                    var ge = T.value(Pn), Je = P.value(y[Pn]);
                    l.add($, kn, { order: Rk(st, Je, rt, ge), flag: 32 | (It ? 2 : 1) });
                  }
                }
              }
            }
          }
        } else for (var Mt = G.maxDistance, wn = G.bonds, tn = wn.offset, Te = wn.b, At = wn.edgeProps, Gt = At.order, Tt = At.distance, nn = At.flag, Pt = H.value(ee), Yt = tn[Pt], Rn = tn[Pt + 1]; Yt < Rn; ++Yt) {
          var kn, Pn = q[Te[Yt]];
          if (!((kn = Me.indexOf(s.elements, Pn)) < 0)) {
            var Kn = zc(b.value(ee)), br = zc(b.value(Pn)), ra = Tt[Yt], dr = Wx(o, ee, s, Pn), Ln = !1;
            ra >= 0 ? Ln = Ar(dr, ra, 0.3) : Mt >= 0 ? Ln = dr < Mt : (Ln = dr < v5(Kn, br, E1(Kn), E1(br)), Uc(Kn) && Uc(br) && (Ln = !1)), Ln && l.add($, kn, { order: Gt[Yt], flag: nn[Yt] });
          }
        }
      }
      l.finishUnitPair();
    })(i, a, t, n);
  }, { maxRadius: t.maxRadius, validUnit: function(i) {
    return ve.isAtomic(i);
  }, validUnitPair: function(i, a) {
    return t.validUnitPair(e, i, a);
  } }), new Jg(n.getMap());
}
function qH(e, t) {
  var n = O(O({}, UH), t);
  return HH(e, O(O({}, n), { validUnitPair: t && t.validUnitPair || function(r, i, a) {
    var o = i.model.atomicHierarchy.derived.residue.moleculeType, s = a.model.atomicHierarchy.derived.residue.moleculeType, u = !(ve.isAtomic(i) && o[i.residueIndex[i.elements[0]]] === 2 || ve.isAtomic(a) && s[a.residueIndex[a.elements[0]]] === 2), l = i.model === a.model, c = !ve.isAtomic(i) || o[i.residueIndex[i.elements[0]]] !== 3 || l && Xx(i), d = !ve.isAtomic(a) || s[a.residueIndex[a.elements[0]]] !== 3 || l && Xx(a), f = c && d;
    return ze.validUnitPair(r, i, a) && (u || !n.ignoreWater) && (f || !n.ignoreIon);
  } }));
}
function Xx(e) {
  if (!ve.isAtomic(e)) return !1;
  var t = e.elements, n = wu.Provider.get(e.model);
  if (n) {
    for (var r = 0, i = t.length; r < i; r++) if (n.byAtomIndex.get(t[r])) return !0;
  }
  return !1;
}
function jH(e) {
  for (var t = function(a) {
    for (var o = Kt.transientSegments(a.model.atomicHierarchy.residueAtomSegments, a.elements), s = 0; o.hasNext; ) {
      var u = o.move();
      s = Math.max(s, u.end - u.start);
    }
    return s;
  }(e), n = function(a, o) {
    return { startVertex: 0, endVertex: 0, count: 0, isRingAtom: new Int32Array(o), marked: new Int32Array(o), queue: new Int32Array(o), pred: new Int32Array(o), depth: new Int32Array(o), left: new Int32Array(5), right: new Int32Array(5), color: new Int32Array(o), currentColor: 0, currentAltLoc: "", hasAltLoc: !1, rings: [], currentRings: [], unit: a, bonds: a.bonds, altLoc: a.model.atomicHierarchy.atoms.label_alt_id };
  }(e, t), r = Kt.transientSegments(e.model.atomicHierarchy.residueAtomSegments, e.elements); r.hasNext; ) {
    var i = r.move();
    KH(n, i.start, i.end);
  }
  return n.rings;
}
function Zx(e) {
  e.count = e.endVertex - e.startVertex;
  for (var t = e.isRingAtom, n = e.pred, r = e.color, i = e.depth, a = e.marked, o = 0; o < e.count; o++) t[o] = 0, n[o] = -1, a[o] = -1, r[o] = 0, i[o] = 0;
  e.currentColor = 0, e.currentAltLoc = "", e.hasAltLoc = !1;
}
function Qx(e) {
  for (var t = e.depth, n = 0; n < e.count; n++) t[n] = e.count + 1;
}
function Jx(e, t) {
  var n = e.bonds.offset, r = e.startVertex + t, i = n[r], a = n[r + 1] - i;
  return !(a <= 1 || e.isRingAtom[t] && a === 2);
}
function KH(e, t, n) {
  if (e.startVertex = t, e.endVertex = n, !(e.endVertex - e.startVertex < 3)) {
    e.currentRings = [];
    for (var r = e.unit.elements, i = [], a = e.startVertex; a < e.endVertex; a++)
      Qo(i, u = e.altLoc.value(r[a]));
    gg(i, "");
    var o = 1;
    if (i.length === 0)
      for (Zx(e), a = 0; a < e.count; a++) Jx(e, a) && (Qx(e), o = $x(e, a, o));
    else for (var s = 0; s < i.length; s++)
      for (Zx(e), e.hasAltLoc = !0, e.currentAltLoc = i[s], a = 0; a < e.count; a++) {
        var u;
        Jx(e, a) && ((u = e.altLoc.value(r[e.startVertex + a])) && u !== e.currentAltLoc || (Qx(e), o = $x(e, a, o)));
      }
    a = 0;
    for (var l = e.currentRings.length; a < l; a++) e.rings.push(e.currentRings[a]);
  }
}
function YH(e, t, n, r) {
  if (n < t) return !1;
  for (var i = e.pred, a = e.color, o = e.left, s = e.right, u = ++e.currentColor, l = t, c = 0; c < 5 && (a[l] = u, !((l = i[l]) < 0)); c++) ;
  var d = 0, f = 0, p = !1, g = 0;
  for (l = n, c = 0; c < 5; c++) {
    if (a[l] === u) {
      g = l, p = !0;
      break;
    }
    if (s[f++] = l, (l = i[l]) < 0) break;
  }
  if (!p) return !1;
  for (l = t, c = 0; c < 5 && (o[d++] = l, g !== l) && !((l = i[l]) < 0); c++) ;
  var m = d + f;
  if (m < 3) return !1;
  var v = new Int32Array(m), h = 0;
  for (c = 0; c < d; c++) v[h++] = e.startVertex + o[c], r[o[c]] = 1;
  for (c = f - 1; c >= 0; c--) v[h++] = e.startVertex + s[c], r[s[c]] = 1;
  zs(v);
  for (var y = 0, x = e.currentRings.length; y < x; y++) {
    var S = e.currentRings[y];
    if (v.length === S.length) {
      if (Me.areEqual(v, S)) return !1;
    } else if (v.length > S.length && Me.isSubset(v, S)) return !1;
  }
  return e.currentRings.push(Me.ofSortedArray(v)), !0;
}
function $x(e, t, n) {
  var r = e.bonds, i = e.startVertex, a = e.endVertex, o = e.isRingAtom, s = e.marked, u = e.queue, l = e.pred, c = e.depth, d = e.unit.elements, f = r.b, p = r.edgeProps.flags, g = r.offset;
  s[t] = n, c[t] = 0, u[0] = t;
  for (var m = 0, v = 1; m < v; ) for (var h = u[m++], y = c[h], x = i + h, S = g[x], b = g[x + 1], _ = S; _ < b; _++) {
    var C = f[_];
    if (!(C < i || C >= a) && cn.isCovalent(p[_])) {
      if (e.hasAltLoc) {
        var w = e.altLoc.value(d[C]);
        if (w && e.currentAltLoc !== w) continue;
      }
      var I = C - i;
      if (s[I] !== n) {
        var M = Math.min(c[I], y + 1);
        M > 5 || (c[I] = M, s[I] = n, u[v++] = I, l[I] = h);
      } else if (l[I] !== h && l[h] !== I && YH(e, h, I, o)) return n + 1;
    }
  }
  return n + 1;
}
function eC(e) {
  for (var t = e.length, n = new Int32Array(2 * t), r = 0; r < n.length; r++) n[r] = -1;
  for (var i = "", a = "", o = 0, s = 1; s < n.length; s++) {
    for (r = n[s - o - 1]; r !== -1 && (i = e[s % t]) !== (a = e[(o + r + 1) % t]); ) i < a && (o = s - r - 1), r = n[r];
    r === -1 && (i = e[s % t]) !== (a = e[(o + r + 1) % t]) ? (i < a && (o = s), n[s - o] = -1) : n[s - o] = r + 1;
  }
  return o;
}
function tC(e, t) {
  var n, r = e.length, i = [];
  for (n = 0; n < r - 1; n++) i.push(e[(n + t) % r]), i.push("-");
  return i.push(e[(n + t) % r]), i.join("");
}
function Nk(e, t) {
  switch (e.kind) {
    case 0:
      return e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[t]];
    case 1:
    case 2:
      var n = function(i, a) {
        var o = i.coarseElements.entityKey[a], s = i.model.sequence.byEntityKey[o].sequence, u = i.coarseElements.seq_id_begin.value(a);
        return s.compId.value(u - 1);
      }(e, t), r = e.model.properties.chemicalComponentMap.get(n);
      if (r) return ah(r.type, n);
  }
  return 0;
}
(function(e) {
  function t(a, o, s, u, l, c) {
    return { kind: "bond-location", aStructure: a, aUnit: o, aIndex: s, bStructure: u, bUnit: l, bIndex: c };
  }
  function n(a, o) {
    return a.aStructure.label === o.aStructure.label && a.bStructure.label === o.bStructure.label && a.aIndex === o.aIndex && a.bIndex === o.bIndex && a.aUnit.id === o.aUnit.id && a.bUnit.id === o.bUnit.id;
  }
  function r(a, o) {
    return { kind: "bond-loci", structure: a, bonds: o };
  }
  e.Location = t, e.isLocation = function(a) {
    return !!a && a.kind === "bond-location";
  }, e.areLocationsEqual = n, e.Loci = r, e.isLoci = function(a) {
    return !!a && a.kind === "bond-loci";
  }, e.areLociEqual = function(a, o) {
    if (a.structure !== o.structure || a.bonds.length !== o.bonds.length) return !1;
    for (var s = 0, u = a.bonds.length; s < u; ++s) if (!n(a.bonds[s], o.bonds[s])) return !1;
    return !0;
  }, e.isLociEmpty = function(a) {
    return a.bonds.length === 0;
  }, e.remapLoci = function(a, o) {
    if (o === a.structure) return a;
    var s = [];
    return a.bonds.forEach(function(u) {
      var l = o.unitMap.get(u.aUnit.id);
      if (l) {
        var c = o.unitMap.get(u.bUnit.id);
        if (c) {
          var d = u.aUnit.elements[u.aIndex], f = Me.indexOf(l.elements, d);
          if (f !== -1) {
            var p = u.bUnit.elements[u.bIndex], g = Me.indexOf(c.elements, p);
            g !== -1 && s.push(t(a.structure, l, f, a.structure, c, g));
          }
        }
      }
    }), r(o, s);
  }, e.toStructureElementLoci = function(a) {
    for (var o = [], s = /* @__PURE__ */ new Map(), u = 0, l = a.bonds; u < l.length; u++) {
      var c = l[u], d = c.aIndex, f = c.aUnit, p = c.bIndex, g = c.bUnit;
      f === g ? s.has(f.id) ? s.get(f.id).push(d, p) : s.set(f.id, [d, p]) : (s.has(f.id) ? s.get(f.id).push(d) : s.set(f.id, [d]), s.has(g.id) ? s.get(g.id).push(p) : s.set(g.id, [p]));
    }
    return s.forEach(function(m, v) {
      o.push({ unit: a.structure.unitMap.get(v), indices: Me.deduplicate(Me.ofUnsortedArray(m)) });
    }), ke(a.structure, o);
  }, e.toFirstStructureElementLoci = function(a) {
    var o = a.bonds[0], s = o.aUnit, u = o.aIndex;
    return ke(a.structure, [{ unit: s, indices: _e.ofSingleton(u) }]);
  }, e.getType = function(a, o) {
    if (o.aUnit === o.bUnit) {
      var s = o.aUnit.bonds, u = s.getEdgeIndex(o.aIndex, o.bIndex);
      return u < 0 ? cn.create(0) : cn.create(s.edgeProps.flags[u]);
    }
    var l = a.interUnitBonds.getBondFromLocation(o);
    return l ? cn.create(l.props.flag) : cn.create(0);
  }, e.getOrder = function(a, o) {
    if (o.aUnit === o.bUnit) {
      var s = o.aUnit.bonds, u = s.getEdgeIndex(o.aIndex, o.bIndex);
      return u < 0 ? 0 : s.edgeProps.order[u];
    }
    var l = a.interUnitBonds.getBondFromLocation(o);
    return l ? l.props.order : 0;
  }, e.getIntraUnitBondCount = function(a) {
    for (var o = 0, s = 0, u = a.units.length; s < u; ++s) {
      var l = a.units[s];
      ve.isAtomic(l) && (o += l.bonds.edgeCount);
    }
    return o;
  };
  var i = function() {
    function a() {
      this.current = {}, this.hasNext = !1;
    }
    return a.prototype.move = function() {
      return this.advance(), this.current;
    }, a.prototype.setElement = function(o, s, u) {
      this.structure = o, this.unit = s, this.index = u, this.interBondIndices = o.interUnitBonds.getEdgeIndices(u, s.id), this.interBondCount = this.interBondIndices.length, this.interBondIndex = 0, this.intraBondEnd = s.bonds.offset[u + 1], this.intraBondIndex = s.bonds.offset[u], this.hasNext = this.interBondIndex < this.interBondCount || this.intraBondIndex < this.intraBondEnd;
    }, a.prototype.advance = function() {
      if (this.intraBondIndex < this.intraBondEnd) this.current.otherUnit = this.unit, this.current.otherIndex = this.unit.bonds.b[this.intraBondIndex], this.current.type = this.unit.bonds.edgeProps.flags[this.intraBondIndex], this.current.order = this.unit.bonds.edgeProps.order[this.intraBondIndex], this.intraBondIndex += 1;
      else {
        if (!(this.interBondIndex < this.interBondCount)) return void (this.hasNext = !1);
        var o = this.structure.interUnitBonds.edges[this.interBondIndex];
        this.current.otherUnit = this.structure.unitMap.get(o.unitA !== this.unit.id ? o.unitA : o.unitB), this.current.otherIndex = o.indexA !== this.index ? o.indexA : o.indexB, this.current.type = o.props.flag, this.current.order = o.props.order, this.interBondIndex += 1;
      }
      this.hasNext = this.interBondIndex < this.interBondCount || this.intraBondIndex < this.intraBondEnd;
    }, a;
  }();
  e.ElementBondIterator = i, e.getBoundingSphere = function(a, o) {
    return J1.fromPairProvider(a.bonds.length, function(s, u, l) {
      var c = a.bonds[s], d = c.aUnit, f = c.aIndex, p = c.bUnit, g = c.bIndex;
      d.conformation.position(d.elements[f], u), p.conformation.position(p.elements[g], l);
    }, o);
  };
})(pt || (pt = {}));
var WH = /* @__PURE__ */ new Set();
function qc(e, t) {
  var n = lH[e];
  if (n !== void 0) {
    var r = n[t];
    if (r !== void 0) return r;
  }
  return WH;
}
var nC = A.zero();
function Fk(e, t) {
  for (var n = e.conformation.position, r = new Float32Array(3 * t.length), i = e.elements, a = 0, o = t.length; a < o; ++a) n(i[t[a]], nC), A.toArray(nC, r, 3 * a);
  return r;
}
var is, Zn, tv = function() {
  function e(t, n) {
    this.unit = n, this.all = t;
  }
  return Object.defineProperty(e.prototype, "index", { get: function() {
    return this._index || (this._index = function(t, n) {
      for (var r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = 0, o = t.length; a < o; a++) for (var s = 0, u = (p = t[a]).length; s < u; s++) {
        var l = p[s];
        r.has(l) ? r.get(l).push(a) : r.set(l, [a]);
      }
      for (var c = 0, d = n.length; c < d; c++) for (s = 0, u = (p = t[a = n[c]]).length; s < u; s++) l = p[s], i.has(l) ? i.get(l).push(a) : i.set(l, [a]);
      var f = new to.UniqueEdgeBuilder(t.length);
      for (a = 0, o = t.length; a < o; a++) {
        var p;
        for (s = 0, u = (p = t[a]).length; s < u; s++) {
          l = p[s];
          var g = r.get(l);
          if (g.length !== 1) for (var m = 0, v = g.length; m < v; m++) {
            var h = g[m];
            a >= h || f.addEdge(a, h);
          }
        }
      }
      var y = to.connectedComponents(f.getGraph()), x = y.componentIndex, S = [];
      for (s = 0; s < y.componentCount; s++) S[s] = [];
      for (a = 0, o = t.length; a < o; a++) S[x[a]].push(a);
      return { elementRingIndices: r, elementAromaticRingIndices: i, ringComponentIndex: x, ringComponents: S };
    }(this.all, this.aromaticRings)), this._index;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "byFingerprint", { get: function() {
    return this._byFingerprint || (this._byFingerprint = function(t, n) {
      for (var r = /* @__PURE__ */ new Map(), i = 0, a = 0, o = n.length; a < o; a++) {
        var s = n[a], u = is.fingerprint(t, s);
        r.has(u) ? r.get(u).push(i) : r.set(u, [i]), i++;
      }
      return r;
    }(this.unit, this.all)), this._byFingerprint;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "elementRingIndices", { get: function() {
    return this.index.elementRingIndices;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "elementAromaticRingIndices", { get: function() {
    return this.index.elementAromaticRingIndices;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "ringComponentIndex", { get: function() {
    return this.index.ringComponentIndex;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "ringComponents", { get: function() {
    return this.index.ringComponents;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "aromaticRings", { get: function() {
    return this._aromaticRings || (this._aromaticRings = function(t, n) {
      for (var r = [], i = 0, a = n.length; i < a; ++i) is.isAromatic(t, n[i]) && r.push(i);
      return r;
    }(this.unit, this.all)), this._aromaticRings;
  }, enumerable: !1, configurable: !0 }), e;
}();
function XH(e, t) {
  for (var n = e.elements, r = e.model.atomicHierarchy.residueAtomSegments.index, i = r[n[t[0]]], a = 1, o = t.length; a < o; a++) if (i !== r[n[t[a]]]) return -1;
  return i;
}
function ZH(e, t, n) {
  var r = e.byFingerprint.get(t);
  if (r) for (var i = 0, a = r.length; i < a; i++) {
    var o = r[i], s = XH(e.unit, e.all[o]);
    s >= 0 && (n.has(s) ? n.get(s).push(o) : n.set(s, [o]));
  }
}
function QH(e) {
  for (var t = [], n = e.elements, r = e.model.coarseHierarchy, i = r.spheres, a = r.gaussians, o = ve.isSpheres(e) ? i.polymerRanges : a.polymerRanges, s = Zn.transientSegments(o, n); s.hasNext; ) for (var u = s.move(), l = u.start, c = u.end, d = l; d < c; ++d) t.push(n[d]);
  return Me.ofSortedArray(t);
}
function JH(e) {
  for (var t = [], n = e.elements, r = e.model.coarseHierarchy, i = r.spheres, a = r.gaussians, o = ve.isSpheres(e) ? i.gapRanges : a.gapRanges, s = Zn.transientSegments(o, n); s.hasNext; ) {
    var u = s.move(), l = u.start, c = u.end;
    t.push(n[l], n[c - 1]);
  }
  return Me.ofSortedArray(t);
}
(function(e) {
  function t(r) {
    return function(i) {
      for (var a = i.length, o = new Array(a), s = 0; s < a; s++) o[s] = i[a - s - 1];
      var u = eC(i), l = eC(o), c = !1;
      for (s = 0; s < a; s++) {
        var d = i[(s + u) % a], f = o[(s + l) % a];
        if (d !== f) {
          c = d < f;
          break;
        }
      }
      return c ? tC(i, u) : tC(o, l);
    }(r);
  }
  e.fingerprint = function(r, i) {
    for (var a = r.elements, o = r.model.atomicHierarchy.atoms.type_symbol, s = [], u = 0, l = i.length; u < l; u++) s[s.length] = o.value(a[i[u]]);
    return t(s);
  }, e.elementFingerprint = t;
  var n = /* @__PURE__ */ new Set(["B", "C", "N", "O", "SI", "P", "S", "GE", "AS", "SN", "SB", "BI"]);
  e.isAromatic = function(r, i) {
    var a = r.elements, o = r.bonds, s = o.b, u = o.offset, l = o.edgeProps.flags, c = r.model.atomicHierarchy.atoms, d = c.type_symbol;
    if (c.label_comp_id.value(r.elements[i[0]]) === "PRO") return !1;
    for (var f = 0, p = !1, g = 0, m = i.length; g < m; ++g) {
      var v = i[g];
      !p && n.has(d.value(a[v])) && (p = !0);
      for (var h = u[v], y = u[v + 1]; h < y; ++h) cn.is(16, l[h]) && Me.has(i, s[h]) && (f += 1);
    }
    if (f === 2 * i.length) return !0;
    if (!p || i.length < 5) return !1;
    var x = Jc.calculateMomentsAxes(Fk(r, i));
    return A.magnitude(x.dirC) < 0.05;
  }, e.getAltId = function(r, i) {
    for (var a = r.model.atomicHierarchy.atoms.label_alt_id, o = r.elements, s = 0, u = i.length; s < u; ++s) {
      var l = o[i[s]], c = a.value(l);
      if (c) return c;
    }
    return "";
  };
})(is || (is = {})), function(e) {
  e.create = function(t) {
    var n = jH(t);
    return new e(n, t);
  }, e.byFingerprintAndResidue = function(t, n) {
    for (var r = /* @__PURE__ */ new Map(), i = 0, a = n.length; i < a; i++)
      ZH(t, n[i], r);
    return r;
  };
}(tv || (tv = {})), function(e) {
  function t(c) {
    return c[c.length - 1];
  }
  function n(c) {
    return c.length / 2;
  }
  function r(c, d) {
    return c[2 * d];
  }
  function i(c, d) {
    return c[2 * d + 1] + 1;
  }
  function a(c, d) {
    return c[2 * d];
  }
  function o(c, d) {
    return c[2 * d + 1];
  }
  function s(c, d) {
    return u(c, d, 0);
  }
  function u(c, d, f) {
    if (a(c, f) > _e.max(d) || t(c) < _e.min(d)) return -1;
    for (var p = f, g = n(c); p < g; ++p) {
      var m = le.ofRange(a(c, p), o(c, p));
      if (_e.areIntersecting(m, d)) return p;
    }
    return -1;
  }
  e.ofSortedRanges = function(c) {
    return Me.ofSortedArray(c);
  }, e.start = function(c) {
    return c[0];
  }, e.end = function(c) {
    return c[c.length - 1] + 1;
  }, e.min = function(c) {
    return c[0];
  }, e.max = t, e.size = function(c) {
    for (var d = 0, f = 0, p = c.length; f < p; f += 2) d += c[f + 1] - c[f] + 1;
    return d;
  }, e.count = n, e.startAt = r, e.endAt = i, e.minAt = a, e.maxAt = o, e.areEqual = function(c, d) {
    if (c.length !== d.length) return !1;
    for (var f = 0, p = c.length; f < p; ++f) if (c[f] !== d[f]) return !1;
    return !0;
  }, e.forEach = function(c, d) {
    for (var f = 0, p = 0, g = c.length; p < g; p += 2) for (var m = c[p], v = c[p + 1]; m <= v; ++m) d(m, f), ++f;
  }, e.has = function(c, d) {
    return s(c, d) !== -1;
  }, e.hasFrom = function(c, d, f) {
    return u(c, d, f) !== -1;
  }, e.firstIntersectionIndex = s, e.firstIntersectionIndexFrom = u, e.transientSegments = function(c, d) {
    return new l(c, d);
  };
  var l = function() {
    function c(d, f) {
      this.ranges = d, this.set = f, this.value = { index: 0, start: 0, end: 0 }, this.curIndex = 0, this.hasNext = !1, this.curIndex = s(d, f), this.hasNext = this.curIndex !== -1;
    }
    return c.prototype.updateValue = function() {
      this.value.index = this.curIndex, this.value.start = _e.findPredecessorIndex(this.set, r(this.ranges, this.curIndex)), this.value.end = _e.findPredecessorIndex(this.set, i(this.ranges, this.curIndex));
    }, c.prototype.move = function() {
      return this.hasNext && (this.updateValue(), this.curIndex = u(this.ranges, this.set, this.curIndex + 1), this.hasNext = this.curIndex !== -1), this.value;
    }, c;
  }();
  e.Iterator = l;
}(Zn || (Zn = {}));
var rC = A.zero();
function iC(e) {
  var t = function(n) {
    for (var r = n.conformation.invariantPosition, i = n.elements, a = new Float32Array(3 * i.length), o = 0, s = i.length; o < s; o++) r(i[o], rC), A.toArray(rC, a, 3 * o);
    return a;
  }(e);
  return Jc.ofPositions(t);
}
var ms = function() {
  function e(t) {
    this.minDist = [], this.maxDist = [], this.extrema = [], this.centroidHelper = new J1(), this.dir = function(n) {
      var r;
      switch (n) {
        case "6":
          r = Re([], Qh, !0);
          break;
        case "14":
          r = Re(Re([], Qh, !0), My, !0);
          break;
        case "26":
          r = Re(Re(Re([], Qh, !0), My, !0), aC, !0);
          break;
        case "98":
          r = Re(Re(Re(Re(Re(Re([], Qh, !0), My, !0), aC, !0), $H, !0), eq, !0), tq, !0);
      }
      return r.map(function(i) {
        var a = A.create(i[0], i[1], i[2]);
        return A.normalize(a, a);
      });
    }(t), this.reset();
  }
  return e.prototype.computeExtrema = function(t, n) {
    var r = A.dot(this.dir[t], n);
    r < this.minDist[t] && (this.minDist[t] = r, A.copy(this.extrema[2 * t], n)), r > this.maxDist[t] && (this.maxDist[t] = r, A.copy(this.extrema[2 * t + 1], n));
  }, e.prototype.computeSphereExtrema = function(t, n, r) {
    var i = A.dot(this.dir[t], n);
    i - r < this.minDist[t] && (this.minDist[t] = i - r, A.scaleAndSub(this.extrema[2 * t], n, this.dir[t], r)), i + r > this.maxDist[t] && (this.maxDist[t] = i + r, A.scaleAndAdd(this.extrema[2 * t + 1], n, this.dir[t], r));
  }, e.prototype.includeSphere = function(t) {
    if (pe.hasExtrema(t) && t.extrema.length > 1) for (var n = 0, r = t.extrema; n < r.length; n++) {
      var i = r[n];
      this.includePosition(i);
    }
    else this.includePositionRadius(t.center, t.radius);
  }, e.prototype.includePosition = function(t) {
    for (var n = 0, r = this.dir.length; n < r; ++n) this.computeExtrema(n, t);
  }, e.prototype.includePositionRadius = function(t, n) {
    for (var r = 0, i = this.dir.length; r < i; ++r) this.computeSphereExtrema(r, t, n);
  }, e.prototype.finishedIncludeStep = function() {
    for (var t = 0; t < this.extrema.length; t++) this.centroidHelper.includeStep(this.extrema[t]);
    this.centroidHelper.finishedIncludeStep();
  }, e.prototype.radiusSphere = function(t) {
    if (pe.hasExtrema(t) && t.extrema.length > 1) for (var n = 0, r = t.extrema; n < r.length; n++) {
      var i = r[n];
      this.radiusPosition(i);
    }
    else this.radiusPositionRadius(t.center, t.radius);
  }, e.prototype.radiusPosition = function(t) {
    this.centroidHelper.radiusStep(t);
  }, e.prototype.radiusPositionRadius = function(t, n) {
    this.centroidHelper.radiusSphereStep(t, n);
  }, e.prototype.getSphere = function(t) {
    return pe.setExtrema(this.centroidHelper.getSphere(t), Re([], this.extrema, !0));
  }, e.prototype.getBox = function(t) {
    return qn.fromVec3Array(t || qn(), this.extrema);
  }, e.prototype.reset = function() {
    for (var t = 0, n = this.dir.length; t < n; ++t) this.minDist[t] = 1 / 0, this.maxDist[t] = -1 / 0, this.extrema[2 * t] = A(), this.extrema[2 * t + 1] = A();
    this.centroidHelper.reset();
  }, e;
}(), Qh = [[1, 0, 0], [0, 1, 0], [0, 0, 1]], My = [[1, 1, 1], [-1, 1, 1], [-1, -1, 1], [1, -1, 1]], aC = [[1, 1, 0], [1, -1, 0], [1, 0, 1], [1, 0, -1], [0, 1, 1], [0, 1, -1]], $H = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [2, 0, 1], [1, 2, 0], [2, 1, 0], [0, 1, -2], [0, 2, -1], [1, 0, -2], [2, 0, -1], [1, -2, 0], [2, -1, 0]], eq = [[1, 1, 2], [2, 1, 1], [1, 2, 1], [1, -1, 2], [1, 1, -2], [1, -1, -2], [2, -1, 1], [2, 1, -1], [2, -1, -1], [1, -2, 1], [1, 2, -1], [1, -2, -1]], tq = [[2, 2, 1], [1, 2, 2], [2, 1, 2], [2, -2, 1], [2, 2, -1], [2, -2, -1], [1, -2, 2], [1, 2, -2], [1, -2, -2], [2, -1, 2], [2, 1, -2], [2, -1, -2]], oC = A.set, nq = new ms("14"), rq = new ms("98"), Jh = A();
function $1(e) {
  var t = e.x, n = e.y, r = e.z, i = e.radius, a = e.indices, o = _e.size(a);
  if (o > 25e4) {
    var s = qn.computeBounding(e);
    return { box: s, sphere: pe.fromBox3D(pe(), s) };
  }
  var u = function(p) {
    return p > 1e4 ? nq : rq;
  }(o);
  u.reset();
  for (var l = 0; l < o; l++) {
    var c = _e.getAt(a, l);
    oC(Jh, t[c], n[c], r[c]), u.includePositionRadius(Jh, i && i[c] || 0);
  }
  for (u.finishedIncludeStep(), l = 0; l < o; l++)
    c = _e.getAt(a, l), oC(Jh, t[c], n[c], r[c]), u.radiusPositionRadius(Jh, i && i[c] || 0);
  var d = u.getSphere();
  if (!i && pe.hasExtrema(d) && o <= d.extrema.length) {
    var f = [];
    for (l = 0; l < o; l++)
      c = _e.getAt(a, l), f.push(A.create(t[c], n[c], r[c]));
    pe.setExtrema(d, f);
  }
  return { box: u.getBox(), sphere: d };
}
var nv, Gi, ve, rv, iq = function() {
  function e() {
    this.data = /* @__PURE__ */ new Map();
  }
  return e.prototype.get = function(t) {
    var n = Me.hashCode(t);
    if (this.data.has(n)) for (var r = 0, i = this.data.get(n); r < i.length; r++) {
      var a = i[r], o = a[0], s = a[1];
      if (Me.areEqual(t, o)) return s;
    }
  }, e.prototype.set = function(t, n) {
    var r = Me.hashCode(t);
    if (this.data.has(r)) {
      for (var i = this.data.get(r), a = 0, o = i; a < o.length; a++) {
        var s = o[a];
        if (Me.areEqual(t, s[0])) return void (s[1] = n);
      }
      i.push([t, n]);
    } else this.data.set(r, [[t, n]]);
  }, e.get = function(t) {
    return t._dynamicPropertyData.ElementSetIntraBondCache || (t._dynamicPropertyData.ElementSetIntraBondCache = new e()), t._dynamicPropertyData.ElementSetIntraBondCache;
  }, e;
}(), S5 = function() {
  function e(t, n, r) {
    this.operatorsProvider = r, this.id = t, this.details = n;
  }
  return Object.defineProperty(e.prototype, "operatorGroups", { get: function() {
    return this._operators || (this._operators = this.operatorsProvider()), this._operators;
  }, enumerable: !1, configurable: !0 }), e;
}();
function aq(e, t, n) {
  if (!e._rowCount) return [];
  for (var r = function(o) {
    for (var s = o.id, u = o.matrix, l = o.vector, c = o._schema, d = /* @__PURE__ */ new Map(), f = 0, p = o._rowCount; f < p; f++) {
      var g = wr.toMat4(ne(), c.matrix.space, u.value(f)), m = wr.toVec3(A(), c.vector.space, l.value(f));
      ne.setTranslation(g, m), ne.setValue(g, 3, 3, 1), d.set(s.value(f), g);
    }
    return d;
  }(n), i = [], a = 0; a < e._rowCount; a++) i[i.length] = oq(e, t, a, r);
  return i;
}
function oq(e, t, n, r) {
  for (var i = e.id.value(n), a = e.details.value(n), o = [], s = t.assembly_id, u = t.oper_expression, l = t.asym_id_list, c = 0, d = t._rowCount; c < d; c++) s.value(c) === i && (o[o.length] = { assemblyId: i, expression: u.value(c), asymIds: l.value(c) });
  return S5.create(i, a, /* @__PURE__ */ function(f, p) {
    return function() {
      for (var g = [], m = 0, v = 0; v < f.length; v++) {
        var h = f[v], y = sq(lq(h.expression)), x = uq(p, y, m, h.assemblyId), S = fr.generators.atoms({ chainTest: fr.pred.and(fr.pred.eq(function(b) {
          return Fe.unit.operator_name(b.element);
        }, lr.DefaultName), fr.pred.inSet(function(b) {
          return Fe.chain.label_asym_id(b.element);
        }, h.asymIds)) });
        g[g.length] = { selector: S, operators: x }, m += x.length;
      }
      return g;
    };
  }(o, r));
}
function sq(e) {
  for (var t = [], n = [], r = 0; r < e.length; r++) n[r] = "";
  return Vk(e, t, e.length - 1, n), t;
}
function Vk(e, t, n, r) {
  if (n < 0) t[t.length] = r.slice(0);
  else for (var i = e[n], a = i.length, o = 0; o < a; o++) r[n] = i[o], Vk(e, t, n - 1, r);
}
function uq(e, t, n, r) {
  for (var i = [], a = n, o = 0, s = t; o < s.length; o++) {
    for (var u = s[o], l = ne.identity(), c = 0; c < u.length; c++) ne.mul(l, l, e.get(u[c]));
    a++, i[i.length] = lr.create("ASM_".concat(a), l, { assembly: { id: r, operId: a, operList: u } });
  }
  return i;
}
function lq(e) {
  for (var t, n = /\(?([^\(\)]+)\)?]*/g, r = [], i = []; t = n.exec(e); ) r[r.length] = t[1];
  return r.forEach(function(a) {
    var o = [];
    a.split(",").forEach(function(s) {
      var u = s.indexOf("-");
      if (u > 0) for (var l = parseInt(s.substring(0, u)), c = parseInt(s.substr(u + 1)), d = l; d <= c; d++) o[o.length] = d.toString();
      else o[o.length] = s.trim();
    }), i[i.length] = o;
  }), i;
}
function cq(e) {
  if (e._rowCount !== 0) {
    for (var t = e.id, n = e.matrix, r = e.vector, i = Zt.struct_ncs_oper.matrix.space, a = Zt.struct_ncs_oper.vector.space, o = [], s = 0; s < e._rowCount; s++) {
      var u = wr.toMat3(pi(), i, n.value(s)), l = wr.toVec3(A(), a, r.value(s));
      if (lr.checkIfRotationAndTranslation(u, l) && (e.code.value(s) !== "given" || pi.isIdentity(u) || A.isZero(l))) {
        var c = t.value(s);
        o[o.length] = lr.ofRotationAndOffset("ncs_".concat(c), u, l, c);
      }
    }
    return o;
  }
}
function dq(e) {
  var t = e.bonds, n = t.b, r = t.edgeProps, i = t.offset;
  r.order;
  for (var a = r.flags, o = e.rings.elementAromaticRingIndices, s = [], u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = function(y, x, S) {
    var b = s.length;
    s.push(Me.ofUnsortedArray([y, x, S])), u.set(Gg(y, x), S), l.has(y) ? l.get(y).push(b) : l.set(y, [b]);
  }, d = 0; d < e.elements.length; d++)
    if (!o.has(d) && !(i[d + 1] - i[d] + 1 < 2)) {
      for (var f = [], p = i[d], g = i[d + 1]; p < g; p++) {
        var m = a[p];
        cn.is(m, 16) && f.push(n[p]);
      }
      if (f.length >= 2) {
        c(d, f[0], f[1]);
        for (var v = 1, h = f.length; v < h; v++) c(d, f[v], f[0]);
      }
    }
  return { getThirdElement: function(y, x) {
    return u.get(Gg(y, x));
  }, getTripletIndices: function(y) {
    return l.get(y);
  }, triplets: s };
}
function Gk() {
  return { result: rv.create(), closeUnitsResult: ad.create(), unitGroupResult: ad.create() };
}
(function(e) {
  e.create = function(t, n, r) {
    return new e(t, n, r);
  };
})(S5 || (S5 = {})), function(e) {
  e.Default = { assemblies: [], spacegroup: za.ZeroP1, isNonStandardCrystalFrame: !1 }, e.findAssembly = function(t, n) {
    var r = n.toLocaleLowerCase(), i = Gi.Provider.get(t);
    return i ? function(a, o) {
      for (var s = 0, u = a.length; s < u; s++) if (o(a[s])) return a[s];
    }(i.assemblies, function(a) {
      return a.id.toLowerCase() === r;
    }) : void 0;
  }, e.getUnitcellLabel = function(t) {
    var n = t.spacegroup, r = n.cell, i = n.name, a = n.num, o = r.size, s = r.anglesInRadians, u = o[0].toFixed(2), l = o[1].toFixed(2), c = o[2].toFixed(2), d = ta(s[0]).toFixed(2), f = ta(s[1]).toFixed(2), p = ta(s[2]).toFixed(2), g = [];
    return g.push("Unit Cell <b>".concat(i, "</b> #").concat(a)), g.push("".concat(u, "×").concat(l, "×").concat(c, " Å")), g.push("α=".concat(d, "° β=").concat(f, "° γ=").concat(p, "°")), g.join(" | ");
  };
}(nv || (nv = {})), function(e) {
  e.Descriptor = { name: "model_symmetry" }, e.Provider = Au.create(e.Descriptor), e.fromData = function(t) {
    var n = aq(t.pdbx_struct_assembly, t.pdbx_struct_assembly_gen, t.pdbx_struct_oper_list), r = function(i, a) {
      if (i._rowCount === 0 || a._rowCount === 0) return za.ZeroP1;
      var o = a.length_a.value(0), s = a.length_b.value(0), u = a.length_c.value(0);
      if (o === 0 || s === 0 || u === 0) return za.ZeroP1;
      var l = a.angle_alpha.value(0), c = a.angle_beta.value(0), d = a.angle_gamma.value(0);
      if (l === 0 || c === 0 || d === 0) return za.ZeroP1;
      var f = function(g) {
        var m = g.Int_Tables_number.value(0), v = g["space_group_name_H-M"].value(0);
        return g.Int_Tables_number.isDefined ? g["space_group_name_H-M"].isDefined ? v : m : v;
      }(i), p = os.create(f, A.create(o, s, u), A.scale(A(), A.create(l, c, d), Math.PI / 180));
      return za.create(p);
    }(t.symmetry, t.cell);
    return { assemblies: n, spacegroup: r, isNonStandardCrystalFrame: (t.atom_sites._rowCount, !1), ncsOperators: cq(t.struct_ncs_oper) };
  }, e.fromCell = function(t, n) {
    var r = os.create("P 1", t, n);
    return { assemblies: [], spacegroup: za.create(r), isNonStandardCrystalFrame: !1 };
  };
}(Gi || (Gi = {})), function(e) {
  function t(h) {
    for (var y = [], x = 0, S = h.length; x < S; x++) y.push(h[x].id);
    return pa(y);
  }
  function n(h) {
    var y = {};
    return { elements: h[0].elements, units: h, get unitIndexMap() {
      return y.unitIndexMap || (y.unitIndexMap = function(x) {
        for (var S = Mu.Mutable(), b = 0, _ = x.length; b < _; b++) S.set(x[b].id, b);
        return S;
      }(h)), y.unitIndexMap;
    }, hashCode: r(h[0]), transformHash: t(h) };
  }
  function r(h) {
    return Bm(h.invariantId, Me.hashCode(h.elements));
  }
  var i;
  e.isAtomic = function(h) {
    return h.kind === 0;
  }, e.isCoarse = function(h) {
    return h.kind === 1 || h.kind === 2;
  }, e.isSpheres = function(h) {
    return h.kind === 1;
  }, e.isGaussians = function(h) {
    return h.kind === 2;
  }, e.create = function(h, y, x, S, b, _, C, w, I) {
    switch (b) {
      case 0:
        return new a(h, y, x, S, _, w, lr.createMapping(C, _.atomicConformation, void 0), I ?? o());
      case 1:
        return f(h, y, x, S, _, 1, w, lr.createMapping(C, _.coarseConformation.spheres, function(M) {
          var E = M.coarseConformation.spheres.radius;
          return function(T) {
            return E[T];
          };
        }(_)), I ?? l());
      case 2:
        return f(h, y, x, S, _, 2, w, lr.createMapping(C, _.coarseConformation.gaussians, function(M) {
          return 0;
        }), I ?? l());
    }
  }, e.SymmetryGroup = n, function(h) {
    h.areInvariantElementsEqual = function(y, x) {
      return y.hashCode === x.hashCode && Me.areEqual(y.elements, x.elements);
    }, h.getUnitSymmetryGroupsIndexMap = function(y) {
      for (var x = Mu.Mutable(), S = 0, b = y.length; S < b; ++S) for (var _ = y[S], C = 0, w = _.units.length; C < w; ++C) x.set(_.units[C].id, S);
      return x;
    };
  }(n = e.SymmetryGroup || (e.SymmetryGroup = {})), e.conformationId = function(h) {
    return e.isAtomic(h) ? h.model.atomicConformation.id : h.model.coarseConformation.id;
  }, e.hashUnit = r, (i = e.Traits || (e.Traits = {})).is = Qi.has, i.create = Qi.create;
  var a = function() {
    function h(y, x, S, b, _, C, w, I) {
      this.kind = 0, this.objectPrimitive = "atomistic", this.id = y, this.invariantId = x, this.chainGroupId = S, this.traits = b, this.model = _, this.elements = C, this.conformation = w, this.residueIndex = _.atomicHierarchy.residueAtomSegments.index, this.chainIndex = _.atomicHierarchy.chainAtomSegments.index, this.props = I;
    }
    return h.prototype.getChild = function(y) {
      return y.length === this.elements.length ? this : new h(this.id, this.invariantId, this.chainGroupId, this.traits, this.model, y, this.conformation, o());
    }, h.prototype.applyOperator = function(y, x, S) {
      S === void 0 && (S = !1);
      var b = S ? x : lr.compose(this.conformation.operator, x);
      return new h(y, this.invariantId, this.chainGroupId, this.traits, this.model, this.elements, lr.createMapping(b, this.model.atomicConformation, this.conformation.r), this.props);
    }, h.prototype.remapModel = function(y, x, S) {
      var b, _;
      S || (S = O(O({}, this.props), { bonds: x && !(!((_ = (b = this.props.bonds) === null || b === void 0 ? void 0 : b.props) === null || _ === void 0) && _.canRemap) ? void 0 : p(this, this.props.bonds, y, x) }), e.isSameConformation(this, y) || (S.boundary = void 0, S.lookup3d = void 0, S.principalAxes = void 0));
      var C = this.conformation.operator, w = Gi.Provider.get(y);
      if (C.spgrOp !== -1 && w && w !== Gi.Provider.get(this.model)) {
        var I = C.hkl, M = I[0], E = I[1], T = I[2], P = w.spacegroup.cell.toFractional, k = A.transformMat4(A(), nr.getCenter(y), P);
        C = za.getSymmetryOperatorRef(w.spacegroup, C.spgrOp, M, E, T, k);
      }
      var D = this.model.atomicConformation !== y.atomicConformation || C !== this.conformation.operator ? lr.createMapping(C, y.atomicConformation) : this.conformation;
      return new h(this.id, this.invariantId, this.chainGroupId, this.traits, y, this.elements, D, S);
    }, Object.defineProperty(h.prototype, "boundary", { get: function() {
      if (this.props.boundary) return this.props.boundary;
      var y = this.model.atomicConformation, x = y.x, S = y.y, b = y.z;
      return this.props.boundary = $1({ x, y: S, z: b, indices: this.elements }), this.props.boundary;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "lookup3d", { get: function() {
      if (this.props.lookup3d) return this.props.lookup3d;
      var y = this.model.atomicConformation, x = y.x, S = y.y, b = y.z;
      return this.props.lookup3d = bf({ x, y: S, z: b, indices: this.elements }, this.boundary), this.props.lookup3d;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "principalAxes", { get: function() {
      return this.props.principalAxes || (this.props.principalAxes = iC(this)), this.props.principalAxes;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "bonds", { get: function() {
      if (this.props.bonds) return this.props.bonds;
      var y = iq.get(this.model), x = y.get(this.elements);
      return x || (x = GH(this), y.set(this.elements, x)), this.props.bonds = x, this.props.bonds;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "rings", { get: function() {
      return this.props.rings || (this.props.rings = tv.create(this)), this.props.rings;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "resonance", { get: function() {
      return this.props.resonance || (this.props.resonance = function(y) {
        return { delocalizedTriplets: dq(y) };
      }(this)), this.props.resonance;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "polymerElements", { get: function() {
      return this.props.polymerElements || (this.props.polymerElements = function(y) {
        for (var x = [], S = y.elements, b = y.model, _ = y.model.atomicHierarchy.residueAtomSegments, C = b.atomicHierarchy.derived.residue.traceElementIndex, w = Zn.transientSegments(y.model.atomicRanges.polymerRanges, S), I = Kt.transientSegments(_, S); w.hasNext; ) {
          var M = w.move();
          for (I.setSegment(M); I.hasNext; ) {
            var E = I.move(), T = E.start, P = E.end, k = E.index;
            if (_e.areIntersecting(le.ofRange(S[T], S[P - 1]), S)) {
              var D = C[k];
              x.push(D === -1 ? _.offsets[k] : D);
            }
          }
        }
        return Me.ofSortedArray(x);
      }(this)), this.props.polymerElements;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "gapElements", { get: function() {
      return this.props.gapElements || (this.props.gapElements = function(y) {
        for (var x = [], S = y.elements, b = y.model, _ = y.residueIndex, C = y.model.atomicHierarchy.residueAtomSegments, w = b.atomicHierarchy.derived.residue.traceElementIndex, I = Zn.transientSegments(y.model.atomicRanges.gapRanges, y.elements); I.hasNext; ) {
          var M = I.move(), E = _[S[M.start]], T = _[S[M.end - 1]], P = w[E], k = w[T];
          x.push(P === -1 ? C.offsets[E] : P), x.push(k === -1 ? C.offsets[T] : k);
        }
        return Me.ofSortedArray(x);
      }(this)), this.props.gapElements;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "nucleotideElements", { get: function() {
      return this.props.nucleotideElements || (this.props.nucleotideElements = function(y) {
        for (var x = [], S = y.elements, b = y.model, _ = b.atomicHierarchy, C = _.chainAtomSegments, w = _.residueAtomSegments, I = b.atomicHierarchy.derived.residue, M = I.moleculeType, E = I.traceElementIndex, T = Kt.transientSegments(C, S), P = Kt.transientSegments(w, S); T.hasNext; ) for (P.setSegment(T.move()); P.hasNext; ) {
          var k = P.move().index;
          if (Nm(M[k])) {
            var D = E[k];
            x.push(D === -1 ? w.offsets[k] : D);
          }
        }
        return Me.ofSortedArray(x);
      }(this)), this.props.nucleotideElements;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "proteinElements", { get: function() {
      return this.props.proteinElements || (this.props.proteinElements = function(y) {
        for (var x = [], S = y.elements, b = y.model, _ = b.atomicHierarchy, C = _.chainAtomSegments, w = _.residueAtomSegments, I = b.atomicHierarchy.derived.residue, M = I.moleculeType, E = I.traceElementIndex, T = Kt.transientSegments(C, S), P = Kt.transientSegments(w, S); T.hasNext; ) for (P.setSegment(T.move()); P.hasNext; ) {
          var k = P.move().index;
          if (Ek(M[k])) {
            var D = E[k];
            x.push(D === -1 ? w.offsets[k] : D);
          }
        }
        return Me.ofSortedArray(x);
      }(this)), this.props.proteinElements;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "residueCount", { get: function() {
      if (this.props.residueCount !== void 0) return this.props.residueCount;
      for (var y = 0, x = Kt.transientSegments(this.model.atomicHierarchy.residueAtomSegments, this.elements); x.hasNext; ) x.move(), y += 1;
      return this.props.residueCount = y, this.props.residueCount;
    }, enumerable: !1, configurable: !0 }), h.prototype.getResidueIndex = function(y) {
      return this.residueIndex[this.elements[y]];
    }, h;
  }();
  function o() {
    return {};
  }
  e.Atomic = a;
  var s = function() {
    function h(y, x, S, b, _, C, w, I, M) {
      this.kind = C, this.objectPrimitive = C === 1 ? "sphere" : "gaussian", this.id = y, this.invariantId = x, this.chainGroupId = S, this.traits = b, this.model = _, this.elements = w, this.conformation = I, this.coarseElements = C === 1 ? _.coarseHierarchy.spheres : _.coarseHierarchy.gaussians, this.coarseConformation = C === 1 ? _.coarseConformation.spheres : _.coarseConformation.gaussians, this.props = M;
    }
    return h.prototype.getChild = function(y) {
      return y.length === this.elements.length ? this : f(this.id, this.invariantId, this.chainGroupId, this.traits, this.model, this.kind, y, this.conformation, l());
    }, h.prototype.applyOperator = function(y, x, S) {
      S === void 0 && (S = !1);
      var b = S ? x : lr.compose(this.conformation.operator, x);
      return f(y, this.invariantId, this.chainGroupId, this.traits, this.model, this.kind, this.elements, lr.createMapping(b, this.getCoarseConformation(), this.conformation.r), this.props);
    }, h.prototype.remapModel = function(y, x, S) {
      var b = this.getCoarseConformation(), _ = u(this.kind, y);
      S || (S = O({}, this.props), e.isSameConformation(this, y) || (S.boundary = void 0, S.lookup3d = void 0, S.principalAxes = void 0));
      var C = b !== _ ? lr.createMapping(this.conformation.operator, _) : this.conformation;
      return new h(this.id, this.invariantId, this.chainGroupId, this.traits, y, this.kind, this.elements, C, S);
    }, Object.defineProperty(h.prototype, "boundary", { get: function() {
      if (this.props.boundary) return this.props.boundary;
      var y = this.getCoarseConformation(), x = y.x, S = y.y, b = y.z;
      return this.props.boundary = $1({ x, y: S, z: b, indices: this.elements }), this.props.boundary;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "lookup3d", { get: function() {
      if (this.props.lookup3d) return this.props.lookup3d;
      var y = this.getCoarseConformation(), x = y.x, S = y.y, b = y.z;
      return this.props.lookup3d = bf({ x, y: S, z: b, indices: this.elements }, this.boundary), this.props.lookup3d;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "principalAxes", { get: function() {
      return this.props.principalAxes || (this.props.principalAxes = iC(this)), this.props.principalAxes;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "polymerElements", { get: function() {
      return this.props.polymerElements || (this.props.polymerElements = QH(this)), this.props.polymerElements;
    }, enumerable: !1, configurable: !0 }), Object.defineProperty(h.prototype, "gapElements", { get: function() {
      return this.props.gapElements || (this.props.gapElements = JH(this)), this.props.gapElements;
    }, enumerable: !1, configurable: !0 }), h.prototype.getCoarseConformation = function() {
      return u(this.kind, this.model);
    }, h;
  }();
  function u(h, y) {
    return h === 1 ? y.coarseConformation.spheres : y.coarseConformation.gaussians;
  }
  function l() {
    return {};
  }
  var c = function(h) {
    function y() {
      return h !== null && h.apply(this, arguments) || this;
    }
    return Zi(y, h), y;
  }(s);
  e.Spheres = c;
  var d = function(h) {
    function y() {
      return h !== null && h.apply(this, arguments) || this;
    }
    return Zi(y, h), y;
  }(s);
  function f(h, y, x, S, b, _, C, w, I) {
    return new s(h, y, x, S, b, _, C, w, I);
  }
  function p(h, y, x, S) {
    var b;
    if (y) {
      if (h.model.atomicConformation.id === x.atomicConformation.id) return y;
      var _ = fi.Provider.get(h.model);
      if (_) {
        var C = fi.Provider.get(x);
        return C && _ !== C ? void 0 : y;
      }
      return !((b = y.props) === null || b === void 0) && b.canRemap || !S || g(h, x) ? y : void 0;
    }
  }
  function g(h, y) {
    var x = nr.CoordinatesHistory.get(nr.getRoot(y));
    if (x) return x.areEqual(h.elements, h.kind, y);
    for (var S = h.elements, b = h.conformation.coordinates, _ = b.x, C = b.y, w = b.z, I = m(h.kind, y), M = I.x, E = I.y, T = I.z, P = 0, k = S.length; P < k; P++) {
      var D = S[P];
      if (_[D] !== M[D] || C[D] !== E[D] || w[D] !== T[D]) return !1;
    }
    return !0;
  }
  function m(h, y) {
    return h === 0 ? y.atomicConformation : h === 1 ? y.coarseConformation.spheres : y.coarseConformation.gaussians;
  }
  function v(h, y) {
    return h === 0 ? y.atomicHierarchy : h === 1 ? y.coarseHierarchy.spheres : y.coarseHierarchy.gaussians;
  }
  e.Gaussians = d, e.areSameChainOperatorGroup = function(h, y) {
    return h.chainGroupId === y.chainGroupId && h.conformation.operator.name === y.conformation.operator.name;
  }, e.areOperatorsEqual = function(h, y) {
    return ne.areEqual(h.conformation.operator.matrix, y.conformation.operator.matrix, 1e-6);
  }, e.areConformationsEqual = function(h, y) {
    return !!Me.areEqual(h.elements, y.elements) && g(h, y.model);
  }, e.isSameConformation = g, e.getModelConformationOfKind = m, e.getConformation = function(h) {
    return m(h.kind, h.model);
  }, e.getModelHierarchyOfKind = v, e.getHierarchy = function(h) {
    return v(h.kind, h.model);
  };
}(ve || (ve = {})), function(e) {
  e.add = function(t, n, r, i) {
    t.indices[t.count] = r, t.units[t.count] = n, t.squaredDistances[t.count] = i, t.count++;
  }, e.create = function() {
    return { count: 0, indices: [], units: [], squaredDistances: [] };
  }, e.copy = function(t, n) {
    for (var r = 0; r < n.count; ++r) t.indices[r] = n.indices[r], t.units[r] = n.units[r], t.squaredDistances[r] = n.squaredDistances[r];
    return t.count = n.count, t;
  };
}(rv || (rv = {}));
var nt, Ma, fq = function() {
  function e(t) {
    this.structure = t, this.pivot = A(), this.findContext = Gk();
    for (var n = t.units, r = t.boundary, i = n.length, a = new Float32Array(i), o = new Float32Array(i), s = new Float32Array(i), u = new Float32Array(i), l = A(), c = 0; c < i; c++) {
      var d = n[c], f = d.boundary.sphere;
      A.transformMat4(l, f.center, d.conformation.operator.matrix), a[c] = l[0], o[c] = l[1], s[c] = l[2], u[c] = f.radius;
    }
    var p = { x: a, y: o, z: s, radius: u, indices: _e.ofBounds(0, i) };
    this.unitLookup = bf(p, r);
  }
  return e.prototype.findUnitIndices = function(t, n, r, i) {
    return this.unitLookup.find(t, n, r, i);
  }, e.prototype.find = function(t, n, r, i, a) {
    return this._find(t, n, r, i, a ?? this.findContext);
  }, e.prototype._find = function(t, n, r, i, a) {
    ad.reset(a.result);
    var o = this.structure.units, s = this.unitLookup.find(t, n, r, i, a.closeUnitsResult);
    if (s.count === 0) return a.result;
    for (var u = 0, l = s.count; u < l; u++) {
      var c = o[s.indices[u]];
      A.set(this.pivot, t, n, r), c.conformation.operator.isIdentity || A.transformMat4(this.pivot, this.pivot, c.conformation.operator.inverse);
      for (var d = c.lookup3d.find(this.pivot[0], this.pivot[1], this.pivot[2], i, a.unitGroupResult), f = 0, p = d.count; f < p; f++) rv.add(a.result, c, d.indices[f], d.squaredDistances[f]);
    }
    return a.result;
  }, e.prototype.findIntoBuilder = function(t, n, r, i, a) {
    var o = this.structure.units, s = this.unitLookup.find(t, n, r, i);
    if (s.count !== 0) for (var u = 0, l = s.count; u < l; u++) {
      var c = o[s.indices[u]];
      A.set(this.pivot, t, n, r), c.conformation.operator.isIdentity || A.transformMat4(this.pivot, this.pivot, c.conformation.operator.inverse);
      var d = c.lookup3d.find(this.pivot[0], this.pivot[1], this.pivot[2], i);
      if (d.count !== 0) {
        var f = c.elements;
        a.beginUnit(c.id);
        for (var p = 0, g = d.count; p < g; p++) a.addElement(f[d.indices[p]]);
        a.commitUnit();
      }
    }
  }, e.prototype.findIntoBuilderIf = function(t, n, r, i, a, o) {
    var s = this.structure.units, u = this.unitLookup.find(t, n, r, i);
    if (u.count !== 0) for (var l = He.create(this.structure), c = 0, d = u.count; c < d; c++) {
      var f = s[u.indices[c]];
      A.set(this.pivot, t, n, r), f.conformation.operator.isIdentity || A.transformMat4(this.pivot, this.pivot, f.conformation.operator.inverse);
      var p = f.lookup3d.find(this.pivot[0], this.pivot[1], this.pivot[2], i);
      if (p.count !== 0) {
        var g = f.elements;
        l.unit = f, a.beginUnit(f.id);
        for (var m = 0, v = p.count; m < v; m++) l.element = g[p.indices[m]], o(l) && a.addElement(l.element);
        a.commitUnit();
      }
    }
  }, e.prototype.findIntoBuilderWithRadius = function(t, n, r, i, a, o, s, u) {
    var l = this.structure.units, c = this.unitLookup.find(t, n, r, o);
    if (c.count !== 0) for (var d = He.create(this.structure), f = i + a + o, p = 0, g = c.count; p < g; p++) {
      var m = l[c.indices[p]];
      A.set(this.pivot, t, n, r), m.conformation.operator.isIdentity || A.transformMat4(this.pivot, this.pivot, m.conformation.operator.inverse);
      var v = m.lookup3d.find(this.pivot[0], this.pivot[1], this.pivot[2], f);
      if (v.count !== 0) {
        var h = m.elements;
        d.unit = m, u.beginUnit(m.id);
        for (var y = 0, x = v.count; y < x; y++) {
          d.element = h[v.indices[y]];
          var S = s(d);
          Math.sqrt(v.squaredDistances[y]) - i - S > o || u.addElement(h[v.indices[y]]);
        }
        u.commitUnit();
      }
    }
  }, e.prototype.check = function(t, n, r, i) {
    var a = this.structure.units, o = this.unitLookup.find(t, n, r, i);
    if (o.count === 0) return !1;
    for (var s = 0, u = o.count; s < u; s++) {
      var l = a[o.indices[s]];
      if (A.set(this.pivot, t, n, r), l.conformation.operator.isIdentity || A.transformMat4(this.pivot, this.pivot, l.conformation.operator.inverse), l.lookup3d.check(this.pivot[0], this.pivot[1], this.pivot[2], i)) return !0;
    }
    return !1;
  }, Object.defineProperty(e.prototype, "boundary", { get: function() {
    return this.structure.boundary;
  }, enumerable: !1, configurable: !0 }), e;
}();
function iv(e, t) {
  if (t.length === 0) return ze.Empty;
  if (t.length === 1) return t[0];
  for (var n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = 0, a = t; i < a.length; i++) for (var o = a[i].units, s = 0, u = o.length; s < u; s++) {
    var l = o[s];
    if (n.has(l.id)) {
      if (r.has(l.id)) continue;
      var c = Me.union(n.get(l.id), l.elements);
      n.set(l.id, c), c.length === e.unitMap.get(l.id).elements.length && r.add(l.id);
    } else n.set(l.id, l.elements), l.elements.length === e.unitMap.get(l.id).elements.length && r.add(l.id);
  }
  var d = e.subsetBuilder(!0);
  return n.forEach(mq, d), d.getStructure();
}
function mq(e, t) {
  this.setUnit(t, e);
}
function H6(e, t) {
  if (e === t) return !0;
  var n, r;
  e.units.length < t.units.length ? (n = e, r = t) : (n = t, r = e);
  for (var i = n.units, a = r.unitMap, o = 0, s = i.length; o < s; o++) {
    var u = i[o];
    if (a.has(u.id)) {
      var l = a.get(u.id);
      if (Me.areIntersecting(u.elements, l.elements)) return !0;
    }
  }
  return !1;
}
function zk(e, t) {
  if (e === t) return ze.Empty;
  if (!H6(e, t)) return e;
  for (var n = e.units, r = t.unitMap, i = [], a = 0, o = n.length; a < o; a++) {
    var s = n[a];
    if (r.has(s.id)) {
      var u = r.get(s.id), l = Me.subtract(s.elements, u.elements);
      l.length > 0 && (i[i.length] = s.getChild(l));
    } else i[i.length] = s;
  }
  return ze.create(i, { parent: e.parent || t.parent });
}
function A5(e) {
  return cn.isCovalent(e.atomicBond.type);
}
function Uk(e, t, n) {
  return { groupedUnits: e, ranges: t, set: n };
}
function Hk(e) {
  return function(t) {
    var n = { hash: t.inputStructure.hashCode, elements: e };
    return nt.Sequence(t.inputStructure, [Ma.toStructure(n, t.inputStructure)]);
  };
}
(function(e) {
  function t(c, d) {
    return { kind: "singletons", source: c, structure: d };
  }
  function n(c, d) {
    return { kind: "sequence", source: c, structures: d };
  }
  function r(c) {
    return t(c, ze.Empty);
  }
  function i(c) {
    return c.kind === "singletons";
  }
  function a(c) {
    return i(c) ? c.structure.units.length === 0 : c.structures.length === 0;
  }
  function o(c) {
    return a(c) ? ze.Empty : i(c) ? c.structure : iv(c.source, c.structures);
  }
  function s(c, d, f) {
    return d.length === 0 ? r(c) : f ? t(c, iv(c, d)) : n(c, d);
  }
  e.Singletons = t, e.Sequence = n, e.Empty = r, e.isSingleton = i, e.isEmpty = a, e.structureCount = function(c) {
    return i(c) ? c.structure.elementCount : c.structures.length;
  }, e.unionStructure = o, e.toLociWithCurrentUnits = function(c) {
    for (var d = [], f = c.source.unitMap, p = 0, g = o(c).units; p < g.length; p++) {
      var m = g[p];
      m === f.get(m.id) ? d[d.length] = { unit: m, indices: _e.ofBounds(0, m.elements.length) } : d[d.length] = { unit: m, indices: _e.ofSortedArray(Me.indicesOf(f.get(m.id).elements, m.elements)) };
    }
    return ke(c.source, d);
  }, e.toLociWithSourceUnits = function(c) {
    for (var d = [], f = c.source.unitMap, p = 0, g = o(c).units; p < g.length; p++) {
      var m = g[p];
      if (f.has(m.id)) {
        var v = f.get(m.id);
        d[d.length] = v === m ? { unit: v, indices: _e.ofBounds(0, v.elements.length) } : { unit: v, indices: _e.ofSortedArray(Me.indicesOf(v.elements, m.elements)) };
      }
    }
    return ke(c.source, d);
  };
  var u = function() {
    function c(d) {
      this.source = d, this.structures = [], this.allSingletons = !0;
    }
    return c.prototype.add = function(d) {
      var f = d.elementCount;
      f !== 0 && (this.structures[this.structures.length] = d, f !== 1 && (this.allSingletons = !1));
    }, c.prototype.getSelection = function() {
      return s(this.source, this.structures, this.allSingletons);
    }, c;
  }(), l = function() {
    function c(d) {
      this.structure = d, this.structures = [], this.allSingletons = !0, this.uniqueSets = L6(ze.hashCode, ze.areUnitIdsAndIndicesEqual);
    }
    return c.prototype.add = function(d) {
      var f = d.elementCount;
      f !== 0 && this.uniqueSets.add(d) && (this.structures[this.structures.length] = d, f !== 1 && (this.allSingletons = !1));
    }, c.prototype.getSelection = function() {
      return s(this.structure, this.structures, this.allSingletons);
    }, c;
  }();
  e.LinearBuilder = function(c) {
    return new u(c);
  }, e.UniqueBuilder = function(c) {
    return new l(c);
  }, e.forEach = function(c, d) {
    var f = 0;
    if (e.isSingleton(c)) for (var p = 0, g = c.structure.units; p < g.length; p++) for (var m = g[p], v = m.elements, h = 0, y = v.length; h < y; h++)
      d(ze.create([m.getChild(Me.ofSingleton(v[h]))], { parent: c.source }), f++);
    else for (var x = 0, S = c.structures; x < S.length; x++)
      d(S[x], f++);
  }, e.withInputStructure = function(c, d) {
    return i(c) ? t(d, c.structure) : n(d, c.structures);
  };
})(nt || (nt = {})), function(e) {
  function t(i) {
    for (var a = [], o = 0, s = i.elements; o < s.length; o++) {
      var u = (x = s[o]).unit, l = x.indices;
      if (_e.size(l) !== 0) {
        var c = [], d = [];
        if (_e.isInterval(l)) _e.size(l) === 1 ? d.push(le.min(l)) : c.push(le.min(l), le.max(l));
        else for (var f = 0, p = l.length; f < p; ) {
          var g = f;
          for (f++; f < p && l[f - 1] + 1 === l[f]; ) f++;
          var m = f;
          if (m - g > 2) c.push(l[g], l[m - 1]);
          else for (var v = g; v < m; v++) d[d.length] = l[v];
        }
        a.push({ unit: u, set: Me.ofSortedArray(d), ranges: Zn.ofSortedRanges(c) });
      }
    }
    for (var h = /* @__PURE__ */ new Map(), y = (f = 0, a.length); f < y; ++f) {
      var x, S, b = Bm(pa((x = a[f]).ranges), pa(x.set));
      h.has(b) ? (S = h.get(b).groupedUnits).has(x.unit.invariantId) ? S.get(x.unit.invariantId).push(x.unit.id) : S.set(x.unit.invariantId, [x.unit.id]) : ((S = /* @__PURE__ */ new Map()).set(x.unit.invariantId, [x.unit.id]), h.set(b, { groupedUnits: S, set: x.set, ranges: x.ranges }));
    }
    var _ = [];
    return h.forEach(function(C) {
      var w = [];
      C.groupedUnits.forEach(function(I) {
        return w.push(Me.ofUnsortedArray(I));
      }), w.sort(function(I, M) {
        return I[0] - M[0];
      }), _.push({ groupedUnits: w, set: C.set, ranges: C.ranges });
    }), { hash: i.structure.hashCode, elements: _ };
  }
  function n(i, a) {
    for (var o = [], s = 0, u = i.length; s < u; ++s) {
      var l = i[s];
      a.unitMap.has(l) && o.push(a.unitMap.get(l));
    }
    return o;
  }
  function r(i) {
    return Ct.internal.generator.bundleElement({ groupedUnits: Ct.core.type.list(i.groupedUnits.map(function(a) {
      return Ct.core.type.list(a);
    })), ranges: Ct.core.type.list(i.ranges), set: Ct.core.type.list(i.set) });
  }
  e.Empty = { hash: -1, elements: [] }, e.fromSubStructure = function(i, a) {
    return t(nt.toLociWithSourceUnits(nt.Singletons(i, a)));
  }, e.fromSelection = function(i) {
    return t(nt.toLociWithSourceUnits(i));
  }, e.fromLoci = t, e.toLoci = function(i, a) {
    i.hash !== -1 && (i.hash, a.hashCode);
    for (var o = [], s = 0, u = i.elements; s < u.length; s++) for (var l = u[s], c = function(p) {
      var g = n(p, a);
      if (g.length === 0) return "continue";
      var m = void 0;
      if (l.ranges.length === 0) m = l.set;
      else if (l.set.length === 0) if (l.ranges.length === 2) m = le.ofRange(l.ranges[0], l.ranges[1]);
      else {
        var v = new Int32Array(Zn.size(l.ranges));
        Zn.forEach(l.ranges, function(_, C) {
          return v[C] = _;
        }), m = Me.ofSortedArray(v);
      }
      else {
        var h = Zn.size(l.ranges), y = new Int32Array(l.set.length + h);
        Zn.forEach(l.ranges, function(_, C) {
          return y[C] = _;
        }), y.set(l.set, h), m = Me.ofUnsortedArray(y);
      }
      for (var x = 0, S = g; x < S.length; x++) {
        var b = S[x];
        o.push({ unit: b, indices: m });
      }
    }, d = 0, f = l.groupedUnits; d < f.length; d++)
      c(f[d]);
    return ke(a, o);
  }, e.toStructure = function(i, a) {
    i.hash !== -1 && (i.hash, a.hashCode);
    for (var o = [], s = 0, u = i.elements; s < u.length; s++) for (var l = u[s], c = function(p) {
      var g = n(p, a);
      if (g.length === 0) return "continue";
      var m = g[0].elements, v = Zn.size(l.ranges), h = l.set.length, y = new Int32Array(h + v), x = void 0;
      if (v === 0) {
        for (var S = 0, b = h; S < b; ++S) y[S] = m[l.set[S]];
        x = Me.ofSortedArray(y);
      } else if (h === 0) Zn.forEach(l.ranges, function(I, M) {
        return y[M] = m[I];
      }), x = Me.ofSortedArray(y);
      else if (Me.min(l.set) > Zn.max(l.ranges)) {
        for (Zn.forEach(l.ranges, function(I, M) {
          return y[M] = m[I];
        }), S = 0, b = h; S < b; ++S) y[S + v] = m[l.set[S]];
        x = Me.ofSortedArray(y);
      } else if (Zn.min(l.ranges) > Me.max(l.set)) {
        for (S = 0, b = h; S < b; ++S) y[S] = m[l.set[S]];
        Zn.forEach(l.ranges, function(I, M) {
          return y[M + h] = m[I];
        }), x = Me.ofSortedArray(y);
      } else {
        for (Zn.forEach(l.ranges, function(I, M) {
          return y[M] = m[I];
        }), S = 0, b = h; S < b; ++S) y[S + v] = m[l.set[S]];
        x = Me.ofUnsortedArray(y);
      }
      for (var _ = 0, C = g; _ < C.length; _++) {
        var w = C[_];
        o.push(w.getChild(x));
      }
    }, d = 0, f = l.groupedUnits; d < f.length; d++)
      c(f[d]);
    return ze.create(o, { parent: a });
  }, e.toExpression = function(i) {
    return Ct.internal.generator.bundle({ elements: Ct.core.type.list(i.elements.map(r)) });
  }, e.areEqual = function(i, a) {
    if (i.elements.length !== a.elements.length) return !1;
    for (var o = 0, s = i.elements.length; o < s; ++o) {
      var u = i.elements[o], l = a.elements[o];
      if (u.groupedUnits.length !== l.groupedUnits.length) return !1;
      for (var c = 0, d = l.groupedUnits.length; c < d; ++c) if (!Me.areEqual(u.groupedUnits[c], l.groupedUnits[c])) return !1;
      if (!Me.areEqual(u.set, l.set) || !Zn.areEqual(u.ranges, l.ranges)) return !1;
    }
    return !0;
  };
}(Ma || (Ma = {}));
var sC, pq = Object.freeze({ __proto__: null, atomicHet: function() {
  return function(e) {
    for (var t = e.inputStructure, n = He.create(t), r = [], i = 0, a = t.units; i < a.length; i++) {
      var o = a[i];
      if (o.kind === 0) {
        n.unit = o;
        var s = o.elements;
        if (n.element = s[0], Fe.entity.type(n) !== "water") {
          if (Fe.entity.type(n) === "polymer") {
            for (var u = Kt.transientSegments(o.model.atomicHierarchy.residueAtomSegments, s), l = 0; u.hasNext; ) l++, u.move();
            if (l >= 8) continue;
          }
          r.push(o);
        }
      }
    }
    return nt.Singletons(t, ze.create(r, { parent: t }));
  };
}, atomicSequence: function() {
  return function(e) {
    for (var t = e.inputStructure, n = He.create(t), r = [], i = 0, a = t.units; i < a.length; i++) {
      var o = a[i];
      if (o.kind === 0) {
        n.unit = o;
        var s = o.elements;
        if (n.element = s[0], Fe.entity.type(n) === "polymer") {
          for (var u = Kt.transientSegments(o.model.atomicHierarchy.residueAtomSegments, s), l = 0; u.hasNext; ) l++, u.move();
          l < 8 || r.push(o);
        }
      }
    }
    return nt.Singletons(t, ze.create(r, { parent: t }));
  };
}, bundleElementImpl: Uk, bundleGenerator: Hk, defaultBondTest: A5, spheres: function() {
  return function(e) {
    for (var t = e.inputStructure, n = [], r = 0, i = t.units; r < i.length; r++) {
      var a = i[r];
      a.kind === 1 && n.push(a);
    }
    return nt.Singletons(t, ze.create(n, { parent: t }));
  };
}, water: function() {
  return function(e) {
    for (var t = e.inputStructure, n = He.create(t), r = [], i = 0, a = t.units; i < a.length; i++) {
      var o = a[i];
      if (o.kind === 0) {
        n.unit = o;
        var s = o.elements;
        n.element = s[0], Fe.entity.type(n) === "water" && r.push(o);
      }
    }
    return nt.Singletons(t, ze.create(r, { parent: t }));
  };
} }), xf = function() {
  function e(t, n) {
    this.currentElementStack = [], this.currentAtomicBondStack = [], this.currentStructureStack = [], this.inputStructureStack = [], this.timeCreated = Wr(), this.element = He.create(void 0), this.currentStructure = void 0, this.atomicBond = new uC(), this.currentSelection = void 0, this.inputStructure = t, this.timeoutMs = n && n.timeoutMs || 0, this.currentSelection = n && n.currentSelection;
  }
  return e.prototype.pushCurrentElement = function() {
    return this.currentElementStack[this.currentElementStack.length] = this.element, this.element = He.create(void 0), this.element;
  }, e.prototype.popCurrentElement = function() {
    this.element = this.currentElementStack.pop();
  }, e.prototype.pushCurrentBond = function() {
    return this.atomicBond && this.currentAtomicBondStack.push(this.atomicBond), this.atomicBond = new uC(), this.atomicBond;
  }, e.prototype.popCurrentBond = function() {
    this.currentAtomicBondStack.length > 0 ? this.atomicBond = this.currentAtomicBondStack.pop() : this.atomicBond = void 0;
  }, e.prototype.pushCurrentStructure = function() {
    this.currentStructure && this.currentStructureStack.push(this.currentStructure);
  }, e.prototype.popCurrentStructure = function() {
    this.currentStructureStack.length ? this.currentStructure = this.currentStructureStack.pop() : this.currentStructure = void 0;
  }, e.prototype.pushInputStructure = function(t) {
    this.inputStructureStack.push(this.inputStructure), this.inputStructure = t;
  }, e.prototype.popInputStructure = function() {
    if (this.inputStructureStack.length === 0) throw new Error("Must push before pop.");
    this.inputStructure = this.inputStructureStack.pop();
  }, e.prototype.throwIfTimedOut = function() {
    if (this.timeoutMs !== 0 && Wr() - this.timeCreated > this.timeoutMs) throw new Error("The query took too long to execute (> ".concat(this.timeoutMs / 1e3, "s)."));
  }, e.prototype.tryGetCurrentSelection = function() {
    if (!this.currentSelection) throw new Error("The current selection is not assigned.");
    return this.currentSelection;
  }, e;
}(), uC = function() {
  function e() {
    this.a = He.create(void 0), this.aIndex = 0, this.b = He.create(void 0), this.bIndex = 0, this.type = 0, this.order = 0, this.testFn = A5;
  }
  return e.prototype.setStructure = function(t) {
    this.a.structure = t, this.b.structure = t;
  }, e.prototype.setTestFn = function(t) {
    this.testFn = t || A5;
  }, e.prototype.test = function(t, n) {
    return !!this.testFn(t) || !!n && (this.swap(), this.testFn(t));
  }, e.prototype.swap = function() {
    var t = this.aIndex;
    this.aIndex = this.bIndex, this.bIndex = t;
    var n = this.a.unit;
    this.a.unit = this.b.unit, this.b.unit = n;
    var r = this.a.element;
    this.a.element = this.b.element, this.b.element = r;
  }, Object.defineProperty(e.prototype, "length", { get: function() {
    return He.distance(this.a, this.b);
  }, enumerable: !1, configurable: !0 }), e;
}();
(function(e) {
  e.run = function(t, n, r) {
    return t(new xf(n, r));
  };
})(sC || (sC = {}));
var Ey = function() {
  function e(t) {
    this.source = t, this.set = L6(ze.hashCode, ze.areUnitIdsAndIndicesEqual), this.structures = [], this.allSingletons = !0;
  }
  return e.prototype.add = function(t) {
    t.elementCount && (t.elementCount !== 1 && (this.allSingletons = !1), this.set.add(t) && (this.structures[this.structures.length] = t));
  }, e.prototype.getSelection = function() {
    return this.allSingletons ? nt.Singletons(this.source, iv(this.source, this.structures)) : nt.Sequence(this.source, this.structures);
  }, e;
}(), hq = function() {
  function e(t) {
    this.source = t, this.builders = [], this.builderMap = /* @__PURE__ */ new Map();
  }
  return e.prototype.add = function(t, n, r) {
    var i = this.builderMap.get(t);
    i || (i = this.source.subsetBuilder(!0), this.builders[this.builders.length] = i, this.builderMap.set(t, i)), i.addToUnit(n, r);
  }, e.prototype.allSingletons = function() {
    for (var t = 0, n = this.builders.length; t < n; t++) if (this.builders[t].elementCount > 1) return !1;
    return !0;
  }, e.prototype.singletonSelection = function() {
    for (var t = this.source.subsetBuilder(!0), n = He.create(this.source), r = 0, i = this.builders.length; r < i; r++) this.builders[r].setSingletonLocation(n), t.addToUnit(n.unit.id, n.element);
    return nt.Singletons(this.source, t.getStructure());
  }, e.prototype.fullSelection = function() {
    for (var t = new Array(this.builders.length), n = 0, r = this.builders.length; n < r; n++) t[n] = this.builders[n].getStructure();
    return nt.Sequence(this.source, t);
  }, e.prototype.getSelection = function() {
    return this.builders.length === 0 ? nt.Empty(this.source) : this.allSingletons() ? this.singletonSelection() : this.fullSelection();
  }, e;
}(), w5 = function(e) {
  return nt.Sequence(e.inputStructure, []);
}, qk = function(e) {
  return nt.Singletons(e.inputStructure, e.inputStructure);
};
function lc(e) {
  return !0;
}
function gq(e) {
  return 0;
}
function Ty(e) {
  if (!(e && (e.atomTest || e.residueTest || e.chainTest || e.entityTest || e.unitTest || e.groupBy))) return qk;
  if (e.atomTest && !e.residueTest && !e.chainTest && !e.entityTest && !e.unitTest && !e.groupBy) return t = e.atomTest, function(r) {
    var i = r.inputStructure, a = i.units, o = r.pushCurrentElement(), s = i.subsetBuilder(!0);
    o.structure = i;
    for (var u = 0, l = a; u < l.length; u++) {
      var c = l[u];
      o.unit = c;
      var d = c.elements;
      s.beginUnit(c.id);
      for (var f = 0, p = d.length; f < p; f++) o.element = d[f], t(r) && s.addElement(o.element);
      s.commitUnit(), r.throwIfTimedOut();
    }
    return r.popCurrentElement(), nt.Singletons(i, s.getStructure());
  };
  var t, n = { unitTest: e.unitTest || lc, entityTest: e.entityTest || lc, chainTest: e.chainTest || lc, residueTest: e.residueTest || lc, atomTest: e.atomTest || lc, groupBy: e.groupBy || gq };
  return e.groupBy ? function(r) {
    var i = r.unitTest, a = r.entityTest, o = r.chainTest, s = r.residueTest, u = r.atomTest, l = r.groupBy;
    return function(c) {
      var d = c.inputStructure, f = d.units, p = c.pushCurrentElement(), g = new hq(d);
      p.structure = d;
      for (var m = 0, v = f; m < v.length; m++) {
        var h = v[m];
        if (p.unit = h, i(c)) {
          var y = h.elements, x = h.model;
          if (h.kind === 0) for (var S = Kt.transientSegments(x.atomicHierarchy.chainAtomSegments, y), b = Kt.transientSegments(x.atomicHierarchy.residueAtomSegments, y); S.hasNext; ) {
            var _ = S.move();
            if (p.element = y[_.start], a(c) && o(c)) for (b.setSegment(_); b.hasNext; ) {
              var C = b.move();
              if (p.element = y[C.start], s(c)) for (var w = C.start, I = C.end; w < I; w++) p.element = y[w], u(c) && g.add(l(c), h.id, p.element);
            }
          }
          else {
            var M = x.coarseHierarchy.spheres.chainElementSegments;
            for (S = Kt.transientSegments(M, y); S.hasNext; )
              if (_ = S.move(), p.element = y[_.start], a(c) && o(c)) for (w = _.start, I = _.end; w < I; w++) p.element = y[w], s(c) && g.add(l(c), h.id, p.element);
          }
          c.throwIfTimedOut();
        }
      }
      return c.popCurrentElement(), g.getSelection();
    };
  }(n) : function(r) {
    var i = r.unitTest, a = r.entityTest, o = r.chainTest, s = r.residueTest, u = r.atomTest;
    return function(l) {
      var c = l.inputStructure, d = c.units, f = l.pushCurrentElement(), p = c.subsetBuilder(!0), g = s === lc && u === lc, m = u === lc;
      f.structure = c;
      for (var v = 0, h = d; v < h.length; v++) {
        var y = h[v];
        if (f.unit = y, i(l)) {
          var x = y.elements, S = y.model;
          if (p.beginUnit(y.id), y.kind === 0) for (var b = Kt.transientSegments(y.model.atomicHierarchy.chainAtomSegments, x), _ = Kt.transientSegments(y.model.atomicHierarchy.residueAtomSegments, x); b.hasNext; ) {
            var C = b.move();
            if (f.element = x[C.start], a(l) && o(l)) if (g) p.addElementRange(x, C.start, C.end);
            else for (_.setSegment(C); _.hasNext; ) {
              var w = _.move();
              if (f.element = x[w.start], s(l)) if (m) p.addElementRange(x, w.start, w.end);
              else for (var I = w.start, M = w.end; I < M; I++) f.element = x[I], u(l) && p.addElement(f.element);
            }
          }
          else {
            var E = S.coarseHierarchy.spheres.chainElementSegments;
            for (b = Kt.transientSegments(E, x); b.hasNext; )
              if (C = b.move(), f.element = x[C.start], a(l) && o(l)) if (g) p.addElementRange(x, C.start, C.end);
              else for (I = C.start, M = C.end; I < M; I++) f.element = x[I], s(l) && p.addElement(f.element);
          }
          p.commitUnit(), l.throwIfTimedOut();
        }
      }
      return l.popCurrentElement(), nt.Singletons(c, p.getStructure());
    };
  }(n);
}
function ky(e, t, n) {
  for (var r = new Int32Array(t.length), i = 0, a = t.length; i < a; i++) r[i] = e.elements[t[i]];
  return ze.create([e.getChild(Me.ofSortedArray(r))], { parent: n });
}
var We, hi, vq = Object.freeze({ __proto__: null, all: qk, atoms: Ty, bondedAtomicPairs: function(e) {
  return function(t) {
    var n = t.inputStructure, r = n.interUnitBonds, i = nt.UniqueBuilder(t.inputStructure);
    t.pushCurrentBond();
    var a = t.atomicBond;
    a.setTestFn(e), a.setStructure(n);
    for (var o = 0, s = n.units; o < s.length; o++) {
      var u = s[o];
      if (u.kind === 0) {
        var l = u.bonds, c = l.offset, d = l.b, f = l.edgeProps, p = f.flags, g = f.order;
        a.a.unit = u, a.b.unit = u;
        for (var m = 0, v = u.elements.length; m < v; m++) {
          a.aIndex = m, a.a.element = u.elements[m];
          for (var h = c[m], y = c[m + 1]; h < y; h++)
            a.bIndex = d[h], a.b.element = u.elements[d[h]], a.type = p[h], a.order = g[h], a.test(t, !1) && ((b = n.subsetBuilder(!1)).beginUnit(u.id), b.addElement(a.a.element), b.addElement(a.b.element), b.commitUnit(), i.add(b.getStructure()));
        }
      }
    }
    for (var x = 0, S = r.edges; x < S.length; x++) {
      var b, _ = S[x];
      a.a.unit = n.unitMap.get(_.unitA), a.a.element = a.a.unit.elements[_.indexA], a.aIndex = _.indexA, a.b.unit = n.unitMap.get(_.unitA), a.b.element = a.b.unit.elements[_.indexB], a.bIndex = _.indexB, a.order = _.props.order, a.type = _.props.flag, a.test(t, !1) && ((b = n.subsetBuilder(!1)).addToUnit(a.a.unit.id, a.a.element), b.addToUnit(a.b.unit.id, a.b.element), i.add(b.getStructure()));
    }
    return t.popCurrentBond(), i.getSelection();
  };
}, chains: function(e) {
  return Ty(O(O({}, e), { groupBy: function(t) {
    return Fe.chain.key(t.element);
  } }));
}, none: w5, querySelection: function(e, t, n) {
  return n === void 0 && (n = !1), function(r) {
    var i = e(r);
    if (nt.structureCount(i) === 0) return i;
    var a = n ? zk(r.inputStructure, nt.unionStructure(i)) : nt.unionStructure(i);
    if (a.elementCount === 0) return nt.Empty(r.inputStructure);
    r.throwIfTimedOut(), r.pushInputStructure(a);
    var o = t(r);
    return r.popInputStructure(), nt.withInputStructure(o, r.inputStructure);
  };
}, residues: function(e) {
  return Ty(O(O({}, e), { groupBy: function(t) {
    return Fe.residue.key(t.element);
  } }));
}, rings: function(e, t) {
  return function(n) {
    var r = n.inputStructure.units, i = nt.LinearBuilder(n.inputStructure);
    if (e && e.length !== 0) {
      for (var a = or.create(), o = 0; o < e.length; o++) or.add(a, e[o], e[o]);
      for (var s = 0, u = r; s < u.length; s++)
        if (h = u[s], ve.isAtomic(h)) for (var l = h.rings, c = 0, d = a.array; c < d.length; c++) {
          var f = d[c];
          if (l.byFingerprint.has(f)) for (var p = 0, g = l.byFingerprint.get(f); p < g.length; p++)
            S = g[p], t && !l.aromaticRings.includes(S) || i.add(ky(h, l.all[S], n.inputStructure));
        }
    } else for (var m = 0, v = r; m < v.length; m++) {
      var h = v[m];
      if (ve.isAtomic(h)) if (t) for (var y = 0, x = h.rings.aromaticRings; y < x.length; y++) {
        var S = x[y];
        i.add(ky(h, h.rings.all[S], n.inputStructure));
      }
      else for (var b = 0, _ = h.rings.all; b < _.length; b++) {
        var S = _[b];
        i.add(ky(h, S, n.inputStructure));
      }
    }
    return i.getSelection();
  };
} }), l3 = function() {
  function e(t) {
    this.parent = t, this.ids = [], this.unitMap = Mu.Mutable(), this.parentId = -1, this.currentUnit = or.create(), this.elementCount = 0;
  }
  return e.prototype.addToUnit = function(t, n) {
    var r = this.unitMap.get(t);
    if (r) or.add(r, n, n) && this.elementCount++;
    else {
      var i = or.create();
      or.add(i, n, n), this.unitMap.set(t, i), this.ids[this.ids.length] = t, this.elementCount++;
    }
  }, e.prototype.has = function(t, n) {
    var r = this.unitMap.get(t);
    return !!r && or.has(r, n);
  }, e.prototype.beginUnit = function(t) {
    this.parentId = t, this.unitMap.has(t) ? this.currentUnit = this.unitMap.get(t) : this.currentUnit = this.currentUnit.array.length > 0 ? or.create() : this.currentUnit;
  }, e.prototype.addElement = function(t) {
    or.add(this.currentUnit, t, t) && this.elementCount++;
  }, e.prototype.commitUnit = function() {
    this.currentUnit.array.length === 0 || this.unitMap.has(this.parentId) || (this.ids[this.ids.length] = this.parentId, this.unitMap.set(this.parentId, this.currentUnit), this.parentId = -1);
  }, e.prototype.getStructure = function() {
    if (this.isEmpty) return ze.Empty;
    var t = [];
    zs(this.ids);
    for (var n = nm.UnitEquivalenceBuilder(), r = 0, i = this.ids.length; r < i; r++) {
      var a = this.ids[r], o = this.parent.unitMap.get(a), s = this.unitMap.get(a).array, u = s.length;
      if (s.length !== o.elements.length) {
        u > 1 && zs(s);
        var l = o.getChild(Me.ofSortedArray(s)), c = n.add(l.id, l);
        l !== c && (l = c.applyOperator(l.id, l.conformation.operator, !0)), t[t.length] = l;
      } else t[t.length] = o, n.add(o.id, o);
    }
    return ze.create(t, { parent: this.parent });
  }, Object.defineProperty(e.prototype, "isEmpty", { get: function() {
    return this.elementCount === 0;
  }, enumerable: !1, configurable: !0 }), e;
}();
function je(e) {
  return { data: e, position: 0, length: e.length, lineNumber: 1, tokenStart: 0, tokenEnd: 0 };
}
function lC(e) {
  for (; e.position < e.length; ) switch (e.data.charCodeAt(e.position)) {
    case 9:
    case 10:
    case 13:
    case 32:
      return void (e.tokenEnd = e.position);
    default:
      ++e.position;
  }
  e.tokenEnd = e.position;
}
function cC(e) {
  return !(e.length - e.position < 2) && e.data.charCodeAt(e.position + 1) === 39 && e.data.charCodeAt(e.position + 2) === 39;
}
function yq(e, t, n) {
  var r, i = n - t, a = e.tokenStart - t, o = e.tokenEnd - e.tokenStart;
  if (o < i) return !1;
  for (r = t; r < n; ++r) if (e.data.charCodeAt(r) !== e.data.charCodeAt(r + a)) return !1;
  return i === o || e.data.charCodeAt(r + a) === 46;
}
function jk(e) {
  var t;
  for (t = e.tokenStart; t < e.tokenEnd; ++t) if (e.data.charCodeAt(t) === 46) return t;
  return t;
}
function Kk(e, t) {
  return e.data.substring(e.tokenStart, t);
}
function I5(e) {
  return e.data.substring(e.tokenStart, e.tokenEnd);
}
function dC(e) {
  var t = function(r) {
    for (var i = 10; r.position < r.length; ) {
      var a = r.data.charCodeAt(r.position);
      switch (a) {
        case 9:
        case 32:
          i = a, ++r.position;
          break;
        case 10:
          i !== 13 && ++r.lineNumber, i = a, ++r.position;
          break;
        case 13:
          i = a, ++r.position, ++r.lineNumber;
          break;
        default:
          return i;
      }
    }
    return i;
  }(e);
  if (e.position >= e.length) e.tokenType = 6;
  else {
    e.tokenStart = e.position, e.tokenEnd = e.position, e.isEscaped = !1;
    var n = e.data.charCodeAt(e.position);
    switch (n) {
      case 35:
        (function(r) {
          for (; r.position < r.length; ) {
            var i = r.data.charCodeAt(r.position);
            if (i === 10 || i === 13) return;
            ++r.position;
          }
        })(e), e.tokenType = 5;
        break;
      case 39:
        if (cC(e)) {
          (function(r) {
            for (r.position += 3; r.position < r.length; ) {
              if (r.data.charCodeAt(r.position) === 39 && cC(r)) return r.tokenStart += 3, r.tokenEnd = r.position, r.isEscaped = !0, void (r.position += 3);
              ++r.position;
            }
            r.tokenEnd = r.position;
          })(e), e.tokenType = 3;
          break;
        }
      case 34:
        (function(r, i) {
          var a, o;
          for (++r.position; r.position < r.length; ) if ((o = r.data.charCodeAt(r.position)) === i) switch (a = r.data.charCodeAt(r.position + 1)) {
            case 9:
            case 10:
            case 13:
            case 32:
              return r.tokenStart++, r.tokenEnd = r.position, r.isEscaped = !0, void ++r.position;
            default:
              if (a === void 0) return r.tokenStart++, r.tokenEnd = r.position, r.isEscaped = !0, void ++r.position;
              ++r.position;
          }
          else {
            if (o === 10 || o === 13) return void (r.tokenEnd = r.position);
            ++r.position;
          }
          r.tokenEnd = r.position;
        })(e, n), e.tokenType = 3;
        break;
      case 59:
        t === 10 || t === 13 ? function(r) {
          for (var i, a = 59, o = r.position + 1; o < r.length; ) {
            if ((i = r.data.charCodeAt(o)) === 59 && (a === 10 || a === 13)) {
              for (r.position = o + 1, r.tokenStart++, o--, i = r.data.charCodeAt(o); i === 10 || i === 13; ) o--, i = r.data.charCodeAt(o);
              return r.tokenEnd = o + 1, void (r.isEscaped = !0);
            }
            (i === 13 || i === 10 && a !== 13) && r.lineNumber++, a = i, ++o;
          }
          r.position = o;
        }(e) : lC(e), e.tokenType = 3;
        break;
      default:
        e.isImportGet ? function(r) {
          for (; r.position < r.length; ) {
            if (r.data.charCodeAt(r.position) === 93) return ++r.position, r.tokenEnd = r.position, void (r.isImportGet = !1);
            ++r.position;
          }
        }(e) : lC(e), e.isEscaped ? e.tokenType = 3 : e.data.charCodeAt(e.tokenStart) === 95 ? (e.inSaveFrame && function(r) {
          return r.tokenEnd - r.tokenStart == 11 && r.data.charCodeAt(r.tokenStart + 1) === 105 && r.data.charCodeAt(r.tokenStart + 2) === 109 && r.data.charCodeAt(r.tokenStart + 3) === 112 && r.data.charCodeAt(r.tokenStart + 4) === 111 && r.data.charCodeAt(r.tokenStart + 5) === 114 && r.data.charCodeAt(r.tokenStart + 6) === 116 && r.data.charCodeAt(r.tokenStart + 7) === 46 && r.data.charCodeAt(r.tokenStart + 8) === 103 && r.data.charCodeAt(r.tokenStart + 9) === 101 && r.data.charCodeAt(r.tokenStart + 10) === 116;
        }(e) && (e.isImportGet = !0), e.tokenType = 4) : e.tokenEnd - e.tokenStart >= 5 && e.data.charCodeAt(e.tokenStart + 4) === 95 ? function(r) {
          var i = r.data.charCodeAt(r.tokenStart);
          return !(i !== 68 && i !== 100 || (i = r.data.charCodeAt(r.tokenStart + 1)) !== 65 && i !== 97 || (i = r.data.charCodeAt(r.tokenStart + 2)) !== 84 && i !== 116 || (i = r.data.charCodeAt(r.tokenStart + 3)) !== 65 && i !== 97);
        }(e) ? e.tokenType = 0 : function(r) {
          var i = r.data.charCodeAt(r.tokenStart);
          return !(i !== 83 && i !== 115 || (i = r.data.charCodeAt(r.tokenStart + 1)) !== 65 && i !== 97 || (i = r.data.charCodeAt(r.tokenStart + 2)) !== 86 && i !== 118 || (i = r.data.charCodeAt(r.tokenStart + 3)) !== 69 && i !== 101);
        }(e) ? e.tokenType = 1 : function(r) {
          if (r.tokenEnd - r.tokenStart != 5) return !1;
          var i = r.data.charCodeAt(r.tokenStart);
          return !(i !== 76 && i !== 108 || (i = r.data.charCodeAt(r.tokenStart + 1)) !== 79 && i !== 111 || (i = r.data.charCodeAt(r.tokenStart + 2)) !== 79 && i !== 111 || (i = r.data.charCodeAt(r.tokenStart + 3)) !== 80 && i !== 112);
        }(e) ? e.tokenType = 2 : e.tokenType = 3 : e.tokenType = 3;
    }
  }
}
function Dc(e) {
  for (dC(e); e.tokenType === 5; ) dC(e);
}
function $h() {
  return { categoryNames: [], categoryData: /* @__PURE__ */ Object.create(null) };
}
function P5(e, t) {
  for (var n = /* @__PURE__ */ Object.create(null), r = 0, i = e; r < i.length; r++) {
    var a = i[r], o = t[a];
    n[a] = Xi(o.name, o.rowCount, o.fieldNames, o.fields);
  }
  return n;
}
function fC(e, t, n) {
  return R6(e.categoryNames, P5(e.categoryNames, e.categoryData), t, n);
}
function M5(e, t, n, r, i) {
  var a;
  if (t in e.categoryData) {
    var o = e.categoryData[t];
    (a = o.fieldNames).push.apply(a, r), Object.assign(o.fields, i);
  } else e.categoryData[t] = { name: t, rowCount: n, fieldNames: r, fields: i }, e.categoryNames.push(t);
}
function bq(e, t) {
  for (var n = t.tokenizer, r = t.tokens, i = t.fieldCount, a = t.tokenCount, o = 0; n.tokenType === 3 && o < e; ) We.add(r[a++ % i], n.tokenStart, n.tokenEnd), Dc(n), o++;
  return t.tokenCount = a, o;
}
function _q(e, t) {
  return e.update({ message: "Parsing...", current: t.tokenizer.position, max: t.tokenizer.data.length });
}
function xq(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f;
    return ie(this, function(p) {
      switch (p.label) {
        case 0:
          for (n = e.lineNumber, Dc(e), r = Kk(e, jk(e)), i = function(g) {
            var m;
            for (m = g.tokenStart; m < g.tokenEnd; ++m) if (g.data.charCodeAt(m) === 46) return !1;
            return !0;
          }(e), a = []; e.tokenType === 4; ) a[a.length] = i ? I5(e) : I5(e).substring(r.length + 1), Dc(e);
          for (o = r === "_atom_site" ? e.data.length / 100 | 0 : 32, s = [], u = a.length, f = 0; f < u; f++) s[f] = We.create(e.data, o);
          return l = { fieldCount: u, tokenCount: 0, tokenizer: e, tokens: s }, [4, C0(e.runtimeCtx, 1e6, l, bq, _q)];
        case 1:
          if (p.sent(), l.tokenCount % u != 0) return [2, { hasError: !0, errorLine: e.lineNumber, errorMessage: "The number of values for loop starting at line ".concat(n, " is not a multiple of the number of columns.") }];
          if (c = l.tokenCount / u | 0, i) for (f = 0; f < u; f++) d = { "": Ye.ofTokens(s[f]) }, M5(t, a[f].substr(1), c, [""], d);
          else {
            for (d = /* @__PURE__ */ Object.create(null), f = 0; f < u; f++) d[a[f]] = Ye.ofTokens(s[f]);
            M5(t, r.substr(1), c, a, d);
          }
          return [2, { hasError: !1, errorLine: 0, errorMessage: "" }];
      }
    });
  });
}
function Xf(e, t) {
  return hi.error(t, e);
}
function Cq(e) {
  return hi.success(e);
}
function Sq(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d;
    return ie(this, function(f) {
      switch (f.label) {
        case 0:
          n = [], r = function(m, v) {
            return { data: m, length: m.length, position: 0, tokenStart: 0, tokenEnd: 0, tokenType: 6, lineNumber: 1, isEscaped: !1, isImportGet: !1, inSaveFrame: !1, runtimeCtx: v };
          }(e, t), i = "", a = $h(), o = [], s = $h(), p = s.categoryNames, g = P5(s.categoryNames, s.categoryData), u = { categoryNames: p, header: "", categories: g }, l = "", t.update({ message: "Parsing...", current: 0, max: e.length }), Dc(r), f.label = 1;
        case 1:
          return r.tokenType === 6 ? [3, 7] : (c = r.tokenType) !== 0 ? [3, 2] : r.inSaveFrame ? [2, Xf(r.lineNumber, "Unexpected data block inside a save frame.")] : (a.categoryNames.length > 0 && n.push(fC(a, i, o)), i = e.substring(r.tokenStart + 5, r.tokenEnd), a = $h(), o = [], Dc(r), [3, 6]);
        case 2:
          if (c !== 1) return [3, 3];
          if (r.tokenEnd - r.tokenStart == 5) s.categoryNames.length > 0 && (o[o.length] = function(m, v) {
            return R6(m.categoryNames, P5(m.categoryNames, m.categoryData), v);
          }(s, l)), r.inSaveFrame = !1;
          else {
            if (r.inSaveFrame) return [2, Xf(r.lineNumber, "Save frames cannot be nested.")];
            r.inSaveFrame = !0, l = e.substring(r.tokenStart + 5, r.tokenEnd), s = $h();
          }
          return Dc(r), [3, 6];
        case 3:
          return c !== 2 ? [3, 5] : [4, xq(r, r.inSaveFrame ? s : a)];
        case 4:
          return (d = f.sent()).hasError ? [2, Xf(d.errorLine, d.errorMessage)] : [3, 6];
        case 5:
          if (c !== 4) return console.log(r.tokenType, je.getTokenString(r)), [2, Xf(r.lineNumber, "Unexpected token. Expected data_, loop_, or data name.")];
          if (d = function(m, v) {
            for (var h = m.tokenStart, y = jk(m), x = Kk(m, y), S = /* @__PURE__ */ Object.create(null), b = [], _ = !0; _; ) {
              if (m.tokenType !== 4 || !yq(m, h, y)) {
                _ = !1;
                break;
              }
              var C = I5(m).substring(x.length + 1);
              if (Dc(m), m.tokenType !== 3) return { hasError: !0, errorLine: m.lineNumber, errorMessage: "Expected value." };
              S[C] = Ye.ofTokens({ data: m.data, indices: [m.tokenStart, m.tokenEnd], count: 1 }), b[b.length] = C, Dc(m);
            }
            return M5(v, x.substr(1), 1, b, S), { hasError: !1, errorLine: 0, errorMessage: "" };
          }(r, r.inSaveFrame ? s : a), d.hasError) return [2, Xf(d.errorLine, d.errorMessage)];
          f.label = 6;
        case 6:
          return [3, 1];
        case 7:
          return r.inSaveFrame ? [2, Xf(r.lineNumber, "Unfinished save frame (".concat(u.header, ")."))] : ((a.categoryNames.length > 0 || o.length > 0) && n.push(fC(a, i, o)), [2, Cq(lk(n))]);
      }
      var p, g;
    });
  });
}
function Aq(e) {
  var t = this;
  return Xt.create("Parse CIF", function(n) {
    return se(t, 0, void 0, function() {
      return ie(this, function(r) {
        switch (r.label) {
          case 0:
            return [4, Sq(e, n)];
          case 1:
            return [2, r.sent()];
        }
      });
    });
  });
}
function Dy(e, t) {
  for (var n = {}, r = 0; r < t; r++)
    n[av(e)] = av(e);
  return n;
}
function Oy(e, t) {
  for (var n = new Uint8Array(t), r = e.offset, i = 0; i < t; i++) n[i] = e.buffer[i + r];
  return e.offset += t, n;
}
function e2(e, t) {
  var n = XT(e.buffer, e.offset, t);
  return e.offset += t, n;
}
function By(e, t) {
  for (var n = new Array(t), r = 0; r < t; r++) n[r] = av(e);
  return n;
}
function av(e) {
  var t, n, r = e.buffer[e.offset];
  if (!(128 & r)) return e.offset++, r;
  if ((240 & r) == 128) return n = 15 & r, e.offset++, Dy(e, n);
  if ((240 & r) == 144) return n = 15 & r, e.offset++, By(e, n);
  if ((224 & r) == 160) return n = 31 & r, e.offset++, e2(e, n);
  if (!(224 & ~r)) return t = e.dataView.getInt8(e.offset), e.offset++, t;
  switch (r) {
    case 192:
      return e.offset++, null;
    case 194:
      return e.offset++, !1;
    case 195:
      return e.offset++, !0;
    case 196:
      return n = e.dataView.getUint8(e.offset + 1), e.offset += 2, Oy(e, n);
    case 197:
      return n = e.dataView.getUint16(e.offset + 1), e.offset += 3, Oy(e, n);
    case 198:
      return n = e.dataView.getUint32(e.offset + 1), e.offset += 5, Oy(e, n);
    case 202:
      return t = e.dataView.getFloat32(e.offset + 1), e.offset += 5, t;
    case 203:
      return t = e.dataView.getFloat64(e.offset + 1), e.offset += 9, t;
    case 204:
      return t = e.buffer[e.offset + 1], e.offset += 2, t;
    case 205:
      return t = e.dataView.getUint16(e.offset + 1), e.offset += 3, t;
    case 206:
      return t = e.dataView.getUint32(e.offset + 1), e.offset += 5, t;
    case 208:
      return t = e.dataView.getInt8(e.offset + 1), e.offset += 2, t;
    case 209:
      return t = e.dataView.getInt16(e.offset + 1), e.offset += 3, t;
    case 210:
      return t = e.dataView.getInt32(e.offset + 1), e.offset += 5, t;
    case 217:
      return n = e.dataView.getUint8(e.offset + 1), e.offset += 2, e2(e, n);
    case 218:
      return n = e.dataView.getUint16(e.offset + 1), e.offset += 3, e2(e, n);
    case 219:
      return n = e.dataView.getUint32(e.offset + 1), e.offset += 5, e2(e, n);
    case 220:
      return n = e.dataView.getUint16(e.offset + 1), e.offset += 3, By(e, n);
    case 221:
      return n = e.dataView.getUint32(e.offset + 1), e.offset += 5, By(e, n);
    case 222:
      return n = e.dataView.getUint16(e.offset + 1), e.offset += 3, Dy(e, n);
    case 223:
      return n = e.dataView.getUint32(e.offset + 1), e.offset += 5, Dy(e, n);
  }
  throw new Error("Unknown type 0x" + r.toString(16));
}
function wq(e) {
  for (var t = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), r = 0, i = e.columns; r < i.length; r++) {
    var a = i[r];
    t[a.name] = a;
  }
  return { rowCount: e.rowCount, name: e.name.substr(1), fieldNames: e.columns.map(function(o) {
    return o.name;
  }), getField: function(o) {
    var s = t[o];
    if (s) return n[o] || (n[o] = function(u) {
      var l = u.mask ? ev(u.mask) : void 0, c = ev(u.data), d = w6(c), f = d ? l ? function(h) {
        return l[h] === 0 ? "" + c[h] : "";
      } : function(h) {
        return "" + c[h];
      } : l ? function(h) {
        return l[h] === 0 ? c[h] : "";
      } : function(h) {
        return c[h];
      }, p = d ? function(h) {
        return c[h];
      } : function(h) {
        var y = c[h];
        return Qc(y, 0, y.length);
      }, g = d ? function(h) {
        return c[h];
      } : function(h) {
        var y = c[h];
        return sf(y, 0, y.length);
      }, m = l ? function(h) {
        return l[h];
      } : function(h) {
        return 0;
      }, v = c.length;
      return { __array: c, binaryEncoding: u.data.encoding, isDefined: !0, rowCount: v, str: f, int: p, float: g, valueKind: m, areValuesEqual: function(h, y) {
        return c[h] === c[y];
      }, toStringArray: function(h) {
        return Ri(v, f, h);
      }, toIntArray: d ? function(h) {
        return Ug(c, h);
      } : function(h) {
        return Ri(v, p, h);
      }, toFloatArray: d ? function(h) {
        return Ug(c, h);
      } : function(h) {
        return Ri(v, g, h);
      } };
    }(s)), n[o];
  } };
}
function Iq(e) {
  var t = this;
  return Xt.create("Parse BinaryCIF", function(n) {
    return se(t, 0, void 0, function() {
      var r, i, a;
      return ie(this, function(o) {
        r = [0, 3];
        try {
          return i = av({ buffer: s = e, offset: 0, dataView: new DataView(s.buffer) }), function(u, l) {
            for (var c = 0; c < 2; c++) if (u[c] > l[c]) return !1;
            return !0;
          }(r, i.version.match(/(\d)\.(\d)\.\d/).slice(1).map(function(u) {
            return +u;
          })) ? (a = lk(i.dataBlocks.map(function(u) {
            for (var l = /* @__PURE__ */ Object.create(null), c = 0, d = u.categories; c < d.length; c++) {
              var f = d[c];
              l[f.name.substr(1)] = wq(f);
            }
            return R6(u.categories.map(function(p) {
              return p.name.substr(1);
            }), l, u.header);
          })), [2, hi.success(a)]) : [2, hi.error("Unsupported format version. Current ".concat(i.version, ", required ").concat(r.join("."), "."))];
        } catch (u) {
          return [2, hi.error("" + u)];
        }
        var s;
        return [2];
      });
    });
  });
}
(function(e) {
  function t(o) {
    return o.data.substring(o.tokenStart, o.tokenEnd);
  }
  function n(o) {
    for (var s = o.data; o.position < o.length; ) switch (s.charCodeAt(o.position)) {
      case 10:
        return o.tokenEnd = o.position, ++o.position, ++o.lineNumber, !0;
      case 13:
        return o.tokenEnd = o.position, ++o.position, ++o.lineNumber, s.charCodeAt(o.position) === 10 && ++o.position, !0;
      default:
        ++o.position;
    }
    return o.tokenEnd = o.position, o.tokenStart !== o.tokenEnd;
  }
  function r(o) {
    return o.tokenStart = o.position, n(o);
  }
  function i(o, s, u) {
    for (var l = 0, c = 0; c < s; c++) {
      if (!r(o)) return l;
      We.addUnchecked(u, o.tokenStart, o.tokenEnd), l++;
    }
    return l;
  }
  function a(o, s, u) {
    for (var l = o.data, c = s, d = u - 1, f = l.charCodeAt(c); (f === 9 || f === 32) && c <= d; ) f = l.charCodeAt(++c);
    for (f = l.charCodeAt(d); (f === 9 || f === 32) && d >= c; ) f = l.charCodeAt(--d);
    return o.tokenStart = c, o.tokenEnd = d + 1, o.position = u, o;
  }
  e.getTokenString = t, e.reset = function(o) {
    o.position = 0, o.lineNumber = 1, o.tokenStart = 0, o.tokenEnd = 0;
  }, e.eatLine = n, e.markStart = function(o) {
    o.tokenStart = o.position;
  }, e.markLine = r, e.readLine = function(o) {
    return r(o), t(o);
  }, e.readLineTrim = function(o) {
    r(o);
    var s = o.position;
    return a(o, o.tokenStart, o.tokenEnd), o.position = s, t(o);
  }, e.markLines = function(o, s) {
    var u = We.create(o.data, 2 * s);
    return i(o, s, u), u;
  }, e.readLines = function(o, s) {
    for (var u = [], l = 0; l < s; l++) u.push(e.readLine(o));
    return u;
  }, e.readLinesAsync = function(o, s, u, l) {
    return l === void 0 && (l = 1e5), se(this, 0, void 0, function() {
      var c, d, f;
      return ie(this, function(p) {
        switch (p.label) {
          case 0:
            return c = o.length, d = We.create(o.data, 2 * s), f = 0, [4, C0(u, l, o, function(g, m) {
              var v = Math.min(s - f, g);
              return i(m, v, d), f += v, v;
            }, function(g, m) {
              return g.update({ message: "Parsing...", current: m.position, max: c });
            })];
          case 1:
            return p.sent(), [2, d];
        }
      });
    });
  }, e.readAllLines = function(o) {
    for (var s = e(o), u = We.create(s.data, Math.max(o.length / 80, 2)); r(s); ) We.add(u, s.tokenStart, s.tokenEnd);
    return u;
  }, e.readAllLinesAsync = function(o, s, u) {
    return u === void 0 && (u = 1e5), se(this, 0, void 0, function() {
      var l, c;
      return ie(this, function(d) {
        switch (d.label) {
          case 0:
            return l = e(o), c = We.create(l.data, Math.max(o.length / 80, 2)), [4, C0(s, u, l, function(f, p) {
              return function(g, m, v) {
                for (var h = 0, y = 0; y < m; y++) {
                  if (!r(g)) return h;
                  We.add(v, g.tokenStart, g.tokenEnd), h++;
                }
              }(p, f, c), p.position < p.length ? f : 0;
            }, function(f, p) {
              return f.update({ message: "Parsing...", current: p.position, max: length });
            })];
          case 1:
            return d.sent(), [2, c];
        }
      });
    });
  }, e.eatValue = function(o) {
    for (; o.position < o.length; ) switch (o.data.charCodeAt(o.position)) {
      case 9:
      case 10:
      case 13:
      case 32:
        return void (o.tokenEnd = o.position);
      default:
        ++o.position;
    }
    o.tokenEnd = o.position;
  }, e.skipWhitespace = function(o) {
    for (var s = -1; o.position < o.length; ) {
      var u = o.data.charCodeAt(o.position);
      switch (u) {
        case 9:
        case 32:
          s = u, ++o.position;
          break;
        case 10:
          s !== 13 && ++o.lineNumber, s = u, ++o.position;
          break;
        case 13:
          s = u, ++o.position, ++o.lineNumber;
          break;
        default:
          return s;
      }
    }
    return s;
  }, e.trim = a;
})(je || (je = {})), function(e) {
  function t(n, r, i) {
    var a = n;
    a.offset > a.indicesLenMinus2 && function(o) {
      var s = new Uint32Array(1.61 * o.indices.length | 0);
      s.set(o.indices), o.indices = s, o.indicesLenMinus2 = s.length - 2 | 0;
    }(a), a.indices[a.offset++] = r, a.indices[a.offset++] = i, n.count++;
  }
  e.add = t, e.addToken = function(n, r) {
    t(n, r.tokenStart, r.tokenEnd);
  }, e.addUnchecked = function(n, r, i) {
    n.indices[n.offset++] = r, n.indices[n.offset++] = i, n.count++;
  }, e.create = function(n, r) {
    return { data: n, indicesLenMinus2: (r = Math.max(10, r)) - 2 | 0, count: 0, offset: 0, indices: new Uint32Array(r) };
  };
}(We || (We = {})), function(e) {
  e.error = function(r, i) {
    return i === void 0 && (i = -1), new t(r, i);
  }, e.success = function(r, i) {
    return i === void 0 && (i = []), new n(r, i);
  };
  var t = function() {
    function r(i, a) {
      this.message = i, this.line = a, this.isError = !0;
    }
    return r.prototype.toString = function() {
      return this.line >= 0 ? "[Line ".concat(this.line, "] ").concat(this.message) : this.message;
    }, r;
  }();
  e.Error = t;
  var n = function(r, i) {
    this.result = r, this.warnings = i, this.isError = !1;
  };
  e.Success = n;
}(hi || (hi = {}));
var Fm = Q.Schema, _n = Fm.str, Pq = Fm.float, mC = Fm.List, so = Fm.Aliased, $m = Fm.int, Zf = Fm.coord, Mq = { chem_comp: { formula: _n, formula_weight: Pq, id: _n, mon_nstd_parent_comp_id: mC(",", function(e) {
  return e;
}), name: _n, one_letter_code: _n, three_letter_code: _n, type: so(_n), pdbx_synonyms: mC(";", function(e) {
  return e;
}), pdbx_type: _n, pdbx_ambiguous_flag: _n, pdbx_replaced_by: _n, pdbx_replaces: _n, pdbx_formal_charge: $m, pdbx_model_coordinates_details: _n, pdbx_model_coordinates_db_code: _n, pdbx_ideal_coordinates_details: _n, pdbx_ideal_coordinates_missing_flag: so(_n), pdbx_model_coordinates_missing_flag: so(_n), pdbx_initial_date: _n, pdbx_modified_date: _n, pdbx_release_status: so(_n), pdbx_processing_site: so(_n) }, chem_comp_atom: { alt_atom_id: _n, atom_id: _n, charge: $m, model_Cartn_x: Zf, model_Cartn_y: Zf, model_Cartn_z: Zf, comp_id: _n, type_symbol: _n, pdbx_align: $m, pdbx_ordinal: $m, pdbx_model_Cartn_x_ideal: Zf, pdbx_model_Cartn_y_ideal: Zf, pdbx_model_Cartn_z_ideal: Zf, pdbx_stereo_config: so(_n), pdbx_aromatic_flag: so(_n), pdbx_leaving_atom_flag: so(_n) }, chem_comp_bond: { atom_id_1: _n, atom_id_2: _n, comp_id: _n, value_order: so(_n), pdbx_ordinal: $m, pdbx_stereo_config: so(_n), pdbx_aromatic_flag: so(_n) }, pdbx_chem_comp_descriptor: { comp_id: _n, descriptor: _n, type: so(_n), program: _n, program_version: _n }, pdbx_chem_comp_identifier: { comp_id: _n, identifier: _n, type: so(_n), program: _n, program_version: _n } }, c3 = Q.Schema, wt = c3.str, Eq = c3.float, ya = c3.Aliased, Lo = c3.int, Tq = { pdbx_reference_molecule: { prd_id: wt, formula_weight: Eq, formula: wt, type: ya(wt), type_evidence_code: wt, class: ya(wt), class_evidence_code: wt, name: wt, represent_as: ya(wt), chem_comp_id: wt, compound_details: wt, description: wt, representative_PDB_id_code: wt, release_status: ya(wt), replaces: wt, replaced_by: wt }, pdbx_reference_entity_list: { prd_id: wt, ref_entity_id: wt, type: ya(wt), details: wt, component_id: Lo }, pdbx_reference_entity_nonpoly: { prd_id: wt, ref_entity_id: wt, name: wt, chem_comp_id: wt }, pdbx_reference_entity_link: { link_id: Lo, prd_id: wt, details: wt, ref_entity_id_1: wt, ref_entity_id_2: wt, entity_seq_num_1: Lo, entity_seq_num_2: Lo, comp_id_1: wt, comp_id_2: wt, atom_id_1: wt, atom_id_2: wt, value_order: ya(wt), component_1: Lo, component_2: Lo, link_class: ya(wt) }, pdbx_reference_entity_poly_link: { link_id: Lo, prd_id: wt, ref_entity_id: wt, component_id: Lo, entity_seq_num_1: Lo, entity_seq_num_2: Lo, comp_id_1: wt, comp_id_2: wt, atom_id_1: wt, atom_id_2: wt, value_order: ya(wt) }, pdbx_reference_entity_poly: { prd_id: wt, ref_entity_id: wt, type: ya(wt), db_code: wt, db_name: wt }, pdbx_reference_entity_poly_seq: { prd_id: wt, ref_entity_id: wt, mon_id: wt, parent_mon_id: wt, num: Lo, observed: ya(wt), hetero: ya(wt) }, pdbx_reference_entity_sequence: { prd_id: wt, ref_entity_id: wt, type: ya(wt), NRP_flag: ya(wt), one_letter_codes: wt }, pdbx_reference_entity_src_nat: { prd_id: wt, ref_entity_id: wt, ordinal: Lo, organism_scientific: wt, taxid: wt, db_code: wt, db_name: wt }, pdbx_prd_audit: { prd_id: wt, date: wt, processing_site: ya(wt), action_type: ya(wt) } }, Yk = Q.Schema, Hr = Yk.str, kq = { datablock: { id: Hr, description: Hr }, dictionary: { title: Hr, datablock_id: Hr, version: Hr }, dictionary_history: { version: Hr, update: Hr, revision: Hr }, sub_category: { id: Hr, description: Hr }, category_group_list: { id: Hr, parent_id: Hr, description: Hr }, item_type_list: { code: Hr, primitive_code: Hr, construct: Hr, detail: Hr }, item_units_list: { code: Hr, detail: Hr }, item_units_conversion: { from_code: Hr, to_code: Hr, operator: Hr, factor: Yk.float } }, oh = Q.Schema, Lp = oh.str, t2 = oh.int, Hu = oh.float, n2 = oh.Aliased, Ec = oh.Vector;
n2(Lp), n2(Lp), n2(Lp), n2(Lp), Ec(3), Ec(3);
var E5, Cf, Dq = { volume_data_3d_info: { name: Lp, axis_order: Ec(3, t2), origin: Ec(3), dimensions: Ec(3), sample_rate: t2, sample_count: Ec(3, t2), spacegroup_number: t2, spacegroup_cell_size: Ec(3), spacegroup_cell_angles: Ec(3), mean_source: Hu, mean_sampled: Hu, sigma_source: Hu, sigma_sampled: Hu, min_source: Hu, min_sampled: Hu, max_source: Hu, max_sampled: Hu }, volume_data_3d: { values: Hu } }, d3 = Q.Schema, Er = d3.float, Ry = d3.int, tr = d3.str, Oq = { cell: { angle_alpha: Er, angle_beta: Er, angle_gamma: Er, formula_units_z: Ry, length_a: Er, length_b: Er, length_c: Er, volume: Er }, chemical: { melting_point: Er, name_common: tr, name_systematic: tr }, chemical_formula: { moiety: tr, sum: tr, weight: Er }, space_group: { crystal_system: tr, it_number: Ry, "name_h-m_full": tr }, space_group_symop: { operation_xyz: tr }, geom_bond: { atom_site_label_1: tr, atom_site_label_2: tr, distance: Er, publ_flag: tr, site_symmetry_1: tr, site_symmetry_2: tr, valence: Er }, audit: { block_doi: tr }, database_code: { cod: tr, csd: tr, depnum_ccdc_archive: tr, depnum_ccdc_fiz: tr, icsd: tr, mdf: tr, nbs: tr }, atom_site: { adp_type: tr, calc_flag: tr, disorder_assembly: tr, disorder_group: tr, fract_x: Er, fract_y: Er, fract_z: Er, label: tr, occupancy: Er, refinement_flags: tr, site_symmetry_multiplicity: Ry, type_symbol: tr, u_iso_or_equiv: Er }, atom_site_aniso: { label: tr, u_11: Er, u: (0, d3.Matrix)(3, 3), u_12: Er, u_13: Er, u_22: Er, u_23: Er, u_33: Er }, atom_type: { description: tr, symbol: tr }, atom_type_scat: { dispersion_imag: Er, dispersion_real: Er, source: tr } }, Bq = { "cell.formula_units_z": ["cell_formula_units_Z"], "space_group.it_number": ["space_group_IT_number", "symmetry_Int_Tables_number"], "space_group.name_h-m_full": ["symmetry_space_group_name_H-M"], "space_group_symop.operation_xyz": ["symmetry_equiv_pos_as_xyz"], "geom_bond.atom_site_label_1": ["geom_bond_atom_site_id_1"], "geom_bond.atom_site_label_2": ["geom_bond_atom_site_id_2"], "geom_bond.distance": ["geom_bond_dist"], "audit.block_doi": ["audit_block_DOI"], "database_code.cod": ["database_code_COD"], "database_code.csd": ["database_code_CSD"], "database_code.depnum_ccdc_archive": ["database_code_depnum_CCDC_archive"], "database_code.depnum_ccdc_fiz": ["database_code_depnum_CCDC_fiz"], "database_code.icsd": ["database_code_ICSD"], "database_code.mdf": ["database_code_MDF"], "database_code.nbs": ["database_code_NBS"], "atom_site.adp_type": ["atom_site_ADP_type", "atom_site_thermal_displace_type"], "atom_site.label": ["atom_site_id"], "atom_site.site_symmetry_multiplicity": ["atom_site_symmetry_multiplicity"], "atom_site.u_iso_or_equiv": ["atom_site_U_iso_or_equiv"], "atom_site_aniso.label": ["atom_site_anisotrop_id"], "atom_site_aniso.u_11": ["atom_site_aniso_U_11", "atom_site_anisotrop_U_11"], "atom_site_aniso.u_12": ["atom_site_aniso_U_12", "atom_site_anisotrop_U_12"], "atom_site_aniso.u_13": ["atom_site_aniso_U_13", "atom_site_anisotrop_U_13"], "atom_site_aniso.u_22": ["atom_site_aniso_U_22", "atom_site_anisotrop_U_22"], "atom_site_aniso.u_23": ["atom_site_aniso_U_23", "atom_site_anisotrop_U_23"], "atom_site_aniso.u_33": ["atom_site_aniso_U_33", "atom_site_anisotrop_U_33"] }, Wk = function(e) {
  return typeof e == "string" ? Aq(e) : Iq(e);
}, Xk = { mmCIF: function(e) {
  return qd(Zt, e);
}, CCD: function(e) {
  return qd(Mq, e);
}, BIRD: function(e) {
  return qd(Tq, e);
}, dic: function(e) {
  return qd(kq, e);
}, cifCore: function(e) {
  return qd(Oq, e, Bq);
}, densityServer: function(e) {
  return qd(Dq, e);
} }, Rq = { type_symbol: Q.Schema.Aliased(Zt.atom_site.type_symbol), label_atom_id: Zt.atom_site.label_atom_id, auth_atom_id: Zt.atom_site.auth_atom_id, label_alt_id: Zt.atom_site.label_alt_id, label_comp_id: Zt.atom_site.label_comp_id, auth_comp_id: Zt.atom_site.auth_comp_id, pdbx_formal_charge: Zt.atom_site.pdbx_formal_charge, cdr: Zt.atom_site.cdr, B_iso_or_equiv: Zt.atom_site.B_iso_or_equiv, em_confidence: Zt.atom_site.em_confidence }, Lq = { group_PDB: Zt.atom_site.group_PDB, label_seq_id: Zt.atom_site.label_seq_id, auth_seq_id: Zt.atom_site.auth_seq_id, pdbx_PDB_ins_code: Zt.atom_site.pdbx_PDB_ins_code }, Nq = { label_asym_id: Zt.atom_site.label_asym_id, auth_asym_id: Zt.atom_site.auth_asym_id, label_entity_id: Zt.atom_site.label_entity_id };
(function(e) {
  e.EmptyResidueKey = function() {
    return { label_entity_id: "", label_asym_id: "", auth_seq_id: 0, pdbx_PDB_ins_code: void 0 };
  };
})(E5 || (E5 = {})), function(e) {
  function t(r, i) {
    return r.residueAtomSegments.index[r.chainAtomSegments.offsets[i]];
  }
  function n(r, i) {
    return r.residueAtomSegments.index[r.chainAtomSegments.offsets[i + 1] - 1] + 1;
  }
  e.chainStartResidueIndex = t, e.chainEndResidueIndexExcl = n, e.chainResidueCount = function(r, i) {
    return n(r, i) - t(r, i);
  };
}(Cf || (Cf = {}));
var I0, em = { H: 1, D: 1, T: 1, HE: 2, LI: 3, BE: 4, B: 5, C: 6, N: 7, O: 8, F: 9, NE: 10, NA: 11, MG: 12, AL: 13, SI: 14, P: 15, S: 16, CL: 17, AR: 18, K: 19, CA: 20, SC: 21, TI: 22, V: 23, CR: 24, MN: 25, FE: 26, CO: 27, NI: 28, CU: 29, ZN: 30, GA: 31, GE: 32, AS: 33, SE: 34, BR: 35, KR: 36, RB: 37, SR: 38, Y: 39, ZR: 40, NB: 41, MO: 42, TC: 43, RU: 44, RH: 45, PD: 46, AG: 47, CD: 48, IN: 49, SN: 50, SB: 51, TE: 52, I: 53, XE: 54, CS: 55, BA: 56, LA: 57, CE: 58, PR: 59, ND: 60, PM: 61, SM: 62, EU: 63, GD: 64, TB: 65, DY: 66, HO: 67, ER: 68, TM: 69, YB: 70, LU: 71, HF: 72, TA: 73, W: 74, RE: 75, OS: 76, IR: 77, PT: 78, AU: 79, HG: 80, TL: 81, PB: 82, BI: 83, PO: 84, AT: 85, RN: 86, FR: 87, RA: 88, AC: 89, TH: 90, PA: 91, U: 92, NP: 93, PU: 94, AM: 95, CM: 96, BK: 97, CF: 98, ES: 99, FM: 100, MD: 101, NO: 102, LR: 103, RF: 104, DB: 105, SG: 106, BH: 107, HS: 108, MT: 109 }, Fq = { 1: 1.1, 2: 1.4, 3: 1.81, 4: 1.53, 5: 1.92, 6: 1.7, 7: 1.55, 8: 1.52, 9: 1.47, 10: 1.54, 11: 2.27, 12: 1.73, 13: 1.84, 14: 2.1, 15: 1.8, 16: 1.8, 17: 1.75, 18: 1.88, 19: 2.75, 20: 2.31, 21: 2.3, 22: 2.15, 23: 2.05, 24: 2.05, 25: 2.05, 26: 2.05, 27: 2, 28: 2, 29: 2, 30: 2.1, 31: 1.87, 32: 2.11, 33: 1.85, 34: 1.9, 35: 1.83, 36: 2.02, 37: 3.03, 38: 2.49, 39: 2.4, 40: 2.3, 41: 2.15, 42: 2.1, 43: 2.05, 44: 2.05, 45: 2, 46: 2.05, 47: 2.1, 48: 2.2, 49: 2.2, 50: 1.93, 51: 2.17, 52: 2.06, 53: 1.98, 54: 2.16, 55: 3.43, 56: 2.68, 57: 2.5, 58: 2.48, 59: 2.47, 60: 2.45, 61: 2.43, 62: 2.42, 63: 2.4, 64: 2.38, 65: 2.37, 66: 2.35, 67: 2.33, 68: 2.32, 69: 2.3, 70: 2.28, 71: 2.27, 72: 2.25, 73: 2.2, 74: 2.1, 75: 2.05, 76: 2, 77: 2, 78: 2.05, 79: 2.1, 80: 2.05, 81: 1.96, 82: 2.02, 83: 2.07, 84: 1.97, 85: 2.02, 86: 2.2, 87: 3.48, 88: 2.83, 89: 2, 90: 2.4, 91: 2, 92: 2.3, 93: 2, 94: 2, 95: 2, 96: 2, 97: 2, 98: 2, 99: 2, 100: 2, 101: 2, 102: 2, 103: 2, 104: 2, 105: 2, 106: 2, 107: 2, 108: 2, 109: 2 }, Vq = { 1: 1.008, 2: 4.0026, 3: 6.94, 4: 9.0122, 5: 10.81, 6: 10.81, 7: 14.007, 8: 15.999, 9: 18.998, 10: 20.18, 11: 22.99, 12: 24.305, 13: 26.982, 14: 28.085, 15: 30.974, 16: 32.06, 17: 35.45, 18: 39.948, 19: 39.098, 20: 40.078, 21: 44.956, 22: 47.867, 23: 50.942, 24: 51.996, 25: 54.938, 26: 55.845, 27: 58.933, 28: 58.693, 29: 63.546, 30: 65.38, 31: 69.723, 32: 72.63, 33: 74.922, 34: 78.971, 35: 79.904, 36: 83.798, 37: 85.468, 38: 87.62, 39: 88.906, 40: 91.224, 41: 92.906, 42: 95.95, 43: 96.906, 44: 101.07, 45: 102.91, 46: 106.42, 47: 107.87, 48: 112.41, 49: 114.82, 50: 118.71, 51: 121.76, 52: 127.6, 53: 127.6, 54: 131.29, 55: 132.91, 56: 137.33, 57: 138.91, 58: 140.12, 59: 140.91, 60: 144.24, 61: 144.912, 62: 150.36, 63: 151.96, 64: 157.25, 65: 158.93, 66: 162.5, 67: 164.93, 68: 167.26, 69: 168.93, 70: 173.05, 71: 174.97, 72: 178.49, 73: 180.95, 74: 183.84, 75: 186.21, 76: 190.23, 77: 192.22, 78: 195.08, 79: 196.97, 80: 200.59, 81: 204.38, 82: 207.2, 83: 208.98, 84: 1.97, 85: 2.02, 86: 2.2, 87: 3.48, 88: 2.83, 89: 2, 90: 232.04, 91: 231.04, 92: 238.03, 93: 237.048, 94: 244.064, 95: 243.061, 96: 247.07, 97: 247.07, 98: 251.079, 99: 252.083, 100: 257.095, 101: 258.098, 102: 259.101, 103: 262.11, 104: 267.122, 105: 270.131, 106: 271.134, 107: 270.133, 108: 270.134, 109: 278.156 }, Gq = 1.7, zq = 0;
function f3(e) {
  var t = em[e];
  return t === void 0 ? Gq : Fq[t];
}
function P0(e) {
  var t = em[e];
  return t === void 0 ? zq : t;
}
function Zk(e, t, n, r) {
  return { type: e, key: t, elements: n, getIndex: r };
}
function Uq(e, t, n, r, i, a) {
  for (var o = e.residues, s = o.auth_seq_id, u = o.label_seq_id, l = o.pdbx_PDB_ins_code, c = n.endSeqId, d = n.endInsCode, f = n.key, p = n.type, g = t === "label" ? u : s, m = r; m < i; ) {
    var v = g.value(m);
    if (a.type[m] = p, a.key[m] = f, v > c || v === c && l.value(m) === d) break;
    m++;
  }
}
(function(e) {
  e.Descriptor = { name: "model_secondary_structure" }, e.Provider = Au.create(e.Descriptor), e.fromStruct = function(t, n, r) {
    var i = /* @__PURE__ */ new Map(), a = [{ kind: "none" }], o = function(l, c) {
      if (l._rowCount > 0) {
        if (l.beg_label_seq_id.valueKind(0) !== 0 || l.end_label_seq_id.valueKind(0) !== 0) return "auth";
      } else if (c && (c.beg_label_seq_id.valueKind(0) !== 0 || c.end_label_seq_id.valueKind(0) !== 0)) return "auth";
      return "label";
    }(t, n);
    (function(l, c, d, f) {
      if (l._rowCount)
        for (var p = l.beg_label_asym_id, g = l.beg_label_seq_id, m = l.beg_auth_seq_id, v = l.pdbx_beg_PDB_ins_code, h = l.end_label_seq_id, y = l.end_auth_seq_id, x = l.pdbx_end_PDB_ins_code, S = l.pdbx_PDB_helix_class, b = l.conf_type_id, _ = l.details, C = c === "label" ? g : m, w = c === "label" ? h : y, I = 0, M = l._rowCount; I < M; I++) {
          var E = gn.create(S.valueKind(I) === 0 ? gn.SecondaryStructurePdb[S.value(I)] : b.valueKind(I) === 0 ? gn.SecondaryStructureMmcif[b.value(I)] : 536870912), T = { kind: "helix", flags: E, type_id: b.valueKind(I) === 0 ? b.value(I) : "HELIX_P", helix_class: S.value(I), details: _.valueKind(I) === 0 ? _.value(I) : void 0 }, P = { startSeqId: C.value(I), startInsCode: v.value(I), endSeqId: w.value(I), endInsCode: x.value(I), type: E, key: f.length };
          f[f.length] = T;
          var k = p.value(I);
          if (d.has(k)) {
            var D = d.get(k);
            D.has(P.startSeqId) ? D.get(P.startSeqId).push(P) : D.set(P.startSeqId, [P]);
          } else d.set(k, /* @__PURE__ */ new Map([[P.startSeqId, [P]]]));
        }
    })(t, o, i, a), function(l, c, d, f, p) {
      if (l._rowCount)
        for (var g = l.beg_label_asym_id, m = l.beg_label_seq_id, v = l.beg_auth_seq_id, h = l.pdbx_beg_PDB_ins_code, y = l.end_label_seq_id, x = l.end_auth_seq_id, S = l.pdbx_end_PDB_ins_code, b = l.sheet_id, _ = c === "label" ? m : v, C = c === "label" ? y : x, w = /* @__PURE__ */ new Map(), I = f + 1, M = 0, E = l._rowCount; M < E; M++) {
          var T = b.value(M), P = void 0;
          w.has(T) ? P = w.get(T) : (P = I++, w.set(T, P));
          var k = gn.create(8388612), D = { kind: "sheet", flags: k, sheet_id: T, symmetry: void 0 }, B = { startSeqId: _.value(M), startInsCode: h.value(M), endSeqId: C.value(M), endInsCode: S.value(M), type: k, key: p.length };
          p[p.length] = D;
          var L = g.value(M);
          if (d.has(L)) {
            var F = d.get(L);
            F.has(B.startSeqId) ? F.get(B.startSeqId).push(B) : F.set(B.startSeqId, [B]);
          } else d.set(L, /* @__PURE__ */ new Map([[B.startSeqId, [B]]]));
        }
    }(n, o, i, t._rowCount, a);
    var s = r.residues._rowCount, u = { type: new Int32Array(s), key: new Int32Array(s), elements: a };
    return i.size > 0 && function(l, c, d, f) {
      for (var p = l.chainAtomSegments.count, g = l.chains.label_asym_id, m = l.residues, v = m.auth_seq_id, h = m.label_seq_id, y = m.pdbx_PDB_ins_code, x = c === "label" ? h : v, S = 0; S < p; S++) {
        var b = Cf.chainStartResidueIndex(l, S), _ = Cf.chainEndResidueIndexExcl(l, S), C = g.value(S);
        if (d.has(C)) for (var w = d.get(C), I = b; I < _; I++) {
          var M = x.value(I);
          if (w.has(M)) for (var E = 0, T = w.get(M); E < T.length; E++) {
            var P = T[E], k = y.value(I);
            P.startInsCode === k && Uq(l, c, P, I, _, f);
          }
        }
      }
    }(r, o, i, u), Zk(u.type, u.key, u.elements, function(l) {
      return l;
    });
  };
})(I0 || (I0 = {}));
var ed, e0, Hq = { U: Zt.atom_site_anisotrop.U, U_esd: Zt.atom_site_anisotrop.U_esd };
(function(e) {
  e.Schema = Hq, e.Descriptor = { name: "atom_site_anisotrop", cifExport: { prefix: "", categories: [{ name: "atom_site_anisotrop", instance: function(t) {
    return e.Provider.get(t.firstModel) && ur.is(t.firstModel.sourceData) ? Ci.Category.ofTable(t.firstModel.sourceData.data.db.atom_site_anisotrop) : Ci.Category.Empty;
  } }] } }, e.Provider = Au.create(e.Descriptor), e.getElementToAnsiotrop = function(t, n) {
    var r = new Int32Array(t.rowCount);
    r.fill(-1);
    for (var i = 0, a = t.rowCount; i < a; i++) r[t.value(i)] = i;
    var o = new Int32Array(t.rowCount);
    for (o.fill(-1), i = 0, a = n.rowCount; i < a; ++i) {
      var s = r[n.value(i)];
      s !== -1 && (o[s] = i);
    }
    return o;
  }, e.getElementToAnsiotropFromLabel = function(t, n) {
    for (var r = {}, i = 0, a = t.rowCount; i < a; i++) r[t.value(i)] = i;
    var o = new Int32Array(t.rowCount);
    for (o.fill(-1), i = 0, a = n.rowCount; i < a; ++i) {
      var s = r[n.value(i)];
      s !== void 0 && (o[s] = i);
    }
    return o;
  };
})(ed || (ed = {})), function(e) {
  var t, n = "molstar_global_model_transform_info";
  function r(i) {
    return e.Provider.get(i);
  }
  e.Schema = ((t = {})[n] = { matrix: Q.Schema.Matrix(4, 4, Q.Schema.float) }, t), e.Descriptor = Us({ name: n, cifExport: { categories: [{ name: n, instance: function(i) {
    var a = r(i.firstModel);
    if (!a) return Ci.Category.Empty;
    var o = On.ofRows(e.Schema.molstar_global_model_transform_info, [{ matrix: a }]);
    return Ci.Category.ofTable(o);
  } }], prefix: "molstar" } }), e.Provider = Au.create(e.Descriptor), e.attach = function(i, a) {
    i.customProperties.has(e.Descriptor) || i.customProperties.add(e.Descriptor), e.Provider.set(i, a);
  }, e.get = r, e.fromMmCif = function(i) {
    if (ur.is(i.sourceData)) {
      var a = i.sourceData.data.frame.categories[n];
      if (a) {
        var o, s = (o = e.Schema[n], new ck(a, o, !0));
        if (s._rowCount !== 0) return s.matrix.value(0);
      }
    }
  }, e.hasData = function(i) {
    if (!ur.is(i.sourceData)) return !1;
    var a = i.sourceData.data.frame.categories[n];
    return !!a && a.rowCount > 0;
  }, e.writeMmCif = function(i, a) {
    i.writeCategory({ name: n, instance: function() {
      var o = On.ofRows(e.Schema.molstar_global_model_transform_info, [{ matrix: a }]);
      return Ci.Category.ofTable(o);
    } });
  };
}(e0 || (e0 = {})), Zt.atom_site.label_comp_id, Zt.atom_site.label_seq_id, Zt.atom_site.pdbx_PDB_ins_code, Zt.atom_site.label_asym_id, Zt.atom_site.label_entity_id, Zt.atom_site.auth_atom_id, Zt.atom_site.auth_seq_id, Zt.atom_site.auth_asym_id, O(O({}, Zt.chem_comp_bond), { molstar_protonation_variant: Q.Schema.Str() });
var qq = O(O({}, Zt.chem_comp), { type: Q.Schema.Aliased(Q.Schema.str) });
function jq(e, t) {
  var n = t.ihm_model_group, r = t.ihm_model_group_link, i = On.pickRow(r, function(o) {
    return r.model_id.value(o) === e;
  });
  if (i) {
    var a = On.pickRow(n, function(o) {
      return n.id.value(o) === i.group_id;
    });
    if (a) return a.name;
  }
  return "";
}
function pC(e) {
  for (var t = 0, n = e.rowCount; t < n; t++) if (e.valueKind(t) === 0) return !0;
  return !1;
}
function r2(e, t, n) {
  e[t].isDefined && pC(e[t]) || (e[t] = e[n]), e[n].isDefined && pC(e[n]) || (e[n] = e[t]);
}
var ur, Ka = { entry: Zt.entry, struct: Zt.struct, struct_asym: Zt.struct_asym, ihm_model_list: Zt.ihm_model_list, ihm_model_group: Zt.ihm_model_group, ihm_model_group_link: Zt.ihm_model_group_link, entity: Zt.entity, entity_poly: Zt.entity_poly, entity_poly_seq: Zt.entity_poly_seq, pdbx_entity_branch: Zt.pdbx_entity_branch, chem_comp: qq, pdbx_chem_comp_identifier: Zt.pdbx_chem_comp_identifier, atom_site: Zt.atom_site, ihm_sphere_obj_site: Zt.ihm_sphere_obj_site, ihm_gaussian_obj_site: Zt.ihm_gaussian_obj_site, pdbx_unobs_or_zero_occ_residues: Zt.pdbx_unobs_or_zero_occ_residues, pdbx_molecule: Zt.pdbx_molecule };
function pd(e, t) {
  t === void 0 && (t = !1);
  for (var n = /* @__PURE__ */ Object.create(null), r = 0, i = Object.keys(Ka); r < i.length; r++) {
    var a = i[r];
    n[a] = a in e ? e[a] : On.ofUndefinedColumns(Ka[a], 0);
  }
  return t && (n.atom_site = function(o) {
    var s = On.ofColumns(o._schema, o);
    return r2(s, "label_atom_id", "auth_atom_id"), r2(s, "label_comp_id", "auth_comp_id"), r2(s, "label_seq_id", "auth_seq_id"), r2(s, "label_asym_id", "auth_asym_id"), s;
  }(n.atom_site)), n;
}
function Qk(e) {
  var t = ur.fromFrame(e), n = pd(t.data.db, !0);
  return Xt.create("Create mmCIF Model", function(r) {
    return Ul(n, t, r);
  });
}
Gi.Provider.formatRegistry.add("mmCIF", function(e) {
  if (ur.is(e.sourceData)) return Gi.fromData(e.sourceData.data.db);
}), I0.Provider.formatRegistry.add("mmCIF", function(e) {
  if (ur.is(e.sourceData)) {
    var t = e.sourceData.data.db, n = t.struct_conf, r = t.struct_sheet_range;
    return I0.fromStruct(n, r, e.atomicHierarchy);
  }
}), ed.Provider.formatRegistry.add("mmCIF", function(e) {
  if (ur.is(e.sourceData)) {
    var t = e.sourceData.data.db.atom_site_anisotrop;
    return { data: On.ofColumns(ed.Schema, t), elementToAnsiotrop: ed.getElementToAnsiotrop(e.atomicConformation.atomId, t.id) };
  }
}, function(e) {
  return !!ur.is(e.sourceData) && e.sourceData.data.db.atom_site_anisotrop.U.isDefined;
}), w0.Provider.formatRegistry.add("mmCIF", function(e) {
  if (ur.is(e.sourceData)) {
    var t = e.sourceData.data.db.chem_comp_bond;
    if (t._rowCount !== 0) return { data: t, entries: w0.getEntriesFromChemCompBond(t) };
  }
}), wu.Provider.formatRegistry.add("mmCIF", function(e) {
  if (ur.is(e.sourceData)) {
    var t = e.sourceData.data.db.struct_conn;
    if (t._rowCount !== 0) {
      var n = wu.getEntriesFromStructConn(t, e);
      return { data: t, byAtomIndex: wu.getAtomIndexFromEntries(n), entries: n };
    }
  }
}), e0.Provider.formatRegistry.add("mmCIF", e0.fromMmCif, e0.hasData), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "mmCIF";
  }, e.fromFrame = function(t, n, r) {
    return n || (n = Xk.mmCIF(t)), { kind: "mmCIF", name: n._name, data: { db: n, frame: t, source: r } };
  };
}(ur || (ur = {}));
var Ft, Kq = 9, i2 = -27.888, Yq = -0.5, hC = -9.9;
function Wq(e, t, n, r) {
  var i = A.distance(e, r), a = A.distance(t, r), o = A.distance(t, n), s = A.distance(e, n), u = i2 / i - i2 / a + (i2 / o - i2 / s);
  return u < hC ? hC : u;
}
function Xq(e, t, n) {
  for (var r = t.residueIndices, i = t.cIndices, a = t.hIndices, o = t.nIndices, s = t.oIndices, u = e.model.atomicHierarchy.index, l = e.conformation.invariantPosition, c = e.model.atomicHierarchy.derived.residue.traceElementIndex, d = r.length, f = [], p = [], g = [], m = A(), v = A(), h = A(), y = A(), x = A(), S = A(), b = A(), _ = 0, C = r.length; _ < C; ++_) {
    var w = _, I = r[_], M = s[w], E = i[w], T = c[I];
    if (M !== -1 && E !== -1 && u.findAtomOnResidue(I, "OXT") === -1) {
      l(M, m), l(E, v), l(T, h);
      for (var P = n.find(h[0], h[1], h[2], Kq), k = P.indices, D = P.count, B = 0; B < D; ++B) {
        var L = k[B];
        if (L !== w && L - 1 !== w && L + 1 !== w) {
          var F = o[L];
          if (F !== -1) {
            l(F, y);
            var V = a[L];
            if (V === -1) {
              if (L === 0) continue;
              var G = L - 1, H = s[G], q = i[G];
              if (H === -1 || q === -1) continue;
              l(H, b), l(q, S), A.sub(x, S, b);
              var z = A.distance(b, S);
              A.scaleAndAdd(x, y, x, 1 / z);
            } else l(V, x);
            var K = Wq(m, v, y, x);
            K > Yq || (f[f.length] = w, p[p.length] = L, g[g.length] = K);
          }
        }
      }
    }
  }
  return function(Y, Z, X, W) {
    for (var J = new to.DirectedEdgeBuilder(Y, Z, X), $ = new Float32Array(J.slotCount), ee = 0, ce = J.edgeCount; ee < ce; ee++) J.addNextEdge(), J.assignProperty($, W[ee]);
    return J.createGraph({ energies: W });
  }(d, f, p, g);
}
(function(e) {
  e.is = Qi.has, e.create = Qi.create;
})(Ft || (Ft = {}));
var a2 = function(e, t, n) {
  this.partner1 = Math.min(e, t), this.partner2 = Math.max(e, t), this.type = n;
};
function Zq(e, t) {
  if (t.type !== e.type || t.partner1 !== e.firstEnd + 1) return !1;
  if (t.type === 0) {
    if (t.partner2 === e.secondEnd + 1) return !0;
  } else if (t.partner2 === e.secondStart - 1) return !0;
  return !1;
}
function Qq(e, t) {
  return e.type === t.type && t.firstStart - e.firstEnd < 6 && e.firstStart < t.firstStart && t.nextLadder === 0 && (e.type === 0 ? gC(e, t) : gC(t, e));
}
function gC(e, t) {
  return t.secondStart - e.secondEnd > 0 && (t.secondStart - e.secondEnd < 6 && t.firstStart - e.firstEnd < 3 || t.secondStart - e.secondEnd < 3);
}
function vC(e) {
  return Ft.is(e, 8) || Ft.is(e, 1) || Ft.is(e, 16);
}
var tm, Jq = { oldDefinition: N.Boolean(!0, { description: "Whether to use the old DSSP convention for the annotation of turns and helices, causes them to be two residues shorter" }), oldOrdering: N.Boolean(!0, { description: "Alpha-helices are preferred over 3-10 helices" }) };
function Jk(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _;
    return ie(this, function(C) {
      for (n = function(w) {
        for (var I = w.model.atomicHierarchy.index, M = w.proteinElements, E = w.residueIndex, T = M.length, P = new Uint32Array(T), k = new Int32Array(T), D = new Int32Array(T), B = new Int32Array(T), L = new Int32Array(T), F = 0; F < T; ++F) {
          var V = E[M[F]];
          P[F] = V, k[F] = I.findAtomOnResidue(V, "C"), D[F] = I.findAtomOnResidue(V, "H"), B[F] = I.findAtomOnResidue(V, "O"), L[F] = I.findAtomOnResidue(V, "N");
        }
        return { residueIndices: Me.ofSortedArray(P), cIndices: k, hIndices: D, oIndices: B, nIndices: L };
      }(e), r = n.residueIndices, i = function(w, I) {
        for (var M = w.model.atomicConformation, E = M.x, T = M.y, P = M.z, k = w.model.atomicHierarchy.derived.residue.traceElementIndex, D = new Uint32Array(I.length), B = 0, L = I.length; B < L; ++B) D[B] = k[I[B]];
        var F = { x: E, y: T, z: P, indices: Me.ofSortedArray(D) };
        return bf(F, $1(F));
      }(e, r), a = Xq(e, n, i), o = r.length, s = new Uint32Array(o), u = function(w, I) {
        var M = I.cIndices, E = I.nIndices, T = I.residueIndices, P = w.conformation.position, k = w.model.atomicHierarchy.index, D = w.model.atomicHierarchy.derived.residue.traceElementIndex, B = T.length, L = function($, ee) {
          return $ === -1 ? A.setNaN(ee) : P($, ee);
        }, F = A(), V = A(), G = A(), H = A(), q = A(), z = A(), K = A(), Y = A(), Z = A();
        if (B === 0) return { phi: new Float32Array(0), psi: new Float32Array(0) };
        var X = new Float32Array(B - 1), W = new Float32Array(B - 1);
        L(-1, F), L(-1, V), L(-1, G), L(M[0], H), L(D[T[0]], q), L(E[0], z), L(M[1], K), L(D[T[1]], Y), L(E[1], Z);
        for (var J = 0; J < B - 1; ++J) k.findAtomOnResidue(T[J], "OXT") === -1 && (X[J] = ta(A.dihedralAngle(F, z, q, H)), W[J] = ta(A.dihedralAngle(z, q, H, Z)), F = H, V = q, G = z, H = K, q = Y, z = Z, L(M[J + 1], K), L(D[T[J + 1]], Y), L(E[J + 1], Z));
        return { phi: X, psi: W };
      }(e, n), l = [], c = [], d = t.oldDefinition ? tj : rj, f = t.oldOrdering ? nj : ij, function(w) {
        for (var I = w.proteinInfo, M = w.hbonds, E = w.flags, T = [1024, 2048, 4096, 128, 256, 512], P = 0; P < 3; P++) for (var k = 0, D = I.residueIndices.length - 1; k < D; ++k) if (M.getDirectedEdgeIndex(k, k + P + 3) !== -1) if (E[k] |= T[P + 3] | T[P], w.params.oldDefinition) for (var B = 1; B < P + 3; ++B) E[k + B] |= 64 | T[P + 3];
        else for (B = 0; B <= P + 3; ++B) E[k + B] |= 64 | T[P + 3];
      }(p = { params: t, getResidueFlag: d, getFlagName: f, unit: e, proteinInfo: n, flags: s, hbonds: a, torsionAngles: u, ladders: l, bridges: c }), function(w) {
        for (var I = w.proteinInfo, M = w.flags, E = I.residueIndices.length, T = [1024, 2048, 4096, 128, 256, 512], P = [0, 0, 0, 8, 1, 16], k = w.params.oldOrdering ? [4, 3, 5] : [3, 4, 5], D = 0; D < k.length; D++) for (var B = k[D], L = 1, F = E - B; L < F; L++) {
          var V = Ft.create(M[L]), G = Ft.create(M[L - 1]), H = Ft.create(M[L + 1]);
          if (w.params.oldOrdering) {
            if (B === 3 && (Ft.is(V, 1) || Ft.is(H, 1)) || B === 5 && (Ft.is(V, 1) || Ft.is(V, 8) || Ft.is(H, 1) || Ft.is(H, 8))) continue;
          } else if (B === 4 && (Ft.is(V, 8) || Ft.is(H, 8)) || B === 5 && (Ft.is(V, 1) || Ft.is(V, 8) || Ft.is(H, 1) || Ft.is(H, 8))) continue;
          if (Ft.is(V, T[B]) && Ft.is(V, T[B - 3]) && Ft.is(G, T[B]) && Ft.is(G, T[B - 3])) if (w.params.oldDefinition) for (var q = 0; q < B; q++) M[L + q] |= P[B];
          else for (q = -1; q <= B; q++) M[L + q] |= P[B];
        }
      }(p), function(w) {
        var I = w.unit, M = w.flags, E = w.proteinInfo, T = I.conformation.position, P = I.model.atomicHierarchy.derived.residue.traceElementIndex, k = E.residueIndices, D = E.nIndices, B = k.length, L = function(Oe, Ne) {
          return Oe === -1 ? A.setNaN(Ne) : T(Oe, Ne);
        }, F = A(), V = A(), G = A(), H = A(), q = A(), z = A(), K = A();
        e: for (var Y = 2; Y < B - 2; Y++) {
          for (var Z = 0; Z < 4; Z++) {
            var X = Y + Z - 2;
            if (L(P[X], H), L(D[X + 1], q), A.squaredDistance(H, q) > 6.25) continue e;
          }
          var W = k[Y - 2], J = k[Y], $ = k[Y + 2], ee = P[W], ce = P[J], ae = P[$];
          L(ee, F), L(ce, V), L(ae, G), A.sub(z, F, V), A.sub(K, V, G);
          var he = ta(A.angle(z, K));
          he && he > 70 && (M[Y] |= 32);
        }
      }(p), function(w) {
        for (var I, M, E = w.proteinInfo, T = w.hbonds, P = w.flags, k = w.bridges, D = T.offset, B = T.b, L = 0, F = E.residueIndices.length; L < F; ++L) for (var V = D[L], G = D[L + 1]; V < G; V++) {
          var H = B[V];
          L > H || ((I = L + 1) !== (M = H) && T.getDirectedEdgeIndex(M, I + 1) !== -1 && (P[I] |= 2, P[M] |= 2, k[k.length] = new a2(I, M, 0)), (I = L) !== (M = H - 1) && T.getDirectedEdgeIndex(M - 1, I) !== -1 && (P[I] |= 2, P[M] |= 2, k[k.length] = new a2(M, I, 0)), (I = L) !== (M = H) && T.getDirectedEdgeIndex(M, I) !== -1 && (P[I] |= 2, P[M] |= 2, k[k.length] = new a2(M, I, 1)), (I = L + 1) !== (M = H - 1) && T.getDirectedEdgeIndex(M - 1, I + 1) !== -1 && (P[I] |= 2, P[M] |= 2, k[k.length] = new a2(M, I, 1)));
        }
        k.sort(function(q, z) {
          return q.partner1 > z.partner1 ? 1 : q.partner1 < z.partner1 ? -1 : 0;
        });
      }(p), function(w) {
        for (var I = w.bridges, M = w.ladders, E = 0; E < I.length; E++) {
          for (var T = I[E], P = !1, k = 0; k < M.length; k++) {
            var D = M[k];
            Zq(D, T) && (P = !0, D.firstEnd++, T.type === 0 ? D.secondEnd++ : D.secondStart--);
          }
          P || (M[M.length] = { previousLadder: 0, nextLadder: 0, firstStart: T.partner1, firstEnd: T.partner1, secondStart: T.partner2, secondEnd: T.partner2, type: T.type });
        }
        for (var B = 0; B < M.length; B++) for (var L = M[B], F = B; F < M.length; F++) {
          var V = M[F];
          Qq(L, V) && (L.nextLadder = F, V.previousLadder = B);
        }
      }(p), function(w) {
        for (var I = w.ladders, M = w.flags, E = 0; E < I.length; E++) {
          for (var T = I[E], P = T.firstStart; P <= T.firstEnd; P++) {
            var k = T.firstStart - P, D = T.secondStart - k;
            T.firstStart !== T.firstEnd ? (M[P] |= 4, M[D] |= 4) : (!vC(M[P]) && Ft.is(M[P], 4) && (M[P] |= 2), !vC(M[D]) && Ft.is(M[D], 4) && (M[D] |= 2));
          }
          if (T.nextLadder !== 0) {
            var B = I[T.nextLadder];
            for (P = T.firstStart; P <= B.firstEnd; P++) M[P] |= 4;
            if (T.type === 0) for (P = T.secondStart; P <= B.secondEnd; P++) M[P] |= 4;
            else for (P = B.secondEnd; P <= T.secondStart; P++) M[P] |= 4;
          }
        }
      }(p), g = function(w, I) {
        for (var M = new Uint32Array(w.length), E = 0, T = w.length; E < T; ++E) {
          var P = Ft.create(w[E]);
          M[E] = I(P);
        }
        return M;
      }(s, d), m = new Uint32Array(o), v = [], h = [], y = function(w) {
        return Me.indexOf(r, w);
      }, x = 0, S = r.length; x < S; ++x) b = g[x], m[x] = b, _ = d(s[x]), h.length !== 0 && _ === h[h.length - 1].flags || (h[h.length] = $q(ej(b), s[x], d)), v[x] = h.length - 1;
      return [2, Zk(m, v, h, y)];
    });
  });
}
function $q(e, t, n) {
  return e === "helix" ? { kind: "helix", flags: n(t) } : e === "sheet" ? { kind: "sheet", flags: n(t) } : e === "turn" || e === "bend" ? { kind: "turn", flags: n(t) } : { kind: "none" };
}
function ej(e) {
  return e === gn.SecondaryStructureDssp.H || e === gn.SecondaryStructureDssp.G || e === gn.SecondaryStructureDssp.I ? "helix" : e === gn.SecondaryStructureDssp.B || e === gn.SecondaryStructureDssp.E ? "sheet" : e === gn.SecondaryStructureDssp.T ? "turn" : e === gn.SecondaryStructureDssp.S ? "bend" : "none";
}
function tj(e) {
  return Ft.is(e, 1) ? gn.SecondaryStructureDssp.H : Ft.is(e, 4) ? gn.SecondaryStructureDssp.E : Ft.is(e, 2) ? gn.SecondaryStructureDssp.B : Ft.is(e, 8) ? gn.SecondaryStructureDssp.G : Ft.is(e, 16) ? gn.SecondaryStructureDssp.I : Ft.is(e, 64) ? gn.SecondaryStructureDssp.T : Ft.is(e, 32) ? gn.SecondaryStructureDssp.S : 0;
}
function nj(e) {
  return Ft.is(e, 1) ? "H" : Ft.is(e, 4) ? "E" : Ft.is(e, 2) ? "B" : Ft.is(e, 8) ? "G" : Ft.is(e, 16) ? "I" : Ft.is(e, 64) ? "T" : Ft.is(e, 32) ? "S" : "-";
}
function rj(e) {
  return Ft.is(e, 16) ? gn.SecondaryStructureDssp.I : Ft.is(e, 1) ? gn.SecondaryStructureDssp.H : Ft.is(e, 4) ? gn.SecondaryStructureDssp.E : Ft.is(e, 2) ? gn.SecondaryStructureDssp.B : Ft.is(e, 8) ? gn.SecondaryStructureDssp.G : Ft.is(e, 64) ? gn.SecondaryStructureDssp.T : Ft.is(e, 32) ? gn.SecondaryStructureDssp.S : 0;
}
function ij(e) {
  return Ft.is(e, 16) ? "I" : Ft.is(e, 1) ? "H" : Ft.is(e, 4) ? "E" : Ft.is(e, 2) ? "B" : Ft.is(e, 8) ? "G" : Ft.is(e, 64) ? "T" : Ft.is(e, 32) ? "S" : "-";
}
function $k(e) {
  var t = "model";
  if (e) {
    t = "model";
    for (var n = 0, r = e.models.length; n < r; ++n) {
      var i = e.models[n];
      if (!nr.isFromPdbArchive(i) && !nr.hasSecondaryStructure(i)) {
        t = "dssp";
        break;
      }
    }
  }
  return { type: N.MappedStatic(t, { model: N.EmptyGroup({ label: "Model" }), dssp: N.Group(Jq, { label: "DSSP", isFlat: !0 }) }, { options: [["model", "Model"], ["dssp", "DSSP"]] }) };
}
(function(e) {
  function t(n) {
    var r = this, i = n.descriptor.name, a = n.type === "root" ? "inheritedPropertyData" : "currentPropertyData", o = function(u) {
      return i in u[a] || (u[a][i] = { props: O({}, N.getDefaultValues(n.getParams(u))), data: Vc.create(void 0) }), u[a][i];
    }, s = function(u, l, c) {
      var d = o(u);
      u[a][i] = { props: l, data: Vc.withValue(d.data, c) };
    };
    return { label: n.label, descriptor: n.descriptor, isHidden: n.isHidden, getParams: function(u) {
      var l = N.clone(n.getParams(u));
      return N.setDefaultValues(l, o(u).props), l;
    }, defaultParams: n.defaultParams, isApplicable: n.isApplicable, attach: function(u, l, c, d) {
      return c === void 0 && (c = {}), se(r, 0, void 0, function() {
        var f, p, g, m, v, h;
        return ie(this, function(y) {
          switch (y.label) {
            case 0:
              return d && l.customPropertyDescriptors.reference(n.descriptor, !0), n.type === "root" && (l = l.root), f = o(l.root).props, p = o(l), g = N.merge(n.defaultParams, f, c), p.data.value && N.areEqual(n.defaultParams, p.props, g) ? [2] : [4, n.obtain(u, l, g)];
            case 1:
              return m = y.sent(), v = m.value, h = m.assets, l.customPropertyDescriptors.add(n.descriptor), l.customPropertyDescriptors.assets(n.descriptor, h), s(l, g, v), [2];
          }
        });
      });
    }, ref: function(u, l) {
      return u.customPropertyDescriptors.reference(n.descriptor, l);
    }, get: function(u) {
      return o(u).data;
    }, set: function(u, l, c) {
      l === void 0 && (l = {}), n.type === "root" && (u = u.root);
      var d = o(u), f = N.merge(n.defaultParams, d.props, l);
      N.areEqual(n.defaultParams, d.props, f) || (s(u, f, c), u.customPropertyDescriptors.assets(n.descriptor));
    }, props: function(u) {
      return o(u).props;
    } };
  }
  e.createProvider = t, e.createSimple = function(n, r, i) {
    var a = this, o = { value: N.Value(i, { isHidden: !0 }) };
    return t({ label: Su(n), descriptor: Us({ name: n }), isHidden: !0, type: r, defaultParams: o, getParams: function() {
      return { value: N.Value(i, { isHidden: !0 }) };
    }, isApplicable: function() {
      return !0;
    }, obtain: function(s, u, l) {
      return se(a, 0, void 0, function() {
        return ie(this, function(c) {
          return [2, O(O({}, N.getDefaultValues(o)), l)];
        });
      });
    } });
  };
})(tm || (tm = {}));
var yC = $k(), na = tm.createProvider({ label: "Secondary Structure", descriptor: Us({ name: "molstar_computed_secondary_structure" }), type: "root", defaultParams: yC, getParams: $k, isApplicable: function(e) {
  return !0;
}, obtain: function(e, t, n) {
  return se(void 0, 0, void 0, function() {
    var r, i, a;
    return ie(this, function(o) {
      switch (o.label) {
        case 0:
          switch (r = O(O({}, N.getDefaultValues(yC)), n), r.type.name) {
            case "dssp":
              return [3, 1];
            case "model":
              return [3, 3];
          }
          return [3, 5];
        case 1:
          return i = {}, [4, aj(t, r.type.params)];
        case 2:
          return [2, (i.value = o.sent(), i)];
        case 3:
          return a = {}, [4, oj(t)];
        case 4:
          return [2, (a.value = o.sent(), a)];
        case 5:
          return [2];
      }
    });
  });
} });
function aj(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          n = /* @__PURE__ */ new Map(), r = 0, i = e.unitSymmetryGroups.length, s.label = 1;
        case 1:
          return r < i ? (a = e.unitSymmetryGroups[r].units[0], !ve.isAtomic(a) || nr.isCoarseGrained(a.model) ? [3, 3] : [4, Jk(a, t)]) : [3, 4];
        case 2:
          o = s.sent(), n.set(a.invariantId, o), s.label = 3;
        case 3:
          return ++r, [3, 1];
        case 4:
          return [2, n];
      }
    });
  });
}
function oj(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a;
    return ie(this, function(o) {
      switch (o.label) {
        case 0:
          t = /* @__PURE__ */ new Map(), n = 0, r = e.unitSymmetryGroups.length, o.label = 1;
        case 1:
          return n < r ? (i = e.unitSymmetryGroups[n].units[0], ve.isAtomic(i) ? nr.isFromPdbArchive(i.model) || nr.hasSecondaryStructure(i.model) ? [3, 3] : [4, Jk(i, { oldDefinition: !0, oldOrdering: !0 })] : [3, 4]) : [3, 5];
        case 2:
          return a = o.sent(), t.set(i.invariantId, a), [3, 4];
        case 3:
          (a = I0.Provider.get(i.model)) && t.set(i.invariantId, a), o.label = 4;
        case 4:
          return ++n, [3, 1];
        case 5:
          return [2, t];
      }
    });
  });
}
function mr() {
  throw new Error("Property only available for atomic models.");
}
function qu(e) {
  throw e ? new Error("Property only available for coarse models (".concat(e, ").")) : new Error("Property only available for coarse models.");
}
var Np = { key: function(e) {
  return e.element;
}, x: function(e) {
  return e.unit.conformation.x(e.element);
}, y: function(e) {
  return e.unit.conformation.y(e.element);
}, z: function(e) {
  return e.unit.conformation.z(e.element);
}, id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicConformation.atomId.value(e.element) : mr();
}, occupancy: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicConformation.occupancy.value(e.element) : mr();
}, B_iso_or_equiv: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicConformation.B_iso_or_equiv.value(e.element) : mr();
}, sourceIndex: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atomSourceIndex.value(e.element) : e.element;
}, type_symbol: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element) : mr();
}, label_atom_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.label_atom_id.value(e.element) : mr();
}, auth_atom_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.auth_atom_id.value(e.element) : mr();
}, label_alt_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.label_alt_id.value(e.element) : mr();
}, label_comp_id: q6, auth_comp_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.auth_comp_id.value(e.element) : mr();
}, pdbx_formal_charge: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.element) : mr();
}, vdw_radius: function(e) {
  return ve.isAtomic(e.unit) ? f3(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element)) : mr();
}, cdr: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.cdr.value(e.element) : mr();
}, em_confidence: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.atoms.em_confidence.value(e.element) : mr();
} };
function q6(e) {
  return ve.isAtomic(e.unit) || mr(), e.unit.model.atomicHierarchy.atoms.label_comp_id.value(e.element);
}
function T5(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.residues.label_seq_id.value(e.unit.residueIndex[e.element]) : mr();
}
function bC(e) {
  ve.isAtomic(e.unit) || mr();
  var t = e.unit.model.sequence.byEntityKey[xa(e)];
  return t && t.sequence.microHet.get(T5(e)) || [q6(e)];
}
var sj = { key: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.residueIndex[e.element] : mr();
}, group_PDB: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.residues.group_PDB.value(e.unit.residueIndex[e.element]) : mr();
}, label_seq_id: T5, auth_seq_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.residues.auth_seq_id.value(e.unit.residueIndex[e.element]) : mr();
}, pdbx_PDB_ins_code: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.unit.residueIndex[e.element]) : mr();
}, isNonStandard: function(e) {
  return ve.isAtomic(e.unit) ? bC(e).some(function(t) {
    return e.unit.model.properties.chemicalComponentMap.get(t).mon_nstd_flag[0] === "n";
  }) : mr();
}, hasMicroheterogeneity: function(e) {
  ve.isAtomic(e.unit) || mr();
  var t = e.unit.model.sequence.byEntityKey[xa(e)];
  return t && t.sequence.microHet.has(T5(e));
}, microheterogeneityCompIds: bC, secondary_structure_type: function(e) {
  var t;
  ve.isAtomic(e.unit) || mr();
  var n = (t = na.get(e.structure).value) === null || t === void 0 ? void 0 : t.get(e.unit.invariantId);
  return n ? n.type[n.getIndex(e.unit.residueIndex[e.element])] : 536870912;
}, secondary_structure_key: function(e) {
  var t;
  ve.isAtomic(e.unit) || mr();
  var n = (t = na.get(e.structure).value) === null || t === void 0 ? void 0 : t.get(e.unit.invariantId);
  return n ? n.key[n.getIndex(e.unit.residueIndex[e.element])] : -1;
}, chem_comp_type: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.properties.chemicalComponentMap.get(q6(e)).type : mr();
} }, uj = { key: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.chainIndex[e.element] : mr();
}, label_asym_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.chains.label_asym_id.value(e.unit.chainIndex[e.element]) : mr();
}, auth_asym_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.chains.auth_asym_id.value(e.unit.chainIndex[e.element]) : mr();
}, label_entity_id: function(e) {
  return ve.isAtomic(e.unit) ? e.unit.model.atomicHierarchy.chains.label_entity_id.value(e.unit.chainIndex[e.element]) : mr();
} }, lj = { key: Np.key, entityKey: function(e) {
  return ve.isCoarse(e.unit) ? e.unit.coarseElements.entityKey[e.element] : qu();
}, x: Np.x, y: Np.y, z: Np.z, asym_id: function(e) {
  return ve.isCoarse(e.unit) ? e.unit.coarseElements.asym_id.value(e.element) : qu();
}, entity_id: function(e) {
  return ve.isCoarse(e.unit) ? e.unit.coarseElements.entity_id.value(e.element) : qu();
}, seq_id_begin: function(e) {
  return ve.isCoarse(e.unit) ? e.unit.coarseElements.seq_id_begin.value(e.element) : qu();
}, seq_id_end: function(e) {
  return ve.isCoarse(e.unit) ? e.unit.coarseElements.seq_id_end.value(e.element) : qu();
}, sphere_radius: function(e) {
  return ve.isSpheres(e.unit) ? e.unit.coarseConformation.radius[e.element] : qu("spheres");
}, sphere_rmsf: function(e) {
  return ve.isSpheres(e.unit) ? e.unit.coarseConformation.rmsf[e.element] : qu("spheres");
}, gaussian_weight: function(e) {
  return ve.isGaussians(e.unit) ? e.unit.coarseConformation.weight[e.element] : qu("gaussians");
}, gaussian_covariance_matrix: function(e) {
  return ve.isGaussians(e.unit) ? e.unit.coarseConformation.covariance_matrix[e.element] : qu("gaussians");
} };
function xa(e) {
  switch (e.unit.kind) {
    case 0:
      return e.unit.model.atomicHierarchy.index.getEntityFromChain(e.unit.chainIndex[e.element]);
    case 1:
      return e.unit.model.coarseHierarchy.spheres.entityKey[e.element];
    case 2:
      return e.unit.model.coarseHierarchy.gaussians.entityKey[e.element];
  }
}
var cj = { key: xa, id: function(e) {
  return e.unit.model.entities.data.id.value(xa(e));
}, type: function(e) {
  return e.unit.model.entities.data.type.value(xa(e));
}, src_method: function(e) {
  return e.unit.model.entities.data.src_method.value(xa(e));
}, pdbx_description: function(e) {
  return e.unit.model.entities.data.pdbx_description.value(xa(e));
}, formula_weight: function(e) {
  return e.unit.model.entities.data.formula_weight.value(xa(e));
}, pdbx_number_of_molecules: function(e) {
  return e.unit.model.entities.data.pdbx_number_of_molecules.value(xa(e));
}, details: function(e) {
  return e.unit.model.entities.data.details.value(xa(e));
}, pdbx_mutation: function(e) {
  return e.unit.model.entities.data.pdbx_mutation.value(xa(e));
}, pdbx_fragment: function(e) {
  return e.unit.model.entities.data.pdbx_fragment.value(xa(e));
}, pdbx_ec: function(e) {
  return e.unit.model.entities.data.pdbx_ec.value(xa(e));
}, subtype: function(e) {
  return e.unit.model.entities.subtype.value(xa(e));
}, prd_id: function(e) {
  var t, n;
  return (n = (t = e.unit.model.entities.prd_id) === null || t === void 0 ? void 0 : t.value(xa(e))) !== null && n !== void 0 ? n : "";
} }, dj = [], fj = { id: function(e) {
  return e.unit.id;
}, chainGroupId: function(e) {
  return e.unit.chainGroupId;
}, multiChain: function(e) {
  return ve.Traits.is(e.unit.traits, 1);
}, object_primitive: function(e) {
  return e.unit.objectPrimitive;
}, operator_name: function(e) {
  return e.unit.conformation.operator.name;
}, model_index: function(e) {
  return e.unit.model.modelNum;
}, model_label: function(e) {
  return e.unit.model.label;
}, model_entry_id: function(e) {
  return e.unit.model.entryId;
}, hkl: function(e) {
  return e.unit.conformation.operator.hkl;
}, spgrOp: function(e) {
  return e.unit.conformation.operator.spgrOp;
}, model_num: function(e) {
  return e.unit.model.modelNum;
}, pdbx_struct_assembly_id: function(e) {
  var t;
  return ((t = e.unit.conformation.operator.assembly) === null || t === void 0 ? void 0 : t.id) || lr.DefaultName;
}, pdbx_struct_oper_list_ids: function(e) {
  var t;
  return ((t = e.unit.conformation.operator.assembly) === null || t === void 0 ? void 0 : t.operList) || dj;
}, struct_ncs_oper_id: function(e) {
  return e.unit.conformation.operator.ncsId;
} }, Fe = { constant: { true: function(e) {
  return !0;
}, false: function(e) {
  return !1;
}, zero: function(e) {
  return 0;
} }, atom: Np, residue: sj, chain: uj, entity: cj, unit: fj, coarse: lj }, t0 = function() {
  function e(t) {
    var n;
    this.index = /* @__PURE__ */ new Map(), this.checkOperator = !1, this.checkOperator = (n = t == null ? void 0 : t.checkOperator) !== null && n !== void 0 && n;
  }
  return e.prototype.add = function(t) {
    var n = this.index.get(t.label_asym_id);
    n || (n = /* @__PURE__ */ new Map(), this.index.set(t.label_asym_id, n));
    var r = n.get(t.label_seq_id);
    return r || (r = [], n.set(t.label_seq_id, r)), !this._find(t, r) && (r.push(t), !0);
  }, e.prototype.hasLabelAsymId = function(t) {
    return this.index.has(t);
  }, e.prototype.has = function(t) {
    var n, r, i = _C(t);
    if (this.index.has(i)) {
      var a = this.index.get(i), o = xC(t);
      if (a.has(o)) for (var s = a.get(o), u = CC(t), l = SC(t), c = AC(t), d = (n = wC(t)) !== null && n !== void 0 ? n : "1_555", f = 0, p = s; f < p.length; f++) {
        var g = p[f];
        if (g.label_comp_id === u && g.label_alt_id === l && g.ins_code === c && (!this.checkOperator || ((r = g.operator_name) !== null && r !== void 0 ? r : "1_555") === d)) return g;
      }
    }
  }, e.getLabel = function(t, n) {
    var r;
    return n === void 0 && (n = !1), "".concat(t.label_asym_id, " ").concat(t.label_comp_id, " ").concat(t.label_seq_id, ":").concat(t.ins_code, ":").concat(t.label_alt_id).concat(n ? " " + ((r = t.operator_name) !== null && r !== void 0 ? r : "1_555") : "");
  }, e.getEntryFromLocation = function(t) {
    var n;
    return { label_asym_id: _C(t), label_comp_id: CC(t), label_seq_id: xC(t), label_alt_id: SC(t), ins_code: AC(t), operator_name: (n = wC(t)) !== null && n !== void 0 ? n : "1_555" };
  }, e.prototype._find = function(t, n) {
    for (var r, i, a = 0, o = n; a < o.length; a++) {
      var s = o[a];
      if (s.label_comp_id === t.label_comp_id && s.label_alt_id === t.label_alt_id && s.ins_code === t.ins_code && (!this.checkOperator || ((r = s.operator_name) !== null && r !== void 0 ? r : "1_555") === ((i = t.operator_name) !== null && i !== void 0 ? i : "1_555"))) return !0;
    }
    return !1;
  }, e;
}(), _C = Fe.chain.label_asym_id, xC = Fe.residue.label_seq_id, CC = Fe.atom.label_comp_id, SC = Fe.atom.label_alt_id, AC = Fe.residue.pdbx_PDB_ins_code, wC = Fe.unit.operator_name;
function F1(e, t, n) {
  for (var r = t.subsetBuilder(!0), i = 0, a = n.units; i < a.length; i++) {
    var o = a[i];
    if (o.kind === 0) {
      var s = o.model.atomicHierarchy.residueAtomSegments, u = t.unitMap.get(o.id).elements, l = o.elements;
      r.beginUnit(o.id);
      for (var c = Kt.transientSegments(s, l); c.hasNext; ) for (var d = c.move().index, f = s.offsets[d], p = s.offsets[d + 1]; f < p; f++) Me.has(u, f) && r.addElement(f);
      r.commitUnit(), e.throwIfTimedOut();
    } else r.setUnit(o.id, o.elements);
  }
  return r.getStructure();
}
function Ly(e, t, n, r) {
  for (var i = new l3(t), a = t.lookup3d, o = r.radius, s = 0, u = n.units; s < u.length; s++) {
    for (var l = u[s], c = l.conformation, d = c.x, f = c.y, p = c.z, g = l.elements, m = 0, v = g.length; m < v; m++) {
      var h = g[m];
      a.findIntoBuilder(d(h), f(h), p(h), o, i);
    }
    e.throwIfTimedOut();
  }
  return r.wholeResidues ? F1(e, t, i.getStructure()) : i.getStructure();
}
function IC(e, t, n, r) {
  var i = new l3(t), a = t.lookup3d, o = r.elementRadius, s = r.elementRadiusClosure, u = r.sourceMaxRadius, l = r.radius;
  e.pushCurrentElement(), e.element.structure = n;
  for (var c = 0, d = n.units; c < d.length; c++) {
    var f = d[c];
    e.element.unit = f;
    for (var p = f.conformation, g = p.x, m = p.y, v = p.z, h = f.elements, y = 0, x = h.length; y < x; y++) {
      var S = h[y];
      e.element.element = S;
      var b = o(e);
      a.findIntoBuilderWithRadius(g(S), m(S), v(S), b, u, l, s, i);
    }
    e.throwIfTimedOut();
  }
  return e.popCurrentElement(), r.wholeResidues ? F1(e, t, i.getStructure()) : i.getStructure();
}
function mj(e, t) {
  return function(n) {
    return e.element.structure = n.structure, e.element.unit = n.unit, e.element.element = n.element, t(e);
  };
}
function pj(e, t) {
  var n = 0;
  e.element.structure = e.inputStructure;
  for (var r = 0, i = e.inputStructure.units; r < i.length; r++) {
    var a = i[r];
    e.element.unit = a;
    for (var o = a.elements, s = 0, u = o.length; s < u; s++) {
      var l = o[s];
      e.element.element = l;
      var c = t(e);
      c > n && (n = c);
    }
  }
  return e.throwIfTimedOut(), n;
}
function PC(e, t, n) {
  var r = function(i, a) {
    for (var o = i.inputStructure, s = o.interUnitBonds, u = new l3(o), l = i.atomicBond, c = 0, d = a.units; c < d.length; c++) {
      var f = d[c];
      if (f.kind === 0) {
        var p = o.unitMap.get(f.id), g = p.bonds, m = g.offset, v = g.b, h = g.edgeProps, y = h.flags, x = h.order;
        for (l.setStructure(o), l.a.unit = p, l.b.unit = p, G = 0, H = f.elements.length; G < H; G++) {
          u.addToUnit(f.id, f.elements[G]);
          for (var S = Me.indexOf(p.elements, f.elements[G]), b = m[S], _ = m[S + 1]; b < _; b++) {
            var C = v[b], w = p.elements[C];
            Me.has(f.elements, w) || u.has(f.id, w) || (l.aIndex = S, l.a.element = f.elements[G], l.bIndex = C, l.b.element = w, l.type = y[b], l.order = x[b], l.test(i, !0) && u.addToUnit(f.id, w));
          }
        }
        for (var I = 0, M = s.getConnectedUnits(p.id); I < M.length; I++) for (var E = M[I], T = a.unitMap.get(E.unitB), P = o.unitMap.get(E.unitB), k = 0, D = E.connectedIndices; k < D.length; k++) {
          var B = D[k];
          if (Me.has(f.elements, p.elements[B])) for (var L = 0, F = E.getEdges(B); L < F.length; L++) {
            var V = F[L];
            w = P.elements[V.indexB], T && Me.has(T.elements, w) || u.has(E.unitB, w) || (l.a.unit = p, l.aIndex = B, l.a.element = p.elements[B], l.b.unit = P, l.bIndex = V.indexB, l.b.element = w, l.type = V.props.flag, l.order = V.props.order, l.test(i, !0) && u.addToUnit(E.unitB, w));
          }
        }
      } else {
        u.beginUnit(f.id);
        for (var G = 0, H = f.elements.length; G < H; G++) u.addElement(f.elements[G]);
        u.commitUnit();
      }
    }
    return u.getStructure();
  }(e, n);
  return t ? F1(e, e.inputStructure, r) : r;
}
var hj = Fe.entity.type;
function gj(e) {
  return hj(e) === "water";
}
var ov, sv, vj = function() {
  function e() {
    this.vertices = /* @__PURE__ */ new Map(), this.edges = /* @__PURE__ */ new Map();
  }
  return e.prototype.addVertex = function(t, n) {
    this.vertices.has(n) || (this.vertices.set(n, t), this.edges.set(n, []));
  }, e.prototype.addEdge = function(t, n) {
    var r = t0.getLabel(t), i = t0.getLabel(n);
    this.addVertex(t, r), this.addVertex(n, i), Qo(this.edges.get(r), i), Qo(this.edges.get(i), r);
  }, e.prototype.addComponent = function(t, n) {
    var r = t0.getLabel(t);
    if (this.vertices.has(r)) {
      var i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = [r];
      for (a.add(r), n.add(t); o.length > 0; ) {
        var s = o.pop();
        i.add(s);
        for (var u = this.vertices.get(s), l = 0, c = this.edges.get(s); l < c.length; l++) {
          var d = c[l];
          if (!i.has(d) && (o.push(d), !a.has(d))) {
            a.add(d);
            var f = this.vertices.get(d);
            u.operator_name === f.operator_name ? n.add(O(O({}, f), { operator_name: t.operator_name })) : n.add(f);
          }
        }
      }
    } else n.add(t);
  }, e;
}(), yj = Object.freeze({ __proto__: null, exceptBy: function(e, t) {
  return function(n) {
    var r = e(n);
    if (nt.structureCount(r) === 0) return r;
    var i = t(n);
    if (nt.structureCount(i) === 0) return r;
    var a = nt.unionStructure(i), o = nt.UniqueBuilder(n.inputStructure);
    return nt.forEach(r, function(s, u) {
      var l = zk(s, a);
      l.elementCount !== 0 && o.add(l), u % 50 == 0 && n.throwIfTimedOut();
    }), o.getSelection();
  };
}, expandProperty: function(e, t) {
  return function(n) {
    var r = e(n), i = /* @__PURE__ */ new Map(), a = [];
    n.pushCurrentElement(), nt.forEach(r, function(S, b) {
      n.element.structure = S;
      for (var _ = 0, C = S.units; _ < C.length; _++) {
        var w = C[_];
        n.element.unit = w;
        for (var I = w.elements, M = 0, E = I.length; M < E; M++) {
          n.element.element = I[M];
          var T = t(n), P = void 0;
          i.has(T) ? P = i.get(T) : (P = or.create(), i.set(T, P)), or.add(P, b, b);
        }
      }
      a[b] = n.inputStructure.subsetBuilder(!0), b % 10 == 0 && n.throwIfTimedOut();
    }), n.element.structure = n.inputStructure;
    for (var o = 0, s = n.inputStructure.units; o < s.length; o++) {
      var u = s[o];
      n.element.unit = u;
      for (var l = u.elements, c = 0, d = l.length; c < d; c++) {
        n.element.element = l[c];
        var f = t(n);
        if (i.has(f)) for (var p = i.get(f).array, g = 0, m = p.length; g < m; g++) a[p[g]].addToUnit(u.id, l[c]);
      }
    }
    n.popCurrentElement();
    for (var v = nt.UniqueBuilder(n.inputStructure), h = 0, y = a; h < y.length; h++) {
      var x = y[h];
      v.add(x.getStructure());
    }
    return v.getSelection();
  };
}, includeConnected: function(e) {
  var t = e.query, n = e.layerCount, r = e.wholeResidues, i = e.bondTest, a = e.fixedPoint, o = Math.max(n, 0);
  return function(s) {
    var u = nt.UniqueBuilder(s.inputStructure), l = t(s);
    return s.pushCurrentBond(), s.atomicBond.setTestFn(i), nt.forEach(l, function(c, d) {
      var f = c;
      if (a) for (; ; ) {
        var p = f.elementCount;
        if ((f = PC(s, r, f)).elementCount === p) break;
      }
      else for (var g = 0; g < o; g++) f = PC(s, r, f);
      u.add(f), d % 10 == 0 && s.throwIfTimedOut();
    }), s.popCurrentBond(), u.getSelection();
  };
}, includeSurroundings: function(e, t) {
  return function(n) {
    var r = e(n);
    if (t.elementRadius) {
      var i = O(O({}, t), { elementRadius: t.elementRadius, elementRadiusClosure: mj(n, t.elementRadius), sourceMaxRadius: pj(n, t.elementRadius) });
      if (nt.isSingleton(r)) {
        var a = IC(n, n.inputStructure, r.structure, i);
        return nt.Singletons(n.inputStructure, a);
      }
      for (var o = new Ey(n.inputStructure), s = 0, u = r.structures; s < u.length; s++) {
        var l = u[s];
        o.add(IC(n, n.inputStructure, l, i));
      }
      return o.getSelection();
    }
    if (nt.isSingleton(r))
      return a = Ly(n, n.inputStructure, r.structure, t), nt.Singletons(n.inputStructure, a);
    o = new Ey(n.inputStructure);
    for (var c = 0, d = r.structures; c < d.length; c++)
      l = d[c], o.add(Ly(n, n.inputStructure, l, t));
    return o.getSelection();
  };
}, intersectBy: function(e, t) {
  return function(n) {
    var r = e(n);
    if (nt.structureCount(r) === 0) return r;
    var i = t(n);
    if (nt.structureCount(i) === 0) return nt.Empty(n.inputStructure);
    var a = nt.unionStructure(i), o = nt.UniqueBuilder(n.inputStructure);
    return nt.forEach(r, function(s, u) {
      var l = function(c, d) {
        if (c === d) return c;
        if (!H6(c, d)) return ze.Empty;
        var f, p;
        c.units.length < d.units.length ? (f = c, p = d) : (f = d, p = c);
        for (var g = f.units, m = p.unitMap, v = [], h = 0, y = g.length; h < y; h++) {
          var x = g[h];
          if (m.has(x.id)) {
            var S = m.get(x.id);
            if (Me.areIntersecting(x.elements, S.elements)) {
              var b = Me.intersect(x.elements, S.elements);
              v[v.length] = x.getChild(b);
            }
          }
        }
        return ze.create(v, { parent: c.parent || d.parent });
      }(a, s);
      l.elementCount !== 0 && o.add(l), u % 50 == 0 && n.throwIfTimedOut();
    }), o.getSelection();
  };
}, querySelection: function(e, t) {
  return function(n) {
    var r = e(n);
    if (nt.structureCount(r) === 0) return r;
    var i = nt.UniqueBuilder(n.inputStructure), a = function(o) {
      return i.add(o);
    };
    return nt.forEach(r, function(o, s) {
      n.pushInputStructure(o), nt.forEach(t(n), a), n.popInputStructure(), s % 10 == 0 && n.throwIfTimedOut();
    }), i.getSelection();
  };
}, surroundingLigands: function(e) {
  var t = e.query, n = e.radius, r = e.includeWater;
  return function(i) {
    for (var a = nt.unionStructure(t(i)), o = F1(i, i.inputStructure, Ly(i, i.inputStructure, a, { radius: n })), s = function(q) {
      var z = q.models[0], K = /* @__PURE__ */ new Set();
      if (!ur.is(z.sourceData)) return K;
      for (var Y = z.sourceData.data.db.pdbx_molecule, Z = Y._rowCount, X = Y.asym_id, W = 0; W < Z; W++) K.add(X.value(W));
      return K;
    }(i.inputStructure), u = function(q) {
      var z, K, Y = q.models[0], Z = new vj();
      if (!ur.is(Y.sourceData)) return Z;
      for (var X = Y.sourceData.data.db.struct_conn, W = X.conn_type_id, J = X.ptnr1_label_asym_id, $ = X.ptnr1_label_comp_id, ee = X.ptnr1_label_seq_id, ce = X.ptnr1_symmetry, ae = X.pdbx_ptnr1_label_alt_id, he = X.pdbx_ptnr1_PDB_ins_code, Oe = X.ptnr2_label_asym_id, Ne = X.ptnr2_label_comp_id, Ue = X.ptnr2_label_seq_id, Ze = X.ptnr2_symmetry, Se = X.pdbx_ptnr2_label_alt_id, qe = X.pdbx_ptnr2_PDB_ins_code, Pe = 0; Pe < X._rowCount; Pe++) {
        var Xe = W.value(Pe);
        if (Xe === "covale" || Xe === "metalc") {
          var Ke = { label_asym_id: J.value(Pe), label_comp_id: $.value(Pe), label_seq_id: ee.value(Pe), label_alt_id: ae.value(Pe), ins_code: he.value(Pe), operator_name: (z = ce.value(Pe)) !== null && z !== void 0 ? z : "1_555" }, de = { label_asym_id: Oe.value(Pe), label_comp_id: Ne.value(Pe), label_seq_id: Ue.value(Pe), label_alt_id: Se.value(Pe), ins_code: qe.value(Pe), operator_name: (K = Ze.value(Pe)) !== null && K !== void 0 ? K : "1_555" };
          Z.addEdge(Ke, de);
        }
      }
      return Z;
    }(i.inputStructure), l = He.create(o), c = /* @__PURE__ */ new Map(), d = new t0({ checkOperator: !0 }), f = 0, p = o.units; f < p.length; f++)
      if ((k = p[f]).kind === 0) {
        l.unit = k;
        for (var g = k.elements, m = Kt.transientSegments(k.model.atomicHierarchy.chainAtomSegments, g), v = Kt.transientSegments(k.model.atomicHierarchy.residueAtomSegments, g); m.hasNext; ) {
          var h = m.move();
          l.element = g[h.start];
          var y = Fe.chain.label_asym_id(l), x = Fe.unit.operator_name(l);
          if (s.has(y)) c.has(y) ? Qo(c.get(y), x) : c.set(y, [x]);
          else {
            var S = Fe.entity.type(l);
            if (S !== "water" && S !== "polymer") for (v.setSegment(h); v.hasNext; ) {
              var b = v.move();
              l.element = g[b.start], u.addComponent(t0.getEntryFromLocation(l), d);
            }
          }
        }
        i.throwIfTimedOut();
      }
    for (var _ = i.inputStructure.subsetBuilder(!0), C = 0, w = i.inputStructure.units; C < w.length; C++)
      if ((k = w[C]).kind === 0) {
        for (l.unit = k, g = k.elements, m = Kt.transientSegments(k.model.atomicHierarchy.chainAtomSegments, g), v = Kt.transientSegments(k.model.atomicHierarchy.residueAtomSegments, g), _.beginUnit(k.id); m.hasNext; )
          if (h = m.move(), l.element = g[h.start], y = Fe.chain.label_asym_id(l), x = Fe.unit.operator_name(l), c.has(y) && c.get(y).indexOf(x) >= 0) _.addElementRange(g, h.start, h.end);
          else if (d.hasLabelAsymId(y)) for (v.setSegment(h); v.hasNext; )
            b = v.move(), l.element = g[b.start], d.has(l) && _.addElementRange(g, b.start, b.end);
        _.commitUnit(), i.throwIfTimedOut();
      }
    var I = iv(i.inputStructure, [_.getStructure(), a]);
    if (r) {
      for (var M = new l3(i.inputStructure), E = i.inputStructure.lookup3d, T = 0, P = I.units; T < P.length; T++) {
        for (var k, D = (k = P[T]).conformation, B = D.x, L = D.y, F = D.z, V = 0, G = (g = k.elements).length; V < G; V++) {
          var H = g[V];
          E.findIntoBuilderIf(B(H), L(H), F(H), n, M, gj), M.addToUnit(k.id, H);
        }
        i.throwIfTimedOut();
      }
      return nt.Sequence(i.inputStructure, [M.getStructure()]);
    }
    return nt.Sequence(i.inputStructure, [I]);
  };
}, union: function(e) {
  return function(t) {
    var n = nt.LinearBuilder(t.inputStructure);
    return n.add(nt.unionStructure(e(t))), n.getSelection();
  };
}, wholeResidues: function(e) {
  return function(t) {
    var n = e(t);
    if (nt.isSingleton(n)) return nt.Singletons(t.inputStructure, F1(t, t.inputStructure, n.structure));
    for (var r = new Ey(t.inputStructure), i = 0, a = n.structures; i < a.length; i++) {
      var o = a[i];
      r.add(F1(t, t.inputStructure, o));
    }
    return r.getSelection();
  };
} });
function Ny(e, t, n) {
  var r = e.currentStructure.units, i = e.pushCurrentElement();
  i.structure = e.currentStructure;
  for (var a = 0, o = r; a < o.length; a++) {
    var s = o[a];
    i.unit = s;
    var u = s.elements, l = void 0;
    if (l = ve.isAtomic(s) ? t.atomic : t.coarse) {
      for (var c = 0, d = u.length; c < d; c++) i.element = u[c], n.add(l(e));
      e.throwIfTimedOut();
    }
  }
  return e.popCurrentElement(), n;
}
(function(e) {
  var t = A.zero();
  function n(a, o, s, u, l, c, d) {
    var f = o.elements, p = o.conformation.position, g = t;
    a.element.unit = o;
    for (var m = !1, v = 0, h = f.length; v < h; v++) {
      var y = f[v];
      a.element.element = y;
      var x = Math.max(0, A.distance(s, p(y, g)) - u - d(a));
      if (x < l) return 0;
      x < c && (m = !0);
    }
    return m ? 1 : 2;
  }
  function r(a, o, s, u, l, c, d) {
    for (var f = o.units, p = !1, g = 0, m = f.length; g < m; g++) {
      var v = n(a, f[g], s, u, l, c, d);
      if (v === 0) return 0;
      v === 1 && (p = !0);
    }
    return p ? 1 : 2;
  }
  e.toPoint = r;
  var i = A.zero();
  e.check = function(a, o, s, u, l, c) {
    if (o.elementCount === 0 || s.elementCount === 0) return 0;
    var d = o.units, f = !1;
    a.element.structure = o;
    for (var p = 0, g = d.length; p < g; p++) {
      var m = d[p], v = m.elements, h = m.conformation.position;
      a.element.unit = m;
      for (var y = 0, x = v.length; y < x; y++) {
        var S = v[y];
        a.element.element = S;
        var b = r(a, s, h(S, i), c(a), u, l, c);
        if (b === 0) return 0;
        b === 1 && (f = !0);
      }
    }
    return f;
  };
})(ov || (ov = {})), function(e) {
  var t = A.zero();
  function n(a, o, s, u, l, c) {
    var d = o.elements, f = o.conformation.position, p = t;
    a.element.unit = o;
    for (var g = 0, m = d.length; g < m; g++) {
      var v = d[g];
      if (a.element.element = v, Math.max(0, A.distance(s, f(v, p)) - u - c(a)) <= l) return !0;
    }
    return !1;
  }
  function r(a, o, s, u, l, c) {
    for (var d = o.units, f = 0, p = d.length; f < p; f++) if (n(a, d[f], s, u, l, c)) return !0;
    return !1;
  }
  e.toPoint = r;
  var i = A.zero();
  e.check = function(a, o, s, u, l) {
    if (o.elementCount === 0 || s.elementCount === 0) return 0;
    var c = o.units;
    a.element.structure = o;
    for (var d = 0, f = c.length; d < f; d++) {
      var p = c[d];
      a.element.unit = p;
      for (var g = p.elements, m = p.conformation.position, v = 0, h = g.length; v < h; v++) {
        var y = g[v];
        if (a.element.element = y, r(a, s, m(y, i), l(a), u, l)) return !0;
      }
    }
    return !1;
  };
}(sv || (sv = {}));
var bj = Object.freeze({ __proto__: null, areIntersectedBy: function(e, t) {
  return function(n) {
    var r = nt.unionStructure(t(n)), i = nt.LinearBuilder(n.inputStructure);
    return nt.forEach(e(n), function(a, o) {
      H6(r, a) && i.add(a), o % 10 && n.throwIfTimedOut();
    }), i.getSelection();
  };
}, first: function(e) {
  return function(t) {
    var n = e(t), r = nt.LinearBuilder(t.inputStructure);
    if (n.kind === "singletons") {
      if (n.structure.elementCount > 0) {
        var i = n.structure.units[0], a = ze.create([i.getChild(Me.ofSingleton(i.elements[0]))], { parent: t.inputStructure });
        r.add(a);
      }
    } else n.structures.length > 0 && r.add(n.structures[0]);
    return r.getSelection();
  };
}, getCurrentStructureProperties: Ny, isConnectedTo: function(e) {
  var t = e.query, n = e.target, r = e.disjunct, i = e.invert, a = e.bondTest;
  return function(o) {
    var s = n(o);
    if (nt.isEmpty(s)) return s;
    var u = t(o);
    if (nt.isEmpty(u)) return u;
    var l = { queryCtx: o, input: o.inputStructure, disjunct: r, target: nt.unionStructure(s) }, c = nt.LinearBuilder(o.inputStructure);
    return o.pushCurrentBond(), o.atomicBond.setTestFn(a), nt.forEach(u, function(d, f) {
      (function(p, g) {
        var m = p.queryCtx, v = p.input, h = p.target, y = p.disjunct, x = m.atomicBond, S = v.interUnitBonds;
        x.setStructure(v);
        for (var b = 0, _ = g.units; b < _.length; b++) {
          var C = _[b];
          if (ve.isAtomic(C)) for (var w = v.unitMap.get(C.id), I = w.bonds, M = I.offset, E = I.b, T = I.edgeProps, P = T.flags, k = T.order, D = S.getConnectedUnits(C.id), B = D.length, L = C.elements, F = w.elements, V = 0, G = L.length; V < G; V++) {
            var H = Me.indexOf(F, L[V]);
            x.a.unit = w, x.b.unit = w;
            for (var q = M[H], z = M[H + 1]; q < z; q++) if (x.b.element = w.elements[E[q]], (!y || !Me.has(C.elements, x.b.element)) && h.hasElement(x.b) && (x.aIndex = H, x.a.element = L[V], x.bIndex = E[q], x.type = P[q], x.order = k[q], x.test(m, !0))) return !0;
            for (var K = 0; K < B; K++) for (var Y = D[K], Z = v.unitMap.get(Y.unitB), X = Z.elements, W = Y.getEdges(H), J = 0, $ = W.length; J < $; J++) {
              var ee = W[J];
              if (x.b.unit = Z, x.b.element = X[ee.indexB], h.hasElement(x.b) && (!y || !g.hasElement(x.b)) && (x.a.unit = w, x.aIndex = H, x.a.element = L[V], x.bIndex = ee.indexB, x.type = ee.props.flag, x.order = ee.props.order, x.test(m, !0))) return !0;
            }
          }
        }
        return !1;
      }(l, d) || i) && c.add(d), f % 5 == 0 && o.throwIfTimedOut();
    }), o.popCurrentBond(), c.getSelection();
  };
}, pick: function(e, t) {
  return function(n) {
    var r = e(n), i = nt.LinearBuilder(n.inputStructure);
    return n.pushCurrentElement(), nt.forEach(r, function(a, o) {
      n.currentStructure = a, t(n) && i.add(a), o % 100 && n.throwIfTimedOut();
    }), n.popCurrentStructure(), i.getSelection();
  };
}, withSameAtomProperties: function(e, t, n) {
  return function(r) {
    var i = e(r), a = function(s, u, l) {
      var c = /* @__PURE__ */ new Set(), d = u(s);
      return s.pushCurrentElement(), nt.forEach(d, function(f, p) {
        s.currentStructure = f, Ny(s, l, c), p % 10 && s.throwIfTimedOut();
      }), s.popCurrentElement(), c;
    }(r, t, n), o = nt.LinearBuilder(r.inputStructure);
    return r.pushCurrentStructure(), nt.forEach(i, function(s, u) {
      r.currentStructure = s;
      var l = Ny(r, n, /* @__PURE__ */ new Set());
      ka.isSuperset(l, a) && o.add(s), u % 10 && r.throwIfTimedOut();
    }), r.popCurrentStructure(), o.getSelection();
  };
}, within: function(e) {
  return function(t) {
    var n = { queryCtx: t, selection: e.query(t), target: e.target(t), maxRadius: e.maxRadius, minRadius: e.minRadius ? Math.max(0, e.minRadius) : 0, elementRadius: e.elementRadius, invert: !!e.invert };
    return n.minRadius === 0 && e.minRadius === void 0 ? function(r) {
      var i = r.queryCtx, a = r.selection, o = r.target, s = r.maxRadius, u = r.invert, l = nt.unionStructure(o).lookup3d, c = nt.LinearBuilder(i.inputStructure), d = A.zero();
      return nt.forEach(a, function(f, p) {
        for (var g = f.units, m = !1, v = 0, h = g.length; v < h; v++) {
          for (var y = g[v], x = y.elements, S = y.conformation, b = S.position, _ = S.r, C = 0, w = x.length; C < w; C++) {
            var I = x[C];
            if (b(I, d), l.check(d[0], d[1], d[2], s + _(I))) {
              m = !0;
              break;
            }
          }
          if (m) break;
        }
        u && (m = !m), m && c.add(f), p % 10 == 0 && i.throwIfTimedOut();
      }), c.getSelection();
    }(n) : n.minRadius === 0 ? function(r) {
      var i = r.queryCtx, a = r.selection, o = r.target, s = r.maxRadius, u = r.invert, l = r.elementRadius, c = nt.unionStructure(o), d = nt.LinearBuilder(i.inputStructure);
      return i.pushCurrentElement(), nt.forEach(a, function(f, p) {
        var g = function(m, v, h, y, x) {
          return v.elementCount === 0 || h.elementCount === 0 || (v.elementCount <= h.elementCount ? sv.check(m, v, h, y, x) : sv.check(m, h, v, y, x));
        }(i, c, f, s, l);
        u && (g = !g), g && d.add(f), p % 10 == 0 && i.throwIfTimedOut();
      }), i.popCurrentElement(), d.getSelection();
    }(n) : function(r) {
      var i = r.queryCtx, a = r.selection, o = r.target, s = r.minRadius, u = r.maxRadius, l = r.invert, c = r.elementRadius, d = nt.unionStructure(o), f = nt.LinearBuilder(i.inputStructure);
      return i.pushCurrentElement(), nt.forEach(a, function(p, g) {
        var m = function(v, h, y, x, S, b) {
          return h.elementCount === 0 || y.elementCount === 0 || (h.elementCount <= y.elementCount ? ov.check(v, h, y, x, S, b) : ov.check(v, y, h, x, S, b));
        }(i, d, p, s, u, c);
        l && (m = !m), m && f.add(p), g % 10 == 0 && i.throwIfTimedOut();
      }), i.popCurrentElement(), f.getSelection();
    }(n);
  };
} }), k5, _j = Object.freeze({ __proto__: null, intersect: function(e) {
  return e.length === 0 ? w5 : e.length === 1 ? e[0] : function(t) {
    for (var n = [], r = 0; r < e.length; r++) n.push(e[r](t));
    var i = 0, a = nt.structureCount(n[0]);
    for (r = 1; r < n.length; r++) {
      var o = nt.structureCount(n[r]);
      o < a && (i = r, a = o);
    }
    t.throwIfTimedOut();
    var s = L6(function(c) {
      return c.hashCode;
    }, ze.areUnitIdsAndIndicesEqual);
    nt.forEach(n[i], function(c) {
      return s.add(c);
    });
    for (var u = nt.UniqueBuilder(t.inputStructure), l = 0; l < n.length; l++) l !== i && (nt.forEach(n[l], function(c) {
      s.has(c) && u.add(c);
    }), t.throwIfTimedOut());
    return u.getSelection();
  };
}, merge: function(e) {
  return e.length === 0 ? w5 : e.length === 1 ? e[0] : function(t) {
    for (var n = nt.UniqueBuilder(t.inputStructure), r = function(a) {
      nt.forEach(e[a](t), function(o, s) {
        n.add(o), a % 100 && t.throwIfTimedOut();
      });
    }, i = 0; i < e.length; i++) r(i);
    return n.getSelection();
  };
} });
(function(e) {
  function t(r) {
    return !0;
  }
  function n(r) {
    return !1;
  }
  e.eq = function(r, i) {
    return function(a) {
      return r(a) === i;
    };
  }, e.lt = function(r, i) {
    return function(a) {
      return r(a) < i;
    };
  }, e.lte = function(r, i) {
    return function(a) {
      return r(a) <= i;
    };
  }, e.gt = function(r, i) {
    return function(a) {
      return r(a) > i;
    };
  }, e.gte = function(r, i) {
    return function(a) {
      return r(a) >= i;
    };
  }, e.inSet = function(r, i) {
    if (function(s) {
      return !!s && !!s.has;
    }(i)) return function(s) {
      return i.has(r(s));
    };
    if (i.length === 0) return n;
    for (var a = /* @__PURE__ */ new Set(), o = 0; o < i.length; o++) a.add(i[o]);
    return function(s) {
      return a.has(r(s));
    };
  }, e.and = function() {
    for (var r = [], i = 0; i < arguments.length; i++) r[i] = arguments[i];
    switch (r.length) {
      case 0:
        return t;
      case 1:
        return r[0];
      case 2:
        var a = r[0], o = r[1];
        return function(M) {
          return a(M) && o(M);
        };
      case 3:
        var s = r[0], u = r[1], l = r[2];
        return function(M) {
          return s(M) && u(M) && l(M);
        };
      case 4:
        var c = r[0], d = r[1], f = r[2], p = r[3];
        return function(M) {
          return c(M) && d(M) && f(M) && p(M);
        };
      case 5:
        var g = r[0], m = r[1], v = r[2], h = r[3], y = r[4];
        return function(M) {
          return g(M) && m(M) && v(M) && h(M) && y(M);
        };
      case 6:
        var x = r[0], S = r[1], b = r[2], _ = r[3], C = r[4], w = r[5];
        return function(M) {
          return x(M) && S(M) && b(M) && _(M) && C(M) && w(M);
        };
      default:
        var I = r.length;
        return function(M) {
          for (var E = 0; E < I; E++) if (!r[E]) return !1;
          return !0;
        };
    }
  }, e.or = function() {
    for (var r = [], i = 0; i < arguments.length; i++) r[i] = arguments[i];
    switch (r.length) {
      case 0:
        return n;
      case 1:
        return r[0];
      case 2:
        var a = r[0], o = r[1];
        return function(M) {
          return a(M) || o(M);
        };
      case 3:
        var s = r[0], u = r[1], l = r[2];
        return function(M) {
          return s(M) || u(M) || l(M);
        };
      case 4:
        var c = r[0], d = r[1], f = r[2], p = r[3];
        return function(M) {
          return c(M) || d(M) || f(M) || p(M);
        };
      case 5:
        var g = r[0], m = r[1], v = r[2], h = r[3], y = r[4];
        return function(M) {
          return g(M) || m(M) || v(M) || h(M) || y(M);
        };
      case 6:
        var x = r[0], S = r[1], b = r[2], _ = r[3], C = r[4], w = r[5];
        return function(M) {
          return x(M) || S(M) || b(M) || _(M) || C(M) || w(M);
        };
      default:
        var I = r.length;
        return function(M) {
          for (var E = 0; E < I; E++) if (r[E]) return !0;
          return !1;
        };
    }
  };
})(k5 || (k5 = {}));
var nm, fr = { generators: vq, filters: bj, modifiers: yj, combinators: _j, pred: k5, internal: pq };
function eD(e, t, n, r, i, a) {
  var o = e.spacegroup, s = e.ncsOperators, u = [], l = o.cell.toFractional, c = A.transformMat4(A(), a, l), d = za.getSymmetryOperatorRef(o, t, n, r, i, c);
  if (s && s.length) for (var f = 0, p = s.length; f < p; ++f) {
    var g = s[f], m = ne.mul(ne(), d.matrix, g.matrix), v = lr.create("".concat(d.name, " ").concat(g.name), m, { assembly: d.assembly, ncsId: g.ncsId, hkl: d.hkl, spgrOp: d.spgrOp });
    u.push(v);
  }
  else u.push(d);
  return u;
}
function MC(e, t, n, r) {
  var i = e.spacegroup, a = e.ncsOperators, o = a && a.length || 0, s = [];
  !o && t[0] <= 0 && n[0] >= 0 && t[1] <= 0 && n[1] >= 0 && t[2] <= 0 && n[2] >= 0 && (s[0] = za.getSymmetryOperator(i, 0, 0, 0, 0));
  for (var u = 0; u < i.operators.length; u++) for (var l = t[0]; l <= n[0]; l++) for (var c = t[1]; c <= n[1]; c++) for (var d = t[2]; d <= n[2]; d++) (o || u !== 0 || l !== 0 || c !== 0 || d !== 0) && s.push.apply(s, eD(e, u, l, c, d, r));
  return s;
}
function EC(e, t) {
  for (var n = ze.Builder({ label: e.label, dynamicBonds: e.dynamicBonds }), r = e.units, i = 0, a = t; i < a.length; i++) for (var o = a[i], s = 0, u = r; s < u.length; s++) {
    var l = u[s];
    n.addWithOperator(l, o);
  }
  return n.getStructure();
}
(function(e) {
  function t(r, i) {
    return r.invariantId === i.invariantId && r.model.id === i.model.id && Me.areEqual(r.elements, i.elements);
  }
  function n() {
    return function(r, i) {
      return new lG(r, i);
    }(ve.hashUnit, t);
  }
  e.buildAssembly = function(r, i) {
    var a = this;
    return Xt.create("Build Assembly", function(o) {
      return se(a, 0, void 0, function() {
        var s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _;
        return ie(this, function(C) {
          if ((s = r.models).length !== 1) throw new Error("Can only build assemblies from structures based on 1 model.");
          if (!(u = nv.findAssembly(s[0], i))) throw new Error("Assembly '".concat(i, "' is not defined."));
          for (l = lr.create(u.id, ne.identity(), { assembly: { id: u.id, operId: 0, operList: [] } }), c = ze.Builder({ coordinateSystem: l, label: r.label, dynamicBonds: r.dynamicBonds }), d = new xf(r), f = 0, p = u.operatorGroups; f < p.length; f++) if (g = p[f], m = g.selector(d), nt.structureCount(m) !== 0) for (v = nt.unionStructure(m).units, h = 0, y = g.operators; h < y.length; h++) for (x = y[h], S = 0, b = v; S < b.length; S++) _ = b[S], c.addWithOperator(_, x);
          return [2, c.getStructure()];
        });
      });
    });
  }, e.buildSymmetryAssembly = function(r, i, a) {
    var o = this;
    return Xt.create("Build Symmetry Assembly", function(s) {
      return se(o, 0, void 0, function() {
        var u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B;
        return ie(this, function(L) {
          if ((u = r.models).length !== 1) throw new Error("Can only build symmetry assemblies from structures based on 1 model.");
          for (l = A(), c = ze.Builder({ label: r.label, representativeModel: u[0], dynamicBonds: r.dynamicBonds }), d = new xf(r), f = 0, p = i; f < p.length; f++) if (g = p[f], F = g.asymIds, m = fr.generators.atoms({ chainTest: fr.pred.and(fr.pred.eq(function(V) {
            return Fe.unit.operator_name(V.element);
          }, lr.DefaultName), fr.pred.inSet(function(V) {
            return Fe.chain.label_asym_id(V.element);
          }, F)) }), v = m(d), nt.structureCount(v) !== 0) for (h = nt.unionStructure(v).units, y = 0, x = g.operators; y < x.length; y++) for (S = x[y], b = S.index, _ = S.shift, C = _[0], w = _[1], I = _[2], M = eD(a, b, C, w, I, l), E = 0, T = h; E < T.length; E++) for (P = T[E], k = 0, D = M; k < D.length; k++) B = D[k], c.addWithOperator(P, B);
          var F;
          return [2, c.getStructure()];
        });
      });
    });
  }, e.builderSymmetryMates = function(r, i) {
    return Xt.create("Find Symmetry Mates", function(a) {
      return function(o, s, u) {
        return se(this, 0, void 0, function() {
          function l(D, B) {
            return "".concat(D.invariantId, "|").concat(B.name);
          }
          var c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k;
          return ie(this, function(D) {
            switch (D.label) {
              case 0:
                if ((c = s.models).length !== 1) throw new Error("Can only build symmetries from structures based on 1 model.");
                return (d = Gi.Provider.get(c[0])) ? (f = d.spacegroup, os.isZero(f.cell) ? [2, s] : o.shouldUpdate ? [4, o.update("Initialing...")] : [3, 2]) : [2, s];
              case 1:
                D.sent(), D.label = 2;
              case 2:
                p = nr.getCenter(c[0]), g = function(B, L) {
                  return B._operators_333 && A.equals(L, B._operators_333.ref) || (B._operators_333 = { ref: A.clone(L), operators: MC(B, A.create(-3, -3, -3), A.create(3, 3, 3), L) }), B._operators_333.operators;
                }(d, p), m = s.lookup3d, v = /* @__PURE__ */ new Set(), h = ze.Builder({ label: s.label, dynamicBonds: s.dynamicBonds }), y = s.units, x = A.zero(), S = 0, b = g, D.label = 3;
              case 3:
                if (!(S < b.length)) return [3, 6];
                for (_ = b[S], C = 0, w = y; C < w.length; C++) for (I = w[C], M = I.lookup3d.boundary.sphere, A.transformMat4(x, M.center, _.matrix), E = m.findUnitIndices(x[0], x[1], x[2], M.radius + u), T = 0, P = E.count; T < P; T++) y[E.indices[T]].lookup3d.check(x[0], x[1], x[2], M.radius + u) && (k = l(I, _), v.has(k) || (h.addWithOperator(I, _), v.add(k)));
                return o.shouldUpdate ? [4, o.update("Building symmetry...")] : [3, 5];
              case 4:
                D.sent(), D.label = 5;
              case 5:
                return S++, [3, 3];
              case 6:
                return [2, h.getStructure()];
            }
          });
        });
      }(a, r, i);
    });
  }, e.buildSymmetryRange = function(r, i, a) {
    return Xt.create("Build Symmetry", function(o) {
      return function(s, u, l, c) {
        return se(this, 0, void 0, function() {
          var d, f, p, g, m;
          return ie(this, function(v) {
            if ((d = u.models).length !== 1) throw new Error("Can only build symmetries from structures based on 1 model.");
            return (f = Gi.Provider.get(d[0])) ? (p = f.spacegroup, os.isZero(p.cell) ? [2, u] : (g = nr.getCenter(d[0]), m = MC(f, l, c, g), [2, EC(u, m)])) : [2, u];
          });
        });
      }(0, r, i, a);
    });
  }, e.buildNcs = function(r) {
    return Xt.create("Build NCS", function(i) {
      return function(a, o) {
        return se(this, 0, void 0, function() {
          var s, u, l;
          return ie(this, function(c) {
            if ((s = o.models).length !== 1) throw new Error("Can only build NCS from structures based on 1 model.");
            return (u = Gi.Provider.get(s[0])) && (l = u.ncsOperators) && l.length ? [2, EC(o, l)] : [2, o];
          });
        });
      }(0, r);
    });
  }, e.areUnitsEquivalent = t, e.UnitEquivalenceBuilder = n, e.computeTransformGroups = function(r) {
    for (var i = n(), a = 0, o = r.units; a < o.length; a++) {
      var s = o[a];
      i.add(s.id, s);
    }
    for (var u = [], l = 0, c = i.groups; l < c.length; l++) {
      var d = c[l];
      u.push(ve.SymmetryGroup(d.map(function(f) {
        return r.unitMap.get(f);
      })));
    }
    return u;
  }, e.areTransformGroupsEquivalent = function(r, i) {
    if (r.length !== i.length) return !1;
    for (var a = 0, o = r.length; a < o; ++a) {
      var s = r[a].units, u = i[a].units;
      if (s.length !== u.length || r[a].hashCode !== i[a].hashCode) return !1;
      for (var l = 0, c = s.length; l < c; l++) if (s[l].conformation !== u[l].conformation) return !1;
    }
    return !0;
  };
})(nm || (nm = {}));
var xj = function() {
  function e(t, n) {
    this.parent = t, this.isSorted = n, this.ids = [], this.unitMap = Mu.Mutable(), this.parentId = -1, this.currentUnit = [], this.elementCount = 0;
  }
  return e.prototype.addToUnit = function(t, n) {
    var r = this.unitMap.get(t);
    r ? r[r.length] = n : (this.unitMap.set(t, [n]), this.ids[this.ids.length] = t), this.elementCount++;
  }, e.prototype.beginUnit = function(t) {
    this.parentId = t, this.currentUnit = this.currentUnit.length > 0 ? [] : this.currentUnit;
  }, e.prototype.addElement = function(t) {
    this.currentUnit[this.currentUnit.length] = t, this.elementCount++;
  }, e.prototype.addElementRange = function(t, n, r) {
    for (var i = n; i < r; i++) this.currentUnit[this.currentUnit.length] = t[i], this.elementCount++;
  }, e.prototype.commitUnit = function() {
    this.currentUnit.length !== 0 && (this.ids[this.ids.length] = this.parentId, this.unitMap.set(this.parentId, this.currentUnit), this.parentId = -1);
  }, e.prototype.setUnit = function(t, n) {
    this.ids[this.ids.length] = t, this.unitMap.set(t, n), this.elementCount += n.length;
  }, e.prototype._getStructure = function(t) {
    if (this.isEmpty) return ze.Empty;
    var n = [];
    zs(this.ids);
    for (var r = nm.UnitEquivalenceBuilder(), i = 0, a = this.ids.length; i < a; i++) {
      var o = this.ids[i], s = this.parent.unitMap.get(o), u = this.unitMap.get(o), l = !1;
      t && (this.isSorted || zs(u), u = Me.deduplicate(Me.ofSortedArray(this.currentUnit)), l = !0);
      var c = u.length;
      if (u.length !== s.elements.length) {
        !this.isSorted && !l && c > 1 && zs(u);
        var d = s.getChild(Me.ofSortedArray(u)), f = r.add(d.id, d);
        d !== f && (d = f.applyOperator(d.id, d.conformation.operator, !0)), n[n.length] = d;
      } else n[n.length] = s, r.add(s.id, s);
    }
    return ze.create(n, { parent: this.parent });
  }, e.prototype.getStructure = function() {
    return this._getStructure(!1);
  }, e.prototype.getStructureDeduplicate = function() {
    return this._getStructure(!0);
  }, e.prototype.setSingletonLocation = function(t) {
    var n = this.ids[0];
    t.unit = this.parent.unitMap.get(n), t.element = this.unitMap.get(n)[0];
  }, Object.defineProperty(e.prototype, "isEmpty", { get: function() {
    return this.elementCount === 0;
  }, enumerable: !1, configurable: !0 }), e;
}();
function TC(e, t) {
  for (var n = 1; t--; ) n *= e--;
  return n;
}
var Cj = function() {
  function e(t, n) {
    this.array = t, this.hasNext = !1, this.index = (1 << n) - 1, this.size = function(r, i) {
      return i > r ? 0 : TC(r, i) / TC(i, i);
    }(t.length, n), this.maxIndex = 1 << t.length, this.value = new Array(n), this.hasNext = n > 0 && n <= t.length;
  }
  return e.prototype.move = function() {
    if (this.hasNext) {
      for (var t = 0, n = 0, r = this.index; r; r >>>= 1, t++) 1 & r && (this.value[n++] = this.array[t]);
      this.index = function(i) {
        var a = i & -i, o = i + a;
        return o | ((o & -o) / a >> 1) - 1;
      }(this.index), this.hasNext = this.index < this.maxIndex;
    }
    return this.value;
  }, e;
}();
function tD(e, t) {
  for (var n = [], r = new Cj(e, t); r.hasNext; ) n.push(r.move().slice());
  return n;
}
var Sd = [], Sj = { links: Sd, terminalLinks: Sd, elements: Sd, partialElements: Sd, getElementIndices: function() {
  return Sd;
}, getLinkIndices: function() {
  return Sd;
}, getTerminalLinkIndices: function() {
  return Sd;
} }, oi = Q1("C"), Fp = Q1("O"), Aj = [is.elementFingerprint([oi, oi, oi, Fp]), is.elementFingerprint([oi, oi, oi, oi, Fp]), is.elementFingerprint([oi, oi, oi, oi, oi, Fp]), is.elementFingerprint([oi, oi, oi, oi, oi, oi, Fp])];
function wj(e, t) {
  for (var n = -1, r = -1, i = -1, a = -1, o = e.elements, s = e.model.atomicHierarchy.atoms, u = s.type_symbol, l = s.label_atom_id, c = e.bonds, d = c.b, f = c.offset, p = 0, g = t.length; p < g; ++p) {
    var m = o[t[p]];
    if (u.value(m) === oi) {
      for (var v = 0, h = 0, y = f[t[p]], x = f[t[p] + 1]; y < x; ++y) {
        var S = o[d[y]], b = u.value(S);
        b === Fp ? ++v : b === oi && ++h;
      }
      if (v === 2) {
        n = m;
        break;
      }
      v === 1 && h === 1 ? r = m : l.value(m).startsWith("C1") ? i = m : a = m;
    }
  }
  return n !== -1 ? n : r !== -1 ? r : i !== -1 ? i : a !== -1 ? a : o[t[0]];
}
function Ij(e, t, n, r) {
  var i = t.conformation.position;
  return A.normalize(e, A.sub(e, r, i(n, e))), e;
}
function kC(e, t) {
  var n = e.elements;
  return e.model.atomicHierarchy.atoms.label_atom_id.value(n[t]);
}
function Pj(e, t) {
  if (t && t.length) {
    for (var n = e.unit, r = e.all, i = /* @__PURE__ */ new Set(), a = tD(Tu(new Array(t.length)), 2), o = 0, s = a.length; o < s; ++o) {
      var u = a[o], l = r[t[u[0]]], c = r[t[u[1]]];
      Me.areIntersecting(l, c) && is.getAltId(n, l) === is.getAltId(n, c) && (i.add(t[u[0]]), i.add(t[u[1]]));
    }
    if (i.size) {
      var d = [];
      for (o = 0, s = t.length; o < s; ++o) i.has(t[o]) || d.push(t[o]);
      return d;
    }
    return t;
  }
}
function Mj(e, t) {
  return t.properties.saccharideComponentMap.get(e);
}
function Ej(e) {
  if (e.models.reduce(function(ce, ae) {
    return ce + ae.properties.saccharideComponentMap.size;
  }, 0) === 0) return Sj;
  var t = [], n = [], r = [], i = [], a = /* @__PURE__ */ new Map();
  function o(ce, ae, he) {
    return "".concat(ce, "|").concat(ae, "|").concat(he);
  }
  function s(ce, ae) {
    a.has(ce) ? a.get(ce).push(ae) : a.set(ce, [ae]);
  }
  function u(ce, ae) {
    A.sub(r[ce].geometry.direction, r[ae].geometry.center, r[ce].geometry.center), A.normalize(r[ce].geometry.direction, r[ce].geometry.direction);
  }
  var l = A.zero();
  function c(ce, ae, he) {
    var Oe = he.conformation.position, Ne = r[ce].geometry;
    A.sub(Ne.direction, Oe(he.elements[ae], l), Ne.center), A.normalize(Ne.direction, Ne.direction);
  }
  for (var d = 0, f = e.units.length; d < f; ++d) {
    var p = e.units[d];
    if (ve.isAtomic(p)) for (var g = p.model, m = p.rings, v = g.atomicHierarchy, h = v.chainAtomSegments, y = v.residueAtomSegments, x = v.atoms.label_comp_id, S = Kt.transientSegments(h, p.elements), b = Kt.transientSegments(y, p.elements), _ = void 0; S.hasNext; ) for (b.setSegment(S.move()); b.hasNext; ) {
      var C = b.move().index, w = Mj(x.value(y.offsets[C]), g);
      if (w) {
        _ || (_ = tv.byFingerprintAndResidue(m, Aj));
        var I = Pj(m, _.get(C));
        if (I && I.length) {
          for (var M = [], E = 0, T = I.length; E < T; ++E) {
            var P = m.all[I[E]], k = wj(p, P), D = Jc.calculateMomentsAxes(Fk(p, P)), B = A.copy(A.zero(), D.origin), L = A.copy(A.zero(), D.dirC), F = Ij(A.zero(), p, k, B);
            A.orthogonalize(F, L, F);
            var V = is.getAltId(p, P), G = r.length;
            M.push(G), s(o(C, p.id, V), G), V && s(o(C, p.id, ""), G), r.push({ geometry: { center: B, normal: L, direction: F }, component: w, ringIndex: I[E], altId: V, unit: p, residueIndex: C });
          }
          var H = tD(Tu(new Array(I.length)), 2);
          for (E = 0, T = H.length; E < T; ++E) {
            var q = H[E], z = m.all[I[q[0]]], K = m.all[I[q[1]]];
            if (to.areVertexSetsConnected(p.bonds, z, K, 3)) {
              var Y = M[q[0]], Z = M[q[1]];
              r[Y].altId === r[Z].altId && (u(Y, Z), u(Z, Y), t.push({ carbohydrateIndexA: Y, carbohydrateIndexB: Z }), t.push({ carbohydrateIndexA: Z, carbohydrateIndexB: Y }));
            }
          }
        } else i.push({ unit: p, residueIndex: C, component: w });
      }
    }
  }
  function X(ce, ae) {
    return a.get(o(ce.getResidueIndex(ae), ce.id, function(he, Oe) {
      var Ne = he.elements;
      return he.model.atomicHierarchy.atoms.label_alt_id.value(Ne[Oe]);
    }(ce, ae))) || [];
  }
  for (d = 0, f = r.length; d < f; ++d) {
    var W = r[d];
    for (p = W.unit, E = d + 1; E < f; ++E) {
      var J = r[E];
      if (p === J.unit && W.residueIndex !== J.residueIndex) {
        var $ = p.rings.all[W.ringIndex], ee = p.rings.all[J.ringIndex];
        to.areVertexSetsConnected(p.bonds, $, ee, 3) && (u(d, E), u(E, d), t.push({ carbohydrateIndexA: d, carbohydrateIndexB: E }), t.push({ carbohydrateIndexA: E, carbohydrateIndexB: d }));
      }
    }
  }
  for (d = 0, f = e.units.length; d < f; ++d)
    p = e.units[d], ve.isAtomic(p) && e.interUnitBonds.getConnectedUnits(p.id).forEach(function(ce) {
      ce.connectedIndices.forEach(function(ae) {
        ce.getEdges(ae).forEach(function(he) {
          var Oe = he.props, Ne = he.indexB;
          if (cn.isCovalent(Oe.flag)) {
            var Ue = e.unitMap.get(ce.unitA), Ze = e.unitMap.get(ce.unitB), Se = X(Ue, ae), qe = X(Ze, Ne);
            if (Se.length > 0 && qe.length > 0) for (var Pe = Se.length, Xe = qe.length, Ke = 0, de = Math.max(Pe, Xe); Ke < de; ++Ke) {
              var we = Se[Math.min(Ke, Pe - 1)], Ie = qe[Math.min(Ke, Xe - 1)];
              ((De = kC(Ue, ae)).startsWith("O1") || De.startsWith("C1")) && u(we, Ie), t.push({ carbohydrateIndexA: we, carbohydrateIndexB: Ie });
            }
            else if (qe.length === 0) for (var Ee = 0, Le = Se; Ee < Le.length; Ee++) {
              var De;
              we = Le[Ee], ((De = kC(Ue, ae)).startsWith("O1") || De.startsWith("C1")) && c(we, Ne, Ze), n.push({ carbohydrateIndex: we, elementIndex: Ne, elementUnit: Ze, fromCarbohydrate: !0 });
            }
            else if (Se.length === 0) for (var rt = 0, st = qe; rt < st.length; rt++)
              Ie = st[rt], n.push({ carbohydrateIndex: Ie, elementIndex: ae, elementUnit: Ue, fromCarbohydrate: !1 });
          }
        });
      });
    });
  return O({ links: t, terminalLinks: n, elements: r, partialElements: i }, function(ce, ae, he) {
    function Oe(tn, Te) {
      return as(tn.id, Te);
    }
    function Ne(tn, Te, At) {
      var Gt = [], Tt = tn.get(Oe(Te, At));
      if (Tt !== void 0) for (var nn = 0, Pt = Tt; nn < Pt.length; nn++)
        Qo(Gt, Pt[nn]);
      return Gt;
    }
    for (var Ue = /* @__PURE__ */ new Map(), Ze = 0, Se = ce.length; Ze < Se; ++Ze) for (var qe = ce[Ze], Pe = qe.unit, Xe = qe.ringIndex, Ke = 0, de = (ge = Pe.rings.all[Xe]).length; Ke < de; ++Ke) {
      var we = Oe(Pe, Pe.elements[ge[Ke]]);
      (Mt = Ue.get(we)) === void 0 ? Ue.set(we, [Ze]) : Mt.push(Ze);
    }
    function Ie(tn, Te) {
      return Ne(Ue, tn, Te);
    }
    var Ee = /* @__PURE__ */ new Map();
    for (Ze = 0, Se = ae.length; Ze < Se; ++Ze) {
      var Le = ce[ae[Ze].carbohydrateIndexA];
      for (Pe = Le.unit, Xe = Le.ringIndex, Ke = 0, de = (ge = Pe.rings.all[Xe]).length; Ke < de; ++Ke)
        we = Oe(Pe, Pe.elements[ge[Ke]]), (Mt = Ee.get(we)) === void 0 ? Ee.set(we, [Ze]) : Mt.push(Ze);
    }
    function De(tn, Te) {
      return Ne(Ee, tn, Te);
    }
    var rt = /* @__PURE__ */ new Map();
    for (Ze = 0, Se = he.length; Ze < Se; ++Ze) {
      var st = he[Ze], gt = st.fromCarbohydrate, ft = st.carbohydrateIndex, yt = st.elementUnit, It = st.elementIndex;
      if (gt) {
        var ge, Je = ce[ft];
        for (Pe = Je.unit, Xe = Je.ringIndex, Ke = 0, de = (ge = Pe.rings.all[Xe]).length; Ke < de; ++Ke)
          we = Oe(Pe, Pe.elements[ge[Ke]]), (Mt = rt.get(we)) === void 0 ? rt.set(we, [Ze]) : Mt.push(Ze);
      } else {
        var Mt;
        we = Oe(yt, yt.elements[It]), (Mt = rt.get(we)) === void 0 ? rt.set(we, [Ze]) : Mt.push(Ze);
      }
    }
    function wn(tn, Te) {
      return Ne(rt, tn, Te);
    }
    return { getElementIndices: Ie, getLinkIndices: De, getTerminalLinkIndices: wn };
  }(r, t, n));
}
var o2 = pe(), Tj = new ms("14"), kj = new ms("98");
function Dj(e) {
  var t = e.units, n = function(u) {
    return u > 500 ? Tj : kj;
  }(t.length);
  n.reset();
  for (var r = 0, i = t.length; r < i; r++) {
    var a = (o = t[r]).boundary;
    (s = o.conformation.operator).isIdentity ? n.includeSphere(a.sphere) : (pe.transform(o2, a.sphere, s.matrix), n.includeSphere(o2));
  }
  for (n.finishedIncludeStep(), r = 0, i = t.length; r < i; r++) {
    var o, s;
    a = (o = t[r]).boundary, (s = o.conformation.operator).isIdentity ? n.radiusSphere(a.sphere) : (pe.transform(o2, a.sphere, s.matrix), n.radiusSphere(o2));
  }
  return { box: n.getBox(), sphere: n.getSphere() };
}
var ze = function() {
  function e(t, n, r, i, a) {
    this.units = t, this.unitMap = n, this.unitIndexMap = r, this.state = i, this._child = a == null ? void 0 : a.child, this._target = a == null ? void 0 : a.target, this._proxy = void 0;
  }
  return e.prototype.subsetBuilder = function(t) {
    return new xj(this, t);
  }, Object.defineProperty(e.prototype, "elementCount", { get: function() {
    return this.state.elementCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "bondCount", { get: function() {
    return this.state.bondCount === -1 && (this.state.bondCount = this.interUnitBonds.edgeCount + pt.getIntraUnitBondCount(this)), this.state.bondCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasCustomProperties", { get: function() {
    return !!this.state.customProps && this.state.customProps.all.length > 0;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "customPropertyDescriptors", { get: function() {
    return this.state.customProps || (this.state.customProps = new Rm()), this.state.customProps;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "currentPropertyData", { get: function() {
    return this.state.propertyData || (this.state.propertyData = /* @__PURE__ */ Object.create(null)), this.state.propertyData;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "inheritedPropertyData", { get: function() {
    return this.parent ? this.parent.currentPropertyData : this.currentPropertyData;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "polymerResidueCount", { get: function() {
    return this.state.polymerResidueCount === -1 && (this.state.polymerResidueCount = function(t) {
      for (var n = t.units, r = 0, i = 0, a = n.length; i < a; i++) r += n[i].polymerElements.length;
      return r;
    }(this)), this.state.polymerResidueCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "polymerGapCount", { get: function() {
    return this.state.polymerGapCount === -1 && (this.state.polymerGapCount = function(t) {
      for (var n = t.units, r = 0, i = 0, a = n.length; i < a; i++) r += n[i].gapElements.length / 2;
      return r;
    }(this)), this.state.polymerGapCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "polymerUnitCount", { get: function() {
    return this.state.polymerUnitCount === -1 && (this.state.polymerUnitCount = function(t) {
      for (var n = t.units, r = 0, i = 0, a = n.length; i < a; i++) n[i].polymerElements.length > 0 && (r += 1);
      return r;
    }(this)), this.state.polymerUnitCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "uniqueElementCount", { get: function() {
    return this.state.uniqueElementCount === -1 && (this.state.uniqueElementCount = function(t) {
      for (var n = t.unitSymmetryGroups, r = 0, i = 0, a = n.length; i < a; i++) r += n[i].elements.length;
      return r;
    }(this)), this.state.uniqueElementCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "atomicResidueCount", { get: function() {
    return this.state.atomicResidueCount === -1 && (this.state.atomicResidueCount = function(t) {
      for (var n = t.units, r = 0, i = 0, a = n.length; i < a; i++) {
        var o = n[i];
        if (ve.isAtomic(o)) for (var s = o.elements, u = o.residueIndex, l = -1, c = -1, d = 0, f = s.length; d < f; ++d) (l = u[s[d]]) !== c && (r += 1, c = l);
      }
      return r;
    }(this)), this.state.atomicResidueCount;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isCoarseGrained", { get: function() {
    return this.models.some(function(t) {
      return nr.isCoarseGrained(t);
    });
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isEmpty", { get: function() {
    return this.units.length === 0;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hashCode", { get: function() {
    return this.state.hashCode !== -1 ? this.state.hashCode : this.computeHash();
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "transformHash", { get: function() {
    return this.state.transformHash !== -1 || (this.state.transformHash = pa(this.units.map(function(t) {
      return t.id;
    }))), this.state.transformHash;
  }, enumerable: !1, configurable: !0 }), e.prototype.computeHash = function() {
    for (var t = 23, n = 0, r = this.units.length; n < r; n++) {
      var i = this.units[n];
      t = 31 * (t = 31 * t + i.id | 0) + Me.hashCode(i.elements) | 0;
    }
    return (t = CT(t = 31 * t + this.elementCount | 0)) === -1 && (t = 0), this.state.hashCode = t, t;
  }, e.prototype.elementLocations = function() {
    return new e.ElementLocationIterator(this);
  }, Object.defineProperty(e.prototype, "root", { get: function() {
    var t;
    return (t = this.state.parent) !== null && t !== void 0 ? t : this;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "parent", { get: function() {
    return this.state.parent;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "coordinateSystem", { get: function() {
    return this.state.coordinateSystem;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "label", { get: function() {
    return this.state.label;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "boundary", { get: function() {
    return this.state.boundary || (this.state.boundary = Dj(this)), this.state.boundary;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "lookup3d", { get: function() {
    return this.state.lookup3d || (this.state.lookup3d = new fq(this)), this.state.lookup3d;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "interUnitBonds", { get: function() {
    return this.state.interUnitBonds || (this.parent && this.state.dynamicBonds === this.parent.state.dynamicBonds && this.parent.state.interUnitBonds && this.parent.state.interUnitBonds.edgeCount === 0 ? this.state.interUnitBonds = new Jg(/* @__PURE__ */ new Map()) : this.state.interUnitBonds = qH(this, { ignoreWater: !this.dynamicBonds, ignoreIon: !this.dynamicBonds })), this.state.interUnitBonds;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "dynamicBonds", { get: function() {
    return this.state.dynamicBonds;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "unitSymmetryGroups", { get: function() {
    return this.state.unitSymmetryGroups || (this.state.unitSymmetryGroups = nm.computeTransformGroups(this)), this.state.unitSymmetryGroups;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "unitSymmetryGroupsIndexMap", { get: function() {
    return this.state.unitSymmetryGroupsIndexMap || (this.state.unitSymmetryGroupsIndexMap = ve.SymmetryGroup.getUnitSymmetryGroupsIndexMap(this.unitSymmetryGroups)), this.state.unitSymmetryGroupsIndexMap;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "carbohydrates", { get: function() {
    return this.state.carbohydrates || (this.state.carbohydrates = Ej(this)), this.state.carbohydrates;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "models", { get: function() {
    return this.state.models || (this.state.models = function(t) {
      for (var n = t.units, r = or.create(), i = 0, a = n; i < a.length; i++) {
        var o = a[i];
        or.add(r, o.model.id, o.model);
      }
      return r.array;
    }(this)), this.state.models;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "uniqueResidueNames", { get: function() {
    return this.state.uniqueResidueNames || (this.state.uniqueResidueNames = function(t) {
      for (var n = Fe.residue.microheterogeneityCompIds, r = /* @__PURE__ */ new Set(), i = He.create(t), a = 0, o = t.unitSymmetryGroups; a < o.length; a++) {
        var s = o[a].units[0];
        if (ve.isAtomic(s)) {
          var u = Kt.transientSegments(s.model.atomicHierarchy.residueAtomSegments, s.elements);
          for (i.unit = s; u.hasNext; ) {
            var l = u.move();
            i.element = s.elements[l.start];
            for (var c = 0, d = n(i); c < d.length; c++) {
              var f = d[c];
              r.add(f);
            }
          }
        }
      }
      return r;
    }(this));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "uniqueElementSymbols", { get: function() {
    return this.state.uniqueElementSymbols || (this.state.uniqueElementSymbols = function(t) {
      for (var n = Fe.atom.type_symbol, r = /* @__PURE__ */ new Set(), i = He.create(t), a = 0, o = t.unitSymmetryGroups; a < o.length; a++) {
        var s = o[a].units[0];
        if (ve.isAtomic(s)) {
          i.unit = s;
          for (var u = 0, l = s.elements.length; u < l; ++u) i.element = s.elements[u], r.add(n(i));
        }
      }
      return r;
    }(this));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "entityIndices", { get: function() {
    return this.state.entityIndices || (this.state.entityIndices = function(t) {
      for (var n = t.units, r = He.create(t), i = or.create(), a = 0, o = n; a < o.length; a++) {
        var s = o[a], u = s.kind === 0 ? Fe.entity.key : Fe.coarse.entityKey;
        r.unit = s;
        for (var l = s.elements, c = Kt.transientSegments(s.model.atomicHierarchy.chainAtomSegments, l); c.hasNext; ) {
          var d = c.move();
          r.element = l[d.start];
          var f = u(r);
          or.add(i, f, f);
        }
      }
      return zs(i.array), i.array;
    }(this));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "uniqueAtomicResidueIndices", { get: function() {
    return this.state.uniqueAtomicResidueIndices || (this.state.uniqueAtomicResidueIndices = function(t) {
      for (var n = /* @__PURE__ */ new Map(), r = [], i = t.unitSymmetryGroups, a = 0, o = i; a < o.length; a++) {
        var s = o[a].units[0];
        if (ve.isAtomic(s)) {
          var u = void 0;
          n.has(s.model.id) ? u = n.get(s.model.id) : (u = or.create(), r.push(s.model.id), n.set(s.model.id, u));
          for (var l = Kt.transientSegments(s.model.atomicHierarchy.residueAtomSegments, s.elements); l.hasNext; ) {
            var c = l.move();
            or.add(u, c.index, c.index);
          }
        }
      }
      for (var d = /* @__PURE__ */ new Map(), f = 0, p = r; f < p.length; f++) {
        var g = p[f], m = n.get(g).array;
        zs(m), d.set(g, m);
      }
      return d;
    }(this));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isAtomic", { get: function() {
    for (var t = 0, n = this.units; t < n.length; t++) {
      var r = n[t];
      if (!ve.isAtomic(r)) return !1;
    }
    return !0;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasAtomic", { get: function() {
    for (var t = 0, n = this.units; t < n.length; t++) {
      var r = n[t];
      if (ve.isAtomic(r)) return !0;
    }
    return !1;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isCoarse", { get: function() {
    for (var t = 0, n = this.units; t < n.length; t++) {
      var r = n[t];
      if (!ve.isCoarse(r)) return !1;
    }
    return !0;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "hasCoarse", { get: function() {
    for (var t = 0, n = this.units; t < n.length; t++) {
      var r = n[t];
      if (ve.isCoarse(r)) return !0;
    }
    return !1;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "serialMapping", { get: function() {
    return this.state.serialMapping || (this.state.serialMapping = function(t) {
      for (var n = t.units, r = t.elementCount, i = t.unitIndexMap, a = new Uint32Array(n.length), o = new Uint32Array(r), s = new Uint32Array(r), u = 0, l = 0, c = n.length; u < c; ++u) {
        a[u] = l;
        for (var d = n[u].elements, f = 0, p = d.length; f < p; ++f) {
          var g = l + f;
          o[g] = u, s[g] = d[f];
        }
        l += d.length;
      }
      return { cumulativeUnitElementCount: a, unitIndices: o, elementIndices: s, getSerialIndex: function(m, v) {
        return a[i.get(m.id)] + _e.indexOf(m.elements, v);
      } };
    }(this));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "model", { get: function() {
    if (this.state.model) return this.state.model;
    if (this.state.representativeModel) return this.state.representativeModel;
    if (this.state.masterModel) return this.state.masterModel;
    var t = this.models;
    if (t.length > 1) throw new Error("The structure is based on multiple models and has neither a master- nor a representative-model.");
    return this.state.model = t[0], this.state.model;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "masterModel", { get: function() {
    return this.state.masterModel;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "representativeModel", { get: function() {
    return this.state.representativeModel;
  }, enumerable: !1, configurable: !0 }), e.prototype.hasElement = function(t) {
    return !!this.unitMap.has(t.unit.id) && Me.has(this.unitMap.get(t.unit.id).elements, t.element);
  }, e.prototype.getModelIndex = function(t) {
    return this.models.indexOf(t);
  }, e.prototype.remapModel = function(t) {
    for (var n = this.state, r = n.dynamicBonds, i = n.interUnitBonds, a = n.parent, o = [], s = 0, u = this.unitSymmetryGroups; s < u.length; s++) {
      var l = u[s], c = l.units[0].remapModel(t, r);
      o.push(c);
      for (var d = 1, f = l.units.length; d < f; ++d) {
        var p = l.units[d];
        o.push(p.remapModel(t, r, c.props));
      }
    }
    return e.create(o, { parent: a == null ? void 0 : a.remapModel(t), label: this.label, interUnitBonds: r ? void 0 : i, dynamicBonds: r });
  }, e.prototype.asParent = function() {
    if (this._proxy) return this._proxy;
    if (this.parent) {
      var t = this.parent.coordinateSystem.isIdentity ? this.parent : e.transform(this.parent, this.parent.coordinateSystem.inverse), n = this.coordinateSystem.isIdentity ? t : e.transform(t, this.coordinateSystem.matrix);
      this._proxy = new e(n.units, n.unitMap, n.unitIndexMap, O(O({}, n.state), { dynamicBonds: this.dynamicBonds }), { child: this, target: this.parent });
    } else this._proxy = this;
    return this._proxy;
  }, Object.defineProperty(e.prototype, "child", { get: function() {
    return this._child;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "target", { get: function() {
    var t;
    return (t = this._target) !== null && t !== void 0 ? t : this;
  }, enumerable: !1, configurable: !0 }), e;
}();
function Oj(e, t, n) {
  return e[t].id - e[n].id;
}
(function(e) {
  function t(h) {
    return { kind: "structure-loci", structure: h };
  }
  function n(h, y) {
    y === void 0 && (y = {});
    for (var x = Mu.Mutable(), S = Mu.Mutable(), b = 0, _ = !0, C = h.length > 0 ? h[0].id : 0, w = 0, I = h.length; w < I; w++) {
      var M = h[w];
      x.set(M.id, M), b += M.elements.length, M.id < C && (_ = !1), C = M.id;
    }
    for (_ || xT(h, 0, h.length, Oj, Qd), w = 0, I = h.length; w < I; w++) S.set(h[w].id, w);
    var E = { hashCode: -1, transformHash: -1, elementCount: b, bondCount: -1, uniqueElementCount: -1, atomicResidueCount: -1, polymerResidueCount: -1, polymerGapCount: -1, polymerUnitCount: -1, dynamicBonds: !1, coordinateSystem: lr.Default, label: "" };
    return y.parent && (E.parent = y.parent.parent || y.parent), y.interUnitBonds && (E.interUnitBonds = y.interUnitBonds), y.dynamicBonds ? E.dynamicBonds = y.dynamicBonds : y.parent && (E.dynamicBonds = y.parent.dynamicBonds), y.coordinateSystem ? E.coordinateSystem = y.coordinateSystem : y.parent && (E.coordinateSystem = y.parent.coordinateSystem), y.label ? E.label = y.label : y.parent && (E.label = y.parent.label), y.masterModel ? E.masterModel = y.masterModel : y.parent && (E.masterModel = y.parent.masterModel), y.representativeModel ? E.representativeModel = y.representativeModel : y.parent && (E.representativeModel = y.parent.representativeModel), new e(h, x, S, E);
  }
  function r(h, y) {
    y === void 0 && (y = {});
    for (var x = h.atomicHierarchy.chainAtomSegments, S = h.atomicHierarchy.index, b = h.atomicHierarchy.chains.auth_asym_id, _ = h.atomicChainOperatorMappinng, C = new o(O({ label: h.label }, y)), w = 0; w < x.count; w++) {
      var I = _.get(w) || lr.Default, M = x.offsets[w];
      Cf.chainResidueCount(h.atomicHierarchy, w), x.offsets[w + 1], x.offsets[w];
      var E = !1;
      if (i(h, w)) for (; w + 1 < x.count && i(h, w + 1) && _.get(w) === _.get(w + 1); )
        E = !0, w++;
      else for (; w + 1 < x.count && x.offsets[w + 1] - x.offsets[w] == 1 && x.offsets[w + 2] - x.offsets[w + 1] == 1 && !(S.getEntityFromChain(w) !== S.getEntityFromChain(w + 1) || b.value(w) !== b.value(w + 1) || _.get(w) !== _.get(w + 1)); )
        E = !0, w++;
      var T = Me.ofBounds(M, x.offsets[w + 1]);
      C.addUnit(0, h, I, T, E ? 1 : 0);
    }
    var P = h.coarseHierarchy;
    return P.isDefined && (P.spheres.count > 0 && a(C, h, h.coarseHierarchy.spheres, 1), P.gaussians.count > 0 && a(C, h, h.coarseHierarchy.gaussians, 2)), C.getStructure();
  }
  function i(h, y) {
    var x = h.atomicHierarchy.index.getEntityFromChain(y);
    return h.entities.data.type.value(x) === "water";
  }
  function a(h, y, x, S) {
    for (var b = x.chainElementSegments, _ = 0; _ < b.count; _++) {
      var C = Me.ofBounds(b.offsets[_], b.offsets[_ + 1]);
      h.addUnit(S, y, lr.Default, C, 0);
    }
  }
  e.Empty = n([]), e.Loci = t, e.toStructureElementLoci = function(h) {
    for (var y = [], x = 0, S = h.units; x < S.length; x++) {
      var b = S[x];
      y.push({ unit: b, indices: le.ofBounds(0, b.elements.length) });
    }
    return ke(h, y);
  }, e.toSubStructureElementLoci = function(h, y) {
    return nt.toLociWithSourceUnits(nt.Singletons(h, y));
  }, e.isLoci = function(h) {
    return !!h && h.kind === "structure-loci";
  }, e.areLociEqual = function(h, y) {
    return h.structure === y.structure;
  }, e.isLociEmpty = function(h) {
    return h.structure.isEmpty;
  }, e.remapLoci = function(h, y) {
    return y === h.structure ? h : t(y);
  }, e.create = n, e.ofTrajectory = function(h, y) {
    return se(this, 0, void 0, function() {
      var x, S, b, _, C, w, I, M, E, T, P, k, D;
      return ie(this, function(B) {
        switch (B.label) {
          case 0:
            if (h.frameCount === 0) return [2, e.Empty];
            x = [], S = void 0, b = 0, _ = 0, C = h.frameCount, B.label = 1;
          case 1:
            return _ < C ? [4, Xt.resolveInContext(h.getFrameAtIndex(_), y)] : [3, 4];
          case 2:
            for (w = B.sent(), S || (S = w), I = r(w), M = 0, E = I.units.length; M < E; ++M) T = I.units[M], P = T.invariantId + b, k = T.chainGroupId + b, D = ve.create(x.length, P, k, T.traits, T.kind, T.model, T.conformation.operator, T.elements), x.push(D);
            b = x.length, B.label = 3;
          case 3:
            return ++_, [3, 1];
          case 4:
            return [2, n(x, { representativeModel: S, label: S.label })];
        }
      });
    });
  }, e.ofModel = r, e.transform = function(h, y) {
    if (ne.isIdentity(y)) return h;
    if (!ne.isRotationAndTranslation(y, lr.RotationTranslationEpsilon)) throw new Error("Only rotation/translation combination can be applied.");
    for (var x = [], S = 0, b = h.units; S < b.length; S++) {
      var _ = b[S], C = _.conformation.operator, w = lr.create(C.name, y, C);
      x.push(_.applyOperator(_.id, w));
    }
    var I = h.coordinateSystem;
    return n(x, { parent: h, coordinateSystem: lr.compose(lr.create(I.name, y, I), I) });
  };
  var o = function() {
    function h(y) {
      y === void 0 && (y = {}), this.props = y, this.units = [], this.invariantId = ha(), this.chainGroupId = -1, this.inChainGroup = !1, this.p = A(), this.singleElementUnits = /* @__PURE__ */ new Map();
    }
    return h.prototype.beginChainGroup = function() {
      this.chainGroupId++, this.inChainGroup = !0;
    }, h.prototype.endChainGroup = function() {
      this.inChainGroup = !1;
    }, h.prototype.addUnit = function(y, x, S, b, _, C) {
      C === void 0 && (C = this.invariantId());
      var w = this.inChainGroup ? this.chainGroupId : ++this.chainGroupId, I = ve.create(C, C, w, _, y, x, S, b);
      return this.add(I);
    }, h.prototype.add = function(y) {
      if (y.elements.length === 1) {
        y.conformation.position(y.elements[0], this.p);
        var x = [y.invariantId, this.p[0], this.p[1], this.p[2]].join("|");
        if (this.singleElementUnits.has(x)) return this.singleElementUnits.get(x);
        this.singleElementUnits.set(x, y);
      }
      return this.units.push(y), y;
    }, h.prototype.addWithOperator = function(y, x, S) {
      return S === void 0 && (S = !1), this.add(y.applyOperator(this.units.length, x, S));
    }, h.prototype.getStructure = function() {
      return n(this.units, this.props);
    }, Object.defineProperty(h.prototype, "isEmpty", { get: function() {
      return this.units.length === 0;
    }, enumerable: !1, configurable: !0 }), h;
  }();
  function s(h, y) {
    if (h === y) return !0;
    if (h.elementCount !== y.elementCount) return !1;
    var x = h.units.length;
    if (x !== y.units.length) return !1;
    for (var S = 0; S < x; S++) if (h.units[S].id !== y.units[S].id) return !1;
    return !0;
  }
  function u(h, y) {
    return h === y || h.hashCode === y.hashCode && nm.areTransformGroupsEquivalent(h.unitSymmetryGroups, y.unitSymmetryGroups);
  }
  e.StructureBuilder = o, e.Builder = function(h) {
    return h === void 0 && (h = {}), new o(h);
  }, e.hashCode = function(h) {
    return h.hashCode;
  }, e.conformationHash = function(h) {
    return t5(h.units.map(function(y) {
      return ve.conformationId(y);
    }).join("|"));
  }, e.areUnitIdsEqual = s, e.areUnitIdsAndIndicesEqual = function(h, y) {
    if (!s(h, y)) return !1;
    for (var x = 0, S = h.units.length; x < S; x++) if (!Me.areEqual(h.units[x].elements, y.units[x].elements)) return !1;
    return !0;
  }, e.areHierarchiesEqual = function(h, y) {
    if (h.hashCode !== y.hashCode) return !1;
    var x = h.models.length;
    if (x !== y.models.length) return !1;
    for (var S = 0; S < x; S++) if (!nr.areHierarchiesEqual(h.models[S], y.models[S])) return !1;
    return !0;
  }, e.areEquivalent = u, e.areRootsEquivalent = function(h, y) {
    return u(h.root, y.root);
  }, e.areRootsEqual = function(h, y) {
    return h.root === y.root;
  };
  var l = function() {
    function h(y) {
      this.structure = y, this.unitIndex = 0, this.maxIdx = 0, this.idx = -1, this.current = He.create(y), this.hasNext = y.elementCount > 0, this.hasNext && (this.elements = y.units[0].elements, this.maxIdx = this.elements.length - 1, this.current.unit = y.units[0]);
    }
    return h.prototype.move = function() {
      return this.advance(), this.current.element = this.elements[this.idx], this.current;
    }, h.prototype.advance = function() {
      if (this.idx < this.maxIdx) return this.idx++, void (this.idx === this.maxIdx && (this.hasNext = this.unitIndex + 1 < this.structure.units.length));
      this.idx = 0, this.unitIndex++, this.unitIndex >= this.structure.units.length ? this.hasNext = !1 : (this.current.unit = this.structure.units[this.unitIndex], this.elements = this.current.unit.elements, this.maxIdx = this.elements.length - 1, this.maxIdx === 0 && (this.hasNext = this.unitIndex + 1 < this.structure.units.length));
    }, h;
  }();
  e.ElementLocationIterator = l;
  var c = A();
  function d(h, y, x) {
    for (var S = h.elements, b = h.conformation, _ = b.position, C = b.r, w = c, I = Number.MAX_VALUE, M = 0, E = S.length; M < E; M++) {
      var T = S[M], P = A.distance(y, _(T, w)) - x - C(T);
      P < I && (I = P);
    }
    return I;
  }
  function f(h, y, x) {
    for (var S = h.units, b = Number.MAX_VALUE, _ = 0, C = S.length; _ < C; _++) {
      var w = d(S[_], y, x);
      w < b && (b = w);
    }
    return b;
  }
  e.minDistanceToPoint = f;
  var p, g = A();
  function m(h) {
    return h.unitSymmetryGroups.filter(function(y) {
      return y.units[0].polymerElements.length > 0;
    });
  }
  e.distance = function(h, y) {
    if (h.elementCount === 0 || y.elementCount === 0) return 0;
    for (var x = h.units, S = Number.MAX_VALUE, b = 0, _ = x.length; b < _; b++) for (var C = x[b], w = C.elements, I = C.conformation, M = I.position, E = I.r, T = 0, P = w.length; T < P; T++) {
      var k = w[T], D = f(y, M(k, g), E(k));
      D < S && (S = D);
    }
    return S;
  }, e.elementDescription = function(h) {
    return h.elementCount === 1 ? "1 element" : "".concat(h.elementCount, " elements");
  }, e.validUnitPair = function(h, y, x) {
    return !0;
  }, e.eachUnitPair = function(h, y, x) {
    var S = x.maxRadius, b = x.validUnit, _ = x.validUnitPair;
    if (h.units.some(function(B) {
      return b(B);
    })) for (var C = h.lookup3d, w = A(), I = 0, M = h.units; I < M.length; I++) {
      var E = M[I];
      if (b(E)) {
        var T = E.boundary.sphere;
        A.transformMat4(w, T.center, E.conformation.operator.matrix);
        for (var P = C.findUnitIndices(w[0], w[1], w[2], T.radius + S + 9999), k = 0; k < P.count; k++) {
          var D = h.units[P.indices[k]];
          !b(D) || E.id >= D.id || !_(E, D) || (D.elements.length >= E.elements.length ? y(E, D) : y(D, E));
        }
      }
    }
  }, e.eachAtomicHierarchyElement = function(h, y) {
    for (var x = y.chain, S = y.residue, b = y.atom, _ = He.create(h), C = 0, w = h.units; C < w.length; C++) {
      var I = w[C];
      if (I.kind === 0) {
        _.unit = I;
        for (var M = I.elements, E = Kt.transientSegments(I.model.atomicHierarchy.chainAtomSegments, M), T = Kt.transientSegments(I.model.atomicHierarchy.residueAtomSegments, M); E.hasNext; ) {
          var P = E.move();
          if (x && (_.element = M[P.start], x(_)), S || b) for (T.setSegment(P); T.hasNext; ) {
            var k = T.move();
            if (S && (_.element = M[k.start], S(_)), b) for (var D = k.start, B = k.end; D < B; D++) _.element = M[D], b(_);
          }
        }
      }
    }
  }, e.DefaultSizeThresholds = { smallResidueCount: 10, mediumResidueCount: 5e3, largeResidueCount: 3e4, highSymmetryUnitCount: 10, fiberResidueCount: 15 }, function(h) {
    h[h.Small = 0] = "Small", h[h.Medium = 1] = "Medium", h[h.Large = 2] = "Large", h[h.Huge = 3] = "Huge", h[h.Gigantic = 4] = "Gigantic";
  }(p = e.Size || (e.Size = {})), e.getSize = function(h, y, x) {
    y === void 0 && (y = {}), x === void 0 && (x = 1);
    var S = O(O({}, e.DefaultSizeThresholds), y);
    return h.polymerResidueCount >= S.largeResidueCount * x ? function(b, _) {
      var C = m(b);
      return C.length >= 1 && C[0].units.length > _.highSymmetryUnitCount;
    }(h, S) ? p.Huge : p.Gigantic : function(b, _) {
      var C = m(b);
      return C.length === 1 && C[0].units.length > 2 && C[0].units[0].polymerElements.length < _.fiberResidueCount;
    }(h, S) || h.polymerResidueCount < S.smallResidueCount * x ? p.Small : h.polymerResidueCount < S.mediumResidueCount * x ? p.Medium : p.Large;
  }, e.Index = tm.createSimple("index", "root");
  var v = "__PrincipalAxes__";
  e.getPrincipalAxes = function(h) {
    if (h.currentPropertyData[v]) return h.currentPropertyData[v];
    var y = ke.getPrincipalAxes(e.toStructureElementLoci(h));
    return h.currentPropertyData[v] = y, y;
  };
})(ze || (ze = {}));
var Sf, V1, DC, OC, BC, Bj = Xr.diff;
function ke(e, t) {
  return { kind: "element-loci", structure: e, elements: t };
}
(function(e) {
  function t(S) {
    for (var b = 0, _ = S.elements; b < _.length; b++) {
      var C = _[b];
      if (_e.size(C.indices) > 0) return !1;
    }
    return !0;
  }
  function n(S) {
    for (var b = 0, _ = 0, C = S.elements; _ < C.length; _++) {
      var w = C[_].indices;
      b += typeof w == "number" ? Bj(w) : w.length;
    }
    return b;
  }
  function r(S) {
    return t(S) ? S : e(S.structure, [{ unit: S.elements[0].unit, indices: _e.ofSingleton(_e.start(S.elements[0].indices)) }]);
  }
  function i(S) {
    return S.length > 3 && Me.isRange(S) ? le.ofRange(S[0], S[S.length - 1]) : Me.ofSortedArray(S);
  }
  function a(S, b) {
    for (var _ = [], C = /* @__PURE__ */ new Set(), w = 0, I = S.elements; w < I.length; w++) {
      var M = I[w];
      if (s(M)) _[_.length] = M;
      else if (M.unit.kind === 0) {
        for (var E = M.unit.elements, T = M.unit.model.atomicHierarchy, P = M.unit.model.atomicHierarchy.atoms.label_alt_id, k = T.residueAtomSegments, D = k.index, B = k.offsets, L = [], F = M.indices, V = _e.size(F), G = 0; G < V; ) {
          C.clear();
          var H = E[_e.getAt(F, G)], q = D[H];
          for (C.add(P.value(H)), G++; G < V; ) {
            var z = E[_e.getAt(F, G)];
            if (D[z] !== q) break;
            C.add(P.value(z)), G++;
          }
          for (var K = C.has(""), Y = B[q], Z = B[q + 1]; Y < Z; Y++) {
            var X = _e.indexOf(E, Y);
            if (X >= 0) {
              var W = P.value(Y);
              b && !K && W && !C.has(W) || (L[L.length] = X);
            }
          }
        }
        _[_.length] = { unit: M.unit, indices: i(L) };
      } else _[_.length] = M;
    }
    return e(S.structure, _);
  }
  function o(S) {
    switch (S.kind) {
      case 0:
        return S.model.atomicHierarchy.chainAtomSegments;
      case 1:
        return S.model.coarseHierarchy.spheres.chainElementSegments;
      case 2:
        return S.model.coarseHierarchy.gaussians.chainElementSegments;
    }
  }
  function s(S) {
    return S.unit.elements.length === _e.size(S.indices);
  }
  function u(S, b, _) {
    for (var C = o(S).index, w = S.elements, I = 0, M = 0, E = w.length; M < E; M++) {
      var T = C[w[M]];
      b.has(T) && I++;
    }
    if (I !== S.elements.length) {
      var P = new Int32Array(I);
      for (I = 0, M = 0, E = w.length; M < E; M++)
        T = C[w[M]], b.has(T) && (P[I++] = M);
      P.length > 0 && (_[_.length] = { unit: S, indices: i(P) });
    } else _[_.length] = { unit: S, indices: le.ofBounds(0, I) };
  }
  function l(S, b, _, C, w) {
    for (var I = o(S.elements[0].unit).index, M = /* @__PURE__ */ new Set(), E = b; E < _; E++) for (var T = S.elements[E], P = T.indices, k = T.unit.elements, D = 0, B = _e.size(P); D < B; D++) M.add(I[k[_e.getAt(P, D)]]);
    if (C) for (var L = S.elements[0].unit, F = 0, V = S.structure.units; F < V.length; F++) {
      var G = V[F];
      ve.areSameChainOperatorGroup(G, L) && u(G, M, w);
    }
    else for (E = b; E < _; E++) u(S.elements[E].unit, M, w);
  }
  function c(S) {
    for (var b = [], _ = 0, C = S.elements.length; _ < C; _++) {
      var w = S.elements[_];
      if (ve.Traits.is(w.unit.traits, 2)) {
        for (var I = _; _ < C && ve.areSameChainOperatorGroup(S.elements[_].unit, w.unit); ) _++;
        var M = _;
        _--, l(S, I, M, !0, b);
      } else s(w) ? b[b.length] = w : l(S, _, _ + 1, !1, b);
    }
    return e(S.structure, b);
  }
  function d(S) {
    return "".concat(S.unit.model.id, "|").concat(Fe.entity.id(S));
  }
  function f(S, b) {
    for (var _ = [], C = 0, w = _e.size(b); C < w; ++C) _.push(S[_e.getAt(b, C)]);
    return Me.ofSortedArray(_);
  }
  function p(S, b) {
    return Me.isRange(S) && Me.areEqual(S, b) ? le.ofLength(S.length) : i(Me.indicesOf(S, b));
  }
  e.is = function(S) {
    return !!S && S.kind === "element-loci";
  }, e.areEqual = function(S, b) {
    if (S.structure !== b.structure || S.elements.length !== b.elements.length) return !1;
    for (var _ = 0, C = S.elements.length; _ < C; ++_) {
      var w = S.elements[_], I = b.elements[_];
      if (w.unit.id !== I.unit.id || !_e.areEqual(w.indices, I.indices)) return !1;
    }
    return !0;
  }, e.isEmpty = t, e.isWholeStructure = function(S) {
    return n(S) === S.structure.elementCount;
  }, e.size = n, e.all = function(S) {
    return e(S, S.units.map(function(b) {
      return { unit: b, indices: _e.ofBounds(0, b.elements.length) };
    }));
  }, e.none = function(S) {
    return e(S, []);
  }, e.getFirstLocation = function(S, b) {
    if (!t(S)) {
      var _ = S.elements[0].unit, C = _.elements[_e.getAt(S.elements[0].indices, 0)];
      return b ? (b.structure = S.structure, b.unit = S.elements[0].unit, b.element = C, b) : He.create(S.structure, _, C);
    }
  }, e.firstElement = r, e.firstResidue = function(S) {
    return t(S) ? S : a(r(S));
  }, e.firstChain = function(S) {
    return t(S) ? S : c(r(S));
  }, e.toStructure = function(S) {
    for (var b = [], _ = function(I) {
      var M = I.unit, E = I.indices, T = new Int32Array(_e.size(E));
      _e.forEach(E, function(P, k) {
        return T[k] = M.elements[P];
      }), b.push(M.getChild(Me.ofSortedArray(T)));
    }, C = 0, w = S.elements; C < w.length; C++)
      _(w[C]);
    return ze.create(b, { parent: S.structure.parent });
  }, e.remap = function(S, b) {
    if (b === S.structure) return S;
    var _ = [];
    return S.elements.forEach(function(C) {
      if (b.unitMap.has(C.unit.id)) {
        var w = b.unitMap.get(C.unit.id), I = _e.indexedIntersect(C.indices, C.unit.elements, w.elements);
        _e.size(I) > 0 && _.push({ unit: w, indices: I });
      }
    }), e(b, _);
  }, e.union = function S(b, _) {
    if (b.elements.length > _.elements.length) return S(_, b);
    if (e.isEmpty(b)) return _;
    for (var C = /* @__PURE__ */ new Map(), w = 0, I = b.elements; w < I.length; w++) {
      var M = I[w];
      C.set(M.unit.id, M.indices);
    }
    for (var E = [], T = 0, P = _.elements; T < P.length; T++)
      M = P[T], C.has(M.unit.id) ? (E[E.length] = { unit: M.unit, indices: _e.union(C.get(M.unit.id), M.indices) }, C.delete(M.unit.id)) : E[E.length] = M;
    return C.forEach(function(k, D) {
      E[E.length] = { unit: b.structure.unitMap.get(D), indices: k };
    }), e(b.structure, E);
  }, e.subtract = function(S, b) {
    for (var _ = /* @__PURE__ */ new Map(), C = 0, w = b.elements; C < w.length; C++) {
      var I = w[C];
      _.set(I.unit.id, I.indices);
    }
    for (var M = [], E = 0, T = S.elements; E < T.length; E++)
      if (I = T[E], _.has(I.unit.id)) {
        var P = _e.subtract(I.indices, _.get(I.unit.id));
        if (_e.size(P) === 0) continue;
        M[M.length] = { unit: I.unit, indices: P };
      } else M[M.length] = I;
    return e(S.structure, M);
  }, e.intersect = function(S, b) {
    for (var _ = /* @__PURE__ */ new Map(), C = 0, w = S.elements; C < w.length; C++) {
      var I = w[C];
      _.set(I.unit.id, I.indices);
    }
    for (var M = [], E = 0, T = b.elements; E < T.length; E++)
      if (I = T[E], _.has(I.unit.id)) {
        var P = _e.intersect(_.get(I.unit.id), I.indices);
        _e.size(P) !== 0 && (M[M.length] = { unit: I.unit, indices: P });
      }
    return e(S.structure, M);
  }, e.areIntersecting = function S(b, _) {
    if (b.elements.length > _.elements.length) return S(_, b);
    if (e.isEmpty(b)) return e.isEmpty(_);
    for (var C = /* @__PURE__ */ new Map(), w = 0, I = b.elements; w < I.length; w++) {
      var M = I[w];
      C.set(M.unit.id, M.indices);
    }
    for (var E = 0, T = _.elements; E < T.length; E++)
      if (M = T[E], C.has(M.unit.id) && _e.areIntersecting(C.get(M.unit.id), M.indices)) return !0;
    return !1;
  }, e.isSubset = function(S, b) {
    if (e.isEmpty(S)) return e.isEmpty(b);
    for (var _ = /* @__PURE__ */ new Map(), C = 0, w = S.elements; C < w.length; C++) {
      var I = w[C];
      _.set(I.unit.id, I.indices);
    }
    for (var M = !1, E = 0, T = b.elements; E < T.length; E++)
      if (I = T[E], _.has(I.unit.id)) {
        if (!_e.isSubset(_.get(I.unit.id), I.indices)) return !1;
        M = !0;
      }
    return M;
  }, e.extendToWholeResidues = a, e.extendToWholeChains = c, e.extendToWholeEntities = function(S) {
    for (var b = [], _ = He.create(S.structure), C = /* @__PURE__ */ new Set(), w = S.structure.units, I = 0, M = S.elements.length; I < M; I++) {
      var E = S.elements[I];
      _.unit = E.unit, _.element = E.unit.elements[0], C.add(d(_));
    }
    I = 0;
    for (var T = w.length; I < T; ++I) {
      var P = w[I];
      if (_.unit = P, _.element = P.elements[0], C.has(d(_))) {
        var k = _e.ofBounds(0, P.elements.length);
        b[b.length] = { unit: P, indices: k };
      }
    }
    return e(S.structure, b);
  }, e.extendToWholeModels = function(S) {
    for (var b = [], _ = /* @__PURE__ */ new Set(), C = S.structure.units, w = 0, I = S.elements.length; w < I; w++) {
      var M = S.elements[w];
      _.add(M.unit.model.id);
    }
    w = 0;
    for (var E = C.length; w < E; ++w) {
      var T = C[w];
      if (_.has(T.model.id)) {
        var P = _e.ofBounds(0, T.elements.length);
        b[b.length] = { unit: T, indices: P };
      }
    }
    return e(S.structure, b);
  }, e.extendToAllInstances = function(S) {
    for (var b = [], _ = /* @__PURE__ */ new Map(), C = 0, w = S.elements.length; C < w; C++) {
      var I = S.elements[C], M = I.unit.model, E = f(I.unit.elements, I.indices);
      _.has(M) ? _.set(M, Me.union(E, _.get(M))) : _.set(M, E);
    }
    C = 0;
    for (var T = S.structure.units.length; C < T; ++C) {
      var P = S.structure.units[C];
      if (E = _.get(P.model)) {
        var k = p(P.elements, E);
        _e.size(k) && (b[b.length] = { unit: P, indices: k });
      }
    }
    return e(S.structure, b);
  }, e.extendToWholeOperators = function(S) {
    for (var b = [], _ = /* @__PURE__ */ new Set(), C = S.structure.units, w = 0, I = S.elements.length; w < I; w++) {
      var M = S.elements[w];
      _.add(M.unit.conformation.operator.name);
    }
    w = 0;
    for (var E = C.length; w < E; ++w) {
      var T = C[w];
      if (_.has(T.conformation.operator.name)) {
        var P = _e.ofBounds(0, T.elements.length);
        b[b.length] = { unit: T, indices: P };
      }
    }
    return e(S.structure, b);
  };
  var g = new ms("98"), m = A();
  e.getBoundary = function(S, b) {
    g.reset();
    for (var _ = 0, C = S.elements; _ < C.length; _++) for (var w = (B = C[_]).indices, I = B.unit.conformation.position, M = B.unit.conformation.r, E = B.unit.elements, T = 0, P = _e.size(w); T < P; T++)
      I(L = E[_e.getAt(w, T)], m), b && A.transformMat4(m, m, b), g.includePositionRadius(m, M(L));
    g.finishedIncludeStep();
    for (var k = 0, D = S.elements; k < D.length; k++) {
      var B;
      for (w = (B = D[k]).indices, I = B.unit.conformation.position, M = B.unit.conformation.r, E = B.unit.elements, T = 0, P = _e.size(w); T < P; T++) {
        var L;
        I(L = E[_e.getAt(w, T)], m), b && A.transformMat4(m, m, b), g.radiusPositionRadius(m, M(L));
      }
    }
    return { box: g.getBox(), sphere: g.getSphere() };
  };
  var v = A();
  function h(S, b, _) {
    _ === void 0 && (_ = 0);
    for (var C = _, w = 0, I = S.elements; w < I.length; w++) {
      for (var M = I[w], E = M.indices, T = M.unit.conformation.position, P = M.unit.elements, k = _e.size(E), D = 0; D < k; D++)
        T(P[_e.getAt(E, D)], v), A.toArray(v, b, C + 3 * D);
      C += 3 * k;
    }
    return b;
  }
  function y(S, b) {
    return ve.isAtomic(S) ? S.model.atomicHierarchy.atomSourceIndex.value(b) : b;
  }
  function x(S, b, _, C, w) {
    zs(b);
    for (var I = [], M = [], E = 0, T = b.length; E < T; ) {
      var P = E;
      for (E++; E < T && b[E - 1] + 1 === b[E]; ) E++;
      var k = E;
      if (k - P > 12) I[I.length] = b[P], I[I.length] = b[k - 1];
      else for (var D = P; D < k; D++) M[M.length] = b[D];
    }
    return _ ? { atom: { set: M, ranges: I }, chain: { opName: [S] }, entity: { modelLabel: C, modelIndex: w } } : { atom: { set: M, ranges: I }, chain: { opName: [S] } };
  }
  e.toPositionsArray = h, e.getPrincipalAxes = function(S) {
    var b = n(S), _ = h(S, new Float32Array(3 * b));
    return Jc.ofPositions(_);
  }, e.getPrincipalAxesMany = function(S) {
    var b = 0;
    S.forEach(function(w) {
      b += n(w);
    });
    var _ = new Float32Array(3 * b), C = 0;
    return S.forEach(function(w) {
      h(w, _, C), C += 3 * n(w);
    }), Jc.ofPositions(_);
  }, e.toExpression = function(S) {
    var b;
    if (e.isEmpty(S)) return Ct.struct.generator.empty();
    for (var _ = S.structure.models, C = /* @__PURE__ */ new Map(), w = 0, I = S.elements; w < I.length; w++) {
      var M = (G = I[w]).indices, E = G.unit.elements, T = G.unit.conformation.operator.name, P = void 0;
      C.has(T) ? P = C.get(T).xs : (P = or.create(), C.set(T, { modelLabel: G.unit.model.label, modelIndex: G.unit.model.modelNum, xs: P }));
      for (var k = 0, D = _e.size(M); k < D; k++) {
        var B = y(G.unit, E[_e.getAt(M, k)]);
        or.add(P, B, B);
      }
    }
    for (var L = [], F = C.keys(); ; ) {
      var V = F.next();
      if (V.done) break;
      var G = C.get(V.value);
      L.push(x(V.value, G.xs.array, _.length > 1, G.modelLabel, G.modelIndex));
    }
    for (var H = /* @__PURE__ */ new Map(), q = (k = 0, L.length); k < q; ++k) {
      var z = L[k], K = Bm(pa(z.atom.ranges), pa(z.atom.set));
      T = "".concat(K, "|").concat(z.entity ? z.entity.modelLabel + z.entity.modelIndex : ""), H.has(T) ? (b = H.get(T).chain.opName).push.apply(b, z.chain.opName) : H.set(T, z);
    }
    var Y = [];
    return H.forEach(function(Z) {
      var X = Z.atom, W = X.ranges, J = X.set, $ = Z.chain.opName, ee = Ct.struct.atomProperty.core.operatorName(), ce = Ct.struct.atomProperty.core.sourceIndex(), ae = [];
      J.length > 0 && (ae[ae.length] = Ct.core.set.has([Ct.core.type.set(J), ce]));
      for (var he = 0, Oe = W.length / 2; he < Oe; he++) ae[ae.length] = Ct.core.rel.inRange([ce, W[2 * he], W[2 * he + 1]]);
      if (Z.entity) {
        var Ne = Z.entity, Ue = Ne.modelLabel, Ze = Ne.modelIndex;
        Y.push(Ct.struct.generator.atomGroups({ "atom-test": ae.length > 1 ? Ct.core.logic.or(ae) : ae[0], "chain-test": $.length > 1 ? Ct.core.set.has([Ct.core.type.set($), ee]) : Ct.core.rel.eq([ee, $[0]]), "entity-test": Ct.core.logic.and([Ct.core.rel.eq([Ct.struct.atomProperty.core.modelLabel(), Ue]), Ct.core.rel.eq([Ct.struct.atomProperty.core.modelIndex(), Ze])]) }));
      } else Y.push(Ct.struct.generator.atomGroups({ "atom-test": ae.length > 1 ? Ct.core.logic.or(ae) : ae[0], "chain-test": $.length > 1 ? Ct.core.set.has([Ct.core.type.set($), ee]) : Ct.core.rel.eq([ee, $[0]]) }));
    }), Ct.struct.modifier.union([Y.length === 1 ? Y[0] : Ct.struct.combinator.merge(Y.map(function(Z) {
      return Ct.struct.modifier.union([Z]);
    }))]);
  };
})(ke || (ke = {})), function(e) {
  function t() {
    return { elementCount: 0, conformationCount: 0, residueCount: 0, chainCount: 0, unitCount: 0, structureCount: 0, firstElementLoc: He.create(void 0), firstConformationLoc: He.create(void 0), firstResidueLoc: He.create(void 0), firstChainLoc: He.create(void 0), firstUnitLoc: He.create(void 0), firstStructureLoc: He.create(void 0) };
  }
  function n(o, s, u) {
    var l = o.get(s) || 0;
    o.set(s, l + u);
  }
  function r(o, s, u) {
    var l = u.indices, c = u.unit, d = c.elements, f = _e.size(l), p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
    if (f > 0 && He.set(o.firstElementLoc, s, c, d[_e.start(l)]), f === d.length) o.unitCount += 1, o.unitCount === 1 && He.set(o.firstUnitLoc, s, c, d[_e.start(l)]);
    else if (f === 1) {
      if (ve.Traits.is(c.traits, 1)) return;
      o.elementCount += 1, o.elementCount === 1 && He.set(o.firstElementLoc, s, c, d[_e.start(l)]);
    } else if (ve.isAtomic(c)) for (var m = c.model.atomicHierarchy.residueAtomSegments, v = m.index, h = m.offsets, y = c.model.atomicHierarchy.atoms.label_alt_id, x = 0, S = function() {
      p.clear();
      var b = 0, _ = d[_e.getAt(l, x)], C = v[_];
      for (n(p, y.value(_), 1), ++x, ++b; x < f; ) {
        var w = d[_e.getAt(l, x)];
        if (v[w] !== C) break;
        n(p, y.value(w), 1), ++x, ++b;
      }
      if (h[C + 1] - h[C] === b) o.residueCount += 1, o.residueCount === 1 && He.set(o.firstResidueLoc, s, c, h[C]);
      else {
        g.clear();
        for (var I = h[C], M = h[C + 1]; I < M; ++I) n(g, y.value(I), 1);
        g.get("") === p.get("") && p.forEach(function(E, T) {
          if (g.get(T) === E) {
            if (T !== "" && (o.conformationCount += 1, o.conformationCount === 1)) {
              for (var P = h[C], k = h[C + 1]; P < k; ++P) if (T === y.value(P)) {
                He.set(o.firstConformationLoc, s, c, P);
                break;
              }
            }
            b -= E;
          }
        }), o.elementCount += b;
      }
    }; x < f; ) S();
    else o.elementCount += f, o.elementCount === 1 && He.set(o.firstElementLoc, s, c, d[_e.start(l)]);
  }
  function i(o, s, u) {
    var l = u.indices, c = u.unit, d = _e.size(l);
    if (d !== 0) {
      var f = c.elements;
      if (ve.Traits.is(c.traits, 1)) {
        var p = ve.isAtomic(c) ? c.model.atomicHierarchy.chainAtomSegments : ve.isSpheres(c) ? c.model.coarseHierarchy.spheres.chainElementSegments : ve.isGaussians(c) ? c.model.coarseHierarchy.gaussians.chainElementSegments : void 0;
        if (p) for (var g = p.index, m = p.offsets, v = 0; v < d; ) {
          var h = 0, y = f[_e.getAt(l, v)], x = g[y];
          for (++v, ++h; v < d && g[f[_e.getAt(l, v)]] === x; )
            ++v, ++h;
          m[x + 1] - m[x] === h ? (o.chainCount += 1, o.chainCount === 1 && He.set(o.firstChainLoc, s, c, m[x])) : d === 1 && (o.elementCount += 1, o.elementCount === 1 && He.set(o.firstElementLoc, s, c, y));
        }
        else console.warn("StructureElement loci stats: unknown unit type");
      } else d === f.length && (o.chainCount += 1, o.chainCount === 1 && He.set(o.firstChainLoc, s, c, f[_e.start(l)]));
    }
  }
  function a(o, s, u, l, c) {
    var d = u[l], f = ve.isAtomic(d.unit) ? d.unit.model.atomicHierarchy.chainAtomSegments : ve.isSpheres(d.unit) ? d.unit.model.coarseHierarchy.spheres.chainElementSegments : ve.isGaussians(d.unit) ? d.unit.model.coarseHierarchy.gaussians.chainElementSegments : void 0;
    if (f) {
      for (var p = f.index, g = f.offsets, m = /* @__PURE__ */ new Map(), v = l; v < c; v++) {
        var h = (d = u[v]).indices, y = d.unit;
        if ((w = _e.size(h)) !== 0) {
          var x = y.elements;
          if (ve.Traits.is(y.traits, 1)) for (var S = 0; S < w; ) {
            var b = 0, _ = p[I = x[_e.getAt(h, S)]];
            for (++S, ++b; S < w && p[x[_e.getAt(h, S)]] === _; )
              ++S, ++b;
            n(m, _, b);
          }
          else n(m, p[I = x[_e.start(h)]], x.length);
        }
      }
      var C = -1;
      if (m.forEach(function(M, E) {
        g[E + 1] - g[E] === M && (o.chainCount += 1, o.chainCount === 1 && (C = E));
      }), !(C < 0)) for (v = l; v < c; v++) {
        var w;
        if (h = (d = u[v]).indices, y = d.unit, (w = _e.size(h)) !== 0) for (x = y.elements, S = 0; S < w; ) {
          var I;
          if ((_ = p[I = x[_e.getAt(h, S)]]) === C) return void He.set(o.firstChainLoc, s, y, I);
        }
      }
    } else console.warn("StructureElement loci stats: unknown unit type");
  }
  e.create = t, e.ofLoci = function(o) {
    var s = t();
    if (ke.isEmpty(o)) return s;
    var u = !1;
    if (ke.isWholeStructure(o)) {
      if (s.structureCount += 1, s.structureCount === 1) {
        var l = o.elements[0], c = l.unit, d = l.indices;
        He.set(s.firstStructureLoc, o.structure, c, c.elements[_e.min(d)]);
      }
    } else for (var f = 0, p = o.elements; f < p.length; f++) {
      var g = p[f];
      r(s, o.structure, g), ve.Traits.is(g.unit.traits, 2) ? u = !0 : i(s, o.structure, g);
    }
    if (u) {
      for (var m = 0, v = o.elements.length; m < v; m++)
        if (g = o.elements[m], ve.Traits.is(g.unit.traits, 2)) {
          for (var h = m; m < v && ve.areSameChainOperatorGroup(o.elements[m].unit, g.unit); ) m++;
          var y = m;
          m--, y - h == 1 ? i(s, o.structure, g) : a(s, o.structure, o.elements, h, y);
        }
    }
    return s;
  }, e.add = function(o, s, u) {
    return s.elementCount === 1 && u.elementCount === 0 ? He.copy(o.firstElementLoc, s.firstElementLoc) : s.elementCount === 0 && u.elementCount === 1 && He.copy(o.firstElementLoc, u.firstElementLoc), s.conformationCount === 1 && u.conformationCount === 0 ? He.copy(o.firstConformationLoc, s.firstConformationLoc) : s.conformationCount === 0 && u.conformationCount === 1 && He.copy(o.firstConformationLoc, u.firstConformationLoc), s.residueCount === 1 && u.residueCount === 0 ? He.copy(o.firstResidueLoc, s.firstResidueLoc) : s.residueCount === 0 && u.residueCount === 1 && He.copy(o.firstResidueLoc, u.firstResidueLoc), s.chainCount === 1 && u.chainCount === 0 ? He.copy(o.firstChainLoc, s.firstChainLoc) : s.chainCount === 0 && u.chainCount === 1 && He.copy(o.firstChainLoc, u.firstChainLoc), s.unitCount === 1 && u.unitCount === 0 ? He.copy(o.firstUnitLoc, s.firstUnitLoc) : s.unitCount === 0 && u.unitCount === 1 && He.copy(o.firstUnitLoc, u.firstUnitLoc), s.structureCount === 1 && u.structureCount === 0 ? He.copy(o.firstStructureLoc, s.firstStructureLoc) : s.structureCount === 0 && u.structureCount === 1 && He.copy(o.firstStructureLoc, u.firstStructureLoc), o.elementCount = s.elementCount + u.elementCount, o.conformationCount = s.conformationCount + u.conformationCount, o.residueCount = s.residueCount + u.residueCount, o.chainCount = s.chainCount + u.chainCount, o.unitCount = s.unitCount + u.unitCount, o.structureCount = s.structureCount + u.structureCount, o;
  };
}(Sf || (Sf = {})), function(e) {
  function t(n) {
    var r = this, i = n.descriptor.name, a = n.type === "static" ? "_staticPropertyData" : "_dynamicPropertyData", o = function(u) {
      return i in u[a] || (u[a][i] = { props: O({}, N.getDefaultValues(n.getParams(u))), data: Vc.create(void 0) }), u[a][i];
    }, s = function(u, l, c) {
      var d = o(u);
      u[a][i] = { props: l, data: Vc.withValue(d.data, c) };
    };
    return { label: n.label, descriptor: n.descriptor, isHidden: n.isHidden, getParams: function(u) {
      var l = N.clone(n.getParams(u));
      return N.setDefaultValues(l, o(u).props), l;
    }, defaultParams: n.defaultParams, isApplicable: n.isApplicable, attach: function(u, l, c, d) {
      return c === void 0 && (c = {}), se(r, 0, void 0, function() {
        var f, p, g, m, v;
        return ie(this, function(h) {
          switch (h.label) {
            case 0:
              return d && l.customProperties.reference(n.descriptor, !0), f = o(l), p = N.merge(n.defaultParams, f.props, c), f.data.value && N.areEqual(n.defaultParams, f.props, p) ? [2] : [4, n.obtain(u, l, p)];
            case 1:
              return g = h.sent(), m = g.value, v = g.assets, l.customProperties.add(n.descriptor), l.customProperties.assets(n.descriptor, v), s(l, p, m), [2];
          }
        });
      });
    }, ref: function(u, l) {
      return u.customProperties.reference(n.descriptor, l);
    }, get: function(u) {
      var l;
      return (l = o(u)) === null || l === void 0 ? void 0 : l.data;
    }, set: function(u, l) {
      l === void 0 && (l = {});
      var c = o(u), d = N.merge(n.defaultParams, c.props, l);
      N.areEqual(n.defaultParams, c.props, d) || (s(u, d, void 0), u.customProperties.assets(n.descriptor));
    }, props: function(u) {
      return o(u).props;
    } };
  }
  e.createProvider = t, e.createSimple = function(n, r, i) {
    var a = this, o = { value: N.Value(i, { isHidden: !0 }) };
    return t({ label: Su(n), descriptor: Us({ name: n }), isHidden: !0, type: r, defaultParams: o, getParams: function() {
      return { value: N.Value(i, { isHidden: !0 }) };
    }, isApplicable: function() {
      return !0;
    }, obtain: function(s, u, l) {
      return se(a, 0, void 0, function() {
        var c;
        return ie(this, function(d) {
          return [2, { value: (c = l.value) !== null && c !== void 0 ? c : i }];
        });
      });
    } });
  };
}(V1 || (V1 = {})), function(e) {
  var t = this;
  function n(i) {
    if (!ur.is(i.sourceData)) return !1;
    var a = i.sourceData.data.db.atom_site, o = a.pdbx_sifts_xref_db_name, s = a.pdbx_sifts_xref_db_acc, u = a.pdbx_sifts_xref_db_num, l = a.pdbx_sifts_xref_db_res;
    return o.isDefined && s.isDefined && u.isDefined && l.isDefined;
  }
  function r(i) {
    if (ur.is(i.sourceData)) {
      var a = i.sourceData.data.db.atom_site, o = a.pdbx_sifts_xref_db_name, s = a.pdbx_sifts_xref_db_acc, u = a.pdbx_sifts_xref_db_num, l = a.pdbx_sifts_xref_db_res;
      if (o.isDefined && s.isDefined && u.isDefined && l.isDefined) {
        for (var c = i.atomicHierarchy.atomSourceIndex, d = i.atomicHierarchy.residueAtomSegments, f = d.count, p = d.offsets, g = new Array(f), m = new Array(f), v = new Array(f), h = new Array(f), y = 0; y < f; y++) {
          var x = c.value(p[y]);
          o.valueKind(x) === 0 ? (g[y] = o.value(x), m[y] = s.value(x), v[y] = u.value(x), h[y] = l.value(x)) : (g[y] = "", m[y] = "", v[y] = "", h[y] = "");
        }
        return { dbName: g, accession: m, num: v, residue: h };
      }
    }
  }
  e.Provider = V1.createProvider({ label: "SIFTS Mapping", descriptor: Us({ name: "sifts_sequence_mapping" }), type: "static", defaultParams: {}, getParams: function() {
    return {};
  }, isApplicable: function(i) {
    return n(i);
  }, obtain: function(i, a) {
    return se(t, 0, void 0, function() {
      return ie(this, function(o) {
        return [2, { value: r(a) }];
      });
    });
  } }), e.isAvailable = n, e.getKey = function(i) {
    var a = i.unit.model, o = e.Provider.get(a).value;
    if (!o) return "";
    var s = i.unit.elements[i.element], u = a.atomicHierarchy.residueAtomSegments.index[s];
    return o.accession[u];
  }, e.getLabel = function(i) {
    var a = i.unit.model, o = e.Provider.get(a).value;
    if (o) {
      var s = i.unit.elements[i.element], u = a.atomicHierarchy.residueAtomSegments.index[s], l = o.dbName[u];
      if (l) return "".concat(l, " ").concat(o.accession[u], " ").concat(o.num[u], " ").concat(o.residue[u]);
    }
  };
}(DC || (DC = {})), Ci.Field, Ci.Encodings, Ci.Field, Ci.Category, Ci.Category, Ci.Category, function(e) {
  e.create = function(t) {
    var n = Array.isArray(t) ? t : [t];
    return { structures: n, firstModel: n[0].model, cache: /* @__PURE__ */ Object.create(null) };
  };
}(OC || (OC = {})), function(e) {
  e.AtomSitePositionsFieldNames = /* @__PURE__ */ new Set(["id", "Cartn_x", "Cartn_y", "Cartn_z"]);
}(BC || (BC = {}));
var Rj = { molstar_atom_site_operator_mapping: { label_asym_id: Q.Schema.Str(), auth_asym_id: Q.Schema.Str(), operator_name: Q.Schema.Str(), suffix: Q.Schema.Str(), assembly_id: Q.Schema.Str(), assembly_operator_id: Q.Schema.Int(), symmetry_operator_index: Q.Schema.Int(), symmetry_hkl: Q.Schema.Vector(3), ncs_id: Q.Schema.Int() } }, RC = function(e, t) {
  return t[e].operator.assembly === void 0 ? 1 : 0;
}, Fy = function(e, t) {
  return t[e].operator.spgrOp === -1 ? 1 : 0;
};
function n0(e, t) {
  return t ? t.length === 1 ? as(t.charCodeAt(0), e) : t.length === 2 ? as(t.charCodeAt(0), as(t.charCodeAt(1), e)) : "".concat(e, " ").concat(t) : e;
}
function Lj(e, t, n, r) {
  if (e.has(t))
    (i = e.get(t)).has(n) || i.set(n, r);
  else {
    var i = /* @__PURE__ */ new Map();
    e.set(t, i), i.set(n, r);
  }
}
function Nj(e) {
  throw new Error("Missing entity entry for entity id '".concat(e, "'."));
}
Ci.fields().str("label_asym_id", function(e, t) {
  return t[e].label_asym_id;
}).str("auth_asym_id", function(e, t) {
  return t[e].auth_asym_id;
}).str("operator_name", function(e, t) {
  return t[e].operator.name;
}).str("suffix", function(e, t) {
  return t[e].operator.suffix;
}).str("assembly_id", function(e, t) {
  var n;
  return ((n = t[e].operator.assembly) === null || n === void 0 ? void 0 : n.id) || "";
}, { valueKind: RC }).int("assembly_operator_id", function(e, t) {
  var n;
  return ((n = t[e].operator.assembly) === null || n === void 0 ? void 0 : n.operId) || 0;
}, { valueKind: RC }).int("symmetry_operator_index", function(e, t) {
  return t[e].operator.spgrOp;
}, { valueKind: Fy }).vec("symmetry_hkl", [function(e, t) {
  return t[e].operator.hkl[0];
}, function(e, t) {
  return t[e].operator.hkl[1];
}, function(e, t) {
  return t[e].operator.hkl[2];
}], { valueKind: Fy }).int("ncs_id", function(e, t) {
  return t[e].operator.ncsId;
}, { valueKind: Fy }).getFields();
var ep = E5.EmptyResidueKey(), Fj = function() {
  function e(t) {
    this.map = t, this.entityIndex = t.entities.getEntityIndex, this.residueOffsets = this.map.segments.residueAtomSegments.offsets;
  }
  return e.prototype.getEntityFromChain = function(t) {
    return this.map.chain_index_entity_index[t];
  }, e.prototype.findEntity = function(t) {
    var n = this.map.label_asym_id.get(t);
    return n !== void 0 ? n : -1;
  }, e.prototype.findChainLabel = function(t) {
    var n = this.entityIndex(t.label_entity_id);
    if (n < 0 || !this.map.entity_index_label_asym_id.has(n)) return -1;
    var r = this.map.entity_index_label_asym_id.get(n);
    return r && r.has(t.label_asym_id) ? r.get(t.label_asym_id) : -1;
  }, e.prototype.findChainAuth = function(t) {
    if (!this.map.auth_asym_id_auth_seq_id.has(t.auth_asym_id)) return -1;
    var n = this.map.auth_asym_id_auth_seq_id.get(t.auth_asym_id);
    return n.has(t.auth_seq_id) ? n.get(t.auth_seq_id) : -1;
  }, e.prototype.findResidue = function(t, n, r, i) {
    var a;
    arguments.length === 1 ? a = t : (ep.label_entity_id = t, ep.label_asym_id = n, ep.auth_seq_id = r, ep.pdbx_PDB_ins_code = i, a = ep);
    var o = this.findChainLabel(a);
    if (o < 0) return -1;
    var s = this.map.chain_index_auth_seq_id.get(o), u = n0(a.auth_seq_id, a.pdbx_PDB_ins_code || "");
    return s.has(u) ? s.get(u) : -1;
  }, e.prototype.findResidueAuth = function(t) {
    var n = this.findChainAuth(t);
    if (n < 0) return -1;
    var r = this.map.chain_index_auth_seq_id.get(n), i = n0(t.auth_seq_id, t.pdbx_PDB_ins_code || "");
    return r.has(i) ? r.get(i) : -1;
  }, e.prototype.findResidueInsertion = function(t) {
    var n = this.findChainLabel(t);
    if (n < 0) return -1;
    var r = this.map.chain_index_label_seq_id.get(n), i = n0(t.label_seq_id, t.pdbx_PDB_ins_code || "");
    if (r.has(i)) return r.get(i);
    var a = Me.findPredecessorIndex(this.map.label_seq_id, t.label_seq_id), o = Cf.chainStartResidueIndex(this.map.segments, n);
    if (a < o) return o;
    var s = Cf.chainEndResidueIndexExcl(this.map.segments, n) - 1;
    return a >= s ? s : a;
  }, e.prototype.findAtom = function(t) {
    var n = this.findResidue(t);
    return n < 0 ? -1 : t.label_alt_id === void 0 ? Vy(this.residueOffsets[n], this.residueOffsets[n + 1], this.map.label_atom_id, t.label_atom_id) : Gy(this.residueOffsets[n], this.residueOffsets[n + 1], this.map.label_atom_id, this.map.label_alt_id, t.label_atom_id, t.label_alt_id);
  }, e.prototype.findAtomAuth = function(t) {
    var n = this.findResidueAuth(t);
    return n < 0 ? -1 : t.label_alt_id === void 0 ? Vy(this.residueOffsets[n], this.residueOffsets[n + 1], this.map.auth_atom_id, t.auth_atom_id) : Gy(this.residueOffsets[n], this.residueOffsets[n + 1], this.map.auth_atom_id, this.map.label_alt_id, t.auth_atom_id, t.label_alt_id);
  }, e.prototype.findAtomOnResidue = function(t, n, r) {
    return r === void 0 ? Vy(this.residueOffsets[t], this.residueOffsets[t + 1], this.map.label_atom_id, n) : Gy(this.residueOffsets[t], this.residueOffsets[t + 1], this.map.label_atom_id, this.map.label_alt_id, n, r);
  }, e.prototype.findAtomsOnResidue = function(t, n) {
    return function(r, i, a, o) {
      for (var s = r; s < i; s++) if (o.has(a.value(s))) return s;
      return -1;
    }(this.residueOffsets[t], this.residueOffsets[t + 1], this.map.label_atom_id, n);
  }, e.prototype.findElementOnResidue = function(t, n) {
    return function(r, i, a, o) {
      for (var s = r; s < i; s++) if (a.value(s) === o) return s;
      return -1;
    }(this.residueOffsets[t], this.residueOffsets[t + 1], this.map.type_symbol, n);
  }, e;
}();
function Vy(e, t, n, r) {
  for (var i = e; i < t; i++) if (n.value(i) === r) return i;
  return -1;
}
function Gy(e, t, n, r, i, a) {
  for (var o = e; o < t; o++) if (n.value(o) === i && r.value(o) === a) return o;
  return -1;
}
function Vj(e, t, n) {
  for (var r = function(M, E, T) {
    return { entities: M, segments: T, label_seq_id: Me.ofSortedArray(E.residues.label_seq_id.toArray({ array: Int32Array })), label_atom_id: E.atoms.label_atom_id, auth_atom_id: E.atoms.auth_atom_id, label_alt_id: E.atoms.label_alt_id, type_symbol: E.atoms.type_symbol, chain_index_entity_index: new Int32Array(E.chains._rowCount), entity_index_label_asym_id: /* @__PURE__ */ new Map(), chain_index_label_seq_id: /* @__PURE__ */ new Map(), auth_asym_id_auth_seq_id: /* @__PURE__ */ new Map(), chain_index_auth_seq_id: /* @__PURE__ */ new Map(), label_asym_id: /* @__PURE__ */ new Map() };
  }(t, e, n), i = e.residues, a = i.label_seq_id, o = i.auth_seq_id, s = i.pdbx_PDB_ins_code, u = e.chains, l = u.label_entity_id, c = u.label_asym_id, d = u.auth_asym_id, f = le.ofBounds(0, e.atoms._rowCount), p = Kt.transientSegments(n.chainAtomSegments, f); p.hasNext; ) {
    var g = p.move(), m = g.index, v = t.getEntityIndex(l.value(m));
    v < 0 && Nj(l.value(m)), r.chain_index_entity_index[m] = v;
    var h = d.value(m), y = r.auth_asym_id_auth_seq_id.get(h);
    y || (y = /* @__PURE__ */ new Map(), r.auth_asym_id_auth_seq_id.set(h, y));
    var x = c.value(m);
    r.label_asym_id.has(x) || r.label_asym_id.set(x, v), Lj(r.entity_index_label_asym_id, v, x, m);
    var S = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map();
    r.chain_index_label_seq_id.set(m, S), r.chain_index_auth_seq_id.set(m, b);
    for (var _ = Kt.transientSegments(n.residueAtomSegments, f, g); _.hasNext; ) {
      var C = _.move().index, w = o.value(C), I = s.value(C);
      S.set(n0(a.value(C), I), C), b.set(n0(w, I), C), y.set(w, m);
    }
  }
  return new Fj(r);
}
function Gj(e, t, n, r, i, a) {
  var o = function(f) {
    if (f._rowCount === 0) return { residues: [], chains: [] };
    for (var p = f._rowCount, g = [0], m = [0], v = f.label_entity_id, h = f.label_asym_id, y = f.label_seq_id, x = f.auth_seq_id, S = f.pdbx_PDB_ins_code, b = 1; b < p; b++) {
      var _ = !v.areValuesEqual(b - 1, b) || !h.areValuesEqual(b - 1, b);
      (_ || !y.areValuesEqual(b - 1, b) || !x.areValuesEqual(b - 1, b) || !S.areValuesEqual(b - 1, b)) && (g[g.length] = b), _ && (m[m.length] = b);
    }
    return { residues: g, chains: m };
  }(e), s = function(f, p, g) {
    var m = On.ofColumns(Rq, { type_symbol: Q.ofArray({ array: Q.mapToArray(f.type_symbol, Q1), schema: Q.Schema.Aliased(Q.Schema.str) }), label_atom_id: f.label_atom_id, auth_atom_id: f.auth_atom_id, label_alt_id: f.label_alt_id, label_comp_id: f.label_comp_id, auth_comp_id: f.auth_comp_id, pdbx_formal_charge: f.pdbx_formal_charge, cdr: f.cdr, B_iso_or_equiv: f.B_iso_or_equiv, em_confidence: f.em_confidence }), v = On.view(f, Lq, g.residues), h = On.view(f, Nq, g.chains);
    if (!v.label_seq_id.isDefined) {
      for (var y = new Int32Array(v.label_seq_id.rowCount), x = g.residues, S = g.chains, b = 0, _ = 0, C = 0, w = y.length; C < w; ++C) x[C] >= S[b + 1] && (b += 1, _ = 0), y[C] = ++_;
      v.label_seq_id = Q.ofIntArray(y);
    }
    return On.columnToArray(v, "label_seq_id", Int32Array), On.columnToArray(v, "auth_seq_id", Int32Array), { atoms: m, residues: v, chains: h, atomSourceIndex: p };
  }(e, t, o), u = function(f, p) {
    var g = /* @__PURE__ */ new Map();
    if (!ur.is(p)) return g;
    var m = qd(Rj, p.data.frame).molstar_atom_site_operator_mapping;
    if (m._rowCount === 0) return g;
    for (var v = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), y = 0; y < m._rowCount; y++) {
      var x = m.assembly_operator_id.valueKind(y) === 0 ? { id: m.assembly_id.value(y), operList: [], operId: m.assembly_operator_id.value(y) } : void 0, S = lr.create(m.operator_name.value(y), ne.identity(), { assembly: x, spgrOp: m.symmetry_operator_index.valueKind(y) === 0 ? m.symmetry_operator_index.value(y) : void 0, hkl: A.ofArray(m.symmetry_hkl.value(y)), ncsId: m.ncs_id.value(y) }), b = m.suffix.value(y), _ = m.label_asym_id.value(y);
      v.set("".concat(_).concat(b), { name: _, operator: S });
      var C = m.auth_asym_id.value(y);
      h.set("".concat(C).concat(b), C);
    }
    var w = f.chains, I = w.label_asym_id, M = w.auth_asym_id, E = new Array(I.rowCount), T = new Array(I.rowCount);
    for (y = 0; y < I.rowCount; y++) if (_ = I.value(y), C = M.value(y), v.has(_)) {
      var P = v.get(_), k = P.name;
      S = P.operator, g.set(y, S), E[y] = k, T[y] = h.get(C) || C;
    } else E[y] = _, T[y] = C;
    return f.chains.label_asym_id = Q.ofArray({ array: E, valueKind: f.chains.label_asym_id.valueKind, schema: f.chains.label_asym_id.schema }), f.chains.auth_asym_id = Q.ofArray({ array: T, valueKind: f.chains.auth_asym_id.valueKind, schema: f.chains.auth_asym_id.schema }), g;
  }(s, i);
  if (a && function(f, p) {
    return On.areEqual(f.chains, p.chains) && On.areEqual(f.residues, p.residues) && On.areEqual(f.atoms, p.atoms);
  }(a.atomicHierarchy, s)) return { sameAsPrevious: !0, hierarchy: a.atomicHierarchy, chainOperatorMapping: u };
  var l = { residueAtomSegments: Kt.ofOffsets(o.residues, le.ofBounds(0, e._rowCount)), chainAtomSegments: Kt.ofOffsets(o.chains, le.ofBounds(0, e._rowCount)) }, c = Vj(s, n, l), d = function(f, p, g, m) {
    for (var v = f.atoms, h = v.label_comp_id, y = v.type_symbol, x = v._rowCount, S = f.residues._rowCount, b = p.residueAtomSegments.offsets, _ = new Uint8Array(x), C = 0; C < x; ++C) _[C] = P0(y.value(C));
    var w = new Int32Array(S), I = new Int32Array(S), M = new Int32Array(S), E = new Uint8Array(S), T = new Uint8Array(S), P = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
    for (C = 0; C < S; ++C) {
      var D = h.value(b[C]), B = m, L = void 0, F = void 0;
      if (P.has(D)) L = P.get(D), F = k.get(D);
      else {
        var V = void 0;
        B.has(D) ? V = B.get(D).type : (VT || console.info("chemComp not found", D), V = Mk(D)), F = _H(V, L = ah(V, D)), P.set(D, L), k.set(D, F);
      }
      E[C] = L, T[C] = F;
      var G = qc(F, "trace"), H = g.findAtomsOnResidue(C, G);
      if (H === -1) {
        var q = qc(F, "coarseBackbone");
        (H = g.findAtomsOnResidue(C, q)) === -1 && U6(L) && (H = g.findElementOnResidue(C, Q1("C")));
      }
      w[C] = H;
      var z = qc(F, "directionFrom");
      I[C] = g.findAtomsOnResidue(C, z);
      var K = qc(F, "directionTo");
      M[C] = g.findAtomsOnResidue(C, K);
    }
    return { atom: { atomicNumber: _ }, residue: { traceElementIndex: w, directionFromElementIndex: I, directionToElementIndex: M, moleculeType: E, polymerType: T } };
  }(s, l, c, r);
  return { sameAsPrevious: !1, hierarchy: O(O(O({}, s), l), { index: c, derived: d }), chainOperatorMapping: u };
}
function nD(e, t, n, r, i, a) {
  var o = Gj(e, t, n, r, i, a), s = o.sameAsPrevious, u = o.hierarchy, l = o.chainOperatorMapping, c = function(d) {
    return { id: di.create22(), atomId: d.id, occupancy: d.occupancy.isDefined ? d.occupancy : Q.ofConst(1, d._rowCount, Q.Schema.float), B_iso_or_equiv: d.B_iso_or_equiv, xyzDefined: d.Cartn_x.isDefined && d.Cartn_y.isDefined && d.Cartn_z.isDefined, x: d.Cartn_x.toArray({ array: Float32Array }), y: d.Cartn_y.toArray({ array: Float32Array }), z: d.Cartn_z.toArray({ array: Float32Array }) };
  }(e);
  return { sameAsPrevious: s, hierarchy: u, conformation: c, chainOperatorMapping: l };
}
var D5, LC = { chainKey: [], entityKey: [], findSequenceKey: function() {
  return -1;
}, findChainKey: function() {
  return -1;
}, getEntityFromChain: function() {
  return -1;
}, count: 0, entity_id: Q.Undefined(0, Q.Schema.str), asym_id: Q.Undefined(0, Q.Schema.str), seq_id_begin: Q.Undefined(0, Q.Schema.int), seq_id_end: Q.Undefined(0, Q.Schema.int), chainElementSegments: Kt.create([]), polymerRanges: Zn.ofSortedRanges([]), gapRanges: Zn.ofSortedRanges([]) };
function zj(e, t, n) {
  if (e.has(t)) return e.get(t);
  var r = n.index++;
  return e.set(t, r), r;
}
function Uj(e, t) {
  if (e.has(t)) return e.get(t);
  var n = /* @__PURE__ */ new Map();
  return e.set(t, n), n;
}
function Hj(e) {
  throw new Error("Missing entity entry for entity id '".concat(e, "'."));
}
function NC(e, t) {
  for (var n = e.entity_id, r = e.asym_id, i = e.seq_id_begin, a = e.seq_id_end, o = e.count, s = e.chainElementSegments, u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = { index: 0 }, d = new Int32Array(o), f = new Int32Array(o), p = new Int32Array(s.count), g = 0; g < o; g++) f[g] = t.getEntityIndex(n.value(g)), f[g] < 0 && Hj(n.value(g));
  for (var m = 0; m < s.count; m++) {
    var v = s.offsets[m], h = s.offsets[m + 1], y = f[v];
    p[m] = y;
    var x = zj(Uj(l, y), r.value(v), c);
    for (g = v; g < h; g++) d[g] = x;
    var S = [], b = [];
    for (g = v; g < h; g++) {
      var _ = i.value(g), C = a.value(g);
      S.push(g), b.push(_, C);
    }
    var w = { elementIndices: S, seqRanges: Zn.ofSortedRanges(b) };
    u.set(x, w);
  }
  var I = function(E, T, P) {
    var k = E.getEntityIndex;
    return { findChainKey: function(D, B) {
      var L = k(D);
      if (L < 0) return -1;
      var F = T.get(L);
      return F.has(B) ? F.get(B) : -1;
    }, findSequenceKey: function(D, B, L) {
      var F = k(D);
      if (F < 0) return -1;
      var V = T.get(F);
      if (V === void 0) return -1;
      var G = V.get(B);
      if (G === void 0) return -1;
      var H = P.get(G), q = H.elementIndices, z = H.seqRanges, K = Zn.firstIntersectionIndex(z, _e.ofSingleton(L));
      return K !== -1 ? q[K] : -1;
    } };
  }(t, l, u), M = I.findChainKey;
  return { chainKey: d, entityKey: f, findSequenceKey: I.findSequenceKey, findChainKey: M, getEntityFromChain: function(E) {
    return p[E];
  } };
}
function FC(e, t) {
  for (var n = [], r = [], i = Kt.transientSegments(e.chainElementSegments, le.ofBounds(0, e.count)), a = e.seq_id_begin, o = e.seq_id_end; i.hasNext; ) for (var s = i.move(), u = s.start, l = s.end, c = -1, d = -1, f = u; f < l; ++f) {
    var p = o.value(f);
    f === u ? (c = f, d = o.value(f)) : a.value(f) - d > 1 && (n.push(c, f - 1), r.push(f - 1, f), c = f), f === l - 1 && n.push(c, f), d = p;
  }
  return { polymerRanges: Zn.ofSortedRanges(n), gapRanges: Zn.ofSortedRanges(r) };
}
(function(e) {
  e.Empty = { isDefined: !1, spheres: LC, gaussians: LC };
})(D5 || (D5 = {}));
var rD = { hierarchy: D5.Empty, conformation: void 0 };
function qj(e, t) {
  var n = e.ihm_sphere_obj_site, r = e.ihm_gaussian_obj_site;
  if (n._rowCount === 0 && r._rowCount === 0) return rD;
  var i = VC(n), a = function(f) {
    return { x: f.Cartn_x.toArray({ array: Float32Array }), y: f.Cartn_y.toArray({ array: Float32Array }), z: f.Cartn_z.toArray({ array: Float32Array }), radius: f.object_radius.toArray({ array: Float32Array }), rmsf: f.rmsf.toArray({ array: Float32Array }) };
  }(n), o = NC(i, e.entities), s = FC(i), u = VC(r), l = function(f) {
    for (var p = Ka.ihm_gaussian_obj_site.covariance_matrix.space, g = [], m = f.covariance_matrix, v = 0, h = m.rowCount; v < h; v++) g[v] = wr.toMat3(pi(), p, m.value(v));
    return { x: f.mean_Cartn_x.toArray({ array: Float32Array }), y: f.mean_Cartn_y.toArray({ array: Float32Array }), z: f.mean_Cartn_z.toArray({ array: Float32Array }), weight: f.weight.toArray({ array: Float32Array }), covariance_matrix: g };
  }(r), c = NC(u, e.entities), d = FC(u);
  return { hierarchy: { isDefined: !0, spheres: O(O(O({}, i), o), s), gaussians: O(O(O({}, u), c), d) }, conformation: { id: di.create22(), spheres: a, gaussians: l } };
}
function VC(e) {
  var t = e.entity_id, n = e.seq_id_begin, r = e.seq_id_end, i = e.asym_id;
  return O({ count: t.rowCount, entity_id: t, asym_id: i, seq_id_begin: n, seq_id_end: r }, function(a, o, s) {
    for (var u = [0], l = 1, c = a.rowCount; l < c; l++) !a.areValuesEqual(l - 1, l) && (u[u.length] = l);
    return { chainElementSegments: Kt.ofOffsets(u, le.ofBounds(0, a.rowCount)) };
  }(i));
}
var Vp, O5, jj = { HIS: "H", ARG: "R", LYS: "K", ILE: "I", PHE: "F", LEU: "L", TRP: "W", ALA: "A", MET: "M", PRO: "P", CYS: "C", ASN: "N", VAL: "V", GLY: "G", SER: "S", GLN: "Q", TYR: "Y", ASP: "D", GLU: "E", THR: "T", SEC: "U", PYL: "O", HSD: "H", HSE: "H", HSP: "H", LSN: "K", ASPP: "D", GLUP: "E", HID: "H", HIE: "H", HIP: "H", LYN: "K", ASH: "D", GLH: "E", ACE: "ACE", NME: "NME" }, Kj = { DA: "A", DC: "C", DG: "G", DT: "T", DU: "U" }, Yj = { A: "A", C: "C", G: "G", T: "T", U: "U" };
function GC(e) {
  return jj[e] || "X";
}
function zC(e) {
  return Yj[e] || "X";
}
function UC(e) {
  return Kj[e] || "X";
}
function iD(e, t, n, r) {
  if (!e.entity_poly_seq || !e.entity_poly_seq._rowCount) return O5.fromHierarchy(t, n, r);
  for (var i = e.entity_poly_seq, a = i.entity_id, o = i.num, s = i.mon_id, u = {}, l = [], c = a.rowCount, d = 0; d < c; ) {
    for (var f = d; d < c - 1 && a.areValuesEqual(d, d + 1); ) d++;
    d++;
    var p = a.value(f), g = Q.window(s, f, d), m = Q.window(o, f, d), v = t.getEntityIndex(p);
    u[v] = { entityId: p, sequence: Vp.ofResidueNames(g, m) }, l.push(u[v]);
  }
  return { byEntityKey: u, sequences: l };
}
function aD(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i, a, o, s, u, l, c, d, f, p, g;
    return ie(this, function(m) {
      switch (m.label) {
        case 0:
          return i = n5(n, r - 1), a = t.label_entity_id, o = t.label_asym_id, s = t.label_seq_id, u = cy(i, a.value), e.shouldUpdate ? [4, e.update()] : [3, 2];
        case 1:
          m.sent(), m.label = 2;
        case 2:
          l = 0, c = u.length - 1, m.label = 3;
        case 3:
          if (!(l < c)) return [3, 10];
          d = cy(i, o.value, { start: u[l], end: u[l + 1] }), f = 0, p = d.length - 1, m.label = 4;
        case 4:
          return f < p ? (g = d[f], s.valueKind(g) !== 0 ? [3, 6] : (cy(i, s.value, { sort: !0, start: g, end: d[f + 1] }), e.shouldUpdate ? [4, e.update()] : [3, 6])) : [3, 7];
        case 5:
          m.sent(), m.label = 6;
        case 6:
          return f++, [3, 4];
        case 7:
          return e.shouldUpdate ? [4, e.update()] : [3, 9];
        case 8:
          m.sent(), m.label = 9;
        case 9:
          return l++, [3, 3];
        case 10:
          return function(v) {
            for (var h = 0, y = v.length; h < y; h++) if (v[h] !== h) return !1;
            return !0;
          }(i) && i.length === t._rowCount ? [2, { atom_site: t, sourceIndex: Q.ofIntArray(i) }] : [2, { atom_site: On.view(t, t._schema, i), sourceIndex: Q.ofIntArray(i) }];
      }
    });
  });
}
function HC(e, t, n, r, i) {
  var a = i.residue, o = a.polymerType, s = a.traceElementIndex, u = a.directionFromElementIndex, l = a.directionToElementIndex, c = o[e], d = o[t];
  if (c === 0 || d === 0 || s[e] === -1 || s[t] === -1) return !1;
  var f = r.findAtomsOnResidue(e, qc(c, "backboneStart")), p = r.findAtomsOnResidue(t, qc(d, "backboneEnd"));
  f !== -1 && p !== -1 || (f = r.findAtomsOnResidue(e, qc(c, "coarseBackbone")), p = r.findAtomsOnResidue(t, qc(d, "coarseBackbone")));
  var g = n.x, m = n.y, v = n.z, h = A.create(g[f], m[f], v[f]), y = A.create(g[p], m[p], v[p]), x = u[e] === -1 || l[e] === -1 || u[t] === -1 || l[t] === -1;
  return A.distance(h, y) < (x ? 10 : 3);
}
function oD(e, t, n, r) {
  for (var i, a, o, s, u = [], l = [], c = /* @__PURE__ */ new Map(), d = Kt.transientSegments(e.chainAtomSegments, le.ofBounds(0, e.atoms._rowCount)), f = Kt.transientSegments(e.residueAtomSegments, le.ofBounds(0, e.atoms._rowCount)), p = e.index, g = e.derived, m = e.residues.label_seq_id, v = e.chains.label_entity_id, h = g.residue, y = h.moleculeType, x = h.traceElementIndex; d.hasNext; ) {
    var S = d.move();
    f.setSegment(S), i = -1, a = -1, o = -1, s = -1;
    var b = t.getEntityIndex(v.value(S.index)), _ = r.byEntityKey[b], C = _ ? _.sequence.seqId.value(_.sequence.seqId.rowCount - 1) : -1, w = e.residueAtomSegments.index[S.start], I = e.residueAtomSegments.index[S.end - 1], M = m.value(w), E = m.value(I);
    for (M === 1 && E === C && n.xyzDefined && HC(w, I, n, p, g) && (c.set(w, I), c.set(I, w)); f.hasNext; ) {
      var T = f.move(), P = T.index, k = m.value(P);
      if (U6(y[P]) && x[P] !== -1) if (s !== -1) if (k !== i + 1) u.push(s, o - 1), l.push(a, T.end - 1), s = T.start;
      else if (f.hasNext) {
        var D = e.residueAtomSegments.index[T.start], B = e.residueAtomSegments.index[o - 1];
        n.xyzDefined && !HC(D, B, n, e.index, g) && (u.push(s, o - 1), l.push(a, T.end - 1), s = T.start);
      } else u.push(s, T.end - 1);
      else s = T.start;
      else s !== -1 && (u.push(s, o - 1), s = -1);
      a = T.start, o = T.end, i = k;
    }
  }
  return { polymerRanges: Zn.ofSortedRanges(u), gapRanges: Zn.ofSortedRanges(l), cyclicPolymerMap: c };
}
function sD(e) {
  var t = /* @__PURE__ */ new Map();
  return function(n) {
    if (t.has(n)) return t.get(n);
    var r = e(n);
    return t.set(n, r), r;
  };
}
function Wj(e) {
  for (var t = /* @__PURE__ */ new Map(), n = function(s, u, l) {
    return "".concat(s, "|").concat(u, "|").concat(l);
  }, r = e.pdbx_unobs_or_zero_occ_residues, i = 0, a = r._rowCount; i < a; ++i) {
    var o = n(r.PDB_model_num.value(i), r.label_asym_id.value(i), r.label_seq_id.value(i));
    t.set(o, { polymer_flag: r.polymer_flag.value(i), occupancy_flag: r.occupancy_flag.value(i) });
  }
  return { has: function(s, u, l) {
    return t.has(n(s, u, l));
  }, get: function(s, u, l) {
    return t.get(n(s, u, l));
  }, size: t.size };
}
function Xj(e) {
  var t = /* @__PURE__ */ new Map();
  if (e.chem_comp._rowCount > 0) for (var n = e.chem_comp.id, r = 0, i = n.rowCount; r < i; ++r) t.set(n.value(r), On.getRow(e.chem_comp, r));
  else uD(e).forEach(function(a) {
    t.set(a, function(o) {
      return { formula: "", formula_weight: 0, id: o, name: o, mon_nstd_flag: z6.has(o) ? "y" : "n", pdbx_synonyms: [], type: Mk(o) };
    }(a));
  });
  return t;
}
function Zj(e) {
  var t = /* @__PURE__ */ new Map();
  if (e.pdbx_chem_comp_identifier._rowCount > 0) {
    for (var n = e.pdbx_chem_comp_identifier, r = n.comp_id, i = n.type, a = n.identifier, o = 0, s = r.rowCount; o < s; ++o) if (i.value(o) === "SNFG CARBOHYDRATE SYMBOL" || i.value(o) === "SNFG CARB SYMBOL") {
      var u = a.value(o), l = iH.get(u);
      l ? t.set(r.value(o), l) : console.warn("Unknown SNFG name '".concat(u, "'"));
    }
  }
  if (e.chem_comp._rowCount > 0) {
    var c = e.chem_comp, d = c.id;
    for (i = c.type, o = 0, s = d.rowCount; o < s; ++o) {
      var f = d.value(o);
      if (!t.has(f)) {
        var p = i.value(o);
        $c.has(f) ? t.set(f, $c.get(f)) : ah(p, f) === 9 && t.set(f, gk);
      }
    }
  } else {
    var g = uD(e);
    $c.forEach(function(m, v) {
      !t.has(v) && g.has(v) && t.set(v, m);
    });
  }
  return t;
}
(function(e) {
  e.getSequenceString = function(r) {
    var i = r.code.toArray();
    return (i instanceof Array ? i : Array.from(i)).join("");
  }, e.ofResidueNames = function(r, i) {
    if (i.rowCount === 0) throw new Error("cannot be empty");
    var a = function(o) {
      for (var s = 0, u = Math.min(o.rowCount, 10); s < u; s++) {
        var l = o.value(s) || "";
        if (GC(l) !== "X") return "protein";
        if (zC(l) !== "X") return "RNA";
        if (UC(l) !== "X") return "DNA";
      }
      return "generic";
    }(r);
    return new t(a, r, i);
  };
  var t = function() {
    function r(i, a, o) {
      this.kind = i, this.microHet = /* @__PURE__ */ new Map();
      for (var s = function(b, _) {
        var C;
        switch (b) {
          case "protein":
            C = GC;
            break;
          case "DNA":
            C = UC;
            break;
          case "RNA":
            C = zC;
            break;
          case "generic":
            C = function() {
              return "X";
            };
            break;
          default:
            Mi();
        }
        return C;
      }(i), u = [], l = [], c = [], d = /* @__PURE__ */ new Map(), f = 0, p = /* @__PURE__ */ new Map(), g = 0, m = o.rowCount; g < m; ++g) {
        var v = o.value(g);
        if (p.has(v)) d.has(v) ? d.get(v).push(a.value(g)) : d.set(v, [l[p.get(v)], a.value(g)]);
        else {
          p.set(v, f);
          var h = a.value(g);
          l[f] = h, c[f] = v, u[f] = s(h), f += 1;
        }
      }
      var y = [];
      for (g = 0, m = f; g < m; ++g) {
        var x = d.get(c[g]);
        if (x) {
          var S = x.map(function(b) {
            var _ = s(b);
            return _ === "X" ? b : _;
          });
          y[g] = "(".concat(S.join("|"), ")");
        } else y[g] = u[g] === "X" ? l[g] : u[g];
      }
      this.length = f, this.code = Q.ofStringArray(u), this.compId = Q.ofStringArray(l), this.seqId = Q.ofIntArray(c), this.label = Q.ofStringArray(y), this.microHet = d, this.indexMap = p;
    }
    return r.prototype.index = function(i) {
      return this.indexMap.get(i);
    }, r;
  }();
  e.ofSequenceRanges = function(r, i) {
    return new n("generic", r, i);
  };
  var n = function() {
    function r(i, a, o) {
      this.kind = i, this.seqIdStart = a, this.seqIdEnd = o, this.microHet = /* @__PURE__ */ new Map();
      for (var s = 0, u = Number.MAX_SAFE_INTEGER, l = 0, c = this.seqIdStart.rowCount; l < c; l++) {
        var d = this.seqIdStart.value(l), f = this.seqIdEnd.value(l);
        d < u && (u = d), s < f && (s = f);
      }
      var p = s - u + 1;
      this.code = Q.ofConst("X", p, Q.Schema.str), this.label = Q.ofConst("", p, Q.Schema.str), this.seqId = Q.ofLambda({ value: function(g) {
        return g + u + 1;
      }, rowCount: p, schema: Q.Schema.int }), this.compId = Q.ofConst("", p, Q.Schema.str), this.length = p, this.minSeqId = u;
    }
    return r.prototype.index = function(i) {
      return i - this.minSeqId;
    }, r;
  }();
})(Vp || (Vp = {})), function(e) {
  var t = { byEntityKey: {}, sequences: [] };
  function n() {
    for (var o = [], s = 0; s < arguments.length; s++) o[s] = arguments[s];
    for (var u = [], l = {}, c = 0, d = o.length; c < d; ++c) u.push.apply(u, o[c].sequences), Object.assign(l, o[c].byEntityKey);
    return { sequences: u, byEntityKey: l };
  }
  function r(o, s) {
    var u = s.atoms.label_comp_id, l = s.residues.label_seq_id, c = s.chainAtomSegments, d = s.residueAtomSegments, f = c.count, p = c.offsets, g = {}, m = [];
    if (f === 1 && p[0] === 0 && p[1] === 0) return { byEntityKey: g, sequences: m };
    for (var v = 0, h = s.chains._rowCount; v < h; v++) {
      var y = s.index.getEntityFromChain(v);
      if (g[y] === void 0 && o.data.type.value(y) === "polymer") {
        var x = v;
        for (v++; v < h && y === s.index.getEntityFromChain(v) && o.data.type.value(y) !== "polymer"; ) v++;
        v--;
        for (var S = d.index[p[x]], b = d.index[p[v + 1] - 1] + 1, _ = Q.window(l, S, b), C = [], w = S; w < b; ++w) C.push(u.value(d.offsets[w]));
        var I = Q.ofStringArray(C);
        g[y] = { entityId: o.data.id.value(y), sequence: Vp.ofResidueNames(I, _) }, m.push(g[y]);
      }
    }
    return { byEntityKey: g, sequences: m };
  }
  function i(o, s) {
    return n(a(o, s.spheres), a(o, s.gaussians));
  }
  function a(o, s) {
    var u = s.chainElementSegments, l = s.seq_id_begin, c = s.seq_id_end, d = u.count, f = u.offsets, p = {}, g = [];
    if (d === 1 && f[0] === 0 && f[1] === 0) return { byEntityKey: p, sequences: g };
    for (var m = 0, v = d; m < v; m++) {
      var h = s.getEntityFromChain(m);
      if (p[h] === void 0) {
        var y = m;
        for (m++; m < v && h === s.getEntityFromChain(m); ) m++;
        m--;
        var x = f[y], S = f[m + 1] - 1, b = Q.window(l, x, S), _ = Q.window(c, x, S);
        p[h] = { entityId: o.data.id.value(h), sequence: Vp.ofSequenceRanges(b, _) }, g.push(p[h]);
      }
    }
    return { byEntityKey: p, sequences: g };
  }
  e.fromHierarchy = function(o, s, u) {
    return n(r(o, s), u.isDefined ? i(o, u) : t);
  }, e.fromAtomicHierarchy = r, e.fromCoarseHierarchy = i, e.fromCoarseElements = a;
}(O5 || (O5 = {}));
var uD = sD(function(e) {
  for (var t = /* @__PURE__ */ new Set(), n = e.atom_site, r = n.label_comp_id, i = n.auth_comp_id, a = r.isDefined ? r : i, o = 0, s = a.rowCount; o < s; ++o) t.add(a.value(o));
  return t;
});
function lD(e, t) {
  for (var n = /* @__PURE__ */ new Map(), r = e.chains, i = r.auth_asym_id, a = r.label_asym_id, o = r.label_entity_id, s = 0, u = e.chains._rowCount; s < u; s++) {
    var l = a.value(s);
    n.set(l, { id: l, auth_id: i.value(s), entity_id: o.value(s) });
  }
  if (t != null && t.struct_asym._rowCount) for (var c = t.struct_asym, d = (l = c.id, c.entity_id), f = (s = 0, l.rowCount); s < f; ++s) {
    var p = l.value(s);
    n.has(p) || n.set(p, { id: p, auth_id: "", entity_id: d.value(s) });
  }
  return n;
}
var Qj = Q.Schema.Aliased(Q.Schema.Str(""));
function cD(e) {
  var t;
  if (e.entity.id.isDefined) t = e.entity;
  else {
    for (var n = /* @__PURE__ */ new Set(), r = [], i = [], a = e.atom_site, o = a.label_entity_id, s = a.label_comp_id, u = 0, l = e.atom_site._rowCount; u < l; u++) {
      var c = o.value(u);
      n.has(c) || (r.push(c), i.push(xH(s.value(u))), n.add(c));
    }
    var d = e.ihm_sphere_obj_site.entity_id;
    for (u = 0, l = e.ihm_sphere_obj_site._rowCount; u < l; u++)
      c = d.value(u), n.has(c) || (r.push(c), i.push("polymer"), n.add(c));
    var f = e.ihm_gaussian_obj_site.entity_id;
    for (u = 0, l = e.ihm_gaussian_obj_site._rowCount; u < l; u++)
      c = f.value(u), n.has(c) || (r.push(c), i.push("polymer"), n.add(c));
    t = On.ofPartialColumns(Ka.entity, { id: Q.ofArray({ array: r, schema: Ka.entity.id }), type: Q.ofArray({ array: i, schema: Ka.entity.type }) }, r.length);
  }
  var p = Q.createIndexer(t.id), g = new Array(t._rowCount);
  g.fill("other");
  var m = /* @__PURE__ */ new Set(), v = !1;
  if (e.entity_poly && e.entity_poly.type.isDefined) {
    var h = e.entity_poly, y = h.entity_id, x = h.type, S = h._rowCount;
    for (u = 0; u < S; ++u)
      g[p(c = y.value(u))] = x.value(u), m.add(c);
  } else v = !0;
  if (e.pdbx_entity_branch && e.pdbx_entity_branch.entity_id.isDefined) {
    var b = e.pdbx_entity_branch;
    for (y = b.entity_id, x = b.type, S = b._rowCount, u = 0; u < S; ++u)
      g[p(c = y.value(u))] = x.value(u), m.add(c);
  } else v = !0;
  if (m.size < g.length && (v = !0), v) {
    var _ = /* @__PURE__ */ new Map();
    if (e.chem_comp) {
      var C = e.chem_comp, w = C.id;
      for (x = C.type, u = 0, l = e.chem_comp._rowCount; u < l; u++) _.set(w.value(u), x.value(u));
    }
    if (e.atom_site) {
      var I = e.atom_site;
      for (o = I.label_entity_id, s = I.label_comp_id, u = 0, l = e.atom_site._rowCount; u < l; u++)
        if (c = o.value(u), !m.has(c)) {
          var M = s.value(u), E = _.get(M) || "";
          g[p(c)] = CH(M, E), m.add(c);
        }
    }
  }
  return { data: t, subtype: Q.ofArray({ array: g, schema: Qj }), getEntityIndex: p };
}
function dD(e, t, n) {
  var r;
  if (!e.pdbx_molecule || !e.pdbx_molecule.prd_id.isDefined) return t;
  var i = new Array(t.data._rowCount);
  i.fill("");
  for (var a = e.pdbx_molecule, o = a.asym_id, s = a.prd_id, u = a._rowCount, l = 0; l < u; ++l) {
    var c = o.value(l), d = (r = n.get(c)) === null || r === void 0 ? void 0 : r.entity_id;
    d !== void 0 && (i[t.getEntityIndex(d)] = s.value(l));
  }
  var f = Q.ofArray({ array: i, schema: Q.Schema.str });
  return O(O({}, t), { prd_id: f });
}
var nr, qC, M0 = function() {
  function e(t) {
    this.frames = t, this.frameCount = t.length, this.representative = t[0], this.duration = t.length;
  }
  return e.prototype.getFrameAtIndex = function(t) {
    return this.frames[t];
  }, e;
}();
function Ul(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          return r = function(u, l) {
            return { missingResidues: Wj(u), chemicalComponentMap: Xj(u), saccharideComponentMap: Zj(u) };
          }(e), e.ihm_model_list._rowCount > 0 ? [4, $j(n, e, r, t)] : [3, 2];
        case 1:
          return a = s.sent(), [3, 4];
        case 2:
          return [4, Jj(n, e, r, t)];
        case 3:
          a = s.sent(), s.label = 4;
        case 4:
          for (i = a, o = 0; o < i.length; o++) nr.TrajectoryInfo.set(i[o], { index: o, size: i.length });
          return [2, new M0(i)];
      }
    });
  });
}
function fD(e, t) {
  var n = e.rowCount;
  if (!e.isDefined) return n;
  for (var r = t + 1; r < n && e.areValuesEqual(t, r); ) r++;
  return r;
}
function Jj(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i, a, o, s, u, l, c, d, f;
    return ie(this, function(p) {
      switch (p.label) {
        case 0:
          if (i = [], !t.atom_site) return [3, 3];
          a = t.atom_site.id.rowCount, o = cD(t), s = 0, p.label = 1;
        case 1:
          return s < a ? (u = fD(t.atom_site.pdbx_PDB_model_num, s), [4, aD(e, t.atom_site, s, u)]) : [3, 3];
        case 2:
          return l = p.sent(), c = l.atom_site, d = l.sourceIndex, f = function(g, m, v, h, y, x, S) {
            var b = nD(m, v, h, y.chemicalComponentMap, x, S), _ = m.pdbx_PDB_model_num.value(0);
            if (S && b.sameAsPrevious) return O(O({}, S), { id: di.create22(), modelNum: _, atomicConformation: b.conformation, _dynamicPropertyData: /* @__PURE__ */ Object.create(null) });
            var C = rD, w = iD(g, h, b.hierarchy, C.hierarchy), I = oD(b.hierarchy, h, b.conformation, w), M = lD(b.hierarchy), E = g.entry.id.valueKind(0) === 0 ? g.entry.id.value(0) : x.name, T = [];
            return E && T.push(E), g.struct.title.valueKind(0) === 0 && T.push(g.struct.title.value(0)), { id: di.create22(), entryId: E, label: T.join(" | "), entry: E, sourceData: x, modelNum: _, parent: void 0, entities: dD(g, h, M), sequence: w, atomicHierarchy: b.hierarchy, atomicConformation: b.conformation, atomicRanges: I, atomicChainOperatorMappinng: b.chainOperatorMapping, coarseHierarchy: C.hierarchy, coarseConformation: C.conformation, properties: O(O({}, y), { structAsymMap: M }), customProperties: new Rm(), _staticPropertyData: /* @__PURE__ */ Object.create(null), _dynamicPropertyData: /* @__PURE__ */ Object.create(null) };
          }(t, c, d, o, n, r, i.length > 0 ? i[i.length - 1] : void 0), i.push(f), s = u, [3, 1];
        case 3:
          return [2, i];
      }
    });
  });
}
function zy(e, t) {
  for (var n = /* @__PURE__ */ new Map(), r = e._rowCount, i = 0; i < r; ) {
    var a = fD(t, i), o = t.value(i);
    n.set(o, { table: On.window(e, e._schema, i, a), start: i, end: a }), i = a;
  }
  return n;
}
function $j(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _;
    return ie(this, function(C) {
      switch (C.label) {
        case 0:
          if (i = cD(t), a = t.atom_site.ihm_model_id.isDefined ? t.atom_site.ihm_model_id : t.atom_site.pdbx_PDB_model_num, o = zy(t.atom_site, a), s = zy(t.ihm_sphere_obj_site, t.ihm_sphere_obj_site.model_id), u = zy(t.ihm_gaussian_obj_site, t.ihm_gaussian_obj_site.model_id), l = [], !t.ihm_model_list) return [3, 6];
          c = t.ihm_model_list, d = c.model_id, f = c.model_name, p = 0, C.label = 1;
        case 1:
          return p < t.ihm_model_list._rowCount ? (g = d.value(p), m = void 0, v = void 0, o.has(g) ? (h = o.get(g), [4, aD(e, t.atom_site, h.start, h.end)]) : [3, 3]) : [3, 6];
        case 2:
          return y = C.sent(), x = y.atom_site, S = y.sourceIndex, m = x, v = S, [3, 4];
        case 3:
          m = On.window(t.atom_site, t.atom_site._schema, 0, 0), v = Q.ofIntArray([]), C.label = 4;
        case 4:
          b = { model_id: g, model_name: f.value(p), model_group_name: jq(g, t), entities: i, atom_site: m, atom_site_sourceIndex: v, ihm_sphere_obj_site: s.has(g) ? s.get(g).table : On.window(t.ihm_sphere_obj_site, t.ihm_sphere_obj_site._schema, 0, 0), ihm_gaussian_obj_site: u.has(g) ? u.get(g).table : On.window(t.ihm_gaussian_obj_site, t.ihm_gaussian_obj_site._schema, 0, 0) }, _ = function(w, I, M, E) {
            var T = nD(I.atom_site, I.atom_site_sourceIndex, I.entities, M.chemicalComponentMap, E), P = qj(I, M.chemicalComponentMap), k = iD(w, I.entities, T.hierarchy, P.hierarchy), D = oD(T.hierarchy, I.entities, T.conformation, k), B = w.entry.id.valueKind(0) === 0 ? w.entry.id.value(0) : E.name, L = [];
            B && L.push(B), w.struct.title.valueKind(0) === 0 && L.push(w.struct.title.value(0)), I.model_name && L.push(I.model_name), I.model_group_name && L.push(I.model_group_name);
            var F = lD(T.hierarchy, w);
            return { id: di.create22(), entryId: B, label: L.join(" | "), entry: B, sourceData: E, modelNum: I.model_id, parent: void 0, entities: dD(w, I.entities, F), sequence: k, atomicHierarchy: T.hierarchy, atomicConformation: T.conformation, atomicRanges: D, atomicChainOperatorMappinng: T.chainOperatorMapping, coarseHierarchy: P.hierarchy, coarseConformation: P.conformation, properties: O(O({}, M), { structAsymMap: F }), customProperties: new Rm(), _staticPropertyData: /* @__PURE__ */ Object.create(null), _dynamicPropertyData: /* @__PURE__ */ Object.create(null) };
          }(t, b, n, r), l.push(_), C.label = 5;
        case 5:
          return p++, [3, 1];
        case 6:
          return [2, l];
      }
    });
  });
}
function Uy(e) {
  for (var t = /* @__PURE__ */ new Map(), n = 0, r = e.length; n < r; n++) t.set(n, e[n]);
  return t;
}
(function(e) {
  function t(h, y) {
    for (var x = [], S = y.frames, b = h.atomicHierarchy.atomSourceIndex, _ = Q.isIdentity(b) ? void 0 : b.toArray({ array: Int32Array }), C = u(h), w = 0, I = S.length; w < I; ++w) {
      var M = S[w], E = O(O({}, h), { id: di.create22(), modelNum: w, atomicConformation: Xg.getAtomicConformation(M, h.atomicConformation.atomId, _), customProperties: new Rm(), _staticPropertyData: /* @__PURE__ */ Object.create(null), _dynamicPropertyData: /* @__PURE__ */ Object.create(null) });
      if (M.cell) {
        var T = Gi.fromCell(M.cell.size, M.cell.anglesInRadians);
        Gi.Provider.set(E, T);
      }
      e.TrajectoryInfo.set(E, { index: w, size: S.length }), e.CoarseGrained.set(E, C), x.push(E);
    }
    return { trajectory: x, srcIndexArray: _ };
  }
  e.trajectoryFromModelAndCoordinates = function(h, y) {
    return new M0(t(h, y).trajectory);
  }, e.trajectoryFromTopologyAndCoordinates = function(h, y) {
    var x = this;
    return Xt.create("Create Trajectory", function(S) {
      return se(x, 0, void 0, function() {
        var b, _, C, w, I, M, E, T, P, k;
        return ie(this, function(D) {
          switch (D.label) {
            case 0:
              return [4, Ul(h.basic, h.sourceData, S)];
            case 1:
              if ((b = D.sent()).frameCount === 0) throw new Error("found no model");
              for (_ = b.representative, C = t(_, y).trajectory, w = { pairs: h.bonds, count: _.atomicHierarchy.atoms._rowCount }, I = fi.fromData(w), M = u(_), E = 0, T = 0, P = C; T < P.length; T++) k = P[T], fi.Provider.set(k, I), e.TrajectoryInfo.set(k, { index: E++, size: C.length }), e.CoarseGrained.set(k, M);
              return [2, new M0(C)];
          }
        });
      });
    });
  };
  var n = "__Center__";
  e.getCenter = function(h) {
    if (h._dynamicPropertyData[n]) return h._dynamicPropertyData[n];
    var y = function(x, S) {
      var b = [], _ = [], C = [];
      x.x.length && (b.push.apply(b, lo(x.x)), _.push.apply(_, lo(x.y)), C.push.apply(C, lo(x.z))), S && (S.spheres.x.length && (b.push.apply(b, lo(S.spheres.x)), _.push.apply(_, lo(S.spheres.y)), C.push.apply(C, lo(S.spheres.z))), S.gaussians.x.length && (b.push.apply(b, lo(S.gaussians.x)), _.push.apply(_, lo(S.gaussians.y)), C.push.apply(C, lo(S.gaussians.z))));
      var w = lo(b), I = w[0], M = w[1], E = lo(_), T = E[0], P = E[1], k = lo(C), D = k[0], B = I + (M - I) / 2, L = T + (P - T) / 2, F = D + (k[1] - D) / 2;
      return A.create(B, L, F);
    }(h.atomicConformation, h.coarseConformation);
    return h._dynamicPropertyData[n] = y, y;
  };
  var r = "__InvertedAtomSrcIndex__";
  e.getInvertedAtomSourceIndex = function(h) {
    if (h._staticPropertyData[r]) return h._staticPropertyData[r];
    var y = function(x) {
      for (var S = new Int32Array(x.rowCount), b = !1, _ = 0, C = x.rowCount; _ < C; _++) {
        var w = x.value(_);
        w !== _ && (b = !1), S[w] = _;
      }
      return { isIdentity: b, invertedIndex: S };
    }(h.atomicHierarchy.atomSourceIndex);
    return h._staticPropertyData[r] = y, y;
  };
  var i = "__TrajectoryInfo__";
  e.TrajectoryInfo = { get: function(h) {
    return h._dynamicPropertyData[i] || { index: 0, size: 1 };
  }, set: function(h, y) {
    return h._dynamicPropertyData[i] = y;
  } };
  var a = "__AsymIdCount__";
  e.AsymIdCount = { get: function(h) {
    if (h._dynamicPropertyData[a]) return h._dynamicPropertyData[a];
    var y = function(x) {
      var S = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
      return x.properties.structAsymMap.forEach(function(_, C) {
        var w = _.auth_id;
        S.add(w), b.add(C);
      }), { auth: S.size, label: b.size };
    }(h);
    return h._dynamicPropertyData[a] = y, y;
  } }, e.AsymIdOffset = V1.createSimple("asym_id_offset", "static"), e.Index = V1.createSimple("index", "static"), e.getRoot = function(h) {
    return h.parent || h;
  }, e.areHierarchiesEqual = function(h, y) {
    return h.atomicHierarchy === y.atomicHierarchy && h.coarseHierarchy === y.coarseHierarchy;
  };
  var o = "__CoordinatesHistory__";
  e.CoordinatesHistory = { get: function(h) {
    return h._staticPropertyData[o];
  }, set: function(h, y) {
    return h._staticPropertyData[o] = y;
  } };
  var s = "__CoarseGrained__";
  function u(h) {
    var y = e.CoarseGrained.get(h);
    if (y === void 0) {
      for (var x = 0, S = h.atomicHierarchy.derived.residue.polymerType, b = 0; b < S.length; ++b) S[b] !== 0 && (x += 1);
      var _ = !1, C = !1, w = h.atomicHierarchy.atoms, I = w.label_atom_id, M = w._rowCount;
      for (b = 0; b < M; ++b) {
        var E = I.value(b);
        if (_ || E !== "BB" || (_ = !0), C || E !== "SC1" || (C = !0), _ && C) break;
      }
      y = _ && C || !(!x || !M) && M / x < 3, e.CoarseGrained.set(h, y);
    }
    return y;
  }
  function l(h) {
    return !!ur.is(h.sourceData) && (h.entryId.match(/^[1-9][a-z0-9]{3,3}$/i) !== null || h.entryId.match(/^pdb_[0-9]{4,4}[1-9][a-z0-9]{3,3}$/i) !== null);
  }
  e.CoarseGrained = { get: function(h) {
    return h._staticPropertyData[s];
  }, set: function(h, y) {
    return h._staticPropertyData[s] = y;
  } }, e.isCoarseGrained = u, e.isMaterial = function(h) {
    var y, x;
    return !!(!((x = (y = h.sourceData) === null || y === void 0 ? void 0 : y.data) === null || x === void 0) && x.isMaterial);
  }, e.isMaterialCrystal = function(h) {
    var y, x, S, b = (y = h.sourceData) === null || y === void 0 ? void 0 : y.data;
    return !(b != null && b.isMaterial) && !!(!((S = (x = b == null ? void 0 : b.molecules) === null || x === void 0 ? void 0 : x[0]) === null || S === void 0) && S.cell);
  }, e.hasCarbohydrate = function(h) {
    return h.properties.saccharideComponentMap.size > 0;
  }, e.hasProtein = function(h) {
    for (var y = h.entities.subtype, x = 0, S = y.rowCount; x < S; ++x) if (y.value(x).startsWith("polypeptide")) return !0;
    return !1;
  }, e.hasNucleic = function(h) {
    for (var y = h.entities.subtype, x = 0, S = y.rowCount; x < S; ++x) {
      var b = y.value(x);
      if (b.endsWith("ribonucleotide hybrid") || b.endsWith("ribonucleotide")) return !0;
    }
    return !1;
  }, e.isFromPdbArchive = function(h) {
    if (!ur.is(h.sourceData)) return !1;
    for (var y = h.sourceData.data.db, x = 0, S = y.database_2.database_id.rowCount; x < S; ++x) if (y.database_2.database_id.value(x) === "PDB") return !0;
    return !1;
  }, e.hasPdbId = l, e.hasSecondaryStructure = function(h) {
    if (!ur.is(h.sourceData)) return !1;
    var y = h.sourceData.data.db;
    return y.struct_conf.id.isDefined || y.struct_sheet_range.id.isDefined;
  };
  var c = A.create(1.5707963, 1.5707963, 1.5707963), d = A.create(1, 1, 1);
  function f(h) {
    if (!ur.is(h.sourceData)) return !1;
    for (var y = h.sourceData.data.db, x = 0; x < y.exptl.method.rowCount; x++)
      if (y.exptl.method.value(x).toUpperCase().indexOf("DIFFRACTION") >= 0) return !0;
    return !1;
  }
  function p(h) {
    if (!ur.is(h.sourceData)) return !1;
    for (var y = h.sourceData.data.db, x = 0; x < y.exptl.method.rowCount; x++)
      if (y.exptl.method.value(x).toUpperCase().indexOf("MICROSCOPY") >= 0) return !0;
    return !1;
  }
  function g(h) {
    if (!ur.is(h.sourceData) || !f(h)) return !1;
    var y = h.sourceData.data.db.pdbx_database_status.status_code_sf;
    return y.isDefined && y.value(0) === "REL";
  }
  function m(h) {
    if (!ur.is(h.sourceData)) return !1;
    for (var y = h.sourceData.data.db, x = y.pdbx_database_related, S = x.db_name, b = x.content_type, _ = 0, C = y.pdbx_database_related._rowCount; _ < C; ++_) if (S.value(_).toUpperCase() === "EMDB" && b.value(_) === "associated EM volume") return !0;
    return !1;
  }
  function v(h) {
    return !!ur.is(h.sourceData) && (g(h) || m(h));
  }
  e.hasCrystalSymmetry = function(h) {
    var y, x = (y = Gi.Provider.get(h)) === null || y === void 0 ? void 0 : y.spacegroup;
    return !(!x || x.num === 1 && A.equals(x.cell.anglesInRadians, c) && A.equals(x.cell.size, d));
  }, e.isFromXray = f, e.isFromEm = p, e.isFromNmr = function(h) {
    if (!ur.is(h.sourceData)) return !1;
    for (var y = h.sourceData.data.db, x = 0; x < y.exptl.method.rowCount; x++)
      if (y.exptl.method.value(x).toUpperCase().indexOf("NMR") >= 0) return !0;
    return !1;
  }, e.hasXrayMap = g, e.hasEmMap = m, e.hasDensityMap = v, e.probablyHasDensityMap = function(h) {
    if (!ur.is(h.sourceData)) return !1;
    var y = h.sourceData.data.db;
    return v(h) || l(h) && (!y.exptl.method.isDefined || f(h) && (!y.pdbx_database_status.status_code_sf.isDefined || y.pdbx_database_status.status_code_sf.valueKind(0) === 2) || p(h) && !y.pdbx_database_related.db_name.isDefined);
  };
})(nr || (nr = {})), function(e) {
  e.getCifDataSource = function(r, i, a) {
    if (!i) return { rowCount: 0 };
    if (a && a[i.id]) return a[i.id];
    var o = i.getElements(r), s = { data: o, rowCount: o.elements.length };
    return a && (a[i.id] = s), s;
  }, e.fromAtomMap = function(r) {
    return new jC(r);
  }, e.fromAtomArray = function(r) {
    return new jC(Uy(r));
  };
  var t = function(r) {
    return r.atomicHierarchy.residueAtomSegments;
  };
  e.fromResidueMap = function(r) {
    return new s2("residue", r, t, 0);
  }, e.fromResidueArray = function(r) {
    return new s2("residue", Uy(r), t, 0);
  };
  var n = function(r) {
    return r.atomicHierarchy.chainAtomSegments;
  };
  e.fromChainMap = function(r) {
    return new s2("chain", r, n, 0);
  }, e.fromChainArray = function(r) {
    return new s2("chain", Uy(r), n, 0);
  }, e.fromEntityMap = function(r) {
    return new eK(r);
  };
}(qC || (qC = {}));
var s2 = function() {
  function e(t, n, r, i) {
    this.level = t, this.map = n, this.segmentGetter = r, this.id = di.create22(), this.kind = i;
  }
  return e.prototype.has = function(t) {
    return this.map.has(t);
  }, e.prototype.get = function(t) {
    return this.map.get(t);
  }, e.prototype.getStructureElements = function(t) {
    var n = t.models;
    if (n.length !== 1) throw new Error("Only works on structures with a single model.");
    for (var r = /* @__PURE__ */ new Set(), i = t.unitSymmetryGroups, a = [], o = this.segmentGetter(n[0]), s = 0, u = i; s < u.length; s++) {
      var l = u[s].units[0];
      if (l.kind === this.kind) for (var c = Kt.transientSegments(o, l.elements); c.hasNext; ) {
        var d = c.move();
        this.has(d.index) && !r.has(d.index) && (r.add(d.index), a[a.length] = He.create(t, l, l.elements[d.start]));
      }
    }
    return a.sort(function(f, p) {
      return f.element - p.element;
    }), a;
  }, e.prototype.getElements = function(t) {
    var n = this, r = this.segmentGetter(t.model).index, i = this.getStructureElements(t);
    return { elements: i, property: function(a) {
      return n.get(r[i[a].element]);
    } };
  }, e;
}(), jC = function() {
  function e(t) {
    this.map = t, this.id = di.create22(), this.level = "atom", this.kind = 0;
  }
  return e.prototype.has = function(t) {
    return this.map.has(t);
  }, e.prototype.get = function(t) {
    return this.map.get(t);
  }, e.prototype.getStructureElements = function(t) {
    if (t.models.length !== 1) throw new Error("Only works on structures with a single model.");
    for (var n = /* @__PURE__ */ new Set(), r = [], i = 0, a = t.unitSymmetryGroups; i < a.length; i++) {
      var o = a[i].units[0];
      if (o.kind === this.kind) for (var s = o.elements, u = 0, l = s.length; u < l; u++) {
        var c = s[u];
        this.has(c) && !n.has(c) && (n.add(s[u]), r[r.length] = He.create(t, o, c));
      }
    }
    return r.sort(function(d, f) {
      return d.element - f.element;
    }), r;
  }, e.prototype.getElements = function(t) {
    var n = this, r = this.getStructureElements(t);
    return { elements: r, property: function(i) {
      return n.get(r[i].element);
    } };
  }, e;
}(), eK = function() {
  function e(t) {
    this.map = t, this.id = di.create22(), this.level = "entity", this.kind = 0;
  }
  return e.prototype.has = function(t) {
    return this.map.has(t);
  }, e.prototype.get = function(t) {
    return this.map.get(t);
  }, e.prototype.getStructureElements = function(t) {
    var n = t.models;
    if (n.length !== 1) throw new Error("Only works on structures with a single model.");
    for (var r = n[0].atomicHierarchy.index, i = /* @__PURE__ */ new Set(), a = t.unitSymmetryGroups, o = [], s = n[0].atomicHierarchy.chainAtomSegments, u = 0, l = a; u < l.length; u++) {
      var c = l[u].units[0];
      if (c.kind === this.kind) for (var d = Kt.transientSegments(s, c.elements); d.hasNext; ) {
        var f = d.move(), p = r.getEntityFromChain(f.index);
        this.has(p) && !i.has(p) && (i.add(p), o[o.length] = He.create(t, c, c.elements[f.start]));
      }
    }
    return o.sort(function(g, m) {
      return g.element - m.element;
    }), o;
  }, e.prototype.getElements = function(t) {
    var n = this, r = this.getStructureElements(t), i = t.model.atomicHierarchy.chainAtomSegments.index, a = t.model.atomicHierarchy.index;
    return { elements: r, property: function(o) {
      return n.get(a.getEntityFromChain(i[r[o].element]));
    } };
  }, e;
}(), u2 = Ae(13421772), KC = {}, tK = { name: "carbohydrate-symbol", label: "Carbohydrate Symbol", category: "Residue Property", factory: function e(t, n) {
  var r;
  if (t.structure) {
    var i = t.structure.carbohydrates, a = i.elements, o = i.getElementIndices, s = function(u, l) {
      if (!ve.isAtomic(u)) return u2;
      var c = o(u, l);
      return c.length > 0 ? a[c[0]].component.color : u2;
    };
    r = function(u, l) {
      return l ? ut.Secondary : He.is(u) ? s(u.unit, u.element) : pt.isLocation(u) ? s(u.aUnit, u.aUnit.elements[u.aIndex]) : u2;
    };
  } else r = function() {
    return u2;
  };
  return { factory: e, granularity: "group", color: r, props: n, description: "Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).", legend: Ws(aH) };
}, getParams: function(e) {
  return KC;
}, defaultValues: N.getDefaultValues(KC), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return nr.hasCarbohydrate(t);
  });
} }, mD = Ae(14539007), nK = "Gives everything the same, uniform color.", uv = { value: N.Color(mD) };
function sh(e, t) {
  var n = ui(t.value, mD);
  return { factory: sh, granularity: "uniform", color: function() {
    return n;
  }, props: t, description: nK, legend: Ws([["uniform", n]]) };
}
var rK = { name: "uniform", label: "Uniform", category: "Miscellaneous", factory: sh, getParams: function(e) {
  return uv;
}, defaultValues: N.getDefaultValues(uv), isApplicable: function(e) {
  return !0;
} }, YC = { value: N.Numeric(1, { min: 0, max: 20, step: 0.1 }) };
function j6(e, t) {
  var n = t.value;
  return { factory: j6, granularity: "uniform", size: function() {
    return n;
  }, props: t, description: "Gives everything the same, uniform size." };
}
var iK = { name: "uniform", label: "Uniform", category: "", factory: j6, getParams: function(e) {
  return YC;
}, defaultValues: N.getDefaultValues(YC), isApplicable: function(e) {
  return !0;
} }, WC = { scale: N.Numeric(1, { min: 0.1, max: 5, step: 0.1 }) };
function Hy(e, t) {
  return ve.isAtomic(e) ? f3(e.model.atomicHierarchy.atoms.type_symbol.value(t)) : ve.isSpheres(e) ? e.model.coarseConformation.spheres.radius[t] : 0;
}
var aK = { name: "physical", label: "Physical", category: "", factory: function e(t, n) {
  var r = n.scale === void 0 ? 1 : n.scale;
  return { factory: e, granularity: "group", size: function(i) {
    return He.is(i) ? r * Hy(i.unit, i.element) : pt.isLocation(i) ? r * Math.min(Hy(i.aUnit, i.aUnit.elements[i.aIndex]), Hy(i.bUnit, i.bUnit.elements[i.bIndex])) : 1 * r;
  }, props: n, description: "Assigns a physical size, i.e. vdW radius for atoms or given radius for coarse spheres." };
}, getParams: function(e) {
  return WC;
}, defaultValues: N.getDefaultValues(WC), isApplicable: function(e) {
  return !!e.structure;
} }, Ua = A();
function rm(e, t, n, r) {
  for (var i = 0, a = 3 * r; i < a; i += 3) A.fromArray(Ua, t, n + i), A.transformMat4(Ua, Ua, e), A.toArray(Ua, t, n + i);
}
var XC = A(), qy = A(), ZC = A(), No = A(), QC = A();
function pD(e, t, n, r, i) {
  for (var a = 0, o = 3 * i; a < o; a += 3) {
    var s = 3 * t[a], u = 3 * t[a + 1], l = 3 * t[a + 2];
    A.fromArray(XC, e, s), A.fromArray(qy, e, u), A.fromArray(ZC, e, l), A.sub(No, ZC, qy), A.sub(QC, XC, qy), A.cross(No, No, QC), n[s] += No[0], n[s + 1] += No[1], n[s + 2] += No[2], n[u] += No[0], n[u + 1] += No[1], n[u + 2] += No[2], n[l] += No[0], n[l + 1] += No[1], n[l + 2] += No[2];
  }
  return function(c, d) {
    for (var f = 0, p = 3 * d; f < p; f += 3) {
      var g = c[f], m = c[f + 1], v = c[f + 2], h = 1 / Math.sqrt(g * g + m * m + v * v);
      c[f] = g * h, c[f + 1] = m * h, c[f + 2] = v * h;
    }
    return c;
  }(n, r);
}
function Vm(e, t, n) {
  n === void 0 && (n = 1);
  for (var r = Kg(e), i = new Int32Array(r + 2), a = new Int32Array(t), o = new Int32Array(t), s = 0, u = t * n; s < u; s += n) ++o[e[s]];
  var l = 0;
  for (s = 0; s < t; s++) i[s] = l, l += o[s];
  i[t] = l;
  var c = new Int32Array(l);
  for (s = 0, u = t * n; s < u; s += n) {
    var d = e[s];
    c[i[d] + a[d]] = s, ++a[d];
  }
  return { indices: c, offsets: i };
}
function ci(e, t, n, r) {
  var i = function(u, l) {
    u = Math.max(u, 2);
    var c = Math.sqrt(u), d = Math.ceil(c), f = (d += (l - d % l) % l) > 0 ? Math.ceil(u / d) : 0;
    return { width: d, height: f, length: d * f * l };
  }(e, t), a = i.length, o = i.width, s = i.height;
  return { array: r = r && r.length >= a ? r : new n(a), width: o, height: s };
}
var Xo = A(), oK = new ms("14"), sK = new ms("98");
function hD(e) {
  return e > 1e5 ? oK : sK;
}
function od(e, t, n) {
  var r = 3 * n, i = hD(t);
  i.reset();
  for (var a = 0, o = 3 * t; a < o; a += r) A.fromArray(Xo, e, a), i.includePosition(Xo);
  for (i.finishedIncludeStep(), a = 0, o = 3 * t; a < o; a += r) A.fromArray(Xo, e, a), i.radiusPosition(Xo);
  var s = i.getSphere();
  if (t <= 98) {
    var u = [];
    for (a = 0, o = 3 * t; a < o; a += r) u.push(A.fromArray(A(), e, a));
    pe.setExtrema(s, u);
  }
  return s;
}
var jy = ne();
function Si(e, t, n) {
  if (n === 1) {
    ne.fromArray(jy, t, 0);
    var r = pe.clone(e);
    return ne.isIdentity(jy) ? r : pe.transform(r, r, jy);
  }
  var i = hD(n);
  i.reset();
  var a = e.center, o = e.radius, s = e.extrema;
  if (s && n < 50) {
    for (var u = 0, l = n; u < l; ++u) for (var c = 0, d = s; c < d.length; c++) {
      var f = d[c];
      A.transformMat4Offset(Xo, f, t, 0, 0, 16 * u), i.includePosition(Xo);
    }
    for (i.finishedIncludeStep(), u = 0, l = n; u < l; ++u) for (var p = 0, g = s; p < g.length; p++)
      f = g[p], A.transformMat4Offset(Xo, f, t, 0, 0, 16 * u), i.radiusPosition(Xo);
  } else {
    for (u = 0, l = n; u < l; ++u) A.transformMat4Offset(Xo, a, t, 0, 0, 16 * u), i.includePositionRadius(Xo, o);
    for (i.finishedIncludeStep(), u = 0, l = n; u < l; ++u) A.transformMat4Offset(Xo, a, t, 0, 0, 16 * u), i.radiusPositionRadius(Xo, o);
  }
  return i.getSphere();
}
var ji = new Uint8Array(772);
function gD(e, t) {
  if (t === 0) return 0;
  var n = new Uint32Array(e.buffer, 0, e.buffer.byteLength >> 2), r = t - 4 >> 2, i = 4 * r, a = 0;
  if (r < 0) for (var o = 0; o < t; ++o) a += e[o] && 1;
  else {
    for (o = 0; o < r; ++o) {
      var s = n[o];
      a += ji[65535 & s] + ji[s >> 16];
    }
    for (o = i; o < t; ++o) a += e[o] && 1;
  }
  return a / t;
}
function ss(e, t) {
  var n = ci(Math.max(1, e), 1, Uint8Array, t && t.tMarker.ref.value.array), r = gD(n.array, e), i = r === 0 ? 0 : -1;
  return t ? (R.updateIfChanged(t.uMarker, 0), R.update(t.tMarker, n), R.update(t.uMarkerTexDim, xe.create(n.width, n.height)), R.updateIfChanged(t.markerAverage, r), R.updateIfChanged(t.markerStatus, i), t) : { uMarker: R.create(0), tMarker: R.create(n), uMarkerTexDim: R.create(xe.create(n.width, n.height)), markerAverage: R.create(r), markerStatus: R.create(i) };
}
ji[1] = 1, ji[2] = 1, ji[3] = 1, ji[256] = 1, ji[512] = 1, ji[768] = 1, ji[257] = 2, ji[513] = 2, ji[769] = 2, ji[258] = 2, ji[514] = 2, ji[770] = 2, ji[259] = 2, ji[515] = 2, ji[771] = 2;
var ku = { kind: "null-location" };
function zr(e, t, n, r, i, a) {
  if (i === void 0 && (i = !1), a === void 0 && (a = function() {
    return !1;
  }), e % n != 0) throw new Error("incompatible groupCount and stride");
  var o = { location: ku, index: 0, groupIndex: 0, instanceIndex: 0, isSecondary: !1 }, s = o.groupIndex < e, u = !1, l = 0, c = 0, d = !1;
  return { get hasNext() {
    return s;
  }, get isNextNewInstance() {
    return u;
  }, groupCount: e, instanceCount: t, count: e * t, stride: n, nonInstanceable: i, move: function() {
    return s && (o.groupIndex = l, o.instanceIndex = c, o.index = c * e + l, o.location = r(l, d ? -1 : c), o.isSecondary = a(l, d ? -1 : c), (l += n) === e ? (++c, u = !0, c < t && (l = 0)) : u = !1, s = l < e), o;
  }, reset: function() {
    o.location = ku, o.index = 0, o.groupIndex = 0, o.instanceIndex = 0, o.isSecondary = !1, s = o.groupIndex < e, u = !1, l = 0, c = 0, d = !1;
  }, skipInstance: function() {
    s && o.instanceIndex === c && (++c, l = 0, s = c < t);
  }, voidInstances: function() {
    d = !0;
  } };
}
function Af(e) {
  return { kind: "position-location", position: A() };
}
function bo(e, t, n, r) {
  var i = function(a, o, s, u) {
    switch (Ui.getGranularity(a, s.granularity)) {
      case "uniform":
        return function(l, c, d) {
          return function(f, p) {
            return p ? (R.update(p.uColor, Ae.toVec3Normalized(p.uColor.ref.value, f)), R.updateIfChanged(p.dColorType, "uniform"), p) : { uColor: R.create(Ae.toVec3Normalized(A(), f)), tColor: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), tColorGrid: R.create(Ha()), tPalette: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), uColorTexDim: R.create(xe.create(1, 1)), uColorGridDim: R.create(A.create(1, 1, 1)), uColorGridTransform: R.create(Nt.create(0, 0, 0, 1)), dColorType: R.create("uniform"), dUsePalette: R.create(!1) };
          }(c(ku, !1), d);
        }(0, s.color, u);
      case "instance":
        return function(l, c, d) {
          var f = l.instanceCount, p = ci(Math.max(1, f), 3, Uint8Array, d && d.tColor.ref.value.array);
          for (l.reset(); l.hasNext; ) {
            var g = l.move(), m = g.location, v = g.isSecondary, h = g.instanceIndex;
            Ae.toArray(c(m, v), p.array, 3 * h), l.skipInstance();
          }
          return tp(p, "instance", d);
        }(a, s.color, u);
      case "group":
        return function(l, c, d) {
          var f = l.groupCount, p = ci(Math.max(1, f), 3, Uint8Array, d && d.tColor.ref.value.array);
          for (l.reset(); l.hasNext && !l.isNextNewInstance; ) {
            var g = l.move(), m = g.location, v = g.isSecondary, h = g.groupIndex;
            Ae.toArray(c(m, v), p.array, 3 * h);
          }
          return tp(p, "group", d);
        }(a, s.color, u);
      case "groupInstance":
        return function(l, c, d) {
          var f = l.groupCount, p = l.instanceCount, g = p * f, m = ci(Math.max(1, g), 3, Uint8Array, d && d.tColor.ref.value.array);
          for (l.reset(); l.hasNext; ) {
            var v = l.move(), h = v.location, y = v.isSecondary, x = v.index;
            Ae.toArray(c(h, y), m.array, 3 * x);
          }
          return tp(m, "groupInstance", d);
        }(a, s.color, u);
      case "vertex":
        return function(l, c, d) {
          var f = l.groupCount, p = l.stride, g = ci(Math.max(1, f), 3, Uint8Array, d && d.tColor.ref.value.array);
          for (l.reset(), l.voidInstances(); l.hasNext && !l.isNextNewInstance; ) for (var m = l.move(), v = m.location, h = m.isSecondary, y = m.groupIndex, x = c(v, h), S = 0; S < p; ++S) Ae.toArray(x, g.array, 3 * (y + S));
          return tp(g, "vertex", d);
        }(o, s.color, u);
      case "vertexInstance":
        return function(l, c, d) {
          var f = l.groupCount, p = l.instanceCount, g = l.stride, m = p * f, v = ci(Math.max(1, m), 3, Uint8Array, d && d.tColor.ref.value.array);
          for (l.reset(); l.hasNext; ) for (var h = l.move(), y = h.location, x = h.isSecondary, S = h.index, b = c(y, x), _ = 0; _ < g; ++_) Ae.toArray(b, v.array, 3 * (S + _));
          return tp(v, "vertexInstance", d);
        }(o, s.color, u);
      case "volume":
        return JC(s.grid, "volume", u);
      case "volumeInstance":
        return JC(s.grid, "volumeInstance", u);
      case "direct":
        return function(l) {
          return l ? (R.updateIfChanged(l.dColorType, "direct"), l) : { uColor: R.create(A()), tColor: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), tColorGrid: R.create(Ha()), tPalette: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), uColorTexDim: R.create(xe.create(1, 1)), uColorGridDim: R.create(A.create(1, 1, 1)), uColorGridTransform: R.create(Nt.create(0, 0, 0, 1)), dColorType: R.create("direct"), dUsePalette: R.create(!1) };
        }(u);
    }
  }(e, t, n, r);
  return n.palette ? (R.updateIfChanged(i.dUsePalette, !0), function(a, o) {
    var s = !0, u = o.ref.value;
    if (a.colors.length !== u.width || u.filter !== a.filter) s = !1;
    else for (var l = u.array, c = 0, d = 0, f = a.colors; d < f.length; d++) {
      var p = f[d], g = Ae.toRgb(p), m = g[0], v = g[1], h = g[2];
      if (l[c++] !== m || l[c++] !== v || l[c++] !== h) {
        s = !1;
        break;
      }
    }
    if (!s) {
      for (var y = new Uint8Array(3 * a.colors.length), x = 0, S = 0, b = a.colors; S < b.length; S++) {
        p = b[S];
        var _ = Ae.toRgb(p);
        m = _[0], v = _[1], h = _[2], y[x++] = m, y[x++] = v, y[x++] = h;
      }
      R.update(o, { array: y, height: 1, width: a.colors.length, filter: a.filter });
    }
  }(n.palette, i.tPalette)) : R.updateIfChanged(i.dUsePalette, !1), i;
}
function tp(e, t, n) {
  return n ? (R.update(n.tColor, e), R.update(n.uColorTexDim, xe.create(e.width, e.height)), R.updateIfChanged(n.dColorType, t), n) : { uColor: R.create(A()), tColor: R.create(e), tColorGrid: R.create(Ha()), tPalette: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), uColorTexDim: R.create(xe.create(e.width, e.height)), uColorGridDim: R.create(A.create(1, 1, 1)), uColorGridTransform: R.create(Nt.create(0, 0, 0, 1)), dColorType: R.create(t), dUsePalette: R.create(!1) };
}
function JC(e, t, n) {
  var r = e.colors, i = e.dimension, a = e.transform, o = r.getWidth(), s = r.getHeight();
  return n ? (R.update(n.tColorGrid, r), R.update(n.uColorTexDim, xe.create(o, s)), R.update(n.uColorGridDim, A.clone(i)), R.update(n.uColorGridTransform, Nt.clone(a)), R.updateIfChanged(n.dColorType, t), n) : { uColor: R.create(A()), tColor: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), tColorGrid: R.create(r), tPalette: R.create({ array: new Uint8Array(3), width: 1, height: 1 }), uColorTexDim: R.create(xe.create(o, s)), uColorGridDim: R.create(A.clone(i)), uColorGridTransform: R.create(Nt.clone(a)), dColorType: R.create(t), dUsePalette: R.create(!1) };
}
var $C = pi(), uK = ne();
function K6(e, t, n) {
  var r = function(u, l) {
    for (var c = 0; c < l; c++) if (pi.fromMat4($C, ne.fromArray(uK, u, 16 * c)), pi.determinant($C) < 0) return !0;
    return !1;
  }(e, t);
  if (n) {
    R.update(n.matrix, n.matrix.ref.value);
    var i = n.transform.ref.value.length >= 16 * t ? n.transform.ref.value : new Float32Array(16 * t);
    i.set(e), R.update(n.transform, i), R.updateIfChanged(n.uInstanceCount, t), R.updateIfChanged(n.instanceCount, t);
    var a = n.aTransform.ref.value.length >= 16 * t ? n.aTransform.ref.value : new Float32Array(16 * t);
    R.update(n.aTransform, a);
    var o = n.extraTransform.ref.value.length >= 16 * t ? n.extraTransform.ref.value : new Float32Array(16 * t);
    R.update(n.extraTransform, B5(o, t));
    var s = n.aInstance.ref.value.length >= t ? n.aInstance.ref.value : new Float32Array(t);
    R.update(n.aInstance, Tu(s, t)), R.update(n.hasReflection, r);
  } else n = { aTransform: R.create(new Float32Array(16 * t)), matrix: R.create(ne.identity()), transform: R.create(new Float32Array(e)), extraTransform: R.create(B5(new Float32Array(16 * t), t)), uInstanceCount: R.create(t), instanceCount: R.create(t), aInstance: R.create(Tu(new Float32Array(t))), hasReflection: R.create(r) };
  return vD(n), n;
}
var Y6 = new Float32Array(16);
function W6(e) {
  return K6(new Float32Array(Y6), 1, e);
}
function B5(e, t) {
  for (var n = 0; n < t; n++) e.set(Y6, 16 * n);
  return e;
}
function vD(e) {
  for (var t = e.aTransform.ref.value, n = e.instanceCount.ref.value, r = e.matrix.ref.value, i = e.transform.ref.value, a = e.extraTransform.ref.value, o = 0; o < n; o++) {
    var s = 16 * o;
    ne.mulOffset(t, a, i, s, s, s), ne.mulOffset(t, r, t, s, 0, s);
  }
  R.update(e.aTransform, t);
}
ne.toArray(ne.identity(), Y6, 0);
var qt = { 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, cornflower: 6591981, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, laserlemon: 16777044, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrod: 16448210, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, maroon2: 8323072, maroon3: 11546720, 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, purple2: 8323199, purple3: 10494192, 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 };
function im(e) {
  return O(O({}, im.Zero), e);
}
function r0() {
}
(function() {
  var e = /* @__PURE__ */ new Map();
  Object.keys(qt).forEach(function(t) {
    e.set(qt[t], t);
  });
})(), function(e) {
  e.Zero = { metalness: 0, roughness: 0, bumpiness: 0 }, e.toArray = function(t, n, r) {
    return n[r] = 255 * t.metalness, n[r + 1] = 255 * t.roughness, n[r + 2] = 255 * t.bumpiness, n;
  }, e.toString = function(t) {
    var n = t.metalness, r = t.roughness, i = t.bumpiness;
    return "M ".concat(n.toFixed(2), " | R ").concat(r.toFixed(2), " | B ").concat(i.toFixed(2));
  }, e.getParam = function(t) {
    return N.Group({ metalness: N.Numeric(0, { min: 0, max: 1, step: 0.01 }), roughness: N.Numeric(1, { min: 0, max: 1, step: 0.01 }), bumpiness: N.Numeric(0, { min: 0, max: 1, step: 0.01 }) }, O(O({}, t), { presets: [[{ metalness: 0, roughness: 1, bumpiness: 0 }, "Matte"], [{ metalness: 0, roughness: 0.2, bumpiness: 0 }, "Plastic"], [{ metalness: 0, roughness: 0.6, bumpiness: 0 }, "Glossy"], [{ metalness: 1, roughness: 0.6, bumpiness: 0 }, "Metallic"]] }));
  };
}(im || (im = {})), function(e) {
  e.Type = { none: 0, plane: 1, sphere: 2, cube: 3, cylinder: 4, infiniteCone: 5 }, e.Params = { variant: N.Select("pixel", N.arrayToOptions(["instance", "pixel"])), objects: N.ObjectList({ type: N.Select("plane", N.objectToOptions(e.Type, function(a) {
    return Su(a);
  })), invert: N.Boolean(!1), position: N.Vec3(A()), rotation: N.Group({ axis: N.Vec3(A.create(1, 0, 0)), angle: N.Numeric(0, { min: -180, max: 180, step: 1 }, { description: "Angle in Degrees" }) }, { isExpanded: !0 }), scale: N.Vec3(A.create(1, 1, 1)) }, function(a) {
    return Su(a.type);
  }) };
  var t = yr(), n = yr(), r = A(), i = A();
  e.getClip = function(a, o) {
    for (var s = (o == null ? void 0 : o.objects) || { count: 0, type: new Array(5).fill(1), invert: new Array(5).fill(!1), position: new Array(15).fill(0), rotation: new Array(20).fill(0), scale: new Array(15).fill(1) }, u = s.type, l = s.invert, c = s.position, d = s.rotation, f = s.scale, p = 0, g = a.objects.length; p < g; ++p) {
      var m = a.objects[p];
      u[p] = e.Type[m.type], l[p] = m.invert, A.toArray(m.position, c, 3 * p), yr.toArray(yr.setAxisAngle(t, m.rotation.axis, xr(m.rotation.angle)), d, 4 * p), A.toArray(m.scale, f, 3 * p);
    }
    return { variant: a.variant, objects: { count: a.objects.length, type: u, invert: l, position: c, rotation: d, scale: f } };
  }, e.areEqual = function(a, o) {
    if (a.variant !== o.variant || a.objects.count !== o.objects.count) return !1;
    for (var s = a.objects, u = o.objects, l = 0, c = s.count; l < c; ++l)
      if (s.invert[l] !== u.invert[l] || s.type[l] !== u.type[l] || (A.fromArray(r, s.position, 3 * l), A.fromArray(i, u.position, 3 * l), !A.equals(r, i)) || (A.fromArray(r, s.scale, 3 * l), A.fromArray(i, u.scale, 3 * l), !A.equals(r, i)) || (yr.fromArray(t, s.rotation, 4 * l), yr.fromArray(n, u.rotation, 4 * l), !yr.equals(t, n))) return !1;
    return !0;
  };
}(r0 || (r0 = {}));
var Qe, lK = Object.keys({ custom: {}, auto: {}, highest: {}, higher: {}, high: {}, medium: {}, low: {}, lower: {}, lowest: {} }), cK = N.arrayToOptions(lK), dK = { smoothColors: N.MappedStatic("auto", { auto: N.Group({}), on: N.Group({ resolutionFactor: N.Numeric(2, { min: 0.5, max: 6, step: 0.1 }), sampleStride: N.Numeric(3, { min: 1, max: 12, step: 1 }) }), off: N.Group({}) }) };
function Ky(e) {
  return !!e.smoothColors;
}
function jd(e, t, n) {
  if ((e.name === "on" || e.name === "auto" && t) && n && n < 3) {
    var r = 3;
    return e.name === "on" ? (n *= e.params.resolutionFactor, r = e.params.sampleStride) : (n *= 2 - bT(0, 1.1, n), (n = Math.max(0.5, n)) > 1.2 && (r = 2)), { resolution: n, stride: r };
  }
}
function eS(e, t, n) {
  return e.fill(0, 4 * t, 4 * n), !0;
}
(function(e) {
  e.MaterialCategory = { category: "Material" }, e.ShadingCategory = { category: "Shading" }, e.CustomQualityParamInfo = { category: "Custom Quality", hideIf: function(t) {
    return t.quality !== void 0 && t.quality !== "custom";
  } }, e.Params = { alpha: N.Numeric(1, { min: 0, max: 1, step: 0.01 }, { label: "Opacity", isEssential: !0, description: "How opaque/transparent the representation is rendered." }), quality: N.Select("auto", cK, { isEssential: !0, description: "Visual/rendering quality of the representation." }), material: im.getParam(), clip: N.Group(r0.Params) }, e.createSimple = function(t, n, r) {
    return t === void 0 && (t = qt.grey), n === void 0 && (n = 1), r || (r = W6()), { transform: r, locationIterator: zr(1, r.instanceCount.ref.value, 1, function() {
      return ku;
    }, !1, function() {
      return !1;
    }), theme: { color: sh(0, { value: t }), size: j6(0, { value: n }) } };
  }, e.createValues = function(t, n) {
    var r = r0.getClip(t.clip);
    return { alpha: R.create(t.alpha), uAlpha: R.create(t.alpha), uVertexCount: R.create(n.vertexCount), uGroupCount: R.create(n.groupCount), drawCount: R.create(n.drawCount), uMetalness: R.create(t.material.metalness), uRoughness: R.create(t.material.roughness), uBumpiness: R.create(t.material.bumpiness), dLightCount: R.create(1), dClipObjectCount: R.create(r.objects.count), dClipVariant: R.create(r.variant), uClipObjectType: R.create(r.objects.type), uClipObjectInvert: R.create(r.objects.invert), uClipObjectPosition: R.create(r.objects.position), uClipObjectRotation: R.create(r.objects.rotation), uClipObjectScale: R.create(r.objects.scale) };
  }, e.updateValues = function(t, n) {
    R.updateIfChanged(t.alpha, n.alpha), R.updateIfChanged(t.uMetalness, n.material.metalness), R.updateIfChanged(t.uRoughness, n.material.roughness), R.updateIfChanged(t.uBumpiness, n.material.bumpiness);
    var r = r0.getClip(n.clip);
    R.update(t.dClipObjectCount, r.objects.count), R.update(t.dClipVariant, r.variant), R.update(t.uClipObjectType, r.objects.type), R.update(t.uClipObjectInvert, r.objects.invert), R.update(t.uClipObjectPosition, r.objects.position), R.update(t.uClipObjectRotation, r.objects.rotation), R.update(t.uClipObjectScale, r.objects.scale);
  }, e.createRenderableState = function(t) {
    t === void 0 && (t = {});
    var n = t.alpha === void 0 || t.alpha === 1;
    return { disposed: !1, visible: !0, alphaFactor: 1, pickable: !0, colorOnly: !1, opaque: n, writeDepth: n };
  }, e.updateRenderableState = function(t, n) {
    t.opaque = n.alpha * t.alphaFactor >= 1, t.writeDepth = t.opaque;
  };
})(Qe || (Qe = {}));
var fK = { array: new Uint8Array(4), width: 1, height: 1 };
function Al(e) {
  return { tOverpaint: R.create(fK), uOverpaintTexDim: R.create(xe.create(1, 1)), dOverpaint: R.create(!1), tOverpaintGrid: R.create(Ha()), uOverpaintGridDim: R.create(A.create(1, 1, 1)), uOverpaintGridTransform: R.create(Nt.create(0, 0, 0, 1)), dOverpaintType: R.create("groupInstance") };
}
function tS(e, t) {
  for (var n = 0, r = 0; r < t; ++r) n += e[r];
  return n / (255 * t);
}
var mK = { array: new Uint8Array(1), width: 1, height: 1 };
function wl(e) {
  return { tTransparency: R.create(mK), uTransparencyTexDim: R.create(xe.create(1, 1)), dTransparency: R.create(!1), transparencyAverage: R.create(0), tTransparencyGrid: R.create(Ha()), uTransparencyGridDim: R.create(A.create(1, 1, 1)), uTransparencyGridTransform: R.create(Nt.create(0, 0, 0, 1)), dTransparencyType: R.create("groupInstance") };
}
var pK = { array: new Uint8Array(1), width: 1, height: 1 };
function Il(e) {
  return { tClipping: R.create(pK), uClippingTexDim: R.create(xe.create(1, 1)), dClipping: R.create(!1) };
}
function nS(e, t, n) {
  return e.fill(0, 4 * t, 4 * n), !0;
}
var Lt, hK = { array: new Uint8Array(4), width: 1, height: 1 };
function Pl(e) {
  return { tSubstance: R.create(hK), uSubstanceTexDim: R.create(xe.create(1, 1)), dSubstance: R.create(!1), tSubstanceGrid: R.create(Ha()), uSubstanceGridDim: R.create(A.create(1, 1, 1)), uSubstanceGridTransform: R.create(Nt.create(0, 0, 0, 1)), dSubstanceType: R.create("groupInstance") };
}
function Yy(e, t, n) {
  return e = Ia(Math.round(e), 0, 16777215) + 1, t[n + 2] = e % 256, e = Math.floor(e / 256), t[n + 1] = e % 256, e = Math.floor(e / 256), t[n] = e % 256, t;
}
function X6(e, t, n) {
  return 256 * Math.floor(e) * 256 + 256 * Math.floor(t) + Math.floor(n) - 1;
}
(function(e) {
  function t(p, g, m, v, h, y, x) {
    return x ? function(S, b, _, C, w, I, M) {
      return M.vertexCount = w, M.triangleCount = I, R.update(M.vertexBuffer, S), R.update(M.indexBuffer, b), R.update(M.normalBuffer, _), R.update(M.groupBuffer, C), M;
    }(p, g, m, v, h, y, x) : function(S, b, _, C, w, I) {
      var M, E = pe(), T = -1, P = -1, k = { kind: "mesh", vertexCount: w, triangleCount: I, vertexBuffer: R.create(S), indexBuffer: R.create(b), normalBuffer: R.create(_), groupBuffer: R.create(C), get boundingSphere() {
        var D = r(k);
        if (D !== T) {
          var B = od(k.vertexBuffer.ref.value, k.vertexCount, 1);
          pe.copy(E, B), T = D;
        }
        return E;
      }, get groupMapping() {
        return k.groupBuffer.ref.version !== P && (M = Vm(k.groupBuffer.ref.value, k.vertexCount), P = k.groupBuffer.ref.version), M;
      }, setBoundingSphere: function(D) {
        pe.copy(E, D), T = r(k);
      }, meta: {} };
      return k;
    }(p, g, m, v, h, y);
  }
  function n(p) {
    return t(p ? p.vertexBuffer.ref.value : new Float32Array(0), p ? p.indexBuffer.ref.value : new Uint32Array(0), p ? p.normalBuffer.ref.value : new Float32Array(0), p ? p.groupBuffer.ref.value : new Float32Array(0), 0, 0, p);
  }
  function r(p) {
    return pa([p.vertexCount, p.triangleCount, p.vertexBuffer.ref.version, p.indexBuffer.ref.version, p.normalBuffer.ref.version, p.groupBuffer.ref.version]);
  }
  e.create = t, e.createEmpty = n, e.computeNormals = function(p) {
    var g = p.vertexCount, m = p.triangleCount, v = p.vertexBuffer.ref.value, h = p.indexBuffer.ref.value, y = p.normalBuffer.ref.value.length >= 3 * g ? p.normalBuffer.ref.value : new Float32Array(3 * g);
    y === p.normalBuffer.ref.value && y.fill(0, 0, 3 * g), pD(v, h, y, g, m), R.update(p.normalBuffer, y);
  }, e.checkForDuplicateVertices = function(p, g) {
    g === void 0 && (g = 3);
    for (var m = p.vertexBuffer.ref.value, v = /* @__PURE__ */ new Map(), h = function(w, I) {
      return "".concat(w[0].toFixed(I), "|").concat(w[1].toFixed(I), "|").concat(w[2].toFixed(I));
    }, y = 0, x = A(), S = 0, b = p.vertexCount; S < b; ++S) {
      A.fromArray(x, m, 3 * S);
      var _ = h(x, g), C = v.get(_);
      C !== void 0 ? (y += 1, v.set(_, C + 1)) : v.set(_, 1);
    }
    return y;
  };
  var i = pi();
  function a(p) {
    for (var g = p.vertexCount, m = p.triangleCount, v = p.indexBuffer.ref.value, h = [], y = 0; y < g; ++y) h[y] = [];
    for (y = 0; y < m; ++y) {
      var x = v[3 * y], S = v[3 * y + 1], b = v[3 * y + 2];
      Qo(h[x], S), Qo(h[x], b), Qo(h[S], x), Qo(h[S], b), Qo(h[b], x), Qo(h[b], S);
    }
    return h;
  }
  function o(p) {
    for (var g = p.triangleCount, m = p.indexBuffer.ref.value, v = /* @__PURE__ */ new Map(), h = function(_, C) {
      var w = Gg(_, C), I = v.get(w) || 0;
      v.set(w, I + 1);
    }, y = 0; y < g; ++y) {
      var x = m[3 * y], S = m[3 * y + 1], b = m[3 * y + 2];
      h(x, S), h(x, b), h(S, b);
    }
    return v;
  }
  function s(p) {
    var g = /* @__PURE__ */ new Set(), m = [0, 0];
    return p.forEach(function(v, h) {
      v === 1 && (function(y, x) {
        var S = Math.floor((Math.sqrt(8 * x + 1) - 1) / 2), b = x - (S * S + S) / 2;
        y[0] = S - b, y[1] = b;
      }(m, h), g.add(m[0]), g.add(m[1]));
    }), g;
  }
  function u(p, g, m) {
    var v = /* @__PURE__ */ new Map(), h = function(y, x) {
      v.has(y) ? Qo(v.get(y), x) : v.set(y, [x]);
    };
    return g.forEach(function(y) {
      for (var x = 0, S = p[y]; x < S.length; x++) {
        var b = S[x];
        g.has(b) && m.get(Gg(y, b)) === 1 && h(y, b);
      }
    }), v;
  }
  function l(p, g, m, v) {
    for (var h, y = p.vertexBuffer, x = p.indexBuffer, S = p.normalBuffer, b = p.triangleCount, _ = y.ref.value, C = x.ref.value, w = S.ref.value, I = be.create(Uint32Array, 3, 1024, b), M = 0, E = 0; E < b; ++E) be.add3(I, C[3 * E], C[3 * E + 1], C[3 * E + 2]), M += 1;
    var T = A(), P = A(), k = A(), D = A(), B = A(), L = A(), F = A(), V = A(), G = A(), H = A(), q = xr(120), z = /* @__PURE__ */ new Set(), K = Array.from(m.keys()).filter(function(Ne) {
      return m.get(Ne).length < 2;
    }).map(function(Ne) {
      var Ue = m.get(Ne);
      return A.fromArray(T, _, 3 * Ne), A.fromArray(P, _, 3 * Ue[0]), A.fromArray(k, _, 3 * Ue[1]), A.sub(B, P, T), A.sub(L, k, T), [Ne, A.angle(B, L)];
    });
    K.sort(function(Ne, Ue) {
      return Ne[1] - Ue[1];
    });
    for (var Y = 0, Z = K; Y < Z.length; Y++) {
      var X = Z[Y], W = X[0], J = X[1];
      if (!(z.has(W) || J > q)) {
        var $ = m.get(W);
        if ((!g[$[0]].includes($[1]) || !((h = m.get($[0])) === null || h === void 0) && h.includes($[1])) && (A.fromArray(T, _, 3 * W), A.fromArray(P, _, 3 * $[0]), A.fromArray(k, _, 3 * $[1]), A.sub(B, P, T), A.sub(L, k, T), A.add(V, B, L), !(A.squaredDistance(T, P) >= v))) {
          for (var ee = !1, ce = 0, ae = g[W]; ce < ae.length; ce++) {
            var he = ae[ce];
            if (!$.includes(he) && (A.fromArray(D, _, 3 * he), A.sub(F, D, T), A.dot(V, F) < 0)) {
              ee = !0;
              break;
            }
          }
          ee && (A.fromArray(G, w, 3 * W), A.triangleNormal(H, T, P, k), A.dot(H, G) > 0 ? be.add3(I, W, $[0], $[1]) : be.add3(I, $[1], $[0], W), z.add(W), z.add($[0]), z.add($[1]), M += 1);
        }
      }
    }
    var Oe = be.compact(I);
    return p.triangleCount = M, R.update(x, Oe), p;
  }
  function c(p, g) {
    var m = p.vertexCount, v = g.instanceCount.ref.value, h = Af(), y = h.position, x = p.vertexBuffer.ref.value, S = g.aTransform.ref.value;
    return zr(m, v, 1, function(b, _) {
      return _ < 0 ? A.fromArray(y, x, 3 * b) : A.transformMat4Offset(y, x, S, 0, 3 * b, 16 * _), h;
    });
  }
  function d(p, g, m, v, h) {
    var y = m.instanceCount, x = m.groupCount, S = bo(m, c(p, g), v.color), b = ss(y * x), _ = Al(), C = wl(), w = Pl(), I = Il(), M = { drawCount: 3 * p.triangleCount, vertexCount: p.vertexCount, groupCount: x, instanceCount: y }, E = pe.clone(p.boundingSphere), T = Si(E, g.aTransform.ref.value, y);
    return O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("mesh"), aPosition: p.vertexBuffer, aNormal: p.normalBuffer, aGroup: p.groupBuffer, elements: p.indexBuffer, boundingSphere: R.create(T), invariantBoundingSphere: R.create(E), uInvariantBoundingSphere: R.create(Nt.ofSphere(E)) }, S), b), _), C), w), I), g), Qe.createValues(h, M)), { uDoubleSided: R.create(h.doubleSided), dFlatShaded: R.create(h.flatShaded), dFlipSided: R.create(h.flipSided), dIgnoreLight: R.create(h.ignoreLight), dXrayShaded: R.create(h.xrayShaded), uBumpFrequency: R.create(h.bumpFrequency), uBumpAmplitude: R.create(h.bumpAmplitude), meta: R.create(p.meta) });
  }
  function f(p, g) {
    Qe.updateRenderableState(p, g), p.opaque = p.opaque && !g.xrayShaded, p.writeDepth = p.opaque;
  }
  e.transform = function(p, g) {
    var m = p.vertexBuffer.ref.value;
    rm(g, m, 0, p.vertexCount), ne.isTranslationAndUniformScaling(g) || function(v, h, y, x) {
      for (var S = 0, b = 3 * x; S < b; S += 3) A.fromArray(Ua, h, y + S), A.transformMat3(Ua, Ua, v), A.toArray(Ua, h, y + S);
    }(pi.directionTransform(i, g), p.normalBuffer.ref.value, 0, p.vertexCount), R.update(p.vertexBuffer, m);
  }, e.getOriginalData = function(p) {
    return ("kind" in p ? p.meta : p.meta.ref.value).originalData;
  }, e.uniformTriangleGroup = function(p, g) {
    g === void 0 && (g = !0);
    var m = p.indexBuffer, v = p.vertexBuffer, h = p.groupBuffer, y = p.normalBuffer, x = p.triangleCount, S = p.vertexCount, b = m.ref.value, _ = v.ref.value, C = h.ref.value, w = y.ref.value, I = be.create(Uint32Array, 3, 1024, x), M = be.create(Float32Array, 3, 1024, _);
    M.currentIndex = 3 * S, M.elementCount = S;
    var E = be.create(Float32Array, 3, 1024, w);
    E.currentIndex = 3 * S, E.elementCount = S;
    var T = be.create(Float32Array, 1, 1024, C);
    T.currentIndex = S, T.elementCount = S;
    var P = A(), k = A(), D = A(), B = A(), L = A(), F = A();
    function V(Se) {
      A.fromArray(P, _, 3 * Se), A.fromArray(B, w, 3 * Se), be.add3(M, P[0], P[1], P[2]), be.add3(E, B[0], B[1], B[2]);
    }
    function G(Se, qe) {
      A.fromArray(P, _, 3 * Se), A.fromArray(k, _, 3 * qe), A.scale(P, A.add(P, P, k), 0.5), A.fromArray(B, w, 3 * Se), A.fromArray(L, w, 3 * qe), A.scale(B, A.add(B, B, L), 0.5), be.add3(M, P[0], P[1], P[2]), be.add3(E, B[0], B[1], B[2]);
    }
    function H(Se, qe, Pe) {
      A.fromArray(P, _, 3 * Se), A.fromArray(k, _, 3 * qe), A.fromArray(D, _, 3 * Pe), A.scale(P, A.add(P, A.add(P, P, k), D), 1 / 3), A.fromArray(B, w, 3 * Se), A.fromArray(L, w, 3 * qe), A.fromArray(F, w, 3 * Pe), A.scale(B, A.add(B, A.add(B, B, L), F), 1 / 3), be.add3(M, P[0], P[1], P[2]), be.add3(E, B[0], B[1], B[2]);
    }
    function q(Se, qe, Pe, Xe, Ke) {
      ++K, V(Se), G(Se, qe), G(Se, Pe), be.add3(I, z, z + 1, z + 2);
      for (var de = 0; de < 3; ++de) be.add(T, Xe);
      for (z += 3, K += 2, V(qe), V(Pe), G(Se, qe), G(Se, Pe), be.add3(I, z, z + 1, z + 3), be.add3(I, z, z + 3, z + 2), de = 0; de < 4; ++de) be.add(T, Ke);
      z += 4;
    }
    var z = S, K = 0;
    if (g) for (var Y = 0, Z = x; Y < Z; ++Y) {
      var X = b[3 * Y], W = b[3 * Y + 1], J = b[3 * Y + 2], $ = C[X], ee = C[W], ce = C[J];
      if ($ === ee && $ === ce) ++K, be.add3(I, X, W, J);
      else if ($ === ee) q(J, X, W, ce, $);
      else if ($ === ce) q(W, J, X, ee, ce);
      else if (ee === ce) q(X, W, J, $, ee);
      else {
        K += 2, V(X), G(X, W), G(X, J), H(X, W, J), be.add3(I, z, z + 1, z + 3), be.add3(I, z, z + 3, z + 2);
        for (var ae = 0; ae < 4; ++ae) be.add(T, $);
        for (z += 4, K += 2, V(W), G(W, J), G(W, X), H(X, W, J), be.add3(I, z, z + 1, z + 3), be.add3(I, z, z + 3, z + 2), ae = 0; ae < 4; ++ae) be.add(T, ee);
        for (z += 4, K += 2, V(J), G(J, W), G(J, X), H(X, W, J), be.add3(I, z + 3, z + 1, z), be.add3(I, z + 2, z + 3, z), ae = 0; ae < 4; ++ae) be.add(T, ce);
        z += 4;
      }
    }
    else for (Y = 0, Z = x; Y < Z; ++Y)
      if (X = b[3 * Y], W = b[3 * Y + 1], J = b[3 * Y + 2], $ = C[X], ee = C[W], ce = C[J], $ !== ee || $ !== ce) {
        ++K, V(X), V(W), V(J), be.add3(I, z, z + 1, z + 2);
        var he = ee === ce ? ee : $;
        for (ae = 0; ae < 3; ++ae) be.add(T, he);
        z += 3;
      } else ++K, be.add3(I, X, W, J);
    var Oe = be.compact(I), Ne = be.compact(M), Ue = be.compact(E), Ze = be.compact(T);
    return p.vertexCount = z, p.triangleCount = K, R.update(v, Ne), R.update(h, Ze), R.update(m, Oe), R.update(y, Ue), p.meta.originalData = { indexBuffer: b, vertexCount: S, triangleCount: x }, p;
  }, e.smoothEdges = function(p, g) {
    (function(S, b) {
      for (var _ = S.indexBuffer, C = S.triangleCount, w = _.ref.value, I = be.create(Uint32Array, 3, 1024, C), M = 0, E = 0; E < C; ++E) {
        var T = w[3 * E], P = w[3 * E + 1], k = w[3 * E + 2];
        b[T].length !== 2 && b[P].length !== 2 && b[k].length !== 2 && (be.add3(I, T, P, k), M += 1);
      }
      var D = be.compact(I);
      S.triangleCount = M, R.update(_, D);
    })(p, a(p));
    for (var m = 0; m < 10; ++m) {
      var v = p.triangleCount, h = o(p), y = a(p);
      if (l(p, y, u(y, s(h), h), g.maxNewEdgeLength * g.maxNewEdgeLength), p.triangleCount === v) break;
    }
    var x = o(p);
    return function(S, b, _) {
      for (var C = _.iterations, w = _.lambda, I = A(), M = A(), E = A(), T = A(), P = -w, k = new Float32Array(S.vertexBuffer.ref.value.length), D = function(L) {
        var F = S.vertexBuffer.ref.value;
        k.set(F), b.forEach(function(G, H) {
          if (G.length === 2) {
            A.fromArray(I, F, 3 * H), A.fromArray(M, F, 3 * G[0]), A.fromArray(E, F, 3 * G[1]);
            var q = 1 / A.distance(I, M), z = 1 / A.distance(I, E);
            A.scale(M, M, q), A.scale(E, E, z), A.add(T, M, E), A.scale(T, T, 1 / (q + z)), A.sub(T, T, I), A.scale(T, T, L), A.add(T, I, T), A.toArray(T, k, 3 * H);
          }
        });
        var V = S.vertexBuffer.ref.value;
        R.update(S.vertexBuffer, k), k = V;
      }, B = 0; B < C; ++B) D(w), D(P);
    }(p, u(a(p), s(x), x), { iterations: g.iterations, lambda: 0.5 }), p;
  }, e.Params = O(O({}, Qe.Params), { doubleSided: N.Boolean(!1, Qe.CustomQualityParamInfo), flipSided: N.Boolean(!1, Qe.ShadingCategory), flatShaded: N.Boolean(!1, Qe.ShadingCategory), ignoreLight: N.Boolean(!1, Qe.ShadingCategory), xrayShaded: N.Boolean(!1, Qe.ShadingCategory), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), bumpAmplitude: N.Numeric(1, { min: 0, max: 5, step: 0.1 }, Qe.ShadingCategory) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: d, createValuesSimple: function(p, g, m, v, h) {
    var y = Qe.createSimple(m, v, h), x = O(O({}, N.getDefaultValues(e.Params)), g);
    return d(p, y.transform, y.locationIterator, y.theme, x);
  }, updateValues: function(p, g) {
    Qe.updateValues(p, g), R.updateIfChanged(p.uDoubleSided, g.doubleSided), R.updateIfChanged(p.dFlatShaded, g.flatShaded), R.updateIfChanged(p.dFlipSided, g.flipSided), R.updateIfChanged(p.dIgnoreLight, g.ignoreLight), R.updateIfChanged(p.dXrayShaded, g.xrayShaded), R.updateIfChanged(p.uBumpFrequency, g.bumpFrequency), R.updateIfChanged(p.uBumpAmplitude, g.bumpAmplitude);
  }, updateBoundingSphere: function(p, g) {
    var m = pe.clone(g.boundingSphere), v = Si(m, p.aTransform.ref.value, p.instanceCount.ref.value);
    pe.equals(v, p.boundingSphere.ref.value) || R.update(p.boundingSphere, v), pe.equals(m, p.invariantBoundingSphere.ref.value) || (R.update(p.invariantBoundingSphere, m), R.update(p.uInvariantBoundingSphere, Nt.fromSphere(p.uInvariantBoundingSphere.ref.value, m)));
  }, createRenderableState: function(p) {
    var g = Qe.createRenderableState(p);
    return f(g, p), g;
  }, updateRenderableState: f, createPositionIterator: c };
})(Lt || (Lt = {}));
var Wy = 255 / 256, Xy = A.create(16777216, 65536, 256), gK = Nt.create(Wy / Xy[0], Wy / Xy[1], Wy / Xy[2], 0.99609375), rS = Nt();
function Hl(e, t, n) {
  switch (Ui.getGranularity(e, t.granularity)) {
    case "uniform":
      return function(r, i, a) {
        return function(o, s) {
          return s ? (R.update(s.uSize, o), R.updateIfChanged(s.dSizeType, "uniform"), s) : O(O({ uSize: R.create(o) }, { tSize: R.create(vK), uSizeTexDim: R.create(xe.create(1, 1)) }), { dSizeType: R.create("uniform") });
        }(i(ku), a);
      }(0, t.size, n);
    case "group":
      return function(r, i, a) {
        var o = r.groupCount, s = ci(Math.max(1, o), 3, Uint8Array, a && a.tSize.ref.value.array);
        for (r.reset(); r.hasNext && !r.isNextNewInstance; ) {
          var u = r.move();
          Yy(i(u.location) * bg, s.array, 3 * u.groupIndex);
        }
        return Zy(s, "group", a);
      }(e, t.size, n);
    case "groupInstance":
      return function(r, i, a) {
        var o = r.groupCount, s = r.instanceCount, u = s * o, l = ci(Math.max(1, u), 3, Uint8Array, a && a.tSize.ref.value.array);
        for (r.reset(); r.hasNext; ) {
          var c = r.move();
          Yy(i(c.location) * bg, l.array, 3 * c.index);
        }
        return Zy(l, "groupInstance", a);
      }(e, t.size, n);
    case "instance":
      return function(r, i, a) {
        var o = r.instanceCount, s = ci(Math.max(1, o), 3, Uint8Array, a && a.tSize.ref.value.array);
        for (r.reset(); r.hasNext && !r.isNextNewInstance; ) {
          var u = r.move();
          Yy(i(u.location) * bg, s.array, 3 * u.instanceIndex), r.skipInstance();
        }
        return Zy(s, "instance", a);
      }(e, t.size, n);
  }
}
var bg = 100;
function E0(e) {
  switch (e.dSizeType.ref.value) {
    case "uniform":
      return e.uSize.ref.value;
    case "instance":
    case "group":
    case "groupInstance":
      for (var t = 0, n = e.tSize.ref.value.array, r = 0, i = n.length; r < i; r += 3) {
        var a = X6(n[r], n[r + 1], n[r + 2]);
        t < a && (t = a);
      }
      return t / bg;
  }
}
var wf, vK = { array: new Uint8Array(3), width: 1, height: 1 };
function Zy(e, t, n) {
  return n ? (R.update(n.tSize, e), R.update(n.uSizeTexDim, xe.create(e.width, e.height)), R.updateIfChanged(n.dSizeType, t), n) : { uSize: R.create(0), tSize: R.create(e), uSizeTexDim: R.create(xe.create(e.width, e.height)), dSizeType: R.create(t) };
}
function iS(e, t, n, r, i, a, o) {
  for (var s = 0; s < t; s++) {
    for (var u = 0; u < n; u++) r[u] = e[u * t + s];
    for (aS(r, i, a, o, n), u = 0; u < n; u++) e[u * t + s] = i[u];
  }
  for (u = 0; u < n; u++) {
    for (s = 0; s < t; s++) r[s] = e[u * t + s];
    for (aS(r, i, a, o, t), s = 0; s < t; s++) e[u * t + s] = Math.sqrt(i[s]);
  }
}
function aS(e, t, n, r, i) {
  n[0] = 0, r[0] = Number.MIN_SAFE_INTEGER, r[1] = Number.MAX_SAFE_INTEGER;
  for (var a = 1, o = 0; a < i; a++) {
    for (var s = (e[a] + a * a - (e[n[o]] + n[o] * n[o])) / (2 * a - 2 * n[o]); s <= r[o]; ) o--, s = (e[a] + a * a - (e[n[o]] + n[o] * n[o])) / (2 * a - 2 * n[o]);
    n[++o] = a, r[o] = s, r[o + 1] = Number.MAX_SAFE_INTEGER;
  }
  for (a = 0, o = 0; a < i; a++) {
    for (; r[o + 1] < a; ) o++;
    t[a] = (a - n[o]) * (a - n[o]) + e[n[o]];
  }
}
(function(e) {
  function t(s, u, l, c) {
    return c ? function(d, f, p, g) {
      return g.pointCount = p, R.update(g.centerBuffer, d), R.update(g.groupBuffer, f), g;
    }(s, u, l, c) : function(d, f, p) {
      var g, m = pe(), v = -1, h = -1, y = { kind: "points", pointCount: p, centerBuffer: R.create(d), groupBuffer: R.create(f), get boundingSphere() {
        var x = r(y);
        if (x !== v) {
          var S = od(y.centerBuffer.ref.value, y.pointCount, 1);
          pe.copy(m, S), v = x;
        }
        return m;
      }, get groupMapping() {
        return y.groupBuffer.ref.version !== h && (g = Vm(y.groupBuffer.ref.value, y.pointCount), h = y.groupBuffer.ref.version), g;
      }, setBoundingSphere: function(x) {
        pe.copy(m, x), v = r(y);
      } };
      return y;
    }(s, u, l);
  }
  function n(s) {
    return t(s ? s.centerBuffer.ref.value : new Float32Array(0), s ? s.groupBuffer.ref.value : new Float32Array(0), 0, s);
  }
  function r(s) {
    return pa([s.pointCount, s.centerBuffer.ref.version, s.groupBuffer.ref.version]);
  }
  function i(s, u) {
    var l = s.pointCount, c = u.instanceCount.ref.value, d = Af(), f = d.position, p = s.centerBuffer.ref.value, g = u.aTransform.ref.value;
    return zr(l, c, 1, function(m, v) {
      return v < 0 ? A.fromArray(f, p, 3 * m) : A.transformMat4Offset(f, p, g, 0, 3 * m, 16 * v), d;
    });
  }
  function a(s, u, l, c, d) {
    var f = l.instanceCount, p = l.groupCount, g = bo(l, i(s, u), c.color), m = Hl(l, c.size), v = ss(f * p), h = Al(), y = wl(), x = Pl(), S = Il(), b = { drawCount: s.pointCount, vertexCount: s.pointCount, groupCount: p, instanceCount: f }, _ = pe.clone(s.boundingSphere), C = Si(_, u.aTransform.ref.value, f);
    return O(O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("points"), aPosition: s.centerBuffer, aGroup: s.groupBuffer, boundingSphere: R.create(C), invariantBoundingSphere: R.create(_), uInvariantBoundingSphere: R.create(Nt.ofSphere(_)) }, g), m), v), h), y), x), S), u), Qe.createValues(d, b)), { uSizeFactor: R.create(d.sizeFactor), dPointSizeAttenuation: R.create(d.pointSizeAttenuation), dPointStyle: R.create(d.pointStyle) });
  }
  function o(s, u) {
    Qe.updateRenderableState(s, u), s.opaque = s.opaque && u.pointStyle !== "fuzzy", s.writeDepth = s.opaque;
  }
  e.create = t, e.createEmpty = n, e.transform = function(s, u) {
    var l = s.centerBuffer.ref.value;
    rm(u, l, 0, s.pointCount), R.update(s.centerBuffer, l);
  }, e.StyleTypes = { square: "Square", circle: "Circle", fuzzy: "Fuzzy" }, e.StyleTypeNames = Object.keys(e.StyleTypes), e.Params = O(O({}, Qe.Params), { sizeFactor: N.Numeric(3, { min: 0, max: 10, step: 0.1 }), pointSizeAttenuation: N.Boolean(!1), pointStyle: N.Select("square", N.objectToOptions(e.StyleTypes)) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: a, createValuesSimple: function(s, u, l, c, d) {
    var f = Qe.createSimple(l, c, d), p = O(O({}, N.getDefaultValues(e.Params)), u);
    return a(s, f.transform, f.locationIterator, f.theme, p);
  }, updateValues: function(s, u) {
    Qe.updateValues(s, u), R.updateIfChanged(s.uSizeFactor, u.sizeFactor), R.updateIfChanged(s.dPointSizeAttenuation, u.pointSizeAttenuation), R.updateIfChanged(s.dPointStyle, u.pointStyle);
  }, updateBoundingSphere: function(s, u) {
    var l = pe.clone(u.boundingSphere), c = Si(l, s.aTransform.ref.value, s.instanceCount.ref.value);
    pe.equals(c, s.boundingSphere.ref.value) || R.update(s.boundingSphere, c), pe.equals(l, s.invariantBoundingSphere.ref.value) || (R.update(s.invariantBoundingSphere, l), R.update(s.uInvariantBoundingSphere, Nt.fromSphere(s.uInvariantBoundingSphere.ref.value, l)));
  }, createRenderableState: function(s) {
    var u = Qe.createRenderableState(s);
    return o(u, s), u;
  }, updateRenderableState: o, createPositionIterator: i };
})(wf || (wf = {}));
var Qy = {}, Co, yD = { fontFamily: N.Select("sans-serif", [["sans-serif", "Sans Serif"], ["monospace", "Monospace"], ["serif", "Serif"], ["cursive", "Cursive"]]), fontQuality: N.Select(3, [[0, "lower"], [1, "low"], [2, "medium"], [3, "high"], [4, "higher"]]), fontStyle: N.Select("normal", [["normal", "Normal"], ["italic", "Italic"], ["oblique", "Oblique"]]), fontVariant: N.Select("normal", [["normal", "Normal"], ["small-caps", "Small Caps"]]), fontWeight: N.Select("normal", [["normal", "Normal"], ["bold", "Bold"]]) }, yK = function() {
  function e(t) {
    t === void 0 && (t = {}), this.mapped = {}, this.scratchW = 0, this.scratchH = 0, this.currentX = 0, this.currentY = 0, this.cutoff = 0.5;
    var n = O(O({}, N.getDefaultValues(yD)), t);
    this.props = n;
    var r = 32 * (n.fontQuality + 1);
    this.buffer = r / 8, this.radius = r / 3, this.lineHeight = Math.round(r + 2 * this.buffer + this.radius), this.maxWidth = Math.round(0.75 * this.lineHeight), this.texture = ci(350 * this.lineHeight * this.maxWidth, 1, Uint8Array), this.scratchCanvas = document.createElement("canvas"), this.scratchCanvas.width = this.maxWidth, this.scratchCanvas.height = this.lineHeight, this.scratchContext = this.scratchCanvas.getContext("2d"), this.scratchContext.font = "".concat(n.fontStyle, " ").concat(n.fontVariant, " ").concat(n.fontWeight, " ").concat(r, "px ").concat(n.fontFamily), this.scratchContext.fillStyle = "black", this.scratchContext.textBaseline = "middle", this.scratchData = new Uint8Array(this.lineHeight * this.maxWidth), this.gridOuter = new Float64Array(this.lineHeight * this.maxWidth), this.gridInner = new Float64Array(this.lineHeight * this.maxWidth), this.f = new Float64Array(Math.max(this.lineHeight, this.maxWidth)), this.d = new Float64Array(Math.max(this.lineHeight, this.maxWidth)), this.z = new Float64Array(Math.max(this.lineHeight, this.maxWidth) + 1), this.v = new Int16Array(Math.max(this.lineHeight, this.maxWidth)), this.middle = Math.ceil(this.lineHeight / 2), this.placeholder = this.get("�");
  }
  return e.prototype.get = function(t) {
    if (this.mapped[t] === void 0) {
      this.draw(t);
      var n = this.texture, r = n.array, i = n.width, a = n.height, o = this.scratchData;
      if (this.currentX + this.scratchW > i && (this.currentX = 0, this.currentY += this.scratchH), this.currentY + this.scratchH > a) return console.warn("canvas to small"), this.placeholder;
      this.mapped[t] = { x: this.currentX, y: this.currentY, w: this.scratchW, h: this.scratchH, nw: this.scratchW / this.lineHeight, nh: this.scratchH / this.lineHeight };
      for (var s = 0; s < this.scratchH; ++s) for (var u = 0; u < this.scratchW; ++u) r[i * (this.currentY + s) + this.currentX + u] = o[s * this.scratchW + u];
      this.currentX += this.scratchW;
    }
    return this.mapped[t];
  }, e.prototype.draw = function(t) {
    var n = this.lineHeight, r = this.scratchContext, i = this.scratchData, a = r.measureText(t), o = Math.min(this.maxWidth, Math.ceil(a.width + 2 * this.buffer)), s = o * n;
    r.clearRect(0, 0, o, n), r.fillText(t, this.buffer, this.middle);
    for (var u = r.getImageData(0, 0, o, n), l = 0; l < s; l++) {
      var c = u.data[4 * l + 3] / 255;
      this.gridOuter[l] = c === 1 ? 0 : c === 0 ? Number.MAX_SAFE_INTEGER : Math.pow(Math.max(0, 0.5 - c), 2), this.gridInner[l] = c === 1 ? Number.MAX_SAFE_INTEGER : c === 0 ? 0 : Math.pow(Math.max(0, c - 0.5), 2);
    }
    for (iS(this.gridOuter, o, n, this.f, this.d, this.v, this.z), iS(this.gridInner, o, n, this.f, this.d, this.v, this.z), l = 0; l < s; l++) {
      var d = this.gridOuter[l] - this.gridInner[l];
      i[l] = Math.max(0, Math.min(255, Math.round(255 - 255 * (d / this.radius + this.cutoff))));
    }
    this.scratchW = o, this.scratchH = n;
  }, e;
}();
function oS(e, t, n, r) {
  for (var i = 0, a = 0, o = 0, s = 4 * n; o < s; ++o) {
    var u = 2 * o, l = Math.abs(e[u]);
    l > i && (i = l);
    var c = Math.abs(e[u + 1]);
    c > i && (i = c);
    var d = Math.abs(t[o]);
    d > a && (a = d);
  }
  return Math.max(a, r + r * i);
}
(function(e) {
  function t(s, u, l, c, d, f, p, g, m) {
    return m ? function(v, h, y, x, S, b, _, C, w) {
      return w.charCount = C, R.update(w.fontTexture, v), R.update(w.centerBuffer, h), R.update(w.mappingBuffer, y), R.update(w.depthBuffer, x), R.update(w.indexBuffer, S), R.update(w.groupBuffer, b), R.update(w.tcoordBuffer, _), w;
    }(s, u, l, c, d, f, p, g, m) : function(v, h, y, x, S, b, _, C) {
      var w, I = pe(), M = -1, E = -1, T = { kind: "text", charCount: C, fontTexture: R.create(v), centerBuffer: R.create(h), mappingBuffer: R.create(y), depthBuffer: R.create(x), indexBuffer: R.create(S), groupBuffer: R.create(b), tcoordBuffer: R.create(_), get boundingSphere() {
        var P = r(T);
        if (P !== M) {
          var k = od(T.centerBuffer.ref.value, 4 * T.charCount, 4);
          pe.copy(I, k), M = P;
        }
        return I;
      }, get groupMapping() {
        return T.groupBuffer.ref.version !== E && (w = Vm(T.groupBuffer.ref.value, T.charCount, 4), E = T.groupBuffer.ref.version), w;
      }, setBoundingSphere: function(P) {
        pe.copy(I, P), M = r(T);
      } };
      return T;
    }(s, u, l, c, d, f, p, g);
  }
  function n(s) {
    return t(s ? s.fontTexture.ref.value : ci(0, 1, Uint8Array), s ? s.centerBuffer.ref.value : new Float32Array(0), s ? s.mappingBuffer.ref.value : new Float32Array(0), s ? s.depthBuffer.ref.value : new Float32Array(0), s ? s.indexBuffer.ref.value : new Uint32Array(0), s ? s.groupBuffer.ref.value : new Float32Array(0), s ? s.tcoordBuffer.ref.value : new Float32Array(0), 0, s);
  }
  function r(s) {
    return pa([s.charCount, s.fontTexture.ref.version, s.centerBuffer.ref.version, s.mappingBuffer.ref.version, s.depthBuffer.ref.version, s.indexBuffer.ref.version, s.groupBuffer.ref.version, s.tcoordBuffer.ref.version]);
  }
  function i(s, u) {
    var l = 4 * s.charCount, c = u.instanceCount.ref.value, d = Af(), f = d.position, p = s.centerBuffer.ref.value, g = u.aTransform.ref.value;
    return zr(l, c, 4, function(m, v) {
      return v < 0 ? A.fromArray(f, p, 3 * m) : A.transformMat4Offset(f, p, g, 0, 3 * m, 16 * v), d;
    });
  }
  function a(s, u, l, c, d) {
    var f = l.instanceCount, p = l.groupCount, g = bo(l, i(s, u), c.color), m = Hl(l, c.size), v = ss(f * p), h = Al(), y = wl(), x = Pl(), S = Il(), b = { drawCount: 2 * s.charCount * 3, vertexCount: 4 * s.charCount, groupCount: p, instanceCount: f }, _ = oS(s.mappingBuffer.ref.value, s.depthBuffer.ref.value, s.charCount, E0(m)), C = pe.expand(pe(), s.boundingSphere, _), w = Si(C, u.aTransform.ref.value, f);
    return O(O(O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("text"), aPosition: s.centerBuffer, aMapping: s.mappingBuffer, aDepth: s.depthBuffer, aGroup: s.groupBuffer, elements: s.indexBuffer, boundingSphere: R.create(w), invariantBoundingSphere: R.create(C), uInvariantBoundingSphere: R.create(Nt.ofSphere(C)) }, g), m), v), h), y), x), S), u), { aTexCoord: s.tcoordBuffer, tFont: s.fontTexture, padding: R.create(_) }), Qe.createValues(d, b)), { uSizeFactor: R.create(d.sizeFactor), uBorderWidth: R.create(Ia(d.borderWidth, 0, 0.5)), uBorderColor: R.create(Ae.toArrayNormalized(d.borderColor, A.zero(), 0)), uOffsetX: R.create(d.offsetX), uOffsetY: R.create(d.offsetY), uOffsetZ: R.create(d.offsetZ), uBackgroundColor: R.create(Ae.toArrayNormalized(d.backgroundColor, A.zero(), 0)), uBackgroundOpacity: R.create(d.backgroundOpacity) });
  }
  function o(s, u) {
    Qe.updateRenderableState(s, u), s.pickable = !1, s.opaque = !1, s.writeDepth = !0;
  }
  e.create = t, e.createEmpty = n, e.Params = O(O(O({}, Qe.Params), yD), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), borderWidth: N.Numeric(0, { min: 0, max: 0.5, step: 0.01 }), borderColor: N.Color(qt.grey), offsetX: N.Numeric(0, { min: 0, max: 10, step: 0.1 }), offsetY: N.Numeric(0, { min: 0, max: 10, step: 0.1 }), offsetZ: N.Numeric(0, { min: 0, max: 10, step: 0.1 }), background: N.Boolean(!1), backgroundMargin: N.Numeric(0.2, { min: 0, max: 1, step: 0.01 }), backgroundColor: N.Color(qt.grey), backgroundOpacity: N.Numeric(1, { min: 0, max: 1, step: 0.01 }), tether: N.Boolean(!1), tetherLength: N.Numeric(1, { min: 0, max: 5, step: 0.1 }), tetherBaseWidth: N.Numeric(0.3, { min: 0, max: 1, step: 0.01 }), attachment: N.Select("middle-center", [["bottom-left", "bottom-left"], ["bottom-center", "bottom-center"], ["bottom-right", "bottom-right"], ["middle-left", "middle-left"], ["middle-center", "middle-center"], ["middle-right", "middle-right"], ["top-left", "top-left"], ["top-center", "top-center"], ["top-right", "top-right"]]) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: a, createValuesSimple: function(s, u, l, c, d) {
    var f = Qe.createSimple(l, c, d), p = O(O({}, N.getDefaultValues(e.Params)), u);
    return a(s, f.transform, f.locationIterator, f.theme, p);
  }, updateValues: function(s, u) {
    Qe.updateValues(s, u), R.updateIfChanged(s.uSizeFactor, u.sizeFactor), R.updateIfChanged(s.uBorderWidth, u.borderWidth), Ae.fromNormalizedArray(s.uBorderColor.ref.value, 0) !== u.borderColor && (Ae.toArrayNormalized(u.borderColor, s.uBorderColor.ref.value, 0), R.update(s.uBorderColor, s.uBorderColor.ref.value)), R.updateIfChanged(s.uOffsetX, u.offsetX), R.updateIfChanged(s.uOffsetY, u.offsetY), R.updateIfChanged(s.uOffsetZ, u.offsetZ), Ae.fromNormalizedArray(s.uBackgroundColor.ref.value, 0) !== u.backgroundColor && (Ae.toArrayNormalized(u.backgroundColor, s.uBackgroundColor.ref.value, 0), R.update(s.uBackgroundColor, s.uBackgroundColor.ref.value)), R.updateIfChanged(s.uBackgroundOpacity, u.backgroundOpacity);
  }, updateBoundingSphere: function(s, u) {
    var l = oS(s.aMapping.ref.value, s.aDepth.ref.value, u.charCount, E0(s)), c = pe.expand(pe(), u.boundingSphere, l), d = Si(c, s.aTransform.ref.value, s.instanceCount.ref.value);
    pe.equals(d, s.boundingSphere.ref.value) || R.update(s.boundingSphere, d), pe.equals(c, s.invariantBoundingSphere.ref.value) || (R.update(s.invariantBoundingSphere, c), R.update(s.uInvariantBoundingSphere, Nt.fromSphere(s.uInvariantBoundingSphere.ref.value, c))), R.update(s.padding, l);
  }, createRenderableState: function(s) {
    var u = Qe.createRenderableState(s);
    return o(u, s), u;
  }, updateRenderableState: o, createPositionIterator: i };
})(Co || (Co = {}));
var zi, Mn, iu = A(), au = A(), Ad = A(), sS = be.add, l2 = be.add3;
(function(e) {
  e.create = function(t, n, r) {
    t === void 0 && (t = 2048), n === void 0 && (n = 1024);
    var i = be.create(Float32Array, 1, n, r ? r.groupBuffer.ref.value : t), a = be.create(Float32Array, 3, n, r ? r.startBuffer.ref.value : t), o = be.create(Float32Array, 3, n, r ? r.endBuffer.ref.value : t), s = function(l, c, d, f, p, g, m) {
      for (var v = 0; v < 4; ++v) l2(a, l, c, d), l2(o, f, p, g), sS(i, m);
    }, u = function(l, c, d, f) {
      var p = A.distance(l, c), g = Math.floor(d / 2), m = 1 / d;
      A.sub(Ad, c, l);
      for (var v = 0; v < g; ++v) {
        var h = m * (2 * v + 1);
        A.setMagnitude(Ad, Ad, p * h), A.add(iu, l, Ad), A.setMagnitude(Ad, Ad, p * m * (2 * (v + 1))), A.add(au, l, Ad), s(iu[0], iu[1], iu[2], au[0], au[1], au[2], f);
      }
    };
    return { add: s, addVec: function(l, c, d) {
      for (var f = 0; f < 4; ++f) l2(a, l[0], l[1], l[2]), l2(o, c[0], c[1], c[2]), sS(i, d);
    }, addFixedCountDashes: u, addFixedLengthDashes: function(l, c, d, f) {
      var p = A.distance(l, c);
      u(l, c, p / d, f);
    }, addCage: function(l, c, d) {
      for (var f = c.vertices, p = c.edges, g = 0, m = p.length; g < m; g += 2) A.fromArray(iu, f, 3 * p[g]), A.fromArray(au, f, 3 * p[g + 1]), A.transformMat4(iu, iu, l), A.transformMat4(au, au, l), s(iu[0], iu[1], iu[2], au[0], au[1], au[2], d);
    }, getLines: function() {
      var l = i.elementCount / 4, c = be.compact(i, !0), d = be.compact(a, !0), f = be.compact(o, !0), p = r && l <= r.lineCount ? r.mappingBuffer.ref.value : new Float32Array(8 * l), g = r && l <= r.lineCount ? r.indexBuffer.ref.value : new Uint32Array(6 * l);
      return (!r || l > r.lineCount) && function(m, v, h) {
        for (var y = 0; y < m; ++y) {
          var x = 8 * y;
          v[x] = -1, v[x + 1] = -1, v[x + 2] = 1, v[x + 3] = -1, v[x + 4] = -1, v[x + 5] = 1, v[x + 6] = 1, v[x + 7] = 1;
        }
        for (y = 0; y < m; ++y) {
          var S = 4 * y, b = 6 * y;
          h[b] = S, h[b + 1] = S + 1, h[b + 2] = S + 2, h[b + 3] = S + 1, h[b + 4] = S + 3, h[b + 5] = S + 2;
        }
      }(l, p, g), Mn.create(p, g, c, d, f, l, r);
    } };
  };
})(zi || (zi = {})), function(e) {
  function t(o, s, u, l, c, d, f) {
    return f ? function(p, g, m, v, h, y, x) {
      return y > x.lineCount && (R.update(x.mappingBuffer, p), R.update(x.indexBuffer, g)), x.lineCount = y, R.update(x.groupBuffer, m), R.update(x.startBuffer, v), R.update(x.endBuffer, h), x;
    }(o, s, u, l, c, d, f) : function(p, g, m, v, h, y) {
      var x, S = pe(), b = -1, _ = -1, C = { kind: "lines", lineCount: y, mappingBuffer: R.create(p), indexBuffer: R.create(g), groupBuffer: R.create(m), startBuffer: R.create(v), endBuffer: R.create(h), get boundingSphere() {
        var w = r(C);
        if (w !== b) {
          var I = od(C.startBuffer.ref.value, 4 * C.lineCount, 4), M = od(C.endBuffer.ref.value, 4 * C.lineCount, 4);
          pe.expandBySphere(S, I, M), b = w;
        }
        return S;
      }, get groupMapping() {
        return C.groupBuffer.ref.version !== _ && (x = Vm(C.groupBuffer.ref.value, C.lineCount, 4), _ = C.groupBuffer.ref.version), x;
      }, setBoundingSphere: function(w) {
        pe.copy(S, w), b = r(C);
      } };
      return C;
    }(o, s, u, l, c, d);
  }
  function n(o) {
    return t(o ? o.mappingBuffer.ref.value : new Float32Array(0), o ? o.indexBuffer.ref.value : new Uint32Array(0), o ? o.groupBuffer.ref.value : new Float32Array(0), o ? o.startBuffer.ref.value : new Float32Array(0), o ? o.endBuffer.ref.value : new Float32Array(0), 0, o);
  }
  function r(o) {
    return pa([o.lineCount, o.mappingBuffer.ref.version, o.indexBuffer.ref.version, o.groupBuffer.ref.version, o.startBuffer.ref.version, o.endBuffer.ref.version]);
  }
  function i(o, s) {
    var u = 4 * o.lineCount, l = s.instanceCount.ref.value, c = Af(), d = c.position, f = o.startBuffer.ref.value, p = o.endBuffer.ref.value, g = s.aTransform.ref.value;
    return zr(u, l, 2, function(m, v) {
      var h = m % 4 == 0 ? f : p;
      return v < 0 ? A.fromArray(d, h, 3 * m) : A.transformMat4Offset(d, h, g, 0, 3 * m, 16 * v), c;
    });
  }
  function a(o, s, u, l, c) {
    var d = u.instanceCount, f = u.groupCount, p = bo(u, i(o, s), l.color), g = Hl(u, l.size), m = ss(d * f), v = Al(), h = wl(), y = Pl(), x = Il(), S = { drawCount: 2 * o.lineCount * 3, vertexCount: 4 * o.lineCount, groupCount: f, instanceCount: d }, b = pe.clone(o.boundingSphere), _ = Si(b, s.aTransform.ref.value, d);
    return O(O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("lines"), aMapping: o.mappingBuffer, aGroup: o.groupBuffer, aStart: o.startBuffer, aEnd: o.endBuffer, elements: o.indexBuffer, boundingSphere: R.create(_), invariantBoundingSphere: R.create(b), uInvariantBoundingSphere: R.create(Nt.ofSphere(b)) }, p), g), m), v), h), y), x), s), Qe.createValues(c, S)), { uSizeFactor: R.create(c.sizeFactor), dLineSizeAttenuation: R.create(c.lineSizeAttenuation), uDoubleSided: R.create(!0), dFlipSided: R.create(!1) });
  }
  e.create = t, e.createEmpty = n, e.fromMesh = function(o, s) {
    for (var u = o.vertexBuffer.ref.value, l = o.indexBuffer.ref.value, c = o.groupBuffer.ref.value, d = zi.create(3 * o.triangleCount, o.triangleCount / 10, s), f = 0, p = 3 * o.triangleCount; f < p; f += 3) {
      var g = l[f], m = l[f + 1], v = l[f + 2], h = u[3 * g], y = u[3 * g + 1], x = u[3 * g + 2], S = u[3 * m], b = u[3 * m + 1], _ = u[3 * m + 2], C = u[3 * v], w = u[3 * v + 1], I = u[3 * v + 2];
      d.add(h, y, x, S, b, _, c[g]), d.add(h, y, x, C, w, I, c[g]), d.add(S, b, _, C, w, I, c[m]);
    }
    return d.getLines();
  }, e.transform = function(o, s) {
    var u = o.startBuffer.ref.value;
    rm(s, u, 0, 4 * o.lineCount), R.update(o.startBuffer, u);
    var l = o.endBuffer.ref.value;
    rm(s, l, 0, 4 * o.lineCount), R.update(o.endBuffer, l);
  }, e.Params = O(O({}, Qe.Params), { sizeFactor: N.Numeric(2, { min: 0, max: 10, step: 0.1 }), lineSizeAttenuation: N.Boolean(!1) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: a, createValuesSimple: function(o, s, u, l, c) {
    var d = Qe.createSimple(u, l, c), f = O(O({}, N.getDefaultValues(e.Params)), s);
    return a(o, d.transform, d.locationIterator, d.theme, f);
  }, updateValues: function(o, s) {
    Qe.updateValues(o, s), R.updateIfChanged(o.uSizeFactor, s.sizeFactor), R.updateIfChanged(o.dLineSizeAttenuation, s.lineSizeAttenuation);
  }, updateBoundingSphere: function(o, s) {
    var u = pe.clone(s.boundingSphere), l = Si(u, o.aTransform.ref.value, o.instanceCount.ref.value);
    pe.equals(l, o.boundingSphere.ref.value) || R.update(o.boundingSphere, l), pe.equals(u, o.invariantBoundingSphere.ref.value) || (R.update(o.invariantBoundingSphere, u), R.update(o.uInvariantBoundingSphere, Nt.fromSphere(o.uInvariantBoundingSphere.ref.value, u)));
  }, createRenderableState: Qe.createRenderableState, updateRenderableState: Qe.updateRenderableState, createPositionIterator: i };
}(Mn || (Mn = {}));
var uS = A(), lS = A(), cS = A();
function bD(e, t) {
  for (var n = t.length, r = uh(n / 3), i = 0; i < n; i += 3) A.fromArray(uS, e, 3 * t[i]), A.fromArray(lS, e, 3 * t[i + 1]), A.fromArray(cS, e, 3 * t[i + 2]), r.add(uS, lS, cS);
  return r.getPrimitive();
}
var c2 = A();
function uh(e, t) {
  t === void 0 && (t = 3 * e);
  var n = new Float32Array(3 * t), r = new Float32Array(3 * t), i = new Uint32Array(3 * e), a = 0, o = 0;
  return { add: function(s, u, l) {
    A.toArray(s, n, a), A.toArray(u, n, a + 3), A.toArray(l, n, a + 6), A.triangleNormal(c2, s, u, l);
    for (var c = 0; c < 3; ++c) A.toArray(c2, r, a + 3 * c), i[o + c] = a / 3 + c;
    a += 9, o += 3;
  }, addQuad: function(s, u, l, c) {
    A.toArray(s, n, a), A.toArray(u, n, a + 3), A.toArray(l, n, a + 6), A.toArray(c, n, a + 9), A.triangleNormal(c2, s, u, l);
    for (var d = 0; d < 4; ++d) A.toArray(c2, r, a + 3 * d);
    var f = a / 3;
    i[o] = f, i[o + 1] = f + 1, i[o + 2] = f + 2, i[o + 3] = f + 2, i[o + 4] = f + 3, i[o + 5] = f, a += 12, o += 6;
  }, getPrimitive: function() {
    return { vertices: n, normals: r, indices: i };
  } };
}
var Qf = A(), bK = pi();
function m3(e, t) {
  for (var n = e.vertices, r = e.normals, i = pi.directionTransform(bK, t), a = 0, o = n.length; a < o; a += 3) A.transformMat4(Qf, A.fromArray(Qf, n, a), t), A.toArray(Qf, n, a), A.transformMat3(Qf, A.fromArray(Qf, r, a), i), A.toArray(Qf, r, a);
  return e;
}
function p3(e, t, n) {
  n === void 0 && (n = -1);
  for (var r = new Float32Array(3 * e), i = n === -1 ? e <= 4 ? Math.sqrt(2) / 2 : 0.6 : n, a = t ? 1 : 0, o = 0, s = e; o < s; ++o) {
    var u = (2 * o + a) / e * Math.PI;
    r[3 * o] = Math.cos(u) * i, r[3 * o + 1] = Math.sin(u) * i, r[3 * o + 2] = 0;
  }
  return r;
}
function h3(e) {
  return { vertices: new Float32Array(e.vertices), edges: new Uint32Array(e.edges) };
}
var Jy = A.zero();
function g3(e, t) {
  for (var n = e.vertices, r = 0, i = n.length; r < i; r += 3) A.transformMat4(Jy, A.fromArray(Jy, n, r), t), A.toArray(Jy, n, r);
  return e;
}
var $y, e4, Ga, t4, n4, $t, Jf = A(), $f = A(), e1 = A(), t1 = A(), Tr = p3(4, !0);
function _D() {
  return $y || ($y = function(e) {
    for (var t = uh(12, 24), n = 0; n < 4; ++n) {
      var r = (n + 1) % 4;
      A.set(Jf, Tr[3 * n], Tr[3 * n + 1], -0.5), A.set($f, Tr[3 * r], Tr[3 * r + 1], -0.5), A.set(e1, Tr[3 * r], Tr[3 * r + 1], 0.5), A.set(t1, Tr[3 * n], Tr[3 * n + 1], 0.5), t.addQuad(Jf, $f, e1, t1);
    }
    return A.set(Jf, Tr[0], Tr[1], -0.5), A.set($f, Tr[3], Tr[4], -0.5), A.set(e1, Tr[6], Tr[7], -0.5), A.set(t1, Tr[9], Tr[10], -0.5), t.addQuad(t1, e1, $f, Jf), A.set(Jf, Tr[0], Tr[1], 0.5), A.set($f, Tr[3], Tr[4], 0.5), A.set(e1, Tr[6], Tr[7], 0.5), A.set(t1, Tr[9], Tr[10], 0.5), t.addQuad(Jf, $f, e1, t1), t.getPrimitive();
  }()), $y;
}
function xD() {
  return e4 || (e4 = /* @__PURE__ */ function(e, t) {
    return { vertices: e, edges: t };
  }([0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5], [0, 4, 1, 5, 2, 6, 3, 7, 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4])), e4;
}
function dS(e) {
  return e.map(function(t) {
    return { x: t[0], alpha: t[1] };
  });
}
function fS(e, t) {
  for (var n, r, i, a, o, s, u = Re(Re([{ x: 0, alpha: 0 }, { x: 0, alpha: 0 }], e, !0), [{ x: 1, alpha: 0 }, { x: 1, alpha: 0 }], !1), l = t ? t.ref.value.array : new Uint8Array(256), c = 0, d = e.length + 1, f = 0; f < d; ++f) {
    n = u[f + 1].x, r = u[f + 2].x, i = u[f].alpha, a = u[f + 1].alpha, o = u[f + 2].alpha, s = u[f + 3].alpha;
    for (var p = Math.round(256 * (r - n)), g = 0; g < p; ++g) {
      var m = g / p;
      l[c] = Math.max(0, 255 * mg(i, a, o, s, m, 0.5)), ++c;
    }
  }
  var v = { array: l, width: 256, height: 1 };
  return t ? (R.update(t, v), t) : R.create(v);
}
function mS(e, t, n, r) {
  var i = (r - n) / t;
  i === 0 && (i = 1);
  for (var a = new Int32Array(t), o = 0, s = e.length; o < s; o++) {
    var u = Math.floor((e[o] - n) / i);
    u >= t ? u = t - 1 : u < 0 && (u = 0), a[u]++;
  }
  return { min: n, max: r, binWidth: i, counts: a };
}
(function(e) {
  e.One = { transform: { kind: "matrix", matrix: ne.identity() }, cells: wr.create(wr.Space([1, 1, 1], [0, 1, 2]), wr.Data1([0])), stats: { min: 0, max: 0, mean: 0, sigma: 0 } };
  var t = ne.zero(), n = ne.zero();
  e.getGridToCartesianTransform = function(r) {
    if (r.transform.kind === "matrix") return ne.copy(ne(), r.transform.matrix);
    if (r.transform.kind === "spacegroup") {
      var i = r.cells.space, a = ne.fromScaling(t, A.div(A.zero(), qn.size(A.zero(), r.transform.fractionalBox), A.ofArray(i.dimensions))), o = ne.fromTranslation(n, r.transform.fractionalBox.min);
      return ne.mul3(ne.zero(), r.transform.cell.fromFractional, o, a);
    }
    return ne.identity();
  }, e.areEquivalent = function(r, i) {
    return r === i;
  }, e.isEmpty = function(r) {
    return r.cells.data.length === 0;
  }, e.getBoundingSphere = function(r, i) {
    i || (i = pe());
    var a = r.cells.space.dimensions, o = e.getGridToCartesianTransform(r);
    return pe.fromDimensionsAndTransform(i, a, o);
  }, e.getHistogram = function(r, i) {
    var a = r._historams;
    return a || (a = r._historams = {}), a[i] || (a[i] = function(o, s, u) {
      if (u) return mS(o, s, u.min, u.max);
      var l = lo(o);
      return mS(o, s, l[0], l[1]);
    }(r.cells.data, i, { min: r.stats.min, max: r.stats.max })), a[i];
  };
})(Ga || (Ga = {})), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "cube";
  }, e.create = function(t) {
    return { kind: "cube", name: t.name, data: t };
  };
}(t4 || (t4 = {})), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "dscif";
  }, e.create = function(t) {
    return { kind: "dscif", name: t._name, data: t };
  };
}(n4 || (n4 = {})), function(e) {
  var t;
  e.is = function(a) {
    var o, s, u, l;
    return ((l = (u = (s = (o = a == null ? void 0 : a.grid) === null || o === void 0 ? void 0 : o.cells) === null || s === void 0 ? void 0 : s.space) === null || u === void 0 ? void 0 : u.dimensions) === null || l === void 0 ? void 0 : l.length) && (a == null ? void 0 : a.sourceData) && (a == null ? void 0 : a.customProperties) && (a == null ? void 0 : a._propertyData);
  }, function(a) {
    function o(s, u) {
      return s.kind === "absolute" ? s : { kind: "absolute", absoluteValue: a.calcAbsolute(u, s.relativeValue) };
    }
    a.areSame = function(s, u, l) {
      return Ar(o(s, l).absoluteValue, o(u, l).absoluteValue, l.sigma / 100);
    }, a.absolute = function(s) {
      return { kind: "absolute", absoluteValue: s };
    }, a.relative = function(s) {
      return { kind: "relative", relativeValue: s };
    }, a.calcAbsolute = function(s, u) {
      return u * s.sigma + s.mean;
    }, a.calcRelative = function(s, u) {
      return s.sigma === 0 ? 0 : (u - s.mean) / s.sigma;
    }, a.toAbsolute = o, a.toRelative = function(s, u) {
      return s.kind === "relative" ? s : { kind: "relative", relativeValue: a.calcRelative(u, s.absoluteValue) };
    }, a.toString = function(s) {
      return s.kind === "relative" ? "".concat(s.relativeValue.toFixed(2), " σ") : "".concat(s.absoluteValue.toPrecision(4));
    };
  }(t = e.IsoValue || (e.IsoValue = {})), e.adjustedIsoValue = function(a, o, s) {
    if (s === "relative") return t.relative(o);
    var u = t.absolute(o);
    if (n4.is(a.sourceData)) {
      var l = { min: a.sourceData.data.volume_data_3d_info.min_source.value(0), max: a.sourceData.data.volume_data_3d_info.max_source.value(0), mean: a.sourceData.data.volume_data_3d_info.mean_source.value(0), sigma: a.sourceData.data.volume_data_3d_info.sigma_source.value(0) };
      return e.IsoValue.toRelative(u, l);
    }
    return u;
  };
  var n, r = { min: -1, max: 1, mean: 0, sigma: 0.1 };
  function i(a, o) {
    var s = o || r, u = s.min, l = s.max, c = s.mean, d = s.sigma, f = (u - c) / d, p = (l - c) / d, g = a;
    return a.kind === "absolute" ? a.absoluteValue < u ? g = e.IsoValue.absolute(u) : a.absoluteValue > l && (g = e.IsoValue.absolute(l)) : a.relativeValue < f ? g = e.IsoValue.relative(f) : a.relativeValue > p && (g = e.IsoValue.relative(p)), N.Conditioned(g, { absolute: N.Converted(function(m) {
      return e.IsoValue.toAbsolute(m, Ga.One.stats).absoluteValue;
    }, function(m) {
      return e.IsoValue.absolute(m);
    }, N.Numeric(c, { min: u, max: l, step: Fx(d / 100, 2) })), relative: N.Converted(function(m) {
      return e.IsoValue.toRelative(m, Ga.One.stats).relativeValue;
    }, function(m) {
      return e.IsoValue.relative(m);
    }, N.Numeric(Math.min(1, p), { min: f, max: p, step: Fx(Math.round((l - u) / d) / 100, 2) })) }, function(m) {
      return m.kind === "absolute" ? "absolute" : "relative";
    }, function(m, v) {
      return v === "absolute" ? e.IsoValue.toAbsolute(m, s) : e.IsoValue.toRelative(m, s);
    }, { isEssential: !0 });
  }
  e.createIsoValueParam = i, e.IsoValueParam = i(e.IsoValue.relative(2)), e.One = { label: "", grid: Ga.One, sourceData: { kind: "", name: "", data: {} }, customProperties: new Rm(), _propertyData: /* @__PURE__ */ Object.create(null) }, e.areEquivalent = function(a, o) {
    return Ga.areEquivalent(a.grid, o.grid);
  }, e.isEmpty = function(a) {
    return Ga.isEmpty(a.grid);
  }, e.isOrbitals = function(a) {
    return !!t4.is(a.sourceData) && a.sourceData.data.header.orbitals;
  }, e.Loci = function(a) {
    return { kind: "volume-loci", volume: a };
  }, e.isLoci = function(a) {
    return !!a && a.kind === "volume-loci";
  }, e.areLociEqual = function(a, o) {
    return a.volume === o.volume;
  }, e.isLociEmpty = function(a) {
    return Ga.isEmpty(a.volume.grid);
  }, e.getBoundingSphere = function(a, o) {
    return Ga.getBoundingSphere(a.grid, o);
  }, (n = e.Isosurface || (e.Isosurface = {})).Loci = function(a, o) {
    return { kind: "isosurface-loci", volume: a, isoValue: o };
  }, n.isLoci = function(a) {
    return !!a && a.kind === "isosurface-loci";
  }, n.areLociEqual = function(a, o) {
    return a.volume === o.volume && e.IsoValue.areSame(a.isoValue, o.isoValue, a.volume.grid.stats);
  }, n.isLociEmpty = function(a) {
    return a.volume.grid.cells.data.length === 0;
  }, n.getBoundingSphere = function(a, o, s) {
    return e.getBoundingSphere(a, s);
  }, function(a) {
    a.Loci = function(u, l) {
      return { kind: "cell-loci", volume: u, indices: l };
    }, a.isLoci = function(u) {
      return !!u && u.kind === "cell-loci";
    }, a.areLociEqual = function(u, l) {
      return u.volume === l.volume && _e.areEqual(u.indices, l.indices);
    }, a.isLociEmpty = function(u) {
      return _e.size(u.indices) === 0;
    };
    var o = new ms("98"), s = A();
    a.getBoundingSphere = function(u, l, c) {
      o.reset();
      for (var d = Ga.getGridToCartesianTransform(u.grid), f = u.grid.cells.space.getCoords, p = 0, g = _e.size(l); p < g; p++)
        f(_e.getAt(l, p), s), A.transformMat4(s, s, d), o.includePosition(s);
      for (o.finishedIncludeStep(), p = 0, g = _e.size(l); p < g; p++)
        f(_e.getAt(l, p), s), A.transformMat4(s, s, d), o.radiusPosition(s);
      var m = o.getSphere(c);
      return pe.expand(m, m, 10 * ne.getMaxScaleOnAxis(d));
    };
  }(e.Cell || (e.Cell = {}));
}($t || ($t = {}));
var lv, Hs, sd, r4 = _D();
function Vn(e, t, n) {
  return { type: "attribute", kind: e, itemSize: t, divisor: n };
}
function me(e, t) {
  return { type: "uniform", kind: e, variant: t };
}
function Rt(e, t, n, r) {
  return { type: "texture", kind: e, format: t, dataType: n, filter: r };
}
function Rf(e) {
  return { type: "elements", kind: e };
}
function Bt(e, t) {
  return { type: "define", kind: e, options: t };
}
function Kr(e) {
  return { type: "value", kind: e };
}
(function(e) {
  function t(u, l, c, d, f, p, g, m, v, h) {
    return h ? function(y, x, S, b, _, C, w, I, M, E) {
      var T = C.getWidth(), P = C.getHeight(), k = C.getDepth();
      return R.update(E.gridDimension, x), R.update(E.gridTexture, C), R.update(E.gridTextureDim, A.set(E.gridTextureDim.ref.value, T, P, k)), R.update(E.gridStats, Nt.set(E.gridStats.ref.value, w.min, w.max, w.mean, w.sigma)), R.update(E.bboxMin, y.min), R.update(E.bboxMax, y.max), R.update(E.bboxSize, A.sub(E.bboxSize.ref.value, y.max, y.min)), R.update(E.transform, S), R.update(E.cellDim, _), R.update(E.unitToCartn, b), R.update(E.cartnToUnit, ne.invert(ne(), b)), R.updateIfChanged(E.packedGroup, I), R.updateIfChanged(E.axisOrder, A.fromArray(E.axisOrder.ref.value, M, 0)), E;
    }(u, l, c, d, f, p, g, m, v, h) : function(y, x, S, b, _, C, w, I, M) {
      var E = pe(), T = -1, P = C.getWidth(), k = C.getHeight(), D = C.getDepth(), B = { kind: "direct-volume", gridDimension: R.create(x), gridTexture: R.create(C), gridTextureDim: R.create(A.create(P, k, D)), gridStats: R.create(Nt.create(w.min, w.max, w.mean, w.sigma)), bboxMin: R.create(y.min), bboxMax: R.create(y.max), bboxSize: R.create(A.sub(A(), y.max, y.min)), transform: R.create(S), cellDim: R.create(_), unitToCartn: R.create(b), cartnToUnit: R.create(ne.invert(ne(), b)), get boundingSphere() {
        var L = n(B);
        if (L !== T) {
          var F = function(V, G) {
            return pe.fromDimensionsAndTransform(pe(), V, G);
          }(B.gridDimension.ref.value, B.transform.ref.value);
          pe.copy(E, F), T = L;
        }
        return E;
      }, packedGroup: R.create(I), axisOrder: R.create(M), setBoundingSphere: function(L) {
        pe.copy(E, L), T = n(B);
      } };
      return B;
    }(u, l, c, d, f, p, g, m, v);
  }
  function n(u) {
    return pa([u.bboxSize.ref.version, u.gridDimension.ref.version, u.gridTexture.ref.version, u.transform.ref.version, u.gridStats.ref.version]);
  }
  function r(u) {
    return t(qn(), A(), ne.identity(), ne.identity(), A(), Ha(), Ga.One.stats, !1, A.create(0, 1, 2), u);
  }
  function i(u, l) {
    return Math.ceil(A.magnitude(u) * l);
  }
  function a(u, l) {
    return Math.min.apply(Math, u) * (1 / l);
  }
  function o(u) {
    return 1 / u;
  }
  function s(u, l, c, d, f) {
    var p = u.gridTexture, g = u.gridTextureDim, m = u.gridStats, v = u.bboxSize, h = u.bboxMin, y = u.bboxMax, x = u.gridDimension, S = u.transform, b = c.instanceCount, _ = c.groupCount, C = bo(c, e.Utils.createPositionIterator(u, l), d.color), w = ss(b * _), I = Al(), M = wl(), E = Pl(), T = Il(), P = x.ref.value, k = P[0], D = P[1], B = P[2], L = { drawCount: r4.indices.length, vertexCount: k * D * B, groupCount: _, instanceCount: b }, F = pe.clone(u.boundingSphere), V = Si(F, l.aTransform.ref.value, b), G = fS(dS(f.controlPoints));
    return O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("directVolume") }, C), w), I), M), E), T), l), Qe.createValues(f, L)), { aPosition: R.create(r4.vertices), elements: R.create(r4.indices), boundingSphere: R.create(V), invariantBoundingSphere: R.create(F), uInvariantBoundingSphere: R.create(Nt.ofSphere(F)), uBboxMin: h, uBboxMax: y, uBboxSize: v, uMaxSteps: R.create(i(x.ref.value, f.stepsPerCell)), uStepScale: R.create(a(u.cellDim.ref.value, f.stepsPerCell)), uJumpLength: R.create(f.jumpLength), uTransform: S, uGridDim: x, tTransferTex: G, uTransferScale: R.create(o(f.stepsPerCell)), dGridTexType: R.create(p.ref.value.getDepth() > 0 ? "3d" : "2d"), uGridTexDim: g, tGridTex: p, uGridStats: m, uCellDim: u.cellDim, uCartnToUnit: u.cartnToUnit, uUnitToCartn: u.unitToCartn, dPackedGroup: u.packedGroup, dAxisOrder: R.create(u.axisOrder.ref.value.join("")), dIgnoreLight: R.create(f.ignoreLight), dXrayShaded: R.create(f.xrayShaded) });
  }
  e.create = t, e.createEmpty = r, e.Params = O(O({}, Qe.Params), { ignoreLight: N.Boolean(!1, Qe.ShadingCategory), xrayShaded: N.Boolean(!1, Qe.ShadingCategory), controlPoints: N.LineGraph([xe.create(0.19, 0), xe.create(0.2, 0.05), xe.create(0.25, 0.05), xe.create(0.26, 0), xe.create(0.79, 0), xe.create(0.8, 0.05), xe.create(0.85, 0.05), xe.create(0.86, 0)], { isEssential: !0 }), stepsPerCell: N.Numeric(3, { min: 1, max: 10, step: 1 }), jumpLength: N.Numeric(0, { min: 0, max: 20, step: 0.1 }) }), e.Utils = { Params: e.Params, createEmpty: r, createValues: s, createValuesSimple: function(u, l, c, d, f) {
    var p = Qe.createSimple(c, d, f), g = O(O({}, N.getDefaultValues(e.Params)), l);
    return s(u, p.transform, p.locationIterator, p.theme, g);
  }, updateValues: function(u, l) {
    Qe.updateValues(u, l), R.updateIfChanged(u.dIgnoreLight, l.ignoreLight), R.updateIfChanged(u.dXrayShaded, l.xrayShaded), fS(dS(l.controlPoints), u.tTransferTex), R.updateIfChanged(u.uMaxSteps, i(u.uGridDim.ref.value, l.stepsPerCell)), R.updateIfChanged(u.uStepScale, a(u.uCellDim.ref.value, l.stepsPerCell)), R.updateIfChanged(u.uTransferScale, o(l.stepsPerCell)), R.updateIfChanged(u.uJumpLength, l.jumpLength);
  }, updateBoundingSphere: function(u, l) {
    var c = pe.clone(l.boundingSphere), d = Si(c, u.aTransform.ref.value, u.instanceCount.ref.value);
    pe.equals(d, u.boundingSphere.ref.value) || R.update(u.boundingSphere, d), pe.equals(c, u.invariantBoundingSphere.ref.value) || (R.update(u.invariantBoundingSphere, c), R.update(u.uInvariantBoundingSphere, Nt.fromSphere(u.uInvariantBoundingSphere.ref.value, c)));
  }, createRenderableState: function(u) {
    var l = Qe.createRenderableState(u);
    return l.opaque = !1, l.writeDepth = !1, l;
  }, updateRenderableState: function(u, l) {
    Qe.updateRenderableState(u, l), u.opaque = !1, u.writeDepth = !1;
  }, createPositionIterator: function(u, l) {
    var c = u.transform.ref.value, d = u.gridDimension.ref.value, f = d[0], p = d[1], g = d[2], m = f * p * g, v = l.instanceCount.ref.value, h = Af(), y = h.position, x = l.aTransform.ref.value;
    return zr(m, v, 1, function(S, b) {
      var _ = Math.floor(S / g);
      return y[0] = Math.floor(_ / p), y[1] = _ % p, y[2] = S % g, A.transformMat4(y, y, c), b >= 0 && A.transformMat4Offset(y, y, x, 0, 0, 16 * b), h;
    });
  } };
})(lv || (lv = {})), function(e) {
  function t(s, u, l, c, d, f) {
    return f ? function(p, g, m, v, h, y) {
      return h > y.sphereCount && (R.update(y.mappingBuffer, g), R.update(y.indexBuffer, m)), y.sphereCount = h, R.update(y.centerBuffer, p), R.update(y.groupBuffer, v), y;
    }(s, u, l, c, d, f) : function(p, g, m, v, h) {
      var y, x = pe(), S = -1, b = -1, _ = { kind: "spheres", sphereCount: h, centerBuffer: R.create(p), mappingBuffer: R.create(g), indexBuffer: R.create(m), groupBuffer: R.create(v), get boundingSphere() {
        var C = r(_);
        if (C !== S) {
          var w = od(_.centerBuffer.ref.value, 4 * _.sphereCount, 4);
          pe.copy(x, w), S = C;
        }
        return x;
      }, get groupMapping() {
        return _.groupBuffer.ref.version !== b && (y = Vm(_.groupBuffer.ref.value, _.sphereCount, 4), b = _.groupBuffer.ref.version), y;
      }, setBoundingSphere: function(C) {
        pe.copy(x, C), S = r(_);
      } };
      return _;
    }(s, u, l, c, d);
  }
  function n(s) {
    return t(s ? s.centerBuffer.ref.value : new Float32Array(0), s ? s.mappingBuffer.ref.value : new Float32Array(0), s ? s.indexBuffer.ref.value : new Uint32Array(0), s ? s.groupBuffer.ref.value : new Float32Array(0), 0, s);
  }
  function r(s) {
    return pa([s.sphereCount, s.centerBuffer.ref.version, s.mappingBuffer.ref.version, s.indexBuffer.ref.version, s.groupBuffer.ref.version]);
  }
  function i(s, u) {
    var l = 4 * s.sphereCount, c = u.instanceCount.ref.value, d = Af(), f = d.position, p = s.centerBuffer.ref.value, g = u.aTransform.ref.value;
    return zr(l, c, 4, function(m, v) {
      return v < 0 ? A.fromArray(f, p, 3 * m) : A.transformMat4Offset(f, p, g, 0, 3 * m, 16 * v), d;
    });
  }
  function a(s, u, l, c, d) {
    var f = l.instanceCount, p = l.groupCount, g = bo(l, i(s, u), c.color), m = Hl(l, c.size), v = ss(f * p), h = Al(), y = wl(), x = Pl(), S = Il(), b = { drawCount: 2 * s.sphereCount * 3, vertexCount: 4 * s.sphereCount, groupCount: p, instanceCount: f }, _ = s.boundingSphere.radius ? E0(m) * d.sizeFactor : 0, C = pe.expand(pe(), s.boundingSphere, _), w = Si(C, u.aTransform.ref.value, f);
    return O(O(O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("spheres"), aPosition: s.centerBuffer, aMapping: s.mappingBuffer, aGroup: s.groupBuffer, elements: s.indexBuffer, boundingSphere: R.create(w), invariantBoundingSphere: R.create(C), uInvariantBoundingSphere: R.create(Nt.ofSphere(C)) }, g), m), v), h), y), x), S), u), { padding: R.create(_) }), Qe.createValues(d, b)), { uSizeFactor: R.create(d.sizeFactor), uDoubleSided: R.create(d.doubleSided), dIgnoreLight: R.create(d.ignoreLight), dXrayShaded: R.create(d.xrayShaded), uBumpFrequency: R.create(d.bumpFrequency), uBumpAmplitude: R.create(d.bumpAmplitude) });
  }
  function o(s, u) {
    Qe.updateRenderableState(s, u), s.opaque = s.opaque && !u.xrayShaded, s.writeDepth = s.opaque;
  }
  e.create = t, e.createEmpty = n, e.Params = O(O({}, Qe.Params), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), doubleSided: N.Boolean(!1, Qe.CustomQualityParamInfo), ignoreLight: N.Boolean(!1, Qe.ShadingCategory), xrayShaded: N.Boolean(!1, Qe.ShadingCategory), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), bumpAmplitude: N.Numeric(1, { min: 0, max: 5, step: 0.1 }, Qe.ShadingCategory) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: a, createValuesSimple: function(s, u, l, c, d) {
    var f = Qe.createSimple(l, c, d), p = O(O({}, N.getDefaultValues(e.Params)), u);
    return a(s, f.transform, f.locationIterator, f.theme, p);
  }, updateValues: function(s, u) {
    Qe.updateValues(s, u), R.updateIfChanged(s.uSizeFactor, u.sizeFactor), R.updateIfChanged(s.uDoubleSided, u.doubleSided), R.updateIfChanged(s.dIgnoreLight, u.ignoreLight), R.updateIfChanged(s.dXrayShaded, u.xrayShaded), R.updateIfChanged(s.uBumpFrequency, u.bumpFrequency), R.updateIfChanged(s.uBumpAmplitude, u.bumpAmplitude);
  }, updateBoundingSphere: function(s, u) {
    var l = u.boundingSphere.radius ? E0(s) * s.uSizeFactor.ref.value : 0, c = pe.expand(pe(), u.boundingSphere, l), d = Si(c, s.aTransform.ref.value, s.instanceCount.ref.value);
    pe.equals(d, s.boundingSphere.ref.value) || R.update(s.boundingSphere, d), pe.equals(c, s.invariantBoundingSphere.ref.value) || (R.update(s.invariantBoundingSphere, c), R.update(s.uInvariantBoundingSphere, Nt.fromSphere(s.uInvariantBoundingSphere.ref.value, c))), R.update(s.padding, l);
  }, createRenderableState: function(s) {
    var u = Qe.createRenderableState(s);
    return o(u, s), u;
  }, updateRenderableState: o, createPositionIterator: i };
}(Hs || (Hs = {})), function(e) {
  var t = function() {
    function a() {
      this.index = 0, this.textures = [];
    }
    return a.prototype.get = function() {
      return this.textures[this.index];
    }, a.prototype.set = function(o, s, u) {
      this.textures[this.index] = Object.assign(this.textures[this.index] || {}, { vertex: o, group: s, normal: u }), this.index = (this.index + 1) % 2;
    }, a.prototype.destroy = function() {
      for (var o = 0, s = this.textures; o < s.length; o++) {
        var u = s[o];
        u.vertex.destroy(), u.group.destroy(), u.normal.destroy();
      }
    }, a;
  }();
  function n(a, o, s, u, l, c, d) {
    var f = s.getWidth(), p = s.getHeight();
    return d ? (d.vertexCount = a, d.groupCount = o, R.update(d.geoTextureDim, xe.set(d.geoTextureDim.ref.value, f, p)), R.update(d.vertexTexture, s), R.update(d.groupTexture, u), R.update(d.normalTexture, l), d.doubleBuffer.set(s, u, l), pe.copy(d.boundingSphere, c), d) : { kind: "texture-mesh", vertexCount: a, groupCount: o, geoTextureDim: R.create(xe.create(f, p)), vertexTexture: R.create(s), groupTexture: R.create(u), normalTexture: R.create(l), doubleBuffer: new t(), boundingSphere: pe.clone(c), meta: {} };
  }
  function r(a) {
    return n(0, 0, a ? a.vertexTexture.ref.value : Ha(), a ? a.groupTexture.ref.value : Ha(), a ? a.normalTexture.ref.value : Ha(), a ? a.boundingSphere : pe(), a);
  }
  function i(a, o, s, u, l) {
    var c = s.instanceCount, d = s.groupCount, f = bo(s, e.Utils.createPositionIterator(a, o), u.color), p = ss(c * d), g = Al(), m = wl(), v = Pl(), h = Il(), y = { drawCount: a.vertexCount, vertexCount: a.vertexCount, groupCount: d, instanceCount: c }, x = pe.clone(a.boundingSphere), S = Si(x, o.aTransform.ref.value, c);
    return O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("textureMesh"), uGeoTexDim: a.geoTextureDim, tPosition: a.vertexTexture, tGroup: a.groupTexture, tNormal: a.normalTexture, boundingSphere: R.create(S), invariantBoundingSphere: R.create(x), uInvariantBoundingSphere: R.create(Nt.ofSphere(x)) }, f), p), g), m), v), h), o), Qe.createValues(l, y)), { uDoubleSided: R.create(l.doubleSided), dFlatShaded: R.create(l.flatShaded), dFlipSided: R.create(l.flipSided), dIgnoreLight: R.create(l.ignoreLight), dXrayShaded: R.create(l.xrayShaded), uBumpFrequency: R.create(l.bumpFrequency), uBumpAmplitude: R.create(l.bumpAmplitude), meta: R.create(a.meta) });
  }
  e.DoubleBuffer = t, e.create = n, e.createEmpty = r, e.Params = O(O({}, Qe.Params), { doubleSided: N.Boolean(!1, Qe.CustomQualityParamInfo), flipSided: N.Boolean(!1, Qe.ShadingCategory), flatShaded: N.Boolean(!1, Qe.ShadingCategory), ignoreLight: N.Boolean(!1, Qe.ShadingCategory), xrayShaded: N.Boolean(!1, Qe.ShadingCategory), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), bumpAmplitude: N.Numeric(1, { min: 0, max: 5, step: 0.1 }, Qe.ShadingCategory) }), e.Utils = { Params: e.Params, createEmpty: r, createValues: i, createValuesSimple: function(a, o, s, u, l) {
    var c = Qe.createSimple(s, u, l), d = O(O({}, N.getDefaultValues(e.Params)), o);
    return i(a, c.transform, c.locationIterator, c.theme, d);
  }, updateValues: function(a, o) {
    Qe.updateValues(a, o), R.updateIfChanged(a.uDoubleSided, o.doubleSided), R.updateIfChanged(a.dFlatShaded, o.flatShaded), R.updateIfChanged(a.dFlipSided, o.flipSided), R.updateIfChanged(a.dIgnoreLight, o.ignoreLight), R.updateIfChanged(a.dXrayShaded, o.xrayShaded), R.updateIfChanged(a.uBumpFrequency, o.bumpFrequency), R.updateIfChanged(a.uBumpAmplitude, o.bumpAmplitude);
  }, updateBoundingSphere: function(a, o) {
    var s = pe.clone(o.boundingSphere), u = Si(s, a.aTransform.ref.value, a.instanceCount.ref.value);
    pe.equals(u, a.boundingSphere.ref.value) || R.update(a.boundingSphere, u), pe.equals(s, a.invariantBoundingSphere.ref.value) || (R.update(a.invariantBoundingSphere, s), R.update(a.uInvariantBoundingSphere, Nt.fromSphere(a.uInvariantBoundingSphere.ref.value, s)));
  }, createRenderableState: Qe.createRenderableState, updateRenderableState: Qe.updateRenderableState, createPositionIterator: function() {
    return zr(1, 1, 1, function() {
      return ku;
    });
  } };
}(sd || (sd = {}));
var ju = { uModel: me("m4"), uView: me("m4"), uInvView: me("m4"), uModelView: me("m4"), uInvModelView: me("m4"), uProjection: me("m4"), uInvProjection: me("m4"), uModelViewProjection: me("m4"), uInvModelViewProjection: me("m4"), uIsOrtho: me("f"), uPixelRatio: me("f"), uViewport: me("v4"), uViewOffset: me("v2"), uDrawingBufferSize: me("v2"), uCameraPosition: me("v3"), uCameraDir: me("v3"), uNear: me("f"), uFar: me("f"), uFogNear: me("f"), uFogFar: me("f"), uFogColor: me("v3"), uTransparentBackground: me("b"), uLightDirection: me("v3[]"), uLightColor: me("v3[]"), uAmbientColor: me("v3"), uPickingAlphaThreshold: me("f"), uInteriorDarkening: me("f"), uInteriorColorFlag: me("b"), uInteriorColor: me("v3"), uHighlightColor: me("v3"), uSelectColor: me("v3"), uHighlightStrength: me("f"), uSelectStrength: me("f"), uMarkerPriority: me("i"), uXrayEdgeFalloff: me("f"), uRenderWboit: me("b"), uMarkingDepthTest: me("b"), uMarkingType: me("i"), uPickType: me("i"), uInvalidColor: me("v3"), uInvalidStrength: me("f") }, Ku = { tDepth: Rt("texture", "depth", "ushort", "nearest") }, Yu = { uObjectId: me("i") }, _K = { uColor: me("v3", "material"), uColorTexDim: me("v2"), uColorGridDim: me("v3"), uColorGridTransform: me("v4"), tColor: Rt("image-uint8", "rgb", "ubyte", "nearest"), tPalette: Rt("image-uint8", "rgb", "ubyte", "nearest"), tColorGrid: Rt("texture", "rgb", "ubyte", "linear"), dColorType: Bt("string", ["uniform", "attribute", "instance", "group", "groupInstance", "vertex", "vertexInstance", "volume", "volumeInstance", "direct"]), dUsePalette: Bt("boolean") }, lh = { uSize: me("f", "material"), uSizeTexDim: me("v2"), tSize: Rt("image-uint8", "rgb", "ubyte", "nearest"), dSizeType: Bt("string", ["uniform", "attribute", "instance", "group", "groupInstance"]), uSizeFactor: me("f") }, xK = { uMarker: me("f"), uMarkerTexDim: me("v2"), tMarker: Rt("image-uint8", "alpha", "ubyte", "nearest"), markerAverage: Kr("number"), markerStatus: Kr("number") }, CK = { uOverpaintTexDim: me("v2"), tOverpaint: Rt("image-uint8", "rgba", "ubyte", "nearest"), dOverpaint: Bt("boolean"), uOverpaintGridDim: me("v3"), uOverpaintGridTransform: me("v4"), tOverpaintGrid: Rt("texture", "rgba", "ubyte", "linear"), dOverpaintType: Bt("string", ["groupInstance", "volumeInstance"]) }, SK = { uTransparencyTexDim: me("v2"), tTransparency: Rt("image-uint8", "alpha", "ubyte", "nearest"), dTransparency: Bt("boolean"), transparencyAverage: Kr("number"), uTransparencyGridDim: me("v3"), uTransparencyGridTransform: me("v4"), tTransparencyGrid: Rt("texture", "alpha", "ubyte", "linear"), dTransparencyType: Bt("string", ["groupInstance", "volumeInstance"]) }, AK = { uSubstanceTexDim: me("v2"), tSubstance: Rt("image-uint8", "rgba", "ubyte", "nearest"), dSubstance: Bt("boolean"), uSubstanceGridDim: me("v3"), uSubstanceGridTransform: me("v4"), tSubstanceGrid: Rt("texture", "rgba", "ubyte", "linear"), dSubstanceType: Bt("string", ["groupInstance", "volumeInstance"]) }, wK = { uClippingTexDim: me("v2"), tClipping: Rt("image-uint8", "alpha", "ubyte", "nearest"), dClipping: Bt("boolean") }, ql = O(O(O(O(O(O(O({ dGeometryType: Bt("string", ["cylinders", "directVolume", "image", "lines", "mesh", "points", "spheres", "text", "textureMesh"]) }, _K), xK), CK), SK), AK), wK), { dLightCount: Bt("number"), dClipObjectCount: Bt("number"), dClipVariant: Bt("string", ["instance", "pixel"]), uClipObjectType: me("i[]"), uClipObjectInvert: me("b[]"), uClipObjectPosition: me("v3[]"), uClipObjectRotation: me("v4[]"), uClipObjectScale: me("v3[]"), aInstance: Vn("float32", 1, 1), aTransform: Vn("float32", 16, 1), uAlpha: me("f", "material"), uMetalness: me("f", "material"), uRoughness: me("f", "material"), uBumpiness: me("f", "material"), uVertexCount: me("i"), uInstanceCount: me("i"), uGroupCount: me("i"), uInvariantBoundingSphere: me("v4"), drawCount: Kr("number"), instanceCount: Kr("number"), alpha: Kr("number"), matrix: Kr("m4"), transform: Kr("float32"), extraTransform: Kr("float32"), hasReflection: Kr("boolean"), boundingSphere: Kr("sphere"), invariantBoundingSphere: Kr("sphere") }), da = `
precision highp float;

attribute vec2 aPosition;
uniform vec2 uQuadScale;

void main(void) {
    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
    gl_Position = vec4(position, 0.0, 1.0);
}
`, IK = ha(), Z6 = Object.keys({ colorBlended: "", colorWboit: "", pick: "", depth: "", marking: "" }), v3 = Z6.filter(function(e) {
  return e !== "colorWboit";
}), PK = Z6.filter(function(e) {
  return e !== "colorBlended";
}), MK = Object.keys({ compute: "" });
function pS(e, t, n, r, i) {
  return n = O(O({}, n), { dRenderVariant: R.create(t) }), i.dRenderVariant === void 0 && Object.defineProperty(i, "dRenderVariant", { value: Bt("string") }), e.resources.program(n, r, i);
}
function Wu(e, t, n, r, i, a, o) {
  return CD(e, t, n, r, i, a, o);
}
function gi(e, t, n, r, i, a) {
  return a === void 0 && (a = -1), CD(e, t, n, r, i, a, MK);
}
function CD(e, t, n, r, i, a, o) {
  var s = IK(), u = e.stats, l = e.state, c = e.resources, d = e.extensions, f = d.instancedArrays, p = d.vertexArrayObject;
  if (i.uVertexCount) {
    var g = i.uVertexCount.ref.value;
    i.aVertex = R.create(Tu(new Float32Array(g))), r.aVertex = Vn("float32", 1, 0);
  }
  for (var m = function(J, $) {
    var ee = {}, ce = {}, ae = {}, he = {}, Oe = {}, Ne = {};
    return Object.keys(J).forEach(function(Ue) {
      var Ze = J[Ue];
      Ze.type === "attribute" && (ee[Ue] = $[Ue]), Ze.type === "define" && (ce[Ue] = $[Ue]), Ze.type === "texture" && $[Ue] !== void 0 && (ae[Ue] = $[Ue]), Ze.type === "uniform" && $[Ue] !== void 0 && (Ze.variant === "material" ? Oe[Ue] = $[Ue] : Ze.variant === "buffered" ? Ne[Ue] = $[Ue] : he[Ue] = $[Ue]);
    }), { attributeValues: ee, defineValues: ce, textureValues: ae, uniformValues: he, materialUniformValues: Oe, bufferedUniformValues: Ne };
  }(r, i), v = m.attributeValues, h = m.defineValues, y = m.textureValues, x = m.uniformValues, S = m.materialUniformValues, b = m.bufferedUniformValues, _ = Object.entries(x), C = Object.entries(S), w = Object.entries(b), I = Object.entries(function(J) {
    var $ = {};
    return Object.keys(J).forEach(function(ee) {
      $[ee] = R.create(Bl(J[ee].ref.value));
    }), $;
  }(b)), M = Object.entries(h), E = function(J) {
    var $ = {};
    return Object.keys(J).forEach(function(ee) {
      $[ee] = J[ee].ref.version;
    }), $;
  }(i), T = function(J, $) {
    var ee = J.gl;
    switch ($) {
      case "points":
        return ee.POINTS;
      case "lines":
        return ee.LINES;
      case "line-strip":
        return ee.LINE_STRIP;
      case "line-loop":
        return ee.LINE_LOOP;
      case "triangles":
        return ee.TRIANGLES;
      case "triangle-strip":
        return ee.TRIANGLE_STRIP;
      case "triangle-fan":
        return ee.TRIANGLE_FAN;
    }
  }(e, t), P = {}, k = 0, D = o; k < D.length; k++) {
    var B = D[k];
    P[B] = pS(e, B, h, n, r);
  }
  var L, F = function(J, $, ee) {
    var ce = J.resources, ae = [];
    return Object.keys($).forEach(function(he) {
      var Oe = $[he];
      if (Oe.type === "texture") {
        var Ne = ee[he];
        if (Ne) if (Oe.kind === "texture") ae[ae.length] = [he, Ne.ref.value];
        else {
          var Ue = ce.texture(Oe.kind, Oe.format, Oe.dataType, Oe.filter);
          Ue.load(Ne.ref.value), ae[ae.length] = [he, Ue];
        }
      }
    }), ae;
  }(e, r, y), V = function(J, $, ee) {
    var ce = [];
    return Object.keys($).forEach(function(ae) {
      var he = $[ae];
      he.type === "attribute" && (ce[ce.length] = [ae, J.resources.attribute(ee[ae].ref.value, he.itemSize, he.divisor)]);
    }), ce;
  }(e, r, v), G = i.elements;
  G && G.ref.value && (L = c.elements(G.ref.value));
  for (var H = {}, q = 0, z = o; q < z.length; q++)
    B = z[q], H[B] = p ? c.vertexArray(P[B], V, L) : null;
  var K = i.drawCount.ref.value, Y = i.instanceCount.ref.value;
  u.drawCount += K, u.instanceCount += Y, u.instancedDrawCount += Y * K;
  var Z = { attributes: !1, defines: !1, elements: !1, textures: !1 }, X = !1, W = -1;
  return { id: s, materialId: a, getProgram: function(J) {
    return P[J];
  }, render: function(J, $) {
    if (K !== 0 && Y !== 0 && !e.isContextLost) {
      var ee = P[J];
      if (ee.id === W && l.currentRenderItemId === s) ee.setUniforms(_), $ && $.length > 0 ? (ee.bindTextures($, 0), ee.bindTextures(F, $.length)) : ee.bindTextures(F, 0);
      else {
        var ce = H[J];
        ee.id === l.currentProgramId && ee.id === W && a !== -1 && a === l.currentMaterialId || (ee.id !== l.currentProgramId && ee.use(), ee.setUniforms(C), l.currentMaterialId = a, W = ee.id), ee.setUniforms(_), ee.setUniforms(I), $ && $.length > 0 ? (ee.bindTextures($, 0), ee.bindTextures(F, $.length)) : ee.bindTextures(F, 0), ce ? (ce.bind(), L && L.bind()) : (L && L.bind(), ee.bindAttributes(V)), l.currentRenderItemId = s;
      }
      if (In) try {
        B6(e.gl);
      } catch (ae) {
        throw new Error("Framebuffer error rendering item id ".concat(s, ": '").concat(ae, "'"));
      }
      if (L ? f.drawElementsInstanced(T, K, L._dataType, 0, Y) : f.drawArraysInstanced(T, 0, K, Y), In) try {
        ik(e.gl);
      } catch (ae) {
        throw new Error("Draw error rendering item id ".concat(s, ": '").concat(ae, "'"));
      }
    }
  }, update: function() {
    if (function(De) {
      De.attributes = !1, De.defines = !1, De.elements = !1, De.textures = !1;
    }(Z), i.aVertex) {
      var J = i.uVertexCount.ref.value;
      i.aVertex.ref.value.length < J && R.update(i.aVertex, Tu(new Float32Array(J)));
    }
    for (var $ = 0, ee = M.length; $ < ee; ++$) {
      var ce = M[$], ae = ce[0];
      (de = ce[1]).ref.version !== E[ae] && (Z.defines = !0, E[ae] = de.ref.version);
    }
    if (Z.defines) for (var he = 0, Oe = o; he < Oe.length; he++)
      ae = Oe[he], P[ae].destroy(), P[ae] = pS(e, ae, h, n, r);
    for (i.drawCount.ref.version !== E.drawCount && (u.drawCount += i.drawCount.ref.value - K, u.instancedDrawCount += Y * i.drawCount.ref.value - Y * K, K = i.drawCount.ref.value, E.drawCount = i.drawCount.ref.version), i.instanceCount.ref.version !== E.instanceCount && (u.instanceCount += i.instanceCount.ref.value - Y, u.instancedDrawCount += i.instanceCount.ref.value * K - Y * K, Y = i.instanceCount.ref.value, E.instanceCount = i.instanceCount.ref.version), $ = 0, ee = V.length; $ < ee; ++$) {
      var Ne = V[$], Ue = (ae = Ne[0], Ne[1]);
      if ((de = v[ae]).ref.version !== E[ae]) {
        if (Ue.length >= de.ref.value.length) Ue.updateSubData(de.ref.value, 0, Ue.length);
        else {
          Ue.destroy();
          var Ze = r[ae], Se = Ze.itemSize, qe = Ze.divisor;
          V[$][1] = c.attribute(de.ref.value, Se, qe), Z.attributes = !0;
        }
        E[ae] = de.ref.version;
      }
    }
    if (L && i.elements.ref.version !== E.elements && (L.length >= i.elements.ref.value.length ? L.updateSubData(i.elements.ref.value, 0, L.length) : (L.destroy(), L = c.elements(i.elements.ref.value), Z.elements = !0), E.elements = i.elements.ref.version), Z.attributes || Z.defines || Z.elements) for (var Pe = 0, Xe = o; Pe < Xe.length; Pe++) {
      ae = Xe[Pe];
      var Ke = H[ae];
      Ke && Ke.destroy(), H[ae] = p ? c.vertexArray(P[ae], V, L) : null;
    }
    for ($ = 0, ee = F.length; $ < ee; ++$) {
      var de, we = F[$], Ie = (ae = we[0], we[1]);
      (de = y[ae]).ref.version !== E[ae] && (r[ae].kind !== "texture" ? (Ie.load(de.ref.value), Z.textures = !0) : F[$][1] = de.ref.value, E[ae] = de.ref.version);
    }
    for ($ = 0, ee = w.length; $ < ee; ++$) {
      var Ee = w[$], Le = (ae = Ee[0], Ee[1]);
      Le.ref.version !== E[ae] && (R.update(I[$][1], Bl(Le.ref.value)), E[ae] = Le.ref.version);
    }
    return Z;
  }, destroy: function() {
    if (!X) {
      for (var J = 0, $ = o; J < $.length; J++) {
        var ee = $[J];
        P[ee].destroy();
        var ce = H[ee];
        ce && ce.destroy();
      }
      F.forEach(function(ae) {
        var he = ae[0], Oe = ae[1];
        r[he].kind !== "texture" && Oe.destroy();
      }), V.forEach(function(ae) {
        return ae[0], ae[1].destroy();
      }), L && L.destroy(), u.drawCount -= K, u.instanceCount -= Y, u.instancedDrawCount -= Y * K, X = !0;
    }
  } };
}
var SD = ha();
function Xu(e, t, n) {
  return { id: SD(), materialId: e.materialId, values: t, state: n, render: function(r, i) {
    t.uAlpha && t.alpha && R.updateIfChanged(t.uAlpha, Ia(t.alpha.ref.value * n.alphaFactor, 0, 1)), e.render(r, i);
  }, getProgram: function(r) {
    return e.getProgram(r);
  }, update: function() {
    return e.update();
  }, dispose: function() {
    return e.destroy();
  } };
}
function vi(e, t) {
  return { id: SD(), values: t, render: function() {
    return e.render("compute");
  }, update: function() {
    return e.update();
  }, dispose: function() {
    return e.destroy();
  } };
}
var AD = new Float32Array([1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1]), Ei = { drawCount: Kr("number"), instanceCount: Kr("number"), aPosition: Vn("float32", 2, 0), uQuadScale: me("v2") }, Pi = { drawCount: R.create(6), instanceCount: R.create(1), aPosition: R.create(AD), uQuadScale: R.create(xe.create(1, 1)) }, EK = O(O({}, Ei), { tColor: Rt("texture", "rgba", "ubyte", "nearest"), uTexSize: me("v2") }), TK = gr("copy", da, `
precision highp float;
precision highp sampler2D;

uniform sampler2D tColor;
uniform vec2 uTexSize;

void main() {
    vec2 coords = gl_FragCoord.xy / uTexSize;
    gl_FragColor = texture2D(tColor, coords);
}
`);
function R5(e, t) {
  var n = O(O({}, Pi), { tColor: R.create(t), uTexSize: R.create(xe.create(t.getWidth(), t.getHeight())) }), r = O({}, EK);
  return vi(gi(e, "triangles", TK, r, n), n);
}
var i4, fa, Ui, hS = new Uint32Array([0, 1, 2, 1, 3, 2]), kK = new Float32Array([0, 1, 0, 0, 1, 1, 1, 0]), wD = { nearest: "Nearest", catmulrom: "Catmulrom (Cubic)", mitchell: "Mitchell (Cubic)", bspline: "B-Spline (Cubic)" }, DK = Object.keys(wD);
(function(e) {
  function t(i, a, o, s) {
    return s ? function(u, l, c, d) {
      var f = u.width, p = u.height;
      return R.update(d.imageTexture, u), R.update(d.imageTextureDim, xe.set(d.imageTextureDim.ref.value, f, p)), R.update(d.cornerBuffer, l), R.update(d.groupTexture, c), d;
    }(i, a, o, s) : function(u, l, c) {
      var d = pe(), f = -1, p = u.width, g = u.height, m = { kind: "image", imageTexture: R.create(u), imageTextureDim: R.create(xe.create(p, g)), cornerBuffer: R.create(l), groupTexture: R.create(c), get boundingSphere() {
        var v = function(y) {
          return pa([y.cornerBuffer.ref.version]);
        }(m);
        if (v !== f) {
          var h = function(y) {
            for (var x = A(), S = [], b = 0, _ = y.length; b < _; b += 3) {
              var C = A.fromArray(A(), y, b);
              S.push(C), A.add(x, x, C);
            }
            A.scale(x, x, 1 / (y.length / 3));
            for (var w = 0, I = 0, M = S; I < M.length; I++) {
              C = M[I];
              var E = A.distance(x, C);
              E > w && (w = E);
            }
            var T = pe.create(x, w);
            return pe.setExtrema(T, S), T;
          }(m.cornerBuffer.ref.value);
          pe.copy(d, h), f = v;
        }
        return d;
      } };
      return m;
    }(i, a, o);
  }
  function n(i) {
    return t(ci(0, 4, Uint8Array), i ? i.cornerBuffer.ref.value : new Float32Array(24), ci(0, 4, Uint8Array), i);
  }
  function r(i, a, o, s, u) {
    var l = o.instanceCount, c = o.groupCount, d = bo(o, e.Utils.createPositionIterator(i, a), s.color), f = ss(l * c), p = Al(), g = wl(), m = Pl(), v = Il(), h = { drawCount: hS.length, vertexCount: AD.length / 3, groupCount: c, instanceCount: l }, y = pe.clone(i.boundingSphere), x = Si(y, a.aTransform.ref.value, l);
    return O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("image") }, d), f), p), g), m), v), a), Qe.createValues(u, h)), { aPosition: i.cornerBuffer, aUv: R.create(kK), elements: R.create(hS), aGroup: R.create(Tu(new Float32Array(4))), boundingSphere: R.create(x), invariantBoundingSphere: R.create(y), uInvariantBoundingSphere: R.create(Nt.ofSphere(y)), dInterpolation: R.create(u.interpolation), uImageTexDim: i.imageTextureDim, tImageTex: i.imageTexture, tGroupTex: i.groupTexture });
  }
  e.create = t, e.createEmpty = n, e.Params = O(O({}, Qe.Params), { interpolation: N.Select("bspline", N.objectToOptions(wD)) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: r, createValuesSimple: function(i, a, o, s, u) {
    var l = Qe.createSimple(o, s, u), c = O(O({}, N.getDefaultValues(e.Params)), a);
    return r(i, l.transform, l.locationIterator, l.theme, c);
  }, updateValues: function(i, a) {
    Qe.updateValues(i, a), R.updateIfChanged(i.dInterpolation, a.interpolation);
  }, updateBoundingSphere: function(i, a) {
    var o = pe.clone(a.boundingSphere), s = Si(o, i.aTransform.ref.value, i.instanceCount.ref.value);
    pe.equals(s, i.boundingSphere.ref.value) || R.update(i.boundingSphere, s), pe.equals(o, i.invariantBoundingSphere.ref.value) || (R.update(i.invariantBoundingSphere, o), R.update(i.uInvariantBoundingSphere, Nt.fromSphere(i.uInvariantBoundingSphere.ref.value, o)));
  }, createRenderableState: function(i) {
    var a = Qe.createRenderableState(i);
    return a.opaque = !1, a;
  }, updateRenderableState: function(i, a) {
    Qe.updateRenderableState(i, a), i.opaque = !1;
  }, createPositionIterator: function() {
    return zr(1, 1, 1, function() {
      return ku;
    });
  } };
})(i4 || (i4 = {})), function(e) {
  function t(s, u, l, c, d, f, p, g, m) {
    return m ? function(v, h, y, x, S, b, _, C, w) {
      return C > w.cylinderCount && (R.update(w.mappingBuffer, v), R.update(w.indexBuffer, h)), w.cylinderCount = C, R.update(w.groupBuffer, y), R.update(w.startBuffer, x), R.update(w.endBuffer, S), R.update(w.scaleBuffer, b), R.update(w.capBuffer, _), w;
    }(s, u, l, c, d, f, p, g, m) : function(v, h, y, x, S, b, _, C) {
      var w, I = pe(), M = -1, E = -1, T = { kind: "cylinders", cylinderCount: C, mappingBuffer: R.create(v), indexBuffer: R.create(h), groupBuffer: R.create(y), startBuffer: R.create(x), endBuffer: R.create(S), scaleBuffer: R.create(b), capBuffer: R.create(_), get boundingSphere() {
        var P = r(T);
        if (P !== M) {
          var k = od(T.startBuffer.ref.value, 6 * T.cylinderCount, 6), D = od(T.endBuffer.ref.value, 6 * T.cylinderCount, 6);
          pe.expandBySphere(I, k, D), M = P;
        }
        return I;
      }, get groupMapping() {
        return T.groupBuffer.ref.version !== E && (w = Vm(T.groupBuffer.ref.value, T.cylinderCount, 6), E = T.groupBuffer.ref.version), w;
      }, setBoundingSphere: function(P) {
        pe.copy(I, P), M = r(T);
      } };
      return T;
    }(s, u, l, c, d, f, p, g);
  }
  function n(s) {
    return t(s ? s.mappingBuffer.ref.value : new Float32Array(0), s ? s.indexBuffer.ref.value : new Uint32Array(0), s ? s.groupBuffer.ref.value : new Float32Array(0), s ? s.startBuffer.ref.value : new Float32Array(0), s ? s.endBuffer.ref.value : new Float32Array(0), s ? s.scaleBuffer.ref.value : new Float32Array(0), s ? s.capBuffer.ref.value : new Float32Array(0), 0, s);
  }
  function r(s) {
    return pa([s.cylinderCount, s.mappingBuffer.ref.version, s.indexBuffer.ref.version, s.groupBuffer.ref.version, s.startBuffer.ref.version, s.endBuffer.ref.version, s.scaleBuffer.ref.version, s.capBuffer.ref.version]);
  }
  function i(s, u) {
    var l = 6 * s.cylinderCount, c = u.instanceCount.ref.value, d = Af(), f = d.position, p = s.startBuffer.ref.value, g = s.endBuffer.ref.value, m = u.aTransform.ref.value;
    return zr(l, c, 2, function(v, h) {
      var y = v % 6 == 0 ? p : g;
      return h < 0 ? A.fromArray(f, y, 3 * v) : A.transformMat4Offset(f, y, m, 0, 3 * v, 16 * h), d;
    });
  }
  function a(s, u, l, c, d) {
    var f = l.instanceCount, p = l.groupCount, g = bo(l, i(s, u), c.color), m = Hl(l, c.size), v = ss(f * p), h = Al(), y = wl(), x = Pl(), S = Il(), b = { drawCount: 4 * s.cylinderCount * 3, vertexCount: 6 * s.cylinderCount, groupCount: p, instanceCount: f }, _ = E0(m) * d.sizeFactor, C = pe.clone(s.boundingSphere), w = Si(C, u.aTransform.ref.value, f);
    return O(O(O(O(O(O(O(O(O(O(O({ dGeometryType: R.create("cylinders"), aMapping: s.mappingBuffer, aGroup: s.groupBuffer, aStart: s.startBuffer, aEnd: s.endBuffer, aScale: s.scaleBuffer, aCap: s.capBuffer, elements: s.indexBuffer, boundingSphere: R.create(w), invariantBoundingSphere: R.create(C), uInvariantBoundingSphere: R.create(Nt.ofSphere(C)) }, g), m), v), h), y), x), S), u), { padding: R.create(_) }), Qe.createValues(d, b)), { uSizeFactor: R.create(d.sizeFactor * d.sizeAspectRatio), uDoubleSided: R.create(d.doubleSided), dIgnoreLight: R.create(d.ignoreLight), dXrayShaded: R.create(d.xrayShaded), uBumpFrequency: R.create(d.bumpFrequency), uBumpAmplitude: R.create(d.bumpAmplitude) });
  }
  function o(s, u) {
    Qe.updateRenderableState(s, u), s.opaque = s.opaque && !u.xrayShaded, s.writeDepth = s.opaque;
  }
  e.create = t, e.createEmpty = n, e.transform = function(s, u) {
    var l = s.startBuffer.ref.value;
    rm(u, l, 0, 6 * s.cylinderCount), R.update(s.startBuffer, l);
    var c = s.endBuffer.ref.value;
    rm(u, c, 0, 6 * s.cylinderCount), R.update(s.endBuffer, c);
  }, e.Params = O(O({}, Qe.Params), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), sizeAspectRatio: N.Numeric(1, { min: 0, max: 3, step: 0.01 }), doubleSided: N.Boolean(!1, Qe.CustomQualityParamInfo), ignoreLight: N.Boolean(!1, Qe.ShadingCategory), xrayShaded: N.Boolean(!1, Qe.ShadingCategory), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), bumpAmplitude: N.Numeric(1, { min: 0, max: 5, step: 0.1 }, Qe.ShadingCategory) }), e.Utils = { Params: e.Params, createEmpty: n, createValues: a, createValuesSimple: function(s, u, l, c, d) {
    var f = Qe.createSimple(l, c, d), p = O(O({}, N.getDefaultValues(e.Params)), u);
    return a(s, f.transform, f.locationIterator, f.theme, p);
  }, updateValues: function(s, u) {
    Qe.updateValues(s, u), R.updateIfChanged(s.uSizeFactor, u.sizeFactor * u.sizeAspectRatio), R.updateIfChanged(s.uDoubleSided, u.doubleSided), R.updateIfChanged(s.dIgnoreLight, u.ignoreLight), R.updateIfChanged(s.dXrayShaded, u.xrayShaded), R.updateIfChanged(s.uBumpFrequency, u.bumpFrequency), R.updateIfChanged(s.uBumpAmplitude, u.bumpAmplitude);
  }, updateBoundingSphere: function(s, u) {
    var l = pe.clone(u.boundingSphere), c = Si(l, s.aTransform.ref.value, s.instanceCount.ref.value);
    pe.equals(c, s.boundingSphere.ref.value) || R.update(s.boundingSphere, c), pe.equals(l, s.invariantBoundingSphere.ref.value) || (R.update(s.invariantBoundingSphere, l), R.update(s.uInvariantBoundingSphere, Nt.fromSphere(s.uInvariantBoundingSphere.ref.value, l)));
  }, createRenderableState: function(s) {
    var u = Qe.createRenderableState(s);
    return o(u, s), u;
  }, updateRenderableState: o, createPositionIterator: i };
}(fa || (fa = {})), function(e) {
  function t(n) {
    switch (n.kind) {
      case "mesh":
        return 3 * n.triangleCount;
      case "points":
        return n.pointCount;
      case "spheres":
        return 2 * n.sphereCount * 3;
      case "cylinders":
        return 4 * n.cylinderCount * 3;
      case "text":
        return 2 * n.charCount * 3;
      case "lines":
        return 2 * n.lineCount * 3;
      case "direct-volume":
        return 36;
      case "image":
        return 6;
      case "texture-mesh":
        return n.vertexCount;
    }
  }
  e.getDrawCount = t, e.getVertexCount = function(n) {
    switch (n.kind) {
      case "mesh":
      case "texture-mesh":
        return n.vertexCount;
      case "points":
        return n.pointCount;
      case "spheres":
        return 4 * n.sphereCount;
      case "cylinders":
        return 6 * n.cylinderCount;
      case "text":
        return 4 * n.charCount;
      case "lines":
        return 4 * n.lineCount;
      case "direct-volume":
        var r = n.gridDimension.ref.value;
        return r[0] * r[1] * r[2];
      case "image":
        return 4;
    }
  }, e.getGroupCount = function(n) {
    switch (n.kind) {
      case "mesh":
      case "points":
      case "spheres":
      case "cylinders":
      case "text":
      case "lines":
        return t(n) === 0 ? 0 : Kg(n.groupBuffer.ref.value) + 1;
      case "direct-volume":
        return 1;
      case "image":
        return Kg(n.groupTexture.ref.value.array) + 1;
      case "texture-mesh":
        return n.groupCount;
    }
  }, e.getUtils = function(n) {
    switch (n.kind) {
      case "mesh":
        return Lt.Utils;
      case "points":
        return wf.Utils;
      case "spheres":
        return Hs.Utils;
      case "cylinders":
        return fa.Utils;
      case "text":
        return Co.Utils;
      case "lines":
        return Mn.Utils;
      case "direct-volume":
        return lv.Utils;
      case "image":
        return i4.Utils;
      case "texture-mesh":
        return sd.Utils;
    }
  }, e.getGranularity = function(n, r) {
    return r === "instance" && n.nonInstanceable ? "group" : r;
  };
}(Ui || (Ui = {}));
var OK = Ae(13421772), gS = {};
function Q6(e, t) {
  return { factory: Q6, granularity: "groupInstance", color: function(n) {
    return wa.isLocation(n) ? n.shape.getColor(n.group, n.instance) : OK;
  }, props: t, description: "Assigns colors as defined by the shape object." };
}
var BK = { name: "shape-group", label: "Shape Group", category: "Miscellaneous", factory: Q6, getParams: function(e) {
  return gS;
}, defaultValues: N.getDefaultValues(gS), isApplicable: function(e) {
  return !!e.shape;
} }, RK = O(O({}, ql), { aPosition: Vn("float32", 3, 0), elements: Rf("uint32"), uBboxMin: me("v3"), uBboxMax: me("v3"), uBboxSize: me("v3"), uMaxSteps: me("i"), uStepScale: me("f"), uJumpLength: me("f"), uTransform: me("m4"), uGridDim: me("v3"), tTransferTex: Rt("image-uint8", "alpha", "ubyte", "linear"), uTransferScale: me("f"), dGridTexType: Bt("string", ["2d", "3d"]), uGridTexDim: me("v3"), tGridTex: Rt("texture", "rgba", "ubyte", "linear"), uGridStats: me("v4"), uCellDim: me("v3"), uCartnToUnit: me("m4"), uUnitToCartn: me("m4"), dPackedGroup: Bt("boolean"), dAxisOrder: Bt("string", ["012", "021", "102", "120", "201", "210"]), dIgnoreLight: Bt("boolean"), dXrayShaded: Bt("boolean") }), LK = O(O({}, ql), { aGroup: Vn("float32", 1, 0), aPosition: Vn("float32", 3, 0), aNormal: Vn("float32", 3, 0), elements: Rf("uint32"), dFlatShaded: Bt("boolean"), uDoubleSided: me("b"), dFlipSided: Bt("boolean"), dIgnoreLight: Bt("boolean"), dXrayShaded: Bt("boolean"), uBumpFrequency: me("f"), uBumpAmplitude: me("f"), meta: Kr("unknown") }), NK = O(O(O({}, ql), lh), { aGroup: Vn("float32", 1, 0), aPosition: Vn("float32", 3, 0), dPointSizeAttenuation: Bt("boolean"), dPointStyle: Bt("string", ["square", "circle", "fuzzy"]) }), FK = O(O(O({}, ql), lh), { aGroup: Vn("float32", 1, 0), aMapping: Vn("float32", 2, 0), aStart: Vn("float32", 3, 0), aEnd: Vn("float32", 3, 0), elements: Rf("uint32"), dLineSizeAttenuation: Bt("boolean"), uDoubleSided: me("b"), dFlipSided: Bt("boolean") }), VK = O(O(O({}, ql), lh), { aGroup: Vn("float32", 1, 0), aPosition: Vn("float32", 3, 0), aMapping: Vn("float32", 2, 0), elements: Rf("uint32"), padding: Kr("number"), uDoubleSided: me("b"), dIgnoreLight: Bt("boolean"), dXrayShaded: Bt("boolean"), uBumpFrequency: me("f"), uBumpAmplitude: me("f") }), GK = O(O(O({}, ql), lh), { aGroup: Vn("float32", 1, 0), aPosition: Vn("float32", 3, 0), aMapping: Vn("float32", 2, 0), aDepth: Vn("float32", 1, 0), elements: Rf("uint32"), aTexCoord: Vn("float32", 2, 0), tFont: Rt("image-uint8", "alpha", "ubyte", "linear"), padding: Kr("number"), uBorderWidth: me("f"), uBorderColor: me("v3"), uOffsetX: me("f"), uOffsetY: me("f"), uOffsetZ: me("f"), uBackgroundColor: me("v3"), uBackgroundOpacity: me("f") }), zK = O(O({}, ql), { uGeoTexDim: me("v2", "buffered"), tPosition: Rt("texture", "rgb", "float", "nearest"), tGroup: Rt("texture", "alpha", "float", "nearest"), tNormal: Rt("texture", "rgb", "float", "nearest"), dFlatShaded: Bt("boolean"), uDoubleSided: me("b"), dFlipSided: Bt("boolean"), dIgnoreLight: Bt("boolean"), dXrayShaded: Bt("boolean"), uBumpFrequency: me("f"), uBumpAmplitude: me("f"), meta: Kr("unknown") }), UK = O(O({}, ql), { aGroup: Vn("float32", 1, 0), aPosition: Vn("float32", 3, 0), aUv: Vn("float32", 2, 0), elements: Rf("uint32"), uImageTexDim: me("v2"), tImageTex: Rt("image-uint8", "rgba", "ubyte", "nearest"), tGroupTex: Rt("image-uint8", "rgba", "ubyte", "nearest"), dInterpolation: Bt("string", DK) }), HK = O(O(O({}, ql), lh), { aGroup: Vn("float32", 1, 0), aStart: Vn("float32", 3, 0), aEnd: Vn("float32", 3, 0), aMapping: Vn("float32", 3, 0), aScale: Vn("float32", 1, 0), aCap: Vn("float32", 1, 0), elements: Rf("uint32"), padding: Kr("number"), uDoubleSided: me("b"), dIgnoreLight: Bt("boolean"), dXrayShaded: Bt("boolean"), uBumpFrequency: me("f"), uBumpAmplitude: me("f") }), Wt, wa, qK = ha(0, 2147483647), jl = ha(0, 2147483647);
function Gm(e, t, n, r) {
  return { id: qK(), type: e, values: t, state: n, materialId: r };
}
function jK(e, t, n) {
  switch (t.type) {
    case "mesh":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), LK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", sx, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "points":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), NK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "points", eU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "spheres":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), VK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", tU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "cylinders":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), HK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", nU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "text":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), GK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", rU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "lines":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), FK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", iU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "direct-volume":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), RK);
        r.isWebGL2 || (l.uMaxSteps = Bt("number"));
        var c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", aU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "image":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), UK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", oU, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
    case "texture-mesh":
      return function(r, i, a, o, s, u) {
        var l = O(O(O(O({}, ju), Ku), Yu), zK), c = { uObjectId: R.create(i) };
        return Xu(Wu(r, "triangles", sx, l, O(O({}, a), c), s, u), a, o);
      }(e, t.id, t.values, t.state, t.materialId, n);
  }
  throw new Error("unsupported type");
}
(function(e) {
  function t(n) {
    var r = n.transforms.length, i = wa.Location(n);
    return zr(n.groupCount, r, 1, function(a, o) {
      return i.group = a, i.instance = o, i;
    });
  }
  e.create = function(n, r, i, a, o, s, u) {
    return { id: di.create22(), name: n, sourceData: r, geometry: i, transforms: u || [ne.identity()], get groupCount() {
      return Ui.getGroupCount(i);
    }, getColor: a, getSize: o, getLabel: s };
  }, e.getTheme = function(n) {
    return { color: Q6(0, {}), size: J6({ shape: n }, {}) };
  }, e.groupIterator = t, e.createTransform = function(n, r) {
    for (var i = r && r.aTransform.ref.value.length >= 16 * n.length ? r.aTransform.ref.value : new Float32Array(16 * n.length), a = 0, o = n.length; a < o; ++a) ne.toArray(n[a], i, 16 * a);
    return K6(i, n.length, r);
  }, e.createRenderObject = function(n, r) {
    var i = e.getTheme(n), a = Ui.getUtils(n.geometry), o = jl(), s = t(n), u = e.createTransform(n.transforms), l = a.createValues(n.geometry, u, s, i, r), c = a.createRenderableState(r);
    return Gm(n.geometry.kind, l, c, o);
  }, e.Loci = function(n) {
    return { kind: "shape-loci", shape: n };
  }, e.isLoci = function(n) {
    return !!n && n.kind === "shape-loci";
  }, e.areLociEqual = function(n, r) {
    return n.shape === r.shape;
  }, e.isLociEmpty = function(n) {
    return n.shape.groupCount === 0;
  };
})(Wt || (Wt = {})), function(e) {
  function t(o) {
    for (var s = 0, u = 0, l = o.groups; u < l.length; u++) {
      var c = l[u];
      s += _e.size(c.ids);
    }
    return s;
  }
  e.Location = function(o, s, u) {
    return s === void 0 && (s = 0), u === void 0 && (u = 0), { kind: "group-location", shape: o, group: s, instance: u };
  }, e.isLocation = function(o) {
    return !!o && o.kind === "group-location";
  }, e.Loci = function(o, s) {
    return { kind: "group-loci", shape: o, groups: s };
  }, e.isLoci = function(o) {
    return !!o && o.kind === "group-loci";
  }, e.areLociEqual = function(o, s) {
    if (o.shape !== s.shape || o.groups.length !== s.groups.length) return !1;
    for (var u = 0, l = o.groups.length; u < l; ++u) {
      var c = o.groups[u], d = c.ids, f = c.instance, p = s.groups[u], g = p.ids;
      if (f !== p.instance || !_e.areEqual(d, g)) return !1;
    }
    return !0;
  }, e.isLociEmpty = function(o) {
    return t(o) === 0;
  }, e.size = t;
  var n = new J1(), r = A.zero();
  function i(o, s, u, l) {
    for (var c = s.indices, d = s.offsets, f = function(v, h) {
      _e.forEach(v, function(y) {
        for (var x = d[y], S = d[y + 1]; x < S; ++x) A.fromArray(r, u, 3 * c[x]), A.transformMat4(r, r, l[h]), n.includeStep(r);
      });
    }, p = 0, g = o; p < g.length; p++) {
      var m = g[p];
      f(m.ids, m.instance);
    }
  }
  function a(o, s, u, l) {
    for (var c = s.indices, d = s.offsets, f = function(v, h) {
      _e.forEach(v, function(y) {
        for (var x = d[y], S = d[y + 1]; x < S; ++x) A.fromArray(r, u, 3 * c[x]), A.transformMat4(r, r, l[h]), n.radiusStep(r);
      });
    }, p = 0, g = o; p < g.length; p++) {
      var m = g[p];
      f(m.ids, m.instance);
    }
  }
  e.getBoundingSphere = function(o, s) {
    s || (s = pe()), n.reset();
    var u = 0, l = o.shape, c = l.geometry, d = l.transforms;
    if (c.kind === "mesh" || c.kind === "points") {
      var f = c.kind === "mesh" ? c.vertexBuffer.ref.value : c.centerBuffer.ref.value;
      i(o.groups, c.groupMapping, f, d), n.finishedIncludeStep(), a(o.groups, c.groupMapping, f, d);
    } else if (c.kind === "lines") {
      var p = c.startBuffer.ref.value, g = c.endBuffer.ref.value;
      i(o.groups, c.groupMapping, p, d), i(o.groups, c.groupMapping, g, d), n.finishedIncludeStep(), a(o.groups, c.groupMapping, p, d), a(o.groups, c.groupMapping, g, d);
    } else {
      if (c.kind !== "spheres" && c.kind !== "text") return pe.copy(s, c.boundingSphere);
      f = c.centerBuffer.ref.value, i(o.groups, c.groupMapping, f, d), n.finishedIncludeStep(), a(o.groups, c.groupMapping, f, d);
      for (var m = function(x, S) {
        _e.forEach(x, function(b) {
          var _ = o.shape.getSize(b, S);
          u < _ && (u = _);
        });
      }, v = 0, h = o.groups; v < h.length; v++) {
        var y = h[v];
        m(y.ids, y.instance);
      }
    }
    return A.copy(s.center, n.center), s.radius = Math.sqrt(n.radiusSq), pe.expand(s, s, u), s;
  };
}(wa || (wa = {}));
var KK = 1, YK = "Assigns sizes as defined by the shape object.", vS = {};
function J6(e, t) {
  return { factory: J6, granularity: "groupInstance", size: function(n) {
    return wa.isLocation(n) ? n.shape.getSize(n.group, n.instance) : KK;
  }, props: t, description: YK };
}
var WK = { name: "shape-group", label: "Shape Group", category: "", factory: J6, getParams: function(e) {
  return vS;
}, defaultValues: N.getDefaultValues(vS), isApplicable: function(e) {
  return !!e.shape;
} }, yS = { bfactorFactor: N.Numeric(0.1, { min: 0, max: 1, step: 0.01 }), rmsfFactor: N.Numeric(0.05, { min: 0, max: 1, step: 0.01 }), baseSize: N.Numeric(0.2, { min: 0, max: 2, step: 0.1 }) };
function bS(e, t, n) {
  return ve.isAtomic(e) ? e.model.atomicConformation.B_iso_or_equiv.value(t) * n.bfactorFactor : ve.isSpheres(e) ? e.model.coarseConformation.spheres.rmsf[t] * n.rmsfFactor : 0;
}
var XK = { name: "uncertainty", label: "Uncertainty/Disorder", category: "", factory: function e(t, n) {
  return { factory: e, granularity: "group", size: function(r) {
    var i = n.baseSize;
    return He.is(r) ? i += bS(r.unit, r.element, n) : pt.isLocation(r) && (i += bS(r.aUnit, r.aUnit.elements[r.aIndex], n)), i;
  }, props: n, description: "Assigns a size reflecting the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique." };
}, getParams: function(e) {
  return yS;
}, defaultValues: N.getDefaultValues(yS), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return t.atomicConformation.B_iso_or_equiv.isDefined || t.coarseHierarchy.isDefined;
  });
} }, _S = { hydrogenSize: N.Numeric(0.2, { min: 0, max: 10, step: 0.1 }), oxygenSize: N.Numeric(0.2, { min: 0, max: 10, step: 0.1 }), baseSize: N.Numeric(0.2, { min: 0, max: 2, step: 0.1 }) }, Ea, us, ZK = { name: "aquasite", label: "Aquasite", category: "", factory: function e(t, n) {
  return { factory: e, granularity: "group", size: function(r) {
    var i = n.baseSize;
    return He.is(r) && (i += function(a, o, s) {
      if (ve.isAtomic(a)) {
        var u = a.model.atomicHierarchy.atoms.type_symbol.value(o).toUpperCase();
        return u === "H" ? s.hydrogenSize : u === "O" ? s.oxygenSize : 0;
      }
      return 0;
    }(r.unit, r.element, n)), i;
  }, props: n, description: "Aquasite" };
}, getParams: function(e) {
  return _S;
}, defaultValues: N.getDefaultValues(_S), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return t.atomicConformation.B_iso_or_equiv.isDefined || t.coarseHierarchy.isDefined;
  });
} };
function xS(e) {
  return e.map(function(t) {
    return [t.name, t.provider.label, t.provider.category];
  });
}
(function(e) {
  e.EmptyFactory = function() {
    return e.Empty;
  }, e.Empty = { factory: e.EmptyFactory, granularity: "uniform", size: function() {
    return 1;
  }, props: {} }, e.areEqual = function(t, n) {
    return t.factory === n.factory && id(t.props, n.props);
  }, e.EmptyProvider = { name: "", label: "", category: "", factory: e.EmptyFactory, getParams: function() {
    return {};
  }, defaultValues: {}, isApplicable: function() {
    return !0;
  } }, e.createRegistry = function() {
    return new ID(e.BuiltIn, e.EmptyProvider);
  }, e.BuiltIn = { physical: aK, "shape-group": WK, uncertainty: XK, uniform: iK, aquasite: ZK };
})(Ea || (Ea = {})), function(e) {
  function t() {
    return { color: Ll.Empty, size: Ea.Empty };
  }
  e.create = function(n, r, i, a) {
    a = a || t();
    var o = i.colorTheme, s = i.sizeTheme;
    return a.color = n.colorThemeRegistry.create(o.name, r, o.params), a.size = n.sizeThemeRegistry.create(s.name, r, s.params), a;
  }, e.createEmpty = t, e.ensureDependencies = function(n, r, i, a) {
    var o, s;
    return se(this, 0, void 0, function() {
      return ie(this, function(u) {
        switch (u.label) {
          case 0:
            return [4, (o = r.colorThemeRegistry.get(a.colorTheme.name).ensureCustomProperties) === null || o === void 0 ? void 0 : o.attach(n, i)];
          case 1:
            return u.sent(), [4, (s = r.sizeThemeRegistry.get(a.sizeTheme.name).ensureCustomProperties) === null || s === void 0 ? void 0 : s.attach(n, i)];
          case 2:
            return u.sent(), [2];
        }
      });
    });
  }, e.releaseDependencies = function(n, r, i) {
    var a, o;
    (a = n.colorThemeRegistry.get(i.colorTheme.name).ensureCustomProperties) === null || a === void 0 || a.detach(r), (o = n.sizeThemeRegistry.get(i.sizeTheme.name).ensureCustomProperties) === null || o === void 0 || o.detach(r);
  };
}(us || (us = {}));
var ID = function() {
  function e(t, n) {
    var r = this;
    this.emptyProvider = n, this._list = [], this._map = /* @__PURE__ */ new Map(), this._name = /* @__PURE__ */ new Map(), FT(t, function(i, a) {
      if (i.name !== a) throw new Error("Fix build in themes to have matching names. ".concat(i.name, " ").concat(a));
      r.add(i);
    });
  }
  return Object.defineProperty(e.prototype, "default", { get: function() {
    return this._list[0];
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "list", { get: function() {
    return this._list;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "types", { get: function() {
    return xS(this._list);
  }, enumerable: !1, configurable: !0 }), e.prototype.sort = function() {
    this._list.sort(function(t, n) {
      return t.provider.category === n.provider.category ? t.provider.label < n.provider.label ? -1 : t.provider.label > n.provider.label ? 1 : 0 : t.provider.category < n.provider.category ? -1 : 1;
    });
  }, e.prototype.add = function(t) {
    if (this._map.has(t.name)) throw new Error("".concat(t.name, " already registered."));
    var n = t.name;
    this._list.push({ name: n, provider: t }), this._map.set(n, t), this._name.set(t, n), this.sort();
  }, e.prototype.remove = function(t) {
    this._list.splice(this._list.findIndex(function(r) {
      return r.name === t.name;
    }), 1);
    var n = this._map.get(t.name);
    n && (this._map.delete(t.name), this._name.delete(n));
  }, e.prototype.has = function(t) {
    return this._map.has(t.name);
  }, e.prototype.get = function(t) {
    return this._map.get(t) || this.emptyProvider;
  }, e.prototype.getName = function(t) {
    if (!this._name.has(t)) throw new Error("'".concat(t.label, "' is not a registered theme provider."));
    return this._name.get(t);
  }, e.prototype.create = function(t, n, r) {
    r === void 0 && (r = {});
    var i = this.get(t);
    return i.factory(n, O(O({}, N.getDefaultValues(i.getParams(n))), r));
  }, e.prototype.getApplicableList = function(t) {
    return this._list.filter(function(n) {
      return n.provider.isApplicable(t);
    });
  }, e.prototype.getApplicableTypes = function(t) {
    return xS(this.getApplicableList(t));
  }, e;
}(), PD = { hue: N.Interval([1, 360], { min: 0, max: 360, step: 1 }), chroma: N.Interval([40, 70], { min: 0, max: 100, step: 1 }), luminance: N.Interval([15, 85], { min: 0, max: 100, step: 1 }), clusteringStepCount: N.Numeric(50, { min: 10, max: 200, step: 1 }, { isHidden: !0 }), minSampleCount: N.Numeric(800, { min: 100, max: 5e3, step: 100 }, { isHidden: !0 }) };
function CS(e, t) {
  return Math.sqrt(Math.pow(Math.abs(e[0] - t[0]), 2) + Math.pow(Math.abs(e[1] - t[1]), 2) + Math.pow(Math.abs(e[2] - t[2]), 2));
}
var n1 = 2, wd = [0, 0, 0], Id = [0, 0, 0];
function QK(e, t) {
  return Bi.toHcl(wd, e), Bi.fromColor(Id, Bi.toColor(e)), wd[0] >= t.hue[0] && wd[0] <= t.hue[1] && wd[1] >= t.chroma[0] && wd[1] <= t.chroma[1] && wd[2] >= t.luminance[0] && wd[2] <= t.luminance[1] && Id[0] >= e[0] - n1 && Id[0] <= e[0] + n1 && Id[1] >= e[1] - n1 && Id[1] <= e[1] + n1 && Id[2] >= e[2] - n1 && Id[2] <= e[2] + n1;
}
function JK(e, t) {
  t === void 0 && (t = {});
  var n = O(O({}, N.getDefaultValues(PD)), t);
  if (e <= 0) return [];
  var r = function(M, E) {
    for (var T = /* @__PURE__ */ new Map(), P = 1.001 * Math.cbrt(M), k = (E.hue[1] - E.hue[0]) / P, D = (E.chroma[1] - E.chroma[0]) / P, B = (E.luminance[1] - E.luminance[0]) / P, L = E.hue[0]; L <= E.hue[1]; L += k) for (var F = E.chroma[0]; F <= E.chroma[1]; F += D) for (var V = E.luminance[0]; V <= E.luminance[1]; V += B) {
      var G = Bi.fromHcl(Bi(), fu.create(L, F, V));
      QK(G, E) && T.set(G.toString(), G);
    }
    return Array.from(T.values());
  }(Math.max(n.minSampleCount, 5 * e), n);
  if (r.length < e) throw new Error("Not enough samples to generate distinct colors, increase sample count.");
  for (var i = [], a = [], o = Math.floor(r.length / e), s = 0; s < r.length && (i.push(r[s]), a.push([]), !(i.length >= e)); s += o) ;
  for (var u = 1; u <= n.clusteringStepCount; ++u) {
    var l = Bl(a);
    for (s = 0; s < r.length; ++s) {
      for (var c = Number.MAX_SAFE_INTEGER, d = 0, f = 0; f < i.length; f++) {
        var p = CS(r[s], i[f]);
        p < c && (c = p, d = f);
      }
      l[d].push(r[s]);
    }
    var g = Bl(i);
    for (s = 0; s < l.length; ++s) {
      for (var m = l[s], v = m.length, h = [], y = [], x = [], S = 0, b = m; S < b.length; S++) {
        var _ = b[S];
        h.push(_[0]), y.push(_[1]), x.push(_[2]);
      }
      var C = hg(h) / v, w = hg(y) / v, I = hg(x) / v;
      i[s] = [C, w, I];
    }
    if (id(g, i)) break;
  }
  return function(M) {
    for (var E = M.slice(0), T = [E.shift()]; E.length > 0; ) {
      for (var P = T[T.length - 1], k = 0, D = Number.MIN_SAFE_INTEGER, B = 0; B < E.length; ++B) {
        var L = CS(P, E[B]);
        L > D && (D = L, k = B);
      }
      T.push(E.splice(k, 1)[0]);
    }
    return T;
  }(i).map(function(M) {
    return Bi.toColor(M);
  });
}
var MD = { type: "generate", colorList: "red-yellow-blue" };
function Eo(e) {
  e === void 0 && (e = {});
  var t = O(O({}, MD), e);
  return { palette: N.MappedStatic(t.type, { colors: N.Group({ list: N.ColorList(t.colorList) }, { isFlat: !0 }), generate: N.Group(O(O({}, PD), { maxCount: N.Numeric(75, { min: 1, max: 250, step: 1 }) }), { isFlat: !0 }) }, { options: [["colors", "Color List"], ["generate", "Generate Distinct"]] }) };
}
N.getDefaultValues(Eo());
var SS = { valueLabel: function(e) {
  return "".concat(e + 1);
}, minLabel: "Start", maxLabel: "End" };
function Xs(e, t, n) {
  var r, i, a;
  if (n === void 0 && (n = {}), t.palette.name === "colors" && t.palette.params.list.kind === "interpolate") {
    var o = t.palette.params.list, s = [0, e - 1], u = O(O({}, SS), n), l = u.minLabel, c = u.maxLabel, d = o.colors;
    d.length === 0 && (d = Dl(MD.colorList).list);
    var f = Eu.create({ listOrName: d, domain: s, minLabel: l, maxLabel: c });
    a = f.legend, i = f.color;
  } else {
    var p;
    t.palette.name === "colors" ? (p = t.palette.params.list.colors.map(function(x) {
      return Array.isArray(x) ? x[0] : x;
    }), p.length === 0 && (p = Dl("dark-2").list.map(function(x) {
      return Array.isArray(x) ? x[0] : x;
    }))) : (e = Math.min(e, t.palette.params.maxCount), p = JK(e, t.palette.params));
    for (var g = (r = n.valueLabel) !== null && r !== void 0 ? r : SS.valueLabel, m = p.length, v = [], h = 0; h < e; ++h) {
      var y = h % m;
      v[y] === void 0 ? v[y] = [g(h), p[y]] : v[y][0] += ", ".concat(g(h));
    }
    a = Ws(v), i = function(x) {
      return p[x % m];
    };
  }
  return { color: i, legend: a };
}
var AS = Ae(16448250), $K = "Gives every chain a color based on its `asym_id` value.", If = O({ asymId: N.Select("auth", N.arrayToOptions(["auth", "label"])) }, Eo({ type: "colors", colorList: "many-distinct" }));
function wS(e, t) {
  var n = function(r, i) {
    switch (r.kind) {
      case 0:
        return i === "auth" ? Fe.chain.auth_asym_id : Fe.chain.label_asym_id;
      case 1:
      case 2:
        return Fe.coarse.asym_id;
    }
  }(e.unit, t)(e);
  return e.structure.root.models.length > 1 ? ED(e.unit.model, n) : n;
}
function ED(e, t) {
  return "".concat(t, "|").concat((nr.Index.get(e).value || 0) + 1);
}
function y3(e, t) {
  var n, r;
  if (e.structure) {
    var i = He.create(e.structure.root), a = function(u, l) {
      for (var c = /* @__PURE__ */ new Map(), d = function(g) {
        var m = nr.AsymIdOffset.get(g).value, v = (l === "auth" ? m == null ? void 0 : m.auth : m == null ? void 0 : m.label) || 0, h = 0;
        g.properties.structAsymMap.forEach(function(y, x) {
          var S = y.auth_id, b = l === "auth" ? S : x, _ = u.models.length > 1 ? ED(g, b) : b;
          c.has(_) || (c.set(_, h + v), ++h);
        });
      }, f = 0, p = u.models; f < p.length; f++) d(p[f]);
      return c;
    }(e.structure.root, t.asymId), o = Array.from(a.keys()), s = Xs(a.size, t, { valueLabel: function(u) {
      return o[u];
    } });
    r = s.legend, n = function(u) {
      var l = void 0;
      if (He.is(u)) {
        var c = wS(u, t.asymId);
        l = a.get(c);
      } else pt.isLocation(u) && (i.unit = u.aUnit, i.element = u.aUnit.elements[u.aIndex], c = wS(i, t.asymId), l = a.get(c));
      return l === void 0 ? AS : s.color(l);
    };
  } else n = function() {
    return AS;
  };
  return { factory: y3, granularity: "group", color: n, props: t, description: $K, legend: r };
}
var eY = { name: "chain-id", label: "Chain Id", category: "Chain Property", factory: y3, getParams: function(e) {
  var t, n = N.clone(If);
  return !((t = e.structure) === null || t === void 0) && t.models.some(function(r) {
    return r.coarseHierarchy.isDefined;
  }) && (n.asymId.defaultValue = "label"), n;
}, defaultValues: N.getDefaultValues(If), isApplicable: function(e) {
  return !!e.structure;
} }, IS = Ae(13421772), PS = O({}, Eo({ type: "colors", colorList: "red-yellow-blue" })), tY = { name: "element-index", label: "Element Index", category: "Atom Property", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    for (var a = t.structure.root.units, o = a.length, s = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), l = 0, c = 0; c < o; ++c) s.set(c, l), l += a[c].elements.length, u.set(a[c].id, c);
    var d = Xs(l, n);
    i = d.legend, r = function(f) {
      if (He.is(f)) {
        var p = u.get(f.unit.id), g = _e.findPredecessorIndex(a[p].elements, f.element);
        return d.color(s.get(p) + g);
      }
      return pt.isLocation(f) ? (p = u.get(f.aUnit.id), g = _e.findPredecessorIndex(a[p].elements, f.aUnit.elements[f.aIndex]), d.color(s.get(p) + g)) : IS;
    };
  } else r = function() {
    return IS;
  };
  return { factory: e, granularity: "groupInstance", preferSmoothing: !0, color: r, props: n, description: "Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.", legend: i };
}, getParams: function(e) {
  return PS;
}, defaultValues: N.getDefaultValues(PS), isApplicable: function(e) {
  return !!e.structure;
} };
function zm(e) {
  var t = {};
  return FT(e, function(n, r) {
    t[r] = N.Color(e[r]);
  }), t;
}
var MS = Ae(13421772), nY = "Assigns a color based on the operator name of a transformed chain.", am = O({}, Eo({ type: "colors", colorList: "many-distinct" }));
function $6(e, t) {
  var n, r;
  if (e.structure) {
    var i = function(s) {
      for (var u = /* @__PURE__ */ new Map(), l = 0, c = s.units.length; l < c; ++l) {
        var d = s.units[l].conformation.operator.name;
        u.has(d) || u.set(d, u.size);
      }
      return u;
    }(e.structure.root), a = Array.from(i.keys()), o = Xs(i.size, t, { valueLabel: function(s) {
      return a[s];
    } });
    r = o.legend, n = function(s) {
      var u = void 0;
      if (He.is(s)) {
        var l = s.unit.conformation.operator.name;
        u = i.get(l);
      } else if (pt.isLocation(s)) {
        var c = s.aUnit.conformation.operator.name;
        u = i.get(c);
      }
      return u === void 0 ? MS : o.color(u);
    };
  } else n = function() {
    return MS;
  };
  return { factory: $6, granularity: "instance", color: n, props: t, description: nY, legend: r };
}
var rY = { name: "operator-name", label: "Operator Name", category: "Symmetry", factory: $6, getParams: function(e) {
  return N.clone(am);
}, defaultValues: N.getDefaultValues(am), isApplicable: function(e) {
  return !!e.structure;
} }, ES = Ae(16448250), iY = "Gives every chain a color based on its `label_entity_id` value.", om = O({}, Eo({ type: "colors", colorList: "many-distinct" }));
function np(e, t) {
  return "".concat(e, "|").concat(t);
}
function TS(e) {
  switch (e.unit.kind) {
    case 0:
      return Fe.chain.label_entity_id(e);
    case 1:
    case 2:
      return Fe.coarse.entity_id(e);
  }
}
function b3(e, t) {
  var n, r;
  if (e.structure) {
    var i = He.create(e.structure.root), a = function(u) {
      for (var l = /* @__PURE__ */ new Map(), c = 0, d = u.models.length; c < d; ++c) {
        for (var f = u.models[c].atomicHierarchy.chains.label_entity_id, p = 0, g = f.rowCount; p < g; ++p) {
          var m = np(f.value(p), c);
          l.has(m) || l.set(m, l.size);
        }
        var v = u.models[c].coarseHierarchy;
        if (v.isDefined) {
          var h = v.spheres.entity_id;
          for (p = 0, g = h.rowCount; p < g; ++p) m = np(h.value(p), c), l.has(m) || l.set(m, l.size);
          var y = v.gaussians.entity_id;
          for (p = 0, g = y.rowCount; p < g; ++p) m = np(y.value(p), c), l.has(m) || l.set(m, l.size);
        }
      }
      return l;
    }(e.structure.root), o = Array.from(a.keys()), s = Xs(a.size, t, { valueLabel: function(u) {
      return o[u];
    } });
    r = s.legend, n = function(u) {
      var l = void 0;
      if (He.is(u)) {
        var c = np(TS(u), u.structure.models.indexOf(u.unit.model));
        l = a.get(c);
      } else pt.isLocation(u) && (i.unit = u.aUnit, i.element = u.aUnit.elements[u.aIndex], c = np(TS(i), i.structure.models.indexOf(i.unit.model)), l = a.get(c));
      return l === void 0 ? ES : s.color(l);
    };
  } else n = function() {
    return ES;
  };
  return { factory: b3, granularity: "group", color: n, props: t, description: iY, legend: r };
}
var aY = { name: "entity-id", label: "Entity Id", category: "Chain Property", factory: b3, getParams: function(e) {
  return N.clone(om);
}, defaultValues: N.getDefaultValues(om), isApplicable: function(e) {
  return !!e.structure;
} }, L5 = "dark-2", d2 = Ae(16448250), oY = "Gives ranges of a polymer chain a color based on the entity source it originates from (e.g. gene, plasmid, organism).", sm = O({}, Eo({ type: "colors", colorList: L5 }));
function TD(e, t) {
  return "".concat(e, "|").concat(t);
}
function sY(e, t, n, r, i, a) {
  return "".concat(e, "|").concat(t, "|").concat(n, "|").concat(a || i || r);
}
function a4(e, t, n, r, i, a, o, s) {
  for (var u = i.entity_id, l = i.pdbx_src_id, c = i.pdbx_beg_seq_num, d = i.pdbx_end_seq_num, f = 0, p = i._rowCount; f < p; ++f) {
    var g = u.value(f), m = TD(n, g), v = void 0;
    if (e.has(m)) v = e.get(m);
    else {
      var h = r.entities.getEntityIndex(g), y = r.sequence.sequences[h].sequence;
      v = new Int16Array(y.length), e.set(m, v);
    }
    var x = o ? o.value(f) : "", S = s ? s.value(f)[0] : "", b = sY(n, g, a.value(f), l.value(f), x, S), _ = c.valueKind(f) === 0 ? c.value(f) : 1, C = d.valueKind(f) === 0 ? d.value(f) : v.length, w = void 0;
    t.has(b) ? w = t.get(b) : (w = t.size + 1, t.set(b, w));
    for (var I = _, M = C; I <= M; ++I) v[I - 1] = w;
  }
}
function kD(e) {
  for (var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = 0, i = e.length; r < i; ++r) {
    var a = e[r];
    if (ur.is(a.sourceData)) {
      var o = a.sourceData.data.db, s = o.entity_src_gen, u = o.entity_src_nat, l = o.pdbx_entity_src_syn;
      a4(t, n, r, a, s, s.pdbx_gene_src_scientific_name, s.plasmid_name, s.pdbx_gene_src_gene), a4(t, n, r, a, u, u.pdbx_organism_scientific, u.pdbx_plasmid_name), a4(t, n, r, a, l, l.organism_scientific);
    }
  }
  return { seqToSrcByModelEntity: t, srcKeySerialMap: n };
}
function uY(e) {
  var t = 0;
  return Array.from(e.keys()).map(function(n) {
    var r = n.split("|"), i = r[2], a = function(o) {
      o = o.trim();
      var s = parseInt(o, 10);
      return !isNaN(s) && s.toString() === o;
    }(r[3]) ? "Unnamed ".concat(++t) : r[3];
    return "".concat(a).concat(i ? " (".concat(i, ")") : "");
  });
}
function _3(e, t) {
  var n, r;
  if (e.structure) {
    var i = He.create(e.structure), a = e.structure.root.models, o = kD(a), s = o.seqToSrcByModelEntity, u = o.srcKeySerialMap, l = uY(u), c = Xs(u.size, t, { valueLabel: function(f) {
      return l[f];
    } });
    r = c.legend;
    var d = function(f) {
      var p = TD(a.indexOf(f.unit.model), Fe.entity.id(f)), g = s.get(p);
      if (g) {
        var m = g[Fe.residue.label_seq_id(f) - 1] - 1;
        return m === -1 ? d2 : c.color(m);
      }
      return d2;
    };
    n = function(f) {
      return He.is(f) ? d(f) : pt.isLocation(f) ? (i.unit = f.aUnit, i.element = f.aUnit.elements[f.aIndex], d(i)) : d2;
    };
  } else n = function() {
    return d2;
  };
  return { factory: _3, granularity: "group", color: n, props: t, description: oY, legend: r };
}
var lY = { name: "entity-source", label: "Entity Source", category: "Chain Property", factory: _3, getParams: function(e) {
  var t = N.clone(sm);
  return e.structure && kD(e.structure.root.models).srcKeySerialMap.size > ja[L5].list.length && (t.palette.defaultValue.name = "colors", t.palette.defaultValue.params = O(O({}, t.palette.defaultValue.params), { list: { kind: "interpolate", colors: Dl(L5).list } })), t;
}, defaultValues: N.getDefaultValues(sm), isApplicable: function(e) {
  return !!e.structure;
} }, DD = { H: 13817304, D: 16777152, T: 16777120, HE: 14286847, LI: 13402367, BE: 12779264, B: 16758197, C: 9474192, N: 7370475, O: 15425118, F: 2543814, NE: 11789301, NA: 11230450, MG: 9109248, AL: 12560038, SI: 1578e4, P: 15654476, S: 15771392, CL: 1286709, AR: 8442339, K: 9388244, CA: 4062976, SC: 15132390, TI: 12567239, V: 10921643, CR: 9083335, MN: 10255047, FE: 14706227, CO: 15765664, NI: 5296208, CU: 13140019, ZN: 8224944, GA: 12750735, GE: 6721423, AS: 12419299, SE: 16752896, BR: 8860212, KR: 6076625, RB: 7351984, SR: 65280, Y: 9764863, ZR: 9756896, NB: 7586505, MO: 5551541, TC: 3907230, RU: 2396047, RH: 687500, PD: 27013, AG: 12632256, CD: 16767375, IN: 10909043, SN: 6717568, SB: 10380213, TE: 13924864, I: 9699476, XE: 9699476, CS: 5707663, BA: 51456, LA: 7394559, CE: 16777159, PR: 14286791, ND: 13107143, PM: 10747847, SM: 9437127, EU: 6422471, GD: 4587463, TB: 3211207, DY: 2097095, HO: 65436, ER: 58997, TM: 54354, YB: 48952, LU: 43812, HF: 5096191, TA: 5089023, W: 2200790, RE: 2522539, OS: 2516630, IR: 1528967, PT: 13684960, AU: 16765219, HG: 12105936, TL: 10900557, PB: 5724513, BI: 10375093, PO: 11230208, AT: 7688005, RN: 4358806, FR: 4325478, RA: 32e3, AC: 7384058, TH: 47871, PA: 41471, U: 36863, NP: 33023, PU: 27647, AM: 5528818, CM: 7888099, BK: 9064419, CF: 10565332, ES: 11739092, FM: 11739066, MD: 11734438, NO: 12389767, LR: 13041766, RF: 13369433, DB: 13697103, SG: 14221381, BH: 14680120, HS: 15073326, MT: 15400998, DS: 16777215, RG: 16777215, CN: 16777215, UUT: 16777215, FL: 16777215, UUP: 16777215, LV: 16777215, UUH: 16777215 }, OD = Ae(16777215), BD = { carbonColor: N.MappedStatic("chain-id", { "chain-id": N.Group(If), "entity-id": N.Group(om), "entity-source": N.Group(sm), "operator-name": N.Group(am), "element-symbol": N.EmptyGroup(), uniform: N.Group(uv) }, { description: "Use chain-id coloring for carbon atoms." }), saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0.2, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(DD)) }) };
function cY(e) {
  return BD;
}
function dY(e, t) {
  var n = e[t];
  return n === void 0 ? OD : n;
}
function RD(e, t) {
  var n = Of(t.colors.name === "default" ? DD : t.colors.params, t.saturation, t.lightness), r = t.carbonColor, i = r.name === "chain-id" ? y3(e, r.params).color : r.name === "entity-id" ? b3(e, r.params).color : r.name === "entity-source" ? _3(e, r.params).color : r.name === "operator-name" ? $6(e, r.params).color : r.name === "element-symbol" ? void 0 : r.name === "uniform" ? sh(0, r.params).color : Mi();
  function a(o, s) {
    return i && o === "C" ? i(s, !1) : dY(n, o);
  }
  return { factory: RD, granularity: t.carbonColor.name === "operator-name" ? "groupInstance" : "group", preferSmoothing: !0, color: function(o) {
    if (He.is(o)) {
      if (ve.isAtomic(o.unit)) return a(o.unit.model.atomicHierarchy.atoms.type_symbol.value(o.element), o);
    } else if (pt.isLocation(o) && ve.isAtomic(o.aUnit))
      return a(o.aUnit.model.atomicHierarchy.atoms.type_symbol.value(o.aUnit.elements[o.aIndex]), o);
    return OD;
  }, props: t, description: "Assigns a color to every atom according to its chemical element.", legend: Ws(Object.keys(n).map(function(o) {
    return [o, n[o]];
  })) };
}
var fY = { name: "element-symbol", label: "Element Symbol", category: "Atom Property", factory: RD, getParams: cY, defaultValues: N.getDefaultValues(BD), isApplicable: function(e) {
  return !!e.structure;
} }, LD = { water: 3697840, ion: 15729279, protein: 12496596, RNA: 16629894, DNA: 12540695, PNA: 4367514, saccharide: 8374655 }, N5 = Ae(16777113), mY = "Assigns a color based on the molecule type of a residue.", F5 = { saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(LD)) }) };
function kS(e, t, n) {
  switch (Nk(t, n)) {
    case 2:
      return e.water;
    case 3:
      return e.ion;
    case 5:
      return e.protein;
    case 6:
      return e.RNA;
    case 7:
      return e.DNA;
    case 8:
      return e.PNA;
    case 9:
      return e.saccharide;
  }
  return N5;
}
function e8(e, t) {
  var n = Of(t.colors.name === "default" ? LD : t.colors.params, t.saturation, t.lightness);
  return { factory: e8, granularity: "group", color: function(r) {
    return He.is(r) ? kS(n, r.unit, r.element) : pt.isLocation(r) ? kS(n, r.aUnit, r.aUnit.elements[r.aIndex]) : N5;
  }, props: t, description: mY, legend: Ws(Object.keys(n).map(function(r) {
    return [r, n[r]];
  }).concat([["Other/unknown", N5]])) };
}
var pY = { name: "molecule-type", label: "Molecule Type", category: "Residue Property", factory: e8, getParams: function(e) {
  return F5;
}, defaultValues: N.getDefaultValues(F5), isApplicable: function(e) {
  return !!e.structure;
} }, V5 = "dark-2", DS = Ae(16448250), OS = O({}, Eo({ type: "colors", colorList: V5 }));
function BS(e) {
  switch (e.kind) {
    case 0:
      return Fe.chain.label_asym_id;
    case 1:
    case 2:
      return Fe.coarse.asym_id;
  }
}
function RS(e) {
  for (var t = /* @__PURE__ */ new Map(), n = 0, r = e.unitSymmetryGroups.length; n < r; ++n) {
    var i = e.unitSymmetryGroups[n].units[0], a = i.model;
    if (ve.isAtomic(i)) for (var o = a.atomicHierarchy, s = o.chainAtomSegments, u = o.chains, l = Kt.transientSegments(s, i.elements); l.hasNext; ) {
      var c = l.move().index, d = u.label_entity_id.value(c), f = a.entities.getEntityIndex(d);
      if (a.entities.data.type.value(f) === "polymer") {
        var p = u.label_asym_id.value(c);
        t.has(p) || t.set(p, t.size);
      }
    }
    else if (ve.isCoarse(i)) {
      var g = ve.isSpheres(i) ? a.coarseHierarchy.spheres : a.coarseHierarchy.gaussians, m = g.chainElementSegments, v = g.asym_id, h = g.entity_id;
      for (l = Kt.transientSegments(m, i.elements); l.hasNext; ) {
        c = l.move().index;
        var y = m.offsets[c];
        d = h.value(y), f = a.entities.getEntityIndex(d), a.entities.data.type.value(f) === "polymer" && (p = v.value(y), t.has(p) || t.set(p, t.size));
      }
    }
  }
  return t;
}
var hY = { name: "polymer-id", label: "Polymer Chain Id", category: "Chain Property", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    var a = He.create(t.structure), o = RS(t.structure.root), s = Array.from(o.keys()), u = Xs(o.size, n, { valueLabel: function(l) {
      return s[l];
    } });
    i = u.legend, r = function(l) {
      var c = void 0;
      if (He.is(l)) {
        var d = BS(l.unit);
        c = o.get(d(l));
      } else pt.isLocation(l) && (d = BS(l.aUnit), a.unit = l.aUnit, a.element = l.aUnit.elements[l.aIndex], c = o.get(d(a)));
      return c === void 0 ? DS : u.color(c);
    };
  } else r = function() {
    return DS;
  };
  return { factory: e, granularity: "group", color: r, props: n, description: "Gives every polymer chain a color based on its `asym_id` value.", legend: i };
}, getParams: function(e) {
  var t = N.clone(OS);
  return e.structure && RS(e.structure.root).size > ja[V5].list.length && (t.palette.defaultValue.name = "colors", t.palette.defaultValue.params = O(O({}, t.palette.defaultValue.params), { list: { kind: "interpolate", colors: Dl(V5).list } })), t;
}, defaultValues: N.getDefaultValues(OS), isApplicable: function(e) {
  return !!e.structure;
} }, G5 = "dark-2", LS = Ae(13421772), NS = O({}, Eo({ type: "colors", colorList: G5 }));
function FS(e) {
  for (var t = 0, n = e.units, r = 0, i = n.length; r < i; ++r) n[r].polymerElements.length > 0 && ++t;
  return t;
}
var gY = { name: "polymer-index", label: "Polymer Chain Instance", category: "Chain Property", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    var a = Xs(FS(t.structure.root), n);
    i = a.legend;
    for (var o = t.structure.root.units, s = /* @__PURE__ */ new Map(), u = 0, l = 0, c = o.length; u < c; ++u) o[u].polymerElements.length > 0 && (s.set(o[u].id, a.color(l)), ++l);
    r = function(d) {
      var f;
      return He.is(d) ? f = s.get(d.unit.id) : pt.isLocation(d) && (f = s.get(d.aUnit.id)), f !== void 0 ? f : LS;
    };
  } else r = function() {
    return LS;
  };
  return { factory: e, granularity: "instance", color: r, props: n, description: "Gives every polymer chain instance a unique color based on the position (index) of the polymer in the list of polymers in the structure.", legend: i };
}, getParams: function(e) {
  var t = N.clone(NS);
  return e.structure && FS(e.structure.root) > ja[G5].list.length && (t.palette.defaultValue.name = "colors", t.palette.defaultValue.params = O(O({}, t.palette.defaultValue.params), { list: { kind: "interpolate", colors: Dl(G5).list } })), t;
}, defaultValues: N.getDefaultValues(NS), isApplicable: function(e) {
  return !!e.structure;
} }, ND = { ALA: 9240460, ARG: 124, ASN: 16743536, ASP: 10485826, CYS: 16777072, GLN: 16731212, GLU: 6684672, GLY: 15658734, HIS: 7368959, ILE: 19456, LEU: 4546117, LYS: 4671416, MET: 12099650, PHE: 5459026, PRO: 5395026, SER: 16740418, THR: 12078080, TRP: 5195264, TYR: 9203788, VAL: 16747775, A: 14423100, G: 3329330, I: 10145074, C: 16766720, T: 4286945, U: 4251856, DA: 14423100, DG: 3329330, DI: 10145074, DC: 16766720, DT: 4286945, DU: 4251856, APN: 14423100, GPN: 3329330, CPN: 16766720, TPN: 4286945, MOL: 0 }, z5 = Ae(16711935), VS = { saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(1, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(ND)) }) };
function GS(e, t) {
  return e.model.atomicHierarchy.atoms.label_comp_id.value(t);
}
function zS(e, t) {
  var n = e.coarseElements.seq_id_begin.value(t);
  if (n === e.coarseElements.seq_id_end.value(t)) {
    var r = e.coarseElements.entityKey[t];
    return e.model.sequence.byEntityKey[r].sequence.compId.value(n - 1);
  }
}
function f2(e, t) {
  var n = e[t];
  return n === void 0 ? z5 : n;
}
var vY = { name: "residue-name", label: "Residue Name", category: "Residue Property", factory: function e(t, n) {
  var r = Of(n.colors.name === "default" ? ND : n.colors.params, n.saturation, n.lightness);
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(i) {
    if (He.is(i)) {
      if (ve.isAtomic(i.unit)) {
        var a = GS(i.unit, i.element);
        return f2(r, a);
      }
      if (a = zS(i.unit, i.element)) return f2(r, a);
    } else if (pt.isLocation(i)) {
      if (ve.isAtomic(i.aUnit))
        return a = GS(i.aUnit, i.aUnit.elements[i.aIndex]), f2(r, a);
      if (a = zS(i.aUnit, i.aUnit.elements[i.aIndex])) return f2(r, a);
    }
    return z5;
  }, props: n, description: "Assigns a color to every residue according to its name.", legend: Ws(Object.keys(r).map(function(i) {
    return [i, r[i]];
  }).concat([["Unknown", z5]])) };
}, getParams: function(e) {
  return VS;
}, defaultValues: N.getDefaultValues(VS), isApplicable: function(e) {
  return !!e.structure;
} }, FD = { alphaHelix: 16711808, threeTenHelix: 10485888, piHelix: 6291584, betaTurn: 6324479, betaStrand: 16762880, coil: 16777215, bend: 6740169, turn: 45670, dna: 11403518, rna: 16580962, carbohydrate: 10921722 }, U5 = Ae(8421504), US = { saturation: N.Numeric(-1, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(FD)) }) };
function HS(e, t, n, r) {
  var i = gn.create(0);
  if (r && ve.isAtomic(t)) {
    var a = r.get(t.invariantId);
    a && (i = a.type[a.getIndex(t.residueIndex[n])]);
  }
  if (gn.is(i, 2)) return gn.is(i, 2048) ? e.threeTenHelix : gn.is(i, 32768) ? e.piHelix : e.alphaHelix;
  if (gn.is(i, 4)) return e.betaStrand;
  if (gn.is(i, 8)) return e.bend;
  if (gn.is(i, 16)) return e.turn;
  var o = Nk(t, n);
  return o === 7 ? e.dna : o === 6 ? e.rna : o === 9 ? e.carbohydrate : o === 5 ? e.coil : U5;
}
var yY = { name: "secondary-structure", label: "Secondary Structure", category: "Residue Property", factory: function e(t, n) {
  var r = t.structure && na.get(t.structure), i = r ? Bm(r.id, r.version) : -1, a = Of(n.colors.name === "default" ? FD : n.colors.params, n.saturation, n.lightness);
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(o) {
    return He.is(o) ? HS(a, o.unit, o.element, r == null ? void 0 : r.value) : pt.isLocation(o) ? HS(a, o.aUnit, o.aUnit.elements[o.aIndex], r == null ? void 0 : r.value) : U5;
  }, props: n, contextHash: i, description: "Assigns a color based on the type of secondary structure and basic molecule type.", legend: Ws(Object.keys(a).map(function(o) {
    return [o, a[o]];
  }).concat([["Other", U5]])) };
}, getParams: function(e) {
  return US;
}, defaultValues: N.getDefaultValues(US), isApplicable: function(e) {
  return !!e.structure;
}, ensureCustomProperties: { attach: function(e, t) {
  return t.structure ? na.attach(e, t.structure, void 0, !0) : Promise.resolve();
}, detach: function(e) {
  return e.structure && na.ref(e.structure, !1);
} } }, bY = Ae(13421772), qS = { list: N.ColorList("turbo", { presetKind: "scale" }) };
function jS(e, t) {
  var n = e.model;
  switch (e.kind) {
    case 0:
      var r = n.atomicHierarchy.residueAtomSegments.index[t];
      return n.atomicHierarchy.residues.label_seq_id.value(r);
    case 1:
      return Math.round((n.coarseHierarchy.spheres.seq_id_begin.value(t) + n.coarseHierarchy.spheres.seq_id_end.value(t)) / 2);
    case 2:
      return Math.round((n.coarseHierarchy.gaussians.seq_id_begin.value(t) + n.coarseHierarchy.gaussians.seq_id_end.value(t)) / 2);
  }
}
function KS(e, t) {
  var n = e.model, r = "";
  switch (e.kind) {
    case 0:
      var i = n.atomicHierarchy.chainAtomSegments.index[t];
      r = n.atomicHierarchy.chains.label_entity_id.value(i);
      break;
    case 1:
      r = n.coarseHierarchy.spheres.entity_id.value(t);
      break;
    case 2:
      r = n.coarseHierarchy.gaussians.entity_id.value(t);
  }
  if (r === "") return 0;
  var a = n.entities.getEntityIndex(r);
  if (a === -1) return 0;
  var o = n.sequence.byEntityKey[a];
  return o === void 0 ? 0 : o.sequence.length;
}
var _Y = { name: "sequence-id", label: "Sequence Id", category: "Residue Property", factory: function e(t, n) {
  var r = Eu.create({ listOrName: n.list.colors, minLabel: "Start", maxLabel: "End" });
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(i) {
    if (He.is(i)) {
      var a = i.unit, o = i.element;
      if ((s = jS(a, o)) > 0 && (u = KS(a, o))) return r.setDomain(0, u - 1), r.color(s);
    } else if (pt.isLocation(i)) {
      var s, u, l = i.aUnit, c = i.aIndex;
      if ((s = jS(l, l.elements[c])) > 0 && (u = KS(l, l.elements[c]))) return r.setDomain(0, u - 1), r.color(s);
    }
    return bY;
  }, props: n, description: "Gives every polymer residue a color based on its `seq_id` value.", legend: r ? r.legend : void 0 };
}, getParams: function(e) {
  return qS;
}, defaultValues: N.getDefaultValues(qS), isApplicable: function(e) {
  return !!e.structure;
} }, H5 = "dark-2", YS = Ae(13421772), WS = O({}, Eo({ type: "colors", colorList: H5 })), xY = { name: "unit-index", label: "Chain Instance", category: "Chain Property", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    var a = t.structure.root.units, o = Xs(a.length, n);
    i = o.legend;
    for (var s = /* @__PURE__ */ new Map(), u = 0, l = a.length; u < l; ++u) s.set(a[u].id, o.color(u));
    r = function(c) {
      return He.is(c) ? s.get(c.unit.id) : pt.isLocation(c) ? s.get(c.aUnit.id) : YS;
    };
  } else r = function() {
    return YS;
  };
  return { factory: e, granularity: "instance", color: r, props: n, description: "Gives every chain instance (single chain or collection of single elements) a unique color based on the position (index) of the chain in the list of chains in the structure.", legend: i };
}, getParams: function(e) {
  var t = N.clone(WS);
  return e.structure && e.structure.root.units.length > ja[H5].list.length && (t.palette.defaultValue.name = "colors", t.palette.defaultValue.params = O(O({}, t.palette.defaultValue.params), { list: { kind: "interpolate", colors: Dl(H5).list } })), t;
}, defaultValues: N.getDefaultValues(WS), isApplicable: function(e) {
  return !!e.structure;
} }, CY = Ae(16777113), XS = { domain: N.Interval([0, 100]), list: N.ColorList("red-white-blue", { presetKind: "scale" }) };
function ZS(e, t) {
  return ve.isAtomic(e) ? e.model.atomicConformation.B_iso_or_equiv.value(t) : ve.isSpheres(e) ? e.model.coarseConformation.spheres.rmsf[t] : 0;
}
var SY = { name: "uncertainty", label: "Uncertainty/Disorder", category: "Atom Property", factory: function e(t, n) {
  var r = Eu.create({ reverse: !0, domain: n.domain, listOrName: n.list.colors });
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(i) {
    return He.is(i) ? r.color(ZS(i.unit, i.element)) : pt.isLocation(i) ? r.color(ZS(i.aUnit, i.aUnit.elements[i.aIndex])) : CY;
  }, props: n, description: "Assigns a color based on the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique.", legend: r ? r.legend : void 0 };
}, getParams: function(e) {
  return XS;
}, defaultValues: N.getDefaultValues(XS), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return t.atomicConformation.B_iso_or_equiv.isDefined || t.coarseHierarchy.isDefined;
  });
} }, AY = Ae(15658734), QS = { style: N.MappedStatic("entity-id", { uniform: N.Group(uv), "chain-id": N.Group(If), "entity-id": N.Group(om), "entity-source": N.Group(sm), "molecule-type": N.Group(F5) }), carbonLightness: N.Numeric(0.8, { min: -6, max: 6, step: 0.1 }) }, wY = { name: "illustrative", label: "Illustrative", category: "Miscellaneous", factory: function e(t, n) {
  var r = n.style.name === "uniform" ? sh(0, n.style.params) : n.style.name === "chain-id" ? y3(t, n.style.params) : n.style.name === "entity-id" ? b3(t, n.style.params) : n.style.name === "entity-source" ? _3(t, n.style.params) : n.style.name === "molecule-type" ? e8(0, n.style.params) : Mi(n.style), i = r.color, a = r.legend;
  function o(s, u) {
    var l = i(s, !1);
    return u === "C" ? Ae.lighten(l, n.carbonLightness) : l;
  }
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(s) {
    if (He.is(s) && ve.isAtomic(s.unit)) {
      var u = s.unit.model.atomicHierarchy.atoms.type_symbol.value(s.element);
      return o(s, u);
    }
    if (pt.isLocation(s) && ve.isAtomic(s.aUnit)) {
      var l = s.aUnit.elements[s.aIndex];
      return u = s.aUnit.model.atomicHierarchy.atoms.type_symbol.value(l), o(s, u);
    }
    return AY;
  }, props: n, description: "Assigns an illustrative color that gives every chain a color based on the choosen style but with lighter carbons (inspired by David Goodsell's Molecule of the Month style).", legend: a };
}, getParams: function(e) {
  return N.clone(QS);
}, defaultValues: N.getDefaultValues(QS), isApplicable: function(e) {
  return !!e.structure;
} }, JS = { list: N.ColorList("red-yellow-green", { presetKind: "scale" }), scale: N.Select("DGwif", [["DGwif", "DG water-membrane"], ["DGwoct", "DG water-octanol"], ["Oct-IF", "DG difference"]]) }, IY = { DGwif: 0, DGwoct: 1, "Oct-IF": 2 };
function $S(e, t) {
  return e.model.atomicHierarchy.atoms.label_comp_id.value(t);
}
function eA(e, t) {
  var n = e.coarseElements.seq_id_begin.value(t);
  if (n === e.coarseElements.seq_id_end.value(t)) {
    var r = e.coarseElements.entityKey[t];
    return e.model.sequence.byEntityKey[r].sequence.compId.value(n - 1);
  }
}
var PY = { name: "hydrophobicity", label: "Hydrophobicity", category: "Residue Property", factory: function e(t, n) {
  var r = IY[n.scale], i = 1 / 0, a = -1 / 0;
  for (var o in Ay) {
    var s = Ay[o][r];
    i = Math.min(i, s), a = Math.max(a, s);
  }
  var u = Eu.create({ listOrName: n.list.colors, domain: [a, i], minLabel: "Hydrophilic", maxLabel: "Hydrophobic" });
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(l) {
    var c;
    return He.is(l) ? c = ve.isAtomic(l.unit) ? $S(l.unit, l.element) : eA(l.unit, l.element) : pt.isLocation(l) && (c = ve.isAtomic(l.aUnit) ? $S(l.aUnit, l.aUnit.elements[l.aIndex]) : eA(l.aUnit, l.aUnit.elements[l.aIndex])), u.color(c ? function(d, f) {
      var p = Ay[d];
      return p === void 0 ? 0 : p[f];
    }(c, r) : 0);
  }, props: n, description: 'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).', legend: u ? u.legend : void 0 };
}, getParams: function(e) {
  return JS;
}, defaultValues: N.getDefaultValues(JS), isApplicable: function(e) {
  return !!e.structure;
} }, tA = Ae(13421772), nA = O({}, Eo({ type: "colors", colorList: "purples" })), MY = { name: "model-index", label: "Model Index", category: "Chain Property", factory: function e(t, n) {
  var r, i, a, o;
  if (t.structure) {
    for (var s = t.structure.root.models, u = 0, l = 0, c = s; l < c.length; l++) {
      var d = c[l];
      u = Math.max(u, ((r = nr.TrajectoryInfo.get(d)) === null || r === void 0 ? void 0 : r.size) || 0);
    }
    var f = Xs(u, n);
    o = f.legend;
    for (var p = /* @__PURE__ */ new Map(), g = 0, m = s.length; g < m; ++g) {
      var v = ((i = nr.TrajectoryInfo.get(s[g])) === null || i === void 0 ? void 0 : i.index) || 0;
      p.set(v, f.color(v));
    }
    a = function(h) {
      return He.is(h) ? p.get(nr.TrajectoryInfo.get(h.unit.model).index) : pt.isLocation(h) ? p.get(nr.TrajectoryInfo.get(h.aUnit.model).index) : tA;
    };
  } else a = function() {
    return tA;
  };
  return { factory: e, granularity: "instance", color: a, props: n, description: "Gives every model a unique color based on the position (index) of the model in the list of models in the structure.", legend: o };
}, getParams: function(e) {
  return nA;
}, defaultValues: N.getDefaultValues(nA), isApplicable: function(e) {
  return !!e.structure && e.structure.elementCount > 0 && nr.TrajectoryInfo.get(e.structure.models[0]).size > 1;
} }, EY = Ae(13421772), rA = { domain: N.Interval([0, 1]), list: N.ColorList("purples", { presetKind: "scale" }) };
function iA(e, t) {
  return ve.isAtomic(e) ? e.model.atomicConformation.occupancy.value(t) : 0;
}
var TY = { name: "occupancy", label: "Occupancy", category: "Atom Property", factory: function e(t, n) {
  var r = Eu.create({ reverse: !1, domain: n.domain, listOrName: n.list.colors });
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(i) {
    return He.is(i) ? r.color(iA(i.unit, i.element)) : pt.isLocation(i) ? r.color(iA(i.aUnit, i.aUnit.elements[i.aIndex])) : EY;
  }, props: n, description: "Assigns a color based on the occupancy of an atom.", legend: r ? r.legend : void 0 };
}, getParams: function(e) {
  return rA;
}, defaultValues: N.getDefaultValues(rA), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return t.atomicConformation.occupancy.isDefined;
  });
} }, q5 = "dark-2", aA = Ae(13421772), oA = O({}, Eo({ type: "colors", colorList: q5 })), Gp = 1e4;
function j5(e) {
  return e.map(function(t) {
    return "".concat(t + Gp).padStart(5, "0");
  }).join("");
}
function K5(e) {
  var t = function(a, o) {
    return Math.abs(a) < o ? 0 : Math.floor(Math.log10(Math.abs(a))) + 1;
  }(Gp, 0), n = parseInt(e.substr(0, t)), r = parseInt(e.substr(t, t)), i = parseInt(e.substr(t + t, t));
  return [n - Gp, r - Gp, i - Gp];
}
function o4(e) {
  return e.map(function(t) {
    return t + 5;
  }).join("");
}
function sA(e) {
  for (var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = 0, i = e.units.length; r < i; ++r) {
    var a = j5(e.units[r].conformation.operator.hkl);
    n.add(a);
  }
  var o = Array.from(n.values()).sort();
  return o.forEach(function(s) {
    return t.set(s, t.size);
  }), { min: K5(o[0]), max: K5(o[o.length - 1]), map: t };
}
var Rl, kY = { name: "operator-hkl", label: "Operator HKL", category: "Symmetry", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    var a = sA(t.structure.root), o = a.min, s = a.max, u = a.map, l = [];
    u.forEach(function(f, p) {
      var g = f % u.size, m = o4(K5(p));
      l[g] === void 0 ? l[g] = m : l[g] += ", ".concat(m);
    });
    var c = { minLabel: o4(o), maxLabel: o4(s), valueLabel: function(f) {
      return l[f];
    } }, d = Xs(u.size, n, c);
    i = d.legend, r = function(f) {
      var p = void 0;
      if (He.is(f)) {
        var g = j5(f.unit.conformation.operator.hkl);
        p = u.get(g);
      } else pt.isLocation(f) && (g = j5(f.aUnit.conformation.operator.hkl), p = u.get(g));
      return p === void 0 ? aA : d.color(p);
    };
  } else r = function() {
    return aA;
  };
  return { factory: e, granularity: "instance", color: r, props: n, description: "Assigns a color based on the operator HKL value of a transformed chain.", legend: i };
}, getParams: function(e) {
  var t = N.clone(oA);
  return e.structure && sA(e.structure.root).map.size > ja[q5].list.length && (t.palette.defaultValue.name = "colors", t.palette.defaultValue.params = O(O({}, t.palette.defaultValue.params), { list: { kind: "interpolate", colors: Dl(q5).list } })), t;
}, defaultValues: N.getDefaultValues(oA), isApplicable: function(e) {
  return !!e.structure;
} };
(function(e) {
  e.Descriptor = { name: "atom_partial_charge" }, e.Provider = Au.create(e.Descriptor);
})(Rl || (Rl = {}));
var s4 = Ae(16777113), uA = { domain: N.Interval([-1, 1]), list: N.ColorList("red-white-blue", { presetKind: "scale" }) };
function lA(e, t) {
  var n;
  return (n = Rl.Provider.get(e.model)) === null || n === void 0 ? void 0 : n.data.value(t);
}
var DY = { name: "partial-charge", label: "Partial Charge", category: "Atom Property", factory: function e(t, n) {
  var r = Eu.create({ domain: n.domain, listOrName: n.list.colors });
  return { factory: e, granularity: "group", preferSmoothing: !0, color: function(i) {
    var a;
    return He.is(i) ? (a = lA(i.unit, i.element)) === void 0 || Number.isNaN(a) ? s4 : r.color(a) : pt.isLocation(i) ? (a = lA(i.aUnit, i.aUnit.elements[i.aIndex])) === void 0 || Number.isNaN(a) ? s4 : r.color(a) : s4;
  }, props: n, description: "Assigns a color based on the partial charge of an atom.", legend: r ? r.legend : void 0 };
}, getParams: function(e) {
  return uA;
}, defaultValues: N.getDefaultValues(uA), isApplicable: function(e) {
  return !!e.structure && e.structure.models.some(function(t) {
    return Rl.Provider.get(t) !== void 0;
  });
} }, cA = Ae(16448250), dA = O({}, Eo({ type: "colors", colorList: "many-distinct" })), OY = { name: "atom-id", label: "Atom Id", category: "Atom Property", factory: function e(t, n) {
  var r, i;
  if (t.structure) {
    var a = He.create(t.structure.root), o = function(l) {
      for (var c = /* @__PURE__ */ new Map(), d = 0, f = l.models; d < f.length; d++) for (var p = f[d].atomicHierarchy.atoms.label_atom_id, g = 0, m = p.rowCount; g < m; ++g) {
        var v = p.value(g);
        c.has(v) || c.set(v, c.size);
      }
      return c;
    }(t.structure.root), s = Array.from(o.keys()), u = Xs(o.size, n, { valueLabel: function(l) {
      return s[l];
    } });
    i = u.legend, r = function(l) {
      var c = void 0;
      if (He.is(l)) {
        var d = Fe.atom.label_atom_id(l);
        c = o.get(d);
      } else pt.isLocation(l) && (a.unit = l.aUnit, a.element = l.aUnit.elements[l.aIndex], d = Fe.atom.label_atom_id(a), c = o.get(d));
      return c === void 0 ? cA : u.color(c);
    };
  } else r = function() {
    return cA;
  };
  return { factory: e, granularity: "group", preferSmoothing: !0, color: r, props: n, description: "Gives every atom a color based on its `label_atom_id` value.", legend: i };
}, getParams: function(e) {
  return N.clone(dA);
}, defaultValues: N.getDefaultValues(dA), isApplicable: function(e) {
  return !!e.structure;
} }, BY = Ae(13421772), fA = { colorList: N.ColorList({ kind: "interpolate", colors: [[qt.white, 0], [qt.red, 0.25], [qt.white, 0.5], [qt.blue, 0.75], [qt.white, 1]] }, { offsets: !0, isEssential: !0 }) }, RY = { name: "volume-value", label: "Volume Value", category: "Miscellaneous", factory: function e(t, n) {
  for (var r = Eu.create({ domain: [0, 1], listOrName: n.colorList.colors }), i = [], a = 0; a < 256; ++a) i[a] = r.color(a / 255);
  var o = { colors: i, filter: "linear" };
  return { factory: e, granularity: "direct", color: function() {
    return BY;
  }, props: n, description: "Assign color based on the given value of a volume cell.", legend: r.legend, palette: o };
}, getParams: function(e) {
  return fA;
}, defaultValues: N.getDefaultValues(fA), isApplicable: function(e) {
  return !!e.volume;
} }, LY = Ae(13421772), mA = { list: N.ColorList("turbo", { presetKind: "scale" }) }, NY = { name: "uni-fold", label: "Uni-Fold", category: "Residue Property", factory: function e(t, n) {
  var r = Eu.create({ listOrName: n.list.colors, minLabel: "Start", maxLabel: "End" });
  return { factory: e, granularity: "group", color: function(i) {
    if (He.is(i)) {
      if (ve.isAtomic(i.unit)) {
        if ((a = i.unit.model.atomicHierarchy.atoms.B_iso_or_equiv.value(i.element)) >= 90) return Ae.fromRgb(148, 164, 239);
        if (a < 90 && a >= 70) return Ae.fromRgb(148, 225, 239);
        if (a < 70 && a >= 50) return Ae.fromRgb(240, 193, 145);
        if (a < 50) return Ae.fromRgb(239, 156, 156);
      }
    } else if (pt.isLocation(i) && ve.isAtomic(i.aUnit)) {
      var a;
      if ((a = i.aUnit.model.atomicHierarchy.atoms.B_iso_or_equiv.value(i.aUnit.elements[i.aIndex])) >= 90) return Ae.fromRgb(148, 164, 239);
      if (a < 90 && a >= 70) return Ae.fromRgb(148, 225, 239);
      if (a < 70 && a >= 50) return Ae.fromRgb(240, 193, 145);
      if (a < 50) return Ae.fromRgb(239, 156, 156);
    }
    return LY;
  }, props: n, description: "Fold", legend: r ? r.legend : void 0 };
}, getParams: function(e) {
  return mA;
}, defaultValues: N.getDefaultValues(mA), isApplicable: function(e) {
  return !!e.structure;
} }, VD = { H: 16777215, D: 16777152, T: 16777120, HE: 14286847, LI: 13402367, BE: 12779264, B: 16758197, C: 9474192, N: 3166456, O: 16715021, F: 9494608, NE: 11789301, NA: 11230450, MG: 9109248, AL: 12560038, SI: 1578e4, P: 16744448, S: 16777008, CL: 2093087, AR: 8442339, K: 9388244, CA: 4062976, SC: 15132390, TI: 12567239, V: 10921643, CR: 9083335, MN: 10255047, FE: 14706227, CO: 15765664, NI: 5296208, CU: 13140019, ZN: 8224944, GA: 12750735, GE: 6721423, AS: 12419299, SE: 16752896, BR: 10889513, KR: 6076625, RB: 7351984, SR: 65280, Y: 9764863, ZR: 9756896, NB: 7586505, MO: 5551541, TC: 3907230, RU: 2396047, RH: 687500, PD: 27013, AG: 12632256, CD: 16767375, IN: 10909043, SN: 6717568, SB: 10380213, TE: 13924864, I: 9699476, XE: 9699476, CS: 5707663, BA: 51456, LA: 7394559, CE: 16777159, PR: 14286791, ND: 13107143, PM: 10747847, SM: 9437127, EU: 6422471, GD: 4587463, TB: 3211207, DY: 2097095, HO: 65436, ER: 58997, TM: 54354, YB: 48952, LU: 43812, HF: 5096191, TA: 5089023, W: 2200790, RE: 2522539, OS: 2516630, IR: 1528967, PT: 13684960, AU: 16765219, HG: 12105936, TL: 10900557, PB: 5724513, BI: 10375093, PO: 11230208, AT: 7688005, RN: 4358806, FR: 4325478, RA: 32e3, AC: 7384058, TH: 47871, PA: 41471, U: 36863, NP: 33023, PU: 27647, AM: 5528818, CM: 7888099, BK: 9064419, CF: 10565332, ES: 11739092, FM: 11739066, MD: 11734438, NO: 12389767, LR: 13041766, RF: 13369433, DB: 13697103, SG: 14221381, BH: 14680120, HS: 15073326, MT: 15400998, DS: 16777215, RG: 16777215, CN: 16777215, UUT: 16777215, FL: 16777215, UUP: 16777215, LV: 16777215, UUH: 16777215 }, FY = Ae(16777215), pA = { carbonColor: N.MappedStatic("chain-id", { "chain-id": N.Group(If), "entity-id": N.Group(om), "entity-source": N.Group(sm), "operator-name": N.Group(am), "element-symbol": N.EmptyGroup() }, { description: "Use chain-id coloring for carbon atoms." }), saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0.2, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(VD)) }) }, VY = { name: "cdr", label: "CDR", category: "Atom Property", factory: function e(t, n) {
  var r = Of(n.colors.name === "default" ? VD : n.colors.params, n.saturation, n.lightness);
  return { factory: e, granularity: n.carbonColor.name === "operator-name" ? "groupInstance" : "group", preferSmoothing: !0, color: function(i) {
    if (He.is(i)) {
      if (ve.isAtomic(i.unit)) {
        var a = i.unit.model.atomicHierarchy.atoms.cdr, o = i.unit.model.atomicHierarchy.chains.auth_asym_id, s = a.value(i.element), u = o.value(i.unit.chainIndex[i.element]);
        return s !== 0 ? s === 3 && u.toLocaleUpperCase() === "H" ? Ae.fromRgb(252, 180, 91) : Ae.fromRgb(153, 154, 235) : u.toLocaleUpperCase() === "L" ? Ae.fromRgb(145, 225, 192) : u.toLocaleUpperCase() === "H" ? Ae.fromRgb(148, 223, 247) : Ae(16777215);
      }
    } else if (pt.isLocation(i) && ve.isAtomic(i.aUnit))
      return a = i.aUnit.model.atomicHierarchy.atoms.cdr, o = i.aUnit.model.atomicHierarchy.chains.auth_asym_id, s = a.value(i.aUnit.elements[i.aIndex]), u = o.value(i.aUnit.chainIndex[i.aIndex]), s !== 0 ? s === 3 && u.toLocaleUpperCase() === "H" ? Ae.fromRgb(252, 180, 91) : Ae.fromRgb(153, 154, 235) : u.toLocaleUpperCase() === "L" ? Ae.fromRgb(145, 225, 192) : u.toLocaleUpperCase() === "H" ? Ae.fromRgb(148, 223, 247) : Ae(16777215);
    return FY;
  }, props: n, description: "CDR", legend: Ws(Object.keys(r).map(function(i) {
    return [i, r[i]];
  })) };
}, getParams: function(e) {
  return pA;
}, defaultValues: N.getDefaultValues(pA), isApplicable: function(e) {
  return !!e.structure;
} }, hA = Ae(16448250), gA = O({ themes: N.Value([]) }, Eo({ type: "colors", colorList: "many-distinct" })), GY = { name: "multi-theme", label: "Multi Theme", category: "Atom Property", factory: function e(t, n) {
  var r, i = n.themes;
  return r = t.structure ? function(a, o) {
    if (He.is(a)) for (var s = 0; s < i.length; s++) {
      var u = i[s];
      if ((l = Ma.toStructure(u.bundle, t.structure)).hasElement(a)) return u.colorTheme.color(a, o);
    }
    else if (pt.isLocation(a) && ve.isAtomic(a.aUnit)) for (s = 0; s < i.length; s++) {
      u = i[s];
      var l = Ma.toStructure(u.bundle, t.structure), c = He.create(a.aStructure, a.aUnit, a.aUnit.elements[a.aIndex]);
      if (l.hasElement(c)) return u.colorTheme.color(a, o);
    }
    return hA;
  } : function() {
    return hA;
  }, { factory: e, granularity: "group", preferSmoothing: !0, color: r, props: n, description: "Structure allows multi theme based on location" };
}, getParams: function(e) {
  return N.clone(gA);
}, defaultValues: N.getDefaultValues(gA), isApplicable: function(e) {
  return !!e.structure;
} }, GD = { H: 16777215, D: 16777152, T: 16777120, HE: 14286847, LI: 13402367, BE: 12779264, B: 16758197, C: 9474192, N: 3166456, O: 16715021, F: 9494608, NE: 11789301, NA: 11230450, MG: 9109248, AL: 12560038, SI: 1578e4, P: 16744448, S: 16777008, CL: 2093087, AR: 8442339, K: 9388244, CA: 4062976, SC: 15132390, TI: 12567239, V: 10921643, CR: 9083335, MN: 10255047, FE: 14706227, CO: 15765664, NI: 5296208, CU: 13140019, ZN: 8224944, GA: 12750735, GE: 6721423, AS: 12419299, SE: 16752896, BR: 10889513, KR: 6076625, RB: 7351984, SR: 65280, Y: 9764863, ZR: 9756896, NB: 7586505, MO: 5551541, TC: 3907230, RU: 2396047, RH: 687500, PD: 27013, AG: 12632256, CD: 16767375, IN: 10909043, SN: 6717568, SB: 10380213, TE: 13924864, I: 9699476, XE: 9699476, CS: 5707663, BA: 51456, LA: 7394559, CE: 16777159, PR: 14286791, ND: 13107143, PM: 10747847, SM: 9437127, EU: 6422471, GD: 4587463, TB: 3211207, DY: 2097095, HO: 65436, ER: 58997, TM: 54354, YB: 48952, LU: 43812, HF: 5096191, TA: 5089023, W: 2200790, RE: 2522539, OS: 2516630, IR: 1528967, PT: 13684960, AU: 16765219, HG: 12105936, TL: 10900557, PB: 5724513, BI: 10375093, PO: 11230208, AT: 7688005, RN: 4358806, FR: 4325478, RA: 32e3, AC: 7384058, TH: 47871, PA: 41471, U: 36863, NP: 33023, PU: 27647, AM: 5528818, CM: 7888099, BK: 9064419, CF: 10565332, ES: 11739092, FM: 11739066, MD: 11734438, NO: 12389767, LR: 13041766, RF: 13369433, DB: 13697103, SG: 14221381, BH: 14680120, HS: 15073326, MT: 15400998, DS: 16777215, RG: 16777215, CN: 16777215, UUT: 16777215, FL: 16777215, UUP: 16777215, LV: 16777215, UUH: 16777215 }, zY = Ae(16777215), vA = { carbonColor: N.MappedStatic("chain-id", { "chain-id": N.Group(If), "entity-id": N.Group(om), "entity-source": N.Group(sm), "operator-name": N.Group(am), "element-symbol": N.EmptyGroup() }, { description: "Use chain-id coloring for carbon atoms." }), saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0.2, { min: -6, max: 6, step: 0.1 }), colors: N.MappedStatic("default", { default: N.EmptyGroup(), custom: N.Group(zm(GD)) }) }, UY = { name: "em-confidence", label: "EM Confidence", category: "Residue Property", factory: function e(t, n) {
  var r = Of(n.colors.name === "default" ? GD : n.colors.params, n.saturation, n.lightness);
  return { factory: e, granularity: n.carbonColor.name === "operator-name" ? "groupInstance" : "group", preferSmoothing: !0, color: function(i) {
    if (He.is(i)) {
      if (ve.isAtomic(i.unit)) {
        var a = i.unit.model.atomicHierarchy.atoms.em_confidence;
        switch (!0) {
          case (o = parseFloat(a.value(i.element))) < -1:
            return Ae.fromRgb(239, 139, 139);
          case (o >= -1 && o < -0.8):
            return Ae.fromRgb(239, 151, 139);
          case (o >= -0.8 && o < -0.6):
            return Ae.fromRgb(239, 167, 138);
          case (o >= -0.6 && o < -0.4):
            return Ae.fromRgb(239, 190, 136);
          case (o >= -0.4 && o < -0.2):
            return Ae.fromRgb(239, 214, 136);
          case (o >= -0.2 && o < 0):
            return Ae.fromRgb(239, 236, 135);
          case (o >= 0 && o < 0.2):
            return Ae.fromRgb(134, 239, 134);
          case (o >= 0.2 && o < 0.4):
            return Ae.fromRgb(134, 239, 227);
          case (o >= 0.4 && o < 0.6):
            return Ae.fromRgb(134, 224, 239);
          case (o >= 0.6 && o < 0.8):
            return Ae.fromRgb(134, 200, 239);
          case (o >= 0.8 && o <= 1):
            return Ae.fromRgb(133, 175, 239);
          case o > 1:
            return Ae.fromRgb(134, 153, 239);
          default:
            return Ae(16777215);
        }
      }
    } else if (pt.isLocation(i) && ve.isAtomic(i.aUnit)) {
      var o;
      switch (a = i.aUnit.model.atomicHierarchy.atoms.em_confidence, !0) {
        case (o = parseFloat(a.value(i.aUnit.elements[i.aIndex]))) < -1:
          return Ae.fromRgb(239, 139, 139);
        case (o >= -1 && o < -0.8):
          return Ae.fromRgb(239, 151, 139);
        case (o >= -0.8 && o < -0.6):
          return Ae.fromRgb(239, 167, 138);
        case (o >= -0.6 && o < -0.4):
          return Ae.fromRgb(239, 190, 136);
        case (o >= -0.4 && o < -0.2):
          return Ae.fromRgb(239, 214, 136);
        case (o >= -0.2 && o < 0):
          return Ae.fromRgb(239, 236, 135);
        case (o >= 0 && o < 0.2):
          return Ae.fromRgb(134, 239, 134);
        case (o >= 0.2 && o < 0.4):
          return Ae.fromRgb(134, 239, 227);
        case (o >= 0.4 && o < 0.6):
          return Ae.fromRgb(134, 224, 239);
        case (o >= 0.6 && o < 0.8):
          return Ae.fromRgb(134, 200, 239);
        case (o >= 0.8 && o <= 1):
          return Ae.fromRgb(133, 175, 239);
        case o > 1:
          return Ae.fromRgb(134, 153, 239);
        default:
          return Ae(16777215);
      }
    }
    return zY;
  }, props: n, description: "EM", legend: Ws(Object.keys(r).map(function(i) {
    return [i, r[i]];
  })) };
}, getParams: function(e) {
  return vA;
}, defaultValues: N.getDefaultValues(vA), isApplicable: function(e) {
  return !!e.structure;
} }, zD = { AC: 7384058, AG: 12632256, AL: 8499926, AM: 5528818, AR: 13631172, AS: 7655511, AT: 7688005, AU: 16765219, B: 2073103, BA: 51456, BE: 6215547, BH: 14680120, BI: 10375093, BK: 9064419, BR: 8270082, C: 5000268, CA: 5936829, CD: 16767375, CE: 16777159, CF: 10565332, CL: 3275778, CM: 7888099, CO: 175, CR: 158, CS: 5707663, CU: 2246620, DB: 13697103, DY: 2097095, ER: 58997, ES: 11739092, EU: 6422471, F: 11581926, FE: 11890944, FM: 11739066, FR: 4325478, GA: 10412915, GD: 4587463, GE: 8285862, H: 16764108, HE: 16574670, HF: 5096191, HG: 12105936, HO: 65436, HS: 15073326, I: 9699476, IN: 10909043, IR: 1528967, K: 10559990, KR: 16433651, LA: 5948489, LI: 8839027, LR: 13041766, LU: 43812, MD: 11734438, MG: 16481045, MN: 10946717, MO: 5551541, MT: 15400998, N: 11581926, NA: 16374844, NB: 7586505, ND: 13107143, NE: 16660405, NI: 12041149, NO: 12389767, NP: 33023, O: 16646912, OS: 2516630, P: 12623042, PA: 41471, PB: 5724513, PD: 27013, PM: 10747847, PO: 11230208, PR: 14286791, PT: 13684960, PU: 27647, RA: 32e3, RB: 7351984, RE: 2522539, RF: 13369433, RH: 687500, RN: 4358806, RU: 2396047, S: 16775680, SB: 10380213, SC: 11887531, SE: 10153743, SG: 14221381, SI: 1784826, SM: 9437127, SN: 10129081, SR: 65280, TA: 5089023, TB: 3211207, TC: 3907230, TE: 13924864, TH: 47871, TI: 7916287, TL: 10900557, TM: 54354, U: 36863, V: 15014144, W: 2200790, XE: 4366e3, Y: 9764863, YB: 48952, ZN: 9408385, ZR: 65280 }, cv = window.materialColors, yA = function() {
  Object.keys(cv.settings).forEach(function(e) {
    zD[e] = cv.getColorNumber(e);
  });
};
cv && (yA(), cv.setColorsSubject.subscribe(function() {
  yA();
}));
var u4 = zD, bA = Ae(16777215), UD = { carbonColor: N.MappedStatic("chain-id", { "chain-id": N.Group(O({}, If)), "operator-name": N.Group(O({}, am)), "element-symbol": N.Group({}) }, { description: "Use chain-id coloring for carbon atoms." }), saturation: N.Numeric(0, { min: -6, max: 6, step: 0.1 }), lightness: N.Numeric(0.2, { min: -6, max: 6, step: 0.1 }) };
function HY(e) {
  return UD;
}
function HD(e, t) {
  var n = Of(u4, t.saturation, t.lightness);
  function r(i, a) {
    return function(o, s) {
      var u = o[s];
      return u === void 0 ? bA : u;
    }(n, i);
  }
  return { factory: HD, granularity: t.carbonColor.name === "operator-name" ? "groupInstance" : "group", preferSmoothing: !0, color: function(i) {
    if (He.is(i)) {
      if (ve.isAtomic(i.unit)) return r(i.unit.model.atomicHierarchy.atoms.type_symbol.value(i.element));
    } else if (pt.isLocation(i) && ve.isAtomic(i.aUnit))
      return r(i.aUnit.model.atomicHierarchy.atoms.type_symbol.value(i.aUnit.elements[i.aIndex]));
    return bA;
  }, props: t, description: "Assigns a color to every atom according to its chemical element.", legend: Ws(Object.keys(u4).map(function(i) {
    return [i, u4[i]];
  })) };
}
var Ll, lt, En, qY = { name: "material-element-symbol", label: "Material Element Symbol", category: "Atom Property", factory: HD, getParams: HY, defaultValues: N.getDefaultValues(UD), isApplicable: function(e) {
  return !!e.structure;
} };
function l4(e, t, n) {
  switch (n) {
    case lt.Highlight:
      e[t] |= 1;
      break;
    case lt.RemoveHighlight:
      e[t] &= -2;
      break;
    case lt.Select:
      e[t] |= 2;
      break;
    case lt.Deselect:
      e[t] &= -3;
      break;
    case lt.Toggle:
      e[t] ^= 2;
      break;
    case lt.Clear:
      e[t] = 0;
  }
}
function Y5(e, t, n) {
  if (n === lt.None) return !1;
  if (le.is(t)) {
    var r = le.start(t), i = le.end(t), a = r + 3 >> 2, o = a + (i - 4 * a >> 2);
    if (o <= a) {
      for (var s = r; s < i; ++s) l4(e, s, n);
      return !0;
    }
    var u = new Uint32Array(e.buffer, 0, e.buffer.byteLength >> 2), l = r, c = Math.min(4 * a, i), d = Math.max(r, 4 * o), f = i;
    switch (n) {
      case lt.Highlight:
        for (s = a; s < o; ++s) u[s] |= 16843009;
        break;
      case lt.RemoveHighlight:
        for (s = a; s < o; ++s) u[s] &= -16843010;
        break;
      case lt.Select:
        for (s = a; s < o; ++s) u[s] |= 33686018;
        break;
      case lt.Deselect:
        for (s = a; s < o; ++s) u[s] &= -33686019;
        break;
      case lt.Toggle:
        for (s = a; s < o; ++s) u[s] ^= 33686018;
        break;
      case lt.Clear:
        for (s = a; s < o; ++s) u[s] = 0;
        break;
      default:
        Mi();
    }
    for (s = l; s < c; ++s) l4(e, s, n);
    for (s = d; s < f; ++s) l4(e, s, n);
  } else switch (n) {
    case lt.Highlight:
      s = 0;
      for (var p = t.length; s < p; ++s) e[t[s]] |= 1;
      break;
    case lt.RemoveHighlight:
      for (s = 0, p = t.length; s < p; ++s) e[t[s]] &= -2;
      break;
    case lt.Select:
      for (s = 0, p = t.length; s < p; ++s) e[t[s]] |= 2;
      break;
    case lt.Deselect:
      for (s = 0, p = t.length; s < p; ++s) e[t[s]] &= -3;
      break;
    case lt.Toggle:
      for (s = 0, p = t.length; s < p; ++s) e[t[s]] ^= 2;
      break;
    case lt.Clear:
      for (s = 0, p = t.length; s < p; ++s) e[t[s]] = 0;
      break;
    default:
      Mi();
  }
  return !0;
}
(function(e) {
  e.PaletteScale = 16777215, e.EmptyFactory = function() {
    return e.Empty;
  };
  var t = Ae(13421772);
  e.Empty = { factory: e.EmptyFactory, granularity: "uniform", color: function() {
    return t;
  }, props: {} }, e.areEqual = function(n, r) {
    return n.contextHash === r.contextHash && n.factory === r.factory && id(n.props, r.props);
  }, e.EmptyProvider = { name: "", label: "", category: "", factory: e.EmptyFactory, getParams: function() {
    return {};
  }, defaultValues: {}, isApplicable: function() {
    return !0;
  } }, e.createRegistry = function() {
    return new ID(e.BuiltIn, e.EmptyProvider);
  }, e.BuiltIn = { "atom-id": OY, "carbohydrate-symbol": tK, "chain-id": eY, "element-index": tY, "element-symbol": fY, "material-element-symbol": qY, "entity-id": aY, "entity-source": lY, hydrophobicity: PY, illustrative: wY, "model-index": MY, "molecule-type": pY, occupancy: TY, "operator-hkl": kY, "operator-name": rY, "partial-charge": DY, "polymer-id": hY, "polymer-index": gY, "residue-name": vY, "secondary-structure": yY, "sequence-id": _Y, "shape-group": BK, uncertainty: SY, "unit-index": xY, uniform: rK, "volume-value": RY, "uni-fold": NY, cdr: VY, "em-confidence": UY, "multi-theme": GY };
})(Ll || (Ll = {})), function(e) {
  e[e.None = 0] = "None", e[e.Highlight = 1] = "Highlight", e[e.RemoveHighlight = 2] = "RemoveHighlight", e[e.Select = 4] = "Select", e[e.Deselect = 8] = "Deselect", e[e.Toggle = 16] = "Toggle", e[e.Clear = 32] = "Clear";
}(lt || (lt = {})), function(e) {
  e.is = Qi.has, e.All = lt.Highlight | lt.RemoveHighlight | lt.Select | lt.Deselect | lt.Toggle | lt.Clear, e.Highlighting = lt.Highlight | lt.RemoveHighlight | lt.Clear, e.Selecting = lt.Select | lt.Deselect | lt.Toggle | lt.Clear, e.isReverse = function(t, n) {
    return t === lt.Highlight && n === lt.RemoveHighlight || t === lt.RemoveHighlight && n === lt.Highlight || t === lt.Select && n === lt.Deselect || t === lt.Deselect && n === lt.Select || t === lt.Toggle && n === lt.Toggle;
  };
}(En || (En = {}));
var t8 = { kind: "every-loci" };
function Ya(e) {
  return !!e && e.kind === "every-loci";
}
var zn, cr = { kind: "empty-loci" };
function td(e) {
  return !!e && e.kind === "empty-loci";
}
function i0(e) {
  return !!e && e.kind === "data-loci";
}
function n8(e, t, n, r, i) {
  return { kind: "data-loci", tag: e, data: t, elements: n, getBoundingSphere: r, getLabel: i };
}
function jY(e) {
  return Object.keys(e).filter(function(t) {
    return !isNaN(t);
  }).map(function(t) {
    return +t;
  }).sort(function(t, n) {
    return t - n;
  }).map(function(t) {
    return e[t];
  });
}
function c4(e, t, n) {
  return e && e[t] !== void 0 ? e[t] : n;
}
function Be(e) {
  for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
  return { kind: "alias", aliases: t, symbol: e };
}
function m2(e, t) {
  for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
  return e.info.namespace = "molscript-macro", e.id = "molscript-macro.".concat(e.info.name), { kind: "macro", symbol: e, translate: t, aliases: Re([e.info.name], n, !0) };
}
function KY(e) {
  return e.kind === "alias" || e.kind === "macro";
}
(function(e) {
  var t = new ms("98");
  function n(o, s) {
    var u;
    if (o.kind !== "every-loci" && o.kind !== "empty-loci") return s || (s = pe()), o.kind === "structure-loci" ? pe.copy(s, o.structure.boundary.sphere) : o.kind === "element-loci" ? pe.copy(s, ke.getBoundary(o).sphere) : o.kind === "bond-loci" ? pt.getBoundingSphere(o, s) : o.kind === "shape-loci" ? pe.copy(s, o.shape.geometry.boundingSphere) : o.kind === "group-loci" ? wa.getBoundingSphere(o, s) : o.kind === "data-loci" ? (u = o.getBoundingSphere) === null || u === void 0 ? void 0 : u.call(o, s) : o.kind === "volume-loci" ? $t.getBoundingSphere(o.volume, s) : o.kind === "isosurface-loci" ? $t.Isosurface.getBoundingSphere(o.volume, o.isoValue, s) : o.kind === "cell-loci" ? $t.Cell.getBoundingSphere(o.volume, o.indices, s) : void 0;
  }
  e.getBundleBoundingSphere = function(o) {
    var s = o.loci.map(function(p) {
      return n(p);
    }).filter(function(p) {
      return !!p;
    });
    t.reset();
    for (var u = 0, l = s; u < l.length; u++) {
      var c = l[u];
      t.includePositionRadius(c.center, c.radius);
    }
    t.finishedIncludeStep();
    for (var d = 0, f = s; d < f.length; d++)
      c = f[d], t.radiusPositionRadius(c.center, c.radius);
    return t.getSphere();
  }, e.areEqual = function(o, s) {
    return !(!Ya(o) || !Ya(s)) || !(!td(o) || !td(s)) || (i0(o) && i0(s) ? function(u, l) {
      if (!s5(u.data, l.data) || u.tag !== l.tag || u.elements.length !== l.elements.length) return !1;
      for (var c = 0, d = u.elements.length; c < d; ++c) if (!s5(u.elements[c], l.elements[c])) return !1;
      return !0;
    }(o, s) : ze.isLoci(o) && ze.isLoci(s) ? ze.areLociEqual(o, s) : ke.is(o) && ke.is(s) ? ke.areEqual(o, s) : pt.isLoci(o) && pt.isLoci(s) ? pt.areLociEqual(o, s) : Wt.isLoci(o) && Wt.isLoci(s) ? Wt.areLociEqual(o, s) : wa.isLoci(o) && wa.isLoci(s) ? wa.areLociEqual(o, s) : $t.isLoci(o) && $t.isLoci(s) ? $t.areLociEqual(o, s) : $t.Isosurface.isLoci(o) && $t.Isosurface.isLoci(s) ? $t.Isosurface.areLociEqual(o, s) : !(!$t.Cell.isLoci(o) || !$t.Cell.isLoci(s)) && $t.Cell.areLociEqual(o, s));
  }, e.isEvery = function(o) {
    return !!o && o.kind === "every-loci";
  }, e.isEmpty = function(o) {
    return !Ya(o) && (!!td(o) || (i0(o) ? function(s) {
      return s.elements.length === 0;
    }(o) : ze.isLoci(o) ? ze.isLociEmpty(o) : ke.is(o) ? ke.isEmpty(o) : pt.isLoci(o) ? pt.isLociEmpty(o) : Wt.isLoci(o) ? Wt.isLociEmpty(o) : wa.isLoci(o) ? wa.isLociEmpty(o) : $t.isLoci(o) ? $t.isLociEmpty(o) : $t.Isosurface.isLoci(o) ? $t.Isosurface.isLociEmpty(o) : !!$t.Cell.isLoci(o) && $t.Cell.isLociEmpty(o)));
  }, e.remap = function(o, s) {
    return s instanceof ze && (ke.is(o) ? o = ke.remap(o, s) : ze.isLoci(o) ? o = ze.remapLoci(o, s) : pt.isLoci(o) && (o = pt.remapLoci(o, s))), o;
  }, e.getBoundingSphere = n;
  var r = pe.zero();
  e.getCenter = function(o, s) {
    var u = n(o, r);
    return u ? A.copy(s || A(), u.center) : void 0;
  }, e.getPrincipalAxes = function(o) {
    if (o.kind !== "every-loci" && o.kind !== "empty-loci") return o.kind === "structure-loci" ? ke.getPrincipalAxes(ze.toStructureElementLoci(o.structure)) : o.kind === "element-loci" ? ke.getPrincipalAxes(o) : void (o.kind !== "bond-loci" && o.kind !== "shape-loci" && o.kind !== "group-loci" && o.kind !== "data-loci" && o.kind !== "volume-loci" && o.kind !== "isosurface-loci" && o.kind);
  };
  var i = { element: function(o) {
    return o;
  }, residue: function(o) {
    return ke.is(o) ? ke.extendToWholeResidues(o, !0) : o;
  }, chain: function(o) {
    return ke.is(o) ? ke.extendToWholeChains(o) : o;
  }, entity: function(o) {
    return ke.is(o) ? ke.extendToWholeEntities(o) : o;
  }, model: function(o) {
    return ke.is(o) ? ke.extendToWholeModels(o) : o;
  }, operator: function(o) {
    return ke.is(o) ? ke.extendToWholeOperators(o) : o;
  }, structure: function(o) {
    return ke.is(o) ? ze.toStructureElementLoci(o.structure) : wa.isLoci(o) ? Wt.Loci(o.shape) : o;
  }, elementInstances: function(o) {
    return ke.is(o) ? ke.extendToAllInstances(o) : o;
  }, residueInstances: function(o) {
    return ke.is(o) ? ke.extendToAllInstances(ke.extendToWholeResidues(o, !0)) : o;
  }, chainInstances: function(o) {
    return ke.is(o) ? ke.extendToAllInstances(ke.extendToWholeChains(o)) : o;
  } };
  function a(o, s) {
    return i[s](o);
  }
  e.GranularityOptions = N.objectToOptions(i, function(o) {
    switch (o) {
      case "element":
        return "Atom/Coarse Element";
      case "elementInstances":
        return ["Atom/Coarse Element Instances", "With Symmetry"];
      case "structure":
        return "Structure/Shape";
      default:
        return o.indexOf("Instances") ? [Su(o), "With Symmetry"] : Su(o);
    }
  }), e.simpleGranularity = function(o) {
    return o.replace("Instances", "");
  }, e.applyGranularity = a, e.normalize = function(o, s, u) {
    return u === void 0 && (u = !1), (s !== "element" || u) && pt.isLoci(o) && (o = pt.toStructureElementLoci(o)), ze.isLoci(o) && (o = ze.toStructureElementLoci(o.structure)), ke.is(o) && (o = ke.remap(o, o.structure.root)), s && (o = a(o, s)), o;
  };
})(zn || (zn = {}));
var YY = [["Core symbols", Be(te.core.type.bool, "bool"), Be(te.core.type.num, "num"), Be(te.core.type.str, "str"), Be(te.core.type.regex, "regex"), Be(te.core.type.list, "list"), Be(te.core.type.set, "set"), Be(te.core.type.compositeKey, "composite-key"), Be(te.core.logic.not, "not"), Be(te.core.logic.and, "and"), Be(te.core.logic.or, "or"), Be(te.core.ctrl.if, "if"), Be(te.core.ctrl.fn, "fn"), Be(te.core.ctrl.eval, "eval"), Be(te.core.math.add, "add", "+"), Be(te.core.math.sub, "sub", "-"), Be(te.core.math.mult, "mult", "*"), Be(te.core.math.div, "div", "/"), Be(te.core.math.pow, "pow", "**"), Be(te.core.math.mod, "mod"), Be(te.core.math.min, "min"), Be(te.core.math.max, "max"), Be(te.core.math.floor, "floor"), Be(te.core.math.ceil, "ceil"), Be(te.core.math.roundInt, "round"), Be(te.core.math.abs, "abs"), Be(te.core.math.sqrt, "sqrt"), Be(te.core.math.cbrt, "cbrt"), Be(te.core.math.sin, "sin"), Be(te.core.math.cos, "cos"), Be(te.core.math.tan, "tan"), Be(te.core.math.asin, "asin"), Be(te.core.math.acos, "acos"), Be(te.core.math.atan, "atan"), Be(te.core.math.sinh, "sinh"), Be(te.core.math.cosh, "cosh"), Be(te.core.math.tanh, "tanh"), Be(te.core.math.exp, "exp"), Be(te.core.math.log, "log"), Be(te.core.math.log10, "log10"), Be(te.core.math.atan2, "atan2"), Be(te.core.rel.eq, "eq", "="), Be(te.core.rel.neq, "neq", "!="), Be(te.core.rel.lt, "lt", "<"), Be(te.core.rel.lte, "lte", "<="), Be(te.core.rel.gr, "gr", ">"), Be(te.core.rel.gre, "gre", ">="), Be(te.core.rel.inRange, "in-range"), Be(te.core.str.concat, "concat"), Be(te.core.str.match, "regex.match"), Be(te.core.list.getAt, "list.get"), Be(te.core.set.has, "set.has"), Be(te.core.set.isSubset, "set.subset")], ["Structure", ["Types", Be(te.structureQuery.type.entityType, "ent-type"), Be(te.structureQuery.type.authResidueId, "auth-resid"), Be(te.structureQuery.type.labelResidueId, "label-resid"), Be(te.structureQuery.type.ringFingerprint, "ringfp"), Be(te.structureQuery.type.bondFlags, "bond-flags")], ["Slots", Be(te.structureQuery.slot.elementSetReduce, "atom.set.reduce.value")], ["Generators", Be(te.structureQuery.generator.atomGroups, "sel.atom.atom-groups"), Be(te.structureQuery.generator.queryInSelection, "sel.atom.query-in-selection"), Be(te.structureQuery.generator.rings, "sel.atom.rings"), Be(te.structureQuery.generator.empty, "sel.atom.empty"), Be(te.structureQuery.generator.all, "sel.atom.all"), Be(te.structureQuery.generator.bondedAtomicPairs, "sel.atom.bonded-pairs"), m2(Op("sel.atom.atoms", ct.Dictionary({ 0: Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test applied to each atom." }) }), $e.ElementSelection, "A selection of singleton atom sets."), function(e) {
  return Ct.struct.generator.atomGroups({ "atom-test": c4(e, 0, !0) });
}), m2(Op("sel.atom.res", ct.Dictionary({ 0: Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test applied to the 1st atom of each residue." }) }), $e.ElementSelection, "A selection of atom sets grouped by residue."), function(e) {
  return Ct.struct.generator.atomGroups({ "residue-test": c4(e, 0, !0), "group-by": Ct.ammp("residueKey") });
}), m2(Op("sel.atom.chains", ct.Dictionary({ 0: Ge(ue.Bool, { isOptional: !0, defaultValue: !0, description: "Test applied to the 1st atom of each chain." }) }), $e.ElementSelection, "A selection of atom sets grouped by chain."), function(e) {
  return Ct.struct.generator.atomGroups({ "chain-test": c4(e, 0, !0), "group-by": Ct.ammp("chainKey") });
})], ["Modifiers", Be(te.structureQuery.modifier.queryEach, "sel.atom.query-each"), Be(te.structureQuery.modifier.intersectBy, "sel.atom.intersect-by"), Be(te.structureQuery.modifier.exceptBy, "sel.atom.except-by"), Be(te.structureQuery.modifier.unionBy, "sel.atom.union-by"), Be(te.structureQuery.modifier.union, "sel.atom.union"), Be(te.structureQuery.modifier.cluster, "sel.atom.cluster"), Be(te.structureQuery.modifier.includeSurroundings, "sel.atom.include-surroundings"), Be(te.structureQuery.modifier.surroundingLigands, "sel.atom.surrounding-ligands"), Be(te.structureQuery.modifier.includeConnected, "sel.atom.include-connected"), Be(te.structureQuery.modifier.expandProperty, "sel.atom.expand-property")], ["Filters", Be(te.structureQuery.filter.pick, "sel.atom.pick"), Be(te.structureQuery.filter.first, "sel.atom.first"), Be(te.structureQuery.filter.withSameAtomProperties, "sel.atom.with-same-atom-properties"), Be(te.structureQuery.filter.intersectedBy, "sel.atom.intersected-by"), Be(te.structureQuery.filter.within, "sel.atom.within"), Be(te.structureQuery.filter.isConnectedTo, "sel.atom.is-connected-to")], ["Combinators", Be(te.structureQuery.combinator.intersect, "sel.atom.intersect"), Be(te.structureQuery.combinator.merge, "sel.atom.merge"), Be(te.structureQuery.combinator.distanceCluster, "sel.atom.dist-cluster")], ["Atom Set Properties", Be(te.structureQuery.atomSet.atomCount, "atom.set.atom-count"), Be(te.structureQuery.atomSet.countQuery, "atom.set.count-query"), Be(te.structureQuery.atomSet.reduce, "atom.set.reduce"), Be(te.structureQuery.atomSet.propertySet, "atom.set.property")], ["Atom Properties", Be(te.structureQuery.atomProperty.core.elementSymbol, "atom.el"), Be(te.structureQuery.atomProperty.core.vdw, "atom.vdw"), Be(te.structureQuery.atomProperty.core.mass, "atom.mass"), Be(te.structureQuery.atomProperty.core.atomicNumber, "atom.atomic-number"), Be(te.structureQuery.atomProperty.core.x, "atom.x"), Be(te.structureQuery.atomProperty.core.y, "atom.y"), Be(te.structureQuery.atomProperty.core.z, "atom.z"), Be(te.structureQuery.atomProperty.core.sourceIndex, "atom.src-index"), Be(te.structureQuery.atomProperty.core.operatorName, "atom.op-name"), Be(te.structureQuery.atomProperty.core.modelIndex, "atom.model-index"), Be(te.structureQuery.atomProperty.core.modelLabel, "atom.model-label"), Be(te.structureQuery.atomProperty.core.atomKey, "atom.key"), Be(te.structureQuery.atomProperty.core.bondCount, "atom.bond-count"), Be(te.structureQuery.atomProperty.topology.connectedComponentKey, "atom.key.molecule"), Be(te.structureQuery.atomProperty.macromolecular.authResidueId, "atom.auth-resid"), Be(te.structureQuery.atomProperty.macromolecular.labelResidueId, "atom.label-resid"), Be(te.structureQuery.atomProperty.macromolecular.residueKey, "atom.key.res"), Be(te.structureQuery.atomProperty.macromolecular.chainKey, "atom.key.chain"), Be(te.structureQuery.atomProperty.macromolecular.entityKey, "atom.key.entity"), Be(te.structureQuery.atomProperty.macromolecular.isHet, "atom.is-het"), Be(te.structureQuery.atomProperty.macromolecular.id, "atom.id"), Be(te.structureQuery.atomProperty.macromolecular.label_atom_id, "atom.label_atom_id"), Be(te.structureQuery.atomProperty.macromolecular.label_alt_id, "atom.label_alt_id", "atom.altloc"), Be(te.structureQuery.atomProperty.macromolecular.label_comp_id, "atom.label_comp_id"), Be(te.structureQuery.atomProperty.macromolecular.label_asym_id, "atom.label_asym_id"), Be(te.structureQuery.atomProperty.macromolecular.label_entity_id, "atom.label_entity_id"), Be(te.structureQuery.atomProperty.macromolecular.label_seq_id, "atom.label_seq_id"), Be(te.structureQuery.atomProperty.macromolecular.auth_atom_id, "atom.auth_atom_id", "atom.name"), Be(te.structureQuery.atomProperty.macromolecular.auth_comp_id, "atom.auth_comp_id", "atom.resname"), Be(te.structureQuery.atomProperty.macromolecular.auth_asym_id, "atom.auth_asym_id", "atom.chain"), Be(te.structureQuery.atomProperty.macromolecular.auth_seq_id, "atom.auth_seq_id", "atom.resno"), Be(te.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code, "atom.pdbx_PDB_ins_code", "atom.inscode"), Be(te.structureQuery.atomProperty.macromolecular.pdbx_formal_charge, "atom.pdbx_formal_charge"), Be(te.structureQuery.atomProperty.macromolecular.occupancy, "atom.occupancy"), Be(te.structureQuery.atomProperty.macromolecular.B_iso_or_equiv, "atom.B_iso_or_equiv", "atom.bfactor"), Be(te.structureQuery.atomProperty.macromolecular.entityType, "atom.entity-type"), Be(te.structureQuery.atomProperty.macromolecular.entitySubtype, "atom.entity-subtype"), Be(te.structureQuery.atomProperty.macromolecular.entityPrdId, "atom.entity-prd-id"), Be(te.structureQuery.atomProperty.macromolecular.entityDescription, "atom.entity-description"), Be(te.structureQuery.atomProperty.macromolecular.objectPrimitive, "atom.object-primitive"), Be(te.structureQuery.atomProperty.macromolecular.chemCompType, "atom.chem-comp-type"), Be(te.structureQuery.atomProperty.macromolecular.secondaryStructureKey, "atom.key.sec-struct"), Be(te.structureQuery.atomProperty.macromolecular.isModified, "atom.is-modified"), Be(te.structureQuery.atomProperty.macromolecular.modifiedParentName, "atom.modified-parent")], ["Bond Properties", Be(te.structureQuery.bondProperty.order, "bond.order"), Be(te.structureQuery.bondProperty.length, "bond.length"), Be(te.structureQuery.bondProperty.atomA, "bond.atom-a"), Be(te.structureQuery.bondProperty.atomB, "bond.atom-b"), m2(Op("bond.is", ct.List($e.BondFlag), ue.Bool, "Test if the current bond has at least one (or all if partial = false) of the specified flags: ".concat(ue.oneOfValues($e.BondFlag).join(", "))), function(e) {
  return Ct.core.flags.hasAny([Ct.struct.bondProperty.flags(), Ct.struct.type.bondFlags(jY(e))]);
})]]], qD = [];
(function e(t) {
  for (var n = 0, r = t; n < r.length; n++) {
    var i = r[n];
    KY(i) ? qD.push(i) : i instanceof Array && e(i);
  }
})(YY);
var WY = function() {
  for (var e = [], t = /* @__PURE__ */ Object.create(null), n = or.create(), r = or.create(), i = 0, a = qD; i < a.length; i++) {
    for (var o = a[i], s = 0, u = o.aliases; s < u.length; s++) {
      var l = u[s];
      if (e.push([l, o]), t[l]) throw new Error("Alias '".concat(l, "' already in use."));
      t[l] = o;
    }
    var c = o.symbol.args;
    if (c.kind === "dictionary") for (var d = 0, f = Object.keys(c.map); d < f.length; d++) {
      l = f[d], isNaN(l) && or.add(n, l, l);
      var p = c.map[l];
      p.type.kind === "oneof" && ue.oneOfValues(p.type).forEach(function(g) {
        return or.add(r, g, g);
      });
    }
    else c.type.kind === "oneof" && ue.oneOfValues(c.type).forEach(function(g) {
      return or.add(r, g, g);
    });
  }
  return { symbolList: e, symbolMap: t, namedArgs: n.array, constants: r.array };
}(), r1 = WY.symbolMap;
function zp(e) {
  if (Vi.isLiteral(e)) return e;
  if (Vi.isSymbol(e)) {
    if (!r1[e.name]) return e;
    var t = r1[e.name];
    if (t.kind === "alias") return Vi.Symbol(r1[e.name].symbol.id);
    throw t.translate([]);
  }
  var n = Vi.isSymbol(e.head) && !!r1[e.head.name] && r1[e.head.name].kind === "macro", r = n ? e.head : zp(e.head), i = r !== e.head;
  if (!e.args) return n ? zp(e.head) : i ? Vi.Apply(r) : e;
  var a, o = !1;
  if (Vi.isArgumentsArray(e.args)) {
    a = [];
    for (var s = 0, u = e.args.length; s < u; s++)
      (d = e.args[s]) !== (f = zp(d)) && (o = !0), a[a.length] = f;
    if (o || (a = e.args), !n && !i && !o) return e;
  } else {
    a = {};
    for (var l = 0, c = Object.keys(e.args); l < c.length; l++) {
      var d, f, p = c[l];
      (d = e.args[p]) !== (f = zp(d)) && (o = !0), a[p] = f;
    }
    if (!n && !i && !o) return e;
    o || (a = e.args);
  }
  if (n) {
    var g = r1[e.head.name];
    return g.kind !== "macro" ? Vi.Apply(r, a) : g.translate(a);
  }
  return Vi.Apply(r, a);
}
function XY(e) {
  return zp(e);
}
var W5, Is = function() {
  function e(t) {
    this._ = t;
  }
  return e.prototype.parse = function(t) {
    var n = this.skip(e.eof)._(t, 0);
    return n.status ? { success: !0, value: n.value } : { success: !1, index: jD(t, n.furthest), expected: n.expected };
  }, e.prototype.tryParse = function(t) {
    var n = this.parse(t);
    if (n.success) return n.value;
    var r = function(i, a) {
      return "expected ".concat(function(o) {
        return o.length === 1 ? o[0] : "one of " + o.join(", ");
      }(a.expected)).concat(function(o, s) {
        var u = s.index, l = u.offset;
        if (l === o.length) return ", got the end of the input";
        var c = l > 0 ? "'..." : "'", d = o.length - l > 12 ? "...'" : "'";
        return " at line ".concat(u.line, " column ").concat(u.column, ", got ").concat(c).concat(o.slice(l, l + 12)).concat(d);
      }(i, a));
    }(t, n);
    throw new Error(r);
  }, e.prototype.or = function(t) {
    return e.alt(this, t);
  }, e.prototype.trim = function(t) {
    return this.wrap(t, t);
  }, e.prototype.wrap = function(t, n) {
    return d4(1, typeof t == "string" ? e.string(t) : t, this, typeof n == "string" ? e.string(n) : n);
  }, e.prototype.thru = function(t) {
    return t(this);
  }, e.prototype.then = function(t) {
    return d4(1, this, t);
  }, e.prototype.many = function() {
    var t = this;
    return new e(function(n, r) {
      for (var i = [], a = void 0; ; ) {
        if (!(a = Jo(t._(n, r), a)).status) return Jo(sa(r, i), a);
        if (r === a.index) throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");
        r = a.index, i.push(a.value);
      }
    });
  }, e.prototype.times = function(t, n) {
    var r = this, i = n === void 0 ? t : n;
    return new e(function(a, o) {
      var s, u = [], l = void 0, c = void 0;
      for (s = 0; s < t; s++) {
        if (c = Jo(l = r._(a, o), c), !l.status) return c;
        o = l.index, u.push(l.value);
      }
      for (; s < i && (c = Jo(l = r._(a, o), c), l.status); s += 1) o = l.index, u.push(l.value);
      return Jo(sa(o, u), c);
    });
  }, e.prototype.result = function(t) {
    return this.map(function() {
      return t;
    });
  }, e.prototype.atMost = function(t) {
    return this.times(0, t);
  }, e.prototype.atLeast = function(t) {
    return e.seq(this.times(t), this.many()).map(function(n) {
      return Re(Re([], n[0], !0), n[1], !0);
    });
  }, e.prototype.map = function(t) {
    var n = this;
    return new e(function(r, i) {
      var a = n._(r, i);
      return a.status ? Jo(sa(a.index, t(a.value)), a) : a;
    });
  }, e.prototype.skip = function(t) {
    return d4(0, this, t);
  }, e.prototype.mark = function() {
    return e.seq(e.index, this, e.index).map(function(t) {
      return { start: t[0], value: t[1], end: t[2] };
    });
  }, e.prototype.node = function(t) {
    return e.seq(e.index, this, e.index).map(function(n) {
      return { name: t, start: n[0], value: n[1], end: n[2] };
    });
  }, e.prototype.sepBy = function(t) {
    return e.sepBy(this, t);
  }, e.prototype.sepBy1 = function(t) {
    return e.sepBy1(this, t);
  }, e.prototype.lookahead = function(t) {
    return this.skip(e.lookahead(t));
  }, e.prototype.notFollowedBy = function(t) {
    return this.skip(e.notFollowedBy(t));
  }, e.prototype.desc = function(t) {
    var n = this;
    return new e(function(r, i) {
      var a = n._(r, i);
      return a.status || (a.expected = [t]), a;
    });
  }, e.prototype.fallback = function(t) {
    return this.or(e.succeed(t));
  }, e.prototype.ap = function(t) {
    return e.seq(t, this).map(function(n) {
      return (0, n[0])(n[1]);
    });
  }, e.prototype.chain = function(t) {
    var n = this;
    return new e(function(r, i) {
      var a = n._(r, i);
      return a.status ? Jo(t(a.value)._(r, a.index), a) : a;
    });
  }, e;
}();
function d4(e) {
  for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
  var r = t.length;
  return new Is(function(i, a) {
    for (var o, s, u = a, l = 0; l < r; l++) {
      if (!(o = Jo(t[l]._(i, u), o)).status) return o;
      e === l && (s = o.value), u = o.index;
    }
    return Jo(sa(u, s), o);
  });
}
function sa(e, t) {
  return { status: !0, index: e, value: t };
}
function Zu(e, t) {
  return { status: !1, furthest: e, expected: [t] };
}
function Jo(e, t) {
  if (!t || e.status || t.status || e.furthest > t.furthest) return e;
  var n = e.furthest === t.furthest ? function(r, i) {
    var a = r.length, o = i.length;
    if (a === 0) return i;
    if (o === 0) return r;
    for (var s = /* @__PURE__ */ new Set(), u = [], l = 0; l < a; l++) s.has(r[l]) || (u[u.length] = r[l], s.add(r[l]));
    for (l = 0; l < o; l++) s.has(i[l]) || (u[u.length] = i[l], s.add(i[l]));
    return u.sort(), u;
  }(e.expected, t.expected) : t.expected;
  return { status: e.status, furthest: t.furthest, expected: n };
}
function jD(e, t) {
  var n = e.slice(0, t).split(`
`);
  return { offset: t, line: n.length, column: n[n.length - 1].length + 1 };
}
function ZY(e) {
  return e instanceof Is;
}
(function(e) {
  function t() {
    for (var l = [], c = 0; c < arguments.length; c++) l[c] = arguments[c];
    var d = l.length;
    return new e(function(f, p) {
      for (var g, m = new Array(d), v = p, h = 0; h < d; h++) {
        if (!(g = Jo(l[h]._(f, v), g)).status) return g;
        m[h] = g.value, v = g.index;
      }
      return Jo(sa(v, m), g);
    });
  }
  function n() {
    for (var l = [], c = 0; c < arguments.length; c++) l[c] = arguments[c];
    return l.length === 0 ? s("zero alternates") : new e(function(d, f) {
      for (var p, g = 0; g < l.length; g++) if ((p = Jo(l[g]._(d, f), p)).status) return p;
      return p;
    });
  }
  function r(l, c) {
    return t(l, c.then(l).many()).map(function(d) {
      return Re([d[0]], d[1], !0);
    });
  }
  function i(l) {
    var c = "'".concat(l, "'");
    if (l.length === 1) {
      var d = l.charCodeAt(0);
      return new e(function(f, p) {
        return f.charCodeAt(p) === d ? sa(p + 1, l) : Zu(p, c);
      });
    }
    return new e(function(f, p) {
      var g = p + l.length;
      return f.slice(p, g) === l ? sa(g, l) : Zu(p, c);
    });
  }
  function a(l, c) {
    c === void 0 && (c = 0);
    var d = function(p) {
      return RegExp("^(?:" + p.source + ")", function(g) {
        var m = "" + g;
        return m.slice(m.lastIndexOf("/") + 1);
      }(p));
    }(l), f = "" + l;
    return new e(function(p, g) {
      var m = d.exec(p.slice(g));
      if (m) {
        if (0 <= c && c <= m.length) {
          var v = m[0], h = m[c];
          return sa(g + v.length, h);
        }
        return Zu(g, "invalid match group (0 to ".concat(m.length, ") in ").concat(f));
      }
      return Zu(g, f);
    });
  }
  function o(l) {
    return new e(function(c, d) {
      return sa(d, l);
    });
  }
  function s(l) {
    return new e(function(c, d) {
      return Zu(d, l);
    });
  }
  function u(l) {
    return new e(function(c, d) {
      var f = c.charAt(d);
      return d < c.length && l(f) ? sa(d + 1, f) : Zu(d, "a character " + l);
    });
  }
  e.seq = t, e.alt = n, e.sepBy = function(l, c) {
    return r(l, c).or(o([]));
  }, e.sepBy1 = r, e.string = i, e.regexp = a, e.succeed = o, e.fail = s, e.lookahead = function l(c) {
    if (ZY(c)) return new e(function(d, f) {
      var p = c._(d, f);
      return p.status && (p.index = f, p.value = null), p;
    });
    if (typeof c == "string") return l(i(c));
    if (c instanceof RegExp) return l(a(c));
    throw new Error("not a string, regexp, or parser: " + c);
  }, e.notFollowedBy = function(l) {
    return new e(function(c, d) {
      var f = l._(c, d);
      return f.status ? Zu(d, 'not "' + c.slice(d, f.index) + '"') : sa(d, null);
    });
  }, e.test = u, e.oneOf = function(l) {
    return u(function(c) {
      return l.indexOf(c) >= 0;
    });
  }, e.noneOf = function(l) {
    return u(function(c) {
      return l.indexOf(c) < 0;
    });
  }, e.range = function(l, c) {
    return u(function(d) {
      return l <= d && d <= c;
    }).desc(l + "-" + c);
  }, e.takeWhile = function(l) {
    return new e(function(c, d) {
      for (var f = d; f < c.length && l(c.charAt(f)); ) f++;
      return sa(f, c.slice(d, f));
    });
  }, e.lazy = function(l) {
    var c = new e(function(d, f) {
      var p = l()._;
      return c._ = p, p(d, f);
    });
    return c;
  }, e.empty = function() {
    return s("empty");
  }, e.index = new e(function(l, c) {
    return sa(c, jD(l, c));
  }), e.anyChar = new e(function(l, c) {
    return c >= l.length ? Zu(c, "any character") : sa(c + 1, l.charAt(c));
  }), e.all = new e(function(l, c) {
    return sa(l.length, l.slice(c));
  }), e.eof = new e(function(l, c) {
    return c < l.length ? Zu(c, "EOF") : sa(c, null);
  }), e.digit = a(/[0-9]/).desc("a digit"), e.digits = a(/[0-9]*/).desc("optional digits"), e.letter = a(/[a-z]/i).desc("a letter"), e.letters = a(/[a-z]*/i).desc("optional letters"), e.optWhitespace = a(/\s*/).desc("optional whitespace"), e.whitespace = a(/\s+/).desc("whitespace"), e.cr = i("\r"), e.lf = i(`
`), e.crlf = i(`\r
`), e.newline = n(e.crlf, e.lf, e.cr).desc("newline"), e.end = n(e.newline, e.eof);
})(Is || (Is = {})), function(e) {
  var t;
  (function(m) {
    m.str = function(v) {
      return { kind: "string", value: v };
    }, m.symb = function(v) {
      return { kind: "symbol", value: v };
    }, m.list = function(v, h) {
      return { kind: "list", bracket: v, nodes: h };
    }, m.comment = function(v) {
      return { kind: "comment", value: v };
    };
  })(t || (t = {}));
  var n = Is.regexp(/[\n\r\s]*/), r = Is.lazy(function() {
    return Is.alt(i, d, a, o).trim(n);
  }), i = Is.takeWhile(function(m) {
    return m !== "`";
  }).trim("`").map(t.str), a = Is.regexp(/[^()\[\]{};`,\n\r\s]+/).map(t.symb), o = Is.regexp(/\s*;+([^\n\r]*)\n/, 1).map(t.comment), s = r.many(), u = s.wrap("(", ")").map(function(m) {
    return t.list("(", m);
  }), l = s.wrap("[", "]").map(function(m) {
    return t.list("[", m);
  }), c = s.wrap("{", "}").map(function(m) {
    return t.list("{", m);
  }), d = Is.alt(u, l, c), f = r.many();
  function p(m) {
    switch (m.kind) {
      case "string":
        return m.value;
      case "symbol":
        var v = m.value;
        if (v.length > 1) switch (v.charAt(0)) {
          case ".":
            return Ct.atomName(v.substr(1));
          case "_":
            return Ct.struct.type.elementSymbol([v.substr(1)]);
        }
        return v === "true" || v !== "false" && (function(y) {
          return /-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/.test(y) && !isNaN(+y);
        }(v) ? +v : Vi.Symbol(v));
      case "list":
        switch (m.bracket) {
          case "[":
            return Ct.core.type.list(g(m.nodes).map(p));
          case "{":
            return Ct.core.type.set(g(m.nodes).map(p));
          case "(":
            if (m.nodes[0].kind === "comment") throw new Error("Invalid expression");
            var h = p(m.nodes[0]);
            return Vi.Apply(h, function(y) {
              if (!(y.length <= 1)) {
                if (!function(k) {
                  for (var D = 1, B = k.length; D < B; D++) {
                    var L = k[D];
                    if (L.kind === "symbol" && L.value.length > 1 && L.value.charAt(0) === ":") return !0;
                  }
                  return !1;
                }(y)) {
                  for (var x = [], S = 1, b = y.length; S < b; S++)
                    (I = y[S]).kind !== "comment" && (x[x.length] = p(I));
                  return x;
                }
                var _ = {}, C = !0, w = 0;
                for (S = 1, b = y.length; S < b; S++) {
                  var I;
                  if ((I = y[S]).kind !== "comment") if (I.kind === "symbol" && I.value.length > 1 && I.value.charAt(0) === ":") {
                    var M = I.value.substr(1);
                    for (++S; S < b && y[S].kind === "comment"; ) S++;
                    if (S >= b) throw new Error("There must be a value foolowed a named arg ':".concat(M, "'."));
                    if (y[S].kind === "comment") throw new Error("Invalid expression");
                    _[M] = p(y[S]), isNaN(+M) && (C = !1);
                  } else _[w++] = p(I);
                }
                if (C) {
                  var E = Object.keys(_).map(function(k) {
                    return +k;
                  }).sort(function(k, D) {
                    return k - D;
                  }), T = !0;
                  for (S = 0, b = E.length; S < b; S++) if (E[S] !== S) {
                    T = !1;
                    break;
                  }
                  if (T) {
                    var P = [];
                    for (S = 0, b = E.length; S < b; S++) P[S] = _[S];
                    return P;
                  }
                }
                return _;
              }
            }(m.nodes));
          default:
            Mi(m.bracket);
        }
      default:
        Mi();
    }
  }
  function g(m) {
    for (var v = !1, h = 0, y = m.length; h < y; h++) if (m[h].kind === "comment") {
      v = !0;
      break;
    }
    return v ? m.filter(function(x) {
      return x.kind !== "comment";
    }) : m;
  }
  e.parse = function(m) {
    for (var v = function(b) {
      return f.tryParse(b);
    }(m), h = [], y = 0, x = v; y < x.length; y++) {
      var S = x[y];
      S.kind !== "comment" && (h[h.length] = p(S));
    }
    return h;
  };
}(W5 || (W5 = {}));
var _A, um, a0, dv, QY = function() {
  function e() {
    this.map = /* @__PURE__ */ new Map();
  }
  return e.prototype.removeSymbol = function(t) {
    this.map.delete(t.symbol.id);
  }, e.prototype.addSymbol = function(t) {
    this.map.has(t.symbol.id) && console.warn("Symbol '".concat(t.symbol.id, "' already added. Call removeSymbol/removeCustomProps re-adding the symbol.")), this.map.set(t.symbol.id, t);
  }, e.prototype.addCustomProp = function(t) {
    if (t.symbols) for (var n = 0, r = Object.keys(t.symbols); n < r.length; n++) {
      var i = r[n];
      this.addSymbol(t.symbols[i]);
    }
  }, e.prototype.removeCustomProp = function(t) {
    if (t.symbols) for (var n = 0, r = Object.keys(t.symbols); n < r.length; n++) {
      var i = r[n];
      this.removeSymbol(t.symbols[i]);
    }
  }, e.prototype.getRuntime = function(t) {
    return this.map.get(t);
  }, e;
}(), KD = new QY(), JY = function(e) {
  this.table = e, this.constQueryContext = new xf(ze.Empty);
};
(function(e) {
  e.Const = function(t) {
    return { kind: "const", value: t };
  }, e.Dynamic = function(t) {
    return { kind: "dynamic", runtime: t };
  };
})(_A || (_A = {})), function(e) {
  e.Const = function(t) {
    return { isConst: !0, fn: function(n) {
      return t;
    } };
  }, e.Dynamic = function(t) {
    return { isConst: !1, fn: t };
  };
}(um || (um = {})), function(e) {
  e.forEachEval = function(t, n, r, i) {
    if (typeof t.length == "number") for (var a = 0, o = t.length; a < o; a++) r(t[a](n), a, i);
    else {
      a = 0;
      for (var s = 0, u = Object.keys(t); s < u.length; s++)
        r(t[u[s]](n), a++, i);
    }
    return i;
  };
}(a0 || (a0 = {})), function(e) {
  e.Const = function(t, n) {
    return new xA(t, n, !0);
  }, e.Dynamic = function(t, n) {
    return new xA(t, n, !1);
  };
}(dv || (dv = {}));
var Du, xA = function() {
  function e(t, n, r) {
    this.symbol = t, this.fn = n, this.isConst = r;
  }
  return e.prototype.compile = function(t, n) {
    var r, i = !1;
    if (n) if (Vi.isArgumentsArray(n)) {
      r = [], i = !0;
      for (var a = 0, o = n; a < o.length; a++) {
        var s = X5(t, o[a]);
        i = i && s.isConst, r.push(s.fn);
      }
    } else {
      r = /* @__PURE__ */ Object.create(null), i = !0;
      for (var u = 0, l = Object.keys(n); u < l.length; u++) {
        var c = l[u];
        s = X5(t, n[c]), i = i && s.isConst, r[c] = s.fn;
      }
    }
    else r = void 0, i = !0;
    return this.isConst && this.isConst && i ? um.Const(this.fn(t.constQueryContext, r)) : um.Dynamic($Y(this.fn, r));
  }, e;
}();
function $Y(e, t) {
  return function(n) {
    return e(n, t);
  };
}
function X5(e, t) {
  if (Vi.isLiteral(t)) return um.Const(t);
  if (Vi.isSymbol(t)) {
    var n = e.table.getRuntime(t.name);
    return n ? n.compile(e) : um.Const(t.name);
  }
  if (!Vi.isSymbol(t.head)) throw new Error("Can only apply symbols.");
  var r = e.table.getRuntime(t.head.name);
  if (!r) throw new Error("Symbol '".concat(t.head.name, "' is not implemented."));
  return r.compile(e, t.args);
}
function fv(e) {
  return X5(new JY(KD), e).fn;
}
function jc(e, t) {
  return { expression: e, language: t };
}
function T0(e) {
  return { layers: e };
}
function k0(e, t) {
  return { kind: e, layers: t };
}
(function(e) {
  function t(r) {
    if (r.language === "mol-script") {
      var i = (a = r.expression, W5.parse(a));
      if (i.length === 0) throw new Error("No query");
      return XY(i[0]);
    }
    var a;
    throw new Error("unsupported script language");
  }
  function n(r) {
    return fv(t(r));
  }
  e.is = function(r) {
    return !!r && typeof r.expression == "string" && !!r.language;
  }, e.areEqual = function(r, i) {
    return r.language === i.language && r.expression === i.expression;
  }, e.toExpression = t, e.toQuery = n, e.toLoci = function(r, i) {
    var a = n(r)(new xf(i));
    return nt.toLociWithSourceUnits(a);
  }, e.getStructureSelection = function(r, i, a) {
    return fv(typeof r == "function" ? r(Ct) : r)(new xf(i, a));
  };
})(jc || (jc = {})), function(e) {
  function t(n) {
    return n.layers.length === 0;
  }
  e.Empty = { layers: [] }, e.areEqual = function(n, r) {
    if (n.layers.length === 0 && r.layers.length === 0) return !0;
    if (n.layers.length !== r.layers.length) return !1;
    for (var i = 0, a = n.layers.length; i < a; ++i)
      if (n.layers[i].clear !== r.layers[i].clear || n.layers[i].color !== r.layers[i].color || !zn.areEqual(n.layers[i].loci, r.layers[i].loci)) return !1;
    return !0;
  }, e.isEmpty = t, e.remap = function(n, r) {
    for (var i = [], a = 0, o = n.layers; a < o.length; a++) {
      var s = o[a], u = s.loci, l = s.color, c = s.clear;
      u = ke.remap(u, r), ke.isEmpty(u) || i.push({ loci: u, color: l, clear: c });
    }
    return { layers: i };
  }, e.merge = function(n) {
    if (t(n)) return n;
    for (var r = n.layers[0].loci.structure, i = /* @__PURE__ */ new Map(), a = ke.none(r), o = 0, s = n.layers.length; o < s; ++o) {
      var u = n.layers[s - o - 1], l = u.loci, c = u.color, d = u.clear;
      if (l = ke.subtract(l, a), a = ke.union(l, a), !ke.isEmpty(l)) {
        var f = d ? -1 : c;
        i.has(f) && (l = ke.union(l, i.get(f))), i.set(f, l);
      }
    }
    var p = [];
    return i.forEach(function(g, m) {
      var v = m === -1, h = v ? Ae(0) : m;
      p.push({ loci: g, color: h, clear: v });
    }), { layers: p };
  }, e.filter = function(n, r) {
    if (t(n)) return n;
    for (var i = n.layers[0].loci.structure, a = [], o = 0, s = n.layers; o < s.length; o++) {
      var u = s[o], l = u.loci, c = u.color, d = u.clear, f = ke.remap(l, r);
      l = ke.remap(f, i), ke.isEmpty(l) || a.push({ loci: l, color: c, clear: d });
    }
    return { layers: a };
  }, e.ofScript = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.script, l = s.color, c = s.clear, d = jc.toLoci(u, r);
      ke.isEmpty(d) || i.push({ loci: d, color: l, clear: c });
    }
    return { layers: i };
  }, e.ofBundle = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.bundle, l = s.color, c = s.clear, d = Ma.toLoci(u, r.root);
      i.push({ loci: d, color: l, clear: c });
    }
    return { layers: i };
  }, e.toBundle = function(n) {
    for (var r = [], i = 0, a = n.layers.length; i < a; ++i) {
      var o = n.layers[i], s = o.loci, u = o.color, l = o.clear, c = Ma.fromLoci(s);
      r.push({ bundle: c, color: u, clear: l });
    }
    return { layers: r };
  };
}(T0 || (T0 = {})), function(e) {
  function t(n) {
    return n.layers.length === 0;
  }
  e.Empty = { kind: "empty-loci", layers: [] }, e.areEqual = function(n, r) {
    if (n.layers.length === 0 && r.layers.length === 0) return !0;
    if (n.layers.length !== r.layers.length) return !1;
    for (var i = 0, a = n.layers.length; i < a; ++i)
      if (n.layers[i].value !== r.layers[i].value || !zn.areEqual(n.layers[i].loci, r.layers[i].loci)) return !1;
    return !0;
  }, e.isEmpty = t, e.remap = function(n, r) {
    if (n.kind === "element-loci") {
      for (var i = [], a = 0, o = n.layers; a < o.length; a++) {
        var s = o[a], u = ke.remap(s.loci, r);
        ke.isEmpty(u) || i.push({ loci: u, value: s.value });
      }
      return { kind: "element-loci", layers: i };
    }
    return n;
  }, e.merge = function(n) {
    if (t(n)) return n;
    if (n.kind === "element-loci") {
      for (var r = n.layers[0].loci.structure, i = /* @__PURE__ */ new Map(), a = ke.none(r), o = 0, s = n.layers.length; o < s; ++o) {
        var u = n.layers[s - o - 1], l = u.loci, c = u.value;
        l = ke.subtract(l, a), a = ke.union(l, a), ke.isEmpty(l) || (i.has(c) && (l = ke.union(l, i.get(c))), i.set(c, l));
      }
      var d = [];
      return i.forEach(function(f, p) {
        d.push({ loci: f, value: p });
      }), { kind: "element-loci", layers: d };
    }
    return n;
  }, e.filter = function(n, r) {
    if (t(n)) return n;
    if (n.kind === "element-loci") {
      for (var i = n.layers[0].loci.structure, a = [], o = 0, s = n.layers; o < s.length; o++) {
        var u = s[o], l = u.loci, c = u.value, d = ke.remap(l, r);
        l = ke.remap(d, i), ke.isEmpty(l) || a.push({ loci: l, value: c });
      }
      return { kind: "element-loci", layers: a };
    }
    return n;
  }, e.ofScript = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.script, l = s.value, c = jc.toLoci(u, r);
      ke.isEmpty(c) || i.push({ loci: c, value: l });
    }
    return { kind: "element-loci", layers: i };
  }, e.ofBundle = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.bundle, l = s.value, c = Ma.toLoci(u, r.root);
      i.push({ loci: c, value: l });
    }
    return { kind: "element-loci", layers: i };
  }, e.toBundle = function(n) {
    for (var r = [], i = 0, a = n.layers.length; i < a; ++i) {
      var o = n.layers[i], s = o.loci, u = o.value, l = Ma.fromLoci(s);
      r.push({ bundle: l, value: u });
    }
    return { kind: "element-loci", layers: r };
  };
}(k0 || (k0 = {})), function(e) {
  e.create = function() {
    return { updateTransform: !1, updateMatrix: !1, updateColor: !1, updateSize: !1, createGeometry: !1, createNew: !1, info: {} };
  }, e.reset = function(t) {
    t.updateTransform = !1, t.updateMatrix = !1, t.updateColor = !1, t.updateSize = !1, t.createGeometry = !1, t.createNew = !1;
  };
}(Du || (Du = {}));
var eW = { lowestElementCount: 1e6, lowerElementCount: 5e5, lowElementCount: 1e5, mediumElementCount: 2e4, highElementCount: 2e3, coarseGrainedFactor: 10, elementCountFactor: 1 };
function Z5(e, t) {
  var n = ui(e.quality, "auto"), r = ui(e.detail, 1), i = ui(e.radialSegments, 12), a = ui(e.linearSegments, 8), o = ui(e.resolution, 2), s = ui(e.probePositions, 12), u = ui(e.doubleSided, !0), l = 0;
  if (n === "auto") {
    if (t instanceof ze) n = function(d, f) {
      f === void 0 && (f = {});
      var p = O(O({}, eW), f), g = d.elementCount * p.elementCountFactor;
      return d.isCoarseGrained && (g *= p.coarseGrainedFactor), g > p.lowestElementCount ? "lowest" : g > p.lowerElementCount ? "lower" : g > p.lowElementCount ? "low" : g > p.mediumElementCount ? "medium" : g > p.highElementCount ? "high" : "higher";
    }(t.root), l = function(d) {
      if (d.root.models.length === 1) {
        var f = Gi.Provider.get(d.root.model);
        if (f && f.spacegroup.name === "P 1" && !os.isZero(f.spacegroup.cell)) return f.spacegroup.cell.volume;
      }
      return qn.volume(d.root.boundary.box);
    }(t);
    else if ($t.is(t)) {
      var c = t.grid.cells.space.dimensions;
      n = (l = c[0] * c[1] * c[2]) < 1e7 ? "medium" : "low";
    }
  }
  switch (n) {
    case "highest":
      r = 3, i = 36, a = 18, o = 0.1, s = 72, u = !0;
      break;
    case "higher":
      r = 3, i = 28, a = 14, o = 0.3, s = 48, u = !0;
      break;
    case "high":
      r = 2, i = 20, a = 10, o = 0.5, s = 36, u = !0;
      break;
    case "medium":
      r = 1, i = 12, a = 8, o = 0.8, s = 24, u = !0;
      break;
    case "low":
      r = 0, i = 8, a = 3, o = 1.3, s = 24, u = !1;
      break;
    case "lower":
      r = 0, i = 4, a = 2, o = 3, s = 12, u = !1;
      break;
    case "lowest":
      r = 0, i = 2, a = 1, o = 8, s = 12, u = !1;
  }
  return o = Math.max(o, l / 5e8), o = Math.min(o, 20), (e.alpha !== void 0 && e.alpha < 1 || e.xrayShaded) && (u = !1), { detail: r, radialSegments: i, linearSegments: a, resolution: o, probePositions: s, doubleSided: u };
}
function mv(e, t) {
  t === void 0 && (t = 0);
  var n = e[0] * e[1] * e[2], r = Math.sqrt(n), i = Math.pow(2, Math.ceil(Math.log(r) / Math.log(2))), a = e[0] + t, o = e[1] + t, s = 1, u = a;
  return i < a * e[2] ? (a *= u = Math.floor(i / a), o *= s = Math.ceil(e[2] / u)) : a *= e[2], { width: a, height: o, columns: u, rows: s, powerOfTwoSize: o < i ? i : 2 * i };
}
function _g(e, t, n, r, i) {
  var a = e.colorType, o = e.vertexCount, s = e.groupCount, u = e.positionBuffer, l = e.transformBuffer, c = e.groupBuffer, d = e.itemSize, f = a.endsWith("Instance"), p = qn.fromSphere3D(qn(), f ? e.boundingSphere : e.invariantBoundingSphere), g = 1 + t, m = qn.expand(qn(), p, A.create(g, g, g)), v = 1 / t, h = qn.scale(qn(), m, v), y = qn.size(A(), h);
  A.ceil(y, y), A.add(y, y, A.create(2, 2, 2));
  var x = m.min, S = y[0], b = y[1], _ = mv(y), C = _.width, w = _.height, I = new Float32Array(C * w * d), M = new Float32Array(C * w), E = new Uint8Array(C * w * d), T = { array: E, width: C, height: w, filter: "linear" }, P = f ? e.instanceCount : 1, k = e.colorData.array;
  function D(ft, yt, It) {
    var ge = Math.floor(It * S % C / S), Je = Math.floor(It * S / C);
    return d * (Je * b * C + yt * C + (ge * S + ft));
  }
  for (var B = y[0], L = y[1], F = y[2], V = A(), G = 0; G < P; ++G) for (var H = 0; H < o; H += n) {
    A.fromArray(V, u, 3 * H), f && A.transformMat4Offset(V, V, l, 0, 0, 16 * G), A.sub(V, V, x), A.scale(V, V, v);
    for (var q = V[0], z = V[1], K = V[2], Y = Math.floor(q), Z = Math.floor(z), X = Math.floor(K), W = (G * s + c[H]) * d, J = Math.max(0, Y - 2), $ = Math.max(0, Z - 2), ee = Math.max(0, X - 2), ce = Math.min(B, Y + 2 + 2), ae = Math.min(L, Z + 2 + 2), he = Math.min(F, X + 2 + 2), Oe = J; Oe < ce; ++Oe) for (var Ne = Oe - q, Ue = $; Ue < ae; ++Ue) for (var Ze = Ue - z, Se = ee; Se < he; ++Se) {
      var qe = Se - K, Pe = Math.sqrt(Ne * Ne + Ze * Ze + qe * qe);
      if (!(Pe > 2)) {
        for (var Xe = 2 - Pe, Ke = D(Oe, Ue, Se), de = 0; de < d; ++de) I[Ke + de] += k[W + de] * Xe;
        M[Ke / d] += Xe;
      }
    }
  }
  G = 0;
  for (var we = M.length; G < we; ++G) {
    var Ie = G * d, Ee = M[G];
    for (de = 0; de < d; ++de) E[Ie + de] = Math.round(I[Ie + de] / Ee);
  }
  var Le = xe.create(C, w), De = Nt.create(x[0], x[1], x[2], v), rt = f ? "volumeInstance" : "volume";
  if (r) {
    if (!i) {
      var st = d === 4 ? "rgba" : d === 3 ? "rgb" : "alpha";
      i = r.resources.texture("image-uint8", st, "ubyte", "linear");
    }
    return i.load(T), { kind: "volume", texture: i, gridTexDim: Le, gridDim: y, gridTransform: De, type: rt };
  }
  var gt = function(ft) {
    var yt = ft.vertexCount, It = ft.positionBuffer, ge = ft.transformBuffer, Je = ft.grid, Mt = ft.gridDim, wn = ft.gridTexDim, tn = ft.gridTransform, Te = ft.vertexStride, At = ft.colorStride, Gt = ft.itemOffset || 0, Tt = ft.outputStride;
    if (Tt + Gt > At) throw new Error("outputStride + itemOffset must NOT be larger than colorStride");
    var nn = ft.colorType.endsWith("Instance"), Pt = nn ? ft.instanceCount : 1, Yt = ci(Math.max(1, Pt * yt), Tt, Uint8Array), Rn = Yt.array, kn = Mt[0], Pn = Mt[1], Kn = wn[0], br = A.fromArray(A(), tn, 0), ra = tn[3];
    function dr(qf, Nh, _d) {
      var rc = Math.floor(_d * kn % Kn / kn), Js = Math.floor(_d * kn / Kn);
      return At * (Js * Pn * Kn + Nh * Kn + (rc * kn + qf));
    }
    for (var Ln = A(), Cr = A(), yi = A(), ri = A(), Hi = 0; Hi < Pt; ++Hi) for (var ia = 0; ia < yt; ++ia) {
      A.fromArray(Ln, It, ia * Te), nn && A.transformMat4Offset(Ln, Ln, ge, 0, 0, 16 * Hi), A.sub(Ln, Ln, br), A.scale(Ln, Ln, ra), A.floor(Cr, Ln), A.ceil(yi, Ln), A.sub(ri, Ln, Cr), A.sub(Ln, yi, Cr), A.div(ri, ri, Ln);
      for (var Mr = Cr[0], ye = Cr[1], Yn = Cr[2], bi = yi[0], ro = yi[1], gs = yi[2], io = ri[0], Zm = ri[1], $l = ri[2], ao = dr(Mr, ye, Yn) + Gt, Do = dr(bi, ye, Yn) + Gt, Th = dr(Mr, ye, gs) + Gt, zf = dr(bi, ye, gs) + Gt, kh = dr(Mr, ro, Yn) + Gt, ec = dr(bi, ro, Yn) + Gt, ga = dr(Mr, ro, gs) + Gt, vs = dr(bi, ro, gs) + Gt, zu = (Hi * yt + ia) * Tt, _i = 0; _i < Tt; ++_i) {
        var Dh = Je[ao + _i], Uf = Je[Do + _i], Oh = Je[Th + _i], tc = Je[zf + _i], va = Je[kh + _i], yd = Je[ec + _i], ys = Je[ga + _i], bd = Je[vs + _i], Bh = si(Dh, Uf, io), Hf = si(Oh, tc, io), Rh = si(va, yd, io), Qm = si(ys, bd, io), Lh = si(Bh, Rh, Zm), nc = si(Hf, Qm, Zm);
        Rn[zu + _i] = si(Lh, nc, $l);
      }
    }
    return Yt;
  }({ vertexCount: o, instanceCount: P, transformBuffer: l, positionBuffer: u, colorType: rt, grid: E, gridDim: y, gridTexDim: Le, gridTransform: De, vertexStride: 3, colorStride: d, outputStride: d });
  return { kind: "vertex", texture: gt, texDim: xe.create(gt.width, gt.height), type: f ? "vertexInstance" : "vertex" };
}
A.set, A.normalize, A.sub, A.addScalar, A.scale, A.toArray;
var tW = `
precision highp float;
precision highp sampler2D;

uniform sampler2D tColor;
uniform sampler2D tCount;
uniform vec2 uTexSize;

void main(void) {
    vec2 coords = gl_FragCoord.xy / uTexSize;
    vec4 color = texture2D(tColor, coords);
    float count = texture2D(tCount, coords).r;

    gl_FragColor = color / count;
}
`, nW = `
precision highp float;

varying vec3 vPosition;
varying vec4 vColor;

uniform float uCurrentSlice;
uniform float uCurrentX;
uniform float uCurrentY;
uniform float uResolution;

const float p = 2.0;

void main() {
    vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;
    vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);
    float dist = distance(fragPos, vPosition);
    if (dist > p) discard;

    float f = p - dist;
    gl_FragColor = vColor * f;
    gl_FragData[1] = vec4(f);
}
`, rW = `
precision highp float;

#include common
#include read_from_texture

uniform int uTotalCount;
uniform int uGroupCount;

attribute float aSample;
#define SampleID int(aSample)

attribute mat4 aTransform;
attribute float aInstance;

uniform vec2 uGeoTexDim;
uniform sampler2D tPosition;
uniform sampler2D tGroup;

uniform vec2 uColorTexDim;
uniform sampler2D tColor;

varying vec3 vPosition;
varying vec4 vColor;

uniform vec3 uBboxSize;
uniform vec3 uBboxMin;
uniform float uResolution;

void main() {
    vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;
    float group = unpackRGBToInt(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);

    position = (aTransform * vec4(position, 1.0)).xyz;
    gl_PointSize = 7.0;
    vPosition = (position - uBboxMin) / uResolution;
    gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);

    #if defined(dColorType_group)
        vColor = readFromTexture(tColor, group, uColorTexDim);
    #elif defined(dColorType_groupInstance)
        vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);
    #endif
}
`, iW = { drawCount: Kr("number"), instanceCount: Kr("number"), stride: Kr("number"), uTotalCount: me("i"), uInstanceCount: me("i"), uGroupCount: me("i"), aTransform: Vn("float32", 16, 1), aInstance: Vn("float32", 1, 1), aSample: Vn("float32", 1, 0), uGeoTexDim: me("v2", "buffered"), tPosition: Rt("texture", "rgba", "float", "nearest"), tGroup: Rt("texture", "rgba", "float", "nearest"), uColorTexDim: me("v2"), tColor: Rt("texture", "rgba", "ubyte", "nearest"), dColorType: Bt("string", ["group", "groupInstance", "vertex", "vertexInstance"]), uCurrentSlice: me("f"), uCurrentX: me("f"), uCurrentY: me("f"), uBboxMin: me("v3", "material"), uBboxSize: me("v3", "material"), uResolution: me("f", "material") }, fo = "color-accumulate", rp = "color-count";
function CA(e, t) {
  for (var n = new Float32Array(e), r = 0; r < e; ++r) n[r] = r * t;
  return n;
}
function aW(e, t, n, r, i) {
  if (e.namedComputeRenderables[fo]) {
    var a = A.sub(A(), n.max, n.min), o = e.namedComputeRenderables[fo].values, s = Math.round(t.vertexCount / i);
    (s > o.drawCount.ref.value || i !== o.stride.ref.value) && R.update(o.aSample, CA(s, i)), R.updateIfChanged(o.drawCount, s), R.updateIfChanged(o.instanceCount, t.instanceCount), R.updateIfChanged(o.stride, i), R.updateIfChanged(o.uTotalCount, t.vertexCount), R.updateIfChanged(o.uInstanceCount, t.instanceCount), R.updateIfChanged(o.uGroupCount, t.groupCount), R.update(o.aTransform, t.transformBuffer), R.update(o.aInstance, t.instanceBuffer), R.update(o.uGeoTexDim, xe.set(o.uGeoTexDim.ref.value, t.positionTexture.getWidth(), t.positionTexture.getHeight())), R.update(o.tPosition, t.positionTexture), R.update(o.tGroup, t.groupTexture), R.update(o.uColorTexDim, xe.set(o.uColorTexDim.ref.value, t.colorData.getWidth(), t.colorData.getHeight())), R.update(o.tColor, t.colorData), R.updateIfChanged(o.dColorType, t.colorType), R.updateIfChanged(o.uCurrentSlice, 0), R.updateIfChanged(o.uCurrentX, 0), R.updateIfChanged(o.uCurrentY, 0), R.update(o.uBboxMin, n.min), R.update(o.uBboxSize, a), R.updateIfChanged(o.uResolution, r), e.namedComputeRenderables[fo].update();
  } else e.namedComputeRenderables[fo] = function(u, l, c, d, f) {
    var p = A.sub(A(), c.max, c.min), g = Math.round(l.vertexCount / f), m = { drawCount: R.create(g), instanceCount: R.create(l.instanceCount), stride: R.create(f), uTotalCount: R.create(l.vertexCount), uInstanceCount: R.create(l.instanceCount), uGroupCount: R.create(l.groupCount), aTransform: R.create(l.transformBuffer), aInstance: R.create(l.instanceBuffer), aSample: R.create(CA(g, f)), uGeoTexDim: R.create(xe.create(l.positionTexture.getWidth(), l.positionTexture.getHeight())), tPosition: R.create(l.positionTexture), tGroup: R.create(l.groupTexture), uColorTexDim: R.create(xe.create(l.colorData.getWidth(), l.colorData.getHeight())), tColor: R.create(l.colorData), dColorType: R.create(l.colorType), uCurrentSlice: R.create(0), uCurrentX: R.create(0), uCurrentY: R.create(0), uBboxMin: R.create(c.min), uBboxSize: R.create(p), uResolution: R.create(d) }, v = O({}, iW), h = gr("accumulate", rW, nW, { drawBuffers: "required" }), y = gi(u, "points", h, v, m);
    return vi(y, m);
  }(e, t, n, r, i);
  return e.namedComputeRenderables[fo];
}
var oW = O(O({}, Ei), { tColor: Rt("texture", "rgba", "float", "nearest"), tCount: Rt("texture", "alpha", "float", "nearest"), uTexSize: me("v2") }), ip = "color-normalize";
function sW(e, t, n) {
  if (e.namedComputeRenderables[ip]) {
    var r = e.namedComputeRenderables[ip].values;
    R.update(r.tColor, t), R.update(r.tCount, n), R.update(r.uTexSize, xe.set(r.uTexSize.ref.value, t.getWidth(), t.getHeight())), e.namedComputeRenderables[ip].update();
  } else e.namedComputeRenderables[ip] = function(i, a, o) {
    var s = O(O({}, Pi), { tColor: R.create(a), tCount: R.create(o), uTexSize: R.create(xe.create(a.getWidth(), a.getHeight())) }), u = O({}, oW), l = gr("normalize", da, tW), c = gi(i, "triangles", l, u, s);
    return vi(c, s);
  }(e, t, n);
  return e.namedComputeRenderables[ip];
}
function f4(e, t, n, r, i) {
  var a = r.extensions.drawBuffers;
  if (!a) throw new Error("need WebGL draw buffers");
  var o = r.gl, s = r.resources, u = r.state, l = r.extensions, c = l.colorBufferHalfFloat, d = l.textureHalfFloat, f = e.colorType.endsWith("Instance"), p = qn.fromSphere3D(qn(), f ? e.boundingSphere : e.invariantBoundingSphere), g = 1 + t, m = qn.expand(qn(), p, A.create(g, g, g)), v = 1 / t, h = qn.scale(qn(), m, v), y = qn.size(A(), h);
  A.ceil(y, y), A.add(y, y, A.create(2, 2, 2));
  var x = m.min, S = y[0], b = y[1], _ = y[2], C = function(Z) {
    var X = Z[0] * Z[1] * Z[2], W = Math.sqrt(X), J = Math.pow(2, Math.ceil(Math.log(W) / Math.log(2))), $ = 0, ee = Z[1], ce = 1, ae = Z[2];
    return J < Z[0] * Z[2] ? (ae = Math.floor(J / Z[0]), ce = Math.ceil(Z[2] / ae), $ = ae * Z[0], ee *= ce) : $ = Z[0] * Z[2], { texDimX: $, texDimY: ee, texRows: ce, texCols: ae, powerOfTwoSize: ee < J ? J : 2 * J };
  }(y), w = C.texDimX, I = C.texDimY, M = C.texCols;
  r.namedFramebuffers[fo] || (r.namedFramebuffers[fo] = r.resources.framebuffer());
  var E = r.namedFramebuffers[fo];
  Jt(o) ? (r.namedTextures[fo] || (r.namedTextures[fo] = c && d ? s.texture("image-float16", "rgba", "fp16", "nearest") : s.texture("image-float32", "rgba", "float", "nearest")), r.namedTextures[rp] || (r.namedTextures[rp] = s.texture("image-float32", "alpha", "float", "nearest"))) : (r.namedTextures[fo] || (r.namedTextures[fo] = s.texture("image-float32", "rgba", "float", "nearest")), r.namedTextures[rp] || (r.namedTextures[rp] = s.texture("image-float32", "rgba", "float", "nearest")));
  var T = r.namedTextures[fo], P = r.namedTextures[rp];
  T.define(w, I), P.define(w, I), T.attachFramebuffer(E, 0), P.attachFramebuffer(E, 1);
  var k = aW(r, e, m, t, n);
  u.currentRenderItemId = -1, E.bind(), a.drawBuffers([a.COLOR_ATTACHMENT0, a.COLOR_ATTACHMENT1]);
  var D = k.values, B = D.uCurrentSlice, L = D.uCurrentX, F = D.uCurrentY;
  (function(Z) {
    var X = Z.gl, W = Z.state;
    W.disable(X.CULL_FACE), W.enable(X.BLEND), W.disable(X.DEPTH_TEST), W.enable(X.SCISSOR_TEST), W.depthMask(!1), W.clearColor(0, 0, 0, 0), W.blendFunc(X.ONE, X.ONE), W.blendEquation(X.FUNC_ADD);
  })(r), o.viewport(0, 0, w, I), o.scissor(0, 0, w, I), o.clear(o.COLOR_BUFFER_BIT), R.update(F, 0);
  for (var V = 0, G = 0, H = 0, q = 0; q < _; ++q) V >= M && (V -= M, G += b, H = 0, R.update(F, G)), R.update(L, H), R.update(B, q), o.viewport(H, G, S, b), o.scissor(H, G, S, b), k.render(), ++V, H += S;
  T.detachFramebuffer(E, 0), P.detachFramebuffer(E, 1), a.drawBuffers([o.COLOR_ATTACHMENT0, o.NONE]), i || (i = s.texture("image-uint8", "rgba", "ubyte", "linear")), i.define(w, I);
  var z = sW(r, T, P);
  u.currentRenderItemId = -1, function(Z) {
    var X = Z.gl, W = Z.state;
    W.disable(X.CULL_FACE), W.enable(X.BLEND), W.disable(X.DEPTH_TEST), W.enable(X.SCISSOR_TEST), W.depthMask(!1), W.clearColor(0, 0, 0, 0), W.blendFunc(X.ONE, X.ONE), W.blendEquation(X.FUNC_ADD);
  }(r), i.attachFramebuffer(E, 0), o.viewport(0, 0, w, I), o.scissor(0, 0, w, I), o.clear(o.COLOR_BUFFER_BIT), z.render();
  var K = Nt.create(x[0], x[1], x[2], v), Y = f ? "volumeInstance" : "volume";
  return { texture: i, gridDim: y, gridTexDim: xe.create(w, I), gridTransform: K, type: Y };
}
var Qt, SA, i1 = "color-smoothing-rgba", m4 = "color-smoothing-alpha";
function D0(e) {
  return { layers: e };
}
function O0(e) {
  return { layers: e };
}
(function(e) {
  e.setVisibility = function(t, n) {
    t && (t.state.visible = n);
  }, e.setAlphaFactor = function(t, n) {
    t && (t.state.alphaFactor = n);
  }, e.setPickable = function(t, n) {
    t && (t.state.pickable = n);
  }, e.setColorOnly = function(t, n) {
    t && (t.state.colorOnly = n);
  }, e.mark = function(t, n, r, i, a) {
    if (!t || td(n)) return !1;
    var o = t.values, s = o.tMarker, u = o.uMarker, l = o.markerAverage, c = o.markerStatus, d = o.uGroupCount, f = o.instanceCount, p = d.ref.value * f.ref.value, g = s.ref.value.array, m = c.ref.value;
    if (!Ya(n)) {
      var v = 0;
      if (i(n, function(b) {
        return v += le.size(b), !0;
      }, !0), v === 0) return !1;
      v === p && (n = t8);
    }
    var h = !1, y = -1, x = -1;
    if (Ya(n)) {
      var S = function(b, _) {
        var C = -1, w = -1;
        switch (b) {
          case lt.Highlight:
            _ === 0 || _ === 1 ? (C = 1, w = 1) : _ === 2 || _ === 3 ? (C = 1, w = 3) : C = 1;
            break;
          case lt.RemoveHighlight:
            _ === 0 || _ === 1 ? (C = 0, w = 0) : _ !== 2 && _ !== 3 || (C = 1, w = 2);
            break;
          case lt.Select:
            _ === 1 || _ === 3 ? (C = 1, w = 3) : _ === 0 || _ === 2 ? (C = 1, w = 2) : C = 1;
            break;
          case lt.Deselect:
            _ === 1 || _ === 3 ? (C = 1, w = 1) : _ !== 0 && _ !== 2 || (C = 0, w = 0);
            break;
          case lt.Toggle:
            _ === 1 ? (C = 1, w = 3) : _ === 2 ? (C = 0, w = 0) : _ === 3 ? (C = 1, w = 1) : _ === 0 && (C = 1, w = 2);
            break;
          case lt.Clear:
            C = 0, w = 0;
        }
        return { average: C, status: w };
      }(r, m);
      S.status !== -1 ? (h = m !== S.status) && function(b, _, C) {
        b.fill(_, 0, C);
      }(g, S.status, p) : h = Y5(g, le.ofLength(p), r), y = S.average, x = S.status;
    } else (h = i(n, function(b) {
      return Y5(g, b, r);
    }, !0)) && (y = function(b, _) {
      switch (b) {
        case lt.Highlight:
          return 0.5;
        case lt.RemoveHighlight:
          return _ === 0 ? 0 : _ === 2 || _ === 3 ? 0.5 : -1;
        case lt.Select:
          return 0.5;
        case lt.Deselect:
          return _ === 1 || _ === 3 ? 0.5 : _ === 0 ? 0 : -1;
        case lt.Toggle:
          return _ === -1 ? -1 : 0.5;
        case lt.Clear:
          return _ === -1 ? -1 : _ === 0 ? 0 : 0.5;
        case lt.None:
          return -1;
        default:
          Mi();
      }
    }(r, m), a && a.status !== -1 && y === -1 && En.isReverse(a.action, r) && zn.areEqual(n, a.loci) && (y = (x = a.status) === 0 ? 0 : 0.5));
    return h && (y === -1 && (y = gD(g, p)) === 0 && (x = 0), a && (a.action = r, a.loci = n, a.status = m), R.updateIfChanged(u, x), x === -1 && R.update(s, s.ref.value), R.updateIfChanged(l, y), R.updateIfChanged(c, x)), h;
  }, e.setOverpaint = function(t, n, r, i, a) {
    if (t) {
      var o = t.values, s = o.tOverpaint, u = o.dOverpaintType, l = o.dOverpaint, c = o.uGroupCount, d = o.instanceCount, f = c.ref.value * d.ref.value;
      (function(I, M) {
        var E = ci(Math.max(1, I), 4, Uint8Array, M && M.tOverpaint.ref.value.array);
        M ? (R.update(M.tOverpaint, E), R.update(M.uOverpaintTexDim, xe.create(E.width, E.height)), R.updateIfChanged(M.dOverpaint, I > 0)) : (R.create(E), R.create(xe.create(E.width, E.height)), R.create(I > 0), R.create(Ha()), R.create(A.create(1, 1, 1)), R.create(Nt.create(0, 0, 0, 1)), R.create("groupInstance"));
      })(n.layers.length ? f : 0, t.values);
      var p = s.ref.value.array;
      i && eS(p, 0, f);
      for (var g = function(I, M) {
        var E = n.layers[I], T = E.loci, P = E.color, k = E.clear;
        r(T, function(D) {
          var B = le.start(D), L = le.end(D);
          return k ? eS(p, B, L) : function(F, V, G, H) {
            for (var q = V; q < G; ++q) Ae.toArray(H, F, 4 * q), F[4 * q + 3] = 255;
            return !0;
          }(p, B, L, P);
        }, !1);
      }, m = 0, v = n.layers.length; m < v; ++m) g(m);
      if (R.update(s, s.ref.value), R.updateIfChanged(u, "groupInstance"), R.updateIfChanged(l, n.layers.length > 0), n.layers.length !== 0 && a && Ky(a.props)) {
        var h = a.geometry, y = a.props, x = a.webgl;
        if (h.kind === "mesh") {
          var S = h.meta, b = S.resolution, _ = S.overpaintTexture;
          (C = jd(y.smoothColors, !0, b)) && (function(I, M, E, T, P) {
            if (/* @__PURE__ */ function(D) {
              return D === "groupInstance";
            }(I.dOverpaintType.ref.value)) {
              var k = _g({ vertexCount: I.uVertexCount.ref.value, instanceCount: I.uInstanceCount.ref.value, groupCount: I.uGroupCount.ref.value, transformBuffer: I.aTransform.ref.value, instanceBuffer: I.aInstance.ref.value, positionBuffer: I.aPosition.ref.value, groupBuffer: I.aGroup.ref.value, colorData: I.tOverpaint.ref.value, colorType: I.dOverpaintType.ref.value, boundingSphere: I.boundingSphere.ref.value, invariantBoundingSphere: I.invariantBoundingSphere.ref.value, itemSize: 4 }, M, E, T, P);
              k.kind === "volume" ? (R.updateIfChanged(I.dOverpaintType, k.type), R.update(I.tOverpaintGrid, k.texture), R.update(I.uOverpaintTexDim, k.gridTexDim), R.update(I.uOverpaintGridDim, k.gridDim), R.update(I.uOverpaintGridTransform, k.gridTransform)) : k.kind === "vertex" && (R.updateIfChanged(I.dOverpaintType, k.type), R.update(I.tOverpaint, k.texture), R.update(I.uOverpaintTexDim, k.texDim));
            }
          }(t.values, C.resolution, C.stride, x, _), h.meta.overpaintTexture = t.values.tOverpaintGrid.ref.value);
        } else if (x && h.kind === "texture-mesh") {
          var C, w = h.meta;
          b = w.resolution, _ = w.overpaintTexture, (C = jd(y.smoothColors, !0, b)) && (function(I, M, E, T, P) {
            if (/* @__PURE__ */ function(B) {
              return B === "groupInstance";
            }(I.dOverpaintType.ref.value)) {
              E *= 3, T.namedTextures[i1] || (T.namedTextures[i1] = T.resources.texture("image-uint8", "rgba", "ubyte", "nearest"));
              var k = T.namedTextures[i1];
              k.load(I.tOverpaint.ref.value);
              var D = f4({ vertexCount: I.uVertexCount.ref.value, instanceCount: I.uInstanceCount.ref.value, groupCount: I.uGroupCount.ref.value, transformBuffer: I.aTransform.ref.value, instanceBuffer: I.aInstance.ref.value, positionTexture: I.tPosition.ref.value, groupTexture: I.tGroup.ref.value, colorData: k, colorType: I.dOverpaintType.ref.value, boundingSphere: I.boundingSphere.ref.value, invariantBoundingSphere: I.invariantBoundingSphere.ref.value }, M, E, T, P);
              R.updateIfChanged(I.dOverpaintType, D.type), R.update(I.tOverpaintGrid, D.texture), R.update(I.uOverpaintTexDim, D.gridTexDim), R.update(I.uOverpaintGridDim, D.gridDim), R.update(I.uOverpaintGridTransform, D.gridTransform);
            }
          }(t.values, C.resolution, C.stride, x, _), h.meta.overpaintTexture = t.values.tOverpaintGrid.ref.value);
        }
      }
    }
  }, e.setTransparency = function(t, n, r, i, a) {
    if (t) {
      var o = t.values, s = o.tTransparency, u = o.dTransparencyType, l = o.transparencyAverage, c = o.dTransparency, d = o.uGroupCount, f = o.instanceCount, p = d.ref.value * f.ref.value;
      (function(M, E) {
        var T = ci(Math.max(1, M), 1, Uint8Array, E && E.tTransparency.ref.value.array);
        E ? (R.update(E.tTransparency, T), R.update(E.uTransparencyTexDim, xe.create(T.width, T.height)), R.updateIfChanged(E.dTransparency, M > 0), R.updateIfChanged(E.transparencyAverage, tS(T.array, M))) : (R.create(T), R.create(xe.create(T.width, T.height)), R.create(M > 0), R.create(0), R.create(Ha()), R.create(A.create(1, 1, 1)), R.create(Nt.create(0, 0, 0, 1)), R.create("groupInstance"));
      })(n.layers.length ? p : 0, t.values);
      var g = s.ref.value.array;
      i && function(M, E, T) {
        M.fill(0, E, T);
      }(g, 0, p);
      for (var m = function(M, E) {
        var T = n.layers[M], P = T.loci, k = T.value;
        r(P, function(D) {
          var B = le.start(D), L = le.end(D);
          return function(F, V, G, H) {
            for (var q = V; q < G; ++q) F[q] = 255 * H;
            return !0;
          }(g, B, L, k);
        }, !1);
      }, v = 0, h = n.layers.length; v < h; ++v) m(v);
      if (R.update(s, s.ref.value), R.updateIfChanged(l, tS(g, p)), R.updateIfChanged(u, "groupInstance"), R.updateIfChanged(c, n.layers.length > 0), n.layers.length !== 0 && a && Ky(a.props)) {
        var y = a.geometry, x = a.props, S = a.webgl;
        if (y.kind === "mesh") {
          var b = y.meta, _ = b.resolution, C = b.transparencyTexture;
          (w = jd(x.smoothColors, !0, _)) && (function(M, E, T, P, k) {
            if (/* @__PURE__ */ function(B) {
              return B === "groupInstance";
            }(M.dTransparencyType.ref.value)) {
              var D = _g({ vertexCount: M.uVertexCount.ref.value, instanceCount: M.uInstanceCount.ref.value, groupCount: M.uGroupCount.ref.value, transformBuffer: M.aTransform.ref.value, instanceBuffer: M.aInstance.ref.value, positionBuffer: M.aPosition.ref.value, groupBuffer: M.aGroup.ref.value, colorData: M.tTransparency.ref.value, colorType: M.dTransparencyType.ref.value, boundingSphere: M.boundingSphere.ref.value, invariantBoundingSphere: M.invariantBoundingSphere.ref.value, itemSize: 1 }, E, T, P, k);
              D.kind === "volume" ? (R.updateIfChanged(M.dTransparencyType, D.type), R.update(M.tTransparencyGrid, D.texture), R.update(M.uTransparencyTexDim, D.gridTexDim), R.update(M.uTransparencyGridDim, D.gridDim), R.update(M.uTransparencyGridTransform, D.gridTransform)) : D.kind === "vertex" && (R.updateIfChanged(M.dTransparencyType, D.type), R.update(M.tTransparency, D.texture), R.update(M.uTransparencyTexDim, D.texDim));
            }
          }(t.values, w.resolution, w.stride, S, C), y.meta.transparencyTexture = t.values.tTransparencyGrid.ref.value);
        } else if (S && y.kind === "texture-mesh") {
          var w, I = y.meta;
          _ = I.resolution, C = I.transparencyTexture, (w = jd(x.smoothColors, !0, _)) && (function(M, E, T, P, k) {
            if (/* @__PURE__ */ function(L) {
              return L === "groupInstance";
            }(M.dTransparencyType.ref.value)) {
              T *= 3, P.namedTextures[m4] || (P.namedTextures[m4] = P.resources.texture("image-uint8", "alpha", "ubyte", "nearest"));
              var D = P.namedTextures[m4];
              D.load(M.tTransparency.ref.value);
              var B = f4({ vertexCount: M.uVertexCount.ref.value, instanceCount: M.uInstanceCount.ref.value, groupCount: M.uGroupCount.ref.value, transformBuffer: M.aTransform.ref.value, instanceBuffer: M.aInstance.ref.value, positionTexture: M.tPosition.ref.value, groupTexture: M.tGroup.ref.value, colorData: D, colorType: M.dTransparencyType.ref.value, boundingSphere: M.boundingSphere.ref.value, invariantBoundingSphere: M.invariantBoundingSphere.ref.value }, E, T, P, k);
              R.updateIfChanged(M.dTransparencyType, B.type), R.update(M.tTransparencyGrid, B.texture), R.update(M.uTransparencyTexDim, B.gridTexDim), R.update(M.uTransparencyGridDim, B.gridDim), R.update(M.uTransparencyGridTransform, B.gridTransform);
            }
          }(t.values, w.resolution, w.stride, S, C), y.meta.transparencyTexture = t.values.tTransparencyGrid.ref.value);
        }
      }
    }
  }, e.setSubstance = function(t, n, r, i, a) {
    if (t) {
      var o = t.values, s = o.tSubstance, u = o.dSubstanceType, l = o.dSubstance, c = o.uGroupCount, d = o.instanceCount, f = c.ref.value * d.ref.value;
      (function(I, M) {
        var E = ci(Math.max(1, I), 4, Uint8Array, M && M.tSubstance.ref.value.array);
        M ? (R.update(M.tSubstance, E), R.update(M.uSubstanceTexDim, xe.create(E.width, E.height)), R.updateIfChanged(M.dSubstance, I > 0)) : (R.create(E), R.create(xe.create(E.width, E.height)), R.create(I > 0), R.create(Ha()), R.create(A.create(1, 1, 1)), R.create(Nt.create(0, 0, 0, 1)), R.create("groupInstance"));
      })(n.layers.length ? f : 0, t.values);
      var p = s.ref.value.array;
      i && nS(p, 0, f);
      for (var g = function(I, M) {
        var E = n.layers[I], T = E.loci, P = E.material, k = E.clear;
        r(T, function(D) {
          var B = le.start(D), L = le.end(D);
          return k ? nS(p, B, L) : function(F, V, G, H) {
            for (var q = V; q < G; ++q) im.toArray(H, F, 4 * q), F[4 * q + 3] = 255;
            return !0;
          }(p, B, L, P);
        }, !1);
      }, m = 0, v = n.layers.length; m < v; ++m) g(m);
      if (R.update(s, s.ref.value), R.updateIfChanged(u, "groupInstance"), R.updateIfChanged(l, n.layers.length > 0), n.layers.length !== 0 && a && Ky(a.props)) {
        var h = a.geometry, y = a.props, x = a.webgl;
        if (h.kind === "mesh") {
          var S = h.meta, b = S.resolution, _ = S.substanceTexture;
          (C = jd(y.smoothColors, !0, b)) && (function(I, M, E, T, P) {
            if (/* @__PURE__ */ function(D) {
              return D === "groupInstance";
            }(I.dSubstanceType.ref.value)) {
              var k = _g({ vertexCount: I.uVertexCount.ref.value, instanceCount: I.uInstanceCount.ref.value, groupCount: I.uGroupCount.ref.value, transformBuffer: I.aTransform.ref.value, instanceBuffer: I.aInstance.ref.value, positionBuffer: I.aPosition.ref.value, groupBuffer: I.aGroup.ref.value, colorData: I.tSubstance.ref.value, colorType: I.dSubstanceType.ref.value, boundingSphere: I.boundingSphere.ref.value, invariantBoundingSphere: I.invariantBoundingSphere.ref.value, itemSize: 4 }, M, E, T, P);
              k.kind === "volume" ? (R.updateIfChanged(I.dSubstanceType, k.type), R.update(I.tSubstanceGrid, k.texture), R.update(I.uSubstanceTexDim, k.gridTexDim), R.update(I.uSubstanceGridDim, k.gridDim), R.update(I.uSubstanceGridTransform, k.gridTransform)) : k.kind === "vertex" && (R.updateIfChanged(I.dSubstanceType, k.type), R.update(I.tSubstance, k.texture), R.update(I.uSubstanceTexDim, k.texDim));
            }
          }(t.values, C.resolution, C.stride, x, _), h.meta.substanceTexture = t.values.tSubstanceGrid.ref.value);
        } else if (x && h.kind === "texture-mesh") {
          var C, w = h.meta;
          b = w.resolution, _ = w.substanceTexture, (C = jd(y.smoothColors, !0, b)) && (function(I, M, E, T, P) {
            if (/* @__PURE__ */ function(B) {
              return B === "groupInstance";
            }(I.dSubstanceType.ref.value)) {
              E *= 3, T.namedTextures[i1] || (T.namedTextures[i1] = T.resources.texture("image-uint8", "rgba", "ubyte", "nearest"));
              var k = T.namedTextures[i1];
              k.load(I.tSubstance.ref.value);
              var D = f4({ vertexCount: I.uVertexCount.ref.value, instanceCount: I.uInstanceCount.ref.value, groupCount: I.uGroupCount.ref.value, transformBuffer: I.aTransform.ref.value, instanceBuffer: I.aInstance.ref.value, positionTexture: I.tPosition.ref.value, groupTexture: I.tGroup.ref.value, colorData: k, colorType: I.dSubstanceType.ref.value, boundingSphere: I.boundingSphere.ref.value, invariantBoundingSphere: I.invariantBoundingSphere.ref.value }, M, E, T, P);
              R.updateIfChanged(I.dSubstanceType, D.type), R.update(I.tSubstanceGrid, D.texture), R.update(I.uSubstanceTexDim, D.gridTexDim), R.update(I.uSubstanceGridDim, D.gridDim), R.update(I.uSubstanceGridTransform, D.gridTransform);
            }
          }(t.values, C.resolution, C.stride, x, _), h.meta.substanceTexture = t.values.tSubstanceGrid.ref.value);
        }
      }
    }
  }, e.setClipping = function(t, n, r, i) {
    if (t) {
      var a = t.values, o = a.tClipping, s = a.dClipping, u = a.uGroupCount, l = a.instanceCount, c = u.ref.value * l.ref.value;
      (function(m, v) {
        var h = ci(Math.max(1, m), 1, Uint8Array, v && v.tClipping.ref.value.array);
        v ? (R.update(v.tClipping, h), R.update(v.uClippingTexDim, xe.create(h.width, h.height)), R.updateIfChanged(v.dClipping, m > 0)) : (R.create(h), R.create(xe.create(h.width, h.height)), R.create(m > 0));
      })(n.layers.length ? c : 0, t.values);
      var d = o.ref.value.array;
      i && function(m, v, h) {
        m.fill(0, v, h);
      }(d, 0, c);
      for (var f = function(m, v) {
        var h = n.layers[m], y = h.loci, x = h.groups;
        r(y, function(S) {
          var b = le.start(S), _ = le.end(S);
          return function(C, w, I, M) {
            return C.fill(M, w, I), !0;
          }(d, b, _, x);
        }, !1);
      }, p = 0, g = n.layers.length; p < g; ++p) f(p);
      R.update(o, o.ref.value), R.updateIfChanged(s, n.layers.length > 0);
    }
  }, e.setTransform = function(t, n, r) {
    if (t && (n || r)) {
      var i = t.values;
      n && (ne.copy(i.matrix.ref.value, n), R.update(i.matrix, i.matrix.ref.value)), r ? (i.extraTransform.ref.value.set(r), R.update(i.extraTransform, i.extraTransform.ref.value)) : r === null && (B5(i.extraTransform.ref.value, i.instanceCount.ref.value), R.update(i.extraTransform, i.extraTransform.ref.value)), vD(i);
      var a = Si(i.invariantBoundingSphere.ref.value, i.aTransform.ref.value, i.instanceCount.ref.value);
      R.update(i.boundingSphere, a);
    }
  };
})(Qt || (Qt = {})), function(e) {
  function t(n) {
    return n.layers.length === 0;
  }
  e.Empty = { layers: [] }, function(n) {
    function r(i) {
      switch (i) {
        case "one":
          return 1;
        case "two":
          return 2;
        case "three":
          return 4;
        case "four":
          return 8;
        case "five":
          return 16;
        case "six":
          return 32;
      }
    }
    n.is = Qi.has, n.create = function(i) {
      return Qi.create(i);
    }, n.Names = { one: 1, two: 2, three: 4, four: 8, five: 16, six: 32 }, n.isName = function(i) {
      return i in n.Names;
    }, n.fromName = r, n.fromNames = function(i) {
      for (var a = 0, o = 0, s = i.length; o < s; ++o) a |= r(i[o]);
      return a;
    }, n.toNames = function(i) {
      var a = [];
      return n.is(i, 1) && a.push("one"), n.is(i, 2) && a.push("two"), n.is(i, 4) && a.push("three"), n.is(i, 8) && a.push("four"), n.is(i, 16) && a.push("five"), n.is(i, 32) && a.push("six"), a;
    };
  }(e.Groups || (e.Groups = {})), e.areEqual = function(n, r) {
    if (n.layers.length !== r.layers.length) return !1;
    for (var i = 0, a = n.layers.length; i < a; ++i)
      if (n.layers[i].groups !== r.layers[i].groups || !zn.areEqual(n.layers[i].loci, r.layers[i].loci)) return !1;
    return !0;
  }, e.isEmpty = t, e.remap = function(n, r) {
    for (var i = [], a = 0, o = n.layers; a < o.length; a++) {
      var s = o[a], u = s.loci, l = s.groups;
      u = ke.remap(u, r), ke.isEmpty(u) || i.push({ loci: u, groups: l });
    }
    return { layers: i };
  }, e.merge = function(n) {
    if (t(n)) return n;
    for (var r = n.layers[0].loci.structure, i = /* @__PURE__ */ new Map(), a = ke.none(r), o = 0, s = n.layers.length; o < s; ++o) {
      var u = n.layers[s - o - 1], l = u.loci, c = u.groups;
      l = ke.subtract(l, a), a = ke.union(l, a), ke.isEmpty(l) || (i.has(c) && (l = ke.union(l, i.get(c))), i.set(c, l));
    }
    var d = [];
    return i.forEach(function(f, p) {
      d.push({ loci: f, groups: p });
    }), { layers: d };
  }, e.filter = function(n, r) {
    if (t(n)) return n;
    for (var i = n.layers[0].loci.structure, a = [], o = 0, s = n.layers; o < s.length; o++) {
      var u = s[o], l = u.loci, c = u.groups, d = ke.remap(l, r);
      l = ke.remap(d, i), ke.isEmpty(l) || a.push({ loci: l, groups: c });
    }
    return { layers: a };
  }, e.ofScript = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.script, l = s.groups, c = jc.toLoci(u, r);
      ke.isEmpty(c) || i.push({ loci: c, groups: l });
    }
    return { layers: i };
  }, e.ofBundle = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.bundle, l = s.groups, c = Ma.toLoci(u, r.root);
      i.push({ loci: c, groups: l });
    }
    return { layers: i };
  }, e.toBundle = function(n) {
    for (var r = [], i = 0, a = n.layers.length; i < a; ++i) {
      var o = n.layers[i], s = o.loci, u = o.groups, l = Ma.fromLoci(s);
      r.push({ bundle: l, groups: u });
    }
    return { layers: r };
  };
}(D0 || (D0 = {})), function(e) {
  function t(n) {
    return n.layers.length === 0;
  }
  e.Empty = { layers: [] }, e.areEqual = function(n, r) {
    if (n.layers.length === 0 && r.layers.length === 0) return !0;
    if (n.layers.length !== r.layers.length) return !1;
    for (var i = 0, a = n.layers.length; i < a; ++i)
      if (n.layers[i].clear !== r.layers[i].clear || !Az(n.layers[i].material, r.layers[i].material) || !zn.areEqual(n.layers[i].loci, r.layers[i].loci)) return !1;
    return !0;
  }, e.isEmpty = t, e.remap = function(n, r) {
    for (var i = [], a = 0, o = n.layers; a < o.length; a++) {
      var s = o[a], u = s.loci, l = s.material, c = s.clear;
      u = ke.remap(u, r), ke.isEmpty(u) || i.push({ loci: u, material: l, clear: c });
    }
    return { layers: i };
  }, e.merge = function(n) {
    if (t(n)) return n;
    for (var r = n.layers[0].loci.structure, i = void 0, a = /* @__PURE__ */ new Map(), o = ke.none(r), s = 0, u = n.layers.length; s < u; ++s) {
      var l = n.layers[u - s - 1], c = l.loci, d = l.material, f = l.clear;
      c = ke.subtract(c, o), o = ke.union(c, o), ke.isEmpty(c) || (f ? i = i ? ke.union(c, i) : c : (a.has(d) && (c = ke.union(c, a.get(d))), a.set(d, c)));
    }
    var p = [];
    return i && p.push({ loci: i, material: im(), clear: !0 }), a.forEach(function(g, m) {
      p.push({ loci: g, material: m, clear: !1 });
    }), { layers: p };
  }, e.filter = function(n, r) {
    if (t(n)) return n;
    for (var i = n.layers[0].loci.structure, a = [], o = 0, s = n.layers; o < s.length; o++) {
      var u = s[o], l = u.loci, c = u.material, d = u.clear, f = ke.remap(l, r);
      l = ke.remap(f, i), ke.isEmpty(l) || a.push({ loci: l, material: c, clear: d });
    }
    return { layers: a };
  }, e.ofScript = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.script, l = s.material, c = s.clear, d = jc.toLoci(u, r);
      ke.isEmpty(d) || i.push({ loci: d, material: l, clear: c });
    }
    return { layers: i };
  }, e.ofBundle = function(n, r) {
    for (var i = [], a = 0, o = n.length; a < o; ++a) {
      var s = n[a], u = s.bundle, l = s.material, c = s.clear, d = Ma.toLoci(u, r.root);
      i.push({ loci: d, material: l, clear: c });
    }
    return { layers: i };
  }, e.toBundle = function(n) {
    for (var r = [], i = 0, a = n.layers.length; i < a; ++i) {
      var o = n.layers[i], s = o.loci, u = o.material, l = o.clear, c = Ma.fromLoci(s);
      r.push({ bundle: c, material: u, clear: l });
    }
    return { layers: r };
  };
}(O0 || (O0 = {})), function(e) {
  e.getDetaultParams = function(t, n, r) {
    return N.getDefaultValues(t.getParams(n, r));
  };
}(SA || (SA = {}));
var en, pv, uW = { name: "", label: "", description: "", factory: function() {
  return en.Empty;
}, getParams: function() {
  return {};
}, defaultValues: {}, defaultColorTheme: Ll.EmptyProvider, defaultSizeTheme: Ea.EmptyProvider, isApplicable: function() {
  return !0;
} };
function AA(e) {
  return e.map(function(t) {
    return [t.name, t.provider.label];
  });
}
(function() {
  function e() {
    this._list = [], this._map = /* @__PURE__ */ new Map(), this._name = /* @__PURE__ */ new Map();
  }
  Object.defineProperty(e.prototype, "default", { get: function() {
    return this._list[0];
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "types", { get: function() {
    return AA(this._list);
  }, enumerable: !1, configurable: !0 }), e.prototype.add = function(t) {
    if (this._map.has(t.name)) throw new Error("".concat(t.name, " already registered."));
    this._list.push({ name: t.name, provider: t }), this._map.set(t.name, t), this._name.set(t, t.name);
  }, e.prototype.getName = function(t) {
    if (!this._name.has(t)) throw new Error("'".concat(t.label, "' is not a registered represenatation provider."));
    return this._name.get(t);
  }, e.prototype.remove = function(t) {
    var n = t.name;
    this._list.splice(this._list.findIndex(function(i) {
      return i.name === n;
    }), 1);
    var r = this._map.get(n);
    r && (this._map.delete(n), this._name.delete(r));
  }, e.prototype.get = function(t) {
    return this._map.get(t) || uW;
  }, Object.defineProperty(e.prototype, "list", { get: function() {
    return this._list;
  }, enumerable: !1, configurable: !0 }), e.prototype.getApplicableList = function(t) {
    return this._list.filter(function(n) {
      return n.provider.isApplicable(t);
    });
  }, e.prototype.getApplicableTypes = function(t) {
    return AA(this.getApplicableList(t));
  };
})(), function(e) {
  function t() {
    return { visible: !0, alphaFactor: 1, pickable: !0, colorOnly: !1, syncManually: !1, transform: ne.identity(), overpaint: T0.Empty, transparency: k0.Empty, substance: O0.Empty, clipping: D0.Empty, markerActions: En.All };
  }
  function n(i, a) {
    a.visible !== void 0 && (i.visible = a.visible), a.alphaFactor !== void 0 && (i.alphaFactor = a.alphaFactor), a.pickable !== void 0 && (i.pickable = a.pickable), a.colorOnly !== void 0 && (i.colorOnly = a.colorOnly), a.overpaint !== void 0 && (i.overpaint = a.overpaint), a.transparency !== void 0 && (i.transparency = a.transparency), a.substance !== void 0 && (i.substance = a.substance), a.clipping !== void 0 && (i.clipping = a.clipping), a.syncManually !== void 0 && (i.syncManually = a.syncManually), a.transform !== void 0 && ne.copy(i.transform, a.transform), a.markerActions !== void 0 && (i.markerActions = a.markerActions);
  }
  (function(i) {
    i.areEqual = function(a, o) {
      return a.repr === o.repr && zn.areEqual(a.loci, o.loci);
    }, i.isEmpty = function(a) {
      return zn.isEmpty(a.loci);
    }, i.Empty = { loci: cr };
  })(e.Loci || (e.Loci = {})), e.createState = t, e.updateState = n, e.StateBuilder = { create: t, update: n }, e.Empty = { label: "", groupCount: 0, renderObjects: [], geometryVersion: -1, props: {}, params: {}, updated: new qr(), state: t(), theme: us.createEmpty(), createOrUpdate: function() {
    return Xt.constant("", void 0);
  }, setState: function() {
  }, setTheme: function() {
  }, getLoci: function() {
    return cr;
  }, mark: function() {
    return !1;
  }, destroy: function() {
  } };
  var r = function() {
    function i() {
      this.curr = /* @__PURE__ */ new Set(), this.next = /* @__PURE__ */ new Set(), this._version = -1;
    }
    return Object.defineProperty(i.prototype, "version", { get: function() {
      return this._version;
    }, enumerable: !1, configurable: !0 }), i.prototype.add = function(a, o) {
      this.next.add(as(a, o));
    }, i.prototype.snapshot = function() {
      var a;
      ka.areEqual(this.curr, this.next) || (this._version += 1), a = [this.next, this.curr], this.curr = a[0], this.next = a[1], this.next.clear();
    }, i;
  }();
  e.GeometryState = r, e.createMulti = function(i, a, o, s, u) {
    var l, c, d, f = this, p = 0, g = new qr(), m = new r(), v = s.create(), h = us.createEmpty(), y = {}, x = Object.keys(u).map(function(S, b) {
      y[b] = S;
      var _ = u[S](a, o);
      return _.setState(v), _;
    });
    return { label: i, updated: g, get groupCount() {
      var S = 0;
      if (c) for (var b = c.visuals, _ = 0, C = x.length; _ < C; ++_) b && !b.includes(y[_]) || (S += x[_].groupCount);
      return S;
    }, get renderObjects() {
      var S = [];
      if (c) for (var b = c.visuals, _ = 0, C = x.length; _ < C; ++_) b && !b.includes(y[_]) || S.push.apply(S, x[_].renderObjects);
      return S;
    }, get geometryVersion() {
      return m.version;
    }, get props() {
      return c;
    }, get params() {
      return l;
    }, createOrUpdate: function(S, b) {
      S === void 0 && (S = {}), b && b !== d && (l = o(a, b), d = b, c || (c = N.getDefaultValues(l))), c || (c = {});
      var _ = Z5(Object.assign({}, c || {}, S || {}), d);
      Object.assign(c, S || {}, _ || {});
      var C = c.visuals;
      return Xt.create("Creating or updating '".concat(i, "' representation"), function(w) {
        return se(f, 0, void 0, function() {
          var I, M;
          return ie(this, function(E) {
            switch (E.label) {
              case 0:
                I = 0, M = x.length, E.label = 1;
              case 1:
                return I < M ? C && !C.includes(y[I]) ? [3, 3] : [4, x[I].createOrUpdate(c, d).runInContext(w)] : [3, 5];
              case 2:
                E.sent(), E.label = 3;
              case 3:
                m.add(I, x[I].geometryVersion), E.label = 4;
              case 4:
                return ++I, [3, 1];
              case 5:
                return m.snapshot(), g.next(p++), [2];
            }
          });
        });
      });
    }, get state() {
      return v;
    }, get theme() {
      return h;
    }, getLoci: function(S) {
      for (var b = c.visuals, _ = 0, C = x.length; _ < C; ++_) if (!b || b.includes(y[_])) {
        var w = x[_].getLoci(S);
        if (!td(w)) return w;
      }
      return cr;
    }, mark: function(S, b) {
      for (var _ = !1, C = 0, w = x.length; C < w; ++C) _ = x[C].mark(S, b) || _;
      return _;
    }, setState: function(S) {
      s.update(v, S);
      for (var b = 0, _ = x.length; b < _; ++b) x[b].setState(S);
      g.next(p++);
    }, setTheme: function(S) {
      h = S;
      for (var b = 0, _ = x.length; b < _; ++b) x[b].setTheme(S);
    }, destroy: function() {
      for (var S = 0, b = x.length; S < b; ++S) x[S].destroy();
    } };
  }, e.fromRenderObject = function(i, a) {
    var o = this, s = 0, u = new qr(), l = new r(), c = e.createState(), d = us.createEmpty(), f = N.clone(Qe.Params), p = N.getDefaultValues(Qe.Params);
    return { label: i, updated: u, get groupCount() {
      return a.values.uGroupCount.ref.value;
    }, get renderObjects() {
      return [a];
    }, get geometryVersion() {
      return l.version;
    }, get props() {
      return p;
    }, get params() {
      return f;
    }, createOrUpdate: function(g) {
      g === void 0 && (g = {});
      var m = Z5(Object.assign({}, p, g));
      return Object.assign(p, g, m), Xt.create("Updating '".concat(i, "' representation"), function(v) {
        return se(o, 0, void 0, function() {
          return ie(this, function(h) {
            return l.add(0, a.id), l.snapshot(), u.next(s++), [2];
          });
        });
      });
    }, get state() {
      return c;
    }, get theme() {
      return d;
    }, getLoci: function() {
      return cr;
    }, mark: function(g, m) {
      return !1;
    }, setState: function(g) {
      g.visible !== void 0 && Qt.setVisibility(a, g.visible), g.alphaFactor !== void 0 && Qt.setAlphaFactor(a, g.alphaFactor), g.pickable !== void 0 && Qt.setPickable(a, g.pickable), g.colorOnly !== void 0 && Qt.setColorOnly(a, g.colorOnly), g.overpaint, g.transparency, g.substance, g.transform !== void 0 && Qt.setTransform(a, g.transform), e.updateState(c, g);
    }, setTheme: function() {
    }, destroy: function() {
    } };
  };
}(en || (en = {})), function(e) {
  e.create = function() {
    return { view: ne.identity(), position: A.create(0, 0, 0), direction: A.create(0, 0, -1), up: A.create(0, 1, 0) };
  };
  var t = A.zero();
  e.update = function(n) {
    A.add(t, n.position, n.direction), ne.lookAt(n.view, n.position, t, n.up);
  };
}(pv || (pv = {}));
var lm, lW = function() {
  function e() {
    this.removeList = Dx(), this.removeMap = /* @__PURE__ */ new Map(), this.addList = Dx(), this.addMap = /* @__PURE__ */ new Map();
  }
  return Object.defineProperty(e.prototype, "isEmpty", { get: function() {
    return this.removeList.count === 0 && this.addList.count === 0;
  }, enumerable: !1, configurable: !0 }), e.prototype.add = function(t) {
    if (this.removeMap.has(t)) {
      var n = this.removeMap.get(t);
      this.removeMap.delete(t), this.removeList.remove(n);
    }
    if (!this.addMap.has(t)) {
      var r = this.addList.addLast(t);
      this.addMap.set(t, r);
    }
  }, e.prototype.remove = function(t) {
    if (this.addMap.has(t)) {
      var n = this.addMap.get(t);
      this.addMap.delete(t), this.addList.remove(n);
    }
    if (!this.removeMap.has(t)) {
      var r = this.removeList.addLast(t);
      this.removeMap.set(t, r);
    }
  }, e.prototype.tryGetRemove = function() {
    var t = this.removeList.removeFirst();
    return t && this.removeMap.delete(t), t;
  }, e.prototype.tryGetAdd = function() {
    var t = this.addList.removeFirst();
    return t && this.addMap.delete(t), t;
  }, e;
}(), ap = new ms("98");
function wA(e, t, n) {
  ap.reset();
  for (var r = 0, i = e.length; r < i; ++r) if (!n || e[r].state.visible) {
    var a = e[r].values.boundingSphere.ref.value;
    a.radius && ap.includeSphere(a);
  }
  for (ap.finishedIncludeStep(), r = 0, i = e.length; r < i; ++r) if (!n || e[r].state.visible) {
    var o = e[r].values.boundingSphere.ref.value;
    o.radius && ap.radiusSphere(o);
  }
  return ap.getSphere(t);
}
function cW(e, t) {
  var n = (e.getProgram("colorBlended") || e.getProgram("colorWboit")).id, r = (t.getProgram("colorBlended") || e.getProgram("colorWboit")).id, i = e.materialId, a = t.materialId;
  return n !== r ? n - r : i !== a ? i - a : e.id - t.id;
}
(function(e) {
  e.create = function(t, n) {
    n === void 0 && (n = Z6);
    var r = /* @__PURE__ */ new Map(), i = [], a = pe(), o = pe(), s = [], u = [], l = !0, c = !0, d = pv.create(), f = d.view, p = d.position, g = d.direction, m = d.up;
    function v(_) {
      if (r.has(_)) return console.warn("RenderObject with id '".concat(_.id, "' already present")), r.get(_);
      var C = jK(t, _, n);
      return i.push(C), _.type === "direct-volume" ? u.push(C) : s.push(C), r.set(_, C), l = !0, c = !0, C;
    }
    function h(_) {
      var C = r.get(_);
      C && (C.dispose(), gg(i, C), gg(s, C), gg(u, C), r.delete(_), l = !0, c = !0);
    }
    var y = new lW(), x = -1;
    function S() {
      for (var _ = 23, C = 0, w = i.length; C < w; ++C) i[C].state.visible && (_ = 31 * _ + i[C].id | 0);
      return (_ = CT(_)) === -1 && (_ = 0), _;
    }
    function b() {
      return S() !== x && (c = !0, !0);
    }
    return { view: f, position: p, direction: g, up: m, renderables: i, primitives: { view: f, position: p, direction: g, up: m, renderables: s }, volumes: { view: f, position: p, direction: g, up: m, renderables: u }, syncVisibility: b, update: function(_, C) {
      var w;
      if (pv.update(d), _) for (var I = 0, M = _.length; I < M; ++I) (w = r.get(_[I])) === null || w === void 0 || w.update();
      else for (I = 0, M = i.length; I < M; ++I) i[I].update();
      C ? b() : (l = !0, c = !0);
    }, add: function(_) {
      return y.add(_);
    }, remove: function(_) {
      return y.remove(_);
    }, commit: function(_) {
      return _ === void 0 && (_ = Number.MAX_VALUE), function(C) {
        for (var w = Wr(), I = 0; M = y.tryGetRemove(); ) if (h(M), ++I % 100 == 0 && Wr() - w > C) return !1;
        for (; ; ) {
          var M;
          if (!(M = y.tryGetAdd())) break;
          if (v(M), ++I % 100 == 0 && Wr() - w > C) return !1;
        }
        return i.sort(cW), !0;
      }(_);
    }, get needsCommit() {
      return !y.isEmpty;
    }, has: function(_) {
      return r.has(_);
    }, clear: function() {
      for (var _ = 0, C = i.length; _ < C; ++_) i[_].dispose();
      i.length = 0, r.clear(), l = !0, c = !0;
    }, forEach: function(_) {
      r.forEach(_);
    }, get count() {
      return i.length;
    }, get boundingSphere() {
      return l && (wA(i, a, !1), l = !1), a;
    }, get boundingSphereVisible() {
      return c && (wA(i, o, !0), c = !1, x = S()), o;
    }, getMarkerAverage: function() {
      if (s.length === 0 && u.length === 0) return 0;
      for (var _ = 0, C = 0, w = s.length; C < w; ++C) _ += s[C].values.markerAverage.ref.value;
      for (C = 0, w = u.length; C < w; ++C) _ += u[C].values.markerAverage.ref.value;
      return _ / (s.length + u.length);
    } };
  };
})(lm || (lm = {}));
var Q5 = function() {
  function e(t) {
    this.camera = t, this.t = 0, this.func = e.defaultTransition, this.start = 0, this.inTransition = !1, this.durationMs = 0, this._source = Nr.createDefaultSnapshot(), this._target = Nr.createDefaultSnapshot(), this._current = Nr.createDefaultSnapshot();
  }
  return Object.defineProperty(e.prototype, "source", { get: function() {
    return this._source;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "target", { get: function() {
    return this._target;
  }, enumerable: !1, configurable: !0 }), e.prototype.apply = function(t, n, r) {
    n === void 0 && (n = 0), (!this.inTransition || n > 0) && Nr.copySnapshot(this._source, this.camera.state), this.inTransition || Nr.copySnapshot(this._target, this.camera.state), Nr.copySnapshot(this._target, t), this._target.radius > this._target.radiusMax && (this._target.radius = this._target.radiusMax), this._target.radius < 0.01 && (this._target.radius = 0.01), this._target.radiusMax < 0.01 && (this._target.radiusMax = 0.01), !this.inTransition && n <= 0 || t.mode !== void 0 && t.mode !== this.camera.state.mode ? this.finish(this._target) : (this.inTransition = !0, this.func = r || e.defaultTransition, (!this.inTransition || n > 0) && (this.start = this.t, this.durationMs = n));
  }, e.prototype.tick = function(t) {
    this.t = t, this.update();
  }, e.prototype.finish = function(t) {
    Nr.copySnapshot(this.camera.state, t), this.inTransition = !1;
  }, e.prototype.update = function() {
    if (this.inTransition) {
      var t = Math.min((this.t - this.start) / this.durationMs, 1);
      t !== 1 ? (this.func(this._current, t, this._source, this._target), Nr.copySnapshot(this.camera.state, this._current)) : this.finish(this._target);
    }
  }, e;
}();
(function(e) {
  var t = yr.identity();
  e.defaultTransition = function(n, r, i, a) {
    Nr.copySnapshot(n, a), yr.slerp(t, yr.Identity, yr.rotationTo(t, i.up, a.up), r), A.transformQuat(n.up, i.up, t), A.lerp(n.target, i.target, a.target, r), A.lerp(n.position, i.position, a.position, r), n.radius = si(i.radius, a.radius, r), n.radiusMax = si(i.radiusMax, a.radiusMax, r), n.fov = si(i.fov, a.fov, r), n.fog = si(i.fog, a.fog, r);
  };
})(Q5 || (Q5 = {}));
var IA = A(), PA = A(), p2 = Nt(), Nr = function() {
  function e(t, n, r) {
    n === void 0 && (n = Ii.create(0, 0, 128, 128)), r === void 0 && (r = {}), this.view = ne.identity(), this.projection = ne.identity(), this.projectionView = ne.identity(), this.inverseProjectionView = ne.identity(), this.state = e.createDefaultSnapshot(), this.viewOffset = e.ViewOffset(), this.near = 1, this.far = 1e4, this.fogNear = 5e3, this.fogFar = 1e4, this.zoom = 1, this.transition = new Q5(this), this.stateChanged = new Fc(this.state), this.prevProjection = ne.identity(), this.prevView = ne.identity(), this.deltaDirection = A(), this.newPosition = A(), this.viewport = n, this.pixelScale = r.pixelScale || 1, e.copySnapshot(this.state, t);
  }
  return Object.defineProperty(e.prototype, "pixelRatio", { get: function() {
    return (typeof window < "u" ? window.devicePixelRatio : 1) * this.pixelScale;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "position", { get: function() {
    return this.state.position;
  }, set: function(t) {
    A.copy(this.state.position, t);
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "up", { get: function() {
    return this.state.up;
  }, set: function(t) {
    A.copy(this.state.up, t);
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "target", { get: function() {
    return this.state.target;
  }, set: function(t) {
    A.copy(this.state.target, t);
  }, enumerable: !1, configurable: !0 }), e.prototype.update = function() {
    var t = this.state;
    if (t.radiusMax === 0) return !1;
    var n = 2 * Math.tan(t.fov / 2) * A.distance(t.position, t.target);
    switch (this.zoom = this.viewport.height / n, function(i) {
      var a = i.state, o = a.radius, s = a.radiusMax, u = (a.mode, a.fog), l = a.clipFar;
      o < 0.01 && (o = 0.01);
      var c = l ? o : s, d = A.distance(i.position, i.target), f = d - o, p = d + c, g = d - c * (-(50 - u) / 50), m = p;
      f = Math.max(Math.min(s, 5), f), p = Math.max(5, p), f === p && (p = f + 0.01), i.near = f, i.far = 2 * p, i.fogNear = g, i.fogFar = m;
    }(this), this.state.mode) {
      case "orthographic":
        (function(i) {
          var a = i.viewport, o = i.zoom, s = i.near, u = i.far, l = i.viewOffset, c = -a.width / 2, d = a.width / 2, f = a.height / 2, p = -a.height / 2, g = (d - c) / (2 * o), m = (f - p) / (2 * o), v = (d + c) / 2, h = (f + p) / 2, y = v - g, x = v + g, S = h + m, b = h - m;
          if (l.enabled) {
            var _ = o / (l.width / l.fullWidth), C = o / (l.height / l.fullHeight), w = (d - c) / l.width, I = (f - p) / l.height;
            x = (y += w * (l.offsetX / _)) + w * (l.width / _), b = (S -= I * (l.offsetY / C)) - I * (l.height / C);
          }
          ne.ortho(i.projection, y, x, S, b, s, u), ne.lookAt(i.view, i.position, i.target, i.up);
        })(this);
        break;
      case "perspective":
        (function(i) {
          var a = i.viewport.width / i.viewport.height, o = i.near, s = i.far, u = i.viewOffset, l = o * Math.tan(0.5 * i.state.fov), c = 2 * l, d = a * c, f = -0.5 * d;
          u.enabled && (f += u.offsetX * d / u.fullWidth, l -= u.offsetY * c / u.fullHeight, d *= u.width / u.fullWidth, c *= u.height / u.fullHeight), ne.perspective(i.projection, f, f + d, l, l - c, o, s), ne.lookAt(i.view, i.position, i.target, i.up);
        })(this);
        break;
      default:
        Mi(this.state.mode);
    }
    var r = !ne.areEqual(this.projection, this.prevProjection, sr) || !ne.areEqual(this.view, this.prevView, sr);
    if (r) {
      if (ne.mul(this.projectionView, this.projection, this.view), !ne.tryInvert(this.inverseProjectionView, this.projectionView)) return ne.copy(this.view, this.prevView), ne.copy(this.projection, this.prevProjection), ne.mul(this.projectionView, this.projection, this.view), !1;
      ne.copy(this.prevView, this.view), ne.copy(this.prevProjection, this.projection);
    }
    return r;
  }, e.prototype.setState = function(t, n) {
    !Number.isNaN(t.radius) && t.radius <= 0.01 || (this.transition.apply(t, n), this.stateChanged.next(t));
  }, e.prototype.getSnapshot = function() {
    return e.copySnapshot(e.createDefaultSnapshot(), this.state);
  }, e.prototype.getTargetDistance = function(t) {
    return e.targetDistance(t, this.state.fov, this.viewport.width, this.viewport.height);
  }, e.prototype.getFocus = function(t, n, r, i) {
    var a = Math.max(n, 0.01), o = this.getTargetDistance(a);
    A.sub(this.deltaDirection, this.target, this.position), i && A.matchDirection(this.deltaDirection, i, this.deltaDirection), A.setMagnitude(this.deltaDirection, this.deltaDirection, o), A.sub(this.newPosition, t, this.deltaDirection);
    var s = e.copySnapshot(e.createDefaultSnapshot(), this.state);
    return s.target = A.clone(t), s.radius = a, s.position = A.clone(this.newPosition), r && A.matchDirection(s.up, r, s.up), s;
  }, e.prototype.getInvariantFocus = function(t, n, r, i) {
    var a = Math.max(n, 0.01), o = this.getTargetDistance(a);
    A.copy(this.deltaDirection, i), A.setMagnitude(this.deltaDirection, this.deltaDirection, o), A.sub(this.newPosition, t, this.deltaDirection);
    var s = e.copySnapshot(e.createDefaultSnapshot(), this.state);
    return s.target = A.clone(t), s.radius = a, s.position = A.clone(this.newPosition), A.copy(s.up, r), s;
  }, e.prototype.focus = function(t, n, r, i, a) {
    n > 0 && this.setState(this.getFocus(t, n, i, a), r);
  }, e.prototype.project = function(t, n) {
    return function(r, i, a, o) {
      var s = a.x, u = a.y, l = a.width, c = a.height;
      Nt.set(nu, i[0], i[1], i[2], 1), Nt.transformMat4(nu, nu, o);
      var d = nu[3];
      return d !== 0 && (nu[0] /= d, nu[1] /= d, nu[2] /= d), r[0] = (nu[0] + 1) * l * 0.5 + s, r[1] = (1 - nu[1]) * c * 0.5 + u, r[2] = 0.5 * (nu[2] + 1), r[3] = d === 0 ? 0 : 1 / d, r;
    }(t, n, this.viewport, this.projectionView);
  }, e.prototype.unproject = function(t, n) {
    return Dp(t, n, this.viewport, this.inverseProjectionView);
  }, e.prototype.getPixelSize = function(t) {
    return this.project(p2, t), this.unproject(IA, p2), p2[0] += 1, this.unproject(PA, p2), A.distance(IA, PA);
  }, e;
}();
(function(e) {
  e.ViewOffset = function() {
    return { enabled: !1, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 };
  }, e.setViewOffset = function(t, n, r, i, a, o, s) {
    t.fullWidth = n, t.fullHeight = r, t.offsetX = i, t.offsetY = a, t.width = o, t.height = s;
  }, e.copyViewOffset = function(t, n) {
    t.enabled = n.enabled, t.fullWidth = n.fullWidth, t.fullHeight = n.fullHeight, t.offsetX = n.offsetX, t.offsetY = n.offsetY, t.width = n.width, t.height = n.height;
  }, e.targetDistance = function(t, n, r, i) {
    var a = Math.max(t, 0.01), o = i < r ? 1 : r / i;
    return Math.abs(a / o / Math.sin(n / 2));
  }, e.createDefaultSnapshot = function() {
    return { mode: "orthographic", fov: Math.PI / 4, position: A.create(0, 0, 100), up: A.create(0, 1, 0), target: A.create(0, 0, 0), radius: 0, radiusMax: 10, fog: 50, clipFar: !0 };
  }, e.copySnapshot = function(t, n) {
    return n && (n.mode !== void 0 && (t.mode = n.mode), n.fov !== void 0 && (t.fov = n.fov), n.position !== void 0 && A.copy(t.position, n.position), n.up !== void 0 && A.copy(t.up, n.up), n.target !== void 0 && A.copy(t.target, n.target), n.radius !== void 0 && (t.radius = n.radius), n.radiusMax !== void 0 && (t.radiusMax = n.radiusMax), n.fog !== void 0 && (t.fog = n.fog), n.clipFar !== void 0 && (t.clipFar = n.clipFar)), t;
  }, e.areSnapshotsEqual = function(t, n) {
    return t.mode === n.mode && t.fov === n.fov && t.radius === n.radius && t.radiusMax === n.radiusMax && t.fog === n.fog && t.clipFar === n.clipFar && A.exactEquals(t.position, n.position) && A.exactEquals(t.up, n.up) && A.exactEquals(t.target, n.target);
  };
})(Nr || (Nr = {}));
var dW = { radius: 1, detail: 0 };
function fW(e, t, n) {
  var r = O(O({}, dW), n), i = r.radius, a = r.detail, o = /* @__PURE__ */ function() {
    var d = [], f = [], p = /* @__PURE__ */ new Map();
    function g(m) {
      var v = "".concat(m[0].toFixed(5), "|").concat(m[1].toFixed(5), "|").concat(m[2].toFixed(5)), h = p.get(v);
      return h === void 0 && (h = d.length / 3, p.set(v, h), d.push.apply(d, m)), h;
    }
    return { vertices: d, indices: f, add: function(m, v, h) {
      f.push(g(m), g(v), g(h));
    } };
  }(), s = o.vertices, u = o.indices;
  (function(d) {
    for (var f = A(), p = A(), g = A(), m = 0; m < t.length; m += 3) A.fromArray(f, e, 3 * t[m + 0]), A.fromArray(p, e, 3 * t[m + 1]), A.fromArray(g, e, 3 * t[m + 2]), c(f, p, g, d);
  })(a), function(d, f) {
    for (var p = 0, g = d.length; p < g; p += 3) A.fromArray(Ua, d, p), A.normalize(Ua, Ua), A.scale(Ua, Ua, f), A.toArray(Ua, d, p);
  }(s, i);
  var l = new Float32Array(s.length);
  return pD(s, u, l, s.length / 3, u.length / 3), { vertices: new Float32Array(s), normals: new Float32Array(l), indices: new Uint32Array(u) };
  function c(d, f, p, g) {
    for (var m = Math.pow(2, g), v = [], h = 0; h <= m; ++h) {
      v[h] = [];
      var y = A();
      A.lerp(y, d, p, h / m);
      var x = A();
      A.lerp(x, f, p, h / m);
      for (var S = m - h, b = 0; b <= S; ++b) if (b === 0 && h === m) v[h][b] = y;
      else {
        var _ = A();
        A.lerp(_, y, x, b / S), v[h][b] = _;
      }
    }
    for (h = 0; h < m; ++h) for (b = 0; b < 2 * (m - h) - 1; ++b) {
      var C = Math.floor(b / 2);
      b % 2 == 0 ? o.add(v[h][C + 1], v[h + 1][C], v[h][C]) : o.add(v[h][C + 1], v[h + 1][C + 1], v[h + 1][C]);
    }
  }
}
var p4, Fo = (1 + Math.sqrt(5)) / 2, YD = (p4 || (p4 = bD([-1, Fo, 0, 1, Fo, 0, -1, -Fo, 0, 1, -Fo, 0, 0, -1, Fo, 0, 1, Fo, 0, -1, -Fo, 0, 1, -Fo, Fo, 0, -1, Fo, 0, 1, -Fo, 0, -1, -Fo, 0, 1], [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1])), p4), mW = YD.vertices, pW = YD.indices;
function WD(e) {
  return 10 * Math.pow(Math.pow(2, e), 2) + 2;
}
var MA = /* @__PURE__ */ new Map(), hW = ne.identity();
function gW(e) {
  var t = MA.get(e);
  return t === void 0 && (t = function(n) {
    return fW(mW, pW, { detail: n, radius: 1 });
  }(e), MA.set(e, t)), t;
}
function mi(e, t, n, r) {
  mt.addPrimitive(e, function(i, a, o) {
    return ne.scaleUniformly(i, ne.fromTranslation(i, a), o);
  }(hW, t, n), gW(r));
}
var ou = { radiusTop: 1, radiusBottom: 1, height: 1, radialSegments: 8, heightSegments: 1, topCap: !1, bottomCap: !1, thetaStart: 0, thetaLength: 2 * Math.PI }, EA = A(), TA = A(), Ra = A(), La = A(), su = A(), a1 = A(), vW = { height: 1, topCap: !0, bottomCap: !0 }, kA = /* @__PURE__ */ new Map(), DA = A.create(0, 1, 0), gu = A(), h2 = A(), OA = A(), Kc = ne(), BA = ne(), RA = A(), T1 = A(), h4 = A();
function hv(e, t, n, r, i) {
  return A.setMagnitude(h2, n, r / 2), A.add(OA, t, h2), i ? A.matchDirection(h4, DA, h2) : A.copy(h4, DA), A.set(RA, 1, r, 1), A.makeRotation(BA, h4, h2), ne.scale(e, BA, RA), ne.setTranslation(e, OA);
}
var uu = new Int32Array(9);
function r8(e) {
  var t = function(i) {
    var a, o, s, u, l, c, d, f, p;
    return uu[0] = Math.round(1e3 * ((a = i.radiusTop) !== null && a !== void 0 ? a : ou.radiusTop)), uu[1] = Math.round(1e3 * ((o = i.radiusBottom) !== null && o !== void 0 ? o : ou.radiusBottom)), uu[2] = Math.round(1e3 * ((s = i.height) !== null && s !== void 0 ? s : ou.height)), uu[3] = (u = i.radialSegments) !== null && u !== void 0 ? u : ou.radialSegments, uu[4] = (l = i.heightSegments) !== null && l !== void 0 ? l : ou.heightSegments, uu[5] = ((c = i.topCap) !== null && c !== void 0 ? c : ou.topCap) ? 1 : 0, uu[6] = ((d = i.bottomCap) !== null && d !== void 0 ? d : ou.bottomCap) ? 1 : 0, uu[7] = Math.round(1e3 * ((f = i.thetaStart) !== null && f !== void 0 ? f : ou.thetaStart)), uu[8] = Math.round(1e3 * ((p = i.thetaLength) !== null && p !== void 0 ? p : ou.thetaLength)), pa(uu);
  }(e), n = kA.get(t);
  if (n === void 0) {
    if (e.radialSegments && e.radialSegments <= 4) {
      var r = function(i, a) {
        var o = i.length / 3;
        if (o < 3) throw new Error("need at least 3 points to build a prism");
        var s = O(O({}, vW), a), u = s.height, l = s.topCap, c = s.bottomCap, d = 2 * o, f = 4 * o, p = (l ? 1 : 0) + (c ? 1 : 0);
        o === 3 ? (d += p, f += 3 * p) : o === 4 ? (d += 2 * p, f += 4 * p) : (d += p * o, f += p * o * 3);
        var g = uh(d, f), m = 0.5 * u;
        A.set(EA, 0, 0, -m), A.set(TA, 0, 0, m);
        for (var v = 0; v < o; ++v) {
          var h = (v + 1) % o;
          A.set(Ra, i[3 * v], i[3 * v + 1], -m), A.set(La, i[3 * h], i[3 * h + 1], -m), A.set(su, i[3 * h], i[3 * h + 1], m), A.set(a1, i[3 * v], i[3 * v + 1], m), g.addQuad(Ra, La, su, a1);
        }
        if (o === 3) l && (A.set(Ra, i[0], i[1], -m), A.set(La, i[3], i[4], -m), A.set(su, i[6], i[7], -m), g.add(su, La, Ra)), c && (A.set(Ra, i[0], i[1], m), A.set(La, i[3], i[4], m), A.set(su, i[6], i[7], m), g.add(Ra, La, su));
        else if (o === 4) l && (A.set(Ra, i[0], i[1], -m), A.set(La, i[3], i[4], -m), A.set(su, i[6], i[7], -m), A.set(a1, i[9], i[10], -m), g.addQuad(a1, su, La, Ra)), c && (A.set(Ra, i[0], i[1], m), A.set(La, i[3], i[4], m), A.set(su, i[6], i[7], m), A.set(a1, i[9], i[10], m), g.addQuad(Ra, La, su, a1));
        else for (v = 0; v < o; ++v) h = (v + 1) % o, l && (A.set(Ra, i[3 * v], i[3 * v + 1], -m), A.set(La, i[3 * h], i[3 * h + 1], -m), g.add(EA, La, Ra)), c && (A.set(Ra, i[3 * v], i[3 * v + 1], m), A.set(La, i[3 * h], i[3 * h + 1], m), g.add(Ra, La, TA));
        return g.getPrimitive();
      }(p3(Math.max(3, e.radialSegments), !0, e.radiusTop), e);
      n = m3(r, ne.rotX90);
    } else n = function(i) {
      var a = O(O({}, ou), i), o = a.radiusTop, s = a.radiusBottom, u = a.height, l = a.radialSegments, c = a.heightSegments, d = a.topCap, f = a.bottomCap, p = a.thetaStart, g = a.thetaLength, m = [], v = [], h = [], y = 0, x = [], S = u / 2;
      return function() {
        for (var _ = A.zero(), C = (s - o) / u, w = 0; w <= c; ++w) {
          for (var I = [], M = w / c, E = M * (s - o) + o, T = 0; T <= l; ++T) {
            var P = T / l * g + p, k = Math.sin(P), D = Math.cos(P);
            v.push(E * k, -M * u + S, E * D), A.normalize(_, A.set(_, k, C, D)), h.push.apply(h, _), I.push(y++);
          }
          x.push(I);
        }
        for (T = 0; T < l; ++T) for (w = 0; w < c; ++w) {
          var B = x[w][T], L = x[w + 1][T], F = x[w + 1][T + 1], V = x[w][T + 1];
          m.push(B, L, V), m.push(L, F, V);
        }
      }(), d && o > 0 && b(!0), f && s > 0 && b(!1), { vertices: new Float32Array(v), normals: new Float32Array(h), indices: new Uint32Array(m) };
      function b(_) {
        for (var C = _ === !0 ? o : s, w = _ === !0 ? 1 : -1, I = y, M = 1; M <= l; ++M) v.push(0, S * w, 0), h.push(0, w, 0), ++y;
        var E = y;
        for (M = 0; M <= l; ++M) {
          var T = M / l * g + p, P = Math.cos(T), k = Math.sin(T);
          v.push(C * k, S * w, C * P), h.push(0, w, 0), ++y;
        }
        for (M = 0; M < l; ++M) {
          var D = I + M, B = E + M;
          _ === !0 ? m.push(B, B + 1, D) : m.push(B + 1, B, D);
        }
      }
    }(e);
    kA.set(t, n);
  }
  return n;
}
function li(e, t, n, r, i) {
  var a = A.distance(t, n) * r;
  A.sub(gu, n, t), hv(Kc, t, gu, a, !0), mt.addPrimitive(e, Kc, r8(i));
}
function yW(e, t, n, r, i, a) {
  var o = A.distance(t, n) * r, s = r8(a);
  A.sub(gu, n, t), A.add(T1, t, i), hv(Kc, T1, gu, o, !0), mt.addPrimitive(e, Kc, s), A.sub(T1, t, i), hv(Kc, T1, gu, o, !0), mt.addPrimitive(e, Kc, s);
}
function o0(e, t, n, r, i, a) {
  var o = Math.floor(i / 2), s = 1 / i;
  if (r < 1) {
    var u = r / 2 / i;
    r += i % 2 == 1 ? u : -u;
  }
  var l = A.distance(t, n) * r, c = r8(a);
  A.sub(gu, n, t);
  for (var d = 0; d < o; ++d) {
    var f = s * (2 * d + 1);
    A.setMagnitude(gu, gu, l * f), A.add(T1, t, gu), hv(Kc, T1, gu, l * s, !1), mt.addPrimitive(e, Kc, c);
  }
}
var mt, kr = A(), LA = pi(), Qu = A(), lu = A(), Pd = A(), g2 = A(), uo = A.fromArray, bW = A.triangleNormal, NA = A.copy, v2 = A.transformMat4, FA = A.transformMat3, VA = pi.directionTransform, Cs = be.add3, g4 = be.add;
(function(e) {
  function t(r, i, a, o) {
    var s = r.vertices, u = r.normals, l = r.indices, c = r.groups, d = r.currentGroup, f = s.elementCount;
    Cs(s, i[0], i[1], i[2]), Cs(s, a[0], a[1], a[2]), Cs(s, o[0], o[1], o[2]), bW(kr, i, a, o);
    for (var p = 0; p < 3; ++p) Cs(u, kr[0], kr[1], kr[2]), g4(c, d);
    Cs(l, f, f + 1, f + 2);
  }
  function n(r, i, a) {
    for (var o = a.vertices, s = a.normals, u = a.indices, l = r.vertices, c = r.normals, d = r.indices, f = r.groups, p = r.currentGroup, g = l.elementCount, m = VA(LA, i), v = 0, h = o.length; v < h; v += 3) v2(kr, uo(kr, o, v), i), Cs(l, kr[0], kr[1], kr[2]), FA(kr, uo(kr, s, v), m), Cs(c, kr[0], kr[1], kr[2]), g4(f, p);
    for (v = 0, h = u.length; v < h; v += 3) Cs(d, u[v] + g, u[v + 1] + g, u[v + 2] + g);
  }
  e.createState = function(r, i, a) {
    return r === void 0 && (r = 2048), i === void 0 && (i = 1024), { currentGroup: -1, vertices: be.create(Float32Array, 3, i, a ? a.vertexBuffer.ref.value : r), normals: be.create(Float32Array, 3, i, a ? a.normalBuffer.ref.value : r), indices: be.create(Uint32Array, 3, 3 * i, a ? a.indexBuffer.ref.value : 3 * r), groups: be.create(Float32Array, 1, i, a ? a.groupBuffer.ref.value : r), mesh: a };
  }, e.addTriangle = t, e.addTriangleStrip = function(r, i, a) {
    uo(Pd, i, 3 * a[0]), uo(g2, i, 3 * a[1]);
    for (var o = 2, s = a.length; o < s; o += 2) NA(Qu, Pd), NA(lu, g2), uo(Pd, i, 3 * a[o]), uo(g2, i, 3 * a[o + 1]), t(r, Qu, lu, Pd), t(r, lu, g2, Pd);
  }, e.addTriangleFan = function(r, i, a) {
    uo(Qu, i, 3 * a[0]);
    for (var o = 2, s = a.length; o < s; ++o) uo(lu, i, 3 * a[o - 1]), uo(Pd, i, 3 * a[o]), t(r, Qu, Pd, lu);
  }, e.addPrimitive = n, e.addPrimitiveFlipped = function(r, i, a) {
    for (var o = a.vertices, s = a.normals, u = a.indices, l = r.vertices, c = r.normals, d = r.indices, f = r.groups, p = r.currentGroup, g = l.elementCount, m = VA(LA, i), v = 0, h = o.length; v < h; v += 3) v2(kr, uo(kr, o, v), i), Cs(l, kr[0], kr[1], kr[2]), FA(kr, uo(kr, s, v), m), Cs(c, -kr[0], -kr[1], -kr[2]), g4(f, p);
    for (v = 0, h = u.length; v < h; v += 3) Cs(d, u[v + 2] + g, u[v + 1] + g, u[v] + g);
  }, e.addCage = function(r, i, a, o, s, u) {
    for (var l = a.vertices, c = a.edges, d = { radiusTop: o, radiusBottom: o, radialSegments: u }, f = 0, p = c.length; f < p; f += 2) uo(Qu, l, 3 * c[f]), uo(lu, l, 3 * c[f + 1]), v2(Qu, Qu, i), v2(lu, lu, i), mi(r, Qu, o, s), mi(r, lu, o, s), li(r, Qu, lu, 1, d);
  }, e.addMesh = function(r, i, a) {
    n(r, i, { vertices: a.vertexBuffer.ref.value.subarray(0, 3 * a.vertexCount), normals: a.normalBuffer.ref.value.subarray(0, 3 * a.vertexCount), indices: a.indexBuffer.ref.value.subarray(0, 3 * a.triangleCount) });
  }, e.getMesh = function(r) {
    var i = r.vertices, a = r.normals, o = r.indices, s = r.groups, u = r.mesh, l = be.compact(i, !0), c = be.compact(o, !0), d = be.compact(a, !0), f = be.compact(s, !0);
    return Lt.create(l, c, d, f, r.vertices.elementCount, r.indices.elementCount, u);
  };
})(mt || (mt = {}));
var i8 = { sceneBoundingSpheres: N.Boolean(!1, { description: "Show full scene bounding spheres." }), visibleSceneBoundingSpheres: N.Boolean(!1, { description: "Show visible scene bounding spheres." }), objectBoundingSpheres: N.Boolean(!1, { description: "Show bounding spheres of visible render objects." }), instanceBoundingSpheres: N.Boolean(!1, { description: "Show bounding spheres of visible instances." }) }, _W = function() {
  function e(t, n, r) {
    this.objectsData = /* @__PURE__ */ new Map(), this.instancesData = /* @__PURE__ */ new Map(), this.scene = lm.create(t, v3), this.parent = n, this._props = O(O({}, N.getDefaultValues(i8)), r);
  }
  return e.prototype.update = function() {
    var t = this, n = y2(this.scene, this.parent.boundingSphere, this.sceneData, qt.lightgrey, xW);
    n && (this.sceneData = n);
    var r = y2(this.scene, this.parent.boundingSphereVisible, this.visibleSceneData, qt.black, CW);
    r && (this.visibleSceneData = r), this.parent.forEach(function(i, a) {
      var o = t.objectsData.get(a), s = y2(t.scene, i.values.boundingSphere.ref.value, o, qt.tomato, SW);
      s && t.objectsData.set(a, s);
      var u = t.instancesData.get(a), l = y2(t.scene, i.values.invariantBoundingSphere.ref.value, u, qt.skyblue, AW, { aTransform: a.values.aTransform, matrix: a.values.matrix, transform: a.values.transform, extraTransform: a.values.extraTransform, uInstanceCount: a.values.uInstanceCount, instanceCount: a.values.instanceCount, aInstance: a.values.aInstance, hasReflection: a.values.hasReflection });
      l && t.instancesData.set(a, l);
    }), this.objectsData.forEach(function(i, a) {
      t.parent.has(a) || (t.scene.remove(i.renderObject), t.objectsData.delete(a));
    }), this.instancesData.forEach(function(i, a) {
      t.parent.has(a) || (t.scene.remove(i.renderObject), t.instancesData.delete(a));
    }), this.scene.update(void 0, !1), this.scene.commit();
  }, e.prototype.syncVisibility = function() {
    var t = this;
    this.sceneData && (this.sceneData.renderObject.state.visible = this._props.sceneBoundingSpheres), this.visibleSceneData && (this.visibleSceneData.renderObject.state.visible = this._props.visibleSceneBoundingSpheres), this.parent.forEach(function(n, r) {
      var i = t.objectsData.get(r);
      i && (i.renderObject.state.visible = r.state.visible && t._props.objectBoundingSpheres);
      var a = t.instancesData.get(r);
      a && (a.renderObject.state.visible = r.state.visible && t._props.instanceBoundingSpheres);
    });
  }, e.prototype.clear = function() {
    this.sceneData = void 0, this.objectsData.clear(), this.scene.clear();
  }, Object.defineProperty(e.prototype, "isEnabled", { get: function() {
    return this._props.sceneBoundingSpheres || this._props.visibleSceneBoundingSpheres || this._props.objectBoundingSpheres || this._props.instanceBoundingSpheres;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "props", { get: function() {
    return this._props;
  }, enumerable: !1, configurable: !0 }), e.prototype.setProps = function(t) {
    Object.assign(this._props, t), this.isEnabled && this.update();
  }, e;
}();
function y2(e, t, n, r, i, a) {
  if (!n || !pe.equals(n.boundingSphere, t)) {
    var o = function(u, l) {
      var c = 2, d = WD(c), f = mt.createState(d, d / 2, l);
      if (u.radius && (mi(f, u.center, u.radius, c), pe.hasExtrema(u))) for (var p = 0, g = u.extrema; p < g.length; p++)
        mi(f, g[p], 1, 0);
      return mt.getMesh(f);
    }(t, n && n.mesh), s = n ? n.renderObject : function(u, l, c, d) {
      var f = Lt.Utils.createValuesSimple(u, { alpha: 0.1, doubleSided: !1 }, l, 1, d);
      return Gm("mesh", f, { disposed: !1, visible: !0, alphaFactor: 1, pickable: !1, colorOnly: !1, opaque: !1, writeDepth: !1 }, c);
    }(o, r, i, a);
    return n ? R.updateIfChanged(s.values.drawCount, Ui.getDrawCount(o)) : e.add(s), { boundingSphere: pe.clone(t), renderObject: s, mesh: o };
  }
}
var xW = jl(), CW = jl(), SW = jl(), AW = jl(), v4 = A(), y4 = A(), GA = A(), XD = { maxFps: N.Numeric(30, { min: 10, max: 60, step: 10 }), preferAtomPixelPadding: N.Numeric(3, { min: 0, max: 20, step: 1 }, { description: "Number of extra pixels at which to prefer atoms over bonds." }) }, wW = function() {
  function e(t, n, r, i, a) {
    var o = this;
    a === void 0 && (a = {}), this.canvasIdentify = t, this.lociGetter = n, this.input = r, this.camera = i, this.ev = Da.create(), this.events = { hover: this.ev(), drag: this.ev(), click: this.ev() }, this.startX = -1, this.startY = -1, this.endX = -1, this.endY = -1, this.id = void 0, this.position = void 0, this.currentIdentifyT = 0, this.isInteracting = !1, this.prevLoci = en.Loci.Empty, this.prevT = 0, this.inside = !1, this.buttons = yf.create(0), this.button = yf.create(0), this.modifiers = Z1.None, this.props = O(O({}, N.getDefaultValues(XD)), a), r.drag.subscribe(function(s) {
      var u = s.x, l = s.y, c = s.buttons, d = s.button, f = s.modifiers;
      o.isInteracting = !0, o.drag(u, l, c, d, f);
    }), r.move.subscribe(function(s) {
      var u = s.x, l = s.y, c = s.inside, d = s.buttons, f = s.button, p = s.modifiers;
      c && !o.isInteracting && o.move(u, l, d, f, p);
    }), r.leave.subscribe(function() {
      o.leave();
    }), r.click.subscribe(function(s) {
      var u = s.x, l = s.y, c = s.buttons, d = s.button, f = s.modifiers;
      o.outsideViewport(u, l) || o.click(u, l, c, d, f);
    }), r.interactionEnd.subscribe(function() {
      o.isInteracting = !1;
    }), r.modifiers.subscribe(function(s) {
      o.modify(s);
    });
  }
  return e.prototype.setProps = function(t) {
    Object.assign(this.props, t);
  }, e.prototype.identify = function(t, n) {
    var r = this.startX !== this.endX || this.startY !== this.endY;
    if (t !== 2) {
      if (r) {
        var i = this.canvasIdentify(this.endX, this.endY);
        this.id = i == null ? void 0 : i.id, this.position = i == null ? void 0 : i.position, this.startX = this.endX, this.startY = this.endY;
      }
      if (t === 1) {
        var a = this.getLoci(this.id, this.position);
        return this.events.click.next({ current: a, buttons: this.buttons, button: this.button, modifiers: this.modifiers, page: xe.create(this.endX, this.endY), position: this.position }), void (this.prevLoci = a);
      }
      if (this.inside && this.currentIdentifyT === n && r && !this.outsideViewport(this.endX, this.endY)) {
        var o = this.getLoci(this.id, this.position);
        this.events.hover.next({ current: o, buttons: this.buttons, button: this.button, modifiers: this.modifiers, page: xe.create(this.endX, this.endY), position: this.position }), this.prevLoci = o;
      }
    } else r && !this.outsideViewport(this.startX, this.startY) && (this.events.drag.next({ current: this.prevLoci, buttons: this.buttons, button: this.button, modifiers: this.modifiers, pageStart: xe.create(this.startX, this.startY), pageEnd: xe.create(this.endX, this.endY) }), this.startX = this.endX, this.startY = this.endY);
  }, e.prototype.tick = function(t) {
    this.inside && t - this.prevT > 1e3 / this.props.maxFps && (this.prevT = t, this.currentIdentifyT = t, this.identify(this.isInteracting ? 2 : 0, t));
  }, e.prototype.leave = function() {
    this.inside = !1, en.Loci.isEmpty(this.prevLoci) || (this.prevLoci = en.Loci.Empty, this.events.hover.next({ current: this.prevLoci, buttons: this.buttons, button: this.button, modifiers: this.modifiers }));
  }, e.prototype.move = function(t, n, r, i, a) {
    this.inside = !0, this.buttons = r, this.button = i, this.modifiers = a, this.endX = t, this.endY = n;
  }, e.prototype.click = function(t, n, r, i, a) {
    this.endX = t, this.endY = n, this.buttons = r, this.button = i, this.modifiers = a, this.identify(1, 0);
  }, e.prototype.drag = function(t, n, r, i, a) {
    this.endX = t, this.endY = n, this.buttons = r, this.button = i, this.modifiers = a, this.identify(2, 0);
  }, e.prototype.modify = function(t) {
    Z1.areEqual(t, this.modifiers) || (this.modifiers = t, this.events.hover.next({ current: this.prevLoci, buttons: this.buttons, button: this.button, modifiers: this.modifiers, page: xe.create(this.endX, this.endY), position: this.position }));
  }, e.prototype.outsideViewport = function(t, n) {
    var r = this.input, i = this.camera.viewport;
    return t *= r.pixelRatio, n *= r.pixelRatio, t > i.x + i.width || r.height - n > i.y + i.height || t < i.x || r.height - n < i.y;
  }, e.prototype.getLoci = function(t, n) {
    var r, i = this.lociGetter(t), a = i.repr, o = i.loci;
    if (n && a && pt.isLoci(o) && o.bonds.length === 2) {
      var s = o.bonds[0], u = s.aUnit, l = s.aIndex;
      u.conformation.position(u.elements[l], v4), A.sub(GA, this.camera.state.position, this.camera.state.target), A.projectPointOnPlane(y4, n, GA, v4);
      var c = this.camera.getPixelSize(y4), d = a.theme.size.size(o.bonds[0]) * ((r = a.props.sizeFactor) !== null && r !== void 0 ? r : 1);
      if (a.props.lineSizeAttenuation === !1 && (d *= c / 2), d += this.props.preferAtomPixelPadding * c, A.distance(y4, v4) < d) return { repr: a, loci: pt.toFirstStructureElementLoci(o) };
    }
    return { repr: a, loci: o };
  }, e.prototype.dispose = function() {
    this.ev.dispose();
  }, e;
}(), IW = { edgeThresholdMin: N.Numeric(0.0312, { min: 0.0312, max: 0.0833, step: 1e-4 }, { description: "Trims the algorithm from processing darks." }), edgeThresholdMax: N.Numeric(0.063, { min: 0.063, max: 0.333, step: 1e-3 }, { description: "The minimum amount of local contrast required to apply algorithm." }), iterations: N.Numeric(12, { min: 0, max: 16, step: 1 }, { description: "Number of edge exploration steps." }), subpixelQuality: N.Numeric(0.3, { min: 0, max: 1, step: 0.01 }, { description: "Choose the amount of sub-pixel aliasing removal." }) }, PW = function() {
  function e(t, n) {
    var r, i, a, o, s, u;
    this.webgl = t, this.renderable = (r = t, a = (i = n).getWidth(), o = i.getHeight(), s = O(O({}, Pi), { tColor: R.create(i), uTexSizeInv: R.create(xe.create(1 / a, 1 / o)), dEdgeThresholdMin: R.create(0.0312), dEdgeThresholdMax: R.create(0.125), dIterations: R.create(12), dSubpixelQuality: R.create(0.3) }), u = O({}, MW), vi(gi(r, "triangles", EW, u, s), s));
  }
  return e.prototype.updateState = function(t) {
    var n = this.webgl, r = n.gl, i = n.state;
    i.enable(r.SCISSOR_TEST), i.disable(r.BLEND), i.disable(r.DEPTH_TEST), i.depthMask(!1);
    var a = t.x, o = t.y, s = t.width, u = t.height;
    r.viewport(a, o, s, u), r.scissor(a, o, s, u), i.clearColor(0, 0, 0, 1), r.clear(r.COLOR_BUFFER_BIT);
  }, e.prototype.setSize = function(t, n) {
    R.update(this.renderable.values.uTexSizeInv, xe.set(this.renderable.values.uTexSizeInv.ref.value, 1 / t, 1 / n));
  }, e.prototype.update = function(t, n) {
    var r = this.renderable.values, i = n.edgeThresholdMin, a = n.edgeThresholdMax, o = n.iterations, s = n.subpixelQuality, u = !1;
    r.tColor.ref.value !== t && (R.update(this.renderable.values.tColor, t), u = !0), r.dEdgeThresholdMin.ref.value !== i && (u = !0), R.updateIfChanged(r.dEdgeThresholdMin, i), r.dEdgeThresholdMax.ref.value !== a && (u = !0), R.updateIfChanged(r.dEdgeThresholdMax, a), r.dIterations.ref.value !== o && (u = !0), R.updateIfChanged(r.dIterations, o), r.dSubpixelQuality.ref.value !== s && (u = !0), R.updateIfChanged(r.dSubpixelQuality, s), u && this.renderable.update();
  }, e.prototype.render = function(t, n) {
    n ? n.bind() : this.webgl.unbindFramebuffer(), this.updateState(t), this.renderable.render();
  }, e;
}(), MW = O(O({}, Ei), { tColor: Rt("texture", "rgba", "ubyte", "linear"), uTexSizeInv: me("v2"), dEdgeThresholdMin: Bt("number"), dEdgeThresholdMax: Bt("number"), dIterations: Bt("number"), dSubpixelQuality: Bt("number") }), EW = gr("fxaa", da, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tColor;
uniform vec2 uTexSizeInv;

// adapted from https://github.com/kosua20/Rendu
// MIT License Copyright (c) 2017 Simon Rodriguez

#define QUALITY(q) ((q) < 5 ? 1.0 : ((q) > 5 ? ((q) < 10 ? 2.0 : ((q) < 11 ? 4.0 : 8.0)) : 1.5))

float rgb2luma(vec3 rgb){
    return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114)));
}

float sampleLuma(vec2 uv) {
    return rgb2luma(texture2D(tColor, uv).rgb);
}

float sampleLuma(vec2 uv, float uOffset, float vOffset) {
    uv += uTexSizeInv * vec2(uOffset, vOffset);
    return sampleLuma(uv);
}

void main(void) {
    vec2 coords = gl_FragCoord.xy * uTexSizeInv;
    vec2 inverseScreenSize = uTexSizeInv;

    vec4 colorCenter = texture2D(tColor, coords);

    // Luma at the current fragment
    float lumaCenter = rgb2luma(colorCenter.rgb);

    // Luma at the four direct neighbours of the current fragment.
    float lumaDown = sampleLuma(coords, 0.0, -1.0);
    float lumaUp = sampleLuma(coords, 0.0, 1.0);
    float lumaLeft = sampleLuma(coords, -1.0, 0.0);
    float lumaRight = sampleLuma(coords, 1.0, 0.0);

    // Find the maximum and minimum luma around the current fragment.
    float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));
    float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));

    // Compute the delta.
    float lumaRange = lumaMax - lumaMin;

    // If the luma variation is lower that a threshold (or if we are in a really dark area),
    // we are not on an edge, don't perform any AA.
    if (lumaRange < max(dEdgeThresholdMin, lumaMax * dEdgeThresholdMax)) {
        gl_FragColor = colorCenter;
        return;
    }

    // Query the 4 remaining corners lumas.
    float lumaDownLeft = sampleLuma(coords, -1.0, -1.0);
    float lumaUpRight = sampleLuma(coords, 1.0, 1.0);
    float lumaUpLeft = sampleLuma(coords, -1.0, 1.0);
    float lumaDownRight = sampleLuma(coords, 1.0, -1.0);

    // Combine the four edges lumas (using intermediary variables for future computations
    // with the same values).
    float lumaDownUp = lumaDown + lumaUp;
    float lumaLeftRight = lumaLeft + lumaRight;

    // Same for corners
    float lumaLeftCorners = lumaDownLeft + lumaUpLeft;
    float lumaDownCorners = lumaDownLeft + lumaDownRight;
    float lumaRightCorners = lumaDownRight + lumaUpRight;
    float lumaUpCorners = lumaUpRight + lumaUpLeft;

    // Compute an estimation of the gradient along the horizontal and vertical axis.
    float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners) + abs(-2.0 * lumaCenter + lumaDownUp) * 2.0 + abs(-2.0 * lumaRight + lumaRightCorners);
    float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners) + abs(-2.0 * lumaCenter + lumaLeftRight) * 2.0 + abs(-2.0 * lumaDown + lumaDownCorners);

    // Is the local edge horizontal or vertical ?
    bool isHorizontal = (edgeHorizontal >= edgeVertical);

    // Choose the step size (one pixel) accordingly.
    float stepLength = isHorizontal ? inverseScreenSize.y : inverseScreenSize.x;

    // Select the two neighboring texels lumas in the opposite direction to the local edge.
    float luma1 = isHorizontal ? lumaDown : lumaLeft;
    float luma2 = isHorizontal ? lumaUp : lumaRight;
    // Compute gradients in this direction.
    float gradient1 = luma1 - lumaCenter;
    float gradient2 = luma2 - lumaCenter;

    // Which direction is the steepest ?
    bool is1Steepest = abs(gradient1) >= abs(gradient2);

    // Gradient in the corresponding direction, normalized.
    float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));

    // Average luma in the correct direction.
    float lumaLocalAverage = 0.0;
    if(is1Steepest){
        // Switch the direction
        stepLength = -stepLength;
        lumaLocalAverage = 0.5 * (luma1 + lumaCenter);
    } else {
        lumaLocalAverage = 0.5 * (luma2 + lumaCenter);
    }

    // Shift UV in the correct direction by half a pixel.
    vec2 currentUv = coords;
    if(isHorizontal){
        currentUv.y += stepLength * 0.5;
    } else {
        currentUv.x += stepLength * 0.5;
    }

    // Compute offset (for each iteration step) in the right direction.
    vec2 offset = isHorizontal ? vec2(inverseScreenSize.x, 0.0) : vec2(0.0, inverseScreenSize.y);
    // Compute UVs to explore on each side of the edge, orthogonally.
    // The QUALITY allows us to step faster.
    vec2 uv1 = currentUv - offset * QUALITY(0);
    vec2 uv2 = currentUv + offset * QUALITY(0);

    // Read the lumas at both current extremities of the exploration segment,
    // and compute the delta wrt to the local average luma.
    float lumaEnd1 = sampleLuma(uv1);
    float lumaEnd2 = sampleLuma(uv2);
    lumaEnd1 -= lumaLocalAverage;
    lumaEnd2 -= lumaLocalAverage;

    // If the luma deltas at the current extremities is larger than the local gradient,
    // we have reached the side of the edge.
    bool reached1 = abs(lumaEnd1) >= gradientScaled;
    bool reached2 = abs(lumaEnd2) >= gradientScaled;
    bool reachedBoth = reached1 && reached2;

    // If the side is not reached, we continue to explore in this direction.
    if(!reached1){
        uv1 -= offset * QUALITY(1);
    }
    if(!reached2){
        uv2 += offset * QUALITY(1);
    }

    // If both sides have not been reached, continue to explore.
    if(!reachedBoth){
        for(int i = 2; i < dIterations; i++){
            // If needed, read luma in 1st direction, compute delta.
            if(!reached1){
                lumaEnd1 = sampleLuma(uv1);
                lumaEnd1 = lumaEnd1 - lumaLocalAverage;
            }
            // If needed, read luma in opposite direction, compute delta.
            if(!reached2){
                lumaEnd2 = sampleLuma(uv2);
                lumaEnd2 = lumaEnd2 - lumaLocalAverage;
            }
            // If the luma deltas at the current extremities is larger than the local gradient,
            // we have reached the side of the edge.
            reached1 = abs(lumaEnd1) >= gradientScaled;
            reached2 = abs(lumaEnd2) >= gradientScaled;
            reachedBoth = reached1 && reached2;

            // If the side is not reached, we continue to explore in this direction,
            // with a variable quality.
            if(!reached1){
                uv1 -= offset * QUALITY(i);
            }
            if(!reached2){
                uv2 += offset * QUALITY(i);
            }

            // If both sides have been reached, stop the exploration.
            if(reachedBoth){
                break;
            }
        }
    }

    // Compute the distances to each side edge of the edge (!).
    float distance1 = isHorizontal ? (coords.x - uv1.x) : (coords.y - uv1.y);
    float distance2 = isHorizontal ? (uv2.x - coords.x) : (uv2.y - coords.y);

    // In which direction is the side of the edge closer ?
    bool isDirection1 = distance1 < distance2;
    float distanceFinal = min(distance1, distance2);

    // Thickness of the edge.
    float edgeThickness = (distance1 + distance2);

    // Is the luma at center smaller than the local average ?
    bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;

    // If the luma at center is smaller than at its neighbour,
    // the delta luma at each end should be positive (same variation).
    bool correctVariation1 = (lumaEnd1 < 0.0) != isLumaCenterSmaller;
    bool correctVariation2 = (lumaEnd2 < 0.0) != isLumaCenterSmaller;

    // Only keep the result in the direction of the closer side of the edge.
    bool correctVariation = isDirection1 ? correctVariation1 : correctVariation2;

    // UV offset: read in the direction of the closest side of the edge.
    float pixelOffset = - distanceFinal / edgeThickness + 0.5;

    // If the luma variation is incorrect, do not offset.
    float finalOffset = correctVariation ? pixelOffset : 0.0;

    // Sub-pixel shifting
    // Full weighted average of the luma over the 3x3 neighborhood.
    float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);
    // Ratio of the delta between the global average and the center luma,
    // over the luma range in the 3x3 neighborhood.
    float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);
    float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;
    // Compute a sub-pixel offset based on this delta.
    float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * float(dSubpixelQuality);

    // Pick the biggest of the two offsets.
    finalOffset = max(finalOffset, subPixelOffsetFinal);

    // Compute the final UV coordinates.
    vec2 finalUv = coords;
    if(isHorizontal){
        finalUv.y += finalOffset * stepLength;
    } else {
        finalUv.x += finalOffset * stepLength;
    }

    // Read the color at the new UV coordinates, and use it.
    gl_FragColor = texture2D(tColor, finalUv);
}
`), TW = { edgeThreshold: N.Numeric(0.1, { min: 0.05, max: 0.15, step: 0.01 }), maxSearchSteps: N.Numeric(16, { min: 0, max: 32, step: 1 }) }, kW = function() {
  function e(t, n) {
    if (this.webgl = t, this._supported = !1, typeof HTMLImageElement < "u") {
      var r = n.getWidth(), i = n.getHeight();
      this.edgesTarget = t.createRenderTarget(r, i, !1, "uint8", "linear"), this.weightsTarget = t.createRenderTarget(r, i, !1, "uint8", "linear"), this.edgesRenderable = function(a, o) {
        var s = o.getWidth(), u = o.getHeight(), l = O(O({}, Pi), { tColor: R.create(o), uTexSizeInv: R.create(xe.create(1 / s, 1 / u)), uViewport: R.create(Nt()), dEdgeThreshold: R.create(0.1) }), c = O({}, DW);
        return vi(gi(a, "triangles", OW, c, l), l);
      }(t, n), this.weightsRenderable = function(a, o) {
        var s = o.getWidth(), u = o.getHeight(), l = h5(a.gl, a.extensions, "image-uint8", "rgb", "ubyte", "linear"), c = h5(a.gl, a.extensions, "image-uint8", "rgba", "ubyte", "nearest"), d = O(O({}, Pi), { tEdges: R.create(o), tArea: R.create(l), tSearch: R.create(c), uTexSizeInv: R.create(xe.create(1 / s, 1 / u)), uViewport: R.create(Nt()), dMaxSearchSteps: R.create(16) });
        Cx("data:image/png;base64, ", d.tArea, l), Cx("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=", d.tSearch, c);
        var f = O({}, BW);
        return vi(gi(a, "triangles", RW, f, d), d);
      }(t, this.edgesTarget.texture), this.blendRenderable = function(a, o, s) {
        var u = o.getWidth(), l = o.getHeight(), c = O(O({}, Pi), { tColor: R.create(o), tWeights: R.create(s), uTexSizeInv: R.create(xe.create(1 / u, 1 / l)), uViewport: R.create(Nt()) }), d = O({}, LW);
        return vi(gi(a, "triangles", NW, d, c), c);
      }(t, n, this.weightsTarget.texture), this._supported = !0;
    } else In && console.log('Missing "HTMLImageElement" required for "SMAA"');
  }
  return Object.defineProperty(e.prototype, "supported", { get: function() {
    return this._supported;
  }, enumerable: !1, configurable: !0 }), e.prototype.updateState = function(t) {
    var n = this.webgl, r = n.gl, i = n.state;
    i.enable(r.SCISSOR_TEST), i.disable(r.BLEND), i.disable(r.DEPTH_TEST), i.depthMask(!1);
    var a = t.x, o = t.y, s = t.width, u = t.height;
    r.viewport(a, o, s, u), r.scissor(a, o, s, u), i.clearColor(0, 0, 0, 1), r.clear(r.COLOR_BUFFER_BIT), R.update(this.edgesRenderable.values.uViewport, Ii.toVec4(this.edgesRenderable.values.uViewport.ref.value, t)), R.update(this.weightsRenderable.values.uViewport, Ii.toVec4(this.weightsRenderable.values.uViewport.ref.value, t)), R.update(this.blendRenderable.values.uViewport, Ii.toVec4(this.blendRenderable.values.uViewport.ref.value, t));
  }, e.prototype.setSize = function(t, n) {
    var r = this.edgesTarget.getWidth(), i = this.edgesTarget.getHeight();
    t === r && n === i || (this.edgesTarget.setSize(t, n), this.weightsTarget.setSize(t, n), R.update(this.edgesRenderable.values.uTexSizeInv, xe.set(this.edgesRenderable.values.uTexSizeInv.ref.value, 1 / t, 1 / n)), R.update(this.weightsRenderable.values.uTexSizeInv, xe.set(this.weightsRenderable.values.uTexSizeInv.ref.value, 1 / t, 1 / n)), R.update(this.blendRenderable.values.uTexSizeInv, xe.set(this.blendRenderable.values.uTexSizeInv.ref.value, 1 / t, 1 / n)));
  }, e.prototype.update = function(t, n) {
    var r = !1;
    this.edgesRenderable.values.tColor.ref.value !== t && (R.update(this.edgesRenderable.values.tColor, t), r = !0), this.edgesRenderable.values.dEdgeThreshold.ref.value !== n.edgeThreshold && (R.update(this.edgesRenderable.values.dEdgeThreshold, n.edgeThreshold), r = !0), r && this.edgesRenderable.update(), this.weightsRenderable.values.dMaxSearchSteps.ref.value !== n.maxSearchSteps && (R.update(this.weightsRenderable.values.dMaxSearchSteps, n.maxSearchSteps), this.weightsRenderable.update()), this.blendRenderable.values.tColor.ref.value !== t && (R.update(this.blendRenderable.values.tColor, t), this.blendRenderable.update());
  }, e.prototype.render = function(t, n) {
    this.edgesTarget.bind(), this.updateState(t), this.edgesRenderable.render(), this.weightsTarget.bind(), this.updateState(t), this.weightsRenderable.render(), n ? n.bind() : this.webgl.unbindFramebuffer(), this.updateState(t), this.blendRenderable.render();
  }, e;
}(), DW = O(O({}, Ei), { tColor: Rt("texture", "rgba", "ubyte", "linear"), uTexSizeInv: me("v2"), uViewport: me("v4"), dEdgeThreshold: Bt("number") }), OW = gr("smaa-edges", `
precision highp float;

attribute vec2 aPosition;
uniform vec2 uQuadScale;

uniform vec2 uTexSizeInv;
uniform vec4 uViewport;

varying vec2 vUv;
varying vec4 vOffset[3];

void SMAAEdgeDetectionVS(vec2 texCoord) {
    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component
    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component
    vOffset[2] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // WebGL port note: Changed sign in W component
}

void main() {
    vec2 scale = uViewport.zw * uTexSizeInv;
    vec2 shift = uViewport.xy * uTexSizeInv;
    vUv = (aPosition + 1.0) * 0.5 * scale + shift;
    SMAAEdgeDetectionVS(vUv);
    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
    gl_Position = vec4(position, 0.0, 1.0);
}
`, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tColor;
uniform vec2 uTexSizeInv;

varying vec2 vUv;
varying vec4 vOffset[3];

vec4 SMAAColorEdgeDetectionPS(vec2 texcoord, vec4 offset[3], sampler2D colorTex) {
    vec2 threshold = vec2(dEdgeThreshold, dEdgeThreshold);

    // Calculate color deltas:
    vec4 delta;
    vec3 C = texture2D(colorTex, texcoord).rgb;

    vec3 Cleft = texture2D(colorTex, offset[0].xy).rgb;
    vec3 t = abs(C - Cleft);
    delta.x = max(max(t.r, t.g), t.b);

    vec3 Ctop = texture2D(colorTex, offset[0].zw).rgb;
    t = abs(C - Ctop);
    delta.y = max(max(t.r, t.g), t.b);

    // We do the usual threshold:
    vec2 edges = step(threshold, delta.xy);

    // Then discard if there is no edge:
    if (dot(edges, vec2(1.0, 1.0 )) == 0.0)
        discard;

    // Calculate right and bottom deltas:
    vec3 Cright = texture2D(colorTex, offset[1].xy).rgb;
    t = abs( C - Cright );
    delta.z = max(max(t.r, t.g), t.b);

    vec3 Cbottom  = texture2D(colorTex, offset[1].zw).rgb;
    t = abs(C - Cbottom);
    delta.w = max(max(t.r, t.g), t.b);

    // Calculate the maximum delta in the direct neighborhood:
    float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w );

    // Calculate left-left and top-top deltas:
    vec3 Cleftleft  = texture2D(colorTex, offset[2].xy).rgb;
    t = abs( C - Cleftleft );
    delta.z = max(max(t.r, t.g), t.b);

    vec3 Ctoptop = texture2D(colorTex, offset[2].zw).rgb;
    t = abs(C - Ctoptop);
    delta.w = max(max(t.r, t.g), t.b);

    // Calculate the final maximum delta:
    maxDelta = max(max(maxDelta, delta.z), delta.w);

    // Local contrast adaptation in action:
    edges.xy *= step(0.5 * maxDelta, delta.xy);

    return vec4(edges, 0.0, 0.0);
}

void main() {
    gl_FragColor = SMAAColorEdgeDetectionPS(vUv, vOffset, tColor);
}
`), BW = O(O({}, Ei), { tEdges: Rt("texture", "rgba", "ubyte", "linear"), tArea: Rt("texture", "rgb", "ubyte", "linear"), tSearch: Rt("texture", "rgba", "ubyte", "nearest"), uTexSizeInv: me("v2"), uViewport: me("v4"), dMaxSearchSteps: Bt("number") }), RW = gr("smaa-weights", `
precision highp float;

attribute vec2 aPosition;
uniform vec2 uQuadScale;

uniform vec2 uTexSizeInv;
uniform vec4 uViewport;

varying vec2 vUv;
varying vec4 vOffset[3];
varying vec2 vPixCoord;

void SMAABlendingWeightCalculationVS(vec2 texCoord) {
    vPixCoord = texCoord / uTexSizeInv;

    // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // WebGL port note: Changed sign in Y and W components
    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); // WebGL port note: Changed sign in Y and W components

    // And these for the searches, they indicate the ends of the loops:
    vOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * uTexSizeInv.xxyy * float(dMaxSearchSteps);
}

void main() {
    vec2 scale = uViewport.zw * uTexSizeInv;
    vec2 shift = uViewport.xy * uTexSizeInv;
    vUv = (aPosition + 1.0) * 0.5 * scale + shift;
    SMAABlendingWeightCalculationVS(vUv);
    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
    gl_Position = vec4(position, 0.0, 1.0);
}
`, `
precision highp float;
precision highp int;
precision highp sampler2D;

#define SMAASampleLevelZeroOffset(tex, coord, offset) texture2D(tex, coord + float(offset) * uTexSizeInv, 0.0)

#define SMAA_AREATEX_MAX_DISTANCE 16
#define SMAA_AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0))
#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 7.0)

uniform sampler2D tEdges;
uniform sampler2D tArea;
uniform sampler2D tSearch;
uniform vec2 uTexSizeInv;

varying vec2 vUv;
varying vec4 vOffset[3];
varying vec2 vPixCoord;

#if __VERSION__ == 100
    vec2 round(vec2 x) {
        return sign(x) * floor(abs(x) + 0.5);
    }
#endif

float SMAASearchLength(sampler2D searchTex, vec2 e, float bias, float scale) {
    // Not required if searchTex accesses are set to point:
    // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
    // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
    //     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
    e.r = bias + e.r * scale;
    return 255.0 * texture2D(searchTex, e, 0.0).r;
}

float SMAASearchXLeft(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {
    /**
     * @PSEUDO_GATHER4
     * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to
     * sample between edge, thus fetching four edges in a row.
     * Sampling with different offsets in each direction allows to disambiguate
     * which edges are active from the four fetched ones.
     */
    vec2 e = vec2(0.0, 1.0);

    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for
        e = texture2D( edgesTex, texCoord, 0.0).rg;
        texCoord -= vec2(2.0, 0.0) * uTexSizeInv;
        if (!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) break;
    }

    // We correct the previous (-0.25, -0.125) offset we applied:
    texCoord.x += 0.25 * uTexSizeInv.x;

    // The searches are bias by 1, so adjust the coords accordingly:
    texCoord.x += uTexSizeInv.x;

    // Disambiguate the length added by the last step:
    texCoord.x += 2.0 * uTexSizeInv.x; // Undo last step
    texCoord.x -= uTexSizeInv.x * SMAASearchLength(searchTex, e, 0.0, 0.5);

    return texCoord.x;
}

float SMAASearchXRight(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {
    vec2 e = vec2( 0.0, 1.0 );

    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for
        e = texture2D(edgesTex, texCoord, 0.0).rg;
        texCoord += vec2(2.0, 0.0) * uTexSizeInv;
        if (!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) break;
    }

    texCoord.x -= 0.25 * uTexSizeInv.x;
    texCoord.x -= uTexSizeInv.x;
    texCoord.x -= 2.0 * uTexSizeInv.x;
    texCoord.x += uTexSizeInv.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );

    return texCoord.x;
}

float SMAASearchYUp(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {
    vec2 e = vec2( 1.0, 0.0 );

    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for
        e = texture2D(edgesTex, texCoord, 0.0).rg;
        texCoord += vec2(0.0, 2.0) * uTexSizeInv; // WebGL port note: Changed sign
        if (!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) break;
    }

    texCoord.y -= 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y -= uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y -= 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y += uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5); // WebGL port note: Changed sign

    return texCoord.y;
}

float SMAASearchYDown(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {
    vec2 e = vec2( 1.0, 0.0 );

    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for
        e = texture2D(edgesTex, texCoord, 0.0).rg;
        texCoord -= vec2( 0.0, 2.0 ) * uTexSizeInv; // WebGL port note: Changed sign
        if (!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) break;
    }

    texCoord.y += 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y += uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y += 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign
    texCoord.y -= uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5); // WebGL port note: Changed sign

    return texCoord.y;
}

vec2 SMAAArea(sampler2D areaTex, vec2 dist, float e1, float e2, float offset) {
    // Rounding prevents precision errors of bilinear filtering:
    vec2 texCoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * vec2(e1, e2)) + dist;

    // We do a scale and bias for mapping to texel space:
    texCoord = SMAA_AREATEX_PIXEL_SIZE * texCoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);

    // Move to proper place, according to the subpixel offset:
    texCoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;

    return texture2D(areaTex, texCoord, 0.0).rg;
}

vec4 SMAABlendingWeightCalculationPS(vec2 texCoord, vec2 pixCoord, vec4 offset[3], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices) {
    vec4 weights = vec4(0.0, 0.0, 0.0, 0.0);

    vec2 e = texture2D(edgesTex, texCoord).rg;

    if (e.g > 0.0) { // Edge at north
        vec2 d;

        // Find the distance to the left:
        vec2 coords;
        coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x );
        coords.y = offset[1].y; // offset[1].y = texCoord.y - 0.25 * uTexSizeInv.y (@CROSSING_OFFSET)
        d.x = coords.x;

        // Now fetch the left crossing edges, two at a time using bilinear
        // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
        // discern what value each edge has:
        float e1 = texture2D(edgesTex, coords, 0.0).r;

        // Find the distance to the right:
        coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);
        d.y = coords.x;

        // We want the distances to be in pixel units (doing this here allow to
        // better interleave arithmetic and memory accesses):
        d = d / uTexSizeInv.x - pixCoord.x;

        // SMAAArea below needs a sqrt, as the areas texture is compressed
        // quadratically:
        vec2 sqrt_d = sqrt(abs(d));

        // Fetch the right crossing edges:
        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added
        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(1, 0)).r;

        // Ok, we know how this pattern looks like, now it is time for getting
        // the actual area:
        weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));
    }

    if (e.r > 0.0) { // Edge at west
        vec2 d;

        // Find the distance to the top:
        vec2 coords;

        coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z );
        coords.x = offset[0].x; // offset[1].x = texCoord.x - 0.25 * uTexSizeInv.x;
        d.x = coords.y;

        // Fetch the top crossing edges:
        float e1 = texture2D(edgesTex, coords, 0.0).g;

        // Find the distance to the bottom:
        coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);
        d.y = coords.y;

        // We want the distances to be in pixel units:
        d = d / uTexSizeInv.y - pixCoord.y;

        // SMAAArea below needs a sqrt, as the areas texture is compressed
        // quadratically:
        vec2 sqrt_d = sqrt(abs(d));

        // Fetch the bottom crossing edges:
        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added
        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(0, 1)).g;

        // Get the area for this direction:
        weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));
    }

    return weights;
}

void main() {
    gl_FragColor = SMAABlendingWeightCalculationPS(vUv, vPixCoord, vOffset, tEdges, tArea, tSearch, ivec4(0.0));
}
`), LW = O(O({}, Ei), { tColor: Rt("texture", "rgba", "ubyte", "linear"), tWeights: Rt("texture", "rgba", "ubyte", "linear"), uTexSizeInv: me("v2"), uViewport: me("v4") }), NW = gr("smaa-blend", `
precision highp float;

attribute vec2 aPosition;
uniform vec2 uQuadScale;

uniform vec2 uTexSizeInv;
uniform vec4 uViewport;

varying vec2 vUv;
varying vec4 vOffset[2];

void SMAANeighborhoodBlendingVS(vec2 texCoord) {
    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component
    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component
}

void main() {
    vec2 scale = uViewport.zw * uTexSizeInv;
    vec2 shift = uViewport.xy * uTexSizeInv;
    vUv = (aPosition + 1.0) * 0.5 * scale + shift;
    SMAANeighborhoodBlendingVS(vUv);
    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
    gl_Position = vec4(position, 0.0, 1.0);
}
`, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tWeights;
uniform sampler2D tColor;
uniform vec2 uTexSizeInv;

varying vec2 vUv;
varying vec4 vOffset[2];

vec4 SMAANeighborhoodBlendingPS(vec2 texCoord, vec4 offset[2], sampler2D colorTex, sampler2D blendTex) {
    // Fetch the blending weights for current pixel:
    vec4 a;
    a.xz = texture2D(blendTex, texCoord).xz;
    a.y = texture2D(blendTex, offset[1].zw).g;
    a.w = texture2D(blendTex, offset[1].xy).a;

    // Is there any blending weight with a value greater than 0.0?
    if (dot(a, vec4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {
        return texture2D(colorTex, texCoord, 0.0);
    } else {
        // Up to 4 lines can be crossing a pixel (one through each edge). We
        // favor blending by choosing the line with the maximum weight for each
        // direction:
        vec2 offset;
        offset.x = a.a > a.b ? a.a : -a.b; // left vs. right
        offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs

        // Then we go in the direction that has the maximum weight:
        if (abs(offset.x) > abs(offset.y)) { // horizontal vs. vertical
            offset.y = 0.0;
        } else {
            offset.x = 0.0;
        }

        // Fetch the opposite color and lerp by hand:
        vec4 C = texture2D(colorTex, texCoord, 0.0);
        texCoord += sign(offset) * uTexSizeInv;
        vec4 Cop = texture2D(colorTex, texCoord, 0.0);
        float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);

        // WebGL port note: Added gamma correction
        C.xyz = pow(C.xyz, vec3(2.2));
        Cop.xyz = pow(Cop.xyz, vec3(2.2));
        vec4 mixed = mix(C, Cop, s);
        mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));

        return mixed;
    }
}

void main() {
    gl_FragColor = SMAANeighborhoodBlendingPS(vUv, vOffset, tColor, tWeights);
}
`), FW = O(O({}, Ei), { tDepth: Rt("texture", "rgba", "ubyte", "nearest"), uTexSize: me("v2"), dOrthographic: Bt("number"), uNear: me("f"), uFar: me("f"), uMaxPossibleViewZDiff: me("f") }), VW = O(O({}, Ei), { tDepth: Rt("texture", "rgba", "ubyte", "nearest"), uSamples: me("v3[]"), dNSamples: Bt("number"), uProjection: me("m4"), uInvProjection: me("m4"), uBounds: me("v4"), uTexSize: me("v2"), uRadius: me("f"), uBias: me("f") }), GW = O(O({}, Ei), { tSsaoDepth: Rt("texture", "rgba", "ubyte", "nearest"), uTexSize: me("v2"), uKernel: me("f[]"), dOcclusionKernelSize: Bt("number"), uBlurDirectionX: me("f"), uBlurDirectionY: me("f"), uMaxPossibleViewZDiff: me("f"), uNear: me("f"), uFar: me("f"), uBounds: me("v4"), dOrthographic: Bt("number") });
function zA(e, t, n) {
  var r = O(O({}, Pi), { tSsaoDepth: R.create(t), uTexSize: R.create(xe.create(t.getWidth(), t.getHeight())), uKernel: R.create([0]), dOcclusionKernelSize: R.create(15), uBlurDirectionX: R.create(n === "horizontal" ? 1 : 0), uBlurDirectionY: R.create(n === "vertical" ? 1 : 0), uMaxPossibleViewZDiff: R.create(0.5), uNear: R.create(0), uFar: R.create(1e4), uBounds: R.create(Nt()), dOrthographic: R.create(0) }), i = O({}, GW);
  return vi(gi(e, "triangles", gr("ssao_blur", da, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tSsaoDepth;
uniform vec2 uTexSize;
uniform vec4 uBounds;

uniform float uKernel[dOcclusionKernelSize];

uniform float uBlurDirectionX;
uniform float uBlurDirectionY;

uniform float uMaxPossibleViewZDiff;

uniform float uNear;
uniform float uFar;

#include common

float getViewZ(const in float depth) {
    #if dOrthographic == 1
        return orthographicDepthToViewZ(depth, uNear, uFar);
    #else
        return perspectiveDepthToViewZ(depth, uNear, uFar);
    #endif
}

bool isBackground(const in float depth) {
    return depth == 1.0;
}

bool outsideBounds(const in vec2 p) {
    return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;
}

void main(void) {
    vec2 coords = gl_FragCoord.xy / uTexSize;

    vec2 packedDepth = texture2D(tSsaoDepth, coords).zw;

    if (outsideBounds(coords)) {
        gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);
        return;
    }

    float selfDepth = unpackRGToUnitInterval(packedDepth);
    // if background and if second pass
    if (isBackground(selfDepth) && uBlurDirectionY != 0.0) {
        gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);
        return;
    }

    float selfViewZ = getViewZ(selfDepth);

    vec2 offset = vec2(uBlurDirectionX, uBlurDirectionY) / uTexSize;

    float sum = 0.0;
    float kernelSum = 0.0;
    // only if kernelSize is odd
    for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {
        vec2 sampleCoords = coords + float(i) * offset;
        if (outsideBounds(sampleCoords)) {
            continue;
        }

        vec4 sampleSsaoDepth = texture2D(tSsaoDepth, sampleCoords);

        float sampleDepth = unpackRGToUnitInterval(sampleSsaoDepth.zw);
        if (isBackground(sampleDepth)) {
            continue;
        }

        if (abs(float(i)) > 1.0) { // abs is not defined for int in webgl1
            float sampleViewZ = getViewZ(sampleDepth);
            if (abs(selfViewZ - sampleViewZ) > uMaxPossibleViewZDiff) {
                continue;
            }
        }

        float kernel = uKernel[int(abs(float(i)))]; // abs is not defined for int in webgl1
        float sampleValue = unpackRGToUnitInterval(sampleSsaoDepth.xy);

        sum += kernel * sampleValue;
        kernelSum += kernel;
    }

    gl_FragColor = vec4(packUnitIntervalToRG(sum / kernelSum), packedDepth);
}
`), i, r), r);
}
var zW = O(O({}, Ei), { tSsaoDepth: Rt("texture", "rgba", "ubyte", "nearest"), tColor: Rt("texture", "rgba", "ubyte", "nearest"), tDepth: Rt("texture", "rgba", "ubyte", "nearest"), tOutlines: Rt("texture", "rgba", "ubyte", "nearest"), uTexSize: me("v2"), dOrthographic: Bt("number"), uNear: me("f"), uFar: me("f"), uFogNear: me("f"), uFogFar: me("f"), uFogColor: me("v3"), uOutlineColor: me("v3"), uTransparentBackground: me("b"), uMaxPossibleViewZDiff: me("f"), dOcclusionEnable: Bt("boolean"), uOcclusionOffset: me("v2"), dOutlineEnable: Bt("boolean"), dOutlineScale: Bt("number"), uOutlineThreshold: me("f") }), ZD = { occlusion: N.MappedStatic("on", { on: N.Group({ samples: N.Numeric(32, { min: 1, max: 256, step: 1 }), radius: N.Numeric(5, { min: 0, max: 10, step: 0.1 }, { description: "Final occlusion radius is 2^x" }), bias: N.Numeric(0.8, { min: 0, max: 3, step: 0.1 }), blurKernelSize: N.Numeric(15, { min: 1, max: 25, step: 2 }), resolutionScale: N.Numeric(1, { min: 0.1, max: 1, step: 0.05 }, { description: "Adjust resolution of occlusion calculation" }) }), off: N.Group({}) }, { cycle: !0, description: "Darken occluded crevices with the ambient occlusion effect" }), outline: N.MappedStatic("off", { on: N.Group({ scale: N.Numeric(1, { min: 1, max: 5, step: 1 }), threshold: N.Numeric(0.33, { min: 0.01, max: 1, step: 0.01 }), color: N.Color(Ae(0)) }), off: N.Group({}) }, { cycle: !0, description: "Draw outline around 3D objects" }), antialiasing: N.MappedStatic("smaa", { fxaa: N.Group(IW), smaa: N.Group(TW), off: N.Group({}) }, { options: [["fxaa", "FXAA"], ["smaa", "SMAA"], ["off", "Off"]], description: "Smooth pixel edges" }) }, ll = function() {
  function e(t, n) {
    this.webgl = t, this.drawPass = n, this.occlusionOffset = [0, 0];
    var r = n.colorTarget, i = n.depthTexture, a = r.getWidth(), o = r.getHeight();
    this.nSamples = 1, this.blurKernelSize = 1, this.downsampleFactor = 1, this.ssaoScale = this.calcSsaoScale(), this.target = t.createRenderTarget(a, o, !1, "uint8", "linear"), this.outlinesTarget = t.createRenderTarget(a, o, !1), this.outlinesRenderable = function(d, f) {
      var p = O(O({}, Pi), { tDepth: R.create(f), uTexSize: R.create(xe.create(f.getWidth(), f.getHeight())), dOrthographic: R.create(0), uNear: R.create(1), uFar: R.create(1e4), uMaxPossibleViewZDiff: R.create(0.5) }), g = O({}, FW);
      return vi(gi(d, "triangles", gr("outlines", da, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tDepth;
uniform vec2 uTexSize;

uniform float uNear;
uniform float uFar;

uniform float uMaxPossibleViewZDiff;

#include common

float getViewZ(const in float depth) {
    #if dOrthographic == 1
        return orthographicDepthToViewZ(depth, uNear, uFar);
    #else
        return perspectiveDepthToViewZ(depth, uNear, uFar);
    #endif
}

float getDepth(const in vec2 coords) {
    return unpackRGBAToDepth(texture2D(tDepth, coords));
}

bool isBackground(const in float depth) {
    return depth == 1.0;
}

void main(void) {
    float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;

    vec2 coords = gl_FragCoord.xy / uTexSize;
    vec2 invTexSize = 1.0 / uTexSize;

    float selfDepth = getDepth(coords);
    float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(getDepth(coords));

    float outline = 1.0;
    float bestDepth = 1.0;

    for (int y = -1; y <= 1; y++) {
        for (int x = -1; x <= 1; x++) {
            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;
            float sampleDepth = getDepth(sampleCoords);
            float sampleViewZ = isBackground(sampleDepth) ? backgroundViewZ : getViewZ(sampleDepth);

            if (abs(selfViewZ - sampleViewZ) > uMaxPossibleViewZDiff && selfDepth > sampleDepth && sampleDepth <= bestDepth) {
                outline = 0.0;
                bestDepth = sampleDepth;
            }
        }
    }

    gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth), 0.0);
}
`), g, p), p);
    }(t, i), this.randomHemisphereVector = [];
    for (var s = 0; s < 256; s++) {
      var u = A();
      u[0] = 2 * Math.random() - 1, u[1] = 2 * Math.random() - 1, u[2] = Math.random(), A.normalize(u, u), A.scale(u, u, Math.random()), this.randomHemisphereVector.push(u);
    }
    this.ssaoFramebuffer = t.resources.framebuffer(), this.ssaoBlurFirstPassFramebuffer = t.resources.framebuffer(), this.ssaoBlurSecondPassFramebuffer = t.resources.framebuffer();
    var l = Math.floor(a * this.ssaoScale), c = Math.floor(o * this.ssaoScale);
    this.downsampledDepthTarget = t.createRenderTarget(l, c, !1, "uint8", "linear"), this.downsampleDepthRenderable = R5(t, i), this.ssaoDepthTexture = t.resources.texture("image-uint8", "rgba", "ubyte", "linear"), this.ssaoDepthTexture.define(l, c), this.ssaoDepthTexture.attachFramebuffer(this.ssaoFramebuffer, "color0"), this.ssaoDepthBlurProxyTexture = t.resources.texture("image-uint8", "rgba", "ubyte", "linear"), this.ssaoDepthBlurProxyTexture.define(l, c), this.ssaoDepthBlurProxyTexture.attachFramebuffer(this.ssaoBlurFirstPassFramebuffer, "color0"), this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer, "color0"), this.ssaoRenderable = function(d, f) {
      var p = O(O({}, Pi), { tDepth: R.create(f), uSamples: R.create([0, 0, 1]), dNSamples: R.create(32), uProjection: R.create(ne.identity()), uInvProjection: R.create(ne.identity()), uBounds: R.create(Nt()), uTexSize: R.create(xe.create(d.gl.drawingBufferWidth, d.gl.drawingBufferHeight)), uRadius: R.create(8), uBias: R.create(0.025) }), g = O({}, VW);
      return vi(gi(d, "triangles", gr("ssao", da, `
precision highp float;
precision highp int;
precision highp sampler2D;

#include common

uniform sampler2D tDepth;
uniform vec2 uTexSize;
uniform vec4 uBounds;

uniform vec3 uSamples[dNSamples];

uniform mat4 uProjection;
uniform mat4 uInvProjection;

uniform float uRadius;
uniform float uBias;

float smootherstep(float edge0, float edge1, float x) {
    x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
    return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);
}

float noise(const in vec2 coords) {
    float a = 12.9898;
    float b = 78.233;
    float c = 43758.5453;
    float dt = dot(coords, vec2(a,b));
    float sn = mod(dt, PI);
    return abs(fract(sin(sn) * c)); // is abs necessary?
}

vec2 getNoiseVec2(const in vec2 coords) {
    return vec2(noise(coords), noise(coords + vec2(PI, 2.71828)));
}

bool isBackground(const in float depth) {
    return depth == 1.0;
}

bool outsideBounds(const in vec2 p) {
    return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;
}

float getDepth(const in vec2 coords) {
    return outsideBounds(coords) ? 1.0 : unpackRGBAToDepth(texture2D(tDepth, coords));
}

vec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {
    vec3 p1 = vec3(offset1, depth1 - depth);
    vec3 p2 = vec3(offset2, depth2 - depth);

    vec3 normal = cross(p1, p2);
    normal.z = -normal.z;

    return normalize(normal);
}

// StarCraft II Ambient Occlusion by [Filion and McNaughton 2008]
void main(void) {
    vec2 invTexSize = 1.0 / uTexSize;
    vec2 selfCoords = gl_FragCoord.xy * invTexSize;

    float selfDepth = getDepth(selfCoords);
    vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth);

    if (isBackground(selfDepth)) {
        gl_FragColor = vec4(packUnitIntervalToRG(0.0), selfPackedDepth);
        return;
    }

    vec2 offset1 = vec2(0.0, invTexSize.y);
    vec2 offset2 = vec2(invTexSize.x, 0.0);

    float selfDepth1 = getDepth(selfCoords + offset1);
    float selfDepth2 = getDepth(selfCoords + offset2);

    vec3 selfViewNormal = normalFromDepth(selfDepth, selfDepth1, selfDepth2, offset1, offset2);
    vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);

    vec3 randomVec = normalize(vec3(getNoiseVec2(selfCoords) * 2.0 - 1.0, 0.0));

    vec3 tangent = normalize(randomVec - selfViewNormal * dot(randomVec, selfViewNormal));
    vec3 bitangent = cross(selfViewNormal, tangent);
    mat3 TBN = mat3(tangent, bitangent, selfViewNormal);

    float occlusion = 0.0;
    for(int i = 0; i < dNSamples; i++){
        vec3 sampleViewPos = TBN * uSamples[i];
        sampleViewPos = selfViewPos + sampleViewPos * uRadius;

        vec4 offset = vec4(sampleViewPos, 1.0);
        offset = uProjection * offset;
        offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;

        float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, getDepth(offset.xy)), uInvProjection).z;

        occlusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uRadius / abs(selfViewPos.z - sampleViewZ));
    }
    occlusion = 1.0 - (uBias * occlusion / float(dNSamples));

    vec2 packedOcclusion = packUnitIntervalToRG(occlusion);

    gl_FragColor = vec4(packedOcclusion, selfPackedDepth);
}
`), g, p), p);
    }(t, this.downsampleFactor === 1 ? i : this.downsampledDepthTarget.texture), this.ssaoBlurFirstPassRenderable = zA(t, this.ssaoDepthTexture, "horizontal"), this.ssaoBlurSecondPassRenderable = zA(t, this.ssaoDepthBlurProxyTexture, "vertical"), this.renderable = function(d, f, p, g, m) {
      var v = O(O({}, Pi), { tSsaoDepth: R.create(m), tColor: R.create(f), tDepth: R.create(p), tOutlines: R.create(g), uTexSize: R.create(xe.create(f.getWidth(), f.getHeight())), dOrthographic: R.create(0), uNear: R.create(1), uFar: R.create(1e4), uFogNear: R.create(1e4), uFogFar: R.create(1e4), uFogColor: R.create(A.create(1, 1, 1)), uOutlineColor: R.create(A.create(0, 0, 0)), uTransparentBackground: R.create(!1), uMaxPossibleViewZDiff: R.create(0.5), dOcclusionEnable: R.create(!0), uOcclusionOffset: R.create(xe.create(0, 0)), dOutlineEnable: R.create(!1), dOutlineScale: R.create(1), uOutlineThreshold: R.create(0.33) }), h = O({}, zW);
      return vi(gi(d, "triangles", gr("postprocessing", da, `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tSsaoDepth;
uniform sampler2D tColor;
uniform sampler2D tDepth;
uniform sampler2D tOutlines;
uniform vec2 uTexSize;

uniform float uNear;
uniform float uFar;
uniform float uFogNear;
uniform float uFogFar;
uniform vec3 uFogColor;
uniform vec3 uOutlineColor;
uniform bool uTransparentBackground;

uniform vec2 uOcclusionOffset;

uniform float uMaxPossibleViewZDiff;

const vec3 occlusionColor = vec3(0.0);

#include common

float getViewZ(const in float depth) {
    #if dOrthographic == 1
        return orthographicDepthToViewZ(depth, uNear, uFar);
    #else
        return perspectiveDepthToViewZ(depth, uNear, uFar);
    #endif
}

float getDepth(const in vec2 coords) {
    return unpackRGBAToDepth(texture2D(tDepth, coords));
}

bool isBackground(const in float depth) {
    return depth == 1.0;
}

float getOutline(const in vec2 coords, out float closestTexel) {
    float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;
    vec2 invTexSize = 1.0 / uTexSize;

    float selfDepth = getDepth(coords);
    float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);

    float outline = 1.0;
    closestTexel = 1.0;
    for (int y = -dOutlineScale; y <= dOutlineScale; y++) {
        for (int x = -dOutlineScale; x <= dOutlineScale; x++) {
            if (x * x + y * y > dOutlineScale * dOutlineScale) {
                continue;
            }

            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;

            vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);
            float sampleOutline = sampleOutlineCombined.r;
            float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);

            if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {
                outline = 0.0;
                closestTexel = sampleOutlineDepth;
            }
        }
    }
    return outline;
}

float getSsao(vec2 coords) {
    float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);
    if (rawSsao > 0.999) {
        return 1.0;
    } else if (rawSsao > 0.001) {
        return rawSsao;
    }
    // treat values close to 0.0 as errors and return no occlusion
    return 1.0;
}

void main(void) {
    vec2 coords = gl_FragCoord.xy / uTexSize;
    vec4 color = texture2D(tColor, coords);

    float viewDist;
    float fogFactor;

    #ifdef dOcclusionEnable
        float depth = getDepth(coords);
        if (!isBackground(depth)) {
            viewDist = abs(getViewZ(depth));
            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
            float occlusionFactor = getSsao(coords + uOcclusionOffset);
            if (!uTransparentBackground) {
                color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);
            } else {
                color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);
            }
        }
    #endif

    // outline needs to be handled after occlusion to keep them clean
    #ifdef dOutlineEnable
        float closestTexel;
        float outline = getOutline(coords, closestTexel);

        if (outline == 0.0) {
            color.rgb = mix(uOutlineColor, color.rgb, outline);
            viewDist = abs(getViewZ(closestTexel));
            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
            if (!uTransparentBackground) {
                color.rgb = mix(color.rgb, uFogColor, fogFactor);
            } else {
                color.a = 1.0 - fogFactor;
            }
        }
    #endif

    gl_FragColor = color;
}
`), h, v), v);
    }(t, r.texture, i, this.outlinesTarget.texture, this.ssaoDepthTexture);
  }
  return e.isEnabled = function(t) {
    return t.occlusion.name === "on" || t.outline.name === "on";
  }, e.prototype.calcSsaoScale = function() {
    return Math.min(1, 1 / this.webgl.pixelRatio) * this.downsampleFactor;
  }, e.prototype.setSize = function(t, n) {
    var r = this.renderable.values.uTexSize.ref.value, i = r[0], a = r[1], o = this.calcSsaoScale();
    if (t !== i || n !== a || this.ssaoScale !== o) {
      this.ssaoScale = o;
      var s = Math.floor(t * this.ssaoScale), u = Math.floor(n * this.ssaoScale);
      this.target.setSize(t, n), this.outlinesTarget.setSize(t, n), this.downsampledDepthTarget.setSize(s, u), this.ssaoDepthTexture.define(s, u), this.ssaoDepthBlurProxyTexture.define(s, u), R.update(this.renderable.values.uTexSize, xe.set(this.renderable.values.uTexSize.ref.value, t, n)), R.update(this.outlinesRenderable.values.uTexSize, xe.set(this.outlinesRenderable.values.uTexSize.ref.value, t, n)), R.update(this.downsampleDepthRenderable.values.uTexSize, xe.set(this.downsampleDepthRenderable.values.uTexSize.ref.value, s, u)), R.update(this.ssaoRenderable.values.uTexSize, xe.set(this.ssaoRenderable.values.uTexSize.ref.value, s, u)), R.update(this.ssaoBlurFirstPassRenderable.values.uTexSize, xe.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value, s, u)), R.update(this.ssaoBlurSecondPassRenderable.values.uTexSize, xe.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value, s, u));
    }
  }, e.prototype.updateState = function(t, n, r, i) {
    var a = !1, o = !1, s = !1, u = t.state.mode === "orthographic" ? 1 : 0, l = i.outline.name === "on", c = i.occlusion.name === "on", d = ne.identity();
    if (ne.invert(d, t.projection), i.occlusion.name === "on") {
      R.update(this.ssaoRenderable.values.uProjection, t.projection), R.update(this.ssaoRenderable.values.uInvProjection, d);
      var f = this.renderable.values.uTexSize.ref.value, p = f[0], g = f[1], m = this.ssaoRenderable.values.uBounds, v = t.viewport, h = this.ssaoScale;
      if (Nt.set(m.ref.value, Math.floor(v.x * h) / (p * h), Math.floor(v.y * h) / (g * h), Math.ceil((v.x + v.width) * h) / (p * h), Math.ceil((v.y + v.height) * h) / (g * h)), R.update(m, m.ref.value), R.update(this.ssaoBlurFirstPassRenderable.values.uBounds, m.ref.value), R.update(this.ssaoBlurSecondPassRenderable.values.uBounds, m.ref.value), R.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uNear, t.near), R.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uNear, t.near), R.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uFar, t.far), R.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uFar, t.far), this.ssaoBlurFirstPassRenderable.values.dOrthographic.ref.value !== u && (s = !0), R.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.dOrthographic, u), R.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.dOrthographic, u), this.nSamples !== i.occlusion.params.samples && (o = !0, this.nSamples = i.occlusion.params.samples, R.update(this.ssaoRenderable.values.uSamples, function(B, L) {
        for (var F = [], V = 0; V < L; V++) {
          var G = (V * V + 2 * V + 1) / (L * L);
          G = 0.1 + 0.9 * G, F.push(B[V][0] * G), F.push(B[V][1] * G), F.push(B[V][2] * G);
        }
        return F;
      }(this.randomHemisphereVector, this.nSamples)), R.updateIfChanged(this.ssaoRenderable.values.dNSamples, this.nSamples)), R.updateIfChanged(this.ssaoRenderable.values.uRadius, Math.pow(2, i.occlusion.params.radius)), R.updateIfChanged(this.ssaoRenderable.values.uBias, i.occlusion.params.bias), this.blurKernelSize !== i.occlusion.params.blurKernelSize) {
        s = !0, this.blurKernelSize = i.occlusion.params.blurKernelSize;
        var y = function(B) {
          for (var L = B / 3, F = Math.floor((B + 1) / 2), V = [], G = 0; G < F; G++) V.push(1 / (Math.sqrt(2 * Math.PI) * L) * Math.exp(-G * G / (2 * L * L)));
          return V;
        }(this.blurKernelSize);
        R.update(this.ssaoBlurFirstPassRenderable.values.uKernel, y), R.update(this.ssaoBlurSecondPassRenderable.values.uKernel, y), R.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.dOcclusionKernelSize, this.blurKernelSize), R.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.dOcclusionKernelSize, this.blurKernelSize);
      }
      if (this.downsampleFactor !== i.occlusion.params.resolutionScale) {
        o = !0, this.downsampleFactor = i.occlusion.params.resolutionScale, this.ssaoScale = this.calcSsaoScale();
        var x = Math.floor(p * this.ssaoScale), S = Math.floor(g * this.ssaoScale);
        this.downsampledDepthTarget.setSize(x, S), this.ssaoDepthTexture.define(x, S), this.ssaoDepthBlurProxyTexture.define(x, S), this.ssaoScale === 1 ? R.update(this.ssaoRenderable.values.tDepth, this.drawPass.depthTexture) : R.update(this.ssaoRenderable.values.tDepth, this.downsampledDepthTarget.texture), R.update(this.downsampleDepthRenderable.values.uTexSize, xe.set(this.downsampleDepthRenderable.values.uTexSize.ref.value, x, S)), R.update(this.ssaoRenderable.values.uTexSize, xe.set(this.ssaoRenderable.values.uTexSize.ref.value, x, S)), R.update(this.ssaoBlurFirstPassRenderable.values.uTexSize, xe.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value, x, S)), R.update(this.ssaoBlurSecondPassRenderable.values.uTexSize, xe.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value, x, S));
      }
    }
    if (i.outline.name === "on") {
      var b = i.outline.params.threshold;
      t.state.mode === "orthographic" && (b /= 5);
      var _ = Math.pow(1e3, b) / 1e3 * t.state.radiusMax, C = i.outline.params.scale - 1;
      R.updateIfChanged(this.outlinesRenderable.values.uNear, t.near), R.updateIfChanged(this.outlinesRenderable.values.uFar, t.far), R.updateIfChanged(this.outlinesRenderable.values.uMaxPossibleViewZDiff, _), R.update(this.renderable.values.uOutlineColor, Ae.toVec3Normalized(this.renderable.values.uOutlineColor.ref.value, i.outline.params.color)), R.updateIfChanged(this.renderable.values.uMaxPossibleViewZDiff, _), this.renderable.values.dOutlineScale.ref.value !== C && (a = !0), R.updateIfChanged(this.renderable.values.dOutlineScale, C);
    }
    R.updateIfChanged(this.renderable.values.uFar, t.far), R.updateIfChanged(this.renderable.values.uNear, t.near), R.updateIfChanged(this.renderable.values.uFogFar, t.fogFar), R.updateIfChanged(this.renderable.values.uFogNear, t.fogNear), R.update(this.renderable.values.uFogColor, Ae.toVec3Normalized(this.renderable.values.uFogColor.ref.value, r)), R.updateIfChanged(this.renderable.values.uTransparentBackground, n), this.renderable.values.dOrthographic.ref.value !== u && (a = !0), R.updateIfChanged(this.renderable.values.dOrthographic, u), this.renderable.values.dOutlineEnable.ref.value !== l && (a = !0), R.updateIfChanged(this.renderable.values.dOutlineEnable, l), this.renderable.values.dOcclusionEnable.ref.value !== c && (a = !0), R.updateIfChanged(this.renderable.values.dOcclusionEnable, c), o && this.ssaoRenderable.update(), s && (this.ssaoBlurFirstPassRenderable.update(), this.ssaoBlurSecondPassRenderable.update()), a && this.renderable.update();
    var w = this.webgl, I = w.gl, M = w.state;
    M.enable(I.SCISSOR_TEST), M.disable(I.BLEND), M.disable(I.DEPTH_TEST), M.depthMask(!1);
    var E = t.viewport, T = E.x, P = E.y, k = E.width, D = E.height;
    I.viewport(T, P, k, D), I.scissor(T, P, k, D);
  }, e.prototype.setOcclusionOffset = function(t, n) {
    this.occlusionOffset[0] = t, this.occlusionOffset[1] = n, R.update(this.renderable.values.uOcclusionOffset, xe.set(this.renderable.values.uOcclusionOffset.ref.value, t, n));
  }, e.prototype.render = function(t, n, r, i, a) {
    this.updateState(t, r, i, a), a.outline.name === "on" && (this.outlinesTarget.bind(), this.outlinesRenderable.render()), a.occlusion.name === "on" && this.occlusionOffset[0] === 0 && this.occlusionOffset[1] === 0 && (this.ssaoScale < 1 && (this.downsampledDepthTarget.bind(), this.downsampleDepthRenderable.render()), this.ssaoFramebuffer.bind(), this.ssaoRenderable.render(), this.ssaoBlurFirstPassFramebuffer.bind(), this.ssaoBlurFirstPassRenderable.render(), this.ssaoBlurSecondPassFramebuffer.bind(), this.ssaoBlurSecondPassRenderable.render()), n ? this.webgl.unbindFramebuffer() : this.target.bind();
    var o = this.webgl, s = o.gl;
    o.state.clearColor(0, 0, 0, 1), s.clear(s.COLOR_BUFFER_BIT), this.renderable.render();
  }, e;
}(), b4 = function() {
  function e(t, n) {
    this.drawPass = n;
    var r = n.colorTarget, i = r.getWidth(), a = r.getHeight();
    this.target = t.createRenderTarget(i, a, !1), this.fxaa = new PW(t, this.target.texture), this.smaa = new kW(t, this.target.texture);
  }
  return e.isEnabled = function(t) {
    return t.antialiasing.name !== "off";
  }, e.prototype.setSize = function(t, n) {
    var r = this.target.texture.getWidth(), i = this.target.texture.getHeight();
    t === r && n === i || (this.target.setSize(t, n), this.fxaa.setSize(t, n), this.smaa.supported && this.smaa.setSize(t, n));
  }, e.prototype._renderFxaa = function(t, n, r) {
    if (r.antialiasing.name === "fxaa") {
      var i = ll.isEnabled(r) ? this.drawPass.postprocessing.target.texture : this.drawPass.colorTarget.texture;
      this.fxaa.update(i, r.antialiasing.params), this.fxaa.render(t.viewport, n ? void 0 : this.target);
    }
  }, e.prototype._renderSmaa = function(t, n, r) {
    if (r.antialiasing.name === "smaa") {
      var i = ll.isEnabled(r) ? this.drawPass.postprocessing.target.texture : this.drawPass.colorTarget.texture;
      this.smaa.update(i, r.antialiasing.params), this.smaa.render(t.viewport, n ? void 0 : this.target);
    }
  }, e.prototype.render = function(t, n, r) {
    if (r.antialiasing.name !== "off") {
      if (r.antialiasing.name === "fxaa") this._renderFxaa(t, n, r);
      else if (r.antialiasing.name === "smaa") {
        if (!this.smaa.supported) throw new Error('SMAA not supported, missing "HTMLImageElement"');
        this._renderSmaa(t, n, r);
      }
    }
  }, e;
}(), UW = O(O({}, Ei), { tColor: Rt("texture", "rgba", "ubyte", "nearest"), uTexSize: me("v2"), uWeight: me("f") }), HW = gr("compose", da, `
precision highp float;
precision highp sampler2D;

uniform sampler2D tColor;
uniform vec2 uTexSize;
uniform float uWeight;

void main() {
    vec2 coords = gl_FragCoord.xy / uTexSize;
    gl_FragColor = texture2D(tColor, coords) * uWeight;
}
`), QD = { mode: N.Select("temporal", [["off", "Off"], ["on", "On"], ["temporal", "Temporal"]]), sampleLevel: N.Numeric(2, { min: 0, max: 5, step: 1 }, { description: "Take level^2 samples." }) }, gv = function() {
  function e(t, n) {
    this.webgl = t, this.drawPass = n;
    var r = t.extensions, i = r.colorBufferFloat, a = r.textureFloat, o = r.colorBufferHalfFloat, s = r.textureHalfFloat, u = n.colorTarget.getWidth(), l = n.colorTarget.getHeight();
    this.colorTarget = t.createRenderTarget(u, l, !1);
    var c, d, f, p, g = o && s ? "fp16" : i && a ? "float32" : "uint8";
    this.composeTarget = t.createRenderTarget(u, l, !1, g), this.holdTarget = t.createRenderTarget(u, l, !1), this.compose = (c = t, d = n.colorTarget.texture, f = O(O({}, Pi), { tColor: R.create(d), uTexSize: R.create(xe.create(d.getWidth(), d.getHeight())), uWeight: R.create(1) }), p = O({}, UW), vi(gi(c, "triangles", HW, p, f), f));
  }
  return e.isEnabled = function(t) {
    return t.mode !== "off";
  }, e.prototype.syncSize = function() {
    var t = this.drawPass.colorTarget.getWidth(), n = this.drawPass.colorTarget.getHeight(), r = this.compose.values.uTexSize.ref.value, i = r[0], a = r[1];
    t === i && n === a || (this.colorTarget.setSize(t, n), this.composeTarget.setSize(t, n), this.holdTarget.setSize(t, n), R.update(this.compose.values.uTexSize, xe.set(this.compose.values.uTexSize.ref.value, t, n)));
  }, e.prototype.render = function(t, n, r, i, a) {
    return r.multiSample.mode !== "temporal" || a ? (this.renderMultiSample(n, i, r), -2) : this.renderTemporalMultiSample(t, n, r, i);
  }, e.prototype.bindOutputTarget = function(t) {
    t ? this.webgl.unbindFramebuffer() : this.colorTarget.bind();
  }, e.prototype.renderMultiSample = function(t, n, r) {
    var i = t.camera, a = this, o = a.compose, s = a.composeTarget, u = a.drawPass, l = a.webgl, c = l.gl, d = l.state, f = J5[Math.max(0, Math.min(r.multiSample.sampleLevel, 5))], p = i.viewport, g = p.x, m = p.y, v = p.width, h = p.height, y = 1 / f.length;
    i.viewOffset.enabled = !0, R.update(o.values.tColor, u.getColorTarget(r.postprocessing).texture), o.update();
    for (var x = 0; x < f.length; ++x) {
      var S = f[x];
      Nr.setViewOffset(i.viewOffset, v, h, S[0], S[1], v, h), i.update();
      var b = y + 0.03125 * ((x + 0.5) / f.length - 0.5);
      R.update(o.values.uWeight, b), x === 0 ? u.postprocessing.setOcclusionOffset(0, 0) : u.postprocessing.setOcclusionOffset(S[0] / v, S[1] / h), u.render(t, r, !1), s.bind(), d.enable(c.BLEND), d.blendEquationSeparate(c.FUNC_ADD, c.FUNC_ADD), d.blendFuncSeparate(c.ONE, c.ONE, c.ONE, c.ONE), d.disable(c.DEPTH_TEST), d.depthMask(!1), c.viewport(g, m, v, h), c.scissor(g, m, v, h), x === 0 && (d.clearColor(0, 0, 0, 0), c.clear(c.COLOR_BUFFER_BIT)), o.render();
    }
    u.postprocessing.setOcclusionOffset(0, 0), R.update(o.values.uWeight, 1), R.update(o.values.tColor, s.texture), o.update(), this.bindOutputTarget(n), c.viewport(g, m, v, h), c.scissor(g, m, v, h), d.disable(c.BLEND), o.render(), i.viewOffset.enabled = !1, i.update();
  }, e.prototype.renderTemporalMultiSample = function(t, n, r, i) {
    var a = n.camera, o = this, s = o.compose, u = o.composeTarget, l = o.holdTarget, c = o.drawPass, d = o.webgl, f = d.gl, p = d.state, g = J5[Math.max(0, Math.min(r.multiSample.sampleLevel, 5))];
    if (t === -2 || t >= g.length) return -2;
    var m = a.viewport, v = m.x, h = m.y, y = m.width, x = m.height, S = 1 / g.length;
    if (t === -1) c.render(n, r, !1), R.update(s.values.uWeight, 1), R.update(s.values.tColor, c.getColorTarget(r.postprocessing).texture), s.update(), l.bind(), p.disable(f.BLEND), p.disable(f.DEPTH_TEST), p.depthMask(!1), f.viewport(v, h, y, x), f.scissor(v, h, y, x), s.render(), t += 1;
    else {
      a.viewOffset.enabled = !0, R.update(s.values.tColor, c.getColorTarget(r.postprocessing).texture), R.update(s.values.uWeight, S), s.update();
      for (var b = Math.pow(2, Math.max(0, r.multiSample.sampleLevel - 2)), _ = 0; _ < b; ++_) {
        var C = g[t];
        if (Nr.setViewOffset(a.viewOffset, y, x, C[0], C[1], y, x), a.update(), t === 0 ? c.postprocessing.setOcclusionOffset(0, 0) : c.postprocessing.setOcclusionOffset(C[0] / y, C[1] / x), c.render(n, r, !1), u.bind(), p.enable(f.BLEND), p.blendEquationSeparate(f.FUNC_ADD, f.FUNC_ADD), p.blendFuncSeparate(f.ONE, f.ONE, f.ONE, f.ONE), p.disable(f.DEPTH_TEST), p.depthMask(!1), f.viewport(v, h, y, x), f.scissor(v, h, y, x), t === 0 && (p.clearColor(0, 0, 0, 0), f.clear(f.COLOR_BUFFER_BIT)), s.render(), (t += 1) >= g.length) break;
      }
    }
    c.postprocessing.setOcclusionOffset(0, 0), this.bindOutputTarget(i), f.viewport(v, h, y, x), f.scissor(v, h, y, x);
    var w = t * S;
    return w > 0 && (R.update(s.values.uWeight, 1), R.update(s.values.tColor, u.texture), s.update(), p.disable(f.BLEND), s.render()), w < 1 && (R.update(s.values.uWeight, 1 - w), R.update(s.values.tColor, l.texture), s.update(), w === 0 ? p.disable(f.BLEND) : p.enable(f.BLEND), s.render()), a.viewOffset.enabled = !1, a.update(), t >= g.length ? -2 : t;
  }, e;
}(), J5 = [[[0, 0]], [[0, 0], [-4, -4]], [[0, 0], [6, -2], [-6, 2], [2, 6]], [[0, 0], [-1, 3], [5, 1], [-3, -5], [-5, 5], [-7, -1], [3, 7], [7, -7]], [[0, 0], [-1, -3], [-3, 2], [4, -1], [-5, -2], [2, 5], [5, 3], [3, -5], [-2, 6], [0, -7], [-4, -6], [-6, 4], [-8, 0], [7, -4], [6, 7], [-7, -8]], [[0, 0], [-7, -5], [-3, -5], [-5, -4], [-1, -4], [-2, -2], [-6, -1], [-4, 0], [-7, 1], [-1, 2], [-6, 3], [-3, 3], [-7, 6], [-3, 6], [-5, 7], [-1, 7], [5, -7], [1, -6], [6, -5], [4, -4], [2, -3], [7, -2], [1, -1], [4, -1], [2, 1], [6, 2], [0, 4], [4, 4], [2, 5], [7, 5], [5, 6], [3, 7]]];
J5.forEach(function(e) {
  e.forEach(function(t) {
    t[0] *= 0.0625, t[1] *= 0.0625;
  });
});
var JD = function() {
  function e(t) {
    this.multiSamplePass = t, this.sampleIndex = -2;
  }
  return e.prototype.update = function(t, n) {
    return t && (this.sampleIndex = -1), n.mode === "temporal" && this.sampleIndex !== -2;
  }, e.prototype.render = function(t, n, r, i) {
    return this.sampleIndex = this.multiSamplePass.render(this.sampleIndex, t, n, r, !!i), this.sampleIndex < 0;
  }, e;
}(), $D = { eyeSeparation: N.Numeric(0.064, { min: 0.01, max: 0.5, step: 1e-3 }), focus: N.Numeric(10, { min: 1, max: 100, step: 0.01 }) }, qW = N.getDefaultValues($D), cm = function() {
  function e(t, n) {
    n === void 0 && (n = {}), this.parent = t, this.left = new UA(), this.right = new UA(), this.props = O(O({}, qW), n);
  }
  return Object.defineProperty(e.prototype, "viewport", { get: function() {
    return this.parent.viewport;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "viewOffset", { get: function() {
    return this.parent.viewOffset;
  }, enumerable: !1, configurable: !0 }), e.prototype.setProps = function(t) {
    Object.assign(this.props, t);
  }, e.prototype.update = function() {
    this.parent.update(), function(t, n, r, i) {
      Ii.copy(r.viewport, t.viewport), ne.copy(r.view, t.view), ne.copy(r.projection, t.projection), Nr.copySnapshot(r.state, t.state), Nr.copyViewOffset(r.viewOffset, t.viewOffset), r.far = t.far, r.near = t.near, r.fogFar = t.fogFar, r.fogNear = t.fogNear, Ii.copy(i.viewport, t.viewport), ne.copy(i.view, t.view), ne.copy(i.projection, t.projection), Nr.copySnapshot(i.state, t.state), Nr.copyViewOffset(i.viewOffset, t.viewOffset), i.far = t.far, i.near = t.near, i.fogFar = t.fogFar, i.fogNear = t.fogNear;
      var a = Math.floor(t.viewport.width / 2), o = a / t.viewport.height;
      r.viewport.width = a, i.viewport.x += a, i.viewport.width -= a;
      var s, u, l = n.eyeSeparation / 2, c = l * t.near / n.focus, d = t.near * Math.tan(0.5 * t.state.fov);
      HA[12] = -l, qA[12] = l, s = -d * o + c, u = d * o + c, r.projection[0] = 2 * t.near / (u - s), r.projection[8] = (u + s) / (u - s), ne.mul(r.view, r.view, HA), ne.mul(r.projectionView, r.projection, r.view), ne.invert(r.inverseProjectionView, r.projectionView), s = -d * o - c, u = d * o - c, i.projection[0] = 2 * t.near / (u - s), i.projection[8] = (u + s) / (u - s), ne.mul(i.view, i.view, qA), ne.mul(i.projectionView, i.projection, i.view), ne.invert(i.inverseProjectionView, i.projectionView);
    }(this.parent, this.props, this.left, this.right);
  }, e;
}();
(function(e) {
  e.is = function(t) {
    return "left" in t && "right" in t;
  };
})(cm || (cm = {}));
var UA = function() {
  this.viewport = Ii.create(0, 0, 0, 0), this.view = ne(), this.projection = ne(), this.projectionView = ne(), this.inverseProjectionView = ne(), this.state = Nr.createDefaultSnapshot(), this.viewOffset = Nr.ViewOffset(), this.far = 0, this.near = 0, this.fogFar = 0, this.fogNear = 0;
}, HA = ne.identity(), qA = ne.identity(), _4 = Math.pow(2, 24) - 2, jW = function() {
  function e(t, n, r) {
    this.webgl = t, this.drawPass = n, this.pickBaseScale = r;
    var i = r / t.pixelRatio;
    this.pickWidth = Math.ceil(n.colorTarget.getWidth() * i), this.pickHeight = Math.ceil(n.colorTarget.getHeight() * i), this.objectPickTarget = t.createRenderTarget(this.pickWidth, this.pickHeight), this.instancePickTarget = t.createRenderTarget(this.pickWidth, this.pickHeight), this.groupPickTarget = t.createRenderTarget(this.pickWidth, this.pickHeight), this.depthPickTarget = t.createRenderTarget(this.pickWidth, this.pickHeight);
  }
  return Object.defineProperty(e.prototype, "drawingBufferHeight", { get: function() {
    return this.drawPass.colorTarget.getHeight();
  }, enumerable: !1, configurable: !0 }), e.prototype.syncSize = function() {
    var t = this.pickBaseScale / this.webgl.pixelRatio, n = Math.ceil(this.drawPass.colorTarget.getWidth() * t), r = Math.ceil(this.drawPass.colorTarget.getHeight() * t);
    n === this.pickWidth && r === this.pickHeight || (this.pickWidth = n, this.pickHeight = r, this.objectPickTarget.setSize(this.pickWidth, this.pickHeight), this.instancePickTarget.setSize(this.pickWidth, this.pickHeight), this.groupPickTarget.setSize(this.pickWidth, this.pickHeight), this.depthPickTarget.setSize(this.pickWidth, this.pickHeight));
  }, e.prototype.renderVariant = function(t, n, r, i, a, o) {
    var s = this.drawPass.depthTexturePrimitives;
    t.clear(!1), t.update(n), t.renderPick(r.primitives, n, a, null, o), t.renderPick(r.volumes, n, a, s, o), t.renderPick(i.handle.scene, n, a, null, o), i.camera.isEnabled && (i.camera.update(n), t.update(i.camera.camera), t.renderPick(i.camera.scene, i.camera.camera, a, null, o));
  }, e.prototype.render = function(t, n, r, i) {
    this.objectPickTarget.bind(), this.renderVariant(t, n, r, i, "pick", 1), this.instancePickTarget.bind(), this.renderVariant(t, n, r, i, "pick", 2), this.groupPickTarget.bind(), this.renderVariant(t, n, r, i, "pick", 3), this.depthPickTarget.bind(), this.renderVariant(t, n, r, i, "depth", 0);
  }, e;
}(), KW = function() {
  function e(t, n, r, i, a, o, s) {
    s === void 0 && (s = 1), this.webgl = t, this.renderer = n, this.scene = r, this.helper = i, this.pickPass = a, this.pickPadding = s, this.dirty = !0, this.viewport = Ii(), this.setViewport(o.x, o.y, o.width, o.height);
  }
  return e.prototype.setupBuffers = function() {
    var t = this.pickWidth * this.pickHeight * 4;
    this.objectBuffer && this.objectBuffer.length === t || (this.objectBuffer = new Uint8Array(t), this.instanceBuffer = new Uint8Array(t), this.groupBuffer = new Uint8Array(t), this.depthBuffer = new Uint8Array(t));
  }, e.prototype.setViewport = function(t, n, r, i) {
    Ii.set(this.viewport, t, n, r, i), this.pickScale = this.pickPass.pickBaseScale / this.webgl.pixelRatio, this.pickX = Math.ceil(t * this.pickScale), this.pickY = Math.ceil(n * this.pickScale);
    var a = Math.floor(r * this.pickScale), o = Math.floor(i * this.pickScale);
    a === this.pickWidth && o === this.pickHeight || (this.pickWidth = a, this.pickHeight = o, this.halfPickWidth = Math.floor(this.pickWidth / 2), this.setupBuffers()), this.spiral = function(s) {
      for (var u, l = 0, c = 0, d = [0, -1], f = 2 * s + 1, p = f / 2, g = [], m = Math.pow(f, 2); m > 0; --m) -p < l && l <= p && -p < c && c <= p && g.push([l, c]), (l === c || l < 0 && l === -c || l > 0 && l === 1 - c) && (u = [-d[1], d[0]], d[0] = u[0], d[1] = u[1]), l += d[0], c += d[1];
      return g;
    }(Math.round(this.pickScale * this.pickPadding));
  }, e.prototype.syncBuffers = function() {
    var t = this, n = t.pickX, r = t.pickY, i = t.pickWidth, a = t.pickHeight;
    this.pickPass.objectPickTarget.bind(), this.webgl.readPixels(n, r, i, a, this.objectBuffer), this.pickPass.instancePickTarget.bind(), this.webgl.readPixels(n, r, i, a, this.instanceBuffer), this.pickPass.groupPickTarget.bind(), this.webgl.readPixels(n, r, i, a, this.groupBuffer), this.pickPass.depthPickTarget.bind(), this.webgl.readPixels(n, r, i, a, this.depthBuffer);
  }, e.prototype.getBufferIdx = function(t, n) {
    return 4 * (n * this.pickWidth + t);
  }, e.prototype.getDepth = function(t, n) {
    var r = this.getBufferIdx(t, n), i = this.depthBuffer;
    return function(a, o, s, u) {
      return Nt.set(rS, a / 255, o / 255, s / 255, u / 255), Nt.dot(rS, gK);
    }(i[r], i[r + 1], i[r + 2], i[r + 3]);
  }, e.prototype.getId = function(t, n, r) {
    var i = this.getBufferIdx(t, n);
    return X6(r[i], r[i + 1], r[i + 2]);
  }, e.prototype.render = function(t) {
    var n = this, r = n.pickX, i = n.pickY, a = n.pickWidth, o = n.pickHeight, s = n.halfPickWidth, u = this, l = u.renderer, c = u.scene, d = u.helper;
    l.setTransparentBackground(!1), l.setDrawingBufferSize(this.pickPass.objectPickTarget.getWidth(), this.pickPass.objectPickTarget.getHeight()), l.setPixelRatio(this.pickScale), cm.is(t) ? (l.setViewport(r, i, s, o), this.pickPass.render(l, t.left, c, d), l.setViewport(r + s, i, a - s, o), this.pickPass.render(l, t.right, c, d)) : (l.setViewport(r, i, a, o), this.pickPass.render(l, t, c, d)), this.dirty = !1;
  }, e.prototype.identifyInternal = function(t, n, r) {
    var i = this.webgl, a = this.pickScale;
    if (!i.isContextLost) {
      t *= i.pixelRatio, n *= i.pixelRatio, n = this.pickPass.drawingBufferHeight - n;
      var o = this.viewport;
      if (!(t < o.x || n < o.y || t > o.x + o.width || n > o.y + o.height)) {
        this.dirty && (this.render(r), this.syncBuffers());
        var s = t - o.x, u = n - o.y, l = Math.floor(s * a), c = Math.floor(u * a), d = this.getId(l, c, this.objectBuffer);
        if (d !== -1 && d !== _4) {
          var f = this.getId(l, c, this.instanceBuffer);
          if (f !== -1 && f !== _4) {
            var p = this.getId(l, c, this.groupBuffer);
            if (p !== -1 && p !== _4) {
              var g = this.getDepth(l, c), m = A.create(t, o.height - n, g);
              if (cm.is(r)) {
                var v = Math.floor(o.width / 2);
                t > o.x + v ? (m[0] = o.x + 2 * (s - v), Dp(m, m, o, r.right.inverseProjectionView)) : (m[0] = o.x + 2 * s, Dp(m, m, o, r.left.inverseProjectionView));
              } else Dp(m, m, o, r.inverseProjectionView);
              return { id: { objectId: d, instanceId: f, groupId: p }, position: m };
            }
          }
        }
      }
    }
  }, e.prototype.identify = function(t, n, r) {
    for (var i = 0, a = this.spiral; i < a.length; i++) {
      var o = a[i], s = this.identifyInternal(t + o[0], n + o[1], r);
      if (s) return s;
    }
  }, e.prototype.getPosition = function(t, n, r) {
    var i = this.webgl;
    if (!i.isContextLost) {
      t *= i.pixelRatio, n *= i.pixelRatio, n = this.pickPass.drawingBufferHeight - n;
      var a = this.viewport;
      if (!(t < a.x || n < a.y || t > a.x + a.width || n > a.y + a.height)) {
        this.dirty && (this.render(r), this.syncBuffers());
        var o = 255 / 256, s = A.create(16777216, 65536, 256), u = Nt.create(o / s[0], o / s[1], o / s[2], 0.99609375), l = Nt();
        Nt.set(l, 128 / 255, 128 / 255, 30 / 255, 60 / 255);
        var c = Nt.dot(l, u) / (r.zoom / 40);
        c > 0.2 && (c = 0.1);
        var d = A.create(t, a.height - n, c);
        return Dp(d, d, a, r.inverseProjectionView), { position: d };
      }
    }
  }, e;
}(), YW = O(O({}, Ei), { tWboitA: Rt("texture", "rgba", "float", "nearest"), tWboitB: Rt("texture", "rgba", "float", "nearest"), uTexSize: me("v2") }), WW = gr("evaluate-wboit", da, `
precision highp float;

uniform sampler2D tWboitA;
uniform sampler2D tWboitB;
uniform vec2 uTexSize;

void main() {
    vec2 coords = gl_FragCoord.xy / uTexSize;

    vec4 accum = texture2D(tWboitA, coords);
    float r = 1.0 - accum.a;

    accum.a = texture2D(tWboitB, coords).r;
    // divisor needs to allow very small values for nice fading
    gl_FragColor = vec4(accum.rgb / clamp(accum.a, 0.00000001, 50000.0), r);
}
`), XW = function() {
  function e(t, n, r) {
    if (this.webgl = t, this._supported = !1, e.isSupported(t)) {
      var i, a, o, s, u, l = t.resources;
      this.textureA = l.texture("image-float32", "rgba", "float", "nearest"), this.textureA.define(n, r), this.textureB = l.texture("image-float32", "rgba", "float", "nearest"), this.textureB.define(n, r), this.renderable = (i = t, a = this.textureA, o = this.textureB, s = O(O({}, Pi), { tWboitA: R.create(a), tWboitB: R.create(o), uTexSize: R.create(xe.create(a.getWidth(), a.getHeight())) }), u = O({}, YW), vi(gi(i, "triangles", WW, u, s), s)), this.framebuffer = l.framebuffer(), this._supported = !0, this._init();
    }
  }
  return Object.defineProperty(e.prototype, "supported", { get: function() {
    return this._supported;
  }, enumerable: !1, configurable: !0 }), e.prototype.bind = function() {
    var t = this.webgl, n = t.state, r = t.gl;
    this.framebuffer.bind(), n.clearColor(0, 0, 0, 1), r.clear(r.COLOR_BUFFER_BIT), n.disable(r.DEPTH_TEST), n.blendFuncSeparate(r.ONE, r.ONE, r.ZERO, r.ONE_MINUS_SRC_ALPHA), n.enable(r.BLEND);
  }, e.prototype.render = function() {
    var t = this.webgl, n = t.state, r = t.gl;
    n.blendFuncSeparate(r.SRC_ALPHA, r.ONE_MINUS_SRC_ALPHA, r.ONE, r.ONE_MINUS_SRC_ALPHA), n.enable(r.BLEND), this.renderable.update(), this.renderable.render();
  }, e.prototype.setSize = function(t, n) {
    var r = this.renderable.values.uTexSize.ref.value, i = r[0], a = r[1];
    t === i && n === a || (this.textureA.define(t, n), this.textureB.define(t, n), R.update(this.renderable.values.uTexSize, xe.set(this.renderable.values.uTexSize.ref.value, t, n)));
  }, e.prototype.reset = function() {
    this._supported && this._init();
  }, e.prototype._init = function() {
    var t = this.webgl.extensions.drawBuffers;
    this.framebuffer.bind(), t.drawBuffers([t.COLOR_ATTACHMENT0, t.COLOR_ATTACHMENT1]), this.textureA.attachFramebuffer(this.framebuffer, "color0"), this.textureB.attachFramebuffer(this.framebuffer, "color1");
  }, e.isSupported = function(t) {
    var n = t.extensions, r = n.drawBuffers, i = n.textureFloat, a = n.colorBufferFloat, o = n.depthTexture;
    if (i && a && o && r) return !0;
    if (In) {
      var s = [];
      i || s.push("textureFloat"), a || s.push("colorBufferFloat"), o || s.push("depthTexture"), r || s.push("drawBuffers"), console.log('Missing "'.concat(s.join('", "'), '" extensions required for "wboit"'));
    }
    return !1;
  }, e;
}(), eO = { enabled: N.Boolean(!0), highlightEdgeColor: N.Color(Ae.darken(Ae.fromNormalizedRgb(1, 0.4, 0.6), 1)), selectEdgeColor: N.Color(Ae.darken(Ae.fromNormalizedRgb(0.2, 1, 0.1), 1)), edgeScale: N.Numeric(1, { min: 1, max: 3, step: 1 }, { description: "Thickness of the edge." }), ghostEdgeStrength: N.Numeric(1, { min: 0, max: 1, step: 0.1 }, { description: "Opacity of the hidden edges that are covered by other geometry. When set to 1, one less geometry render pass is done." }), innerEdgeFactor: N.Numeric(1.5, { min: 0, max: 3, step: 0.1 }, { description: "Factor to multiply the inner edge color with - for added contrast." }) }, jA = function() {
  function e(t, n, r) {
    this.webgl = t, this.depthTarget = t.createRenderTarget(n, r), this.maskTarget = t.createRenderTarget(n, r), this.edgesTarget = t.createRenderTarget(n, r), this.edge = function(i, a) {
      var o = a.getWidth(), s = a.getHeight(), u = O(O({}, Pi), { tMaskTexture: R.create(a), uTexSizeInv: R.create(xe.create(1 / o, 1 / s)), dEdgeScale: R.create(1) }), l = O({}, ZW);
      return vi(gi(i, "triangles", QW, l, u), u);
    }(t, this.maskTarget.texture), this.overlay = function(i, a) {
      var o = a.getWidth(), s = a.getHeight(), u = O(O({}, Pi), { tEdgeTexture: R.create(a), uTexSizeInv: R.create(xe.create(1 / o, 1 / s)), uHighlightEdgeColor: R.create(A()), uSelectEdgeColor: R.create(A()), uGhostEdgeStrength: R.create(0), uInnerEdgeFactor: R.create(0) }), l = O({}, JW);
      return vi(gi(i, "triangles", $W, l, u), u);
    }(t, this.edgesTarget.texture);
  }
  return e.isEnabled = function(t) {
    return t.enabled;
  }, e.prototype.setEdgeState = function(t) {
    var n = this.webgl, r = n.gl, i = n.state;
    i.enable(r.SCISSOR_TEST), i.enable(r.BLEND), i.blendFunc(r.ONE, r.ONE), i.blendEquation(r.FUNC_ADD), i.disable(r.DEPTH_TEST), i.depthMask(!1);
    var a = t.x, o = t.y, s = t.width, u = t.height;
    r.viewport(a, o, s, u), r.scissor(a, o, s, u), i.clearColor(0, 0, 0, 0), r.clear(r.COLOR_BUFFER_BIT);
  }, e.prototype.setOverlayState = function(t) {
    var n = this.webgl, r = n.gl, i = n.state;
    i.enable(r.SCISSOR_TEST), i.enable(r.BLEND), i.blendFunc(r.SRC_ALPHA, r.ONE_MINUS_SRC_ALPHA), i.blendEquation(r.FUNC_ADD), i.disable(r.DEPTH_TEST), i.depthMask(!1);
    var a = t.x, o = t.y, s = t.width, u = t.height;
    r.viewport(a, o, s, u), r.scissor(a, o, s, u);
  }, e.prototype.setSize = function(t, n) {
    var r = this.depthTarget.getWidth(), i = this.depthTarget.getHeight();
    t === r && n === i || (this.depthTarget.setSize(t, n), this.maskTarget.setSize(t, n), this.edgesTarget.setSize(t, n), R.update(this.edge.values.uTexSizeInv, xe.set(this.edge.values.uTexSizeInv.ref.value, 1 / t, 1 / n)), R.update(this.overlay.values.uTexSizeInv, xe.set(this.overlay.values.uTexSizeInv.ref.value, 1 / t, 1 / n)));
  }, e.prototype.update = function(t) {
    var n = t.highlightEdgeColor, r = t.selectEdgeColor, i = t.edgeScale, a = t.innerEdgeFactor, o = t.ghostEdgeStrength, s = this.edge.values, u = Math.round(i * this.webgl.pixelRatio);
    s.dEdgeScale.ref.value !== u && (R.update(s.dEdgeScale, u), this.edge.update());
    var l = this.overlay.values;
    R.update(l.uHighlightEdgeColor, Ae.toVec3Normalized(l.uHighlightEdgeColor.ref.value, n)), R.update(l.uSelectEdgeColor, Ae.toVec3Normalized(l.uSelectEdgeColor.ref.value, r)), R.update(l.uInnerEdgeFactor, a), R.update(l.uGhostEdgeStrength, o);
  }, e.prototype.render = function(t, n) {
    this.edgesTarget.bind(), this.setEdgeState(t), this.edge.render(), n ? n.bind() : this.webgl.unbindFramebuffer(), this.setOverlayState(t), this.overlay.render();
  }, e;
}(), ZW = O(O({}, Ei), { tMaskTexture: Rt("texture", "rgba", "ubyte", "linear"), uTexSizeInv: me("v2"), dEdgeScale: Bt("number") }), QW = gr("edge", da, `
precision highp float;
precision highp sampler2D;

uniform sampler2D tMaskTexture;
uniform vec2 uTexSizeInv;

void main() {
    vec2 coords = gl_FragCoord.xy * uTexSizeInv;
    vec4 offset = vec4(float(dEdgeScale), 0.0, 0.0, float(dEdgeScale)) * vec4(uTexSizeInv, uTexSizeInv);
    vec4 c0 = texture2D(tMaskTexture, coords);
    vec4 c1 = texture2D(tMaskTexture, coords + offset.xy);
    vec4 c2 = texture2D(tMaskTexture, coords - offset.xy);
    vec4 c3 = texture2D(tMaskTexture, coords + offset.yw);
    vec4 c4 = texture2D(tMaskTexture, coords - offset.yw);
    float diff1 = (c1.r - c2.r) * 0.5;
    float diff2 = (c3.r - c4.r) * 0.5;
    float d = length(vec2(diff1, diff2));
    if (d <= 0.0)
        discard;
    float a1 = min(c1.g, c2.g);
    float a2 = min(c3.g, c4.g);
    float visibility = min(a1, a2) > 0.001 ? 1.0 : 0.0;
    float mask = c0.r;
    float marker = min(c1.b, min(c2.b, min(c3.b, c4.b)));
    float fogAlpha = min(c1.a, min(c2.a, min(c3.a, c4.a)));
    gl_FragColor = vec4(visibility, mask, marker, fogAlpha);
}
`), JW = O(O({}, Ei), { tEdgeTexture: Rt("texture", "rgba", "ubyte", "linear"), uTexSizeInv: me("v2"), uHighlightEdgeColor: me("v3"), uSelectEdgeColor: me("v3"), uGhostEdgeStrength: me("f"), uInnerEdgeFactor: me("f") }), $W = gr("overlay", da, `
precision highp float;
precision highp sampler2D;

uniform vec2 uTexSizeInv;
uniform sampler2D tEdgeTexture;
uniform vec3 uHighlightEdgeColor;
uniform vec3 uSelectEdgeColor;
uniform float uGhostEdgeStrength;
uniform float uInnerEdgeFactor;

void main() {
    vec2 coords = gl_FragCoord.xy * uTexSizeInv;
    vec4 edgeValue = texture2D(tEdgeTexture, coords);
    if (edgeValue.a > 0.0) {
        vec3 edgeColor = edgeValue.b == 1.0 ? uHighlightEdgeColor : uSelectEdgeColor;
        gl_FragColor.rgb = edgeValue.g > 0.0 ? edgeColor : edgeColor * uInnerEdgeFactor;
        gl_FragColor.a = (edgeValue.r == 1.0 ? uGhostEdgeStrength : 1.0) * edgeValue.a;
    } else {
        gl_FragColor = vec4(0.0);
    }
}
`), eX = O(O({}, Ei), { tDepthPrimitives: Rt("texture", "depth", "ushort", "nearest"), tDepthVolumes: Rt("texture", "depth", "ushort", "nearest"), uTexSize: me("v2"), dPackedDepth: Bt("boolean") }), tX = gr("depth-merge", da, `
precision highp float;
precision highp sampler2D;

uniform sampler2D tDepthPrimitives;
uniform sampler2D tDepthVolumes;
uniform vec2 uTexSize;

#include common

float getDepth(const in vec2 coords, sampler2D tDepth) {
    #ifdef dPackedDepth
        return unpackRGBAToDepth(texture2D(tDepth, coords));
    #else
        return texture2D(tDepth, coords).r;
    #endif
}

void main() {
    vec2 coords = gl_FragCoord.xy / uTexSize;
    float depth = min(getDepth(coords, tDepthPrimitives), getDepth(coords, tDepthVolumes));
    gl_FragColor = packDepthToRGBA(depth);
}
`), tO = function() {
  function e(t, n, r, i) {
    this.webgl = t;
    var a, o, s, u, l, c, d, f = t.extensions, p = t.resources, g = t.isWebGL2;
    this.drawTarget = (a = t.gl, { id: nk(), texture: Ha(a), framebuffer: { id: ek(), bind: function() {
    }, reset: function() {
    }, destroy: function() {
    } }, getWidth: function() {
      return 0;
    }, getHeight: function() {
      return 0;
    }, bind: function() {
      a.bindFramebuffer(a.FRAMEBUFFER, null);
    }, setSize: function() {
    }, reset: function() {
    }, destroy: function() {
    } }), this.colorTarget = t.createRenderTarget(n, r, !0, "uint8", "linear"), this.packedDepth = !f.depthTexture, this.depthTarget = t.createRenderTarget(n, r), this.depthTexture = this.depthTarget.texture, this.depthTargetPrimitives = this.packedDepth ? t.createRenderTarget(n, r) : null, this.depthTargetVolumes = this.packedDepth ? t.createRenderTarget(n, r) : null, this.depthTexturePrimitives = this.depthTargetPrimitives ? this.depthTargetPrimitives.texture : p.texture("image-depth", "depth", g ? "float" : "ushort", "nearest"), this.depthTextureVolumes = this.depthTargetVolumes ? this.depthTargetVolumes.texture : p.texture("image-depth", "depth", g ? "float" : "ushort", "nearest"), this.packedDepth || (this.depthTexturePrimitives.define(n, r), this.depthTextureVolumes.define(n, r)), this.depthMerge = (o = t, s = this.depthTexturePrimitives, u = this.depthTextureVolumes, l = this.packedDepth, c = O(O({}, Pi), { tDepthPrimitives: R.create(s), tDepthVolumes: R.create(u), uTexSize: R.create(xe.create(s.getWidth(), s.getHeight())), dPackedDepth: R.create(l) }), d = O({}, eX), vi(gi(o, "triangles", tX, d, c), c)), this.wboit = i ? new XW(t, n, r) : void 0, this.marking = new jA(t, n, r), this.postprocessing = new ll(t, this), this.antialiasing = new b4(t, this), this.copyFboTarget = R5(t, this.colorTarget.texture), this.copyFboPostprocessing = R5(t, this.postprocessing.target.texture);
  }
  return Object.defineProperty(e.prototype, "wboitEnabled", { get: function() {
    var t;
    return !!(!((t = this.wboit) === null || t === void 0) && t.supported);
  }, enumerable: !1, configurable: !0 }), e.prototype.reset = function() {
    var t;
    (t = this.wboit) === null || t === void 0 || t.reset();
  }, e.prototype.setSize = function(t, n) {
    var r, i = this.colorTarget.getWidth(), a = this.colorTarget.getHeight();
    t === i && n === a || (this.colorTarget.setSize(t, n), this.depthTarget.setSize(t, n), this.depthTargetPrimitives ? this.depthTargetPrimitives.setSize(t, n) : this.depthTexturePrimitives.define(t, n), this.depthTargetVolumes ? this.depthTargetVolumes.setSize(t, n) : this.depthTextureVolumes.define(t, n), R.update(this.depthMerge.values.uTexSize, xe.set(this.depthMerge.values.uTexSize.ref.value, t, n)), R.update(this.copyFboTarget.values.uTexSize, xe.set(this.copyFboTarget.values.uTexSize.ref.value, t, n)), R.update(this.copyFboPostprocessing.values.uTexSize, xe.set(this.copyFboPostprocessing.values.uTexSize.ref.value, t, n)), !((r = this.wboit) === null || r === void 0) && r.supported && this.wboit.setSize(t, n), this.marking.setSize(t, n), this.postprocessing.setSize(t, n), this.antialiasing.setSize(t, n));
  }, e.prototype._depthMerge = function() {
    var t = this.webgl, n = t.state, r = t.gl;
    this.depthMerge.update(), this.depthTarget.bind(), n.disable(r.BLEND), n.disable(r.DEPTH_TEST), n.disable(r.CULL_FACE), n.depthMask(!1), n.clearColor(1, 1, 1, 1), r.clear(r.COLOR_BUFFER_BIT), this.depthMerge.render();
  }, e.prototype._renderWboit = function(t, n, r, i, a) {
    var o;
    if (!(!((o = this.wboit) === null || o === void 0) && o.supported)) throw new Error("expected wboit to be supported");
    this.colorTarget.bind(), t.clear(!0), this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, "depth"), this.colorTarget.bind(), t.clearDepth(), t.renderWboitOpaque(r.primitives, n, null), this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer, "depth"), this.colorTarget.bind(), t.clearDepth(), t.renderWboitOpaque(r.volumes, n, this.depthTexturePrimitives), this._depthMerge(), ll.isEnabled(a) && this.postprocessing.render(n, !1, i, t.props.backgroundColor, a), this.wboit.bind(), t.renderWboitTransparent(r.primitives, n, this.depthTexture), t.renderWboitTransparent(r.volumes, n, this.depthTexture), ll.isEnabled(a) ? (this.depthTexturePrimitives.attachFramebuffer(this.postprocessing.target.framebuffer, "depth"), this.postprocessing.target.bind()) : (this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, "depth"), this.colorTarget.bind()), this.wboit.render();
  }, e.prototype._renderBlended = function(t, n, r, i, a, o) {
    if (i ? this.drawTarget.bind() : (this.colorTarget.bind(), this.packedDepth || this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer, "depth")), t.clear(!0), t.renderBlendedOpaque(r.primitives, n, null), !i) {
      this.depthTargetPrimitives && (this.depthTargetPrimitives.bind(), t.clear(!1), t.renderDepth(r.primitives, n, null), this.colorTarget.bind()), this.packedDepth || (this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer, "depth"), t.clearDepth()), t.renderBlendedVolumeOpaque(r.volumes, n, this.depthTexturePrimitives), this.depthTargetVolumes && (this.depthTargetVolumes.bind(), t.clear(!1), t.renderDepth(r.volumes, n, this.depthTexturePrimitives), this.colorTarget.bind()), this._depthMerge(), this.colorTarget.bind(), ll.isEnabled(o) && this.postprocessing.render(n, !1, a, t.props.backgroundColor, o), t.renderBlendedVolumeTransparent(r.volumes, n, this.depthTexturePrimitives);
      var s = ll.isEnabled(o) ? this.postprocessing.target : this.colorTarget;
      this.packedDepth || this.depthTexturePrimitives.attachFramebuffer(s.framebuffer, "depth"), s.bind();
    }
    t.renderBlendedTransparent(r.primitives, n, null);
  }, e.prototype._render = function(t, n, r, i, a, o) {
    var s = r.volumes.renderables.length > 0, u = ll.isEnabled(o.postprocessing), l = b4.isEnabled(o.postprocessing), c = jA.isEnabled(o.marking), d = n.viewport, f = d.x, p = d.y, g = d.width, m = d.height;
    if (t.setViewport(f, p, g, m), t.update(n), o.transparentBackground && !l && a && (this.drawTarget.bind(), t.clear(!1)), this.wboitEnabled ? this._renderWboit(t, n, r, o.transparentBackground, o.postprocessing) : this._renderBlended(t, n, r, !s && !u && !l && a, o.transparentBackground, o.postprocessing), u ? this.postprocessing.target.bind() : !a || s || this.wboitEnabled ? this.colorTarget.bind() : this.drawTarget.bind(), c) {
      var v = r.getMarkerAverage();
      if (v > 0) {
        var h = o.marking.ghostEdgeStrength < 1;
        h && v !== 1 && (this.marking.depthTarget.bind(), t.clear(!1, !0), t.renderMarkingDepth(r.primitives, n, null)), this.marking.maskTarget.bind(), t.clear(!1, !0), t.renderMarkingMask(r.primitives, n, h ? this.marking.depthTarget.texture : null), this.marking.update(o.marking), this.marking.render(n.viewport, u ? this.postprocessing.target : this.colorTarget);
      }
    }
    i.debug.isEnabled && (i.debug.syncVisibility(), t.renderBlended(i.debug.scene, n, null)), i.handle.isEnabled && t.renderBlended(i.handle.scene, n, null), i.camera.isEnabled && (i.camera.update(n), t.update(i.camera.camera), t.renderBlended(i.camera.scene, i.camera.camera, null)), l ? this.antialiasing.render(n, a, o.postprocessing) : a && (this.drawTarget.bind(), this.webgl.state.disable(this.webgl.gl.DEPTH_TEST), u ? this.copyFboPostprocessing.render() : (s || this.wboitEnabled) && this.copyFboTarget.render()), this.webgl.gl.flush();
  }, e.prototype.render = function(t, n, r) {
    var i = t.renderer, a = t.camera, o = t.scene, s = t.helper;
    i.setTransparentBackground(n.transparentBackground), i.setDrawingBufferSize(this.colorTarget.getWidth(), this.colorTarget.getHeight()), i.setPixelRatio(this.webgl.pixelRatio), cm.is(a) ? (this._render(i, a.left, o, s, r, n), this._render(i, a.right, o, s, r, n)) : this._render(i, a, o, s, r, n);
  }, e.prototype.getColorTarget = function(t) {
    return b4.isEnabled(t) ? this.antialiasing.target : ll.isEnabled(t) ? this.postprocessing.target : this.colorTarget;
  }, e;
}();
function Rs(e) {
  for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) n[r - 1] = arguments[r];
  throw Error("[Immer] minified error nr: " + e + (n.length ? " " + n.map(function(i) {
    return "'" + i + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function dm(e) {
  return !!e && !!e[So];
}
function Pf(e) {
  return !!e && (function(t) {
    if (!t || typeof t != "object") return !1;
    var n = Object.getPrototypeOf(t);
    if (n === null) return !0;
    var r = Object.hasOwnProperty.call(n, "constructor") && n.constructor;
    return r === Object || typeof r == "function" && Function.toString.call(r) === sX;
  }(e) || Array.isArray(e) || !!e[$A] || !!e.constructor[$A] || a8(e) || o8(e));
}
function B0(e, t, n) {
  n === void 0 && (n = !1), fm(e) === 0 ? (n ? Object.keys : d8)(e).forEach(function(r) {
    n && typeof r == "symbol" || t(r, e[r], e);
  }) : e.forEach(function(r, i) {
    return t(i, r, e);
  });
}
function fm(e) {
  var t = e[So];
  return t ? t.i > 3 ? t.i - 4 : t.i : Array.isArray(e) ? 1 : a8(e) ? 2 : o8(e) ? 3 : 0;
}
function $5(e, t) {
  return fm(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
}
function nO(e, t, n) {
  var r = fm(e);
  r === 2 ? e.set(t, n) : r === 3 ? (e.delete(t), e.add(n)) : e[t] = n;
}
function a8(e) {
  return aX && e instanceof Map;
}
function o8(e) {
  return oX && e instanceof Set;
}
function Kd(e) {
  return e.o || e.t;
}
function s8(e) {
  if (Array.isArray(e)) return Array.prototype.slice.call(e);
  var t = uX(e);
  delete t[So];
  for (var n = d8(t), r = 0; r < n.length; r++) {
    var i = n[r], a = t[i];
    a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (t[i] = { configurable: !0, writable: !0, enumerable: a.enumerable, value: e[i] });
  }
  return Object.create(Object.getPrototypeOf(e), t);
}
function u8(e, t) {
  return t === void 0 && (t = !1), l8(e) || dm(e) || !Pf(e) || (fm(e) > 1 && (e.set = e.add = e.clear = e.delete = nX), Object.freeze(e), t && B0(e, function(n, r) {
    return u8(r, !0);
  }, !0)), e;
}
function nX() {
  Rs(2);
}
function l8(e) {
  return e == null || typeof e != "object" || Object.isFrozen(e);
}
function Iu(e) {
  var t = lX[e];
  return t || Rs(18, e), t;
}
function KA() {
  return R0;
}
function x4(e, t) {
  t && (Iu("Patches"), e.u = [], e.s = [], e.v = t);
}
function vv(e) {
  e_(e), e.p.forEach(rX), e.p = null;
}
function e_(e) {
  e === R0 && (R0 = e.l);
}
function YA(e) {
  return R0 = { p: [], l: R0, h: e, m: !0, _: 0 };
}
function rX(e) {
  var t = e[So];
  t.i === 0 || t.i === 1 ? t.j() : t.O = !0;
}
function C4(e, t) {
  t._ = t.p.length;
  var n = t.p[0], r = e !== void 0 && e !== n;
  return t.h.g || Iu("ES5").S(t, e, r), r ? (n[So].P && (vv(t), Rs(4)), Pf(e) && (e = yv(t, e), t.l || bv(t, e)), t.u && Iu("Patches").M(n[So].t, e, t.u, t.s)) : e = yv(t, n, []), vv(t), t.u && t.v(t.u, t.s), e !== rO ? e : void 0;
}
function yv(e, t, n) {
  if (l8(t)) return t;
  var r = t[So];
  if (!r) return B0(t, function(a, o) {
    return WA(e, r, t, a, o, n);
  }, !0), t;
  if (r.A !== e) return t;
  if (!r.P) return bv(e, r.t, !0), r.t;
  if (!r.I) {
    r.I = !0, r.A._--;
    var i = r.i === 4 || r.i === 5 ? r.o = s8(r.k) : r.o;
    B0(r.i === 3 ? new Set(i) : i, function(a, o) {
      return WA(e, r, i, a, o, n);
    }), bv(e, i, !1), n && e.u && Iu("Patches").R(r, n, e.u, e.s);
  }
  return r.o;
}
function WA(e, t, n, r, i, a) {
  if (dm(i)) {
    var o = yv(e, i, a && t && t.i !== 3 && !$5(t.D, r) ? a.concat(r) : void 0);
    if (nO(n, r, o), !dm(o)) return;
    e.m = !1;
  }
  if (Pf(i) && !l8(i)) {
    if (!e.h.F && e._ < 1) return;
    yv(e, i), t && t.A.l || bv(e, i);
  }
}
function bv(e, t, n) {
  n === void 0 && (n = !1), e.h.F && e.m && u8(t, n);
}
function S4(e, t) {
  var n = e[So];
  return (n ? Kd(n) : e)[t];
}
function XA(e, t) {
  if (t in e) for (var n = Object.getPrototypeOf(e); n; ) {
    var r = Object.getOwnPropertyDescriptor(n, t);
    if (r) return r;
    n = Object.getPrototypeOf(n);
  }
}
function t_(e) {
  e.P || (e.P = !0, e.l && t_(e.l));
}
function A4(e) {
  e.o || (e.o = s8(e.t));
}
function n_(e, t, n) {
  var r = a8(t) ? Iu("MapSet").N(t, n) : o8(t) ? Iu("MapSet").T(t, n) : e.g ? function(i, a) {
    var o = Array.isArray(i), s = { i: o ? 1 : 0, A: a ? a.A : KA(), P: !1, I: !1, D: {}, l: a, t: i, k: null, o: null, j: null, C: !1 }, u = s, l = r_;
    o && (u = [s], l = Up);
    var c = Proxy.revocable(u, l), d = c.revoke, f = c.proxy;
    return s.k = f, s.j = d, f;
  }(t, n) : Iu("ES5").J(t, n);
  return (n ? n.A : KA()).p.push(r), r;
}
function iX(e) {
  return dm(e) || Rs(22, e), function t(n) {
    if (!Pf(n)) return n;
    var r, i = n[So], a = fm(n);
    if (i) {
      if (!i.P && (i.i < 4 || !Iu("ES5").K(i))) return i.t;
      i.I = !0, r = ZA(n, a), i.I = !1;
    } else r = ZA(n, a);
    return B0(r, function(o, s) {
      i && function(u, l) {
        return fm(u) === 2 ? u.get(l) : u[l];
      }(i.t, o) === s || nO(r, o, t(s));
    }), a === 3 ? new Set(r) : r;
  }(e);
}
function ZA(e, t) {
  switch (t) {
    case 2:
      return new Map(e);
    case 3:
      return Array.from(e);
  }
  return s8(e);
}
var QA, R0, c8 = typeof Symbol < "u" && typeof Symbol("x") == "symbol", aX = typeof Map < "u", oX = typeof Set < "u", JA = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u", rO = c8 ? Symbol.for("immer-nothing") : ((QA = {})["immer-nothing"] = !0, QA), $A = c8 ? Symbol.for("immer-draftable") : "__$immer_draftable", So = c8 ? Symbol.for("immer-state") : "__$immer_state", sX = "" + Object.prototype.constructor, d8 = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(e) {
  return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
} : Object.getOwnPropertyNames, uX = Object.getOwnPropertyDescriptors || function(e) {
  var t = {};
  return d8(e).forEach(function(n) {
    t[n] = Object.getOwnPropertyDescriptor(e, n);
  }), t;
}, lX = {}, r_ = { get: function(e, t) {
  if (t === So) return e;
  var n = Kd(e);
  if (!$5(n, t)) return function(i, a, o) {
    var s, u = XA(a, o);
    return u ? "value" in u ? u.value : (s = u.get) === null || s === void 0 ? void 0 : s.call(i.k) : void 0;
  }(e, n, t);
  var r = n[t];
  return e.I || !Pf(r) ? r : r === S4(e.t, t) ? (A4(e), e.o[t] = n_(e.A.h, r, e)) : r;
}, has: function(e, t) {
  return t in Kd(e);
}, ownKeys: function(e) {
  return Reflect.ownKeys(Kd(e));
}, set: function(e, t, n) {
  var r = XA(Kd(e), t);
  if (r != null && r.set) return r.set.call(e.k, n), !0;
  if (!e.P) {
    var i = S4(Kd(e), t), a = i == null ? void 0 : i[So];
    if (a && a.t === n) return e.o[t] = n, e.D[t] = !1, !0;
    if (function(o, s) {
      return o === s ? o !== 0 || 1 / o == 1 / s : o != o && s != s;
    }(n, i) && (n !== void 0 || $5(e.t, t))) return !0;
    A4(e), t_(e);
  }
  return e.o[t] === n && typeof n != "number" && (n !== void 0 || t in e.o) || (e.o[t] = n, e.D[t] = !0, !0);
}, deleteProperty: function(e, t) {
  return S4(e.t, t) !== void 0 || t in e.t ? (e.D[t] = !1, A4(e), t_(e)) : delete e.D[t], e.o && delete e.o[t], !0;
}, getOwnPropertyDescriptor: function(e, t) {
  var n = Kd(e), r = Reflect.getOwnPropertyDescriptor(n, t);
  return r && { writable: !0, configurable: e.i !== 1 || t !== "length", enumerable: r.enumerable, value: n[t] };
}, defineProperty: function() {
  Rs(11);
}, getPrototypeOf: function(e) {
  return Object.getPrototypeOf(e.t);
}, setPrototypeOf: function() {
  Rs(12);
} }, Up = {};
B0(r_, function(e, t) {
  Up[e] = function() {
    return arguments[0] = arguments[0][0], t.apply(this, arguments);
  };
}), Up.deleteProperty = function(e, t) {
  return Up.set.call(this, e, t, void 0);
}, Up.set = function(e, t, n) {
  return r_.set.call(this, e[0], t, n, e[0]);
};
var cX = function() {
  function e(n) {
    var r = this;
    this.g = JA, this.F = !0, this.produce = function(i, a, o) {
      if (typeof i == "function" && typeof a != "function") {
        var s = a;
        a = i;
        var u = r;
        return function(m) {
          var v = this;
          m === void 0 && (m = s);
          for (var h = arguments.length, y = Array(h > 1 ? h - 1 : 0), x = 1; x < h; x++) y[x - 1] = arguments[x];
          return u.produce(m, function(S) {
            var b;
            return (b = a).call.apply(b, [v, S].concat(y));
          });
        };
      }
      var l;
      if (typeof a != "function" && Rs(6), o !== void 0 && typeof o != "function" && Rs(7), Pf(i)) {
        var c = YA(r), d = n_(r, i, void 0), f = !0;
        try {
          l = a(d), f = !1;
        } finally {
          f ? vv(c) : e_(c);
        }
        return typeof Promise < "u" && l instanceof Promise ? l.then(function(m) {
          return x4(c, o), C4(m, c);
        }, function(m) {
          throw vv(c), m;
        }) : (x4(c, o), C4(l, c));
      }
      if (!i || typeof i != "object") {
        if ((l = a(i)) === void 0 && (l = i), l === rO && (l = void 0), r.F && u8(l, !0), o) {
          var p = [], g = [];
          Iu("Patches").M(i, l, p, g), o(p, g);
        }
        return l;
      }
      Rs(21, i);
    }, this.produceWithPatches = function(i, a) {
      if (typeof i == "function") return function(l) {
        for (var c = arguments.length, d = Array(c > 1 ? c - 1 : 0), f = 1; f < c; f++) d[f - 1] = arguments[f];
        return r.produceWithPatches(l, function(p) {
          return i.apply(void 0, [p].concat(d));
        });
      };
      var o, s, u = r.produce(i, a, function(l, c) {
        o = l, s = c;
      });
      return typeof Promise < "u" && u instanceof Promise ? u.then(function(l) {
        return [l, o, s];
      }) : [u, o, s];
    }, typeof (n == null ? void 0 : n.useProxies) == "boolean" && this.setUseProxies(n.useProxies), typeof (n == null ? void 0 : n.autoFreeze) == "boolean" && this.setAutoFreeze(n.autoFreeze);
  }
  var t = e.prototype;
  return t.createDraft = function(n) {
    Pf(n) || Rs(8), dm(n) && (n = iX(n));
    var r = YA(this), i = n_(this, n, void 0);
    return i[So].C = !0, e_(r), i;
  }, t.finishDraft = function(n, r) {
    var i = (n && n[So]).A;
    return x4(i, r), C4(void 0, i);
  }, t.setAutoFreeze = function(n) {
    this.F = n;
  }, t.setUseProxies = function(n) {
    n && !JA && Rs(20), this.g = n;
  }, t.applyPatches = function(n, r) {
    var i;
    for (i = r.length - 1; i >= 0; i--) {
      var a = r[i];
      if (a.path.length === 0 && a.op === "replace") {
        n = a.value;
        break;
      }
    }
    i > -1 && (r = r.slice(i + 1));
    var o = Iu("Patches").$;
    return dm(n) ? o(n, r) : this.produce(n, function(s) {
      return o(s, r);
    });
  }, e;
}(), co = new cX(), f8 = co.produce;
co.produceWithPatches.bind(co), co.setAutoFreeze.bind(co), co.setUseProxies.bind(co), co.applyPatches.bind(co), co.createDraft.bind(co), co.finishDraft.bind(co);
var ud, Vo = new Uint16Array([0, 1, 2, 1, 3, 2]), Md = be.add3, Ti = be.add2, ew = be.add;
(function(e) {
  e.create = function(t, n, r, i) {
    t === void 0 && (t = {}), n === void 0 && (n = 2048), r === void 0 && (r = 1024), n *= 2, r *= 2;
    var a = be.create(Float32Array, 3, r, i ? i.centerBuffer.ref.value : n), o = be.create(Float32Array, 2, r, i ? i.mappingBuffer.ref.value : n), s = be.create(Float32Array, 1, r, i ? i.depthBuffer.ref.value : n), u = be.create(Uint32Array, 3, r, i ? i.indexBuffer.ref.value : n), l = be.create(Float32Array, 1, r, i ? i.groupBuffer.ref.value : n), c = be.create(Float32Array, 2, r, i ? i.tcoordBuffer.ref.value : n), d = O(O({}, N.getDefaultValues(Co.Params)), t), f = d.attachment, p = d.background, g = d.backgroundMargin, m = d.tether, v = d.tetherLength, h = d.tetherBaseWidth, y = function(_) {
      var C = JSON.stringify(_);
      return Qy[C] === void 0 && (Qy[C] = new yK(_)), Qy[C];
    }(d), x = 0.4 * g, S = y.buffer / y.lineHeight, b = function(_, C, w, I, M) {
      Md(a, _, C, w), ew(s, I), ew(l, M);
    };
    return { add: function(_, C, w, I, M, E, T) {
      for (var P = 0, k = _.length, D = 0; D < k; ++D)
        P += (Oe = y.get(_[D])).nw - 2 * S;
      var B, L;
      if (B = f.startsWith("top") ? 0.8 : f.startsWith("middle") ? 0.4 : 0, L = f.endsWith("right") ? P : f.endsWith("center") ? P / 2 : 0, m) switch (f) {
        case "bottom-left":
          L -= v / 2 + x + 0.1, B -= v / 2 + x;
          break;
        case "bottom-center":
          B -= v + x;
          break;
        case "bottom-right":
          L += v / 2 + x + 0.1, B -= v / 2 + x;
          break;
        case "middle-left":
          L -= v + x + 0.1;
          break;
        case "middle-center":
          break;
        case "middle-right":
          L += v + x + 0.1;
          break;
        case "top-left":
          L -= v / 2 + x + 0.1, B += v / 2 + x;
          break;
        case "top-center":
          B += v + x;
          break;
        case "top-right":
          L += v / 2 + x + 0.1, B += v / 2 + x;
      }
      var F = (-L - x - 0.1) * E, V = (P - L + x + 0.1) * E, G = (0.8 - B + x) * E, H = (-B - x) * E;
      if (p) {
        Ti(o, F, G), Ti(o, F, H), Ti(o, V, G), Ti(o, V, H);
        for (var q = a.elementCount, z = 0; z < 4; ++z) Ti(c, 10, 10), b(C, w, I, M, T);
        Md(u, q + Vo[0], q + Vo[1], q + Vo[2]), Md(u, q + Vo[3], q + Vo[4], q + Vo[5]);
      }
      if (m) {
        var K = void 0, Y = void 0, Z = void 0, X = void 0, W = void 0, J = void 0, $ = void 0, ee = void 0, ce = v * E, ae = h * E;
        switch (f) {
          case "bottom-left":
            K = F - ce / 2, Z = F + ae / 2, W = F, $ = F, Y = H - ce / 2, X = H, J = H + ae / 2, ee = H;
            break;
          case "bottom-center":
            K = 0, Z = ae / 2, W = -ae / 2, $ = 0, Y = H - ce, X = H, J = H, ee = H;
            break;
          case "bottom-right":
            K = V + ce / 2, Z = V, W = V - ae / 2, $ = V, Y = H - ce / 2, X = H + ae / 2, J = H, ee = H;
            break;
          case "middle-left":
            K = F - ce, Z = F, W = F, $ = F, Y = 0, X = -ae / 2, J = ae / 2, ee = 0;
            break;
          case "middle-center":
            K = 0, Z = 0, W = 0, $ = 0, Y = 0, X = 0, J = 0, ee = 0;
            break;
          case "middle-right":
            K = V + ce, Z = V, W = V, $ = V, Y = 0, X = ae / 2, J = -ae / 2, ee = 0;
            break;
          case "top-left":
            K = F - ce / 2, Z = F + ae / 2, W = F, $ = F, Y = G + ce / 2, X = G, J = G - ae / 2, ee = G;
            break;
          case "top-center":
            K = 0, Z = ae / 2, W = -ae / 2, $ = 0, Y = G + ce, X = G, J = G, ee = G;
            break;
          case "top-right":
            K = V + ce / 2, Z = V, W = V - ae / 2, $ = V, Y = G + ce / 2, X = G - ae / 2, J = G, ee = G;
            break;
          default:
            Mi();
        }
        for (Ti(o, K, Y), Ti(o, Z, X), Ti(o, W, J), Ti(o, $, ee), q = a.elementCount, z = 0; z < 4; ++z) Ti(c, 10, 10), b(C, w, I, M, T);
        Md(u, q, q + 1, q + 3), Md(u, q, q + 3, q + 2);
      }
      L += S, B += S;
      var he = 0;
      for (D = 0; D < k; ++D) {
        var Oe, Ne = (he - L) * E, Ue = (he + (Oe = y.get(_[D])).nw - L) * E, Ze = (Oe.nh - B) * E, Se = -B * E;
        Ti(o, Ne, Ze), Ti(o, Ne, Se), Ti(o, Ue, Ze), Ti(o, Ue, Se);
        var qe = y.texture.width, Pe = y.texture.height;
        for (Ti(c, Oe.x / qe, Oe.y / Pe), Ti(c, Oe.x / qe, (Oe.y + Oe.h) / Pe), Ti(c, (Oe.x + Oe.w) / qe, Oe.y / Pe), Ti(c, (Oe.x + Oe.w) / qe, (Oe.y + Oe.h) / Pe), he += Oe.nw - 2 * S, q = a.elementCount, z = 0; z < 4; ++z) b(C, w, I, M, T);
        Md(u, q + Vo[0], q + Vo[1], q + Vo[2]), Md(u, q + Vo[3], q + Vo[4], q + Vo[5]);
      }
    }, getText: function() {
      var _ = y.texture, C = be.compact(a, !0), w = be.compact(o, !0), I = be.compact(s, !0), M = be.compact(u, !0), E = be.compact(l, !0), T = be.compact(c, !0);
      return Co.create(_, C, w, I, M, E, T, u.elementCount / 2, i);
    } };
  };
})(ud || (ud = {}));
var ir, iO = { alpha: N.Numeric(0.51, { min: 0, max: 1, step: 0.01 }, { isEssential: !0, label: "Opacity" }), hideX: N.Boolean(!1), hideY: N.Boolean(!1), hideZ: N.Boolean(!1), colorX: N.Color(qt.red, { isEssential: !0 }), colorY: N.Color(qt.green, { isEssential: !0 }), colorZ: N.Color(qt.blue, { isEssential: !0 }), scale: N.Numeric(0.33, { min: 0.1, max: 2, step: 0.1 }, { isEssential: !0 }), vecA: N.Vec3(A.unitX), vecB: N.Vec3(A.unitY), vecC: N.Vec3(A.unitZ), location: N.Select("bottom-left", N.arrayToOptions(["bottom-left", "bottom-right", "top-left", "top-right"])), locationOffsetX: N.Numeric(0), locationOffsetY: N.Numeric(0), originColor: N.Color(qt.grey), radiusScale: N.Numeric(0.075, { min: 0.01, max: 0.3, step: 1e-3 }), showPlanes: N.Boolean(!1), planeColorXY: N.Color(qt.grey, { label: "Plane Color XY" }), planeColorXZ: N.Color(qt.grey, { label: "Plane Color XZ" }), planeColorYZ: N.Color(qt.grey, { label: "Plane Color YZ" }), showLabels: N.Boolean(!0), labelX: N.Text("X"), labelY: N.Text("Y"), labelZ: N.Text("Z"), labelColorX: N.Color(qt.grey), labelColorY: N.Color(qt.grey), labelColorZ: N.Color(qt.grey), labelOpacity: N.Numeric(1, { min: 0, max: 1, step: 0.01 }), labelScale: N.Numeric(0.15, { min: 0.1, max: 1, step: 0.01 }) }, x3 = { axes: N.MappedStatic("on", { on: N.Group(iO), off: N.Group({}) }, { cycle: !0, description: "Show camera orientation axes" }) }, aO = function() {
  function e(t, n) {
    var r = this;
    n === void 0 && (n = {}), this.webgl = t, this.props = { axes: { name: "off", params: {} } }, this.pixelRatio = 1, this.eachGroup = function(i, a) {
      if (!tw(i)) return !1;
      var o = !1;
      if (r.meshRenderObject) for (var s = r.meshRenderObject.values.uGroupCount.ref.value, u = 0, l = i.elements; u < l.length; u++) {
        var c = l[u], d = c.groupId, f = c.instanceId * s + d;
        a(le.ofSingleton(f)) && (o = !0);
      }
      if (r.textRenderObject) {
        s = r.textRenderObject.values.uGroupCount.ref.value;
        for (var p = 0, g = i.elements; p < g.length; p++) {
          var m = g[p];
          d = m.groupId, f = m.instanceId * s + d, a(le.ofSingleton(f)) && (o = !0);
        }
      }
      return o;
    }, this.scene = lm.create(t, v3), this.camera = new Nr(), A.set(this.camera.up, 0, 1, 0), A.set(this.camera.target, 0, 0, 0), this.setProps(n);
  }
  return e.prototype.setProps = function(t) {
    var n = this;
    this.props = f8(this.props, function(r) {
      if (t.axes !== void 0 && (r.axes.name = t.axes.name, t.axes.name === "on")) {
        n.scene.clear();
        var i = O(O({}, N.getDefaultValues(iO)), t.axes.params);
        n.pixelRatio = n.webgl.pixelRatio;
        var a = O(O({}, i), { scale: i.scale * n.pixelRatio, labelScale: i.labelScale * n.pixelRatio });
        n.meshRenderObject = function(o) {
          var s = function(u, l) {
            var c = 100 * u.scale, d = function(p, g) {
              var m = p.vecA, v = p.vecB, h = p.vecC, y = mt.createState(512, 256, g), x = 100 * p.scale, S = p.radiusScale * x, b = p.showLabels ? 100 * p.labelScale / 3 : 0, _ = A.sub(A(), A.scale(A(), m, x - b), A.scale(A(), A.create(0, 0, 1), 0.5 * x)), C = A.sub(A(), A.scale(A(), v, x - b), A.scale(A(), A.create(0, 0, 1), 0.5 * x)), w = A.sub(A(), A.scale(A(), h, x - b), A.scale(A(), A.create(0, 0, 1), 0.5 * x)), I = A.sub(A(), A.origin, A.scale(A(), A.create(0, 0, 1), 0.5 * x)), M = { radiusTop: S, radiusBottom: S, radialSegments: 32 };
              if (y.currentGroup = ir.Origin, mi(y, I, S, 2), p.hideX || (y.currentGroup = ir.X, mi(y, _, S, 2), li(y, I, _, 1, M)), p.hideY || (y.currentGroup = ir.Y, mi(y, C, S, 2), li(y, I, C, 1, M)), p.hideZ || (y.currentGroup = ir.Z, mi(y, w, S, 2), li(y, I, w, 1, M)), p.showPlanes) {
                if (A.scale(_, _, 0.5), A.scale(C, C, 0.5), A.scale(w, w, 0.5), !p.hideX && !p.hideY) {
                  y.currentGroup = ir.XY, mt.addTriangle(y, I, _, C), mt.addTriangle(y, I, C, _);
                  var E = A.add(A(), _, C);
                  mt.addTriangle(y, E, _, C), mt.addTriangle(y, E, C, _);
                }
                if (!p.hideX && !p.hideZ) {
                  y.currentGroup = ir.XZ, mt.addTriangle(y, I, _, w), mt.addTriangle(y, I, w, _);
                  var T = A.add(A(), _, w);
                  mt.addTriangle(y, T, _, w), mt.addTriangle(y, T, w, _);
                }
                if (!p.hideY && !p.hideZ) {
                  y.currentGroup = ir.YZ, mt.addTriangle(y, I, C, w), mt.addTriangle(y, I, w, C);
                  var P = A.add(A(), C, w);
                  mt.addTriangle(y, P, C, w), mt.addTriangle(y, P, w, C);
                }
              }
              return mt.getMesh(y);
            }(u, void 0);
            d.setBoundingSphere(pe.create(A.create(c / 2, c / 2, c / 2), c + c / 4));
            var f = function(p) {
              switch (p) {
                case ir.X:
                  return u.colorX;
                case ir.Y:
                  return u.colorY;
                case ir.Z:
                  return u.colorZ;
                case ir.XY:
                  return u.planeColorXY;
                case ir.XZ:
                  return u.planeColorXZ;
                case ir.YZ:
                  return u.planeColorYZ;
                case ir.Origin:
                  return u.originColor;
                default:
                  return qt.grey;
              }
            };
            return Wt.create("axes-mesh", {}, d, f, function() {
              return 1;
            }, function() {
              return "";
            });
          }(o);
          return Wt.createRenderObject(s, O(O(O({}, N.getDefaultValues(Lt.Params)), o), { ignoreLight: !0 }));
        }(a), n.scene.add(n.meshRenderObject), a.showLabels ? (n.textRenderObject = function(o) {
          var s = function(u, l) {
            var c = 100 * u.scale, d = function(p, g) {
              var m = p.vecA, v = p.vecB, h = p.vecC, y = ud.create(p, 8, 8, g), x = 100 * p.scale, S = A.add(A(), A.scale(A(), m, x), A.scale(A(), A.create(0, 0, 1), 1.5 * x)), b = A.add(A(), A.scale(A(), v, x), A.scale(A(), A.create(0, 0, 1), 1.5 * x)), _ = A.add(A(), A.scale(A(), h, x), A.scale(A(), A.create(0, 0, 1), 1.5 * x)), C = 100 * p.labelScale;
              return p.hideX || y.add(p.labelX, S[0], S[1], S[2], 0, C, ir.X), p.hideY || y.add(p.labelY, b[0], b[1], b[2], 0, C, ir.Y), p.hideZ || y.add(p.labelZ, _[0], _[1], _[2], 0, C, ir.Z), y.getText();
            }(u, void 0);
            d.setBoundingSphere(pe.create(A.create(c / 2, c / 2, c / 2), c));
            var f = function(p) {
              switch (p) {
                case ir.X:
                  return u.labelColorX;
                case ir.Y:
                  return u.labelColorY;
                case ir.Z:
                  return u.labelColorZ;
                default:
                  return qt.grey;
              }
            };
            return Wt.create("axes-text", {}, d, f, function() {
              return 1;
            }, function() {
              return "";
            });
          }(o);
          return Wt.createRenderObject(s, O(O(O({}, N.getDefaultValues(Co.Params)), o), { alpha: o.labelOpacity }));
        }(a), n.scene.add(n.textRenderObject)) : n.textRenderObject = void 0, n.scene.commit(), A.set(n.camera.position, 0, 0, 200 * a.scale), ne.lookAt(n.camera.view, n.camera.position, n.camera.target, n.camera.up), r.axes.params = O({}, i);
      }
    });
  }, Object.defineProperty(e.prototype, "isEnabled", { get: function() {
    return this.props.axes.name === "on";
  }, enumerable: !1, configurable: !0 }), e.prototype.getLoci = function(t) {
    var n = t.objectId, r = t.groupId, i = t.instanceId;
    return (this.meshRenderObject && n === this.meshRenderObject.id || this.textRenderObject && n === this.textRenderObject.id) && r !== ir.None ? function(a, o, s) {
      return n8("camera-axes", a, [{ groupId: o, instanceId: s }], void 0, function() {
        return function(u, l) {
          var c = l.props.axes, d = c.name === "on" ? c.params.labelX : "X", f = c.name === "on" ? c.params.labelY : "Y", p = c.name === "on" ? c.params.labelZ : "Z";
          switch (u) {
            case ir.X:
              return "".concat(d, " Axis");
            case ir.Y:
              return "".concat(f, " Axis");
            case ir.Z:
              return "".concat(p, " Axis");
            case ir.XY:
              return "".concat(d).concat(f, " Plane");
            case ir.XZ:
              return "".concat(d).concat(p, " Plane");
            case ir.YZ:
              return "".concat(f).concat(p, " Plane");
            case ir.Origin:
              return "Origin";
            default:
              return "Axes";
          }
        }(o, a);
      });
    }(this, r, i) : cr;
  }, e.prototype.mark = function(t, n) {
    return !En.is(En.Highlighting, n) || !Ya(t) && (!tw(t) || t.data !== this) ? !1 : Qt.mark(this.meshRenderObject, t, n, this.eachGroup) || Qt.mark(this.textRenderObject, t, n, this.eachGroup);
  }, e.prototype.update = function(t) {
    if (this.meshRenderObject && this.props.axes.name !== "off") {
      this.pixelRatio !== this.webgl.pixelRatio && this.setProps(this.props), function(o, s, u) {
        var l = o.near, c = o.far, d = -s.width / 2, f = s.width / 2, p = s.height / 2, g = -s.height / 2, m = (f - d) / 2, v = (p - g) / 2, h = (f + d) / 2, y = (p + g) / 2, x = h - m, S = h + m, b = y + v, _ = y - v;
        if (u.enabled) {
          var C = (f - d) / u.width, w = (p - g) / u.height;
          S = (x += C * u.offsetX) + C * u.width, _ = (b -= w * u.offsetY) - w * u.height;
        }
        ne.ortho(o.projection, x, S, b, _, l, c);
      }(this.camera, t.viewport, t.viewOffset), ne.extractRotation(this.scene.view, t.view);
      var n = this.textRenderObject ? this.textRenderObject.values.boundingSphere.ref.value.radius : this.meshRenderObject.values.boundingSphere.ref.value.radius, r = this.props.axes.params.location, i = this.props.axes.params.locationOffsetX * this.pixelRatio, a = this.props.axes.params.locationOffsetY * this.pixelRatio;
      r === "bottom-left" ? ne.setTranslation(this.scene.view, A.create(-t.viewport.width / 2 + n + i, -t.viewport.height / 2 + n + a, 0)) : r === "bottom-right" ? ne.setTranslation(this.scene.view, A.create(t.viewport.width / 2 - n - i, -t.viewport.height / 2 + n + a, 0)) : r === "top-left" ? ne.setTranslation(this.scene.view, A.create(-t.viewport.width / 2 + n + i, t.viewport.height / 2 - n - a, 0)) : r === "top-right" ? ne.setTranslation(this.scene.view, A.create(t.viewport.width / 2 - n - i, t.viewport.height / 2 - n - a, 0)) : Mi();
    }
  }, e;
}();
function tw(e) {
  return e.kind === "data-loci" && e.tag === "camera-axes";
}
(function(e) {
  e[e.None = 0] = "None", e[e.X = 1] = "X", e[e.Y = 2] = "Y", e[e.Z = 3] = "Z", e[e.XY = 4] = "XY", e[e.XZ = 5] = "XZ", e[e.YZ = 6] = "YZ", e[e.Origin = 7] = "Origin";
})(ir || (ir = {}));
var dX = { transparentBackground: N.Boolean(!1), multiSample: N.Group(QD), postprocessing: N.Group(ZD), marking: N.Group(eO), cameraHelper: N.Group(x3) }, fX = function() {
  function e(t, n, r, i, a, o, s) {
    this.webgl = t, this.renderer = n, this.scene = r, this.camera = i, this._width = 0, this._height = 0, this._camera = new Nr(), this.props = O(O({}, N.getDefaultValues(dX)), s), this.drawPass = new tO(t, 128, 128, o), this.multiSamplePass = new gv(t, this.drawPass), this.multiSampleHelper = new JD(this.multiSamplePass), this.helper = { camera: new aO(t, this.props.cameraHelper), debug: a.debug, handle: a.handle }, this.setSize(1024, 768);
  }
  return Object.defineProperty(e.prototype, "colorTarget", { get: function() {
    return this._colorTarget;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "width", { get: function() {
    return this._width;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "height", { get: function() {
    return this._height;
  }, enumerable: !1, configurable: !0 }), e.prototype.setSize = function(t, n) {
    t === this._width && n === this._height || (this._width = t, this._height = n, this.drawPass.setSize(t, n), this.multiSamplePass.syncSize());
  }, e.prototype.setProps = function(t) {
    t === void 0 && (t = {}), Object.assign(this.props, t), t.cameraHelper && this.helper.camera.setProps(t.cameraHelper);
  }, e.prototype.render = function() {
    Nr.copySnapshot(this._camera.state, this.camera.state), Ii.set(this._camera.viewport, 0, 0, this._width, this._height), this._camera.update();
    var t = { renderer: this.renderer, camera: this._camera, scene: this.scene, helper: this.helper };
    gv.isEnabled(this.props.multiSample) ? (this.multiSampleHelper.render(t, this.props, !1), this._colorTarget = this.multiSamplePass.colorTarget) : (this.drawPass.render(t, this.props, !1), this._colorTarget = this.drawPass.getColorTarget(this.props.postprocessing));
  }, e.prototype.getImageData = function(t, n, r) {
    var i, a;
    this.setSize(t, n), this.render(), this.colorTarget.bind();
    var o = (i = r == null ? void 0 : r.width) !== null && i !== void 0 ? i : t, s = (a = r == null ? void 0 : r.height) !== null && a !== void 0 ? a : n, u = new Uint8Array(o * s * 4);
    r ? this.webgl.readPixels(r.x, n - r.y - r.height, o, s, u) : this.webgl.readPixels(0, 0, o, s, u);
    var l = cf.create(u, o, s);
    return cf.flipY(l), cf.divideByAlpha(l), new ImageData(new Uint8ClampedArray(u), o, s);
  }, e;
}(), mX = O(O({}, Lt.Params), { alpha: O(O({}, Lt.Params.alpha), { defaultValue: 1 }), ignoreLight: O(O({}, Lt.Params.ignoreLight), { defaultValue: !0 }), colorX: N.Color(qt.red, { isEssential: !0 }), colorY: N.Color(qt.green, { isEssential: !0 }), colorZ: N.Color(qt.blue, { isEssential: !0 }), scale: N.Numeric(0.33, { min: 0.1, max: 2, step: 0.1 }, { isEssential: !0 }) }), oO = { handle: N.MappedStatic("off", { on: N.Group(mX), off: N.Group({}) }, { cycle: !0, description: "Show handle tool" }) }, pX = function() {
  function e(t, n) {
    var r = this;
    n === void 0 && (n = {}), this.webgl = t, this.props = { handle: { name: "off", params: {} } }, this.pixelRatio = 1, this._transform = ne(), this.eachGroup = function(i, a) {
      if (!r.renderObject || !nw(i)) return !1;
      for (var o = !1, s = r.renderObject.values.uGroupCount.ref.value, u = 0, l = i.elements; u < l.length; u++) {
        var c = l[u], d = c.groupId, f = c.instanceId * s + d;
        a(le.ofSingleton(f)) && (o = !0);
      }
      return o;
    }, this.scene = lm.create(t, v3), this.setProps(n);
  }
  return e.prototype.getBoundingSphere = function(t, n) {
    return this.renderObject && (pe.copy(t, this.renderObject.values.invariantBoundingSphere.ref.value), ne.fromArray(this._transform, this.renderObject.values.aTransform.ref.value, 16 * n), pe.transform(t, t, this._transform)), t;
  }, e.prototype.setProps = function(t) {
    var n = this;
    this.props = f8(this.props, function(r) {
      if (t.handle !== void 0 && (r.handle.name = t.handle.name, t.handle.name === "on")) {
        n.scene.clear(), n.pixelRatio = n.webgl.pixelRatio;
        var i = O(O({}, t.handle.params), { scale: t.handle.params.scale * n.webgl.pixelRatio });
        n.renderObject = function(a) {
          var o = function(s, u) {
            var l = 10 * s.scale, c = function(f, p) {
              var g = mt.createState(512, 256, p), m = 0.05 * f, v = A.scale(A(), A.unitX, f), h = A.scale(A(), A.unitY, f), y = A.scale(A(), A.unitZ, f), x = { radiusTop: m, radiusBottom: m, radialSegments: 32 };
              return g.currentGroup = Ed.TranslateScreenXY, mi(g, A.origin, 3 * m, 2), g.currentGroup = Ed.TranslateObjectX, mi(g, v, m, 2), li(g, A.origin, v, 1, x), g.currentGroup = Ed.TranslateObjectY, mi(g, h, m, 2), li(g, A.origin, h, 1, x), g.currentGroup = Ed.TranslateObjectZ, mi(g, y, m, 2), li(g, A.origin, y, 1, x), mt.getMesh(g);
            }(l, void 0);
            c.setBoundingSphere(pe.create(A.create(l / 2, l / 2, l / 2), l + l / 4));
            var d = function(f) {
              switch (f) {
                case Ed.TranslateObjectX:
                  return s.colorX;
                case Ed.TranslateObjectY:
                  return s.colorY;
                case Ed.TranslateObjectZ:
                  return s.colorZ;
                default:
                  return qt.grey;
              }
            };
            return Wt.create("handle", {}, c, d, function() {
              return 1;
            }, function() {
              return "";
            });
          }(a);
          return Wt.createRenderObject(o, a);
        }(i), n.scene.add(n.renderObject), n.scene.commit(), r.handle.params = O({}, t.handle.params);
      }
    });
  }, Object.defineProperty(e.prototype, "isEnabled", { get: function() {
    return this.props.handle.name === "on";
  }, enumerable: !1, configurable: !0 }), e.prototype.update = function(t, n, r) {
    this.renderObject && (this.pixelRatio !== this.webgl.pixelRatio && this.setProps(this.props), ne.setTranslation(this.renderObject.values.aTransform.ref.value, n), ne.fromMat3(this.renderObject.values.aTransform.ref.value, r), R.update(this.renderObject.values.aTransform, this.renderObject.values.aTransform.ref.value), this.scene.update([this.renderObject], !0));
  }, e.prototype.getLoci = function(t) {
    var n = t.objectId, r = t.groupId, i = t.instanceId;
    return this.renderObject && n === this.renderObject.id ? function(a, o, s) {
      return n8("handle", a, [{ groupId: o, instanceId: s }], function(u) {
        return a.getBoundingSphere(u, s);
      }, function() {
        return "Handle Helper | Group Id ".concat(o, " | Instance Id ").concat(s);
      });
    }(this, r, i) : cr;
  }, e.prototype.mark = function(t, n) {
    return !En.is(En.Highlighting, n) || !Ya(t) && (!nw(t) || t.data !== this) ? !1 : Qt.mark(this.renderObject, t, n, this.eachGroup);
  }, e;
}(), Ed = { None: 0, TranslateScreenXY: 1, TranslateObjectX: 3, TranslateObjectY: 4, TranslateObjectZ: 5 };
function nw(e) {
  return e.kind === "data-loci" && e.tag === "handle";
}
var i_, hX = { debug: N.Group(i8), camera: N.Group({ helper: N.Group(x3) }), handle: N.Group(oO) }, gX = N.getDefaultValues(hX), vX = function(e, t, n) {
  n === void 0 && (n = {});
  var r = O(O({}, gX), n);
  this.debug = new _W(e, t, r.debug), this.camera = new aO(e, r.camera.helper), this.handle = new pX(e, r.handle);
}, yX = function() {
  function e(t, n) {
    n === void 0 && (n = {}), this.webgl = t;
    var r = t.gl;
    this.draw = new tO(t, r.drawingBufferWidth, r.drawingBufferHeight, n.enableWboit || !1), this.pick = new jW(t, this.draw, n.pickScale || 0.25), this.multiSample = new gv(t, this.draw);
  }
  return e.prototype.updateSize = function() {
    var t = this.webgl.gl;
    this.draw.setSize(t.drawingBufferWidth, t.drawingBufferHeight), this.pick.syncSize(), this.multiSample.syncSize();
  }, e;
}(), _v = { camera: N.Group({ mode: N.Select("orthographic", N.arrayToOptions(["perspective", "orthographic"]), { label: "Camera" }), helper: N.Group(x3, { isFlat: !0 }), stereo: N.MappedStatic("off", { on: N.Group($D), off: N.Group({}) }, { cycle: !0, hideIf: function(e) {
  return (e == null ? void 0 : e.mode) !== "perspective";
} }), manualReset: N.Boolean(!1, { isHidden: !0 }) }, { pivot: "mode" }), cameraFog: N.MappedStatic("on", { on: N.Group({ intensity: N.Numeric(50, { min: 1, max: 100, step: 1 }) }), off: N.Group({}) }, { cycle: !0, description: "Show fog in the distance" }), cameraClipping: N.Group({ radius: N.Numeric(100, { min: 0, max: 99, step: 1 }, { label: "Clipping", description: "How much of the scene to show." }), far: N.Boolean(!0, { description: "Hide scene in the distance" }) }, { pivot: "radius" }), viewport: N.MappedStatic("canvas", { canvas: N.Group({}), "static-frame": N.Group({ x: N.Numeric(0), y: N.Numeric(0), width: N.Numeric(128), height: N.Numeric(128) }), "relative-frame": N.Group({ x: N.Numeric(0.33, { min: 0, max: 1, step: 0.01 }), y: N.Numeric(0.33, { min: 0, max: 1, step: 0.01 }), width: N.Numeric(0.5, { min: 0.01, max: 1, step: 0.01 }), height: N.Numeric(0.5, { min: 0.01, max: 1, step: 0.01 }) }) }), cameraResetDurationMs: N.Numeric(250, { min: 0, max: 1e3, step: 1 }, { description: "The time it takes to reset the camera." }), transparentBackground: N.Boolean(!1), multiSample: N.Group(QD), postprocessing: N.Group(ZD), marking: N.Group(eO), renderer: N.Group(f5), trackball: N.Group(JT), interaction: N.Group(XD), debug: N.Group(i8), handle: N.Group(oO) }, bX = N.getDefaultValues(_v);
(function(e) {
  e.DefaultAttribs = { antialias: !0, preserveDrawingBuffer: !0, pixelScale: 1, pickScale: 0.25, pickPadding: 1, enableWboit: !0, preferWebGl1: !1 }, e.fromCanvas = function(t, n) {
    n === void 0 && (n = {});
    var r = O(O({}, e.DefaultAttribs), n), i = r.antialias, a = r.preserveDrawingBuffer, o = r.pixelScale, s = r.preferWebGl1, u = function(v, h) {
      function y(S) {
        try {
          return v.getContext(S, h);
        } catch {
          return null;
        }
      }
      var x = (h != null && h.preferWebGl1 ? null : y("webgl2")) || y("webgl") || y("experimental-webgl");
      return In && console.log("isWebgl2: ".concat(Jt(x))), x;
    }(t, { antialias: i, preserveDrawingBuffer: a, alpha: !0, depth: !0, premultipliedAlpha: !0, preferWebGl1: s });
    if (u === null) throw new Error("Could not create a WebGL rendering context");
    var l = u5.fromElement(t, { pixelScale: o, preventGestures: !0 }), c = OU(u, { pixelScale: o }), d = new yX(c, n);
    if (In) {
      var f = u.getExtension("WEBGL_lose_context");
      f && t.addEventListener("mousedown", function(v) {
        c.isContextLost || v.shiftKey && v.ctrlKey && v.altKey && (In && console.log("lose context"), f.loseContext(), setTimeout(function() {
          c.isContextLost && (In && console.log("restore context"), f.restoreContext());
        }, 1e3));
      }, !1);
    }
    var p = new Fc(0), g = function(v) {
      c.setContextLost(), v && v.preventDefault(), In && console.log("context lost"), p.next(Wr());
    }, m = function() {
      c.isContextLost && (c.handleContextRestored(function() {
        d.draw.reset();
      }), In && console.log("context restored"));
    };
    return t.addEventListener("webglcontextlost", g, !1), t.addEventListener("webglcontextrestored", m, !1), { canvas: t, webgl: c, input: l, passes: d, attribs: r, contextLost: p, contextRestored: c.contextRestored, dispose: function(v) {
      l.dispose(), t.removeEventListener("webglcontextlost", g, !1), t.removeEventListener("webglcontextrestored", m, !1), c.destroy(v);
    }, handleWebglContextLost: g, handlewWebglContextRestored: m };
  };
})(i_ || (i_ = {}));
var a_, _X = typeof window < "u" ? window.requestAnimationFrame : function(e) {
  return setImmediate(function() {
    return e(Date.now());
  });
}, xX = typeof window < "u" ? window.cancelAnimationFrame : function(e) {
  return clearImmediate(e);
};
function rw(e, t, n) {
  n === void 0 && (n = 1);
  var r = window.innerWidth, i = window.innerHeight;
  t !== document.body && (r = t.offsetWidth, i = t.offsetHeight), function(a, o, s, u) {
    u === void 0 && (u = 1), a.width = Math.round(window.devicePixelRatio * u * o), a.height = Math.round(window.devicePixelRatio * u * s), Object.assign(a.style, { width: "".concat(o, "px"), height: "".concat(s, "px") });
  }(e, r, i, n);
}
function iw(e, t, n) {
  return se(this, 0, void 0, function() {
    return ie(this, function(r) {
      return [2, new Promise(function(i, a) {
        var o = function(s) {
          s ? i(s) : a("no blob returned");
        };
        HTMLCanvasElement.prototype.toBlob ? e.toBlob(o, t, n) : function(s, u, l, c) {
          for (var d = atob(s.toDataURL(l, c).split(",")[1]), f = d.length, p = f >> 2, g = new Uint8Array(f), m = new Uint32Array(g.buffer, 0, p), v = 0, h = 0; h < p; ++h) m[h] = d.charCodeAt(v++) | d.charCodeAt(v++) << 8 | d.charCodeAt(v++) << 16 | d.charCodeAt(v++) << 24;
          for (var y = 3 & f; y--; ) g[v] = d.charCodeAt(v++);
          u(new Blob([g], { type: l }));
        }(e, o, t, n);
      })];
    });
  });
}
function Tn(e, t) {
  return e.model.atomicHierarchy.atoms.type_symbol.value(e.elements[t]);
}
function m8(e, t) {
  return e.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.elements[t]);
}
function sO(e, t) {
  return e.model.atomicHierarchy.atoms.label_atom_id.value(e.elements[t]);
}
function xv(e, t) {
  return e.model.atomicHierarchy.atoms.label_alt_id.value(e.elements[t]);
}
function CX(e, t) {
  return e.model.atomicHierarchy.atoms.label_comp_id.value(e.elements[t]);
}
function L0(e, t, n) {
  return function(r, i, a) {
    for (var o = 0, s = r.interUnitBonds.getEdgeIndices(a, i.id), u = 0, l = s.length; u < l; ++u) {
      var c = r.interUnitBonds.edges[s[u]];
      cn.isCovalent(c.props.flag) && (o += 1);
    }
    return o;
  }(e, t, n) + function(r, i) {
    for (var a = 0, o = r.bonds, s = o.offset, u = o.edgeProps.flags, l = s[i], c = s[i + 1]; l < c; ++l) cn.isCovalent(u[l]) && (a += 1);
    return a;
  }(t, n);
}
function aw(e, t, n, r) {
  var i = 0;
  return Ml(e, t, n, function(a, o) {
    Tn(a, o) === r && (i += 1);
  }), i;
}
function SX(e, t, n, r, i) {
  return t === r ? function(a, o, s) {
    var u = a.bonds, l = u.offset, c = u.b, d = u.edgeProps.flags;
    cn.is;
    for (var f = l[o], p = l[o + 1]; f < p; ++f) if (c[f] === s && cn.isCovalent(d[f])) return !0;
    return !1;
  }(t, n, i) : function(a, o, s, u, l) {
    var c = a.interUnitBonds.getEdge(s, o.id, l, u.id);
    return c && cn.isCovalent(c.props.flag);
  }(e, t, n, r, i);
}
function Cu(e, t, n) {
  for (var r = e.bonds, i = r.offset, a = r.b, o = r.edgeProps.flags, s = i[t], u = i[t + 1]; s < u; ++s) cn.isCovalent(o[s]) && n(e, a[s]);
}
function Ml(e, t, n, r) {
  (function(i, a, o, s) {
    for (var u = i.interUnitBonds.getEdgeIndices(o, a.id), l = 0, c = u.length; l < c; ++l) {
      var d = i.interUnitBonds.edges[u[l]], f = i.unitMap.get(d.unitB);
      cn.isCovalent(d.props.flag) && s(f, d.indexB);
    }
  })(e, t, n, r), Cu(t, n, r);
}
function b2(e) {
  switch (e) {
    case 0:
      return 0;
    case 1:
      return 1;
    case 2:
      return 2;
    case 3:
      return 3;
    case 4:
      return 4;
    default:
      return 8;
  }
}
(function(e) {
  e.create = function(t, n) {
    var r = t.webgl, i = t.input, a = t.passes, o = t.attribs;
    n === void 0 && (n = {});
    var s = O(O({}, bX), n), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), c = new Fc(0), d = Wr(), f = new Fc(0), p = new Fc(0), g = r.gl, m = r.contextRestored, v = 0, h = 0, y = 128, x = 128;
    Xe();
    var S = lm.create(r, a.draw.wboitEnabled ? PK : v3), b = new Nr({ position: A.create(0, 0, 100), mode: s.camera.mode, fog: s.cameraFog.name === "on" ? s.cameraFog.params.intensity : 0, clipFar: s.cameraClipping.far }, { x: v, y: h, width: y, height: x }, { pixelScale: o.pixelScale }), _ = new cm(b, s.camera.stereo.params), C = m5.create(i, b, s.trackball), w = d5.create(r, s.renderer), I = new vX(r, S, s), M = new KW(r, w, S, I, a.pick, { x: v, y: h, width: y, height: x }, o.pickPadding), E = new wW(ee, F, i, b, s.interaction), T = new JD(a.multiSample), P = !1, k = void 0, D = void 0, B = !1, L = !0;
    function F(de) {
      var we = cr, Ie = en.Empty;
      if (de) {
        var Ee = I.camera.getLoci(de);
        if (Ee !== cr) return { loci: Ee, repr: Ie };
        we = I.handle.getLoci(de), u.forEach(function(Le, De) {
          var rt = De.getLoci(de);
          td(rt) || (td(we) || console.warn("found another loci, this should not happen"), we = rt, Ie = De);
        });
      }
      return { loci: we, repr: Ie };
    }
    var V = [];
    function G(de, we) {
      var Ie = de.repr, Ee = de.loci, Le = !1;
      return Ie ? Le = Ie.mark(Ee, we) : (Le = I.handle.mark(Ee, we), Le = I.camera.mark(Ee, we) || Le, u.forEach(function(De, rt) {
        Le = rt.mark(Ee, we) || Le;
      })), Le;
    }
    function H(de) {
      if (r.isContextLost) return !1;
      var we = !1;
      if (B && (Pe(!1), B = !1, we = !0), v > g.drawingBufferWidth || v + y < 0 || h > g.drawingBufferHeight || h + x < 0) return !1;
      var Ie = function() {
        for (var yt = !1, It = 0, ge = V; It < ge.length; It++) {
          var Je = ge[It];
          yt = G(Je[0], Je[1]) || yt;
        }
        return V = [], yt && (S.update(void 0, !0), I.handle.scene.update(void 0, !0), I.camera.scene.update(void 0, !0)), yt;
      }(), Ee = !1;
      C.update(K);
      var Le = b.update(), De = de || Le || we || q;
      q = !1;
      var rt = T.update(Ie || De, s.multiSample);
      if (De || rt || Ie) {
        var st = b;
        s.camera.stereo.name === "on" && (_.update(), st = _);
        var gt = { renderer: w, camera: st, scene: S, helper: I };
        if (gv.isEnabled(s.multiSample)) {
          var ft = !Le && Ie && !C.isAnimating;
          T.render(gt, s, !0, ft);
        } else a.draw.render(gt, s, !0);
        M.dirty = M.dirty || De, Ee = !0;
      }
      return Ee;
    }
    var q = !1, z = !1, K = 0, Y = !1;
    function Z(de) {
      Y || H(!!(de != null && de.force)) && L && f.next(Wr() - d);
    }
    function X() {
      q = !0;
    }
    var W = 0;
    function J(de, we) {
      K = de, ce(we == null ? void 0 : we.isSynchronous), b.transition.tick(K), we != null && we.manualDraw || (Z(), b.transition.inTransition || r.isContextLost || E.tick(K));
    }
    function $() {
      J(Wr()), W = _X($);
    }
    function ee(de, we) {
      var Ie = s.camera.stereo.name === "on" ? _ : b;
      return r.isContextLost ? void 0 : M.identify(de, we, Ie);
    }
    function ce(de) {
      de === void 0 && (de = !1);
      var we = function(Ie) {
        if (!S.needsCommit) return !0;
        if (pe.copy(ae, S.boundingSphereVisible), !S.commit(Ie ? void 0 : Oe)) return !1;
        I.debug.isEnabled && I.debug.update();
        var Ee = function() {
          if (b.state.radiusMax === 0) return !0;
          if (b.transition.inTransition || D) return !1;
          var Le = !0, De = !0;
          pe.set(he, b.state.target, b.state.radius);
          for (var rt = 0, st = S.renderables; rt < st.length; rt++) {
            var gt = st[rt];
            if (gt.state.visible) {
              var ft = gt.values.boundingSphere.ref.value;
              if (ft.radius) {
                De = !1;
                var yt = A.distance(he.center, ft.center);
                if ((yt > he.radius || yt > ft.radius || ft.radius > b.state.radiusMax) && !pe.includes(ae, ft)) return !0;
                pe.overlaps(he, ft) && (Le = !1);
              }
            }
          }
          return Le || !De && he.radius <= 0.1;
        }();
        return s.camera.manualReset || c.value !== 0 && !Ee || (P = !0), ae.radius === 0 && (k = 0), Ee && b.setState({ radiusMax: S.boundingSphere.radius }, 0), c.next(u.size), In && Ne(), !0;
      }(de);
      we && (C.isLockCamera ? (k = void 0, D = void 0, P = !1) : function() {
        if (!(!P || C.isLockCamera)) {
          var Ie = S.boundingSphereVisible, Ee = Ie.center, Le = Ie.radius, De = C.props.autoAdjustMinMaxDistance;
          if (De.name === "on") {
            var rt = De.params.minDistanceFactor * Le + De.params.minDistancePadding, st = Math.max(De.params.maxDistanceFactor * Le, De.params.maxDistanceMin);
            C.setProps({ minDistance: rt, maxDistance: st });
          }
          if (Le > 0) {
            var gt = k === void 0 ? s.cameraResetDurationMs : k, ft = b.getFocus(Ee, Le), yt = typeof D == "function" ? D(S, b) : D, It = yt ? O(O({}, ft), yt) : ft;
            b.setState(O(O({}, It), { radiusMax: S.boundingSphere.radius }), gt);
          }
          k = void 0, D = void 0, P = !1;
        }
      }(), z && (I.debug.isEnabled && I.debug.update(), Z({ force: !0 }), z = !1), p.next(Wr()));
    }
    var ae = pe(), he = pe(), Oe = 250;
    function Ne() {
      console.table(S.renderables.map(function(Le) {
        return { drawCount: Le.values.drawCount.ref.value, instanceCount: Le.values.instanceCount.ref.value, materialId: Le.materialId, renderItemId: Le.id };
      })), console.log(r.stats);
      var de = r.resources.getByteCounts(), we = de.texture, Ie = de.attribute, Ee = de.elements;
      console.log({ texture: "".concat((we / 1024 / 1024).toFixed(3), " MiB"), attribute: "".concat((Ie / 1024 / 1024).toFixed(3), " MiB"), elements: "".concat((Ee / 1024 / 1024).toFixed(3), " MiB") });
    }
    function Ue(de) {
      (function(Ee) {
        l.has(Ee) || l.set(Ee, Ee.updated.subscribe(function(Le) {
          Ee.state.syncManually || Ue(Ee);
        }));
      })(de);
      var we = u.get(de), Ie = /* @__PURE__ */ new Set();
      de.renderObjects.forEach(function(Ee) {
        return Ie.add(Ee);
      }), we ? ka.areEqual(Ie, we) || (Ie.forEach(function(Ee) {
        we.has(Ee) || S.add(Ee);
      }), we.forEach(function(Ee) {
        Ie.has(Ee) || S.remove(Ee);
      })) : de.renderObjects.forEach(function(Ee) {
        return S.add(Ee);
      }), u.set(de, Ie), S.update(de.renderObjects, !1), z = !0, In && Ne();
    }
    function Ze() {
      var de = S.boundingSphere.radius > 0 ? 100 - Math.round(b.transition.target.radius / S.boundingSphere.radius * 100) : 0;
      return { camera: { mode: b.state.mode, helper: O({}, I.camera.props), stereo: O({}, s.camera.stereo), manualReset: !!s.camera.manualReset }, cameraFog: b.state.fog > 0 ? { name: "on", params: { intensity: b.state.fog } } : { name: "off", params: {} }, cameraClipping: { far: b.state.clipFar, radius: de }, cameraResetDurationMs: s.cameraResetDurationMs, transparentBackground: s.transparentBackground, viewport: s.viewport, postprocessing: O({}, s.postprocessing), marking: O({}, s.marking), multiSample: O({}, s.multiSample), renderer: O({}, w.props), trackball: O({}, C.props), interaction: O({}, E.props), debug: O({}, I.debug.props), handle: O({}, I.handle.props) };
    }
    var Se = m.subscribe(function() {
      M.dirty = !0, Z({ force: !0 }), Z({ force: !0 });
    }), qe = new Fc(0);
    function Pe(de) {
      de === void 0 && (de = !0), a.updateSize(), Xe(), Ke(), de && X(), qe.next(+/* @__PURE__ */ new Date());
    }
    return { webgl: r, scene: S, helper: I, add: Ue, remove: function(de) {
      (function(Ie) {
        var Ee = l.get(Ie);
        Ee && (Ee.unsubscribe(), l.delete(Ie));
      })(de);
      var we = u.get(de);
      we && (we.forEach(function(Ie) {
        return S.remove(Ie);
      }), u.delete(de), z = !0, In && Ne());
    }, commit: ce, controls: C, update: function(de, we) {
      if (de) {
        if (!u.has(de)) return;
        S.update(de.renderObjects, !!we);
      } else S.update(void 0, !!we);
      z = !0;
    }, clear: function() {
      l.forEach(function(de) {
        return de.unsubscribe();
      }), l.clear(), u.clear(), S.clear(), I.debug.clear(), X(), c.next(u.size);
    }, syncVisibility: function() {
      b.state.radiusMax === 0 && (P = !0, k = 0), S.syncVisibility() && I.debug.isEnabled && I.debug.update(), X();
    }, requestDraw: X, tick: J, animate: function() {
      Y = !1, C.start(Wr()), W === 0 && $();
    }, resetTime: function(de) {
      d = de, C.start(de);
    }, pause: function(de) {
      de === void 0 && (de = !1), Y = de, xX(W), W = 0;
    }, resume: function() {
      Y = !1;
    }, identify: ee, getPosition: function(de, we) {
      var Ie = b;
      return r.isContextLost ? void 0 : M.getPosition(de, we, Ie);
    }, mark: function(de, we) {
      V.push([de, we]);
    }, getLoci: F, handleResize: Pe, requestResize: function() {
      B = !0;
    }, requestCameraReset: function(de) {
      k = de == null ? void 0 : de.durationMs, D = de == null ? void 0 : de.snapshot, P = !0;
    }, camera: b, boundingSphere: S.boundingSphere, boundingSphereVisible: S.boundingSphereVisible, get notifyDidDraw() {
      return L;
    }, set notifyDidDraw(de) {
      L = de;
    }, didDraw: f, commited: p, reprCount: c, resized: qe, setProps: function(de, we) {
      var Ie, Ee, Le;
      we === void 0 && (we = !1);
      var De = typeof de == "function" ? f8(Ze(), de) : de, rt = /* @__PURE__ */ Object.create(null);
      if (De.camera && De.camera.mode !== void 0 && De.camera.mode !== b.state.mode && (rt.mode = De.camera.mode), De.cameraFog !== void 0 && De.cameraFog.params) {
        var st = De.cameraFog.name === "on" ? De.cameraFog.params.intensity : 0;
        st !== b.state.fog && (rt.fog = st);
      }
      if (De.cameraClipping !== void 0 && (De.cameraClipping.far !== void 0 && De.cameraClipping.far !== b.state.clipFar && (rt.clipFar = De.cameraClipping.far), De.cameraClipping.radius !== void 0)) {
        var gt = S.boundingSphere.radius / 100 * (100 - De.cameraClipping.radius);
        gt > 0 && gt !== rt.radius && (rt.radius = Math.max(gt, 0.01));
      }
      Object.keys(rt).length > 0 && b.setState(rt), !((Ie = De.camera) === null || Ie === void 0) && Ie.helper && I.camera.setProps(De.camera.helper), ((Ee = De.camera) === null || Ee === void 0 ? void 0 : Ee.manualReset) !== void 0 && (s.camera.manualReset = De.camera.manualReset), ((Le = De.camera) === null || Le === void 0 ? void 0 : Le.stereo) !== void 0 && Object.assign(s.camera.stereo, De.camera.stereo), De.cameraResetDurationMs !== void 0 && (s.cameraResetDurationMs = De.cameraResetDurationMs), De.transparentBackground !== void 0 && (s.transparentBackground = De.transparentBackground), De.viewport !== void 0 && (s.viewport === De.viewport || s.viewport.name === De.viewport.name && s5(s.viewport.params, De.viewport.params) || (s.viewport = De.viewport, Xe(), Ke())), De.postprocessing && Object.assign(s.postprocessing, De.postprocessing), De.marking && Object.assign(s.marking, De.marking), De.multiSample && Object.assign(s.multiSample, De.multiSample), De.renderer && w.setProps(De.renderer), De.trackball && C.setProps(De.trackball), De.interaction && E.setProps(De.interaction), De.debug && I.debug.setProps(De.debug), De.handle && I.handle.setProps(De.handle), rt.mode === "orthographic" && (s.camera.stereo.name = "off"), we || X();
    }, getImagePass: function(de) {
      return de === void 0 && (de = {}), new fX(r, w, S, b, I, a.draw.wboitEnabled, de);
    }, getRenderObjects: function() {
      var de = [];
      return S.forEach(function(we, Ie) {
        return de.push(Ie);
      }), de;
    }, get props() {
      return Ze();
    }, get input() {
      return i;
    }, get stats() {
      return w.stats;
    }, get interaction() {
      return E.events;
    }, dispose: function() {
      Se.unsubscribe(), V = [], S.clear(), I.debug.clear(), C.dispose(), w.dispose(), E.dispose();
    } };
    function Xe() {
      var de = v, we = h, Ie = y, Ee = x;
      s.viewport.name === "canvas" ? (v = 0, h = 0, y = g.drawingBufferWidth, x = g.drawingBufferHeight) : s.viewport.name === "static-frame" ? (v = s.viewport.params.x * r.pixelRatio, x = s.viewport.params.height * r.pixelRatio, h = g.drawingBufferHeight - x - s.viewport.params.y * r.pixelRatio, y = s.viewport.params.width * r.pixelRatio) : s.viewport.name === "relative-frame" && (v = Math.round(s.viewport.params.x * g.drawingBufferWidth), x = Math.round(s.viewport.params.height * g.drawingBufferHeight), h = Math.round(g.drawingBufferHeight - x - s.viewport.params.y * g.drawingBufferHeight), y = Math.round(s.viewport.params.width * g.drawingBufferWidth)), de === v && we === h && Ie === y && Ee === x || (q = !0);
    }
    function Ke() {
      M.setViewport(v, h, y, x), w.setViewport(v, h, y, x), Ii.set(b.viewport, v, h, y, x), Ii.set(C.viewport, v, h, y, x);
    }
  };
})(a_ || (a_ = {}));
var ow = A(), sw = A(), w4 = A(), uw = A(), lw = A();
function o_(e, t, n, r, i) {
  var a = [];
  return t.conformation.position(t.elements[n], w4), r.conformation.position(r.elements[i], uw), A.sub(ow, uw, w4), Ml(e, t, n, function(o, s) {
    Tn(o, s) !== "H" && (o.conformation.position(o.elements[s], lw), A.sub(sw, lw, w4), a.push(A.angle(ow, sw)));
  }), a;
}
var AX = /* @__PURE__ */ new Set(["LI", "NA", "K", "RB", "CS", "FR"]), wX = /* @__PURE__ */ new Set(["BE", "MG", "CA", "SR", "BA", "RA"]), IX = /* @__PURE__ */ new Set(["ZN", "GA", "CD", "IN", "SN", "HG", "TI", "PB", "BI", "PO", "CN"]), PX = /* @__PURE__ */ new Set(["F", "CL", "BR", "I", "AT"]);
function MX(e) {
  return PX.has(e);
}
function uO(e) {
  var t = P0(e);
  return t >= 21 && t <= 29 || t >= 39 && t <= 47 || t >= 72 && t <= 79 || t >= 104 && t <= 108;
}
function EX(e) {
  return function(t) {
    return AX.has(t);
  }(e) || function(t) {
    return wX.has(t);
  }(e) || function(t) {
    var n = P0(t);
    return n >= 57 && n <= 71;
  }(e) || function(t) {
    var n = P0(t);
    return n >= 89 && n <= 103;
  }(e) || uO(e) || function(t) {
    return IX.has(t);
  }(e);
}
var I4 = new pt.ElementBondIterator(), P4 = new pt.ElementBondIterator(), o1 = new pt.ElementBondIterator(), M4 = new pt.ElementBondIterator();
function TX(e, t, n, r) {
  var i = aw(e, t, n, "H"), a = Tn(t, n), o = m8(t, n), s = r.assignCharge === "always" || r.assignCharge === "auto" && o === 0, u = !["sdf", "mol"].includes(t.model.sourceData.kind) && (r.assignH === "always" || r.assignH === "auto" && i === 0), l = L0(e, t, n), c = function(x, S, b) {
    for (var _ = 0, C = S.bonds, w = C.offset, I = C.edgeProps, M = I.flags, E = I.order, T = w[b], P = w[b + 1]; T < P; ++T) cn.isCovalent(M[T]) && (_ += E[T]);
    return x.interUnitBonds.getEdgeIndices(b, S.id).forEach(function(k) {
      var D = x.interUnitBonds.edges[k];
      cn.isCovalent(D.props.flag) && (_ += D.props.order);
    }), _;
  }(e, t, n), d = function(x, S, b) {
    var _ = Tn(S, b), C = _ === "O" || _ === "N";
    if (C && L0(x, S, b) === 4) return !1;
    for (I4.setElement(x, S, b); I4.hasNext; ) {
      var w = I4.move();
      if (w.order > 1) return !0;
      if (C) {
        var I = Tn(w.otherUnit, w.otherIndex);
        for (P4.setElement(x, w.otherUnit, w.otherIndex); P4.hasNext; ) {
          var M = P4.move();
          if (M.order > 1) {
            if ((I === "P" || I === "S") && Tn(M.otherUnit, M.otherIndex) === "O") continue;
            return !0;
          }
        }
      }
    }
    return !1;
  }(e, t, n), f = c - l > 0, p = 0, g = 8;
  switch (a) {
    case "H":
      s && (l === 0 ? (o = 1, g = 0) : l === 1 && (o = 0, g = 1));
      break;
    case "C":
      s && (o = 0), u && (p = Math.max(0, 4 - c - Math.abs(o))), g = b2(l + p + Math.max(0, -o));
      break;
    case "N":
      if (s) if (u) if (d && c < 4) o = l - i == 1 && c - i == 2 ? 1 : 0;
      else for (o1.setElement(e, t, n); o1.hasNext; ) {
        var m = o1.move(), v = Tn(m.otherUnit, m.otherIndex);
        if (v === "S" || EX(v) || cn.is(m.type, 32)) {
          o = 0;
          break;
        }
        o = 1;
      }
      else o = c - 3;
      u && (p = Math.max(0, 3 - c + o)), g = b2(d && !f ? l + p - o : l + p + 1 - o);
      break;
    case "O":
      if (s && (u || (o = c - 2), c === 1)) {
        o1.setElement(e, t, n);
        e: for (; o1.hasNext; ) {
          var h = o1.move();
          for (M4.setElement(e, h.otherUnit, h.otherIndex); M4.hasNext; ) {
            var y = M4.move();
            if ((y.otherUnit !== t || y.otherIndex !== n) && Tn(y.otherUnit, y.otherIndex) === "O" && y.order === 2) {
              o = -1;
              break e;
            }
          }
        }
      }
      u && (p = Math.max(0, 2 - c + o)), g = b2(d && !f ? l + p - o + 1 : l + p - o + 2);
      break;
    case "S":
      s && (u || (o = c <= 3 && aw(e, t, n, "O") === 0 ? c - 2 : 0)), u && c < 2 && (p = Math.max(0, 2 - c + o)), c <= 3 && (g = b2(l + p - o + 2));
      break;
    case "F":
    case "CL":
    case "BR":
    case "I":
    case "AT":
      s && (o = c - 1);
      break;
    case "LI":
    case "NA":
    case "K":
    case "RB":
    case "CS":
    case "FR":
      s && (o = 1 - c);
      break;
    case "BE":
    case "MG":
    case "CA":
    case "SR":
    case "BA":
    case "RA":
      s && (o = 2 - c);
      break;
    default:
      In && console.warn("Requested charge, protonation for an unhandled element", a);
  }
  return [o, p, p + i, g];
}
function kX(e, t, n) {
  for (var r = t.elements.length, i = new Int8Array(r), a = new Int8Array(r), o = new Int8Array(r), s = new Int8Array(r), u = 0; u < r; ++u) {
    var l = TX(e, t, u, n), c = l[0], d = l[1], f = l[2], p = l[3];
    i[u] = c, a[u] = d, o[u] = f, s[u] = p;
  }
  return { charge: i, implicitH: a, totalH: o, idealGeometry: s };
}
var lO = { assignCharge: N.Select("auto", [["always", "always"], ["auto", "auto"], ["never", "never"]]), assignH: N.Select("auto", [["always", "always"], ["auto", "auto"], ["never", "never"]]) };
function DX(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u;
    return ie(this, function(l) {
      for (r = O(O({}, N.getDefaultValues(lO)), n), i = /* @__PURE__ */ new Map(), a = 0, o = t.units.length; a < o; ++a) s = t.units[a], ve.isAtomic(s) && (u = kX(t, s, r), i.set(s.id, u));
      return [2, i];
    });
  });
}
var Gn, s_, u_, E4 = O({}, lO), ch = tm.createProvider({ label: "Valence Model", descriptor: Us({ name: "molstar_computed_valence_model" }), type: "local", defaultParams: E4, getParams: function(e) {
  return E4;
}, isApplicable: function(e) {
  return !0;
}, obtain: function(e, t, n) {
  return se(void 0, 0, void 0, function() {
    var r, i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return r = O(O({}, N.getDefaultValues(E4)), n), i = {}, [4, DX(e.runtime, t, r)];
        case 1:
          return [2, (i.value = a.sent(), i)];
      }
    });
  });
} });
(function(e) {
  function t(a, o) {
    for (var s = new Int32Array(o + 1), u = new Int32Array(o), l = new Int32Array(o), c = a.members, d = a.count, f = a.offsets, p = 0, g = f[d]; p < g; ++p) ++l[c[p]];
    var m = 0;
    for (p = 0; p < o; p++) s[p] = m, m += l[p];
    s[o] = m;
    var v = new Int32Array(m);
    for (p = 0; p < d; ++p) for (var h = f[p], y = f[p + 1]; h < y; ++h) {
      var x = c[h];
      v[s[x] + u[x]] = p, ++u[x];
    }
    return { indices: v, offsets: s };
  }
  function n(a, o) {
    for (var s, u = a.count, l = a.types, c = [], d = 0; d < u; ++d) o.has(l[d]) && c.push(d);
    var f = Me.ofSortedArray(c);
    return { indices: f, get lookup3d() {
      if (!s) {
        var p = { x: a.x, y: a.y, z: a.z, indices: f };
        s = bf(p, $1(p));
      }
      return s;
    } };
  }
  e.setPosition = function(a, o, s, u) {
    return A.set(a, u.x[s], u.y[s], u.z[s]), A.transformMat4(a, a, o.conformation.operator.matrix), a;
  }, e.createElementsIndex = t, e.create = function(a, o) {
    var s, u;
    return O(O({}, o), { get lookup3d() {
      if (!s) {
        var l = { x: o.x, y: o.y, z: o.z, indices: _e.ofBounds(0, o.count) };
        s = bf(l, $1(l));
      }
      return s;
    }, get elementsIndex() {
      return u || (u = t(o, a));
    }, subset: function(l) {
      return n(o, l);
    } });
  }, e.createSubset = n, e.Info = function(a, o, s) {
    var u = ch.get(a).value;
    if (!u || !u.has(o.id)) throw new Error("valence model required");
    return { unit: o, types: s.types, feature: -1, x: s.x, y: s.y, z: s.z, members: s.members, offsets: s.offsets, idealGeometry: u.get(o.id).idealGeometry };
  }, e.position = function(a, o) {
    return A.set(a, o.x[o.feature], o.y[o.feature], o.z[o.feature]), A.transformMat4(a, a, o.unit.conformation.operator.matrix), a;
  };
  var r = A(), i = A();
  e.distance = function(a, o) {
    var s = a.members[a.offsets[a.feature]], u = o.members[o.offsets[o.feature]];
    return a.unit.conformation.position(a.unit.elements[s], r), o.unit.conformation.position(o.unit.elements[u], i), A.distance(r, i);
  }, e.Provider = function(a, o) {
    return { types: new Set(a), add: o };
  };
})(Gn || (Gn = {})), function(e) {
  e.create = function(t, n, r) {
    t === void 0 && (t = 2048), n === void 0 && (n = 1024);
    var i = be.create(Float32Array, 1, n, r ? r.x : t), a = be.create(Float32Array, 1, n, r ? r.y : t), o = be.create(Float32Array, 1, n, r ? r.z : t), s = be.create(Uint8Array, 1, n, r ? r.types : t), u = be.create(Uint8Array, 1, n, r ? r.groups : t), l = be.create(Uint32Array, 1, n, r ? r.offsets : t), c = be.create(Uint32Array, 1, n, r ? r.members : t), d = { x: 0, y: 0, z: 0, offset: 0, count: 0 };
    return { startState: function() {
      d.x = 0, d.y = 0, d.z = 0, d.offset = c.elementCount, d.count = 0;
    }, pushMember: function(f, p, g, m) {
      be.add(c, m), d.x += f, d.y += p, d.z += g, d.count += 1;
    }, finishState: function(f, p) {
      var g = d.count;
      g !== 0 && (be.add(s, f), be.add(u, p), be.add(i, d.x / g), be.add(a, d.y / g), be.add(o, d.z / g), be.add(l, d.offset));
    }, add: function(f, p, g, m, v, h) {
      be.add(s, f), be.add(u, p), be.add(i, g), be.add(a, m), be.add(o, v), be.add(l, c.elementCount), be.add(c, h);
    }, getFeatures: function(f) {
      be.add(l, c.elementCount);
      var p = be.compact(i, !0), g = be.compact(a, !0), m = be.compact(o, !0), v = i.elementCount;
      return Gn.create(f, { x: p, y: g, z: m, count: v, types: be.compact(s, !0), groups: be.compact(u, !0), offsets: be.compact(l, !0), members: be.compact(c, !0) });
    } };
  };
}(s_ || (s_ = {})), function(e) {
  e.createElementsIndex = function(t, n, r) {
    for (var i = new Int32Array(r + 1), a = new Int32Array(r), o = new Int32Array(r), s = n.members, u = n.offsets, l = 0, c = 2 * t.edgeCount; l < c; ++l)
      if (!((m = t.a[l]) > (v = t.b[l]))) {
        for (var d = u[m], f = u[m + 1]; d < f; ++d) ++o[s[d]];
        for (d = u[v], f = u[v + 1]; d < f; ++d) ++o[s[d]];
      }
    var p = 0;
    for (l = 0; l < r; l++) i[l] = p, p += o[l];
    i[r] = p;
    var g = new Int32Array(p);
    for (l = 0, c = 2 * t.edgeCount; l < c; ++l) {
      var m, v;
      if (!((m = t.a[l]) > (v = t.b[l]))) {
        for (d = u[m], f = u[m + 1]; d < f; ++d)
          g[i[h = s[d]] + a[h]] = l, ++a[h];
        for (d = u[v], f = u[v + 1]; d < f; ++d) {
          var h;
          g[i[h = s[d]] + a[h]] = l, ++a[h];
        }
      }
    }
    return { indices: g, offsets: i };
  };
}(u_ || (u_ = {}));
var Oa, hn, OX = function(e) {
  function t(n, r) {
    var i = e.call(this, n) || this;
    i.elementKeyIndex = /* @__PURE__ */ new Map();
    for (var a = 0, o = i.edges.length; a < o; ++a) for (var s = i.edges[a], u = s.unitA, l = s.indexA, c = r.get(u), d = c.offsets, f = c.members, p = d[l], g = d[l + 1]; p < g; ++p) {
      var m = i.getElementKey(f[p], u), v = i.elementKeyIndex.get(m);
      v === void 0 ? i.elementKeyIndex.set(m, [a]) : v.push(a);
    }
    return i;
  }
  return Zi(t, e), t.prototype.getContactIndicesForElement = function(n, r) {
    return this.elementKeyIndex.get(this.getElementKey(n, r.id)) || [];
  }, t.prototype.getElementKey = function(n, r) {
    return "".concat(n, "|").concat(r);
  }, t;
}(_f);
function l_(e) {
  switch (e) {
    case hn.HydrogenBond:
      return "Hydrogen Bond";
    case hn.Hydrophobic:
      return "Hydrophobic Contact";
    case hn.HalogenBond:
      return "Halogen Bond";
    case hn.Ionic:
      return "Salt Bridge";
    case hn.MetalCoordination:
      return "Metal Bond";
    case hn.CationPi:
      return "Cation-Pi Interaction";
    case hn.PiStacking:
      return "Pi Stacking";
    case hn.WeakHydrogenBond:
      return "Weak Hydrogen Bond";
    case hn.Unknown:
      return "Unknown Interaction";
  }
}
(function(e) {
  e[e.None = 0] = "None", e[e.Filtered = 1] = "Filtered";
})(Oa || (Oa = {})), function(e) {
  e[e.Unknown = 0] = "Unknown", e[e.Ionic = 1] = "Ionic", e[e.CationPi = 2] = "CationPi", e[e.PiStacking = 3] = "PiStacking", e[e.HydrogenBond = 4] = "HydrogenBond", e[e.HalogenBond = 5] = "HalogenBond", e[e.Hydrophobic = 6] = "Hydrophobic", e[e.MetalCoordination = 7] = "MetalCoordination", e[e.WeakHydrogenBond = 8] = "WeakHydrogenBond";
}(hn || (hn = {}));
var cO = { distanceMax: N.Numeric(2.8, { min: 1, max: 5, step: 0.1 }), backbone: N.Boolean(!0, { description: "Include backbone-to-backbone hydrogen bonds" }), accAngleDevMax: N.Numeric(90, { min: 0, max: 180, step: 1 }, { description: "Max deviation from ideal acceptor angle" }), donAngleDevMax: N.Numeric(120, { min: 0, max: 180, step: 1 }, { description: "Max deviation from ideal donor angle" }), accOutOfPlaneAngleMax: N.Numeric(90, { min: 0, max: 180, step: 1 }), donOutOfPlaneAngleMax: N.Numeric(45, { min: 0, max: 180, step: 1 }) }, dO = O(O({}, cO), { water: N.Boolean(!1, { description: "Include water-to-water hydrogen bonds" }), sulfurDistanceMax: N.Numeric(3.4, { min: 1, max: 5, step: 0.1 }) }), BX = N.getDefaultValues(dO), fO = O({}, cO), RX = N.getDefaultValues(fO);
function cw(e, t) {
  return e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[e.elements[t]]] === 2;
}
function dw(e, t) {
  return F6.has(sO(e, t));
}
function mO(e) {
  return { includeBackbone: e.backbone, maxAccAngleDev: xr(e.accAngleDevMax), maxDonAngleDev: xr(e.donAngleDevMax), maxAccOutOfPlaneAngle: xr(e.accOutOfPlaneAngleMax), maxDonOutOfPlaneAngle: xr(e.donOutOfPlaneAngleMax) };
}
function pO(e, t, n, r) {
  var i = t.members[t.offsets[t.feature]], a = n.members[n.offsets[n.feature]];
  if (r.includeBackbone || (o = t.unit, s = i, u = n.unit, l = a, !dw(o, s) || !dw(u, l))) {
    var o, s, u, l, c = o_(e, t.unit, i, n.unit, a);
    if (ta(c[0]) >= 120 && ta(c[0]) <= 180) return !0;
  }
}
function LX(e, t, n, r, i) {
  var a = t.types[t.feature], o = n.types[n.feature];
  if (u = o, (s = a) === 5 && u === 4 || s === 4 && u === 5) {
    var s, u, l, c, d, f, p = o === 5 ? [t, n] : [n, t], g = p[0], m = p[1], v = g.members[g.offsets[g.feature]], h = m.members[m.offsets[m.feature]];
    if (!(r > (Tn(g.unit, v) === "S" || Tn(m.unit, h) === "S" ? i.maxSulfurDistSq : i.maxDistSq)) && (i.includeWater || (l = g.unit, c = v, d = m.unit, f = h, !cw(l, c) || !cw(d, f))) && pO(e, g, m, i)) return hn.HydrogenBond;
  }
}
var NX = Gn.Provider([4], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = function(d, f) {
    var p = Tn(t, d), g = !1;
    p === "H" && (Cu(t, d, function(m, v) {
      var h = Tn(m, v);
      h !== "N" && h !== "O" && h !== "S" || (g = !0);
    }), g && n.add(4, 0, a[r[d]], o[r[d]], s[r[d]], d));
  }, l = 0, c = r.length; l < c; ++l) u(l);
}), FX = Gn.Provider([9], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = function(d, f) {
    var p = Tn(t, d), g = !1;
    if (p === "H") {
      var m = [];
      if (Cu(t, d, function(h, y) {
        Tn(h, y) === "C" && (function(x, S) {
          var b = x.rings.elementAromaticRingIndices, _ = b.get(S);
          return _ !== void 0;
        }(h, y) ? g = !0 : m.push(y));
      }), !g && m.length === 1) {
        var v = 0;
        Cu(t, m[0], function(h, y) {
          Tn(h, y) === "F" && v++;
        }), v === 2 && (g = !0);
      }
      g && n.add(9, 0, a[r[d]], o[r[d]], s[r[d]], d);
    }
  }, l = 0, c = r.length; l < c; ++l) u(l);
}), VX = Gn.Provider([5], function(e, t, n) {
  for (var r = function(y, x) {
    var S = ch.get(y).value;
    if (!S) throw Error("expected valence model to be available");
    var b = S.get(x.id);
    if (!b) throw Error("expected valence model for unit to be available");
    return b;
  }(e, t), i = r.charge, a = r.implicitH, o = r.idealGeometry, s = t.elements, u = t.model.atomicConformation, l = u.x, c = u.y, d = u.z, f = function(y) {
    n.add(5, 0, l[s[y]], c[s[y]], d[s[y]], y);
  }, p = 0, g = s.length; p < g; ++p) {
    var m = Tn(t, p);
    if (m === "O") f(p);
    else if (m === "N") {
      if (i[p] < 1) {
        var v = L0(e, t, p) + a[p], h = o[p];
        (h === 4 && v < 4 || h === 3 && v < 3 || h === 2 && v < 2) && f(p);
      }
    } else m === "S" ? m8(t, p) === -1 && f(p) : m === "F" && f(p);
  }
}), GX = { name: "hydrogen-bonds", params: dO, createTester: function(e) {
  var t = Math.max(e.distanceMax, e.sulfurDistanceMax), n = function(r) {
    return O(O({}, mO(r)), { includeWater: r.water, maxSulfurDistSq: r.sulfurDistanceMax * r.sulfurDistanceMax, maxDistSq: r.distanceMax * r.distanceMax });
  }(e);
  return { maxDistance: t, requiredFeatures: /* @__PURE__ */ new Set([4, 5]), getType: function(r, i, a, o) {
    return LX(r, i, a, o, n);
  } };
} }, zX = { name: "weak-hydrogen-bonds", params: fO, createTester: function(e) {
  var t = mO(e);
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([9, 5]), getType: function(n, r, i, a) {
    return function(o, s, u, l, c) {
      var d = s.types[s.feature], f = u.types[u.feature];
      if (g = f, (p = d) === 9 && g === 5 || p === 5 && g === 9) {
        var p, g, m = f === 5 ? [s, u] : [u, s];
        if (pO(o, m[0], m[1], c)) return hn.WeakHydrogenBond;
      }
    }(n, r, i, 0, t);
  } };
} }, hO = { distanceMax: N.Numeric(3.5, { min: 1, max: 5, step: 0.1 }), angleMax: N.Numeric(60, { min: 0, max: 60, step: 1 }) }, UX = N.getDefaultValues(hO), HX = ["CL", "BR", "I", "AT"], qX = xr(180), jX = xr(120), KX = Gn.Provider([6], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = 0, l = r.length; u < l; ++u) {
    var c = Tn(t, u);
    HX.includes(c) && n.add(6, 0, a[r[u]], o[r[u]], s[r[u]], u);
  }
}), YX = Gn.Provider([7], function(e, t, n) {
  for (var r = function(C, w) {
    var I = ch.get(C).value;
    if (!I) throw Error("expected valence model to be available");
    var M = I.get(w.id);
    if (!M) throw Error("expected valence model for unit to be available");
    return M;
  }(e, t), i = r.charge, a = r.implicitH, o = r.idealGeometry, s = t.elements, u = t.model.atomicConformation, l = u.x, c = u.y, d = u.z, f = function(C) {
    n.add(7, 0, l[s[C]], c[s[C]], d[s[C]], C);
  }, p = 0, g = s.length; p < g; ++p) {
    var m = Tn(t, p);
    if (m === "O") f(p);
    else if (m === "N") {
      if (i[p] < 1) {
        var v = L0(e, t, p) + a[p], h = o[p];
        (h === 4 && v < 4 || h === 3 && v < 3 || h === 2 && v < 2) && f(p);
      }
    } else m === "S" ? m8(t, p) === -1 && f(p) : m === "F" && f(p);
  }
  for (var y = 0, x = t.rings.aromaticRings; y < x.length; y++) {
    var S = x[y], b = t.rings.all[S];
    for (n.startState(), p = 0, g = b.length; p < g; ++p) {
      var _ = b[p];
      n.pushMember(l[s[_]], c[s[_]], d[s[_]], _);
    }
    n.finishState(7, 0);
  }
}), WX = { name: "halogen-bonds", params: hO, createTester: function(e) {
  var t = function(n) {
    return { angleMax: xr(n.angleMax) };
  }(e);
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([6, 7]), getType: function(n, r, i) {
    return function(a, o, s, u) {
      var l = o.types[o.feature], c = s.types[s.feature];
      if (f = c, (d = l) === 7 && f === 6 || d === 6 && f === 7) {
        var d, f, p = l === 6 ? [o, s] : [s, o], g = p[0], m = p[1], v = g.members[g.offsets[g.feature]], h = m.members[m.offsets[m.feature]], y = o_(a, g.unit, v, m.unit, h);
        if (y.length === 1 && !(qX - y[0] > u.angleMax)) {
          var x = o_(a, m.unit, h, g.unit, v);
          if (x.length !== 0 && !x.some(function(S) {
            return jX - S > u.angleMax;
          })) return hn.HalogenBond;
        }
      }
    }(n, r, i, t);
  } };
} }, gO = { distanceMax: N.Numeric(5, { min: 0, max: 8, step: 0.1 }) }, XX = N.getDefaultValues(gO), vO = { distanceMax: N.Numeric(5.5, { min: 1, max: 8, step: 0.1 }), offsetMax: N.Numeric(2, { min: 0, max: 4, step: 0.1 }), angleDevMax: N.Numeric(30, { min: 0, max: 180, step: 1 }) }, ZX = N.getDefaultValues(vO), yO = { distanceMax: N.Numeric(6.6, { min: 1, max: 8, step: 0.1 }), offsetMax: N.Numeric(2, { min: 0, max: 4, step: 0.1 }) }, QX = N.getDefaultValues(yO);
function bO(e, t) {
  var n = ch.get(e).value;
  if (!n) throw Error("expected valence model to be available");
  var r = n.get(t.id);
  if (!r) throw Error("expected valence model for unit to be available");
  return r;
}
var fw = A(), mw = A(), mm = A(), Yc = A(), df = A(), _2 = A();
function c_(e, t) {
  var n = t.unit, r = t.feature, i = t.offsets, a = t.members, o = n.elements, s = i[r];
  return t.unit.conformation.position(o[a[s]], mm), t.unit.conformation.position(o[a[s + 1]], Yc), t.unit.conformation.position(o[a[s + 2]], df), A.triangleNormal(e, mm, Yc, df);
}
var T4 = xr(180), x2 = xr(90), s0 = A(), k4 = A();
function JX(e, t, n, r, i) {
  var a, o, s = t.types[t.feature], u = n.types[n.feature];
  if (o = u, ((a = s) === 2 && o === 1 || a === 1 && o === 2) && function(l, c, d) {
    for (var f = l.feature, p = l.offsets, g = l.members, m = c.feature, v = c.offsets, h = c.members, y = p[f], x = p[f + 1]; y < x; ++y) {
      var S = g[y];
      l.unit.conformation.position(l.unit.elements[S], fw);
      for (var b = v[m], _ = v[m + 1]; b < _; ++b) {
        var C = h[b];
        if (c.unit.conformation.position(c.unit.elements[C], mw), A.squaredDistance(fw, mw) < d) return !0;
      }
    }
    return !1;
  }(t, n, i.distanceMaxSq)) return hn.Ionic;
}
function $X(e, t, n, r, i) {
  var a, o, s = t.types[t.feature], u = n.types[n.feature];
  if (o = u, (a = s) === 3 && o === 1 || a === 1 && o === 3) {
    var l = s === 3 ? [t, n] : [n, t], c = l[0], d = l[1];
    c_(s0, c);
    var f = function(p, g, m) {
      return Gn.position(mm, p), Gn.position(Yc, g), A.sub(df, mm, Yc), A.projectOnPlane(_2, df, m), A.add(_2, _2, Yc), A.distance(_2, Yc);
    }(d, c, s0);
    if (f <= i.offsetMax) return hn.CationPi;
  }
}
var eZ = Gn.Provider([2], function(e, t, n) {
  for (var r = bO(e, t).charge, i = t.elements, a = t.model.atomicConformation, o = a.x, s = a.y, u = a.z, l = Kt.transientSegments(t.model.atomicHierarchy.residueAtomSegments, i); l.hasNext; ) for (var c = l.move(), d = c.start, f = c.end, p = function(m) {
    if (r[m] < 0) n.add(2, 0, o[i[m]], s[i[m]], u[i[m]], m);
    else if (Tn(t, m) === "O") {
      var v = -1, h = 0;
      if (Cu(t, m, function(M, E) {
        Tn(t, E) === "C" && (v = E, h++);
      }), h === 1 && v !== -1) {
        var y = /* @__PURE__ */ new Set(), x = 0;
        if (Cu(t, v, function(M, E) {
          Tn(t, E) === "O" && y.add(E);
        }), y.size === 2) {
          for (var S = t.bonds, b = !0, _ = 0, C = S.a.length; _ < C; _++) {
            var w = S.a[_], I = S.b[_];
            y.has(I) && w !== v && Tn(t, w) !== "H" && (x = -100), S.edgeProps.order[_] === 2 && I === m && (b = !1), w === v && y.has(I) && S.edgeProps.order[_] === 2 && x++;
          }
          x === 1 && b && n.add(2, 0, o[i[m]], s[i[m]], u[i[m]], m);
        }
      }
    }
  }, g = d; g < f; ++g) p(g);
}), tZ = Gn.Provider([1], function(e, t, n) {
  for (var r = bO(e, t).charge, i = t.elements, a = t.model.atomicConformation, o = a.x, s = a.y, u = a.z, l = Kt.transientSegments(t.model.atomicHierarchy.residueAtomSegments, i); l.hasNext; ) for (var c = l.move(), d = c.start, f = c.end, p = function(m) {
    if (r[m] > 0) n.add(1, 0, o[i[m]], s[i[m]], u[i[m]], m);
    else if (Tn(t, m) === "N") {
      var v = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
      if (Cu(t, m, function(x, S) {
        Tn(t, S) === "C" && v.add(S);
      }), !v.size) return "continue";
      v.forEach(function(x) {
        var S = /* @__PURE__ */ new Set();
        Cu(t, x, function(b, _) {
          Tn(t, _) === "N" ? S.add(_) : v.delete(x);
        }), S.size !== 3 ? v.delete(x) : h.set(x, S);
      });
      var y = !1;
      if (!v.size) return "continue";
      v.forEach(function(x) {
        var S = t.bonds, b = h.get(x), _ = 0;
        if (b) {
          for (var C = function(M, E) {
            var T = S.a[M], P = S.b[M];
            if (T === x && b.has(P) && S.edgeProps.order[M] === 2) {
              P === m && (y = !0);
              var k = !0;
              Cu(t, P, function(D, B) {
                B !== x && Tn(t, B) !== "H" && (k = !1);
              }), k && b.delete(P), _++;
            }
          }, w = 0, I = S.a.length; w < I; w++) C(w);
          _ !== 1 ? v.delete(x) : b.forEach(function(M) {
            var E = !0;
            Cu(t, M, function(T, P) {
              P !== x && Tn(t, P) !== "H" && (E = !1);
            }), E && b.delete(M);
          }), b.size > 1 && v.delete(x);
        }
      }), v.size && y && n.add(1, 0, o[i[m]], s[i[m]], u[i[m]], m);
    }
  }, g = d; g < f; ++g) p(g);
}), nZ = Gn.Provider([3], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = 0, l = t.rings.aromaticRings; u < l.length; u++) {
    var c = l[u], d = t.rings.all[c];
    n.startState();
    for (var f = 0, p = d.length; f < p; ++f) {
      var g = d[f];
      n.pushMember(a[r[g]], o[r[g]], s[r[g]], g);
    }
    n.finishState(3, 0);
  }
}), rZ = { name: "ionic", params: gO, createTester: function(e) {
  var t = function(n) {
    return { distanceMaxSq: n.distanceMax * n.distanceMax };
  }(e);
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([2, 1]), getType: function(n, r, i, a) {
    return JX(0, r, i, 0, t);
  } };
} }, iZ = { name: "pi-stacking", params: vO, createTester: function(e) {
  var t = function(n) {
    return { offsetMax: n.offsetMax, angleDevMax: xr(n.angleDevMax) };
  }(e);
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([3]), getType: function(n, r, i, a) {
    return function(o, s, u, l, c) {
      var d, f = s.types[s.feature], p = u.types[u.feature];
      if (d = p, f === 3 && d === 3) {
        c_(s0, s), c_(k4, u);
        var g = A.angle(s0, k4);
        Gn.position(mm, s), Gn.position(Yc, u), A.sub(df, mm, Yc);
        var m = A.angle(s0, df), v = A.angle(k4, df), h = ta(m > x2 ? T4 - m : m), y = ta(v > x2 ? T4 - v : v), x = g <= c.angleDevMax || g >= T4 - c.angleDevMax ? "parallel" : g <= c.angleDevMax + x2 && g >= x2 - c.angleDevMax ? "t-shaped" : void 0, S = x === "parallel" ? [0, 33] : [0, 30];
        if (x && (h >= S[0] && h <= S[1] || y >= S[0] && y <= S[1])) return hn.PiStacking;
      }
    }(0, r, i, 0, t);
  } };
} }, aZ = { name: "cation-pi", params: yO, createTester: function(e) {
  var t = function(n) {
    return { offsetMax: n.offsetMax };
  }(e);
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([3, 1]), getType: function(n, r, i, a) {
    return $X(0, r, i, 0, t);
  } };
} }, _O = { distanceMax: N.Numeric(3, { min: 1, max: 5, step: 0.1 }) }, oZ = N.getDefaultValues(_O), C2 = { 7: 0.71, 8: 0.63, 16: 1.03, 17: 0.99, 35: 1.14, 53: 1.33, 12: 1.39, 23: 1.34, 24: 1.22, 25: 1.19, 26: 1.16, 27: 1.11, 28: 1.1, 29: 1.12, 30: 1.18, 44: 1.25, 45: 1.25, 75: 1.31, 76: 1.29, 78: 1.23, 79: 1.24 }, sZ = ["LI", "NA", "K", "RB", "CS", "MG", "CA", "SR", "BA", "AL", "GA", "IN", "TL", "SC", "SN", "PB", "BI", "SB", "HG"];
function pw(e) {
  return !F6.has(e);
}
function uZ(e) {
  return F6.has(e);
}
function lZ(e) {
  return cH.has(e);
}
function hw(e, t) {
  return e === 12 ? t === 11 || t === 12 : e === 13 ? t === 10 : void 0;
}
var S2, op, s1, pn, ei, fe, dt, cZ = Gn.Provider([13, 12], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = 0, l = r.length; u < l; ++u) {
    var c = Tn(t, u), d = 0;
    sZ.includes(c) ? d = 13 : (uO(c) || c === "ZN" || c === "CD") && (d = 12), d && n.add(d, 0, a[r[u]], o[r[u]], s[r[u]], u);
  }
}), dZ = Gn.Provider([10, 11], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = 0, l = r.length; u < l; ++u) {
    var c = Tn(t, u), d = CX(t, u), f = sO(t, u), p = !1, g = !1, m = ih.has(d), v = G6.has(d);
    m || v ? m ? c === "O" ? (["ASP", "GLU", "SER", "THR", "TYR", "ASN", "GLN"].includes(d) && pw(f) || uZ(f)) && (p = !0, g = !0) : c !== "S" || d !== "CYS" && d !== "MET" ? c === "N" && d === "HIS" && pw(f) && (p = !0) : (p = !0, g = !0) : v && (c === "O" && lZ(f) ? (p = !0, g = !0) : ["N3", "N4", "N7"].includes(f) ? p = !0 : ["O2", "O4", "O6"].includes(f) && (p = !0, g = !0)) : MX(c) || c === "O" || c === "S" ? (p = !0, g = !0) : c === "N" && (p = !0), p && n.add(11, 0, a[r[u]], o[r[u]], s[r[u]], u), g && n.add(10, 0, a[r[u]], o[r[u]], s[r[u]], u);
  }
}), fZ = { name: "metal-coordination", params: _O, createTester: function(e) {
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([13, 12, 10, 11]), getType: function(t, n, r, i) {
    return function(a, o, s, u) {
      var l = o.types[o.feature], c = s.types[s.feature];
      if (hw(l, c) || hw(c, l)) {
        var d = em[Tn(o.unit, o.members[o.offsets[o.feature]])], f = em[Tn(s.unit, s.members[s.offsets[s.feature]])];
        if (d && f && C2[d] && C2[f]) {
          var p = C2[d] + C2[f] + 0.5, g = A.create(0, 0, 0), m = A.create(0, 0, 0);
          if (Gn.position(g, o), Gn.position(m, s), A.distance(g, m) > p) return;
        }
        return hn.MetalCoordination;
      }
    }(0, n, r);
  } };
} };
(function(e) {
  e.Pdb = "pdb", e.Sdf = "sdf", e.Mol = "mol", e.Mol2 = "mol2", e.MMCif = "mmcif", e.Gro = "gro", e.Xtc = "xtc", e.Dump = "dump", e.Xyz = "xyz", e.Cif = "cif", e.MCif = "mcif", e.POSCAR = "poscar", e.Material = "material", e.Pymatgen = "pymatgen";
})(pn || (pn = {})), function(e) {
  e.Molecular = "Molecular", e.Protein = "Protein", e.Chain = "Chain", e.Residue = "Residue", e.Ligand = "Ligand", e.Solvent = "Solvent", e.Water = "Water", e.Other = "Other", e.Metal = "Metal", e.Ions = "Ions", e.Atom = "Atom";
}(ei || (ei = {})), function(e) {
  e.Ribbon = "Ribbon", e.BallAndStick = "BallAndStick", e.Line = "Line", e.Stick = "Stick", e.CPK = "CPK", e.Label = "Label", e.Distance = "Distance", e.Angle = "Angle", e.Dihedral = "Dihedral", e.IntraInteractions = "IntraInteractions", e.BetweenInteractions = "BetweenInteractions", e.Pharmacophore = "Pharmacophore", e.Pocket = "Pocket", e.Surface = "Surface", e.IsoSurface = "IsoSurface", e.RotateArrow = "RotateArrow", e.MappingLine = "MappingLine", e.UnitCell = "UnitCell", e.CustomLines = "CustomLines", e.CustomPlanes = "CustomPlanes", e.Trajectory = "Trajectory";
}(fe || (fe = {})), function(e) {
  e.RIBBON = "Ribbon", e.ATOM = "Atom", e.SURFACE = "Surface";
}(dt || (dt = {}));
var Oc, pr = ((S2 = {})[dt.RIBBON] = [fe.Ribbon], S2[dt.ATOM] = [fe.CPK, fe.Line, fe.Stick, fe.BallAndStick], S2[dt.SURFACE] = [fe.Surface], S2);
(function(e) {
  e[e.Not = 0] = "Not", e[e.Include = 1] = "Include", e[e.BeIncluded = 2] = "BeIncluded", e[e.Cross = 3] = "Cross";
})(Oc || (Oc = {}));
var Dt, mZ = /* @__PURE__ */ new Set([fe.Ribbon, fe.CPK, fe.Line, fe.Stick, fe.BallAndStick, fe.Surface]), A1 = /* @__PURE__ */ new Set([fe.BallAndStick, fe.Line, fe.Stick, fe.CPK]), pZ = /* @__PURE__ */ new Set([fe.BallAndStick, fe.Line, fe.Stick]), pm = /* @__PURE__ */ new Set([fe.Label, fe.Distance, fe.Angle, fe.Dihedral]), hZ = /* @__PURE__ */ new Set([fe.Surface, fe.Pharmacophore, fe.Pocket]);
(function(e) {
  e.Atom = "Atom", e.Residue = "Residue", e.Chain = "Chain", e.Molecular = "Molecular";
})(Dt || (Dt = {}));
var $r, gZ = ((op = {})[Dt.Atom] = "element", op[Dt.Residue] = "residue", op[Dt.Chain] = "chain", op[Dt.Molecular] = "entity", op), vZ = { element: Dt.Atom, residue: Dt.Residue, chain: Dt.Chain, entity: Dt.Molecular };
(function(e) {
  e.HydrogenBonds = "hydrogen-bonds", e.WeakHydrogenBonds = "weak-hydrogen-bonds", e.HalogenBonds = "halogen-bonds", e.SaltBridge = "ionic", e.PiPiStacking = "pi-stacking", e.PiCations = "cation-pi", e.MetalBonds = "metal-coordination", e.Hydrophobic = "hydrophobic";
})($r || ($r = {}));
var Wd, d_ = function(e) {
  var t, n = ((t = {})[$r.HydrogenBonds] = { name: "on", params: BX }, t[$r.WeakHydrogenBonds] = { name: "off", params: RX }, t[$r.HalogenBonds] = { name: "on", params: UX }, t[$r.SaltBridge] = { name: "on", params: XX }, t[$r.PiPiStacking] = { name: "on", params: ZX }, t[$r.PiCations] = { name: "on", params: QX }, t[$r.MetalBonds] = { name: "on", params: oZ }, t[$r.Hydrophobic] = { name: "off", params: {} }, t);
  return e && Object.keys(n).forEach(function(r) {
    n[r].name = e.includes(r) ? "on" : "off";
  }), n;
};
(function(e) {
  e[e.All = 0] = "All", e[e.Residues = 1] = "Residues", e[e.Water = 2] = "Water", e[e.SolventWithoutWater = 3] = "SolventWithoutWater", e[e.Solvent = 4] = "Solvent";
})(Wd || (Wd = {}));
var u0, ti, $d, yZ = ((s1 = {})[Wd.All] = [ei.Protein, ei.Water, ei.Ligand, ei.Solvent], s1[Wd.Residues] = [ei.Protein], s1[Wd.Water] = [ei.Water], s1[Wd.SolventWithoutWater] = [ei.Solvent], s1[Wd.Solvent] = [ei.Water, ei.Solvent], s1);
(function(e) {
  e.Structure = "Structure", e.Measurement = "Measurement", e.Interaction = "Interaction", e.Bond = "Bond";
})(u0 || (u0 = {})), function(e) {
  e[e.NotHydrogen = -1] = "NotHydrogen", e[e.NonPolar = 0] = "NonPolar", e[e.Polar = 1] = "Polar", e[e.ConnectPolar = 2] = "ConnectPolar", e[e.ConnectNonPolar = 3] = "ConnectNonPolar";
}(ti || (ti = {})), function(e) {
  e.Drug = "drug", e.Material = "material";
}($d || ($d = {}));
var Yi = function(e) {
  if (e.kind === "element-loci") return e;
  if (e.kind === "structure-loci") return ze.toStructureElementLoci(e.structure);
  if (e.kind === "shape-loci") {
    var t, n = e.shape.sourceData, r = [];
    return n.infos ? r.push.apply(r, Re([], n.infos, !0).map(function(i) {
      return i.loci;
    })) : n.pairs ? r.push.apply(r, n.pairs[0].loci) : n.triples ? r.push.apply(r, n.triples[0].loci) : n.quads && r.push.apply(r, n.quads[0].loci), r.forEach(function(i) {
      t = t ? ke.union(t, Yi(i)) : Yi(i);
    }), t;
  }
}, Vr = function(e, t) {
  var n = [], r = new Set(t), i = /* @__PURE__ */ new Set();
  return e.units.forEach(function(a) {
    if (!i.has(a.invariantId)) {
      i.add(a.invariantId);
      var o = [];
      a.elements.forEach(function(s, u) {
        t && !r.has(s) || o.push(u);
      }), o.length > 0 && n.push({ unit: a, indices: o });
    }
  }), ke(e, n);
}, Ai = function(e) {
  var t = [];
  return e.elements.forEach(function(n) {
    t.push.apply(t, _e.toArray(n.indices).map(function(r) {
      return n.unit.elements[r];
    }).filter(function(r) {
      return r !== void 0;
    }));
  }), t;
}, bZ = function(e, t) {
  var n, r = Sf.ofLoci(e);
  n = r.elementCount > 0 ? r.firstElementLoc : r.residueCount > 0 ? r.firstResidueLoc : r.chainCount > 0 ? r.firstChainLoc : r.unitCount > 0 ? r.firstUnitLoc : r.conformationCount > 0 ? r.firstConformationLoc : r.firstStructureLoc;
  var i = Fe.atom.em_confidence(n), a = Fe.atom.B_iso_or_equiv(n);
  switch (t) {
    case Dt.Atom:
      return r.elementCount === 1 ? { x: Fe.atom.x(n), y: Fe.atom.y(n), z: Fe.atom.z(n), granularity: Dt.Atom, atomName: Fe.atom.label_atom_id(n), atomId: Fe.atom.id(n), altId: Fe.atom.label_alt_id(n), residueName: Fe.atom.label_comp_id(n), residueId: Fe.residue.auth_seq_id(n), insertCode: Fe.residue.pdbx_PDB_ins_code(n), chainId: Fe.chain.label_asym_id(n), emConfidence: i, bfactor: a } : { granularity: Dt.Residue, altId: Fe.atom.label_alt_id(n), residueName: Fe.atom.label_comp_id(n), residueId: Fe.residue.auth_seq_id(n), chainId: Fe.chain.label_asym_id(n), insertCode: Fe.residue.pdbx_PDB_ins_code(n), emConfidence: i, bfactor: a };
    case Dt.Residue:
      return { granularity: Dt.Residue, altId: Fe.atom.label_alt_id(n), residueName: Fe.atom.label_comp_id(n), residueId: Fe.residue.auth_seq_id(n), chainId: Fe.chain.label_asym_id(n), insertCode: Fe.residue.pdbx_PDB_ins_code(n), bfactor: a };
    case Dt.Chain:
      return { granularity: Dt.Chain, chainId: Fe.chain.label_asym_id(n) };
    case Dt.Molecular:
      return { granularity: Dt.Molecular };
    default:
      return {};
  }
}, _Z = function(e) {
  var t = e.elements[0], n = t.unitA, r = t.indexA, i = t.unitB, a = t.indexB, o = e.data.interactions, s = o.contacts, u = o.unitsContacts, l = o.unitsFeatures, c = l.get(n.id), d = c.members, f = c.offsets, p = l.get(i.id), g = p.members, m = p.offsets, v = -1;
  if (n === i) {
    var h = u.get(n.id), y = h.getDirectedEdgeIndex(r, a);
    v = h.edgeProps.type[y];
  } else
    y = s.getEdgeIndex(r, n.id, a, i.id), v = s.edges[y].props.type;
  var x = pt.Location(e.data.structure, n, d[f[r]], e.data.structure, i, g[m[a]]), S = ke(x.aStructure, [{ unit: x.aUnit, indices: _e.ofSingleton(x.aIndex) }]), b = ke(x.bStructure, [{ unit: x.bUnit, indices: _e.ofSingleton(x.bIndex) }]), _ = Sf.ofLoci(S), C = Sf.ofLoci(b), w = _.firstElementLoc, I = C.firstElementLoc;
  return { infoA: { chainId: Fe.chain.label_asym_id(w), residueName: Fe.atom.label_comp_id(w), residueId: Fe.residue.auth_seq_id(w), atomName: Fe.atom.label_atom_id(w) }, infoB: { chainId: Fe.chain.label_asym_id(I), residueName: Fe.atom.label_comp_id(I), residueId: Fe.residue.auth_seq_id(I), atomName: Fe.atom.label_atom_id(I) }, interactionType: l_(v) };
}, xZ = function(e) {
  return fetch(e).then(function(t) {
    return t.text();
  });
}, CZ = function(e) {
  return fetch(e).then(function(t) {
    return t.blob();
  });
}, SZ = function(e) {
  return new Promise(function(t) {
    var n = new FileReader();
    n.onload = function(r) {
      return se(this, 0, void 0, function() {
        return ie(this, function(i) {
          return t(n.result), [2];
        });
      });
    }, n.readAsText(e);
  });
}, ff = function(e) {
  return se(void 0, 0, void 0, function() {
    var t, n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return typeof e != "string" ? [3, 4] : e.startsWith("http") || e.startsWith("https") ? [4, xZ(e)] : [3, 2];
        case 1:
          return n = r.sent(), [3, 3];
        case 2:
          n = e, r.label = 3;
        case 3:
          return t = n, [3, 6];
        case 4:
          return [4, SZ(e)];
        case 5:
          t = r.sent(), r.label = 6;
        case 6:
          return [2, t];
      }
    });
  });
}, AZ = function(e) {
  return se(void 0, 0, void 0, function() {
    var t, n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return typeof e != "string" ? [3, 2] : [4, CZ(e)];
        case 1:
          return t = r.sent(), [3, 4];
        case 2:
          return n = Blob.bind, [4, e.arrayBuffer()];
        case 3:
          t = new (n.apply(Blob, [void 0, [r.sent()]]))(), r.label = 4;
        case 4:
          return [2, t];
      }
    });
  });
};
function wZ(e, t, n) {
  return se(this, 0, void 0, function() {
    return ie(this, function(r) {
      return [2, new Promise(function(i, a) {
        var o = function(m) {
          m ? i(m) : a("no blob returned");
        };
        if (HTMLCanvasElement.prototype.toBlob) e.toBlob(o, t, n);
        else {
          for (var s = atob(e.toDataURL(t, n).split(",")[1]), u = s.length, l = u >> 2, c = new Uint8Array(u), d = new Uint32Array(c.buffer, 0, l), f = 0, p = 0; p < l; ++p) d[p] = s.charCodeAt(f++) | s.charCodeAt(f++) << 8 | s.charCodeAt(f++) << 16 | s.charCodeAt(f++) << 24;
          for (var g = 3 & u; g--; ) c[f] = s.charCodeAt(f++);
          o(new Blob([c], { type: t }));
        }
      })];
    });
  });
}
var IZ = 1 / 0;
function xO(e, t, n, r, i) {
  var a = -1, o = e.length;
  for (n || (n = Array.isArray), i || (i = []); ++a < o; ) {
    var s = e[a];
    n(s) ? xO(s, t - 1, n, r, i) : i[i.length] = s;
  }
  return i;
}
function CO(e) {
  return e != null && e.length ? xO(e, IZ) : [];
}
var D4 = function(e, t) {
  for (var n = [], r = 0, i = t.length; r < i; r++) {
    var a = t[r], o = a.start, s = a.end;
    a.regular.test(e.slice(o, s)) || n.push({ start: o, end: s });
  }
  return n;
}, N0 = function(e) {
  return e.length > 2 || e.length === 0 ? e : "".concat(e[0].toLocaleUpperCase()).concat(e.length === 2 ? e[1].toLocaleLowerCase() : "");
}, O4 = { HSE: "SER", HSD: "HIS", HSP: "HIS", "2AS": "ASP", "3AH": "HIS", "5HP": "GLU", ACL: "ARG", AGM: "ARG", AIB: "ALA", ALM: "ALA", ALO: "THR", ALY: "LYS", ARM: "ARG", ASA: "ASP", ASB: "ASP", ASK: "ASP", ASL: "ASP", ASQ: "ASP", AYA: "ALA", BCS: "CYS", BHD: "ASP", BMT: "THR", BNN: "ALA", BUC: "CYS", BUG: "LEU", C5C: "CYS", C6C: "CYS", CAS: "CYS", CCS: "CYS", CEA: "CYS", CGU: "GLU", CHG: "GLY", CLE: "LEU", CME: "CYS", CSD: "CYS", CSO: "CYS", CSP: "CYS", CSS: "CYS", CSW: "CYS", CSX: "CYS", CXM: "MET", CY1: "CYS", CY3: "CYS", CYG: "CYS", CYM: "CYS", CYQ: "CYS", DAH: "PHE", DAL: "ALA", DAR: "ARG", DAS: "ASP", DCY: "CYS", DGL: "GLU", DGN: "GLN", DHA: "ALA", DHI: "HIS", DIL: "ILE", DIV: "VAL", DLE: "LEU", DLY: "LYS", DNP: "ALA", DPN: "PHE", DPR: "PRO", DSN: "SER", DSP: "ASP", DTH: "THR", DTR: "TRP", DTY: "TYR", DVA: "VAL", EFC: "CYS", FLA: "ALA", FME: "MET", GGL: "GLU", GL3: "GLY", GLZ: "GLY", GMA: "GLU", GSC: "GLY", HAC: "ALA", HAR: "ARG", HIC: "HIS", HIP: "HIS", HMR: "ARG", HPQ: "PHE", HTR: "TRP", HYP: "PRO", IAS: "ASP", IIL: "ILE", IYR: "TYR", KCX: "LYS", LLP: "LYS", LLY: "LYS", LTR: "TRP", LYM: "LYS", LYZ: "LYS", MAA: "ALA", MEN: "ASN", MHS: "HIS", MIS: "SER", MLE: "LEU", MPQ: "GLY", MSA: "GLY", MSE: "MET", MVA: "VAL", NEM: "HIS", NEP: "HIS", NLE: "LEU", NLN: "LEU", NLP: "LEU", NMC: "GLY", OAS: "SER", OCS: "CYS", OMT: "MET", PAQ: "TYR", PCA: "GLU", PEC: "CYS", PHI: "PHE", PHL: "PHE", PR3: "CYS", PRR: "ALA", PTR: "TYR", PYX: "CYS", SAC: "SER", SAR: "GLY", SCH: "CYS", SCS: "CYS", SCY: "CYS", SEL: "SER", SEP: "SER", SET: "SER", SHC: "CYS", SHR: "LYS", SMC: "CYS", SOC: "CYS", STY: "TYR", SVA: "SER", TIH: "ALA", TPL: "TRP", TPO: "THR", TPQ: "ALA", TRG: "LYS", TRO: "TRP", TYB: "TYR", TYI: "TYR", TYQ: "TYR", TYS: "TYR", TYY: "TYR", ALA: "ALA", ASN: "ASN", CYS: "CYS", GLU: "GLU", HIS: "HIS", LEU: "LEU", MET: "MET", PRO: "PRO", THR: "THR", TYR: "TYR", ARG: "ARG", ASP: "ASP", GLN: "GLN", GLY: "GLY", ILE: "ILE", LYS: "LYS", PHE: "PHE", SER: "SER", TRP: "TRP", VAL: "VAL", "0CS": "ALA", "1AB": "PRO", "1LU": "LEU", "1PA": "PHE", "1TQ": "TRP", "1TY": "TYR", "23F": "PHE", "23S": "TRP", "2BU": "ALA", "2ML": "LEU", "2MR": "ARG", "2MT": "PRO", "2OP": "ALA", "2TY": "TYR", "32S": "TRP", "32T": "TRP", "3MD": "ASP", "3TY": "TYR", "4DP": "TRP", "4F3": "ALA", "4FB": "PRO", "4FW": "TRP", "4HT": "TRP", "4IN": "TRP", "4PH": "PHE", "5CS": "CYS", "6CL": "LYS", "6CW": "TRP", A0A: "ASP", AA4: "ALA", AAR: "ARG", AB7: "GLU", ABA: "ALA", ACB: "ASP", ACY: "GLY", AEI: "THR", AFA: "ASN", AGT: "CYS", AHB: "ASN", AHO: "ALA", AHP: "ALA", AKL: "ASP", ALC: "ALA", ALG: "ARG", ALN: "ALA", ALS: "ALA", ALT: "ALA", AME: "MET", AP7: "ALA", APH: "ALA", API: "LYS", APK: "LYS", AR2: "ARG", AR4: "GLU", ARO: "ARG", ASI: "ASP", AYG: "ALA", AZK: "LYS", B2A: "ALA", B2F: "PHE", B2I: "ILE", B2V: "VAL", B3A: "ALA", B3D: "ASP", B3E: "GLU", B3K: "LYS", B3S: "SER", B3X: "ASN", B3Y: "TYR", BAL: "ALA", BBC: "CYS", BCX: "CYS", BFD: "ASP", BG1: "SER", BIF: "PHE", BLE: "LEU", BLY: "LYS", BOR: "ARG", BPE: "CYS", BTR: "TRP", C12: "ALA", C1X: "LYS", C3Y: "CYS", C99: "ALA", CAB: "ALA", CAF: "CYS", CH6: "ALA", CH7: "ALA", CHP: "GLY", CHS: "PHE", CIR: "ARG", CLB: "ALA", CLD: "ALA", CLG: "LYS", CLH: "LYS", CLV: "ALA", CML: "CYS", CMT: "CYS", CQR: "ALA", CR2: "ALA", CR5: "ALA", CR7: "ALA", CR8: "ALA", CRK: "ALA", CRO: "THR", CRQ: "TYR", CRW: "ALA", CRX: "ALA", CS1: "CYS", CS3: "CYS", CS4: "CYS", CSA: "CYS", CSB: "CYS", CSE: "CYS", CSI: "ALA", CSR: "CYS", CSU: "CYS", CSY: "ALA", CSZ: "CYS", CTH: "THR", CWR: "ALA", CY0: "CYS", CY4: "CYS", CY7: "CYS", CYD: "CYS", CYF: "CYS", CYJ: "LYS", CYR: "CYS", CYX: "CYS", CZ2: "CYS", CZZ: "CYS", DA2: "ARG", DAB: "ALA", DAM: "ALA", DBU: "ALA", DBY: "TYR", DBZ: "ALA", DCL: "LEU", DDE: "HIS", DHL: "SER", DLS: "LYS", DMH: "ASN", DMK: "ASP", DNE: "LEU", DNG: "LEU", DNL: "LYS", DNM: "LEU", DPH: "PHE", DPL: "PRO", DPP: "ALA", DPQ: "TYR", DSE: "SER", DSG: "ASN", DYG: "ALA", DYS: "CYS", ESB: "TYR", ESC: "MET", FCL: "PHE", FGL: "ALA", FGP: "SER", FHL: "LYS", FLE: "LEU", FLT: "TYR", FOE: "CYS", FOG: "PHE", FOR: "MET", FRF: "PHE", FTR: "TRP", FTY: "TYR", GHG: "GLN", GHP: "GLY", GLH: "GLN", GMU: "ALA", GPL: "LYS", GT9: "CYS", GVL: "SER", GYC: "CYS", GYS: "GLY", H5M: "PRO", HHK: "ALA", HIA: "HIS", HID: "HIS", HIE: "HIS", HIQ: "HIS", HLU: "LEU", HMF: "ALA", HPE: "PHE", HPH: "PHE", HRG: "ARG", HSL: "SER", HSO: "HIS", HTI: "CYS", HY3: "PRO", IAM: "ALA", IGL: "ALA", ILG: "GLU" }, PZ = { ALA: "A", CYS: "C", ASP: "D", GLU: "E", PHE: "F", GLY: "G", HIS: "H", ILE: "I", LYS: "K", LEU: "L", MET: "M", ASN: "N", PRO: "P", GLN: "Q", ARG: "R", SER: "S", THR: "T", VAL: "V", TRP: "W", TYR: "Y", HID: "H", HIE: "H", HIP: "H", ASH: "B", GLH: "E", LYN: "K", CYM: "CM" }, MZ = [{ start: 0, end: 10, regular: /\s*[\d.-]+/ }, { start: 10, end: 20, regular: /\s*[\d.-]+/ }, { start: 20, end: 30, regular: /\s*[\d.-]+/ }, { start: 31, end: 33, regular: /[\sA-Za-z]+/ }], EZ = [{ start: 0, end: 3, regular: /\s*[\d]+/ }, { start: 3, end: 6, regular: /\s*[\d]+/ }, { start: 6, end: 9, regular: /\s*[\d]+/ }], TZ = [{ start: 0, end: 3, regular: /\s*[\d]+/ }, { start: 3, end: 6, regular: /\s*[\d]+/ }], SO = { Dihedral: fe.Dihedral, Distance: fe.Distance, Angle: fe.Angle, Label: fe.Label, "Molecular Surface": fe.Surface, "Ball & Stick": fe.BallAndStick, Line: fe.Line, Stick: fe.Stick, Spacefill: fe.CPK, Cartoon: fe.Ribbon }, AO = function(e, t, n) {
  var r, i = t[0], a = i.residueName, o = i.residueId, s = i.isEutectic, u = t.map(function(p) {
    return p.elementId;
  }), l = Vr(e, u), c = Sf.ofLoci(l);
  r = c.elementCount > 0 ? c.firstElementLoc : c.residueCount > 0 ? c.firstResidueLoc : c.chainCount > 0 ? c.firstChainLoc : c.unitCount > 0 ? c.firstUnitLoc : c.conformationCount > 0 ? c.firstConformationLoc : c.firstStructureLoc;
  var d, f = (d = Fe.residue.secondary_structure_type(r), gn.is(d, 2) ? "helix" : gn.is(d, 4) ? "sheet" : gn.is(d, 16) ? "turn" : gn.is(d, 8) ? "bend" : "none");
  return { residueNum: o, residueName: a.toUpperCase(), standardResidueName: O4[a.toUpperCase()], oneLetter: s ? "X" : PZ[O4[a.toUpperCase()]] || O4[a.toUpperCase()] || "X", elementIds: t.map(function(p) {
    return p.elementId;
  }), secondaryStructureType: f, secondaryStructureTypeInfo: Fe.residue.secondary_structure_type(r), secondaryStructureTypeKey: Fe.residue.secondary_structure_key(r), insCode: Fe.residue.pdbx_PDB_ins_code(r), index: n };
}, mf = /* @__PURE__ */ new Set(["DAPC", "DBPC", "DFPC", "DGPC", "DIPC", "DLPC", "DNPC", "DOPC", "DPPC", "DRPC", "DTPC", "DVPC", "DXPC", "DYPC", "LPPC", "PAPC", "PEPC", "PGPC", "PIPC", "POPC", "PRPC", "PUPC", "DAPE", "DBPE", "DFPE", "DGPE", "DIPE", "DLPE", "DNPE", "DOPE", "DPPE", "DRPE", "DTPE", "DUPE", "DVPE", "DXPE", "DYPE", "LPPE", "PAPE", "PGPE", "PIPE", "POPE", "PQPE", "PRPE", "PUPE", "DAPS", "DBPS", "DFPS", "DGPS", "DIPS", "DLPS", "DNPS", "DOPS", "DPPS", "DRPS", "DTPS", "DUPS", "DVPS", "DXPS", "DYPS", "LPPS", "PAPS", "PGPS", "PIPS", "POPS", "PQPS", "PRPS", "PUPS", "DAPG", "DBPG", "DFPG", "DGPG", "DIPG", "DLPG", "DNPG", "DOPG", "DPPG", "DRPG", "DTPG", "DVPG", "DXPG", "DYPG", "LPPG", "PAPG", "PGPG", "PIPG", "POPG", "PRPG", "DAPA", "DBPA", "DFPA", "DGPA", "DIPA", "DLPA", "DNPA", "DOPA", "DPPA", "DRPA", "DTPA", "DVPA", "DXPA", "DYPA", "LPPA", "PAPA", "PGPA", "PIPA", "POPA", "PRPA", "PUPA", "DPP", "DPPI", "PAPI", "PIPI", "POP", "POPI", "PUPI", "PVP", "PVPI", "PADG", "PIDG", "PODG", "PUDG", "PVDG", "APC", "CPC", "IPC", "LPC", "OPC", "PPC", "TPC", "UPC", "VPC", "BNSM", "DBSM", "DPSM", "DXSM", "PGSM", "PNSM", "POSM", "PVSM", "XNSM", "DPCE", "DXCE", "PNCE", "XNCE", "DMPC"]), p8 = /* @__PURE__ */ new Set(["LI", "NA", "K", "RB", "CS", "FR", "BE", "MG", "CA", "SR", "BA", "RA", "AL", "GA", "IN", "SN", "TL", "PB", "BI", "SC", "TI", "V", "CR", "MN", "FE", "CO", "NI", "CU", "ZN", "Y", "ZR", "NB", "MO", "TC", "RU", "RH", "PD", "AG", "CD", "LA", "HF", "TA", "W", "RE", "OS", "IR", "PT", "AU", "HG", "AC", "RF", "DB", "SG", "BH", "HS", "MT", "CE", "PR", "ND", "PM", "SM", "EU", "GD", "TB", "DY", "HO", "ER", "TM", "YB", "LU", "TH", "PA", "U", "NP", "PU", "AM", "CM", "BK", "CF", "ES", "FM", "MD", "NO", "LR"]), h8 = /* @__PURE__ */ new Set(["EOH", "GOL", "DMS", "PEG", "POL", "IOH", "DIO", "ACN", "SBT", "1BO", "CCN", "DMS", "GBL", "P2K", "MPD", "PGQ", "SEO"]), Sa = function(e, t, n) {
  n === void 0 && (n = !1);
  var r = n ? "".concat(t.residueId, "_").concat(t.insertCode) : t.residueId;
  e[t.chainId] ? e[t.chainId][r] = (e[t.chainId][r] ? e[t.chainId][r] : []).concat(t) : (e[t.chainId] = {}, e[t.chainId][r] = [t]);
}, wO = function(e) {
  var t = {}, n = {}, r = {}, i = {}, a = {}, o = {}, s = {}, u = {}, l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
  e.units.forEach(function(v) {
    var h;
    v.elements.forEach(function(_) {
      var C = Ou(v, _);
      if (Lm.has(C.residueName.toUpperCase())) Sa(n, C);
      else if (p8.has(C.typeSymbol.toUpperCase())) Sa(i, C);
      else if (h8.has(C.residueName.toUpperCase())) Sa(r, C);
      else if (rh.has(C.residueName.toUpperCase())) Sa(a, C);
      else {
        if (C.groupPDB === "ATOM" && !["UNK", "MOL"].includes(C.residueName) && !mf.has(C.residueName)) return Sa(t, C, !0), void l.add(C.elementId);
        if (C.groupPDB !== "HETATM" && !["UNK", "MOL"].includes(C.residueName) && mf.has(C.residueName)) Sa(s, C);
        else {
          var w = "".concat(C.chainId, "_").concat(C.residueId);
          c.set(w, c.has(w) ? Re(Re([], c.get(w), !0), [C], !1) : [C]);
        }
      }
    });
    for (var y = 0, x = v.bonds.a.length; y < x; y++) {
      var S = v.elements[v.bonds.a[y]], b = v.elements[v.bonds.b[y]];
      d.has(S) ? (h = d.get(S)) === null || h === void 0 || h.add(b) : d.set(S, /* @__PURE__ */ new Set([b]));
    }
  }), c.forEach(function(v) {
    var h = !1;
    new Set(v.map(function(y) {
      return y.elementId;
    })).forEach(function(y) {
      if (d.has(y)) {
        var x = d.get(y);
        x == null || x.forEach(function(S) {
          l.has(S) && (h = !0);
        });
      }
    }), v.forEach(function(y) {
      h ? (Object.assign(y, { isEutectic: !0 }), Sa(o, y)) : Sa(s, y);
    });
  });
  var f = {};
  Object.keys(s).forEach(function(v) {
    var h = s[v];
    Object.keys(h).forEach(function(y) {
      var x = h[y], S = x.filter(function(b) {
        return b.typeSymbol !== "H";
      });
      !mf.has(x[0].residueName.toUpperCase()) && S.length > 10 && S.length < 150 ? (u[v] || (u[v] = {}), u[v][y] = x) : (f[v] || (f[v] = {}), f[v][y] = x);
    });
  });
  var p = {};
  Object.keys(t).forEach(function(v) {
    var h;
    p[v] || (p[v] = []), (h = p[v]).push.apply(h, Object.values(t[v]));
  }), Object.keys(o).forEach(function(v) {
    var h = o[v];
    Object.keys(h).forEach(function(y) {
      var x = h[y];
      f[v] || (f[v] = {}), p[v] || (p[v] = []), p[v].push(x), f[v][y] = x;
    });
  });
  var g = 0, m = {};
  return Object.keys(p).forEach(function(v) {
    m[v] = {}, p[v].sort(function(h, y) {
      return h[0].residueId !== y[0].residueId ? h[0].residueId - y[0].residueId : h[0].insertCode.localeCompare(y[0].insertCode);
    }).forEach(function(h) {
      m[h[0].chainId]["".concat(h[0].residueId, "_").concat(h[0].insertCode)] = AO(e, h, g++);
    });
  }), { data: { polymer: t, water: n, otherSolvent: r, metal: i, ion: a, ligand: u, other: f }, extraData: { sequenceData: m } };
}, kZ = function(e) {
  var t = {}, n = {}, r = {}, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
  e.units.forEach(function(d) {
    var f;
    d.elements.forEach(function(h) {
      var y = Ou(d, h);
      if (!Lm.has(y.residueName.toUpperCase()) && !(p8.has(y.typeSymbol.toUpperCase()) || h8.has(y.residueName.toUpperCase()) || rh.has(y.residueName.toUpperCase()) || mf.has(y.residueName.toUpperCase()))) {
        if (y.groupPDB === "ATOM" && !["UNK", "MOL"].includes(y.residueName)) return Sa(t, y, !0), void i.add(y.elementId);
        if (y.groupPDB === "HETATM" || ["UNK", "MOL"].includes(y.residueName)) {
          var x = "".concat(y.chainId, "_").concat(y.residueId);
          a.set(x, a.has(x) ? Re(Re([], a.get(x), !0), [y], !1) : [y]);
        } else Sa(r, y);
      }
    });
    for (var p = 0, g = d.bonds.a.length; p < g; p++) {
      var m = d.elements[d.bonds.a[p]], v = d.elements[d.bonds.b[p]];
      o.has(m) ? (f = o.get(m)) === null || f === void 0 || f.add(v) : o.set(m, /* @__PURE__ */ new Set([v]));
    }
  }), a.forEach(function(d) {
    var f = !1;
    new Set(d.map(function(p) {
      return p.elementId;
    })).forEach(function(p) {
      if (o.has(p)) {
        var g = o.get(p);
        g == null || g.forEach(function(m) {
          i.has(m) && (f = !0);
        });
      }
    }), d.forEach(function(p) {
      f ? (Object.assign(p, { isEutectic: !0 }), Sa(n, p)) : Sa(r, p);
    });
  });
  var s = {};
  Object.keys(r).forEach(function(d) {
    var f = r[d];
    Object.keys(f).forEach(function(p) {
      var g = f[p], m = g.filter(function(v) {
        return v.typeSymbol !== "H";
      });
      m.length <= 10 && m.length < 150 && (s[d] || (s[d] = {}), s[d][p] = g);
    });
  });
  var u = {};
  Object.keys(t).forEach(function(d) {
    var f;
    u[d] || (u[d] = []), (f = u[d]).push.apply(f, Object.values(t[d]));
  }), Object.keys(n).forEach(function(d) {
    var f = n[d];
    Object.keys(f).forEach(function(p) {
      var g = f[p];
      s[d] || (s[d] = {}), u[d] || (u[d] = []), u[d].push(g), s[d][p] = g;
    });
  });
  var l = 0, c = {};
  return Object.keys(u).forEach(function(d) {
    c[d] = {}, u[d].sort(function(f, p) {
      return f[0].residueId !== p[0].residueId ? f[0].residueId - p[0].residueId : f[0].insertCode.localeCompare(p[0].insertCode);
    }).forEach(function(f) {
      c[f[0].chainId]["".concat(f[0].residueId, "_").concat(f[0].insertCode)] = AO(e, f, l++);
    });
  }), c;
}, Cv = function(e, t) {
  switch (t) {
    case Dt.Atom:
      return "".concat(e.elementId);
    case Dt.Residue:
      return "".concat(e.chainId, "_").concat(e.residueName, "_").concat(e.residueId);
    case Dt.Chain:
      return "".concat(e.chainId);
    case Dt.Molecular:
      return "".concat(e.unitId);
  }
  return "";
}, DZ = function(e, t) {
  switch (t) {
    case Dt.Atom:
      return e;
    case Dt.Residue:
      return { unitId: e.unitId, chainId: e.chainId, groupPDB: e.groupPDB, residueId: e.residueId, residueName: e.residueName };
    case Dt.Chain:
      return { unitId: e.unitId, chainId: e.chainId };
    case Dt.Molecular:
      return { unitId: e.unitId };
  }
  return {};
};
function IO(e, t, n) {
  var r = this;
  return n === void 0 && (n = !1), Xt.create("Parse PDB", function(i) {
    return se(r, 0, void 0, function() {
      var a, o, s;
      return ie(this, function(u) {
        switch (u.label) {
          case 0:
            return o = (a = hi).success, s = {}, [4, je.readAllLinesAsync(e, i)];
          case 1:
            return [2, o.apply(a, [(s.lines = u.sent(), s.id = t, s.isPdbqt = n, s)])];
        }
      });
    });
  });
}
function OZ(e, t) {
  var n = function(a, o) {
    return (t.substr(a, o) || "").trim();
  }, r = { entry_id: Ye.ofString(e), length_a: Ye.ofString(n(6, 9)), length_b: Ye.ofString(n(15, 9)), length_c: Ye.ofString(n(24, 9)), angle_alpha: Ye.ofString(n(33, 7)), angle_beta: Ye.ofString(n(40, 7)), angle_gamma: Ye.ofString(n(47, 7)), Z_PDB: Ye.ofString(n(66, 4)), pdbx_unique_axis: Ye.ofString("?") }, i = { entry_id: Ye.ofString(e), "space_group_name_H-M": Ye.ofString(n(55, 11)), Int_Tables_number: Ye.ofString("?"), cell_setting: Ye.ofString("?"), space_group_name_Hall: Ye.ofString("?") };
  return [Xi.ofFields("cell", r), Xi.ofFields("symmetry", i)];
}
function gw(e, t) {
  return { id: e, details: t, groups: [] };
}
function BZ(e, t, n) {
  for (var r, i, a, o = [], s = 1, u = 1, l = function(z) {
    return e.data.substring(e.indices[2 * z], e.indices[2 * z + 1]);
  }, c = t; c < n; c++) {
    var d = l(c);
    if (d.substr(11, 12) === "BIOMOLECULE:") {
      var f = d.substr(23).trim(), p = "Biomolecule ".concat(f);
      (d = l(c + 1)).substr(11, 30) !== "APPLY THE FOLLOWING TO CHAINS:" && (c++, p = d.substr(11).trim()), r = gw(f, p), o.push(r);
    } else if (d.substr(13, 5) === "BIOMT") {
      var g = d.split(/\s+/);
      (G = parseInt(d[18]) - 1) === 0 && (a = ne.identity(), i.operators.push({ id: s++, matrix: a })), ne.setValue(a, G, 0, parseFloat(g[4])), ne.setValue(a, G, 1, parseFloat(g[5])), ne.setValue(a, G, 2, parseFloat(g[6])), ne.setValue(a, G, 3, parseFloat(g[7]));
    } else if (d.substr(11, 30) === "APPLY THE FOLLOWING TO CHAINS:" || d.substr(11, 30) === "                   AND CHAINS:") {
      d.substr(11, 5) === "APPLY" && (i = { chains: [], operators: [] }, r.groups.push(i));
      for (var m = 0, v = (h = d.substr(41, 30).split(",")).length; m < v; ++m)
        (y = h[m].trim()) && i.chains.push(y);
    } else if (d.substr(11, 33) === "APPLYING THE FOLLOWING TO CHAINS:") {
      r = gw("".concat(u), "Biomolecule ".concat(u)), o.push(r), u += 1, i = { chains: [], operators: [] }, r.groups.push(i);
      var h;
      for (m = 0, v = (h = (d = l(++c)).substr(11, 69).split(",")).length; m < v; ++m) {
        var y;
        (y = h[m].trim()) && i.chains.push(y);
      }
    }
  }
  if (o.length === 0) return [];
  for (var x = { id: Ye.ofStrings(o.map(function(z) {
    return z.id;
  })), details: Ye.ofStrings(o.map(function(z) {
    return z.details;
  })) }, S = [], b = 0, _ = o; b < _.length; b++) for (var C = 0, w = (k = _[b]).groups; C < w.length; C++) {
    var I = w[C];
    S.push({ assembly_id: k.id, oper_expression: I.operators.map(function(z) {
      return z.id;
    }).join(","), asym_id_list: I.chains.join(",") });
  }
  for (var M = { assembly_id: Ye.ofStrings(S.map(function(z) {
    return z.assembly_id;
  })), oper_expression: Ye.ofStrings(S.map(function(z) {
    return z.oper_expression;
  })), asym_id_list: Ye.ofStrings(S.map(function(z) {
    return z.asym_id_list;
  })) }, E = [], T = 0, P = o; T < P.length; T++) for (var k, D = 0, B = (k = P[T]).groups; D < B.length; D++) for (var L = 0, F = B[D].operators; L < F.length; L++) {
    var V = F[L], G = { id: "" + V.id, type: "?", name: "?", symmetry_operation: "?" };
    for (c = 0; c < 3; c++) {
      for (m = 0; m < 3; m++) G["matrix[".concat(c + 1, "][").concat(m + 1, "]")] = "" + ne.getValue(V.matrix, c, m);
      G["vector[".concat(c + 1, "]")] = "" + ne.getValue(V.matrix, c, 3);
    }
    E.push(G);
  }
  var H = { id: Ye.ofStrings(E.map(function(z) {
    return z.id;
  })), type: Ye.ofStrings(E.map(function(z) {
    return z.type;
  })), name: Ye.ofStrings(E.map(function(z) {
    return z.name;
  })), symmetry_operation: Ye.ofStrings(E.map(function(z) {
    return z.symmetry_operation;
  })) }, q = function(z) {
    for (var K = function(X) {
      var W = "matrix[".concat(z + 1, "][").concat(X + 1, "]");
      H[W] = Ye.ofStrings(E.map(function(J) {
        return J[W];
      }));
    }, Y = 0; Y < 3; Y++) K(Y);
    var Z = "vector[".concat(z + 1, "]");
    H[Z] = Ye.ofStrings(E.map(function(X) {
      return X[Z];
    }));
  };
  for (c = 0; c < 3; c++) q(c);
  return [Xi.ofFields("pdbx_struct_assembly", x), Xi.ofFields("pdbx_struct_assembly_gen", M), Xi.ofFields("pdbx_struct_oper_list", H)];
}
function RZ(e, t, n) {
  for (var r, i = [], a = function(y) {
    return e.data.substring(e.indices[2 * y], e.indices[2 * y + 1]);
  }, o = t; o < n; o++) {
    var s = a(o), u = s.split(/\s+/);
    (g = parseInt(s[5]) - 1) === 0 && (r = ne.identity(), i.push(r)), ne.setValue(r, g, 0, parseFloat(u[2])), ne.setValue(r, g, 1, parseFloat(u[3])), ne.setValue(r, g, 2, parseFloat(u[4])), ne.setValue(r, g, 3, parseFloat(u[5]));
  }
  if (i.length === 0) return [];
  for (var l = [], c = 1, d = 0, f = i; d < f.length; d++) {
    var p = f[d], g = { id: "ncsop" + c++, code: ".", details: "." };
    for (o = 0; o < 3; o++) {
      for (var m = 0; m < 3; m++) g["matrix[".concat(o + 1, "][").concat(m + 1, "]")] = "" + ne.getValue(p, o, m);
      g["vector[".concat(o + 1, "]")] = "" + ne.getValue(p, o, 3);
    }
    l.push(g);
  }
  var v = { id: Ye.ofStrings(l.map(function(y) {
    return y.id;
  })), code: Ye.ofStrings(l.map(function(y) {
    return y.code;
  })), details: Ye.ofStrings(l.map(function(y) {
    return y.details;
  })) }, h = function(y) {
    for (var x = function(_) {
      var C = "matrix[".concat(y + 1, "][").concat(_ + 1, "]");
      v[C] = Ye.ofStrings(l.map(function(w) {
        return w[C];
      }));
    }, S = 0; S < 3; S++) x(S);
    var b = "vector[".concat(y + 1, "]");
    v[b] = Ye.ofStrings(l.map(function(_) {
      return _[b];
    }));
  };
  for (o = 0; o < 3; o++) h(o);
  return [Xi.ofFields("struct_ncs_oper", v)];
}
var LZ = { 1: "HELX_RH_AL_P", 2: "HELX_RH_OM_P", 3: "HELX_RH_PI_P", 4: "HELX_RH_GA_P", 5: "HELX_RH_3T_P", 6: "HELX_LH_AL_P", 7: "HELX_LH_OM_P", 8: "HELX_LH_GA_P", 9: "HELX_RH_27_P", 10: "HELX_RH_PP_P" };
function NZ(e, t, n) {
  for (var r = [], i = function(f) {
    return e.data.substring(e.indices[2 * f], e.indices[2 * f + 1]);
  }, a = t; a < n; a++) {
    var o = i(a);
    r.push({ serNum: o.substr(7, 3).trim(), helixID: o.substr(11, 3).trim(), initResName: o.substr(15, 3).trim(), initChainID: o.substr(19, 1).trim(), initSeqNum: o.substr(21, 4).trim(), initICode: o.substr(25, 1).trim(), endResName: o.substr(27, 3).trim(), endChainID: o.substr(31, 3).trim(), endSeqNum: o.substr(33, 4).trim(), endICode: o.substr(37, 1).trim(), helixClass: o.substr(38, 2).trim(), comment: o.substr(40, 30).trim(), length: o.substr(71, 5).trim() });
  }
  var s = Ye.ofStrings(r.map(function(f) {
    return f.initChainID;
  })), u = Ye.ofStrings(r.map(function(f) {
    return f.initResName;
  })), l = Ye.ofStrings(r.map(function(f) {
    return f.endChainID;
  })), c = Ye.ofStrings(r.map(function(f) {
    return f.endResName;
  })), d = { beg_label_asym_id: s, beg_label_comp_id: u, beg_label_seq_id: Ye.ofUndefined(r.length, Q.Schema.int), beg_auth_asym_id: s, beg_auth_comp_id: u, beg_auth_seq_id: Ye.ofStrings(r.map(function(f) {
    return f.initSeqNum;
  })), conf_type_id: Ye.ofStrings(r.map(function(f) {
    return function(p) {
      return LZ[p] || "HELX_P";
    }(f.helixClass);
  })), details: Ye.ofStrings(r.map(function(f) {
    return f.comment;
  })), end_label_asym_id: l, end_label_comp_id: c, end_label_seq_id: Ye.ofUndefined(r.length, Q.Schema.int), end_auth_asym_id: l, end_auth_comp_id: c, end_auth_seq_id: Ye.ofStrings(r.map(function(f) {
    return f.endSeqNum;
  })), id: Ye.ofStrings(r.map(function(f) {
    return f.serNum;
  })), pdbx_beg_PDB_ins_code: Ye.ofStrings(r.map(function(f) {
    return f.initICode;
  })), pdbx_end_PDB_ins_code: Ye.ofStrings(r.map(function(f) {
    return f.endICode;
  })), pdbx_PDB_helix_class: Ye.ofStrings(r.map(function(f) {
    return f.helixClass;
  })), pdbx_PDB_helix_length: Ye.ofStrings(r.map(function(f) {
    return f.length;
  })), pdbx_PDB_helix_id: Ye.ofStrings(r.map(function(f) {
    return f.helixID;
  })) };
  return Xi.ofFields("struct_conf", d);
}
function FZ(e, t, n) {
  for (var r = [], i = function(g) {
    return e.data.substring(e.indices[2 * g], e.indices[2 * g + 1]);
  }, a = t; a < n; a++) {
    var o = i(a);
    r.push({ strand: o.substr(7, 3).trim(), sheetID: o.substr(11, 3).trim(), numStrands: o.substr(14, 2).trim(), initResName: o.substr(17, 3).trim(), initChainID: o.substr(21, 1).trim(), initSeqNum: o.substr(22, 4).trim(), initICode: o.substr(26, 1).trim(), endResName: o.substr(28, 3).trim(), endChainID: o.substr(32, 1).trim(), endSeqNum: o.substr(33, 4).trim(), endICode: o.substr(37, 1).trim(), sense: o.substr(38, 2).trim(), curAtom: o.substr(41, 4).trim(), curResName: o.substr(45, 3).trim(), curChainId: o.substr(49, 1).trim(), curResSeq: o.substr(50, 4).trim(), curICode: o.substr(54, 1).trim(), prevAtom: o.substr(56, 4).trim(), prevResName: o.substr(60, 3).trim(), prevChainId: o.substr(64, 1).trim(), prevResSeq: o.substr(65, 4).trim(), prevICode: o.substr(69, 1).trim() });
  }
  var s = Ye.ofStrings(r.map(function(g) {
    return g.initChainID;
  })), u = Ye.ofStrings(r.map(function(g) {
    return g.initResName;
  })), l = Ye.ofStrings(r.map(function(g) {
    return g.initSeqNum;
  })), c = Ye.ofStrings(r.map(function(g) {
    return g.endChainID;
  })), d = Ye.ofStrings(r.map(function(g) {
    return g.endResName;
  })), f = Ye.ofStrings(r.map(function(g) {
    return g.endSeqNum;
  })), p = { beg_label_asym_id: s, beg_label_comp_id: u, beg_label_seq_id: l, beg_auth_asym_id: s, beg_auth_comp_id: u, beg_auth_seq_id: l, end_label_asym_id: c, end_label_comp_id: c, end_label_seq_id: f, end_auth_asym_id: c, end_auth_comp_id: d, end_auth_seq_id: f, id: Ye.ofStrings(r.map(function(g) {
    return g.strand;
  })), sheet_id: Ye.ofStrings(r.map(function(g) {
    return g.sheetID;
  })), pdbx_beg_PDB_ins_code: Ye.ofStrings(r.map(function(g) {
    return g.initICode;
  })), pdbx_end_PDB_ins_code: Ye.ofStrings(r.map(function(g) {
    return g.endICode;
  })) };
  return Xi.ofFields("struct_sheet_range", p);
}
var VZ = { MOL_ID: "", MOLECULE: "", CHAIN: "", FRAGMENT: "", SYNONYM: "", EC: "", ENGINEERED: "", MUTATION: "", OTHER_DETAILS: "" };
function GZ(e, t, n) {
  for (var r, i = function(x) {
    return e.data.substring(e.indices[2 * x], e.indices[2 * x + 1]);
  }, a = { chains: [], description: "" }, o = [], s = t; s < n; s++) {
    var u = i(s).substr(10, 70).trim(), l = u.indexOf(":"), c = u.substring(0, l), d = void 0;
    c in VZ ? (r = c, d = u.substring(l + 2)) : d = u, d = d.replace(/;$/, ""), r === "MOL_ID" ? (a = { chains: [], description: "" }, o.push(a)) : r === "MOLECULE" ? (a.description && (a.description += " "), a.description += d) : r === "CHAIN" && Array.prototype.push.apply(a.chains, d.split(/\s*,\s*/));
  }
  for (var f = [], p = 0, g = o; p < g.length; p++) for (var m = g[p], v = 0, h = m.chains; v < h.length; v++) {
    var y = h[v];
    f.push({ description: m.description, chains: [y] });
  }
  return f;
}
function zZ(e, t, n) {
  for (var r = function(l) {
    return e.data.substring(e.indices[2 * l], e.indices[2 * l + 1]);
  }, i = /* @__PURE__ */ new Map(), a = t; a < n; a++) {
    var o = r(a), s = o.substr(11, 3).trim(), u = o.substr(15).trim();
    i.has(s) ? i.set(s, "".concat(i.get(s), " ").concat(u)) : i.set(s, u);
  }
  return i;
}
var UZ = [/* @__PURE__ */ new Set(["CA"]), /* @__PURE__ */ new Set(["C"]), /* @__PURE__ */ new Set(["N"])], HZ = [/* @__PURE__ */ new Set(["P", "O3'", "O3*"]), /* @__PURE__ */ new Set(["C4'", "C4*"]), /* @__PURE__ */ new Set(["O2'", "O2*", "F2'", "F2*"])], qZ = [/* @__PURE__ */ new Set(["P", "O3'", "O3*"]), /* @__PURE__ */ new Set(["C3'", "C3*"]), /* @__PURE__ */ new Set(["O2'", "O2*", "F2'", "F2*"])], jZ = /* @__PURE__ */ new Set(["FMN", "NCN", "FNS", "FMA", "ATP", "ADP", "AMP", "GTP", "GDP", "GMP"]), vw = function() {
  var e = /* @__PURE__ */ new Map();
  return [{ id: "HIS", name: "HISTIDINE", type: "L-peptide linking" }, { id: "ARG", name: "ARGININE", type: "L-peptide linking" }, { id: "LYS", name: "LYSINE", type: "L-peptide linking" }, { id: "ILE", name: "ISOLEUCINE", type: "L-peptide linking" }, { id: "PHE", name: "PHENYLALANINE", type: "L-peptide linking" }, { id: "LEU", name: "LEUCINE", type: "L-peptide linking" }, { id: "TRP", name: "TRYPTOPHAN", type: "L-peptide linking" }, { id: "ALA", name: "ALANINE", type: "L-peptide linking" }, { id: "MET", name: "METHIONINE", type: "L-peptide linking" }, { id: "CYS", name: "CYSTEINE", type: "L-peptide linking" }, { id: "ASN", name: "ASPARAGINE", type: "L-peptide linking" }, { id: "VAL", name: "VALINE", type: "L-peptide linking" }, { id: "GLY", name: "GLYCINE", type: "peptide linking" }, { id: "SER", name: "SERINE", type: "L-peptide linking" }, { id: "GLN", name: "GLUTAMINE", type: "L-peptide linking" }, { id: "TYR", name: "TYROSINE", type: "L-peptide linking" }, { id: "ASP", name: "ASPARTIC ACID", type: "L-peptide linking" }, { id: "GLU", name: "GLUTAMIC ACID", type: "L-peptide linking" }, { id: "THR", name: "THREONINE", type: "L-peptide linking" }, { id: "PRO", name: "PROLINE", type: "L-peptide linking" }, { id: "SEC", name: "SELENOCYSTEINE", type: "L-peptide linking" }, { id: "PYL", name: "PYRROLYSINE", type: "L-peptide linking" }, { id: "MSE", name: "SELENOMETHIONINE", type: "L-peptide linking" }, { id: "SEP", name: "PHOSPHOSERINE", type: "L-peptide linking" }, { id: "TPO", name: "PHOSPHOTHREONINE", type: "L-peptide linking" }, { id: "PTR", name: "O-PHOSPHOTYROSINE", type: "L-peptide linking" }, { id: "PCA", name: "PYROGLUTAMIC ACID", type: "L-peptide linking" }, { id: "A", name: "ADENOSINE-5'-MONOPHOSPHATE", type: "RNA linking" }, { id: "C", name: "CYTIDINE-5'-MONOPHOSPHATE", type: "RNA linking" }, { id: "T", name: "THYMIDINE-5'-MONOPHOSPHATE", type: "RNA linking" }, { id: "G", name: "GUANOSINE-5'-MONOPHOSPHATE", type: "RNA linking" }, { id: "I", name: "INOSINIC ACID", type: "RNA linking" }, { id: "U", name: "URIDINE-5'-MONOPHOSPHATE", type: "RNA linking" }, { id: "DA", name: "2'-DEOXYADENOSINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "DC", name: "2'-DEOXYCYTIDINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "DT", name: "THYMIDINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "DG", name: "2'-DEOXYGUANOSINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "DI", name: "2'-DEOXYINOSINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "DU", name: "2'-DEOXYURIDINE-5'-MONOPHOSPHATE", type: "DNA linking" }, { id: "ACE", name: "Acetylgroup", type: "peptide linking" }, { id: "NME", name: "Methylamine", type: "peptide linking" }].forEach(function(t) {
    return e.set(t.id, t);
  }), e;
}(), yw = function() {
  var e = /* @__PURE__ */ new Map();
  return [{ id: "ZN2", name: "ZINC ION", type: "Ion" }, { id: "SOD", name: "SODIUM ION", type: "Ion" }, { id: "CES", name: "CESIUM ION", type: "Ion" }, { id: "CLA", name: "CHLORIDE ION", type: "Ion" }, { id: "CAL", name: "CALCIUM ION", type: "Ion" }, { id: "POT", name: "POTASSIUM ION", type: "Ion" }].forEach(function(t) {
    return e.set(t.id, t);
  }), e;
}(), Lf = function() {
  function e(t, n) {
    this.seqId = t, this.atomId = n, this.namesMap = /* @__PURE__ */ new Map(), this.comps = /* @__PURE__ */ new Map(), this.ids = [], this.names = [], this.types = [], this.mon_nstd_flags = [];
  }
  return e.prototype.set = function(t) {
    this.comps.set(t.id, t), this.ids.push(t.id), this.names.push(t.name), this.types.push(t.type), this.mon_nstd_flags.push(z6.has(t.id) ? "y" : "n");
  }, e.prototype.getAtomIds = function(t) {
    for (var n = /* @__PURE__ */ new Set(), r = this.seqId.value(t); t < this.seqId.rowCount && this.seqId.value(t) === r; )
      n.add(this.atomId.value(t)), t += 1;
    return n;
  }, e.prototype.hasAtomIds = function(t, n) {
    for (var r = 0, i = n.length; r < i; ++r) if (!ka.areIntersecting(t, n[r])) return !1;
    return !0;
  }, e.prototype.getType = function(t) {
    return this.hasAtomIds(t, UZ) ? "peptide linking" : this.hasAtomIds(t, HZ) ? "RNA linking" : this.hasAtomIds(t, qZ) ? "DNA linking" : "other";
  }, e.prototype.has = function(t) {
    return this.comps.has(t);
  }, e.prototype.get = function(t) {
    return this.comps.get(t);
  }, e.prototype.add = function(t, n) {
    if (!this.has(t)) if (vw.has(t)) this.set(vw.get(t));
    else if (Lm.has(t)) this.set({ id: t, name: "WATER", type: "non-polymer" });
    else if (jZ.has(t.toUpperCase())) this.set({ id: t, name: this.namesMap.get(t) || t, type: "non-polymer" });
    else if ($c.has(t.toUpperCase())) this.set({ id: t, name: this.namesMap.get(t) || t, type: "saccharide" });
    else {
      var r = this.getAtomIds(n);
      if (r.size === 1 && yw.has(t)) this.set(yw.get(t));
      else {
        var i = this.getType(r);
        this.set({ id: t, name: this.namesMap.get(t) || t, type: i });
      }
    }
    return this.get(t);
  }, e.prototype.getChemCompTable = function() {
    return On.ofPartialColumns(Ka.chem_comp, { id: Q.ofStringArray(this.ids), name: Q.ofStringArray(this.names), type: Q.ofStringAliasArray(this.types), mon_nstd_flag: Q.ofStringAliasArray(this.mon_nstd_flags) }, this.ids.length);
  }, e.prototype.setNames = function(t) {
    var n = this;
    t.forEach(function(r) {
      return n.namesMap.set(r[0], r[1]);
    });
  }, e;
}(), Nf = function() {
  function e() {
    this.count = 0, this.ids = [], this.types = [], this.descriptions = [], this.compoundsMap = /* @__PURE__ */ new Map(), this.namesMap = /* @__PURE__ */ new Map(), this.heteroMap = /* @__PURE__ */ new Map(), this.chainMap = /* @__PURE__ */ new Map();
  }
  return e.prototype.set = function(t, n) {
    this.count += 1, this.ids.push("".concat(this.count)), this.types.push(t), this.descriptions.push([n]);
  }, e.prototype.getEntityId = function(t, n, r, i) {
    return n === 2 ? (this.waterId === void 0 && (this.set("water", (i == null ? void 0 : i.customName) || "Water"), this.waterId = "".concat(this.count)), this.waterId) : U6(n) ? this.compoundsMap.has(r) ? this.compoundsMap.get(r) : (this.chainMap.has(r) || (this.set("polymer", (i == null ? void 0 : i.customName) || "Polymer ".concat(this.chainMap.size + 1)), this.chainMap.set(r, "".concat(this.count))), this.chainMap.get(r)) : (this.heteroMap.has(t) || (this.set("non-polymer", (i == null ? void 0 : i.customName) || this.namesMap.get(t) || t), this.heteroMap.set(t, "".concat(this.count))), this.heteroMap.get(t));
  }, e.prototype.getEntityTable = function() {
    return On.ofPartialColumns(Ka.entity, { id: Q.ofStringArray(this.ids), type: Q.ofStringAliasArray(this.types), pdbx_description: Q.ofStringListArray(this.descriptions) }, this.count);
  }, e.prototype.setCompounds = function(t) {
    for (var n = 0, r = t.length; n < r; ++n) {
      var i = t[n], a = i.chains, o = i.description;
      this.set("polymer", o);
      for (var s = 0, u = a.length; s < u; ++s) this.compoundsMap.set(a[s], "".concat(this.count));
    }
  }, e.prototype.setNames = function(t) {
    var n = this;
    t.forEach(function(r) {
      return n.namesMap.set(r[0], r[1]);
    });
  }, e;
}();
function Sv(e, t, n, r) {
  for (var i = n, a = r - 1, o = t.charCodeAt(i); (o === 32 || o >= 48 && o <= 57) && i <= a; ) o = t.charCodeAt(++i);
  for (o = t.charCodeAt(a); (o === 32 || o >= 48 && o <= 57) && a >= i; ) o = t.charCodeAt(--a);
  if (i === ++a || i + 1 === a) return We.add(e, i, a);
  if (o = t.charCodeAt(i), i + 2 === a) {
    var s = t.charCodeAt(i + 1);
    if (!((o !== 78 && o !== 110 || s !== 65 && s !== 97) && (o !== 67 && o !== 99 || s !== 76 && s !== 108) && (o !== 70 && o !== 102 || s !== 69 && s !== 101) && (o !== 83 && o !== 115 || s !== 73 && s !== 105) && (o !== 66 && o !== 98 || s !== 82 && s !== 114) && (o !== 65 && o !== 97 || s !== 83 && s !== 115))) return We.add(e, i, i + 2);
  }
  if (o === 67 || o === 99 || o === 72 || o === 104 || o === 78 || o === 110 || o === 79 || o === 111 || o === 80 || o === 112 || o === 83 || o === 115) return We.add(e, i, i + 1);
  We.add(e, i, i);
}
var f_, KZ = /* @__PURE__ */ new Set(["NA", "CL", "FE", "SI", "BR", "AS", "LI"]), YZ = /* @__PURE__ */ new Set(["C", "H", "N", "O", "P", "S", "F", "B"]), WZ = /^[\s\d]+|[\s\d]+$/g;
function g8(e, t) {
  var n = (e = e.replace(WZ, "").toUpperCase()).length;
  if (n === 0 || n === 1 || KZ.has(e)) return e;
  if (n === 3 && t === e) {
    if (e === "SOD") return "NA";
    if (e === "POT") return "K";
    if (e === "CES") return "CS";
    if (e === "CAL") return "CA";
    if (e === "CLA") return "CL";
  }
  return YZ.has(e[0]) ? e[0] : e;
}
function bw(e, t, n, r, i, a) {
  var o = n.data, s = i - r;
  We.addToken(e.group_PDB, je.trim(n, r, r + 6)), je.trim(n, r + 6, r + 11), e.id[e.index] = n.data.substring(n.tokenStart, n.tokenEnd), We.addToken(e.auth_atom_id, je.trim(n, r + 12, r + 16)), o.charCodeAt(r + 16) === 32 ? We.add(e.label_alt_id, 0, 0) : We.add(e.label_alt_id, r + 16, r + 17), We.addToken(e.auth_comp_id, je.trim(n, r + 17, r + 20)), We.add(e.auth_asym_id, r + 21, r + 22), We.addToken(e.auth_seq_id, je.trim(n, r + 22, r + 26)), o.charCodeAt(r + 26) === 32 ? We.add(e.pdbx_PDB_ins_code, 0, 0) : We.add(e.pdbx_PDB_ins_code, r + 26, r + 27), We.addToken(e.Cartn_x, je.trim(n, r + 30, r + 38)), We.addToken(e.Cartn_y, je.trim(n, r + 38, r + 46)), We.addToken(e.Cartn_z, je.trim(n, r + 46, r + 54)), We.addToken(e.occupancy, je.trim(n, r + 54, r + 60)), s >= 66 ? We.addToken(e.B_iso_or_equiv, je.trim(n, r + 60, r + 66)) : We.add(e.B_iso_or_equiv, 0, 0), a && We.addToken(e.partial_charge, je.trim(n, r + 70, r + 76)), s >= 78 && !a ? (je.trim(n, r + 76, r + 78), n.tokenStart < n.tokenEnd ? We.addToken(e.type_symbol, n) : Sv(e.type_symbol, o, r + 12, r + 16)) : Sv(e.type_symbol, o, r + 12, r + 16), s >= 82 && We.addToken(e.pdbx_formal_charge, je.trim(n, r + 78, r + 82)), s >= 84 && We.addToken(e.cdr, je.trim(n, r + 82, r + 84)), s >= 90 && We.addToken(e.em_confidence, je.trim(n, r + 84, r + 90)), e.pdbx_PDB_model_num[e.index] = t, e.index++;
}
function XZ(e) {
  var t = Ye.ofTokens(e.pdbx_auth_seq_id), n = Ye.ofTokens(e.pdbx_auth_comp_id), r = Ye.ofTokens(e.pdbx_auth_asym_id), i = Ye.ofTokens(e.pdbx_auth_atom_id), a = { id: Ye.ofStrings(e.id), type_symbol: Ye.ofTokens(e.type_symbol), pdbx_label_atom_id: i, pdbx_label_alt_id: Ye.ofTokens(e.pdbx_label_alt_id), pdbx_label_comp_id: n, pdbx_label_asym_id: r, pdbx_label_seq_id: t, pdbx_PDB_ins_code: Ye.ofTokens(e.pdbx_PDB_ins_code), pdbx_auth_seq_id: t, pdbx_auth_comp_id: n, pdbx_auth_asym_id: r, pdbx_auth_atom_id: i };
  return a["U[1][1]"] = Ye.ofNumbers(e["U[1][1]"]), a["U[2][2]"] = Ye.ofNumbers(e["U[2][2]"]), a["U[3][3]"] = Ye.ofNumbers(e["U[3][3]"]), a["U[1][2]"] = Ye.ofNumbers(e["U[1][2]"]), a["U[1][3]"] = Ye.ofNumbers(e["U[1][3]"]), a["U[2][3]"] = Ye.ofNumbers(e["U[2][3]"]), a;
}
function ZZ(e, t, n, r, i) {
  var a = n.data, o = i - r;
  je.trim(n, r + 6, r + 11), e.id[e.index] = a.substring(n.tokenStart, n.tokenEnd), We.addToken(e.pdbx_auth_atom_id, je.trim(n, r + 12, r + 16)), a.charCodeAt(r + 16) === 32 ? We.add(e.pdbx_label_alt_id, 0, 0) : We.add(e.pdbx_label_alt_id, r + 16, r + 17), We.addToken(e.pdbx_auth_comp_id, je.trim(n, r + 17, r + 20)), We.add(e.pdbx_auth_asym_id, r + 21, r + 22), We.addToken(e.pdbx_auth_seq_id, je.trim(n, r + 22, r + 26)), a.charCodeAt(r + 26) === 32 ? We.add(e.pdbx_PDB_ins_code, 0, 0) : We.add(e.pdbx_PDB_ins_code, r + 26, r + 27), e["U[1][1]"][e.index] = Hd(a, r + 28, r + 35) / 1e4, e["U[2][2]"][e.index] = Hd(a, r + 35, r + 42) / 1e4, e["U[3][3]"][e.index] = Hd(a, r + 42, r + 49) / 1e4, e["U[1][2]"][e.index] = Hd(a, r + 49, r + 56) / 1e4, e["U[1][3]"][e.index] = Hd(a, r + 56, r + 63) / 1e4, e["U[2][3]"][e.index] = Hd(a, r + 63, r + 70) / 1e4, o >= 78 ? (je.trim(n, r + 76, r + 78), n.tokenStart < n.tokenEnd ? We.addToken(e.type_symbol, n) : Sv(e.type_symbol, a, r + 12, r + 16)) : Sv(e.type_symbol, a, r + 12, r + 16), e.index++;
}
function QZ(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L;
    return ie(this, function(F) {
      for (t = e.lines, n = t.data, r = t.indices, i = je(n), a = !!e.isPdbqt, o = 0, s = 0, I = 0, v = t.count; I < v; I++) switch (h = r[2 * I], y = r[2 * I + 1], n[h]) {
        case "A":
          Ur(n, h, y, "ATOM  ") ? o++ : Ur(n, h, y, "ANISOU") && s++;
          break;
        case "H":
          Ur(n, h, y, "HETATM") && o++;
      }
      for (u = function(z, K) {
        var Y = function() {
          return We.create(z, 2 * K);
        };
        return { index: 0, group_PDB: Y(), id: [], auth_atom_id: Y(), label_alt_id: Y(), auth_comp_id: Y(), auth_asym_id: Y(), auth_seq_id: Y(), pdbx_PDB_ins_code: Y(), Cartn_x: Y(), Cartn_y: Y(), Cartn_z: Y(), occupancy: Y(), B_iso_or_equiv: Y(), type_symbol: Y(), pdbx_PDB_model_num: [], label_entity_id: [], partial_charge: Y(), pdbx_formal_charge: Y(), cdr: Y(), em_confidence: Y() };
      }(n, o), l = function(z, K) {
        var Y = function() {
          return new Float32Array(K);
        }, Z = function() {
          return We.create(z, 2 * K);
        };
        return { index: 0, count: K, id: [], type_symbol: Z(), pdbx_label_atom_id: Z(), pdbx_label_alt_id: Z(), pdbx_label_comp_id: Z(), pdbx_label_asym_id: Z(), pdbx_label_seq_id: Z(), pdbx_PDB_ins_code: Z(), "U[1][1]": Y(), "U[2][2]": Y(), "U[3][3]": Y(), "U[1][2]": Y(), "U[1][3]": Y(), "U[2][3]": Y(), pdbx_auth_seq_id: Z(), pdbx_auth_comp_id: Z(), pdbx_auth_asym_id: Z(), pdbx_auth_atom_id: Z() };
      }(n, s), c = new Nf(), d = [], f = [], p = 0, g = "", m = void 0, I = 0, v = t.count; I < v; I++) switch (h = r[2 * I], y = r[2 * I + 1], n[h]) {
        case "A":
          Ur(n, h, y, "ATOM  ") ? (p || (p++, g = "" + p), bw(u, g, i, h, y, a)) : Ur(n, h, y, "ANISOU") && ZZ(l, 0, i, h, y);
          break;
        case "C":
          if (Ur(n, h, y, "CRYST1")) d.push.apply(d, OZ(e.id || "?", n.substring(h, y)));
          else if (Ur(n, h, y, "CONECT")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "CONECT"); ) x++;
            m ? In && console.log("only single CONECT block allowed, ignoring others") : m = [I, x], I = x - 1;
          } else if (Ur(n, h, y, "COMPND")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "COMPND"); ) x++;
            c.setCompounds(GZ(t, I, x)), I = x - 1;
          }
          break;
        case "H":
          if (Ur(n, h, y, "HETATM")) p || (p++, g = "" + p), bw(u, g, i, h, y, a);
          else if (Ur(n, h, y, "HELIX")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "HELIX"); ) x++;
            d.push(NZ(t, I, x)), I = x - 1;
          } else if (Ur(n, h, y, "HETNAM")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "HETNAM"); ) x++;
            f.push.apply(f, Array.from(zZ(t, I, x).entries())), I = x - 1;
          }
          break;
        case "M":
          if (Ur(n, h, y, "MODEL ") && (p++, g = "" + p), Ur(n, h, y, "MTRIX")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "MTRIX"); ) x++;
            d.push.apply(d, RZ(t, I, x)), I = x - 1;
          }
          break;
        case "O":
          break;
        case "R":
          if (Ur(n, h, y, "REMARK 350")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "REMARK 350"); ) x++;
            d.push.apply(d, BZ(t, I, x)), I = x - 1;
          }
          break;
        case "S":
          if (Ur(n, h, y, "SHEET")) {
            for (x = I + 1; h = r[2 * x], y = r[2 * x + 1], Ur(n, h, y, "SHEET"); ) x++;
            d.push(FZ(t, I, x)), I = x - 1;
          }
      }
      for (S = Q.ofIntTokens(u.auth_seq_id), b = Q.ofStringTokens(u.auth_atom_id), _ = Q.ofStringTokens(u.auth_comp_id), C = Q.ofStringTokens(u.auth_asym_id), (w = new Lf(S, b)).setNames(f), c.setNames(f), I = 0, M = _.rowCount; I < M; ++I) E = _.value(I), T = ah(w.add(E, I).type, E), u.label_entity_id[I] = c.getEntityId(E, T, C.value(I));
      var V, G, H, q;
      for (V = u, G = Ye.ofTokens(V.auth_asym_id), H = Ye.ofTokens(V.auth_atom_id), q = Ye.ofTokens(V.auth_comp_id), P = { auth_asym_id: G, auth_atom_id: H, auth_comp_id: q, auth_seq_id: Ye.ofTokens(V.auth_seq_id), B_iso_or_equiv: Ye.ofTokens(V.B_iso_or_equiv), Cartn_x: Ye.ofTokens(V.Cartn_x), Cartn_y: Ye.ofTokens(V.Cartn_y), Cartn_z: Ye.ofTokens(V.Cartn_z), group_PDB: Ye.ofTokens(V.group_PDB), id: Ye.ofStrings(V.id), label_alt_id: Ye.ofTokens(V.label_alt_id), label_asym_id: G, label_atom_id: H, label_comp_id: q, label_seq_id: Ye.ofUndefined(V.index, Q.Schema.int), label_entity_id: Ye.ofStrings(V.label_entity_id), occupancy: LU(V.occupancy) ? Ye.ofUndefined(V.index, Q.Schema.float) : Ye.ofTokens(V.occupancy), type_symbol: Ye.ofTokens(V.type_symbol), pdbx_PDB_ins_code: Ye.ofTokens(V.pdbx_PDB_ins_code), pdbx_PDB_model_num: Ye.ofStrings(V.pdbx_PDB_model_num), partial_charge: Ye.ofTokens(V.partial_charge), pdbx_formal_charge: Ye.ofTokens(V.pdbx_formal_charge), cdr: Ye.ofTokens(V.cdr), em_confidence: Ye.ofTokens(V.em_confidence) }, m && d.push(function(z, K, Y, Z) {
        for (var X = {}, W = 0, J = Z.id.rowCount; W < J; ++W) X[Z.id.str(W)] = W;
        var $ = function(rt) {
          return z.data.substring(z.indices[2 * rt], z.indices[2 * rt + 1]);
        }, ee = [], ce = [], ae = [], he = [], Oe = [], Ne = [], Ue = [], Ze = [], Se = [], qe = [], Pe = [11, 16, 21, 26], Xe = 1;
        for (W = K; W < Y; W++) {
          var Ke = $(W), de = X[parseInt(Ke.substr(6, 5))], we = {};
          if (de !== void 0) for (var Ie = 0; Ie < 4; ++Ie) {
            var Ee = parseInt(Ke.substr(Pe[Ie], 5));
            if (!Number.isNaN(Ee)) {
              var Le = X[Ee];
              Le !== void 0 && (de > Le || we[Le] === void 0 && (ee.push("covale".concat(Xe)), ce.push("covale"), ae.push(Z.label_asym_id.str(de)), Oe.push(Z.auth_seq_id.int(de)), he.push(Z.label_seq_id.int(de)), Ne.push(Z.label_atom_id.str(de)), Ue.push(Z.label_asym_id.str(Le)), Se.push(Z.auth_seq_id.int(Le)), Ze.push(Z.label_seq_id.int(Le)), qe.push(Z.label_atom_id.str(Le)), Xe += 1));
            }
          }
        }
        var De = { id: Ye.ofStrings(ee), conn_type_id: Ye.ofStrings(ce), ptnr1_label_asym_id: Ye.ofStrings(ae), ptnr1_auth_seq_id: Ye.ofNumbers(Oe), ptnr1_label_seq_id: Ye.ofNumbers(he), ptnr1_label_atom_id: Ye.ofStrings(Ne), ptnr2_label_asym_id: Ye.ofStrings(Ue), ptnr2_label_seq_id: Ye.ofNumbers(Ze), ptnr2_auth_seq_id: Ye.ofNumbers(Se), ptnr2_label_atom_id: Ye.ofStrings(qe) };
        return Xi.ofFields("struct_conn", De);
      }(t, m[0], m[1], P)), k = { entity: Xi.ofTable("entity", c.getEntityTable()), chem_comp: Xi.ofTable("chem_comp", w.getChemCompTable()), atom_site: Xi.ofFields("atom_site", P), atom_site_anisotrop: Xi.ofFields("atom_site_anisotrop", XZ(l)) }, D = 0, B = d; D < B.length; D++) L = B[D], k[L.name] = L;
      return [2, { header: e.id || "PDB", categoryNames: Object.keys(k), categories: k }];
    });
  });
}
function PO(e) {
  var t = this;
  return Xt.create("Parse PDB", function(n) {
    return se(t, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f, p;
      return ie(this, function(g) {
        switch (g.label) {
          case 0:
            return [4, n.update("Converting to mmCIF")];
          case 1:
            return g.sent(), [4, QZ(e)];
          case 2:
            return r = g.sent(), i = ur.fromFrame(r, void 0, f_.create(e)), [4, Ul(pd(i.data.db, !0), i, n)];
          case 3:
            return a = g.sent(), (o = (p = r.categories.atom_site) === null || p === void 0 ? void 0 : p.getField("partial_charge")) && a.frameCount === 1 && (s = a.representative, u = s.atomicHierarchy.atomSourceIndex, l = Q.isIdentity(u), c = l ? void 0 : u.toArray({ array: Int32Array }), d = o.toFloatArray(), f = c ? Q.ofFloatArray(Q.mapToArray(u, function(m) {
              return d[m];
            }, Float32Array)) : Q.ofFloatArray(d), Rl.Provider.set(s, { data: f, type: "GASTEIGER" })), [2, a];
        }
      });
    });
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "pdb";
  }, e.create = function(t) {
    return { kind: "pdb", name: t.id || "", data: t };
  };
})(f_ || (f_ = {}));
var m_, JZ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return e.trim() ? [4, IO(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, PO(t.result).run()];
        case 2:
          return [2, n.sent().frames.map(function(r) {
            return ze.ofModel(r, { dynamicBonds: !0 });
          })];
      }
    });
  });
} };
function $Z(e) {
  switch (e) {
    case 7:
      return -3;
    case 6:
      return -2;
    case 5:
      return -1;
    case 0:
    case 4:
      return 0;
    case 3:
      return 1;
    case 2:
      return 2;
    case 1:
      return 3;
    default:
      return console.error("Value ".concat(e, " is outside the 0-7 range, defaulting to 0.")), 0;
  }
}
function v8(e, t) {
  for (var n = We.create(e.data, 2 * t), r = We.create(e.data, 2 * t), i = We.create(e.data, 2 * t), a = We.create(e.data, 2 * t), o = We.create(e.data, 2 * t), s = 0; s < t; ++s) {
    je.markLine(e);
    var u = e.tokenStart, l = e.position;
    je.trim(e, u, u + 10), We.addUnchecked(n, e.tokenStart, e.tokenEnd), je.trim(e, u + 10, u + 20), We.addUnchecked(r, e.tokenStart, e.tokenEnd), je.trim(e, u + 20, u + 30), We.addUnchecked(i, e.tokenStart, e.tokenEnd), je.trim(e, u + 31, u + 34), We.addUnchecked(a, e.tokenStart, e.tokenEnd), je.trim(e, u + 36, u + 39), We.addUnchecked(o, e.tokenStart, e.tokenEnd), e.position = l;
  }
  return { count: t, x: Fn(n)(Q.Schema.float), y: Fn(r)(Q.Schema.float), z: Fn(i)(Q.Schema.float), type_symbol: Fn(a)(Q.Schema.str), formal_charge: Fn(o)(Q.Schema.int) };
}
function y8(e, t) {
  for (var n = We.create(e.data, 2 * t), r = We.create(e.data, 2 * t), i = We.create(e.data, 2 * t), a = 0; a < t; ++a) {
    je.markLine(e);
    var o = e.tokenStart, s = e.position;
    je.trim(e, o, o + 3), We.addUnchecked(n, e.tokenStart, e.tokenEnd), je.trim(e, o + 3, o + 6), We.addUnchecked(r, e.tokenStart, e.tokenEnd), je.trim(e, o + 6, o + 9), We.addUnchecked(i, e.tokenStart, e.tokenEnd), e.position = s;
  }
  return { count: t, atomIdxA: Fn(n)(Q.Schema.int), atomIdxB: Fn(r)(Q.Schema.int), order: Fn(i)(Q.Schema.int) };
}
function eQ(e, t, n) {
  je.trim(e, t + 6, t + 9);
  for (var r = parseInt(je.getTokenString(e)), i = 0; i < r; ++i) {
    var a = 9 + 8 * i;
    je.trim(e, t + a, t + a + 4);
    var o = je.getTokenString(e);
    n.atomIdx.push(+o), je.trim(e, t + a + 4, t + a + 8);
    var s = je.getTokenString(e);
    n.charge.push(+s);
  }
  je.eatLine(e);
}
function b8(e) {
  for (var t = { atomIdx: [], charge: [] }; e.position < e.length; ) {
    var n = e.position;
    je.trim(e, n + 3, n + 6);
    var r = je.getTokenString(e);
    if (r === "END") break;
    je.eatLine(e), r === "CHG" && eQ(e, n, t);
  }
  return { atomIdx: Q.ofIntArray(t.atomIdx), charge: Q.ofIntArray(t.charge) };
}
function tQ(e) {
  var t = je(e), n = je.readLine(t).trim(), r = je.readLine(t).trim(), i = je.readLine(t).trim(), a = je.readLine(t), o = +a.substr(0, 3), s = +a.substr(3, 3), u = { title: n, program: r, comment: i, atoms: v8(t, o), bonds: y8(t, s), formalCharges: b8(t) };
  return hi.success(u);
}
function nQ(e) {
  var t = this;
  return Xt.create("Parse Mol", function() {
    return se(t, 0, void 0, function() {
      return ie(this, function(n) {
        return [2, tQ(e)];
      });
    });
  });
}
function MO(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x;
    return ie(this, function(S) {
      switch (S.label) {
        case 0:
          if (r = e.atoms, i = e.bonds, a = e.formalCharges, o = Q.ofConst("MOL", e.atoms.count, Q.Schema.str), s = Q.ofConst("A", e.atoms.count, Q.Schema.str), u = Q.asArrayColumn(r.type_symbol), l = Q.ofConst(1, r.count, Q.Schema.int), c = new Int32Array(e.atoms.count), a.atomIdx.rowCount > 0) for (d = 0; d < a.atomIdx.rowCount; d++) c[a.atomIdx.value(d) - 1] = a.charge.value(d);
          else for (d = 0; d < e.atoms.count; d++) c[d] = $Z(r.formal_charge.value(d));
          return f = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: s, auth_atom_id: u, auth_comp_id: o, auth_seq_id: l, Cartn_x: Q.asArrayColumn(r.x, Float32Array), Cartn_y: Q.asArrayColumn(r.y, Float32Array), Cartn_z: Q.asArrayColumn(r.z, Float32Array), id: Q.range(0, r.count - 1), label_asym_id: s, label_atom_id: u, label_comp_id: o, label_seq_id: l, label_entity_id: Q.ofConst("1", r.count, Q.Schema.str), occupancy: Q.ofConst(1, r.count, Q.Schema.float), type_symbol: u, pdbx_PDB_model_num: Q.ofConst(1, r.count, Q.Schema.int), pdbx_formal_charge: Q.ofIntArray(c) }, r.count), (p = new Nf()).setNames([["MOL", "Ligand"]]), p.getEntityId("MOL", 0, "A"), (g = new Lf(l, u)).setNames([["MOL", "Unknown Molecule"]]), g.add("MOL", 0), [4, Ul(pd({ entity: p.getEntityTable(), chem_comp: g.getChemCompTable(), atom_site: f }), t ?? m_.create(e), n)];
        case 1:
          return (m = S.sent()).frameCount > 0 && (v = Q.ofIntArray(Q.mapToArray(i.atomIdxA, function(b) {
            return b - 1;
          }, Int32Array)), h = Q.ofIntArray(Q.mapToArray(i.atomIdxB, function(b) {
            return b - 1;
          }, Int32Array)), y = Q.asArrayColumn(i.order, Int32Array), x = fi.fromData({ pairs: { indexA: v, indexB: h, order: y }, count: r.count }), fi.Provider.set(m.representative, x)), [2, m];
      }
    });
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "mol";
  }, e.create = function(t) {
    return { kind: "mol", name: t.title, data: t };
  };
})(m_ || (m_ = {}));
var rQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return e.trim() ? [4, nQ(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = r.sent()).isError) throw t;
          return [4, (i = t.result, Xt.create("Parse MOL", function(a) {
            return MO(i, void 0, a);
          })).run()];
        case 2:
          return n = r.sent(), [2, [ze.ofModel(n.representative)]];
      }
      var i;
    });
  });
} };
function Ju(e) {
  je.skipWhitespace(e), je.eatValue(e);
}
function $u(e, t) {
  var n = e.position;
  je.skipWhitespace(e), je.eatValue(e), je.trim(e, n, e.position), We.addUnchecked(t, e.tokenStart, e.tokenEnd);
}
var p_, B4 = "$$$$";
function iQ(e) {
  var t = je.readLine(e).trim(), n = je.readLine(e).trim(), r = je.readLine(e).trim(), i = je.readLine(e), a = i.trim().endsWith("V3000"), o = a ? function(g) {
    var m = We.create(g.data, 1), v = We.create(g.data, 1);
    return je.eatLine(g), Ju(g), Ju(g), Ju(g), $u(g, m), $u(g, v), je.eatLine(g), { atomCount: Fn(m)(Q.Schema.int).value(0), bondCount: Fn(v)(Q.Schema.int).value(0) };
  }(e) : function(g) {
    return { atomCount: +g.substr(0, 3), bondCount: +g.substr(3, 3) };
  }(i), s = o.atomCount, u = o.bondCount;
  if (!Number.isNaN(s) && !Number.isNaN(u)) {
    var l = { atomIdx: Q.ofConst(0, s, Q.Schema.int), charge: Q.ofConst(0, s, Q.Schema.int) }, c = a ? function(g, m) {
      for (var v = We.create(g.data, 2 * m), h = We.create(g.data, 2 * m), y = We.create(g.data, 2 * m), x = We.create(g.data, 2 * m), S = 0; S < m; ++S) {
        je.markLine(g), Ju(g), Ju(g), Ju(g);
        var b = g.position;
        $u(g, x), $u(g, v), $u(g, h), $u(g, y), g.position = b;
      }
      return je.eatLine(g), je.eatLine(g), { count: m, x: Fn(v)(Q.Schema.float), y: Fn(h)(Q.Schema.float), z: Fn(y)(Q.Schema.float), type_symbol: Fn(x)(Q.Schema.str), formal_charge: Q.ofConst(0, m, Q.Schema.int) };
    }(e, s) : v8(e, s), d = a ? function(g, m) {
      for (var v = We.create(g.data, 2 * m), h = We.create(g.data, 2 * m), y = We.create(g.data, 2 * m), x = 0; x < m; ++x) {
        je.markLine(g), Ju(g), Ju(g), Ju(g);
        var S = g.position;
        $u(g, y), $u(g, v), $u(g, h), g.position = S;
      }
      return je.eatLine(g), je.eatLine(g), { count: m, atomIdxA: Fn(v)(Q.Schema.float), atomIdxB: Fn(h)(Q.Schema.float), order: Fn(y)(Q.Schema.float) };
    }(e, u) : y8(e, u), f = a ? l : b8(e), p = function(g) {
      for (var m = We.create(g.data, 32), v = We.create(g.data, 32); g.position < g.length; ) {
        var h = je.readLine(g);
        if (h.startsWith(B4)) break;
        if (h && h.startsWith("> ")) {
          We.add(m, g.tokenStart + 2, g.tokenEnd), je.markLine(g);
          for (var y = g.tokenStart, x = g.tokenEnd, S = !1; g.position < g.length; ) {
            var b = je.readLine(g);
            if (!b || b.startsWith(B4) || b.startsWith("> ")) {
              We.add(v, y, x), S = !0;
              break;
            }
            x = g.tokenEnd;
          }
          S || We.add(v, y, x);
        }
      }
      return { dataHeader: Fn(m)(Q.Schema.str), data: Fn(v)(Q.Schema.str) };
    }(e);
    return { molFile: { title: t, program: n, comment: r, atoms: c, bonds: d, formalCharges: f }, dataItems: p };
  }
  for (; e.position < e.length && !je.readLine(e).startsWith(B4); )
    ;
}
function aQ(e) {
  for (var t = je(e), n = []; t.position < t.length; ) {
    var r = iQ(t);
    r && n.push(r);
  }
  return hi.success({ compounds: n });
}
function oQ(e) {
  var t = this;
  return Xt.create("Parse Sdf", function() {
    return se(t, 0, void 0, function() {
      return ie(this, function(n) {
        return [2, aQ(e)];
      });
    });
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "sdf";
  }, e.create = function(t) {
    return { kind: "sdf", name: t.molFile.title, data: t };
  };
})(p_ || (p_ = {}));
var R4, l0, pf = {};
R4 = pf, function() {
  var e = { not_string: /[^s]/, not_bool: /[^t]/, not_type: /[^T]/, not_primitive: /[^v]/, number: /[diefg]/, numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[+-]/ };
  function t(i) {
    return function(a, o) {
      var s, u, l, c, d, f, p, g, m, v = 1, h = a.length, y = "";
      for (u = 0; u < h; u++) if (typeof a[u] == "string") y += a[u];
      else if (typeof a[u] == "object") {
        if ((c = a[u]).keys) for (s = o[v], l = 0; l < c.keys.length; l++) {
          if (s == null) throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"', c.keys[l], c.keys[l - 1]));
          s = s[c.keys[l]];
        }
        else s = c.param_no ? o[c.param_no] : o[v++];
        if (e.not_type.test(c.type) && e.not_primitive.test(c.type) && s instanceof Function && (s = s()), e.numeric_arg.test(c.type) && typeof s != "number" && isNaN(s)) throw new TypeError(t("[sprintf] expecting number but found %T", s));
        switch (e.number.test(c.type) && (g = s >= 0), c.type) {
          case "b":
            s = parseInt(s, 10).toString(2);
            break;
          case "c":
            s = String.fromCharCode(parseInt(s, 10));
            break;
          case "d":
          case "i":
            s = parseInt(s, 10);
            break;
          case "j":
            s = JSON.stringify(s, null, c.width ? parseInt(c.width) : 0);
            break;
          case "e":
            s = c.precision ? parseFloat(s).toExponential(c.precision) : parseFloat(s).toExponential();
            break;
          case "f":
            s = c.precision ? parseFloat(s).toFixed(c.precision) : parseFloat(s);
            break;
          case "g":
            s = c.precision ? String(Number(s.toPrecision(c.precision))) : parseFloat(s);
            break;
          case "o":
            s = (parseInt(s, 10) >>> 0).toString(8);
            break;
          case "s":
            s = String(s), s = c.precision ? s.substring(0, c.precision) : s;
            break;
          case "t":
            s = String(!!s), s = c.precision ? s.substring(0, c.precision) : s;
            break;
          case "T":
            s = Object.prototype.toString.call(s).slice(8, -1).toLowerCase(), s = c.precision ? s.substring(0, c.precision) : s;
            break;
          case "u":
            s = parseInt(s, 10) >>> 0;
            break;
          case "v":
            s = s.valueOf(), s = c.precision ? s.substring(0, c.precision) : s;
            break;
          case "x":
            s = (parseInt(s, 10) >>> 0).toString(16);
            break;
          case "X":
            s = (parseInt(s, 10) >>> 0).toString(16).toUpperCase();
        }
        e.json.test(c.type) ? y += s : (!e.number.test(c.type) || g && !c.sign ? m = "" : (m = g ? "+" : "-", s = s.toString().replace(e.sign, "")), f = c.pad_char ? c.pad_char === "0" ? "0" : c.pad_char.charAt(1) : " ", p = c.width - (m + s).length, d = c.width && p > 0 ? f.repeat(p) : "", y += c.align ? m + s + d : f === "0" ? m + d + s : d + m + s);
      }
      return y;
    }(function(a) {
      if (r[a]) return r[a];
      for (var o, s = a, u = [], l = 0; s; ) {
        if ((o = e.text.exec(s)) !== null) u.push(o[0]);
        else if ((o = e.modulo.exec(s)) !== null) u.push("%");
        else {
          if ((o = e.placeholder.exec(s)) === null) throw new SyntaxError("[sprintf] unexpected placeholder");
          if (o[2]) {
            l |= 1;
            var c = [], d = o[2], f = [];
            if ((f = e.key.exec(d)) === null) throw new SyntaxError("[sprintf] failed to parse named argument key");
            for (c.push(f[1]); (d = d.substring(f[0].length)) !== ""; ) if ((f = e.key_access.exec(d)) !== null) c.push(f[1]);
            else {
              if ((f = e.index_access.exec(d)) === null) throw new SyntaxError("[sprintf] failed to parse named argument key");
              c.push(f[1]);
            }
            o[2] = c;
          } else l |= 2;
          if (l === 3) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
          u.push({ placeholder: o[0], param_no: o[1], keys: o[2], sign: o[3], pad_char: o[4], align: o[5], width: o[6], precision: o[7], type: o[8] });
        }
        s = s.substring(o[0].length);
      }
      return r[a] = u;
    }(i), arguments);
  }
  function n(i, a) {
    return t.apply(null, [i].concat(a || []));
  }
  var r = /* @__PURE__ */ Object.create(null);
  R4.sprintf = t, R4.vsprintf = n, typeof window < "u" && (window.sprintf = t, window.vsprintf = n);
}(), function(e) {
  e.PDB = "chemical/pdb", e.SDF = "chemical/x-mdl-sdf", e.MOL = "chemical/x-mdl-molfile", e.MOL2 = "chemical/x-mol2";
}(l0 || (l0 = {}));
var sQ = ["HEADER", "SOURCE", "AUTHOR", "OBSLTE", "KEYWDS", "REVDAT", "TITLE", "EXPDTA", "SPRSDE", "SPLT", "NUMMDL", "JRNL", "CAVEAT", "MDLTYP", "REMARKS", "COMPND"], uQ = ["DBREF", "DBREF1", "DBREF2", "SEQADV", "SEQRES", "MODRES"], lQ = ["HET   ", "HETNAM", "HETSYN", "FORMUL"], _8 = function(e, t) {
  var n = yo(e);
  return (n == null ? void 0 : n.sourceData.kind) === "mmCIF" ? n.sourceData.data.source.data.lines.data.split(`
`).filter(function(r) {
    for (var i = 0, a = t.length; i < a; i++) if (r.startsWith(t[i])) return !0;
    return !1;
  }) : [];
};
function x8(e, t, n, r) {
  var i, a = [];
  if (((i = e.models[0]) === null || i === void 0 ? void 0 : i.sourceData.kind) === "mmCIF") {
    var o = Re(Re(Re([], sQ, !0), uQ, !0), lQ, !0);
    a.push.apply(a, _8(e, o));
  }
  var s = [];
  t ? s.push.apply(s, Re([], t, !0).sort(function(m, v) {
    return m - v;
  })) : e.units.forEach(function(m) {
    return s.push.apply(s, Re([], m.elements, !0));
  });
  var u = e.units[0], l = [], c = !1, d = !1;
  if (s.forEach(function(m) {
    var v = { elementId: m, group_PDB: u.model.atomicHierarchy.residues.group_PDB.value(u.residueIndex[m]), atom_id: u.model.atomicConformation.atomId.value(m), auth_atom_id: u.model.atomicHierarchy.atoms.auth_atom_id.value(m), label_alt_id: u.model.atomicHierarchy.atoms.label_alt_id.value(m), auth_comp_id: u.model.atomicHierarchy.atoms.label_comp_id.value(m), auth_asym_id: u.model.atomicHierarchy.chains.auth_asym_id.value(u.chainIndex[m]), auth_seq_id: u.model.atomicHierarchy.residues.auth_seq_id.value(u.residueIndex[m]), pdbx_PDB_ins_code: u.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(u.residueIndex[m]), x: u.model.atomicConformation.x[m], y: u.model.atomicConformation.y[m], z: u.model.atomicConformation.z[m], occupancy: u.model.atomicConformation.occupancy.value(m), B_iso_or_equiv: u.model.atomicConformation.B_iso_or_equiv.value(m), type_symbol: N0(u.model.atomicHierarchy.atoms.type_symbol.value(m)), charge: u.model.atomicHierarchy.atoms.pdbx_formal_charge.value(m), em_confidence: u.model.atomicHierarchy.atoms.em_confidence.value(m) };
    l.push(v), v.em_confidence && (c = !0), v.charge && (d = !0);
  }), r) {
    var f = r(l, []), p = f.editedAtomList, g = f.editedBondList;
    return a.push(h_(p, g, n && d, n && c)), a.join(`
`);
  }
  return a.push(h_(l, [], n && d, n && c)), a.join(`
`);
}
function h_(e, t, n, r) {
  var i = "ATOM  %5d %-4s%1s%3s %1s%4d%1s   %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s".concat(n ? "%4.1f" : "%2s  ").concat(r ? "   %5.2f" : ""), a = "HETATM%5d %-4s%1s%3s %1s%4d%1s   %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s".concat(n ? "%4.1f" : "%2s  ").concat(r ? "   %5.2f" : ""), o = "CONECT%5s%5s%5s%5s%5s", s = [], u = [];
  return e.forEach(function(l) {
    var c = l.elementId, d = l.atom_id, f = l.auth_atom_id, p = l.label_alt_id, g = l.auth_comp_id, m = l.auth_asym_id, v = l.auth_seq_id, h = l.pdbx_PDB_ins_code, y = h === void 0 ? " " : h, x = l.x, S = l.y, b = l.z, _ = l.occupancy, C = l.B_iso_or_equiv, w = l.type_symbol, I = l.group_PDB, M = l.charge, E = l.em_confidence, T = I === "HETATM" ? a : i;
    s.push(pf.sprintf(T, d, f, p, g, m, v, y, x, S, b, _, C, " ", w, n ? M : "  ", r ? E : ""));
    var P = [];
    if (t && (t.forEach(function(B) {
      if (B.a !== c || P.includes(B.atom_idB)) {
        if (B.b === c && !P.includes(B.atom_idA)) for (L = 0, F = B.order; L < F; L++) P.push(B.atom_idA);
      } else for (var L = 0, F = B.order; L < F; L++) P.push(B.atom_idB);
    }), P.length > 0)) {
      for (var k = []; P.length > 0; ) {
        var D = P.shift();
        D && k.push(D), k.length === 4 && (u.push(pf.sprintf(o, d, k[0], k[1], k[2], k[3])), k = []);
      }
      k.length > 0 && (u.push(pf.sprintf(o, d, k[0] || "", k[1] || "", k[2] || "", k[3] || "")), k = []);
    }
  }), Re(Re([], s, !0), u, !0).join(`
`);
}
function g_(e, t, n, r, i) {
  var a, o, s, u, l, c;
  i === void 0 && (i = !1);
  var d = [];
  if (e.units.forEach(function(B) {
    return d.push.apply(d, Re([], B.elements, !0));
  }), d.length > 999) return "";
  if (d.length <= 0) {
    if (r) {
      var f = r([], []), p = f.editedAtomList, g = f.editedBondList, m = (a = e == null ? void 0 : e.state.model) !== null && a !== void 0 ? a : e == null ? void 0 : e.state.models[0], v = (o = m == null ? void 0 : m.sourceData) === null || o === void 0 ? void 0 : o.kind, h = xg(p, g);
      return v === "sdf" || v === "mol" ? Re(Re([m.entryId], h.split(`
`).slice(1), !0), ["$$$$"], !1).join(`
`) : "".concat(h, `
$$$$`);
    }
    return "";
  }
  var y = e.units[0], x = [], S = /* @__PURE__ */ new Map();
  d.forEach(function(B) {
    var L;
    x.push({ elementId: B, group_PDB: y.model.atomicHierarchy.residues.group_PDB.value(y.residueIndex[B]), atom_id: y.model.atomicConformation.atomId.value(B), auth_atom_id: y.model.atomicHierarchy.atoms.label_atom_id.value(B), label_alt_id: y.model.atomicHierarchy.atoms.label_alt_id.value(B), auth_comp_id: y.model.atomicHierarchy.atoms.label_comp_id.value(B), auth_asym_id: y.model.atomicHierarchy.chains.auth_asym_id.value(y.chainIndex[B]), auth_seq_id: y.model.atomicHierarchy.residues.auth_seq_id.value(y.residueIndex[B]), pdbx_PDB_ins_code: y.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(y.residueIndex[B]), x: y.model.atomicConformation.x[B], y: y.model.atomicConformation.y[B], z: y.model.atomicConformation.z[B], occupancy: y.model.atomicConformation.occupancy.value(B), B_iso_or_equiv: y.model.atomicConformation.B_iso_or_equiv.value(B), type_symbol: N0(y.model.atomicHierarchy.atoms.type_symbol.value(B)), charge: y.model.atomicHierarchy.atoms.pdbx_formal_charge.value(B) || ((L = Rl.Provider.get(y.model)) === null || L === void 0 ? void 0 : L.data.value(B)) || 0 });
  });
  var b = new Set(t), _ = /* @__PURE__ */ new Map();
  if (i && ((s = e.model) === null || s === void 0 ? void 0 : s.sourceData.kind) === "mmCIF") for (var C = function(B, L) {
    for (var F = e.units[B], V = function(q, z) {
      var K = F.rings.all[F.rings.aromaticRings[q]].map(function(Y) {
        return F.elements[Y];
      });
      K.forEach(function(Y, Z) {
        b.has(Y) && _.set(Y, new Set(Re(Re([], K.slice(0, Z), !0), K.slice(Z + 1), !0)));
      });
    }, G = 0, H = F.rings.aromaticRings.length; G < H; G++) V(G);
  }, w = 0, I = e.units.length; w < I; w++) C(w);
  e.units.forEach(function(B) {
    for (var L, F = 0, V = B.bonds.a.length; F < V; F++) {
      var G = B.elements[B.bonds.a[F]], H = B.elements[B.bonds.b[F]];
      if (d.includes(G) && d.includes(H) && !S.has("".concat(G, "_").concat(H)) && !S.has("".concat(H, "_").concat(G))) {
        var q = i && _.has(G) && (!((L = _.get(G)) === null || L === void 0) && L.has(H)) ? 4 : B.bonds.edgeProps.order[F];
        S.set("".concat(G, "_").concat(H), { a: d.indexOf(G) + 1, b: d.indexOf(H) + 1, order: q });
      }
    }
  });
  var M = [];
  if (((u = e.model) === null || u === void 0 ? void 0 : u.sourceData.kind) === "sdf" && (!((l = e.state.models) === null || l === void 0) && l.length)) for (var E = (c = e.state.models[0]) === null || c === void 0 ? void 0 : c.sourceData.data.dataItems, T = (w = 0, E.data.rowCount); w < T; w++) M.push("> ".concat(E.dataHeader.value(w), `
`).concat(E.data.value(w)));
  if (r) {
    var P = r(x, Array.from(S).map(function(B) {
      return B[1];
    })), k = (p = P.editedAtomList, g = P.editedBondList, xg(p, g));
    return "".concat(k, `
`).concat(M.join(`

`)).concat(M.length ? `

` : "", "$$$$");
  }
  var D = xg(x, Array.from(S).map(function(B) {
    return B[1];
  }));
  return "".concat(D, `
`).concat(M.join(`

`)).concat(M.length ? `

` : "", "$$$$");
}
var xg = function(e, t, n) {
  var r = [];
  return r.push("".concat("", `

`)), r.push(pf.sprintf("%3d%3d  0  0  0  0  0  0  0  0999 V2000", e.length, t.length)), e.forEach(function(i) {
    var a = i.x, o = i.y, s = i.z, u = i.type_symbol, l = i.charge;
    r.push(pf.sprintf("%10.4f%10.4f%10.4f %-2s  0%3d  0  0  0  0  0  0  0  0  0  0", a, o, s, u, function(c) {
      switch (c) {
        case 0:
          return 0;
        case 3:
          return 1;
        case 2:
          return 2;
        case 1:
          return 3;
        case -1:
          return 5;
        case -2:
          return 6;
        case -3:
          return 7;
        default:
          return 0;
      }
    }(l)));
  }), t.forEach(function(i) {
    var a = i.a, o = i.b, s = i.order;
    r.push(pf.sprintf("%3s%3s%3s  0  0  0  0", a, o, s));
  }), r.push("M  END"), r.join(`
`);
}, sp = function(e, t, n, r) {
  return { elementId: -1, group_PDB: "HETATM", atom_id: e, auth_atom_id: t, label_alt_id: "", auth_comp_id: "UNK", auth_asym_id: " ", auth_seq_id: "1", x: parseFloat(n[0].toFixed(3)), y: parseFloat(n[1].toFixed(3)), z: parseFloat(n[2].toFixed(3)), occupancy: "1", B_iso_or_equiv: "0.00", type_symbol: t, charge: r ?? 0 };
}, cQ = function(e, t) {
  var n = [], r = [], i = 1, a = "sdf", o = [], s = [], u = !1, l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), d = e.sort(function(v) {
    var h;
    return ((h = yo(v)) === null || h === void 0 ? void 0 : h.sourceData.kind) === "mmCIF" ? -1 : 1;
  });
  d.forEach(function(v, h) {
    var y;
    v && ((y = yo(v)) === null || y === void 0 ? void 0 : y.sourceData.kind) === "mmCIF" && Array.from(yo(v).properties.structAsymMap.keys()).forEach(function(x) {
      c.set("".concat(h, `
`).concat(x), x), l.has(x) && (u = !0), l.add(x);
    });
  });
  var f = "", p = 1;
  if (c.size > 35) return { format: "pdb", type: l0.PDB, content: "" };
  if (u) l.clear(), Array.from(c.keys()).forEach(function(v, h) {
    var y = 65 + h > 90 ? String.fromCharCode(65 + h) : "".concat(h);
    c.set(v, y), h === c.size - 1 && (f = 65 + h + 1 > 90 ? String.fromCharCode(65 + h + 1) : "".concat(h));
  });
  else {
    for (var g = 65; g < 91 && f === ""; g++) {
      var m = String.fromCharCode(g);
      l.has(m) || (f = m);
    }
    for (g = 48; g < 58 && f === ""; g++)
      m = String.fromCharCode(g), l.has(m) || (f = m);
  }
  return d.forEach(function(v, h) {
    var y;
    if (v) if (((y = yo(v)) === null || y === void 0 ? void 0 : y.sourceData.kind) === "mmCIF") {
      var x = [], S = _8(v, ["HEADER"]);
      x.push.apply(x, S);
      var b = vo(v), _ = v.units[0], C = [];
      b.forEach(function(P) {
        var k, D = _.model.atomicHierarchy.chains.auth_asym_id.value(_.chainIndex[P]), B = { elementId: i, atom_id: "".concat(i), group_PDB: _.model.atomicHierarchy.residues.group_PDB.value(_.residueIndex[P]), auth_atom_id: _.model.atomicHierarchy.atoms.auth_atom_id.value(P), label_alt_id: _.model.atomicHierarchy.atoms.label_alt_id.value(P), auth_comp_id: _.model.atomicHierarchy.atoms.label_comp_id.value(P), auth_asym_id: (k = c.get("".concat(h, `
`).concat(D))) !== null && k !== void 0 ? k : D, auth_seq_id: _.model.atomicHierarchy.residues.auth_seq_id.value(_.residueIndex[P]), pdbx_PDB_ins_code: _.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(_.residueIndex[P]), x: _.model.atomicConformation.x[P], y: _.model.atomicConformation.y[P], z: _.model.atomicConformation.z[P], occupancy: _.model.atomicConformation.occupancy.value(P), B_iso_or_equiv: _.model.atomicConformation.B_iso_or_equiv.value(P), type_symbol: N0(_.model.atomicHierarchy.atoms.type_symbol.value(P)), charge: _.model.atomicHierarchy.atoms.pdbx_formal_charge.value(P) };
        C.push(B), i++;
      });
      var w = /* @__PURE__ */ new Map();
      v.units.forEach(function(P) {
        for (var k = 0, D = P.bonds.a.length; k < D; k++) {
          var B = P.elements[P.bonds.a[k]], L = P.elements[P.bonds.b[k]];
          if (b.includes(B) && b.includes(L) && !w.has("".concat(B, "_").concat(L)) && !w.has("".concat(L, "_").concat(B))) {
            var F = P.bonds.edgeProps.order[k];
            w.set("".concat(B, "_").concat(L), { a: C[b.indexOf(B)].elementId, b: C[b.indexOf(L)].elementId, order: F, atom_idA: C[b.indexOf(B)].atom_id, atom_idB: C[b.indexOf(B)].atom_id });
          }
        }
      }), n.push.apply(n, C), r.push.apply(r, Array.from(w).map(function(P) {
        return P[1];
      })), a = "pdb";
    } else {
      var I = vo(v), M = v.units[0], E = [], T = /* @__PURE__ */ new Map();
      I.forEach(function(P) {
        var k;
        E.push({ elementId: i, group_PDB: "HETATM", atom_id: "".concat(i), auth_atom_id: M.model.atomicHierarchy.atoms.label_atom_id.value(P), label_alt_id: M.model.atomicHierarchy.atoms.label_alt_id.value(P), auth_comp_id: M.model.atomicHierarchy.atoms.label_comp_id.value(P), auth_asym_id: f, auth_seq_id: "".concat(p), pdbx_PDB_ins_code: M.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(M.residueIndex[P]), x: M.model.atomicConformation.x[P], y: M.model.atomicConformation.y[P], z: M.model.atomicConformation.z[P], occupancy: M.model.atomicConformation.occupancy.value(P), B_iso_or_equiv: M.model.atomicConformation.B_iso_or_equiv.value(P), type_symbol: N0(M.model.atomicHierarchy.atoms.type_symbol.value(P)), charge: M.model.atomicHierarchy.atoms.pdbx_formal_charge.value(P) || ((k = Rl.Provider.get(M.model)) === null || k === void 0 ? void 0 : k.data.value(P)) || 0 }), i++;
      }), v.units.forEach(function(P) {
        for (var k = 0, D = P.bonds.a.length; k < D; k++) {
          var B = P.elements[P.bonds.a[k]], L = P.elements[P.bonds.b[k]];
          if (I.includes(B) && I.includes(L) && !T.has("".concat(B, "_").concat(L)) && !T.has("".concat(L, "_").concat(B))) {
            var F = P.bonds.edgeProps.order[k];
            T.set("".concat(B, "_").concat(L), { a: E[I.indexOf(B)].elementId, b: E[I.indexOf(L)].elementId, order: F, atom_idA: E[I.indexOf(B)].atom_id, atom_idB: E[I.indexOf(B)].atom_id });
          }
        }
      }), p++, s.push.apply(s, E), r.push.apply(r, Array.from(T).map(function(P) {
        return P[1];
      }));
    }
  }), o.length === 2 && r.push({ a: o[0], b: o[1], order: 1, atom_idA: "".concat(o[0]), atom_idB: "".concat(o[1]) }), n.push.apply(n, s), a === "pdb" ? { format: "pdb", type: l0.PDB, content: n.length > 99999 ? "" : h_(n, r, !1, !1) } : { format: "sdf", type: l0.SDF, content: n.length > 999 || r.length > 999 ? "" : "".concat(xg(n, r), `
$$$$`) };
}, dQ = function(e, t) {
  switch (t) {
    case pn.Pdb:
      return fQ(e);
    case pn.Sdf:
    case pn.Mol:
      return EO(e);
    default:
      return [e];
  }
}, fQ = function(e) {
  var t = e.split(`
`), n = [], r = [[]], i = 0;
  t.forEach(function(s) {
    switch (s[0]) {
      case "A":
        if (s.startsWith("ATOM")) return void r[i].push(s);
        if (s.startsWith("AUTHER")) return;
        n.push(s);
        break;
      case "C":
        if (s.startsWith("CONECT")) return void r[i].push(s);
        n.push(s);
        break;
      case "E":
        if (s.startsWith("ENDMDL")) return void (r[i].length > 0 && (i++, r.push([])));
        if (s.startsWith("END")) return;
        n.push(s);
        break;
      case "H":
        if (s.startsWith("HETATM")) return void r[i].push(s);
        n.push(s);
        break;
      case "M":
        if (s.startsWith("MODEL")) return void (r[i].length > 0 && (i++, r.push([])));
        if (s.startsWith("MASTER")) return;
        n.push(s);
        break;
      case "R":
        if (s.startsWith("REVDAT")) return;
        n.push(s);
        break;
      case "S":
        if (s.startsWith("SOURCE")) return;
        n.push(s);
        break;
      case "T":
        if (s.startsWith("TER")) return void r[i].push(s);
        n.push(s);
        break;
      default:
        n.push(s);
    }
  });
  var a = n.join(`
`), o = [];
  return r.forEach(function(s) {
    s.length > 0 && o.push("".concat(a).concat(a ? `
` : "").concat(s.join(`
`)));
  }), o;
}, EO = function(e) {
  return e.replace(/\u001a/g, " ").split(/\$\$\$\$\r?\n?/).filter(function(t) {
    return !!t.trim();
  });
}, mQ = function(e) {
  for (var t = e.split(`
`), n = !0, r = !1, i = [], a = [], o = 0, s = t.length; o < s; o++) {
    var u = t[o];
    if (n) {
      if (i.length < 4)
        i.push(u), i.length === 4 && (l = D4(u, TZ)).length > 0 && a.push({ index: o, info: l });
      else if (u.startsWith("M  END")) r = !0, n = !1, i = [];
      else if (!u.startsWith("M") && !u.startsWith("V")) {
        if (u.startsWith("G") || u.startsWith("A")) o++;
        else if (u.slice(4, 5) !== "T" && u.slice(4, 5) !== "F") {
          var l;
          u.length < 34 ? (l = D4(u, EZ)).length > 0 && a.push({ index: o, info: l }) : (l = D4(u, MZ)).length > 0 && a.push({ index: o, info: l });
        }
      }
    } else u.startsWith("$$$$") && (n = !0, i = []);
  }
  return r || a.push({ index: 0, info: [{ start: 0, end: 0 }] }), a;
}, pQ = function(e, t) {
  switch (t) {
    case pn.Sdf:
    case pn.Mol:
      return mQ(e);
    default:
      return [];
  }
}, hQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s, u, l, c;
    return ie(this, function(d) {
      switch (d.label) {
        case 0:
          if (!e.trim()) return [2, [Fu()]];
          t = [], n = EO(e), r = 0, i = n, d.label = 1;
        case 1:
          return r < i.length ? [4, oQ(i[r]).run()] : [3, 7];
        case 2:
          if ((a = d.sent()).isError) throw a;
          o = 0, s = a.result.compounds, d.label = 3;
        case 3:
          return o < s.length ? (u = s[o], [4, (f = u, Xt.create("Parse SDF", function(p) {
            return MO(f.molFile, p_.create(f), p);
          })).run()]) : [3, 6];
        case 4:
          l = d.sent(), c = ze.ofModel(l.representative), t.push(c), d.label = 5;
        case 5:
          return o++, [3, 3];
        case 6:
          return r++, [3, 1];
        case 7:
          return [2, t];
      }
      var f;
    });
  });
} };
function gQ(e) {
  return function(t, n, r) {
    return function(i, a, o, s) {
      var u = i.data, l = i.indices, c = i.count, d = s.valueType, f = d === "str" ? function(p) {
        var g = l[2 * p] + a, m = l[2 * p + 1];
        if (g >= m) return "";
        var v = g + o;
        return v > m && (v = m), function(h, y, x) {
          for (var S = y, b = x - 1, _ = h.charCodeAt(S); (_ === 9 || _ === 32) && S <= b; ) _ = h.charCodeAt(++S);
          for (_ = h.charCodeAt(b); (_ === 9 || _ === 32) && b >= S; ) _ = h.charCodeAt(--b);
          return h.substring(S, b + 1);
        }(u, g, v);
      } : d === "int" ? function(p) {
        var g = l[2 * p] + a;
        return g > l[2 * p + 1] ? 0 : Hd(u, g, g + o);
      } : function(p) {
        var g = l[2 * p] + a;
        return g > l[2 * p + 1] ? 0 : function(m, v, h) {
          for (; v < h && m.charCodeAt(v) === 32; ) v++;
          return sf(m, v, h);
        }(u, g, g + o);
      };
      return { schema: s, __array: void 0, isDefined: !0, rowCount: c, value: f, valueKind: function(p) {
        return 0;
      }, toArray: function(p) {
        return Ri(c, f, p);
      }, areValuesEqual: function(p, g) {
        return f(p) === f(g);
      } };
    }(e, t, n, r);
  };
}
function vQ(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s, u, l, c, d;
    return ie(this, function(f) {
      switch (f.label) {
        case 0:
          return t = e.tokenizer, n = e.numberOfAtoms, [4, je.readLinesAsync(t, n, e.runtimeCtx, 1e5)];
        case 1:
          return r = f.sent(), i = t.data.substring(r.indices[0], r.indices[1]).substring(20), a = i.match(/\.\d+/g), o = a.length === 6, e.header.hasVelocities = o, e.header.precision.position = a[0].length - 1, e.header.precision.velocity = o ? a[3].length - 1 : 0, s = e.header.precision.position + 5, u = 20 + 3 * s, l = e.header.precision.velocity + 4, c = gQ(r), d = Q.Undefined(e.numberOfAtoms, Q.Schema.float), [2, { count: e.numberOfAtoms, residueNumber: c(0, 5, Q.Schema.int), residueName: c(5, 5, Q.Schema.str), atomName: c(10, 5, Q.Schema.str), atomNumber: c(15, 5, Q.Schema.int), x: c(20, s, Q.Schema.float), y: c(20 + s, s, Q.Schema.float), z: c(20 + 2 * s, s, Q.Schema.float), vx: o ? c(u, l, Q.Schema.float) : d, vy: o ? c(u + l, l, Q.Schema.float) : d, vz: o ? c(u + 2 * l, l, Q.Schema.float) : d }];
      }
    });
  });
}
function yQ(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          return n = je(e), [4, t.update({ message: "Parsing...", current: 0, max: e.length })];
        case 1:
          s.sent(), r = [], s.label = 2;
        case 2:
          return n.position < e.length ? (i = /* @__PURE__ */ function(u, l) {
            return { tokenizer: u, header: { title: "", timeInPs: 0, hasVelocities: !1, precision: { position: 0, velocity: 0 }, box: [0, 0, 0] }, numberOfAtoms: 0, runtimeCtx: l };
          }(n, t), function(u) {
            var l = u.tokenizer, c = u.header, d = je.readLine(l);
            d.trim().length === 0 && (d = je.readLine(l));
            var f = d.lastIndexOf("t=");
            f >= 0 ? (c.timeInPs = parseFloat(d.substring(f + 2)), c.title = d.substring(0, f).trim(), c.title && c.title[c.title.length - 1] === "," && (c.title = c.title.substring(0, c.title.length - 1))) : c.title = d;
          }(i), function(u) {
            var l = u.tokenizer;
            je.markLine(l);
            var c = je.getTokenString(l);
            u.numberOfAtoms = parseInt(c);
          }(i), [4, vQ(i)]) : [3, 4];
        case 3:
          return a = s.sent(), function(u) {
            var l = u.tokenizer, c = je.readLine(l).trim().split(/\s+/g);
            u.header.box = [+c[0], +c[1], +c[2]];
          }(i), r.push({ header: i.header, atoms: a }), [3, 2];
        case 4:
          return o = { structures: r }, [2, hi.success(o)];
      }
    });
  });
}
function TO(e) {
  var t = this;
  return Xt.create("Parse GRO", function(n) {
    return se(t, 0, void 0, function() {
      return ie(this, function(r) {
        switch (r.label) {
          case 0:
            return [4, yQ(e, n)];
          case 1:
            return [2, r.sent()];
        }
      });
    });
  });
}
var _w = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", v_, bQ = sD(function(e) {
  for (var t = e, n = 0, r = _w[t % 26]; t >= 26; ) t = Math.floor(t / 26), r += _w[t % 26], n += 1;
  return n >= 5 && console.warn("getChainId overflow"), r;
});
function kO(e) {
  var t = this;
  return Xt.create("Parse GRO", function(n) {
    return se(t, 0, void 0, function() {
      var r, i, a, o, s, u;
      return ie(this, function(l) {
        switch (l.label) {
          case 0:
            r = v_.fromGro(e), i = [], a = 0, o = e.structures.length, l.label = 1;
          case 1:
            return a < o ? (s = function(c, d) {
              for (var f = c.atomName, p = c.residueName, g = new Array(c.count), m = new Array(c.count), v = new Uint32Array(c.count), h = new Uint32Array(c.count), y = new Array(c.count), x = new Nf(), S = new Lf(c.residueNumber, c.atomName), b = "", _ = 0, C = "", w = 0, I = 0, M = -1, E = 0, T = c.count; E < T; ++E) {
                var P = c.residueNumber.value(E);
                if (P !== M) {
                  var k = c.residueName.value(E), D = ah(S.add(k, E).type, k);
                  D === I && (P === M + 1 || M === 99999 && P === 0) || (C = bQ(_), _ += 1, w = 0), b = x.getEntityId(k, D, C), w += 1, M = P, I = D;
                }
                g[E] = b, m[E] = C, v[E] = w, h[E] = E, y[E] = g8(c.atomName.value(E), c.residueName.value(E));
              }
              var B = Q.ofStringArray(m), L = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: B, auth_atom_id: f, auth_comp_id: p, auth_seq_id: c.residueNumber, Cartn_x: Q.ofFloatArray(Q.mapToArray(c.x, function(F) {
                return 10 * F;
              }, Float32Array)), Cartn_y: Q.ofFloatArray(Q.mapToArray(c.y, function(F) {
                return 10 * F;
              }, Float32Array)), Cartn_z: Q.ofFloatArray(Q.mapToArray(c.z, function(F) {
                return 10 * F;
              }, Float32Array)), id: Q.ofIntArray(h), label_asym_id: B, label_atom_id: f, label_comp_id: p, label_seq_id: Q.ofIntArray(v), label_entity_id: Q.ofStringArray(g), occupancy: Q.ofConst(1, c.count, Q.Schema.float), type_symbol: Q.ofStringArray(y), pdbx_PDB_model_num: Q.ofConst(d, c.count, Q.Schema.int) }, c.count);
              return pd({ entity: x.getEntityTable(), chem_comp: S.getChemCompTable(), atom_site: L });
            }(e.structures[a].atoms, a + 1), [4, Ul(s, r, n)]) : [3, 4];
          case 2:
            (u = l.sent()).frameCount === 1 && i.push(u.representative), l.label = 3;
          case 3:
            return ++a, [3, 1];
          case 4:
            return [2, new M0(i)];
        }
      });
    });
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "gro";
  }, e.fromGro = function(t) {
    return { kind: "gro", name: t.structures[0].header.title, data: t };
  };
})(v_ || (v_ = {}));
var Fa, _Q = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, TO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, kO(t.result).run()];
        case 2:
          return [2, n.sent().representative];
      }
    });
  });
} }, u1 = new Uint32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 101, 128, 161, 203, 256, 322, 406, 512, 645, 812, 1024, 1290, 1625, 2048, 2580, 3250, 4096, 5060, 6501, 8192, 10321, 13003, 16384, 20642, 26007, 32768, 41285, 52015, 65536, 82570, 104031, 131072, 165140, 208063, 262144, 330280, 416127, 524287, 660561, 832255, 1048576, 1321122, 1664510, 2097152, 2642245, 3329021, 4194304, 5284491, 6658042, 8388607, 10568983, 13316085, 16777216]), L4 = 9;
function xQ() {
  throw new Error("(xdrfile error) Undefined error.");
}
function CQ(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F;
    return ie(this, function(V) {
      switch (V.label) {
        case 0:
          n = new DataView(t.buffer, t.byteOffset), i = (r = { frames: [], boxes: [], times: [], timeOffset: 0, deltaTime: 0 }).frames, a = r.boxes, o = r.times, s = [0, 0, 0, 0, 0, 0], u = [0, 0, 0], l = [0, 0, 0], c = [0, 0, 0], d = [0.1, 0.1, 0.1], f = [0.1, 0.1, 0.1], p = 0, g = Fa.buf, V.label = 1;
        case 1:
          for (m = void 0, v = n.getInt32(p + 4), p += 12, o.push(n.getFloat32(p)), p += 4, h = new Float32Array(9), P = 0; P < 9; ++P) h[P] = 10 * n.getFloat32(p), p += 4;
          if (a.push(h), v <= 9) for (m = { count: v / 3, x: new Float32Array(v / 3), y: new Float32Array(v / 3), z: new Float32Array(v / 3) }, P = 0; P < v / 3; ++P) m.x[P] = n.getFloat32(p), m.y[P] = n.getFloat32(p), m.z[P] = n.getFloat32(p), p += 4;
          else {
            for (g[0] = g[1] = g[2] = 0, u[0] = u[1] = u[2] = 0, c[0] = c[1] = c[2] = 0, l[0] = l[1] = l[2] = 0, d[0] = d[1] = d[2] = 0, f[0] = f[1] = f[2] = 0, m = { count: v, x: new Float32Array(v), y: new Float32Array(v), z: new Float32Array(v) }, y = 0, x = n.getInt32(p), p += 4, S = n.getFloat32(p), p += 4, s[0] = n.getInt32(p), s[1] = n.getInt32(p + 4), s[2] = n.getInt32(p + 8), s[3] = n.getInt32(p + 12), s[4] = n.getInt32(p + 16), s[5] = n.getInt32(p + 20), u[0] = s[3] - s[0] + 1, u[1] = s[4] - s[1] + 1, u[2] = s[5] - s[2] + 1, p += 24, b = void 0, (u[0] | u[1] | u[2]) > 16777215 ? (l[0] = Fa.sizeOfInt(u[0]), l[1] = Fa.sizeOfInt(u[1]), l[2] = Fa.sizeOfInt(u[2]), b = 0) : b = Fa.sizeOfInts(3, u), _ = n.getInt32(p), p += 4, w = u1[C = L4 > (C = _ - 1) ? L4 : C] / 2 | 0, I = u1[_] / 2 | 0, c[0] = c[1] = c[2] = u1[_], M = 4 * Math.ceil(n.getInt32(p) / 4), p += 4, E = 1 / S, T = 0, P = 0, d[0] = d[1] = d[2] = 0; P < x; ) {
              if (b === 0 ? (d[0] = Fa.decodeBits(t, p, l[0]), d[1] = Fa.decodeBits(t, p, l[1]), d[2] = Fa.decodeBits(t, p, l[2])) : Fa.decodeInts(t, p, b, u, d), P++, d[0] += s[0], d[1] += s[1], d[2] += s[2], f[0] = d[0], f[1] = d[1], f[2] = d[2], k = Fa.decodeBits(t, p, 1), D = 0, k === 1 && (T = Fa.decodeBits(t, p, 5), T -= D = T % 3, D--), T > 0) for (d[0] = d[1] = d[2] = 0, B = 0; B < T; B += 3) Fa.decodeInts(t, p, _, c, d), P++, d[0] += f[0] - I, d[1] += f[1] - I, d[2] += f[2] - I, B === 0 ? (L = d[0], d[0] = f[0], f[0] = L, L = d[1], d[1] = f[1], f[1] = L, L = d[2], d[2] = f[2], f[2] = L, m.x[y] = f[0] * E, m.y[y] = f[1] * E, m.z[y] = f[2] * E, y++) : (f[0] = d[0], f[1] = d[1], f[2] = d[2]), m.x[y] = d[0] * E, m.y[y] = d[1] * E, m.z[y] = d[2] * E, y++;
              else m.x[y] = d[0] * E, m.y[y] = d[1] * E, m.z[y] = d[2] * E, y++;
              _ += D, D < 0 ? (I = w, w = _ > L4 ? u1[_ - 1] / 2 | 0 : 0) : D > 0 && (w = I, I = u1[_] / 2 | 0), c[0] = c[1] = c[2] = u1[_], c[0] !== 0 && c[1] !== 0 && c[2] !== 0 || xQ();
            }
            p += M;
          }
          for (F = 0; F < v; F++) m.x[F] *= 10, m.y[F] *= 10, m.z[F] *= 10;
          return i.push(m), e.shouldUpdate ? [4, e.update({ current: p, max: t.length })] : [3, 3];
        case 2:
          V.sent(), V.label = 3;
        case 3:
          return p >= t.length ? [3, 4] : [3, 1];
        case 4:
          return o.length >= 1 && (r.timeOffset = o[0]), o.length >= 2 && (r.deltaTime = o[1] - o[0]), [2, r];
      }
    });
  });
}
function SQ(e) {
  var t = this;
  return Xt.create("Parse XTC", function(n) {
    return se(t, 0, void 0, function() {
      var r, i;
      return ie(this, function(a) {
        switch (a.label) {
          case 0:
            return a.trys.push([0, 2, , 3]), n.update({ canAbort: !0, message: "Parsing trajectory..." }), [4, CQ(n, e)];
          case 1:
            return r = a.sent(), [2, hi.success(r)];
          case 2:
            return i = a.sent(), [2, hi.error("" + i)];
          case 3:
            return [2];
        }
      });
    });
  });
}
function Av() {
  return Av.empty();
}
function AQ(e) {
  var t = this;
  return Xt.create("Parse XTC", function(n) {
    return se(t, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d;
      return ie(this, function(f) {
        switch (f.label) {
          case 0:
            return [4, n.update("Converting to coordinates")];
          case 1:
            for (f.sent(), r = yy(e.deltaTime, "step"), i = yy(e.timeOffset, r.unit), a = [], o = 0, s = e.frames.length; o < s; ++o) u = e.boxes[o], l = A.fromArray(A(), u, 0), c = A.fromArray(A(), u, 3), d = A.fromArray(A(), u, 6), a.push({ elementCount: e.frames[o].count, cell: Av.fromBasis(l, c, d), x: e.frames[o].x, y: e.frames[o].y, z: e.frames[o].z, xyzOrdering: { isIdentity: !0 }, time: yy(i.value + r.value * o, r.unit) });
            return [2, Xg.create(a, r, i)];
        }
      });
    });
  });
}
(function(e) {
  e.sizeOfInt = function(s) {
    for (var u = 1, l = 0; s >= u && l < 32; ) l++, u <<= 1;
    return l;
  };
  var t = new Uint8Array(32);
  e.sizeOfInts = function(s, u) {
    var l = 1, c = 0;
    t[0] = 1;
    for (var d = 0; d < s; d++) {
      var f = void 0, p = 0;
      for (f = 0; f < l; f++) p += t[f] * u[d], t[f] = 255 & p, p >>= 8;
      for (; p !== 0; ) t[f++] = 255 & p, p >>= 8;
      l = f;
    }
    var g = 1;
    for (l--; t[l] >= g; ) c++, g *= 2;
    return c + 8 * l;
  };
  var n = new ArrayBuffer(24);
  e.buf = new Int32Array(n);
  var r = new Uint32Array(n);
  function i(s, u, l) {
    for (var c = l, d = (1 << c) - 1, f = r[1], p = r[2], g = e.buf[0], m = 0; c >= 8; ) m |= (p = p << 8 | s[u + g++]) >> f << c - 8, c -= 8;
    return c > 0 && (f < c && (f += 8, p = p << 8 | s[u + g++]), m |= p >> (f -= c) & (1 << c) - 1), m &= d, e.buf[0] = g, e.buf[1] = f, e.buf[2] = p, m;
  }
  function a(s, u) {
    var l = r[2], c = e.buf[0];
    return l = l << 8 | s[u + c], e.buf[0] = c + 1, e.buf[2] = l, l >> r[1] & 255;
  }
  e.decodeBits = i;
  var o = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  e.decodeInts = function(s, u, l, c, d) {
    var f = l, p = 0;
    for (o[0] = 0, o[1] = 0, o[2] = 0, o[3] = 0; f > 8; ) o[p++] = a(s, u), f -= 8;
    f > 0 && (o[p++] = i(s, u, f));
    for (var g = 2; g > 0; g--) {
      for (var m = 0, v = c[g], h = p - 1; h >= 0; h--) {
        var y = (m = m << 8 | o[h]) / v | 0;
        o[h] = y, m -= y * v;
      }
      d[g] = m;
    }
    d[0] = o[0] | o[1] << 8 | o[2] << 16 | o[3] << 24;
  };
})(Fa || (Fa = {})), function(e) {
  function t(r, i) {
    return { size: r, anglesInRadians: i };
  }
  function n() {
    return t(A(), A());
  }
  e.create = t, e.empty = n, e.fromBasis = function(r, i, a) {
    var o = A.magnitude(r), s = A.magnitude(i), u = A.magnitude(a), l = Math.acos(A.dot(i, a) / (s * u)), c = Math.acos(A.dot(r, a) / (o * u)), d = Math.acos(A.dot(r, i) / (o * s));
    return o <= 0 || s <= 0 || u <= 0 || l >= Math.PI || c >= Math.PI || d >= Math.PI ? n() : t(A.create(o, s, u), A.create(l, c, d));
  };
}(Av || (Av = {}));
var wQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    return ie(this, function(t) {
      return [2, new Promise(function(n) {
        var r = new FileReader();
        r.onload = function(i) {
          return se(this, 0, void 0, function() {
            var a, o;
            return ie(this, function(s) {
              switch (s.label) {
                case 0:
                  return [4, SQ(new Uint8Array(r.result)).run()];
                case 1:
                  if ((a = s.sent()).isError) throw new Error(a.message);
                  return [4, AQ(a.result).run()];
                case 2:
                  return o = s.sent(), n(o), [2];
              }
            });
          });
        }, r.readAsArrayBuffer(e);
      })];
    });
  });
} };
function DO(e, t, n, r, i, a) {
  var o = e, s = t, u = n, l = Math.cos(r * Math.PI / 180), c = Math.cos(i * Math.PI / 180), d = Math.cos(a * Math.PI / 180), f = Math.sin(r * Math.PI / 180), p = Math.sin(i * Math.PI / 180), g = function() {
    var b = (l * c - d) / (f * p);
    return Math.max(Math.min(b, 1), -1);
  }(), m = Math.acos(g), v = ne.ofRows([[o * p, -s * f * Math.cos(m), 0, 0], [0, s * f * Math.sin(m), 0, 0], [o * c, s * l, u, 0], [0, 0, 0, 1]]), h = ne.invert(ne.zero(), v), y = A.create(v[0], v[4], v[8]), x = A.create(v[1], v[5], v[9]), S = A.create(v[2], v[6], v[10]);
  return { a: e, b: t, c: n, volume: Math.abs(A.dot(y, y)) * n, alpha: r, beta: i, gamma: a, vecA: y, vecB: x, vecC: S, matrix: v, invertMatrix: h };
}
function OO(e, t, n) {
  var r = A.create.apply(null, e), i = A.create.apply(null, t), a = A.create.apply(null, n), o = r[0], s = r[1], u = r[2], l = i[0], c = i[1], d = i[2], f = a[0], p = a[1], g = a[2], m = ne.ofRows([[o, l, f, 0], [s, c, p, 0], [u, d, g, 0], [0, 0, 0, 1]]), v = ne.invert(ne.zero(), m), h = Math.sqrt(Math.abs(A.dot(r, r))), y = Math.sqrt(Math.abs(A.dot(i, i))), x = Math.sqrt(Math.abs(A.dot(a, a))), S = A.angle(i, a) * (180 / Math.PI), b = A.angle(r, a) * (180 / Math.PI), _ = A.angle(r, i) * (180 / Math.PI);
  return { a: h, b: y, c: x, volume: Math.abs(A.dot(r, r)) * x, alpha: S, beta: b, gamma: _, vecA: r, vecB: i, vecC: a, matrix: m, invertMatrix: v };
}
var wv, BO = [];
function IQ(e) {
  je.readLine(e);
  var t = +je.readLine(e);
  je.readLine(e);
  var n = +je.readLine(e);
  isNaN(n) && (n = 0);
  var r = je.readLine(e), i = new Float64Array(3), a = new Float64Array(3), o = new Float64Array(3);
  r.includes("xy xz yz") && function(b, _) {
    var C = _[0], w = _[1], I = _[2], M = _.map(function() {
      return je.readLine(b).trim().split(/\s+/g).map(function($) {
        return Number($);
      });
    }), E = M[0], T = E[0], P = E[1], k = E[2], D = M[1], B = D[0], L = D[1], F = D[2], V = M[2], G = V[0], H = V[1], q = V[2], z = [[T, P], [B, L], [G, H]], K = [k, F, q], Y = [0, K[0], K[1], K[0] + K[1]], Z = [0, K[2]], X = [[Math.min.apply(null, Y), Math.max.apply(null, Y)], [Math.min.apply(null, Z), Math.max.apply(null, Z)], [0, 0]];
    z.forEach(function($, ee) {
      $.forEach(function(ce, ae) {
        z[ee][ae] = ce - X[ee][ae];
      });
    });
    var W = z.map(function($) {
      return $[1] - $[0];
    }), J = [[W[0], 0, 0], [K[0], W[1], 0], [K[1], K[2], W[2]]];
    C[0] = J[0][0], C[1] = J[0][1], C[2] = J[0][2], w[0] = J[1][0], w[1] = J[1][1], w[2] = J[1][2], I[0] = J[2][0], I[1] = J[2][1], I[2] = J[2][2];
  }(e, [i, a, o]);
  var s = function(b, _, C) {
    var w = new Float64Array(_), I = new Float64Array(_), M = new Float64Array(_), E = new Float64Array(_), T = new Float64Array(_), P = [["id", w], ["type", I], ["x", M], ["y", E], ["z", T]];
    P.sort(function(L, F) {
      return C.indexOf(L[0]) - C.indexOf(F[0]);
    });
    for (var k = P.map(function(L) {
      return L[1];
    }), D = function(L) {
      je.readLine(b).trim().split(/\s+/g).forEach(function(F, V) {
        k[V][L] = Number(F);
      });
    }, B = 0; B < _; B++) D(B);
    return [w, I, M, E, T];
  }(e, n, je.readLine(e).replace("ITEM: ATOMS", "").split(/\s+/g)), u = s[0], l = s[1], c = s[2], d = s[3], f = s[4], p = [], g = [];
  l.forEach(function(b) {
    p[b] || (p[b] = BO[b].symbol), g.push(p[b]);
  });
  for (var m = OO(i, a, o), v = new Float64Array(n), h = new Float64Array(n), y = new Float64Array(n), x = 0; x < n; x++) {
    var S = A.create(c[x], d[x], f[x]);
    A.transformMat4(S, S, m.invertMatrix), v[x] = S[0], h[x] = S[1], y[x] = S[2];
  }
  return { count: n, comment: "", x: Q.ofFloatArray(c), y: Q.ofFloatArray(d), z: Q.ofFloatArray(f), type_symbol: Q.ofStringArray(g), cell: m, timestep: t, fractX: Q.ofFloatArray(v), fractY: Q.ofFloatArray(h), fractZ: Q.ofFloatArray(y), id: Q.ofFloatArray(u) };
}
function PQ(e) {
  for (var t = je(e), n = []; ; ) {
    var r = IQ(t);
    if (r.count === 0) break;
    n.push(r);
  }
  var i = { molecules: n, isMaterial: !0 };
  return hi.success(i);
}
function C8(e) {
  var t = this;
  return Xt.create("Parse Mol", function() {
    return se(t, 0, void 0, function() {
      var n;
      return ie(this, function(r) {
        return n = function(i) {
          var a = i.split(/\r?\n/).reduce(function(o, s) {
            return s.includes("ITEM: TIMESTEP") && o.push([]), o[o.length - 1].push(s), o;
          }, []).map(function(o) {
            var s = o.findIndex(function(L) {
              return L.includes("ITEM: BOX BOUNDS");
            });
            o.splice(s, 1, "ITEM: BOX BOUNDS xy xz yz pp pp pp");
            var u = o.findIndex(function(L) {
              return L.includes("ITEM: ATOMS");
            }), l = o[u].includes("xs") || o[u].includes("xsu"), c = o[s + 1], d = o[s + 2], f = o[s + 3], p = c.split(" ").map(function(L) {
              return +L;
            }), g = p[0], m = p[1], v = p[2], h = v === void 0 ? 0 : v, y = d.split(" ").map(function(L) {
              return +L;
            }), x = y[0], S = y[1], b = y[2], _ = b === void 0 ? 0 : b, C = f.split(" ").map(function(L) {
              return +L;
            }), w = C[0], I = C[1], M = C[2], E = M === void 0 ? 0 : M;
            if (l) {
              var T = [[m - g - Math.abs(h) - Math.abs(_), 0, 0], [h, S - x - Math.abs(E), 0], [_, E, I - w]], P = o.slice(u + 1).map(function(L) {
                return L.split(" ");
              }).map(function(L) {
                var F = L[0], V = L[1], G = function(H, q) {
                  for (var z = [], K = 0; K < H.length; K++) {
                    z[K] = [];
                    for (var Y = 0; Y < q[0].length; Y++) {
                      for (var Z = 0, X = 0; X < H[0].length; X++) Z += +H[K][X] * +q[X][Y];
                      z[K][Y] = Z;
                    }
                  }
                  return z;
                }([[L[2], L[3], L[4]]], T)[0];
                return [F, V, G[0], G[1], G[2]];
              }), k = P.map(function(L) {
                return L.join(" ");
              }).join(`
`);
              return [o.slice(0, s + 4).join(`
`), B = "ITEM: ATOMS id type x y z", k].join(`
`);
            }
            var D = [[g, m, h], [x, S, _], [w, I, E]].map(function(L) {
              return L.join(" ");
            });
            o.splice.apply(o, Re([s + 1, 3], D, !1)), k = (P = o.slice(u + 1).map(function(L) {
              return L.split(" ");
            }).map(function(L) {
              return [L[0], L[1], L[2], L[3], L[4]];
            })).map(function(L) {
              return L.join(" ");
            }).join(`
`);
            var B = "ITEM: ATOMS id type x y z";
            return [o.slice(0, s + 4).join(`
`), B, k].join(`
`);
          });
          return a.join(`
`);
        }(e), [2, PQ(n)];
      });
    });
  });
}
function MQ(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B;
    return ie(this, function(L) {
      switch (L.label) {
        case 0:
          for (n = wv.formatMol(e), r = n.molecules, i = 0, a = 0, o = r; a < o.length; a++) m = o[a], i += m.count;
          for (s = new Array(i), u = new Int32Array(i), l = new Float32Array(i), c = new Float32Array(i), d = new Float32Array(i), f = new Int32Array(i), p = function(F) {
            if (F.length) {
              var V = F[0], G = V.cell, H = V.spaceGroup;
              if (G) {
                var q = G.a, z = G.b, K = G.c, Y = G.alpha, Z = G.beta, X = G.gamma, W = G.matrix, J = G.invertMatrix, $ = function(ce) {
                  if (!ce) return "P 1";
                  var ae = ce.it_number.value(0), he = ce["name_h-m_full"].value(0).replace("-", " ");
                  return ce.it_number.isDefined ? (ce["name_h-m_full"].isDefined, ae) : he;
                }(H), ee = os.createMaterial($, A.create(q, z, K), A.scale(A(), A.create(Y, Z, X), Math.PI / 180), q * z * K, J, W);
                return { spacegroup: za.create(ee), assemblies: [], isNonStandardCrystalFrame: !1, ncsOperators: [] };
              }
            }
          }(r), g = 0, B = 0; B < r.length; B++) for (m = r[B], v = 0; v < m.count; v++) s[g] = m.type_symbol.value(v), l[g] = m.x.value(v), c[g] = m.y.value(v), d[g] = m.z.value(v), u[g] = v, f[g] = B, g++;
          return h = Q.ofConst("MOL", i, Q.Schema.str), y = Q.ofConst("A", i, Q.Schema.str), x = Q.ofConst(1, i, Q.Schema.int), S = Q.ofStringArray(s), b = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: y, auth_atom_id: S, auth_comp_id: h, auth_seq_id: x, Cartn_x: Q.ofFloatArray(l), Cartn_y: Q.ofFloatArray(c), Cartn_z: Q.ofFloatArray(d), id: Q.ofIntArray(u), label_asym_id: y, label_atom_id: S, label_comp_id: h, label_seq_id: x, label_entity_id: Q.ofConst("1", i, Q.Schema.str), occupancy: Q.ofConst(1, i, Q.Schema.float), type_symbol: S, pdbx_PDB_model_num: Q.ofIntArray(f) }, i), (_ = new Nf()).setNames([["MOL", "Ligand"]]), _.getEntityId("MOL", 0, "A"), (C = new Lf(x, S)).setNames([["MOL", "Unknown Molecule"]]), C.add("MOL", 0), [4, Ul(pd({ entity: _.getEntityTable(), chem_comp: C.getChemCompTable(), atom_site: b }), wv.create(n), t)];
        case 1:
          if ((w = L.sent()).frameCount > 0 && (I = w.representative, Gi.Provider.set(I, p)), M = r[0], E = M.bonds) for (T = Q.ofIntArray(E.atomA), P = Q.ofIntArray(E.atomB), k = Q.ofIntArray(new Array(E.count).fill(1)), D = fi.fromData({ pairs: { indexA: T, indexB: P, order: k }, count: M.count }), B = 0; B < w.frameCount; B++) fi.Provider.set(w.getFrameAtIndex(B), D);
          return [2, w];
      }
    });
  });
}
function hd(e) {
  return Xt.create("Parse Material", function(t) {
    return MQ(e, t);
  });
}
Object.entries({ Ac: { "Atomic mass": 227, "Atomic no": 89, "Atomic orbitals": { "1s": -3443.110367, "2p": -572.7627, "2s": -592.622878, "3d": -119.541743, "3p": -137.654394, "3s": -147.320716, "4d": -23.57061, "4f": -12.278225, "4p": -31.761846, "4s": -36.15826, "5d": -3.222752, "5p": -6.06511, "5s": -7.713078, "6d": -0.137786, "6p": -0.744524, "6s": -1.19698, "7s": -0.126551 }, "Atomic radius": 1.95, "Atomic radius calculated": "no data", "Boiling point": "3573 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "10070 kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].6d<sup>1</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.26 }, "Liquid range": "2250 K", "Melting point": "1323 K", "Mendeleev no": 48, "Mineral hardness": "no data", "Molar volume": "22.55 cm<sup>3</sup>", Name: "Actinium", "Oxidation states": [3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.26, ionic_radius: 1.12 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "12 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.47, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.1, "Youngs modulus": "no data GPa", "Metallic radius": 1.878, iupac_ordering: 32, "IUPAC ordering": 32, "Ground level": "2D3/2", "Ionization energies": [5.380226, 11.75, 17.431, 44.8, 55, 67, 79, 98.9, 113.9, 143.9, 161.1, 233, 255, 279, 305, 330, 355, 390, 416, 444, 470, 610, 640, 670, 710, 780, 820, 920, 950, 1030, 1100, 1170, 1240, 1310, 1380, 1460, 1530, 1610, 1680, 1750, 1820, 1900, 1970, 2298, 2362, 2430, 2503, 2572, 2639, 2762, 2833, 2908, 2980, 3264, 3334, 3409, 3479, 3811, 3893, 4093, 4175, 6767, 6923, 7088, 7265, 7430, 7600, 7950, 8120, 8310, 8480, 8970, 9120, 9290, 9440, 10480, 10660, 11030, 11200, 23480, 23890, 24340, 24760, 28610, 29160, 29850, 30293.1, 119938.6, 122062.9], "Electron affinity": 0.35 }, Ag: { "Atomic mass": 107.8682, "Atomic no": 47, "Atomic orbitals": { "1s": -900.324578, "2p": -120.913351, "2s": -129.859807, "3d": -13.367803, "3p": -20.06763, "3s": -23.678437, "4d": -0.298706, "4p": -2.086602, "4s": -3.22309, "5s": -0.157407 }, "Atomic radius": 1.6, "Atomic radius calculated": 1.65, "Boiling point": "2435 K", "Brinell hardness": "24.5 MN m<sup>-2</sup>", "Bulk modulus": "100 GPa", "Coefficient of linear thermal expansion": "18.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "no data K", "Density of solid": "10490 kg m<sup>-3</sup>", "Electrical resistivity": "1.63 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>1</sup>", "ICSD oxidation states": [1, 2, 3], "Ionic radii": { 1: 1.29, 2: 1.08, 3: 0.89 }, "Liquid range": "1200.07 K", "Melting point": "1234.93 K", "Mendeleev no": 71, "Mineral hardness": "2.5", "Molar volume": "10.27 cm<sup>3</sup>", Name: "Silver", "Oxidation states": [1, 2, 3], "Poissons ratio": "0.37", Reflectivity: "97 %", "Refractive index": "no data", "Rigidity modulus": "30 GPa", "Shannon radii": { 1: { II: { "": { crystal_radius: 0.81, ionic_radius: 0.67 } }, IV: { "": { crystal_radius: 1.14, ionic_radius: 1 } }, IVSQ: { "": { crystal_radius: 1.16, ionic_radius: 1.02 } }, V: { "": { crystal_radius: 1.23, ionic_radius: 1.09 } }, VI: { "": { crystal_radius: 1.29, ionic_radius: 1.15 } }, VII: { "": { crystal_radius: 1.36, ionic_radius: 1.22 } }, VIII: { "": { crystal_radius: 1.42, ionic_radius: 1.28 } } }, 2: { IVSQ: { "": { crystal_radius: 0.93, ionic_radius: 0.79 } }, VI: { "": { crystal_radius: 1.08, ionic_radius: 0.94 } } }, 3: { IVSQ: { "": { crystal_radius: 0.81, ionic_radius: 0.67 } }, VI: { "": { crystal_radius: 0.89, ionic_radius: 0.75 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "430 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.11, "Velocity of sound": "2600 m s<sup>-1</sup>", "Vickers hardness": "251 MN m<sup>-2</sup>", X: 1.93, "Youngs modulus": "83 GPa", "Metallic radius": 1.445, iupac_ordering: 72, "IUPAC ordering": 72, "Ground level": "2S1/2", "Ionization energies": [7.576234, 21.4844, 34.8, 49, 65, 82, 106, 125, 145.1, 167, 188, 271.46, 294, 321, 347, 381, 408.43, 469, 500.87, 885, 946, 1013, 1082, 1149, 1231, 1308, 1382, 1460, 1535, 1747, 1810.5, 1888, 1979, 2077, 2131, 2302, 2371.99, 5558, 5753, 5966, 6170, 6551, 6785, 7082, 7271.298, 30097.318, 30965.698], "Electron affinity": 1.304473 }, Al: { "Atomic mass": 26.9815386, "Atomic no": 13, "Atomic orbitals": { "1s": -55.156044, "2p": -2.564018, "2s": -3.934827, "3p": -0.102545, "3s": -0.286883 }, "Atomic radius": 1.25, "Atomic radius calculated": 1.18, "Boiling point": "2792 K", "Brinell hardness": "245 MN m<sup>-2</sup>", "Bulk modulus": "76 GPa", "Coefficient of linear thermal expansion": "23.1 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "2700 kg m<sup>-3</sup>", "Electrical resistivity": "2.7 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>1</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 0.675 }, "Liquid range": "1858.53 K", "Melting point": "933.47 K", "Mendeleev no": 80, "Mineral hardness": "2.75", "Molar volume": "10.00 cm<sup>3</sup>", Name: "Aluminum", "Oxidation states": [1, 3], "Poissons ratio": "0.35", Reflectivity: "71 %", "Refractive index": "no data", "Rigidity modulus": "26 GPa", "Shannon radii": { 3: { IV: { "": { crystal_radius: 0.53, ionic_radius: 0.39 } }, V: { "": { crystal_radius: 0.62, ionic_radius: 0.48 } }, VI: { "": { crystal_radius: 0.675, ionic_radius: 0.535 } } } }, "Superconduction temperature": "1.175 K", "Thermal conductivity": "235 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.84, "Velocity of sound": "5100 m s<sup>-1</sup>", "Vickers hardness": "167 MN m<sup>-2</sup>", X: 1.61, "Youngs modulus": "70 GPa", "NMR Quadrupole Moment": { "Al-27": 146.6 }, "Metallic radius": 1.43, iupac_ordering: 80, "IUPAC ordering": 80, "Ground level": "2P°1/2", "Ionization energies": [5.985769, 18.82855, 28.447642, 119.9924, 153.8252, 190.49, 241.76, 284.64, 330.21, 398.65, 442.005, 2085.97702, 2304.14007], "Electron affinity": 0.432835 }, Am: { "Atomic mass": 243, "Atomic no": 95, "Atomic orbitals": "no data", "Atomic radius": 1.75, "Atomic radius calculated": "no data", "Boiling point": "2880 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>7</sup>.7s<sup>2</sup>", "Ionic radii": { 2: 1.4, 3: 1.115, 4: 0.99 }, "Liquid range": "1431 K", "Melting point": "1449 K", "Mendeleev no": 42, "Mineral hardness": "no data", "Molar volume": "17.63 cm<sup>3</sup>", Name: "Americium", "Oxidation states": [2, 3, 4, 5, 6], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { VII: { "": { crystal_radius: 1.35, ionic_radius: 1.21 } }, VIII: { "": { crystal_radius: 1.4, ionic_radius: 1.26 } }, IX: { "": { crystal_radius: 1.45, ionic_radius: 1.31 } } }, 3: { VI: { "": { crystal_radius: 1.115, ionic_radius: 0.975 } }, VIII: { "": { crystal_radius: 1.23, ionic_radius: 1.09 } } }, 4: { VI: { "": { crystal_radius: 0.99, ionic_radius: 0.85 } }, VIII: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } } } }, "Superconduction temperature": "0.6 K", "Thermal conductivity": "10 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.44, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": 1.73, iupac_ordering: 26, "IUPAC ordering": 26, "Ground level": "8S°7/2", "Ionization energies": [5.97381, 11.7, 21.7, 36.8, 50, 67.9, 95, 110, 125, 141, 163, 184, 206, 225, 242, 284, 305, 424, 451, 481, 511, 541, 571, 616, 646, 680, 711, 870, 900, 940, 980, 1090, 1130, 1240, 1280, 1410, 1490, 1570, 1650, 1730, 1820, 1900, 1980, 2070, 2160, 2240, 2320, 2410, 2480, 2874, 2946, 3021, 3101, 3178, 3251, 3402, 3479, 3563, 3641, 3956, 4033, 4115, 4191, 4642, 4733, 4960, 5050, 8040, 8210, 8390, 8590, 8770, 8950, 9380, 9560, 9770, 9960, 10490, 10650, 10830, 11e3, 12400, 12600, 13e3, 13190, 27110, 27550, 28040, 28500, 33700, 34300, 35100, 35549.4, 139769.5, 142161], "Electron affinity": 0.1 }, Ar: { "Atomic mass": 39.948, "Atomic no": 18, "Atomic orbitals": { "1s": -113.800134, "2p": -8.443439, "2s": -10.794172, "3p": -0.38233, "3s": -0.883384 }, "Atomic radius": 0.71, "Atomic radius calculated": 0.71, "Boiling point": "87.3 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "150.8 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>6</sup>", "Liquid range": "3.5 K", "Max oxidation state": 0, "Melting point": "83.8 K", "Mendeleev no": 3, "Min oxidation state": 0, "Mineral hardness": "no data", "Molar volume": "22.56 cm<sup>3</sup>", Name: "Argon", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000281", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "0.01772 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.88, "Velocity of sound": "319 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 3, "IUPAC ordering": 3, "Ground level": "1S0", "Ionization energies": [15.7596119, 27.62967, 40.735, 59.58, 74.84, 91.29, 124.41, 143.4567, 422.6, 479.76, 540.4, 619, 685.5, 755.13, 855.5, 918.375, 4120.6657, 4426.2229], "Electron affinity": -1.02 }, As: { "Atomic mass": 74.9216, "Atomic no": 33, "Atomic orbitals": { "1s": -423.336658, "2p": -47.527869, "2s": -53.093086, "3d": -1.542767, "3p": -4.851725, "3s": -6.730755, "4p": -0.197497, "4s": -0.52367 }, "Atomic radius": 1.15, "Atomic radius calculated": 1.14, "Boiling point": "887 K", "Brinell hardness": "1440 MN m<sup>-2</sup>", "Bulk modulus": "22 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-3, 3, 5], "Critical temperature": "1700 K", "Density of solid": "5727 kg m<sup>-3</sup>", "Electrical resistivity": "33 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>3</sup>", "ICSD oxidation states": [2, 3, 5, -2, -3, -1], "Ionic radii": { 3: 0.72, 5: 0.6 }, "Liquid range": "203 K", "Melting point": "1090 K", "Mendeleev no": 89, "Mineral hardness": "3.5", "Molar volume": "12.95 cm<sup>3</sup>", Name: "Arsenic", "Oxidation states": [-3, 2, 3, 5], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.001552", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } } }, 5: { IV: { "": { crystal_radius: 0.475, ionic_radius: 0.335 } }, VI: { "": { crystal_radius: 0.6, ionic_radius: 0.46 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "50 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.85, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.18, "Youngs modulus": "8 GPa", "Metallic radius": "no data", iupac_ordering: 89, "IUPAC ordering": 89, "Ground level": "4S°3/2", "Ionization energies": [9.78855, 18.5892, 28.349, 50.15, 62.77, 121.19, 147, 180, 213, 247, 296, 333, 375, 418, 460, 587.6, 628.8, 672.9, 728.9, 774, 814, 911.7, 956.79, 2356.9, 2486, 2626, 2766, 2938, 3088.1, 3287, 3411.643, 14447.678, 15028.907], "Electron affinity": 0.80482 }, At: { "Atomic mass": 210, "Atomic no": 85, "Atomic orbitals": { "1s": -3127.390276, "2p": -513.044243, "2s": -531.81835, "3d": -103.060375, "3p": -119.995013, "3s": -129.035542, "4d": -18.295162, "4f": -8.063483, "4p": -25.778264, "4s": -29.809515, "5d": -1.643758, "5p": -4.027061, "5s": -5.453383, "6p": -0.255453, "6s": -0.560189 }, "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1, 1], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>5</sup>", "Ionic radii": { 7: 0.76 }, "Liquid range": "no data K", "Melting point": "575 K", "Mendeleev no": 96, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Astatine", "Oxidation states": [-1, 1, 3, 5], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 7: { VI: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "2 (estimate)W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.02, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 98, "IUPAC ordering": 98, "Ground level": "2P°3/2", "Ionization energies": [9.31751, 17.88, 26.58, 39.65, 50.39, 72, 85.1, 130.1, 149, 169, 192.1, 212, 236, 263, 287, 311, 335, 452, 481, 510, 540, 600, 630, 720, 750, 790, 860, 920, 990, 1050, 1120, 1180, 1250, 1320, 1380, 1450, 1510, 1590, 1650, 1948, 2007, 2071, 2139, 2203, 2266, 2373, 2439, 2510, 2576, 2841, 2905, 2977, 3042, 3312, 3388, 3573, 3649, 5976, 6122, 6279, 6445, 6604, 6759, 7068, 7230, 7410, 7570, 8030, 8180, 8330, 8480, 9330, 9500, 9830, 9990, 21210, 21600, 22030, 22420, 25580, 26090, 26730, 27139, 107923.4, 109886], "Electron affinity": 2.415787 }, Au: { "Atomic mass": 196.966569, "Atomic no": 79, "Atomic orbitals": { "1s": -2683.508245, "2p": -430.725701, "2s": -447.888973, "3d": -81.511751, "3p": -96.707, "3s": -104.824516, "4d": -12.131815, "4f": -3.486824, "4p": -18.578652, "4s": -22.078357, "5d": -0.304738, "5p": -2.002495, "5s": -3.113936, "6s": -0.162334 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.74, "Boiling point": "3129 K", "Brinell hardness": "2450 MN m<sup>-2</sup>", "Bulk modulus": "220 GPa", "Coefficient of linear thermal expansion": "14.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "19300 kg m<sup>-3</sup>", "Electrical resistivity": "2.2 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>1</sup>", "Ionic radii": { 1: 1.51, 3: 0.99, 5: 0.71 }, "Liquid range": "1791.67 K", "Melting point": "1337.33 K", "Mendeleev no": 70, "Mineral hardness": "2.5", "Molar volume": "10.21 cm<sup>3</sup>", Name: "Gold", "Oxidation states": [-1, 1, 2, 3, 5], "Poissons ratio": "0.44", Reflectivity: "95 %", "Refractive index": "no data", "Rigidity modulus": "27 GPa", "Shannon radii": { 1: { VI: { "": { crystal_radius: 1.51, ionic_radius: 1.37 } } }, 3: { IVSQ: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } }, VI: { "": { crystal_radius: 0.99, ionic_radius: 0.85 } } }, 5: { VI: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "320 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.14, "Velocity of sound": "1740 m s<sup>-1</sup>", "Vickers hardness": "216 MN m<sup>-2</sup>", X: 2.54, "Youngs modulus": "78 GPa", "Metallic radius": 1.442, iupac_ordering: 71, "IUPAC ordering": 71, "Ground level": "2S1/2", "Ionization energies": [9.225554, 20.203, 30, 45, 60, 74, 94, 112, 130.1, 149, 168.2, 248, 275, 299, 324, 365, 392, 433, 487, 520, 550, 600, 650, 710, 760, 820, 870, 930, 990, 1040, 1100, 1150, 1210, 1475, 1527, 1584, 1644, 1702, 1758, 1845, 1904, 1967, 2026, 2261, 2320, 2383, 2443, 2640, 2708, 2870, 2941, 4888, 5013, 5156, 5307, 5452, 5594, 5846, 5994, 6156, 6305, 6724, 6854, 6997, 7130, 7760, 7910, 8210, 8360, 18040, 18400, 18790, 19150, 21470, 21920, 22500, 22868.1, 91515.82, 93254.3], "Electron affinity": 2.30861025 }, B: { "Atomic mass": 10.811, "Atomic no": 5, "Atomic orbitals": { "1s": -6.564347, "2p": -0.136603, "2s": -0.344701 }, "Atomic radius": 0.85, "Atomic radius calculated": 0.87, "Boiling point": "4200 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "320 GPa", "Coefficient of linear thermal expansion": "6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "2460 kg m<sup>-3</sup>", "Electrical resistivity": "&gt; 10<sup>12</sup>10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>1</sup>", "ICSD oxidation states": [3, -3], "Ionic radii": { 3: 0.41 }, "Liquid range": "1851 K", "Melting point": "2349 K", "Mendeleev no": 86, "Mineral hardness": "9.3", "Molar volume": "4.39 cm<sup>3</sup>", Name: "Boron", "Oxidation states": [1, 2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { III: { "": { crystal_radius: 0.15, ionic_radius: 0.01 } }, IV: { "": { crystal_radius: 0.25, ionic_radius: 0.11 } }, VI: { "": { crystal_radius: 0.41, ionic_radius: 0.27 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "27 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.92, "Velocity of sound": "16200 m s<sup>-1</sup>", "Vickers hardness": "49000 MN m<sup>-2</sup>", X: 2.04, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "B-10": 84.59, "B-11": 40.59 }, "Metallic radius": "no data", iupac_ordering: 81, "IUPAC ordering": 81, "Ground level": "2P°1/2", "Ionization energies": [8.298019, 25.15483, 37.93059, 259.3715, 340.2260229], "Electron affinity": 0.27972325 }, Ba: { "Atomic mass": 137.327, "Atomic no": 56, "Atomic orbitals": { "1s": -1305.743258, "2p": -189.598483, "2s": -200.844444, "3d": -28.528933, "3p": -37.536931, "3s": -42.359434, "4d": -3.432441, "4p": -6.497622, "4s": -8.257061, "5p": -0.698605, "5s": -1.157159, "6s": -0.118967 }, "Atomic radius": 2.15, "Atomic radius calculated": 2.53, "Boiling point": "2143 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "9.6 GPa", "Coefficient of linear thermal expansion": "20.6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "3510 kg m<sup>-3</sup>", "Electrical resistivity": "34 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].6s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 1.49 }, "Liquid range": "1143 K", "Melting point": "1000 K", "Mendeleev no": 14, "Mineral hardness": "1.25", "Molar volume": "38.16 cm<sup>3</sup>", Name: "Barium", "Oxidation states": [2], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "4.9 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.49, ionic_radius: 1.35 } }, VII: { "": { crystal_radius: 1.52, ionic_radius: 1.38 } }, VIII: { "": { crystal_radius: 1.56, ionic_radius: 1.42 } }, IX: { "": { crystal_radius: 1.61, ionic_radius: 1.47 } }, X: { "": { crystal_radius: 1.66, ionic_radius: 1.52 } }, XI: { "": { crystal_radius: 1.71, ionic_radius: 1.57 } }, XII: { "": { crystal_radius: 1.75, ionic_radius: 1.61 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "18 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.68, "Velocity of sound": "1620 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.89, "Youngs modulus": "13 GPa", "Metallic radius": 2.236, iupac_ordering: 13, "IUPAC ordering": 13, "Ground level": "1S0", "Ionization energies": [5.2116646, 10.003826, 35.8438, 47, 58, 71, 86, 101, 130.5, 146.52, 241, 267.1, 296, 325, 354, 390, 422, 455, 488, 520, 646, 679, 717, 752, 809, 846, 935, 976.62, 1695, 1776, 1864, 1958, 2047, 2142, 2256, 2349, 2452, 2547, 2814, 2901, 2994, 3081, 3266, 3363, 3546, 3640, 8326, 8565, 8831, 9077, 9739, 10023, 10376, 10616.42, 43485.366, 44561.47], "Electron affinity": 0.144626 }, Be: { "Atomic mass": 9.012182, "Atomic no": 4, "Atomic orbitals": { "1s": -3.856411, "2s": -0.205744 }, "Atomic radius": 1.05, "Atomic radius calculated": 1.12, "Boiling point": "2742 K", "Brinell hardness": "600 MN m<sup>-2</sup>", "Bulk modulus": "130 GPa", "Coefficient of linear thermal expansion": "11.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "1848 kg m<sup>-3</sup>", "Electrical resistivity": "3.8 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 0.59 }, "Liquid range": "1182 K", "Melting point": "1560 K", "Mendeleev no": 77, "Mineral hardness": "5.5", "Molar volume": "4.85 cm<sup>3</sup>", Name: "Beryllium", "Oxidation states": [2], "Poissons ratio": "0.032", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "132 GPa", "Shannon radii": { 2: { III: { "": { crystal_radius: 0.3, ionic_radius: 0.16 } }, IV: { "": { crystal_radius: 0.41, ionic_radius: 0.27 } }, VI: { "": { crystal_radius: 0.59, ionic_radius: 0.45 } } } }, "Superconduction temperature": "0.026 K", "Thermal conductivity": "190 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.53, "Velocity of sound": "13000 m s<sup>-1</sup>", "Vickers hardness": "1670 MN m<sup>-2</sup>", X: 1.57, "Youngs modulus": "287 GPa", "NMR Quadrupole Moment": { "Be-9": 52.88 }, "Metallic radius": 1.12, iupac_ordering: 17, "IUPAC ordering": 17, "Ground level": "1S0", "Ionization energies": [9.322699, 18.21115, 153.896205, 217.7185861], "Electron affinity": -0.52 }, Bi: { "Atomic mass": 208.9804, "Atomic no": 83, "Atomic orbitals": { "1s": -2975.550959, "2p": -484.716359, "2s": -502.950758, "3d": -95.532476, "3p": -111.883393, "3s": -120.613998, "4d": -16.084817, "4f": -6.382744, "4p": -23.218641, "4s": -27.07034, "5d": -1.139408, "5p": -3.293637, "5s": -4.611934, "6p": -0.180198, "6s": -0.426129 }, "Atomic radius": 1.6, "Atomic radius calculated": 1.43, "Boiling point": "1837 K", "Brinell hardness": "94.2 MN m<sup>-2</sup>", "Bulk modulus": "31 GPa", "Coefficient of linear thermal expansion": "13.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "9780 kg m<sup>-3</sup>", "Electrical resistivity": "130 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>3</sup>", "ICSD oxidation states": [1, 2, 3, 5], "Ionic radii": { 3: 1.17, 5: 0.9 }, "Liquid range": "1292.6 K", "Melting point": "544.4 K", "Mendeleev no": 87, "Mineral hardness": "2.25", "Molar volume": "21.31 cm<sup>3</sup>", Name: "Bismuth", "Oxidation states": [-3, 3, 5], "Poissons ratio": "0.33", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "12 GPa", "Shannon radii": { 3: { V: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } }, VI: { "": { crystal_radius: 1.17, ionic_radius: 1.03 } }, VIII: { "": { crystal_radius: 1.31, ionic_radius: 1.17 } } }, 5: { VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "8 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.07, "Velocity of sound": "1790 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.02, "Youngs modulus": "32 GPa", "Metallic radius": 1.82, iupac_ordering: 87, "IUPAC ordering": 87, "Ground level": "4S°3/2", "Ionization energies": [7.285516, 16.703, 25.57075, 45.37, 54.856, 88.4, 103, 122, 143, 161.1, 183, 208, 229, 252, 272.6, 370.2, 409, 436, 464, 520, 550, 620, 660, 690, 750, 810, 870, 930, 990, 1060, 1120, 1180, 1250, 1310, 1380, 1440, 1500, 1784, 1840, 1902, 1967, 2029, 2090, 2190, 2253, 2321, 2385, 2641, 2703, 2771, 2835, 3078, 3151, 3329, 3401.8, 5599, 5740, 5892, 6054, 6208, 6358, 6648, 6804, 6977, 7137, 7580, 7720, 7870, 8010, 8780, 8950, 9270, 9430, 20130, 20500, 20920, 21300, 24150, 24640, 25260, 25656.9, 102251.76, 104132.8], "Electron affinity": 0.94236213 }, Bk: { "Atomic mass": 247, "Atomic no": 97, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "14780 kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>9</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.1, 4: 0.97 }, "Liquid range": "no data K", "Melting point": "1259 K", "Mendeleev no": 40, "Mineral hardness": "no data", "Molar volume": "16.84 cm<sup>3</sup>", Name: "Berkelium", "Oxidation states": [3, 4], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } } }, 4: { VI: { "": { crystal_radius: 0.97, ionic_radius: 0.83 } }, VIII: { "": { crystal_radius: 1.07, ionic_radius: 0.93 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "10 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.44, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": 1.703, iupac_ordering: 24, "IUPAC ordering": 24, "Ground level": "6H°15/2", "Ionization energies": [6.19785, 11.9, 21.6, 36, 56, 70.1, 90, 114, 130, 147, 171, 195, 218, 240, 259, 279, 303, 339, 361, 497, 526, 557, 590, 621, 652, 700, 733, 768, 800, 960, 1e3, 1040, 1080, 1200, 1240, 1360, 1410, 1550, 1630, 1720, 1800, 1890, 1970, 2050, 2140, 2240, 2320, 2410, 2490, 2580, 2670, 3080, 3154, 3232, 3315, 3393, 3469, 3630, 3709, 3797, 3877, 4202, 4281, 4365, 4445, 4940, 5040, 5270, 5360, 8500, 8670, 8850, 9050, 9240, 9420, 9880, 10070, 10280, 10480, 11020, 11190, 11380, 11550, 13090, 13300, 13720, 13910, 28380, 28800, 29300, 29800, 35500, 36200, 37e3, 37457.6, 146904.7, 149398], "Electron affinity": -1.72 }, Br: { "Atomic mass": 79.904, "Atomic no": 35, "Atomic orbitals": { "1s": -480.182643, "2p": -55.67796, "2s": -61.710022, "3d": -2.52211, "3p": -6.298805, "3s": -8.409057, "4p": -0.295334, "4s": -0.720066 }, "Atomic radius": 1.15, "Atomic radius calculated": 0.94, "Boiling point": "332 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "1.9 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1, 1, 3, 5, 7], "Critical temperature": "586 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "&gt; 10<sup>18</sup>10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>5</sup>", "ICSD oxidation states": [5, -1], "Ionic radii": { "-1": 1.82, 3: 0.73, 5: 0.45, 7: 0.53 }, "Liquid range": "66.2 K", "Melting point": "265.8 K", "Mendeleev no": 98, "Mineral hardness": "no data", "Molar volume": "19.78 cm<sup>3</sup>", Name: "Bromine", "Oxidation states": [-1, 1, 3, 4, 5, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.001132", "Rigidity modulus": "no data GPa", "Shannon radii": { "-1": { VI: { "": { crystal_radius: 1.82, ionic_radius: 1.96 } } }, 3: { IVSQ: { "": { crystal_radius: 0.73, ionic_radius: 0.59 } } }, 5: { IIIPY: { "": { crystal_radius: 0.45, ionic_radius: 0.31 } } }, 7: { IV: { "": { crystal_radius: 0.39, ionic_radius: 0.25 } }, VI: { "": { crystal_radius: 0.53, ionic_radius: 0.39 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.12 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.85, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.96, "Youngs modulus": "no data GPa", "Metallic radius": 1.14, iupac_ordering: 100, "IUPAC ordering": 100, "Ground level": "2P°3/2", "Ionization energies": [11.81381, 21.591, 34.871, 47.782, 59.595, 87.39, 103.03, 192.61, 224, 261, 301, 338, 393, 436, 481, 530, 577, 716.3, 761, 809.8, 870, 920.8, 963, 1070.6, 1119.17, 2731.4, 2869, 3021, 3169, 3361, 3523.1, 3735, 3868.986, 16317.011, 16937.127], "Electron affinity": 3.3635883 }, C: { "Atomic mass": 12.0107, "Atomic no": 6, "Atomic orbitals": { "1s": -9.947718, "2p": -0.199186, "2s": -0.500866 }, "Atomic radius": 0.7, "Atomic radius calculated": 0.67, "Boiling point": "4300 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "33 GPa", "Coefficient of linear thermal expansion": "7.1 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-4, 4], "Critical temperature": "no data K", "Density of solid": "2267 kg m<sup>-3</sup>", "Electrical resistivity": "about 1000 - direction dependent10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>2</sup>", "ICSD oxidation states": [2, 3, 4, -4, -3, -2], "Ionic radii": { 4: 0.3 }, "Liquid range": "500 K", "Melting point": "3800 K", "Mendeleev no": 95, "Mineral hardness": "0.5 (graphite; diamond is 10.0)(no units)", "Molar volume": "5.29 cm<sup>3</sup>", Name: "Carbon", "Oxidation states": [-4, -3, -2, -1, 1, 2, 3, 4], "Poissons ratio": "no data", Reflectivity: "27 %", "Refractive index": "2.417 (diamond)(no units)", "Rigidity modulus": "no data GPa", "Shannon radii": { 4: { III: { "": { crystal_radius: 0.06, ionic_radius: -0.08 } }, IV: { "": { crystal_radius: 0.29, ionic_radius: 0.15 } }, VI: { "": { crystal_radius: 0.3, ionic_radius: 0.16 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "140 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.7, "Velocity of sound": "18350 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.55, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "C-11": 33.27 }, "Metallic radius": "no data", iupac_ordering: 86, "IUPAC ordering": 86, "Ground level": "3P0", "Ionization energies": [11.260288, 24.383154, 47.88778, 64.49352, 392.090518, 489.993198], "Electron affinity": 1.262113612 }, Ca: { "Atomic mass": 40.078, "Atomic no": 20, "Atomic orbitals": { "1s": -143.935181, "2p": -12.285376, "2s": -15.046905, "3p": -1.030572, "3s": -1.706331, "4s": -0.141411 }, "Atomic radius": 1.8, "Atomic radius calculated": 1.94, "Boiling point": "1757 K", "Brinell hardness": "167 MN m<sup>-2</sup>", "Bulk modulus": "17 GPa", "Coefficient of linear thermal expansion": "22.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "1550 kg m<sup>-3</sup>", "Electrical resistivity": "3.4 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].4s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 1.14 }, "Liquid range": "642 K", "Melting point": "1115 K", "Mendeleev no": 16, "Mineral hardness": "1.75", "Molar volume": "26.20 cm<sup>3</sup>", Name: "Calcium", "Oxidation states": [2], "Poissons ratio": "0.31", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "7.4 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.14, ionic_radius: 1 } }, VII: { "": { crystal_radius: 1.2, ionic_radius: 1.06 } }, VIII: { "": { crystal_radius: 1.26, ionic_radius: 1.12 } }, IX: { "": { crystal_radius: 1.32, ionic_radius: 1.18 } }, X: { "": { crystal_radius: 1.37, ionic_radius: 1.23 } }, XII: { "": { crystal_radius: 1.48, ionic_radius: 1.34 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "200 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.31, "Velocity of sound": "3810 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1, "Youngs modulus": "20 GPa", "NMR Quadrupole Moment": { "Ca-41": -66.5, "Ca-43": -40.8 }, "Metallic radius": 1.976, iupac_ordering: 15, "IUPAC ordering": 15, "Ground level": "1S0", "Ionization energies": [6.11315547, 11.871719, 50.91316, 67.2732, 84.34, 108.78, 127.21, 147.24, 188.54, 211.275, 591.6, 658.2, 728.6, 817.2, 894, 973.7, 1086.8, 1157.726, 5128.8578, 5469.8616], "Electron affinity": 0.024551 }, Cd: { "Atomic mass": 112.411, "Atomic no": 48, "Atomic orbitals": { "1s": -941.476646, "2p": -127.63512, "2s": -136.83249, "3d": -14.685252, "3p": -21.637522, "3s": -25.379908, "4d": -0.47053, "4p": -2.39526, "4s": -3.596069, "5s": -0.204228 }, "Atomic radius": 1.55, "Atomic radius calculated": 1.61, "Boiling point": "1040 K", "Brinell hardness": "203 MN m<sup>-2</sup>", "Bulk modulus": "42 GPa", "Coefficient of linear thermal expansion": "30.8 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "8650 kg m<sup>-3</sup>", "Electrical resistivity": "7 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 1.09 }, "Liquid range": "445.78 K", "Melting point": "594.22 K", "Mendeleev no": 75, "Mineral hardness": "2.0", "Molar volume": "13.00 cm<sup>3</sup>", Name: "Cadmium", "Oxidation states": [1, 2], "Poissons ratio": "0.30", Reflectivity: "67 %", "Refractive index": "no data", "Rigidity modulus": "19 GPa", "Shannon radii": { 2: { IV: { "": { crystal_radius: 0.92, ionic_radius: 0.78 } }, V: { "": { crystal_radius: 1.01, ionic_radius: 0.87 } }, VI: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } }, VII: { "": { crystal_radius: 1.17, ionic_radius: 1.03 } }, VIII: { "": { crystal_radius: 1.24, ionic_radius: 1.1 } }, XII: { "": { crystal_radius: 1.45, ionic_radius: 1.31 } } } }, "Superconduction temperature": "0.517 K", "Thermal conductivity": "97 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.18, "Velocity of sound": "2310 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.69, "Youngs modulus": "50 GPa", "Metallic radius": 1.51, iupac_ordering: 75, "IUPAC ordering": 75, "Ground level": "1S0", "Ionization energies": [8.99382, 16.908313, 37.468, 51, 67.9, 87, 105, 130.1, 150, 173, 195, 218, 305, 329, 358, 385, 421, 452.6, 513, 546.19, 963, 1026, 1095, 1167, 1237, 1320, 1401, 1477, 1558, 1635, 1852, 1917.9, 1998, 2091, 2195, 2250, 2427, 2498.62, 5839, 6039, 6257, 6460, 6869, 7109, 7414, 7607.95, 31451.062, 32341.49], "Electron affinity": -0.72 }, Ce: { "Atomic mass": 140.116, "Atomic no": 58, "Atomic orbitals": { "1s": -1406.148284, "2p": -206.925148, "2s": -218.684842, "3d": -32.412569, "3p": -41.938282, "3s": -47.035283, "4d": -4.192548, "4f": -0.337442, "4p": -7.532106, "4s": -9.432744, "5d": -0.14055, "5p": -0.85011, "5s": -1.369728, "6s": -0.133974 }, "Atomic radius": 1.85, "Atomic radius calculated": "no data", "Boiling point": "3633 K", "Brinell hardness": "412 MN m<sup>-2</sup>", "Bulk modulus": "22 GPa", "Coefficient of linear thermal expansion": "6.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3, 4], "Critical temperature": "no data K", "Density of solid": "6689 kg m<sup>-3</sup>", "Electrical resistivity": "74 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>1</sup>.5d<sup>1</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4], "Ionic radii": { 3: 1.15, 4: 1.01 }, "Liquid range": "2565 K", "Melting point": "1068 K", "Mendeleev no": 32, "Mineral hardness": "2.5", "Molar volume": "20.69 cm<sup>3</sup>", Name: "Cerium", "Oxidation states": [2, 3, 4], "Poissons ratio": "0.24", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "14 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.15, ionic_radius: 1.01 } }, VII: { "": { crystal_radius: 1.21, ionic_radius: 1.07 } }, VIII: { "": { crystal_radius: 1.283, ionic_radius: 1.143 } }, IX: { "": { crystal_radius: 1.336, ionic_radius: 1.196 } }, X: { "": { crystal_radius: 1.39, ionic_radius: 1.25 } }, XII: { "": { crystal_radius: 1.48, ionic_radius: 1.34 } } }, 4: { VI: { "": { crystal_radius: 1.01, ionic_radius: 0.87 } }, VIII: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } }, X: { "": { crystal_radius: 1.21, ionic_radius: 1.07 } }, XII: { "": { crystal_radius: 1.28, ionic_radius: 1.14 } } } }, "Superconduction temperature": "0.022  (under pressure)K", "Thermal conductivity": "11 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.42, "Velocity of sound": "2100 m s<sup>-1</sup>", "Vickers hardness": "270 MN m<sup>-2</sup>", X: 1.12, "Youngs modulus": "34 GPa", "Metallic radius": 1.707, iupac_ordering: 46, "IUPAC ordering": 46, "Ground level": "1G°4", "Ionization energies": [5.5386, 10.956, 20.1974, 36.906, 65.55, 77.6, 91, 106, 125, 140, 172, 192.24, 312, 340, 371, 403, 435, 472, 509, 543, 579, 613, 749, 785, 824, 862, 924, 965, 1060, 1103.5, 1908, 1994, 2087, 2185, 2280, 2378, 2500, 2600, 2706, 2806, 3087, 3176, 3274, 3366, 3570, 3672, 3865, 3963, 9020, 9269, 9545, 9803, 10542, 10840, 11210, 11459.85, 46840.306, 47965.72], "Electron affinity": 0.572 }, Cf: { "Atomic mass": 251, "Atomic no": 98, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "15100 kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>10</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.09, 4: 0.961 }, "Liquid range": "no data K", "Melting point": "1173 K", "Mendeleev no": 39, "Mineral hardness": "no data", "Molar volume": "16.50 cm<sup>3</sup>", Name: "Californium", "Oxidation states": [2, 3, 4], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } } }, 4: { VI: { "": { crystal_radius: 0.961, ionic_radius: 0.821 } }, VIII: { "": { crystal_radius: 1.06, ionic_radius: 0.92 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.45, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": 1.86, iupac_ordering: 23, "IUPAC ordering": 23, "Ground level": "5I8", "Ionization energies": [6.28166, 12, 22.4, 37.7, 51.9, 75, 91, 112.9, 133, 152, 178, 201, 225, 247, 265, 286, 310, 334, 368, 390, 536, 566, 597, 630, 662, 695, 744, 778, 814, 847, 1010, 1050, 1090, 1120, 1250, 1300, 1420, 1470, 1620, 1700, 1790, 1880, 1960, 2050, 2130, 2220, 2320, 2410, 2490, 2580, 2670, 2750, 3186, 3261, 3340, 3424, 3503, 3581, 3747, 3828, 3915, 3998, 4329, 4407, 4494, 4570, 5100, 5190, 5430, 5520, 8730, 8900, 9090, 9290, 9480, 9660, 10140, 10330, 10550, 10740, 11300, 11470, 11650, 11820, 13450, 13660, 14080, 14280, 29e3, 29500, 3e4, 30500, 36500, 37100, 37900, 38443.5, 150579.3, 153124], "Electron affinity": -1.01 }, Cl: { "Atomic mass": 35.453, "Atomic no": 17, "Atomic orbitals": { "1s": -100.369229, "2p": -7.039982, "2s": -9.187993, "3p": -0.32038, "3s": -0.754458 }, "Atomic radius": 1, "Atomic radius calculated": 0.79, "Boiling point": "239.11 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "1.1 (liquid)GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1, 1, 3, 5, 7], "Critical temperature": "417 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "&gt; 10<sup>10</sup>10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>5</sup>", "ICSD oxidation states": [-1], "Ionic radii": { "-1": 1.67, 5: 0.26, 7: 0.41 }, "Liquid range": "67.51 K", "Melting point": "171.6 K", "Mendeleev no": 99, "Mineral hardness": "no data", "Molar volume": "17.39 cm<sup>3</sup>", Name: "Chlorine", "Oxidation states": [-1, 1, 2, 3, 4, 5, 6, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000773", "Rigidity modulus": "no data GPa", "Shannon radii": { "-1": { VI: { "": { crystal_radius: 1.67, ionic_radius: 1.81 } } }, 5: { IIIPY: { "": { crystal_radius: 0.26, ionic_radius: 0.12 } } }, 7: { IV: { "": { crystal_radius: 0.22, ionic_radius: 0.08 } }, VI: { "": { crystal_radius: 0.41, ionic_radius: 0.27 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.0089 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.75, "Velocity of sound": "206 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 3.16, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "Cl-35": -81.65, "Cl-37": -64.35 }, "Metallic radius": "no data", iupac_ordering: 101, "IUPAC ordering": 101, "Ground level": "2P°3/2", "Ionization energies": [12.967633, 23.81364, 39.8, 53.24, 67.68, 96.94, 114.2013, 348.306, 400.851, 456.7, 530, 591.58, 656.3, 750.23, 809.198, 3658.3438, 3946.2909], "Electron affinity": 3.61272528 }, Cm: { "Atomic mass": 247, "Atomic no": 96, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "3383 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "13510 kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>7</sup>.6d<sup>1</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.11, 4: 0.99 }, "Liquid range": "1770 K", "Melting point": "1613 K", "Mendeleev no": 41, "Mineral hardness": "no data", "Molar volume": "18.05 cm<sup>3</sup>", Name: "Curium", "Oxidation states": [3, 4], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } } }, 4: { VI: { "": { crystal_radius: 0.99, ionic_radius: 0.85 } }, VIII: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "8.8 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.45, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": 1.743, iupac_ordering: 25, "IUPAC ordering": 25, "Ground level": "9D°2", "Ionization energies": [5.99141, 12.4, 20.1, 37.7, 51, 69.1, 97, 112, 128, 144, 167, 190, 213, 235, 253, 272, 311, 332, 460, 489, 518, 550, 580, 611, 657, 689, 723, 755, 910, 950, 990, 1030, 1140, 1180, 1300, 1340, 1480, 1560, 1650, 1730, 1810, 1890, 1980, 2060, 2160, 2240, 2320, 2410, 2490, 2580, 2976, 3050, 3125, 3207, 3284, 3360, 3515, 3593, 3679, 3758, 4078, 4156, 4239, 4317, 4791, 4880, 5110, 5200, 8270, 8440, 8620, 8820, 9e3, 9180, 9630, 9820, 10020, 10220, 10760, 10920, 11100, 11270, 12740, 12950, 13350, 13550, 27740, 28180, 28700, 29100, 34600, 35200, 36e3, 36493, 143299.6, 145743], "Electron affinity": 0.28 }, Co: { "Atomic mass": 58.933195, "Atomic no": 27, "Atomic orbitals": { "1s": -275.616639, "2p": -28.152095, "2s": -32.379758, "3d": -0.322368, "3p": -2.388285, "3s": -3.651812, "4s": -0.204497 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.52, "Boiling point": "3200 K", "Brinell hardness": "700 MN m<sup>-2</sup>", "Bulk modulus": "180 GPa", "Coefficient of linear thermal expansion": "13.0 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 3], "Critical temperature": "no data K", "Density of solid": "8900 kg m<sup>-3</sup>", "Electrical resistivity": "6 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>7</sup>.4s<sup>2</sup>", "ICSD oxidation states": [1, 2, 3, 4], "Ionic radii": { 2: 0.885, 3: 0.75, 4: 0.67 }, "Ionic radii hs": { 2: 0.885, 3: 0.75, 4: 0.67 }, "Ionic radii ls": { 2: 0.79, 3: 0.685 }, "Liquid range": "1432 K", "Melting point": "1768 K", "Mendeleev no": 64, "Mineral hardness": "5.0", "Molar volume": "6.67 cm<sup>3</sup>", Name: "Cobalt", "Oxidation states": [-1, 1, 2, 3, 4, 5], "Poissons ratio": "0.31", Reflectivity: "67 %", "Refractive index": "no data", "Rigidity modulus": "75 GPa", "Shannon radii": { 2: { IV: { "High Spin": { crystal_radius: 0.72, ionic_radius: 0.58 } }, V: { "": { crystal_radius: 0.81, ionic_radius: 0.67 } }, VI: { "Low Spin": { crystal_radius: 0.79, ionic_radius: 0.65 }, "High Spin": { crystal_radius: 0.885, ionic_radius: 0.745 } }, VIII: { "": { crystal_radius: 1.04, ionic_radius: 0.9 } } }, 3: { VI: { "High Spin": { crystal_radius: 0.75, ionic_radius: 0.61 }, "Low Spin": { crystal_radius: 0.685, ionic_radius: 0.545 } } }, 4: { IV: { "": { crystal_radius: 0.54, ionic_radius: 0.4 } }, VI: { "High Spin": { crystal_radius: 0.67, ionic_radius: 0.53 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "100 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2, "Velocity of sound": "4720 m s<sup>-1</sup>", "Vickers hardness": "1043 MN m<sup>-2</sup>", X: 1.88, "Youngs modulus": "209 GPa", "NMR Quadrupole Moment": { "Co-59": 420.3 }, "Metallic radius": 1.25, iupac_ordering: 67, "IUPAC ordering": 67, "Ground level": "4F9/2", "Ionization energies": [7.88101, 17.0844, 33.5, 51.27, 79.5, 102, 128.9, 157.8, 186.14, 275.4, 305.32, 336.1, 378.5, 410, 441.1, 511.96, 546.588, 1397.2, 1504.5, 1606, 1724, 1844, 1960.8, 2119.4, 2218.876, 9544.1833, 10012.122], "Electron affinity": 0.662265 }, Cr: { "Atomic mass": 51.9961, "Atomic no": 24, "Atomic orbitals": { "1s": -213.881191, "2p": -20.526273, "2s": -24.113457, "3d": -0.118123, "3p": -1.65423, "3s": -2.649085, "4s": -0.150445 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.66, "Boiling point": "2944 K", "Brinell hardness": "1120 MN m<sup>-2</sup>", "Bulk modulus": "160 GPa", "Coefficient of linear thermal expansion": "4.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3, 6], "Critical temperature": "no data K", "Density of solid": "7140 kg m<sup>-3</sup>", "Electrical resistivity": "12.7 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>5</sup>.4s<sup>1</sup>", "ICSD oxidation states": [2, 3, 4, 5, 6], "Ionic radii": { 2: 0.94 }, "Ionic radii hs": { 2: 0.94 }, "Ionic radii ls": { 2: 0.87, 3: 0.755, 4: 0.69, 5: 0.63, 6: 0.58 }, "Liquid range": "764 K", "Melting point": "2180 K", "Mendeleev no": 57, "Mineral hardness": "8.5", "Molar volume": "7.23 cm<sup>3</sup>", Name: "Chromium", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.21", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "115 GPa", "Shannon radii": { 2: { VI: { "Low Spin": { crystal_radius: 0.87, ionic_radius: 0.73 }, "High Spin": { crystal_radius: 0.94, ionic_radius: 0.8 } } }, 3: { VI: { "": { crystal_radius: 0.755, ionic_radius: 0.615 } } }, 4: { IV: { "": { crystal_radius: 0.55, ionic_radius: 0.41 } }, VI: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } } }, 5: { IV: { "": { crystal_radius: 0.485, ionic_radius: 0.345 } }, VI: { "": { crystal_radius: 0.63, ionic_radius: 0.49 } }, VIII: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } } }, 6: { IV: { "": { crystal_radius: 0.4, ionic_radius: 0.26 } }, VI: { "": { crystal_radius: 0.58, ionic_radius: 0.44 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "94 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.06, "Velocity of sound": "5940 m s<sup>-1</sup>", "Vickers hardness": "1060 MN m<sup>-2</sup>", X: 1.66, "Youngs modulus": "279 GPa", "NMR Quadrupole Moment": { "Cr-53": -150.5 }, "Metallic radius": 1.285, iupac_ordering: 58, "IUPAC ordering": 58, "Ground level": "7S3", "Ionization energies": [6.76651, 16.486305, 30.959, 49.16, 69.46, 90.6349, 160.29, 184.76, 209.5, 244.5, 270.8, 296.7, 354.7, 384.163, 1011.6, 1097.2, 1188, 1294.8, 1394.5, 1495.1, 1634.1, 1721.183, 7481.8628, 7894.7992], "Electron affinity": 0.6758412 }, Cs: { "Atomic mass": 132.9054519, "Atomic no": 55, "Atomic orbitals": { "1s": -1256.738791, "2p": -180.995344, "2s": -191.981873, "3d": -26.418398, "3p": -35.166423, "3s": -39.851584, "4d": -2.848386, "4p": -5.769326, "4s": -7.455966, "5p": -0.504903, "5s": -0.915819, "6s": -0.078699 }, "Atomic radius": 2.6, "Atomic radius calculated": 2.98, "Boiling point": "944 K", "Brinell hardness": "0.14 MN m<sup>-2</sup>", "Bulk modulus": "1.6 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "1938 K", "Density of solid": "1879 kg m<sup>-3</sup>", "Electrical resistivity": "21 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].6s<sup>1</sup>", "ICSD oxidation states": [1], "Ionic radii": { 1: 1.81 }, "Liquid range": "642.41 K", "Melting point": "301.59 K", "Mendeleev no": 8, "Mineral hardness": "0.2", "Molar volume": "70.94 cm<sup>3</sup>", Name: "Cesium", "Oxidation states": [1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 1: { VI: { "": { crystal_radius: 1.81, ionic_radius: 1.67 } }, VIII: { "": { crystal_radius: 1.88, ionic_radius: 1.74 } }, IX: { "": { crystal_radius: 1.92, ionic_radius: 1.78 } }, X: { "": { crystal_radius: 1.95, ionic_radius: 1.81 } }, XI: { "": { crystal_radius: 1.99, ionic_radius: 1.85 } }, XII: { "": { crystal_radius: 2.02, ionic_radius: 1.88 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "36 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 3.43, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.79, "Youngs modulus": "1.7 GPa", "Metallic radius": 2.719, iupac_ordering: 7, "IUPAC ordering": 7, "Ground level": "2S1/2", "Ionization energies": [3.89390572743, 23.15745, 33.195, 43, 56, 69.1, 82.9, 110.1, 125.61, 213.3, 233, 261, 289, 316, 352, 382, 413, 445, 476, 597, 629, 666, 700, 753, 791, 875, 916.1, 1592, 1672, 1757, 1848, 1936, 2029, 2137, 2230, 2329, 2422, 2683, 2767, 2859, 2945, 3118, 3214, 3392, 3485, 7989, 8224, 8484, 8726, 9350, 9629, 9974, 10208.78, 41861.075, 42912.99], "Electron affinity": 0.47163025 }, Cu: { "Atomic mass": 63.546, "Atomic no": 29, "Atomic orbitals": { "1s": -320.78852, "2p": -33.481247, "2s": -38.14131, "3d": -0.202272, "3p": -2.609244, "3s": -4.057453, "4s": -0.172056 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.45, "Boiling point": "3200 K", "Brinell hardness": "874 MN m<sup>-2</sup>", "Bulk modulus": "140 GPa", "Coefficient of linear thermal expansion": "16.5 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "8920 kg m<sup>-3</sup>", "Electrical resistivity": "1.72 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>1</sup>", "ICSD oxidation states": [1, 2, 3], "Ionic radii": { 1: 0.91, 2: 0.87, 3: 0.68 }, "Liquid range": "1842.23 K", "Melting point": "1357.77 K", "Mendeleev no": 72, "Mineral hardness": "3.0", "Molar volume": "7.11 cm<sup>3</sup>", Name: "Copper", "Oxidation states": [1, 2, 3, 4], "Poissons ratio": "0.34", Reflectivity: "90 %", "Refractive index": "no data", "Rigidity modulus": "48 GPa", "Shannon radii": { 1: { II: { "": { crystal_radius: 0.6, ionic_radius: 0.46 } }, IV: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } }, VI: { "": { crystal_radius: 0.91, ionic_radius: 0.77 } } }, 2: { IV: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } }, IVSQ: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } }, V: { "": { crystal_radius: 0.79, ionic_radius: 0.65 } }, VI: { "": { crystal_radius: 0.87, ionic_radius: 0.73 } } }, 3: { VI: { "Low Spin": { crystal_radius: 0.68, ionic_radius: 0.54 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "400 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.96, "Velocity of sound": "3570 m s<sup>-1</sup>", "Vickers hardness": "369 MN m<sup>-2</sup>", X: 1.9, "Youngs modulus": "130 GPa", "NMR Quadrupole Moment": { "Cu-63": -220.15, "Cu-65": -204.14 }, "Metallic radius": 1.278, iupac_ordering: 73, "IUPAC ordering": 73, "Ground level": "2S1/2", "Ionization energies": [7.72638, 20.29239, 36.841, 57.38, 79.8, 103, 139, 166, 198, 232.2, 265.33, 367, 401, 436, 483.1, 518.7, 552.8, 632.5, 670.608, 1690.5, 1800, 1918, 2044, 2179.4, 2307.3, 2479.1, 2586.954, 11062.4313, 11567.613], "Electron affinity": 1.235784 }, Dy: { "Atomic mass": 162.5, "Atomic no": 66, "Atomic orbitals": { "1s": -1843.229585, "2p": -281.558531, "2s": -295.342856, "3d": -47.4867, "3p": -59.091931, "3s": -65.299442, "4d": -5.686352, "4f": -0.265302, "4p": -10.094091, "4s": -12.551251, "5p": -0.90349, "5s": -1.547977, "6s": -0.132769 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.28, "Boiling point": "2840 K", "Brinell hardness": "500 MN m<sup>-2</sup>", "Bulk modulus": "41 GPa", "Coefficient of linear thermal expansion": "9.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "8551 kg m<sup>-3</sup>", "Electrical resistivity": "92.6 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>10</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 2: 1.21, 3: 1.052 }, "Liquid range": "1160 K", "Melting point": "1680 K", "Mendeleev no": 24, "Mineral hardness": "no data", "Molar volume": "19.01 cm<sup>3</sup>", Name: "Dysprosium", "Oxidation states": [2, 3], "Poissons ratio": "0.25", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "25 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.21, ionic_radius: 1.07 } }, VII: { "": { crystal_radius: 1.27, ionic_radius: 1.13 } }, VIII: { "": { crystal_radius: 1.33, ionic_radius: 1.19 } } }, 3: { VI: { "": { crystal_radius: 1.052, ionic_radius: 0.912 } }, VII: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } }, VIII: { "": { crystal_radius: 1.167, ionic_radius: 1.027 } }, IX: { "": { crystal_radius: 1.223, ionic_radius: 1.083 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "11 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.31, "Velocity of sound": "2710 m s<sup>-1</sup>", "Vickers hardness": "540 MN m<sup>-2</sup>", X: 1.22, "Youngs modulus": "61 GPa", "Metallic radius": 1.773, iupac_ordering: 38, "IUPAC ordering": 38, "Ground level": "5I8", "Ionization energies": [5.93905, 11.647, 22.89, 41.23, 62.1, 93, 110, 127, 152, 170, 192, 224, 259, 279, 300, 332, 366, 399, 431, 464.9, 664, 702, 743, 786, 827, 872, 924, 969, 1014, 1059, 1232, 1275, 1325, 1371, 1468, 1520, 1638, 1691.7, 2882, 2987, 3098, 3217, 3331, 3445, 3607, 3725, 3852, 3970, 4303, 4407, 4523, 4629, 4945, 5066, 5296, 5412, 12081, 12370, 12690, 12986, 14144, 14495, 14936, 15228.06, 61736.56, 63073.5], "Electron affinity": 0.352 }, Er: { "Atomic mass": 167.259, "Atomic no": 68, "Atomic orbitals": { "1s": -1961.799176, "2p": -302.01827, "2s": -316.310631, "3d": -51.682149, "3p": -63.818655, "3s": -70.310142, "4d": -6.127443, "4f": -0.278577, "4p": -10.819574, "4s": -13.423547, "5p": -0.935202, "5s": -1.616073, "6s": -0.134905 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.26, "Boiling point": "3141 K", "Brinell hardness": "814 MN m<sup>-2</sup>", "Bulk modulus": "44 GPa", "Coefficient of linear thermal expansion": "12.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "9066 kg m<sup>-3</sup>", "Electrical resistivity": "86.0 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>12</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 1.03 }, "Liquid range": "1371 K", "Melting point": "1802 K", "Mendeleev no": 22, "Mineral hardness": "no data", "Molar volume": "18.46 cm<sup>3</sup>", Name: "Erbium", "Oxidation states": [3], "Poissons ratio": "0.24", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "28 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.03, ionic_radius: 0.89 } }, VII: { "": { crystal_radius: 1.085, ionic_radius: 0.945 } }, VIII: { "": { crystal_radius: 1.144, ionic_radius: 1.004 } }, IX: { "": { crystal_radius: 1.202, ionic_radius: 1.062 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "15 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.29, "Velocity of sound": "2830 m s<sup>-1</sup>", "Vickers hardness": "589 MN m<sup>-2</sup>", X: 1.24, "Youngs modulus": "70 GPa", "Metallic radius": 1.756, iupac_ordering: 36, "IUPAC ordering": 36, "Ground level": "3H6", "Ionization energies": [6.1077, 11.916, 22.7, 42.42, 65.1, 96, 114, 131, 158, 177, 201, 235, 268, 290, 311, 345, 381, 415, 450, 486, 520, 555, 770, 810, 853, 899, 943, 989, 1046, 1092, 1142, 1188, 1370, 1416, 1468, 1516, 1625, 1678, 1803, 1858.5, 3157, 3265, 3381, 3505, 3624, 3742, 3916, 4038, 4170, 4294, 4639, 4748, 4866, 4978, 5329, 5455, 5695, 5815, 12918, 13217, 13548, 13855, 15146, 15511, 15971, 16274.56, 65848.24, 67241.9], "Electron affinity": 0.312 }, Es: { "Atomic mass": 252, "Atomic no": 99, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>11</sup>.7s<sup>2</sup>", "Liquid range": "no data K", "Melting point": "1133 K", "Mendeleev no": 38, "Mineral hardness": "no data", "Molar volume": "28.52 cm<sup>3</sup>", Name: "Einsteinium", "Oxidation states": [2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.45, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": 1.86, iupac_ordering: 22, "IUPAC ordering": 22, "Ground level": "4I°15/2", "Ionization energies": [6.36758, 12.2, 22.7, 38.8, 54.1, 71, 97, 112.9, 137, 157, 180, 206, 231, 252, 270, 294, 317, 342, 367, 398, 421, 576, 606, 638, 672, 705, 738, 790, 824, 861, 895, 1060, 1100, 1140, 1180, 1310, 1360, 1480, 1530, 1690, 1780, 1870, 1950, 2040, 2130, 2220, 2300, 2410, 2490, 2580, 2680, 2760, 2850, 3294, 3370, 3449, 3535, 3616, 3694, 3866, 3947, 4038, 4120, 4456, 4537, 4620, 4700, 5260, 5350, 5600, 5690, 8960, 9140, 9330, 9530, 9720, 9910, 10400, 10590, 10810, 11010, 11570, 11740, 11930, 12110, 13810, 14030, 14460, 14700, 29700, 30100, 30700, 31100, 37400, 38100, 38900, 39451.4, 154328.1, 156926], "Electron affinity": -0.3 }, Eu: { "Atomic mass": 151.964, "Atomic no": 63, "Atomic orbitals": { "1s": -1672.309322, "2p": -252.176697, "2s": -265.199534, "3d": -41.465518, "3p": -52.281987, "3s": -58.068128, "4d": -5.03242, "4f": -0.232773, "4p": -9.025455, "4s": -11.267747, "5p": -0.853575, "5s": -1.444087, "6s": -0.129426 }, "Atomic radius": 1.85, "Atomic radius calculated": 2.31, "Boiling point": "1800 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "8.3 GPa", "Coefficient of linear thermal expansion": "35 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 3], "Critical temperature": "no data K", "Density of solid": "5244 kg m<sup>-3</sup>", "Electrical resistivity": "90 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>7</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 2: 1.31, 3: 1.087 }, "Liquid range": "701 K", "Melting point": "1099 K", "Mendeleev no": 18, "Mineral hardness": "no data", "Molar volume": "28.97 cm<sup>3</sup>", Name: "Europium", "Oxidation states": [2, 3], "Poissons ratio": "0.15", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "7.9 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.31, ionic_radius: 1.17 } }, VII: { "": { crystal_radius: 1.34, ionic_radius: 1.2 } }, VIII: { "": { crystal_radius: 1.39, ionic_radius: 1.25 } }, IX: { "": { crystal_radius: 1.44, ionic_radius: 1.3 } }, X: { "": { crystal_radius: 1.49, ionic_radius: 1.35 } } }, 3: { VI: { "": { crystal_radius: 1.087, ionic_radius: 0.947 } }, VII: { "": { crystal_radius: 1.15, ionic_radius: 1.01 } }, VIII: { "": { crystal_radius: 1.206, ionic_radius: 1.066 } }, IX: { "": { crystal_radius: 1.26, ionic_radius: 1.12 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "14 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.35, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "167 MN m<sup>-2</sup>", X: 1.2, "Youngs modulus": "18 GPa", "Metallic radius": 2.041, iupac_ordering: 41, "IUPAC ordering": 41, "Ground level": "8S°7/2", "Ionization energies": [5.670385, 11.24, 24.84, 42.94, 63.2, 89, 105, 120, 144, 161, 183, 213, 243, 263, 281, 311, 344.4, 518, 553, 590, 630, 667, 709, 755, 795, 838, 879, 1037, 1078, 1124, 1167, 1249, 1296, 1406, 1456.06, 2495, 2591, 2697, 2807, 2914, 3022, 3168, 3279, 3398, 3510, 3823, 3921, 4031, 4131, 4400, 4513, 4729, 4838, 10880, 11153, 11457, 11739, 12718, 13050, 13462, 13738.58, 55865.92, 57120.64], "Electron affinity": 0.11613 }, F: { "Atomic mass": 18.9984032, "Atomic no": 9, "Atomic orbitals": { "1s": -24.189391, "2p": -0.415606, "2s": -1.086859 }, "Atomic radius": 0.5, "Atomic radius calculated": 0.42, "Boiling point": "85.03 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1], "Critical temperature": "144 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>5</sup>", "ICSD oxidation states": [-1], "Ionic radii": { "-1": 1.19, 7: 0.22 }, "Liquid range": "31.5 K", "Melting point": "53.53 K", "Mendeleev no": 102, "Mineral hardness": "no data", "Molar volume": "11.20 cm<sup>3</sup>", Name: "Fluorine", "Oxidation states": [-1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000195", "Rigidity modulus": "no data GPa", "Shannon radii": { "-1": { II: { "": { crystal_radius: 1.145, ionic_radius: 1.285 } }, III: { "": { crystal_radius: 1.16, ionic_radius: 1.3 } }, IV: { "": { crystal_radius: 1.17, ionic_radius: 1.31 } }, VI: { "": { crystal_radius: 1.19, ionic_radius: 1.33 } } }, 7: { VI: { "": { crystal_radius: 0.22, ionic_radius: 0.08 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.0277 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.47, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 3.98, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "F-19": -94.2 }, "Metallic radius": "no data", iupac_ordering: 102, "IUPAC ordering": 102, "Ground level": "2P°3/2", "Ionization energies": [17.42282, 34.97081, 62.70798, 87.175, 114.249, 157.16311, 185.1868, 953.89805, 1103.11748], "Electron affinity": 3.401189824 }, Fe: { "Atomic mass": 55.845, "Atomic no": 26, "Atomic orbitals": { "1s": -254.225505, "2p": -25.551766, "2s": -29.56486, "3d": -0.295049, "3p": -2.187523, "3s": -3.360621, "4s": -0.197978 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.56, "Boiling point": "3134 K", "Brinell hardness": "490 MN m<sup>-2</sup>", "Bulk modulus": "170 GPa", "Coefficient of linear thermal expansion": "11.8 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 3], "Critical temperature": "no data K", "Density of solid": "7874 kg m<sup>-3</sup>", "Electrical resistivity": "10 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>6</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 2: 0.92, 3: 0.785 }, "Ionic radii hs": { 2: 0.92, 3: 0.785 }, "Ionic radii ls": { 2: 0.75, 3: 0.69, 4: 0.725, 6: 0.39 }, "Liquid range": "1323 K", "Melting point": "1811 K", "Mendeleev no": 61, "Mineral hardness": "4.0", "Molar volume": "7.09 cm<sup>3</sup>", Name: "Iron", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.29", Reflectivity: "65 %", "Refractive index": "no data", "Rigidity modulus": "82 GPa", "Shannon radii": { 2: { IV: { "High Spin": { crystal_radius: 0.77, ionic_radius: 0.63 } }, IVSQ: { "High Spin": { crystal_radius: 0.78, ionic_radius: 0.64 } }, VI: { "Low Spin": { crystal_radius: 0.75, ionic_radius: 0.61 }, "High Spin": { crystal_radius: 0.92, ionic_radius: 0.78 } }, VIII: { "High Spin": { crystal_radius: 1.06, ionic_radius: 0.92 } } }, 3: { IV: { "High Spin": { crystal_radius: 0.63, ionic_radius: 0.49 } }, V: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } }, VI: { "Low Spin": { crystal_radius: 0.69, ionic_radius: 0.55 }, "High Spin": { crystal_radius: 0.785, ionic_radius: 0.645 } }, VIII: { "High Spin": { crystal_radius: 0.92, ionic_radius: 0.78 } } }, 4: { VI: { "": { crystal_radius: 0.725, ionic_radius: 0.585 } } }, 6: { IV: { "": { crystal_radius: 0.39, ionic_radius: 0.25 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "80 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.04, "Velocity of sound": "4910 m s<sup>-1</sup>", "Vickers hardness": "608 MN m<sup>-2</sup>", X: 1.83, "Youngs modulus": "211 GPa", "NMR Quadrupole Moment": { "Fe-57": 160 }, "Metallic radius": 1.277, iupac_ordering: 64, "IUPAC ordering": 64, "Ground level": "5D4", "Ionization energies": [7.9024681, 16.19921, 30.651, 54.91, 75, 98.985, 124.976, 151.06, 233.6, 262.1, 290.9, 330.8, 361, 392.2, 456.2, 489.312, 1262.7, 1357.8, 1460, 1575.6, 1687, 1798.4, 1950.4, 2045.759, 8828.1879, 9277.6818], "Electron affinity": 0.15323634 }, Fm: { "Atomic mass": 257, "Atomic no": 100, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>12</sup>.7s<sup>2</sup>", "Liquid range": "no data K", "Melting point": "about 1800 K", "Mendeleev no": 37, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Fermium", "Oxidation states": [2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.45, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 21, "IUPAC ordering": 21, "Ground level": "3H6", "Ionization energies": [6.5, 12.4, 23.2, 39.3, 55, 74, 93, 120, 136, 162, 185, 209, 237, 257, 276, 300, 326, 351, 377, 402, 430, 453, 616, 647, 680, 716, 749, 782, 837, 871, 909, 944, 1110, 1150, 1190, 1230, 1370, 1420, 1550, 1600, 1770, 1850, 1940, 2030, 2120, 2210, 2300, 2390, 2490, 2590, 2680, 2760, 2850, 2950, 3403, 3480, 3561, 3647, 3730, 3810, 3986, 4070, 4160, 4245, 4586, 4670, 4760, 4840, 5420, 5510, 5760, 5860, 9200, 9370, 9570, 9770, 9970, 10160, 10660, 10860, 11080, 11280, 11850, 12020, 12220, 12390, 14180, 14400, 14800, 15e3, 30300, 30800, 31300, 31800, 38400, 39100, 4e4, 40482.2, 158152.5, 160804], "Electron affinity": 0.35 }, Fr: { "Atomic mass": 223, "Atomic no": 87, "Atomic orbitals": { "1s": -3283.263399, "2p": -542.41424, "2s": -561.73045, "3d": -111.085223, "3p": -128.607136, "3s": -137.959632, "4d": -20.812462, "4f": -10.050648, "4p": -28.648131, "4s": -32.861013, "5d": -2.360991, "5p": -4.97328, "5s": -6.509516, "6p": -0.466197, "6s": -0.841848, "7s": -0.076176 }, "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].7s<sup>1</sup>", "Ionic radii": { 1: 1.94 }, "Liquid range": "no data K", "Melting point": "maybe about 300 K", "Mendeleev no": 7, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Francium", "Oxidation states": [1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 1: { VI: { "": { crystal_radius: 1.94, ionic_radius: 1.8 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 3.48, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.7, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 6, "IUPAC ordering": 6, "Ground level": "2S1/2", "Ionization energies": [4.0727411, 22.4, 33.5, 39.1, 50, 67, 80, 106, 120, 179, 200, 222.1, 245, 269, 293, 324, 349, 375, 400, 530, 560, 590, 620, 690, 720, 810, 850, 910, 980, 1040, 1110, 1180, 1250, 1320, 1380, 1460, 1530, 1600, 1670, 1740, 1810, 2119, 2182, 2247, 2317, 2384, 2450, 2564, 2631, 2706, 2774, 3049, 3115, 3190, 3257, 3556, 3635, 3828, 3907, 6365, 6516, 6678, 6849, 7013, 7172, 7500, 7670, 7850, 8020, 8500, 8640, 8800, 8950, 9890, 10070, 10420, 10590, 22330, 22730, 23170, 23570, 27060, 27590, 28260, 28683.4, 113817.2, 115859], "Electron affinity": 0.486 }, Ga: { "Atomic mass": 69.723, "Atomic no": 31, "Atomic orbitals": { "1s": -370.170639, "2p": -40.093339, "2s": -45.200869, "3d": -0.736204, "3p": -3.584666, "3s": -5.241645, "4p": -0.101634, "4s": -0.328019 }, "Atomic radius": 1.3, "Atomic radius calculated": 1.36, "Boiling point": "2477 K", "Brinell hardness": "60 MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "120 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "5904 kg m<sup>-3</sup>", "Electrical resistivity": "about  14 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>1</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 3: 0.76 }, "Liquid range": "2174.09 K", "Melting point": "302.91 K", "Mendeleev no": 81, "Mineral hardness": "1.5", "Molar volume": "11.80 cm<sup>3</sup>", Name: "Gallium", "Oxidation states": [1, 2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { IV: { "": { crystal_radius: 0.61, ionic_radius: 0.47 } }, V: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } }, VI: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } } } }, "Superconduction temperature": "1.083 K", "Thermal conductivity": "29 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.87, "Velocity of sound": "2740 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.81, "Youngs modulus": "no data GPa", "Metallic radius": 1.35, iupac_ordering: 79, "IUPAC ordering": 79, "Ground level": "2P°1/2", "Ionization energies": [5.999302, 20.51514, 30.72576, 63.241, 86.01, 112.7, 140.8, 169.9, 211, 244, 280, 319, 356, 471.2, 508.8, 548.3, 599.8, 640, 677, 765.7, 807.308, 2010, 2129, 2258, 2391, 2543.9, 2683, 2868, 2984.426, 12696.5575, 13239.489], "Electron affinity": 0.3012011 }, Gd: { "Atomic mass": 157.25, "Atomic no": 64, "Atomic orbitals": { "1s": -1728.625195, "2p": -262.081616, "2s": -275.36313, "3d": -43.754556, "3p": -54.836922, "3s": -60.764408, "4d": -5.531835, "4f": -0.489012, "4p": -9.669866, "4s": -11.986486, "5d": -0.12722, "5p": -0.978749, "5s": -1.608477, "6s": -0.143627 }, "Atomic radius": 1.8, "Atomic radius calculated": 2.33, "Boiling point": "3523 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "38 GPa", "Coefficient of linear thermal expansion": "9.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "7901 kg m<sup>-3</sup>", "Electrical resistivity": "131 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>7</sup>.5d<sup>1</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 1.075 }, "Liquid range": "1938 K", "Melting point": "1585 K", "Mendeleev no": 27, "Mineral hardness": "no data", "Molar volume": "19.90 cm<sup>3</sup>", Name: "Gadolinium", "Oxidation states": [1, 2, 3], "Poissons ratio": "0.26", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "22 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.078, ionic_radius: 0.938 } }, VII: { "": { crystal_radius: 1.14, ionic_radius: 1 } }, VIII: { "": { crystal_radius: 1.193, ionic_radius: 1.053 } }, IX: { "": { crystal_radius: 1.247, ionic_radius: 1.107 } } } }, "Superconduction temperature": "1.083 K", "Thermal conductivity": "11 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.34, "Velocity of sound": "2680 m s<sup>-1</sup>", "Vickers hardness": "570 MN m<sup>-2</sup>", X: 1.2, "Youngs modulus": "55 GPa", "Metallic radius": 1.802, iupac_ordering: 40, "IUPAC ordering": 40, "Ground level": "9D°2", "Ionization energies": [6.1498, 12.076, 20.54, 44.44, 64.8, 89, 106, 123, 144, 165, 183, 213, 246, 268, 288, 319, 352, 384.4, 565, 601, 639, 680, 719, 761, 810, 851, 895, 937, 1100, 1142, 1189, 1233, 1321, 1368, 1481, 1532.3, 2621, 2720, 2827, 2941, 3050, 3160, 3312, 3424, 3546, 3660, 3980, 4080, 4191, 4294, 4578, 4693, 4914, 5025, 11273, 11552, 11861, 12147, 13183, 13521, 13943, 14224.57, 57783.9, 59065.53], "Electron affinity": 0.137 }, Ge: { "Atomic mass": 72.64, "Atomic no": 32, "Atomic orbitals": { "1s": -396.292991, "2p": -43.720129, "2s": -49.055282, "3d": -1.117316, "3p": -4.194822, "3s": -5.961472, "4p": -0.149882, "4s": -0.426523 }, "Atomic radius": 1.25, "Atomic radius calculated": 1.25, "Boiling point": "3093 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-4, 2, 4], "Critical temperature": "no data K", "Density of solid": "5323 kg m<sup>-3</sup>", "Electrical resistivity": "about 50000 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>2</sup>", "ICSD oxidation states": [2, 3, 4], "Ionic radii": { 2: 0.87, 4: 0.67 }, "Liquid range": "1881.6 K", "Melting point": "1211.4 K", "Mendeleev no": 84, "Mineral hardness": "6.0", "Molar volume": "13.63 cm<sup>3</sup>", Name: "Germanium", "Oxidation states": [-4, 1, 2, 3, 4], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 0.87, ionic_radius: 0.73 } } }, 4: { IV: { "": { crystal_radius: 0.53, ionic_radius: 0.39 } }, VI: { "": { crystal_radius: 0.67, ionic_radius: 0.53 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "60 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.11, "Velocity of sound": "5400 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.01, "Youngs modulus": "no data GPa", "Metallic radius": 1.39, iupac_ordering: 84, "IUPAC ordering": 84, "Ground level": "3P0", "Ionization energies": [7.899435, 15.93461, 34.0576, 45.7155, 90.5, 115.9, 144.9, 176.4, 212.5, 252.1, 286, 326, 367, 407, 527.9, 567.3, 609.1, 662.8, 706.7, 744, 837.1, 880.44, 2180.1, 2304, 2439, 2575, 2737.1, 2881.9, 3074, 3194.293, 13557.4208, 14119.43], "Electron affinity": 1.232676413 }, H: { "Atomic mass": 1.00794, "Atomic no": 1, "Atomic orbitals": { "1s": -0.233471 }, "Atomic radius": 0.25, "Atomic radius calculated": 0.53, "Boiling point": "20.28 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1, 1], "Critical temperature": "33 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "1s<sup>1</sup>", "ICSD oxidation states": [1, -1], "Liquid range": "6.27 K", "Melting point": "14.01 K", "Mendeleev no": 103, "Mineral hardness": "no data", "Molar volume": "11.42 cm<sup>3</sup>", Name: "Hydrogen", "Oxidation states": [-1, 1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000132 (gas; liquid 1.12)(no units)", "Rigidity modulus": "no data GPa", "Shannon radii": { 1: { I: { "": { crystal_radius: -0.24, ionic_radius: -0.38 } }, II: { "": { crystal_radius: -0.04, ionic_radius: -0.18 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.1805 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.1, "Velocity of sound": "1270 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "H-2": 2.86 }, "Metallic radius": "no data", iupac_ordering: 92, "IUPAC ordering": 92, "Ground level": "2S1/2", "Ionization energies": [13.598434599702], "Electron affinity": 0.754598 }, He: { "Atomic mass": 4.002602, "Atomic no": 2, "Atomic orbitals": { "1s": -0.570425 }, "Atomic radius": "no data", "Atomic radius calculated": 0.31, "Boiling point": "4.22 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "5.19 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "1s<sup>2</sup>", "Liquid range": "3.27 K", "Max oxidation state": 0, "Melting point": "0.95 K", "Mendeleev no": 1, "Min oxidation state": 0, "Mineral hardness": "no data", "Molar volume": "21.0 cm<sup>3</sup>", Name: "Helium", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000035 (gas; liquid 1.028)(no units)", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "0.1513 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.4, "Velocity of sound": "970 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 5, "IUPAC ordering": 5, "Ground level": "1S0", "Ionization energies": [24.587389011, 54.417765486], "Electron affinity": -0.52 }, Hf: { "Atomic mass": 178.49, "Atomic no": 72, "Atomic orbitals": { "1s": -2210.65199, "2p": -345.687023, "2s": -361.006527, "3d": -61.231443, "3p": -74.452656, "3s": -81.522812, "4d": -7.676638, "4f": -0.871574, "4p": -12.971211, "4s": -15.883625, "5d": -0.143805, "5p": -1.246441, "5s": -2.049828, "6s": -0.166465 }, "Atomic radius": 1.55, "Atomic radius calculated": 2.08, "Boiling point": "4876 K", "Brinell hardness": "1700 MN m<sup>-2</sup>", "Bulk modulus": "110 GPa", "Coefficient of linear thermal expansion": "5.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "13310 kg m<sup>-3</sup>", "Electrical resistivity": "34 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>2</sup>.6s<sup>2</sup>", "ICSD oxidation states": [4], "Ionic radii": { 4: 0.85 }, "Liquid range": "2370 K", "Melting point": "2506 K", "Mendeleev no": 50, "Mineral hardness": "5.5", "Molar volume": "13.44 cm<sup>3</sup>", Name: "Hafnium", "Oxidation states": [2, 3, 4], "Poissons ratio": "0.37", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "30 GPa", "Shannon radii": { 4: { IV: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } }, VI: { "": { crystal_radius: 0.85, ionic_radius: 0.71 } }, VII: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } }, VIII: { "": { crystal_radius: 0.97, ionic_radius: 0.83 } } } }, "Superconduction temperature": "0.128 K", "Thermal conductivity": "23 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.23, "Velocity of sound": "3010 m s<sup>-1</sup>", "Vickers hardness": "1760 MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "78 GPa", "Metallic radius": 1.58, iupac_ordering: 50, "IUPAC ordering": 50, "Ground level": "3F2", "Ionization energies": [6.82507, 14.61, 22.55, 33.37, 68.37, 98, 118, 137, 157, 187, 209, 230, 270, 310, 334, 359, 399, 440, 481, 520, 570, 610, 650, 690, 730, 772, 1002, 1047, 1094, 1146, 1195, 1245, 1311, 1362, 1417, 1467, 1669, 1719, 1776, 1827, 1963, 2022, 2159, 2218.9, 3741, 3858, 3984, 4118, 4246, 4372, 4573, 4703, 4846, 4980, 5350, 5468, 5595, 5713, 6149, 6284, 6545, 6674, 14678, 14999, 15351, 15680, 17280, 17680, 18180, 18502.32, 74565.93, 76077.8], "Electron affinity": 0.17807 }, Hg: { "Atomic mass": 200.59, "Atomic no": 80, "Atomic orbitals": { "1s": -2755.022637, "2p": -443.848676, "2s": -461.27864, "3d": -84.845492, "3p": -100.328031, "3s": -108.597921, "4d": -13.019221, "4f": -4.110291, "4p": -19.636187, "4s": -23.222921, "5d": -0.452552, "5p": -2.261975, "5s": -3.423486, "6s": -0.205137 }, "Atomic radius": 1.5, "Atomic radius calculated": 1.71, "Boiling point": "629.88 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "25 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1, 2], "Critical temperature": "1750 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "96 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>", "ICSD oxidation states": [1, 2], "Ionic radii": { 1: 1.33, 2: 1.16 }, "Liquid range": "395.56 K", "Melting point": "234.32 K", "Mendeleev no": 74, "Mineral hardness": "1.5", "Molar volume": "14.09 cm<sup>3</sup>", Name: "Mercury", "Oxidation states": [1, 2, 4], "Poissons ratio": "no data", Reflectivity: "73 %", "Refractive index": "1.000933", "Rigidity modulus": "no data GPa", "Shannon radii": { 1: { III: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } }, VI: { "": { crystal_radius: 1.33, ionic_radius: 1.19 } } }, 2: { II: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } }, IV: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } }, VI: { "": { crystal_radius: 1.16, ionic_radius: 1.02 } }, VIII: { "": { crystal_radius: 1.28, ionic_radius: 1.14 } } } }, "Superconduction temperature": "3.95 K", "Thermal conductivity": "8.3 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.23, "Velocity of sound": "1407 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "Hg-201": 387.6 }, "Metallic radius": 1.51, iupac_ordering: 74, "IUPAC ordering": 74, "Ground level": "1S0", "Ionization energies": [10.437504, 18.75688, 34.49, 48.55, 61.2, 76.6, 93, 113.9, 134, 153, 173, 192.7, 276.9, 307, 332, 357, 402, 429, 477, 530, 560, 590, 650, 710, 760, 820, 880, 930, 990, 1050, 1110, 1160, 1220, 1280, 1549, 1603, 1661, 1723, 1780, 1839, 1928, 1989, 2052, 2113, 2354, 2412, 2478, 2539, 2745, 2815, 2981, 3049.9, 5055, 5191, 5335, 5490, 5636, 5780, 6041, 6192, 6356, 6508, 6933, 7066, 7211, 7350, 8010, 8160, 8470, 8620, 18550, 18910, 19310, 19680, 22120, 22580, 23170, 23544.1, 94124.7, 95897.7], "Electron affinity": -0.52 }, Ho: { "Atomic mass": 164.93032, "Atomic no": 67, "Atomic orbitals": { "1s": -1902.051908, "2p": -291.700994, "2s": -305.739294, "3d": -49.565996, "3p": -61.436304, "3s": -67.785492, "4d": -5.906195, "4f": -0.272677, "4p": -10.455303, "4s": -12.985498, "5p": -0.919463, "5s": -1.582088, "6s": -0.133845 }, "Atomic radius": 1.75, "Atomic radius calculated": "no data", "Boiling point": "2993 K", "Brinell hardness": "746 MN m<sup>-2</sup>", "Bulk modulus": "40 GPa", "Coefficient of linear thermal expansion": "11.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "8795 kg m<sup>-3</sup>", "Electrical resistivity": "81.4 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>11</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 1.041 }, "Liquid range": "1259 K", "Melting point": "1734 K", "Mendeleev no": 23, "Mineral hardness": "no data", "Molar volume": "18.74 cm<sup>3</sup>", Name: "Holmium", "Oxidation states": [3], "Poissons ratio": "0.23", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "26 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.041, ionic_radius: 0.901 } }, VIII: { "": { crystal_radius: 1.155, ionic_radius: 1.015 } }, IX: { "": { crystal_radius: 1.212, ionic_radius: 1.072 } }, X: { "": { crystal_radius: 1.26, ionic_radius: 1.12 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "16 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.3, "Velocity of sound": "2760 m s<sup>-1</sup>", "Vickers hardness": "481 MN m<sup>-2</sup>", X: 1.23, "Youngs modulus": "65 GPa", "Metallic radius": 1.765, iupac_ordering: 37, "IUPAC ordering": 37, "Ground level": "4I°15/2", "Ionization energies": [6.0215, 11.781, 22.79, 42.52, 63.9, 95, 112, 129, 155, 173, 197, 229, 263, 284, 305, 340, 373, 408, 441, 475, 510, 715, 755, 797, 842, 885, 929, 985, 1029, 1077, 1122, 1300, 1346, 1395, 1443, 1545, 1598, 1719, 1773.6, 3018, 3125, 3238, 3359, 3476, 3592, 3760, 3880, 4009, 4131, 4469, 4576, 4693, 4802, 5135, 5258, 5494, 5611, 12495, 12790, 13116, 13417, 14639, 14998, 15448, 15745.77, 63772.43, 65136.8], "Electron affinity": 0.338 }, I: { "Atomic mass": 126.90447, "Atomic no": 53, "Atomic orbitals": { "1s": -1161.787047, "2p": -164.603788, "2s": -175.073804, "3d": -22.600693, "3p": -30.831092, "3s": -35.243351, "4d": -1.938179, "4p": -4.572522, "4s": -6.115811, "5p": -0.267904, "5s": -0.596339 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.15, "Boiling point": "457.4 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "7.7 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-1, 1, 3, 5, 7], "Critical temperature": "819 K", "Density of solid": "4940 kg m<sup>-3</sup>", "Electrical resistivity": "&gt; 10<sup>15</sup>10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>5</sup>", "ICSD oxidation states": [5, -1], "Ionic radii": { "-1": 2.06, 5: 1.09, 7: 0.67 }, "Liquid range": "70.55 K", "Melting point": "386.85 K", "Mendeleev no": 97, "Mineral hardness": "no data", "Molar volume": "25.72 cm<sup>3</sup>", Name: "Iodine", "Oxidation states": [-1, 1, 3, 5, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { "-1": { VI: { "": { crystal_radius: 2.06, ionic_radius: 2.2 } } }, 5: { IIIPY: { "": { crystal_radius: 0.58, ionic_radius: 0.44 } }, VI: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } } }, 7: { IV: { "": { crystal_radius: 0.56, ionic_radius: 0.42 } }, VI: { "": { crystal_radius: 0.67, ionic_radius: 0.53 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.449 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.98, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.66, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "I-127": -696.12, "I-129": -604.1 }, "Metallic radius": "no data", iupac_ordering: 99, "IUPAC ordering": 99, "Ground level": "2P°3/2", "Ionization energies": [10.45126, 19.13126, 29.57, 40.357, 51.52, 74.4, 87.61, 150.81, 171, 197, 220.9, 247, 279, 307, 335, 365, 393, 505, 535, 569, 601, 649, 683, 762, 800.8, 1397, 1472, 1553, 1639, 1720, 1812, 1911, 1999, 2093, 2181, 2431, 2510, 2598, 2680, 2836, 2926, 3096, 3185.5, 7337, 7563, 7811, 8044, 8601, 8867, 9196, 9421.1, 38716.996, 39721.41], "Electron affinity": 3.05905238 }, In: { "Atomic mass": 114.818, "Atomic no": 49, "Atomic orbitals": { "1s": -983.647445, "2p": -134.628845, "2s": -144.078357, "3d": -16.139823, "3p": -23.345778, "3s": -27.2206, "4d": -0.730481, "4p": -2.795832, "4s": -4.062639, "5p": -0.101782, "5s": -0.290497 }, "Atomic radius": 1.55, "Atomic radius calculated": 1.56, "Boiling point": "2345 K", "Brinell hardness": "8.83 MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "32.1 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "7310 kg m<sup>-3</sup>", "Electrical resistivity": "8 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>1</sup>", "ICSD oxidation states": [1, 2, 3], "Ionic radii": { 3: 0.94 }, "Liquid range": "1915.25 K", "Melting point": "429.75 K", "Mendeleev no": 79, "Mineral hardness": "1.2", "Molar volume": "15.76 cm<sup>3</sup>", Name: "Indium", "Oxidation states": [1, 2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { IV: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } }, VI: { "": { crystal_radius: 0.94, ionic_radius: 0.8 } }, VIII: { "": { crystal_radius: 1.06, ionic_radius: 0.92 } } } }, "Superconduction temperature": "3.41 K", "Thermal conductivity": "82 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.93, "Velocity of sound": "1215 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.78, "Youngs modulus": "11 GPa", "NMR Quadrupole Moment": { "In-113": 759.8, "In-115": 770.8 }, "Metallic radius": 1.67, iupac_ordering: 78, "IUPAC ordering": 78, "Ground level": "2P°1/2", "Ionization energies": [5.7863557, 18.87041, 28.04415, 55.45, 69.3, 90, 109, 130.1, 156, 178, 201, 226, 249, 341, 368, 396, 425, 462, 497.1, 560, 593.38, 1043, 1109, 1181, 1255, 1328, 1413, 1496, 1575, 1659, 1738, 1961, 2028.5, 2111, 2207, 2317, 2373, 2555, 2628.77, 6126, 6331, 6554, 6770, 7196, 7442, 7754, 7953.14, 32837.592, 33750.31], "Electron affinity": 0.383926 }, Ir: { "Atomic mass": 192.217, "Atomic no": 77, "Atomic orbitals": { "1s": -2543.761342, "2p": -405.526834, "2s": -422.159424, "3d": -75.485027, "3p": -90.108427, "3s": -97.923081, "4d": -10.856593, "4f": -2.738339, "4p": -16.966578, "4s": -20.29429, "5d": -0.335189, "5p": -1.883349, "5s": -2.909174, "6s": -0.195511 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.8, "Boiling point": "4701 K", "Brinell hardness": "1670 MN m<sup>-2</sup>", "Bulk modulus": "320 GPa", "Coefficient of linear thermal expansion": "6.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3, 4], "Critical temperature": "no data K", "Density of solid": "22650 kg m<sup>-3</sup>", "Electrical resistivity": "4.7 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>7</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4, 5], "Ionic radii": { 3: 0.82, 4: 0.765, 5: 0.71 }, "Liquid range": "1962 K", "Melting point": "2739 K", "Mendeleev no": 66, "Mineral hardness": "6.5", "Molar volume": "8.52 cm<sup>3</sup>", Name: "Iridium", "Oxidation states": [-3, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.26", Reflectivity: "78 %", "Refractive index": "no data", "Rigidity modulus": "210 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } } }, 4: { VI: { "": { crystal_radius: 0.765, ionic_radius: 0.625 } } }, 5: { VI: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } } } }, "Superconduction temperature": "0.11 K", "Thermal conductivity": "150 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.13, "Velocity of sound": "4825 m s<sup>-1</sup>", "Vickers hardness": "1760 MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "528 GPa", "Metallic radius": 1.357, iupac_ordering: 65, "IUPAC ordering": 65, "Ground level": "4F9/2", "Ionization energies": [8.96702, 17, 28, 40, 57, 72, 89, 105, 122.7, 194.8, 217, 240, 264, 303, 329, 356, 407, 445, 472, 510, 560, 610, 670, 720, 770, 820, 870, 920, 980, 1030, 1080, 1331, 1381, 1436, 1493, 1548, 1603, 1684, 1739, 1801, 1857, 2083, 2139, 2201, 2258, 2435, 2500, 2656, 2720.4, 4540, 4668, 4806, 4952, 5092, 5229, 5466, 5609, 5765, 5910, 6315, 6441, 6580, 6708, 7274, 7421, 7710, 7850, 17040, 17390, 17770, 18120, 20210, 20650, 21200, 21556.6, 86438.9, 88113.3], "Electron affinity": 1.5643615 }, K: { "Atomic mass": 39.0983, "Atomic no": 19, "Atomic orbitals": { "1s": -128.414957, "2p": -10.283851, "2s": -12.839001, "3p": -0.693776, "3s": -1.281897, "4s": -0.088815 }, "Atomic radius": 2.2, "Atomic radius calculated": 2.43, "Boiling point": "1032 K", "Brinell hardness": "0.363 MN m<sup>-2</sup>", "Bulk modulus": "3.1 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "2223 K", "Density of solid": "856 kg m<sup>-3</sup>", "Electrical resistivity": "7.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].4s<sup>1</sup>", "ICSD oxidation states": [1], "Ionic radii": { 1: 1.52 }, "Liquid range": "695.47 K", "Melting point": "336.53 K", "Mendeleev no": 10, "Mineral hardness": "0.4", "Molar volume": "45.94 cm<sup>3</sup>", Name: "Potassium", "Oxidation states": [-1, 1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "1.3 GPa", "Shannon radii": { 1: { IV: { "": { crystal_radius: 1.51, ionic_radius: 1.37 } }, VI: { "": { crystal_radius: 1.52, ionic_radius: 1.38 } }, VII: { "": { crystal_radius: 1.6, ionic_radius: 1.46 } }, VIII: { "": { crystal_radius: 1.65, ionic_radius: 1.51 } }, IX: { "": { crystal_radius: 1.69, ionic_radius: 1.55 } }, X: { "": { crystal_radius: 1.73, ionic_radius: 1.59 } }, XII: { "": { crystal_radius: 1.78, ionic_radius: 1.64 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "100 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.75, "Velocity of sound": "2000 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.82, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "K-39": 58.5, "K-40": -73, "K-41": 71.1 }, "Metallic radius": 2.381, iupac_ordering: 9, "IUPAC ordering": 9, "Ground level": "2S1/2", "Ionization energies": [4.34066373, 31.625, 45.8031, 60.917, 82.66, 99.44, 117.56, 154.87, 175.8174, 503.67, 565.6, 631.1, 714.7, 786.3, 860.92, 967.7, 1034.542, 4610.87018, 4934.0484], "Electron affinity": 0.50145913 }, Kr: { "Atomic mass": 83.798, "Atomic no": 36, "Atomic orbitals": { "1s": -509.982989, "2p": -60.017328, "2s": -66.285953, "3d": -3.074109, "3p": -7.086634, "3s": -9.315192, "4p": -0.34634, "4s": -0.820574 }, "Atomic radius": "no data", "Atomic radius calculated": 0.88, "Boiling point": "119.93 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "209.4 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>6</sup>", "Liquid range": "4.14 K", "Max oxidation state": 0, "Melting point": "115.79 K", "Mendeleev no": 4, "Min oxidation state": 0, "Mineral hardness": "no data", "Molar volume": "27.99 cm<sup>3</sup>", Name: "Krypton", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000427", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "0.00943 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.02, "Velocity of sound": "1120 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 3, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 2, "IUPAC ordering": 2, "Ground level": "1S0", "Ionization energies": [13.9996055, 24.35984, 35.838, 50.85, 64.69, 78.49, 109.13, 125.802, 233, 268, 308, 350, 391, 446, 492, 540, 591, 640, 785, 831.6, 882.8, 945, 999, 1042, 1155, 1205.23, 2928.9, 3072, 3228, 3380, 3584, 3752, 3971, 4109.083, 17296.421, 17936.209], "Electron affinity": -1.02 }, La: { "Atomic mass": 138.90547, "Atomic no": 57, "Atomic orbitals": { "1s": -1355.622446, "2p": -198.325243, "2s": -209.831151, "3d": -30.626696, "3p": -39.895838, "3s": -44.856283, "4d": -3.95801, "4p": -7.167724, "4s": -9.000543, "5d": -0.141085, "5p": -0.824498, "5s": -1.324936, "6s": -0.132233 }, "Atomic radius": 1.95, "Atomic radius calculated": "no data", "Boiling point": "3743 K", "Brinell hardness": "363 MN m<sup>-2</sup>", "Bulk modulus": "28 GPa", "Coefficient of linear thermal expansion": "12.1 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "6146 kg m<sup>-3</sup>", "Electrical resistivity": "61.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].5d<sup>1</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 3: 1.172 }, "Liquid range": "2550 K", "Melting point": "1193 K", "Mendeleev no": 33, "Mineral hardness": "2.5", "Molar volume": "22.39 cm<sup>3</sup>", Name: "Lanthanum", "Oxidation states": [2, 3], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "14 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.172, ionic_radius: 1.032 } }, VII: { "": { crystal_radius: 1.24, ionic_radius: 1.1 } }, VIII: { "": { crystal_radius: 1.3, ionic_radius: 1.16 } }, IX: { "": { crystal_radius: 1.356, ionic_radius: 1.216 } }, X: { "": { crystal_radius: 1.41, ionic_radius: 1.27 } }, XII: { "": { crystal_radius: 1.5, ionic_radius: 1.36 } } } }, "Superconduction temperature": "6.00 K", "Thermal conductivity": "13 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.43, "Velocity of sound": "2475 m s<sup>-1</sup>", "Vickers hardness": "491 MN m<sup>-2</sup>", X: 1.1, "Youngs modulus": "37 GPa", "NMR Quadrupole Moment": { "La-139": 200.6 }, "Metallic radius": 1.877, iupac_ordering: 47, "IUPAC ordering": 47, "Ground level": "2D3/2", "Ionization energies": [5.5769, 11.18496, 19.1773, 49.95, 61.6, 74, 88, 105, 119, 151.4, 168.77, 275, 303, 332, 364, 393, 431, 464, 498, 533, 566, 696, 731, 770, 806, 865, 906, 995, 1039.09, 1800, 1884, 1974, 2069, 2162, 2259, 2377, 2473, 2577, 2674, 2950, 3036, 3133, 3222, 3416, 3515, 3704, 3800, 8669, 8914, 9184, 9437, 10136, 10426, 10789, 11033.4, 45144.996, 46245.6], "Electron affinity": 0.5575462 }, Li: { "Atomic mass": 6.941, "Atomic no": 3, "Atomic orbitals": { "1s": -1.878564, "2s": -0.10554 }, "Atomic radius": 1.45, "Atomic radius calculated": 1.67, "Boiling point": "1615 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "11 GPa", "Coefficient of linear thermal expansion": "46 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "3223 K", "Density of solid": "535 kg m<sup>-3</sup>", "Electrical resistivity": "9.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>1</sup>", "ICSD oxidation states": [1], "Ionic radii": { 1: 0.9 }, "Liquid range": "1161.31 K", "Melting point": "453.69 K", "Mendeleev no": 12, "Mineral hardness": "0.6", "Molar volume": "13.02 cm<sup>3</sup>", Name: "Lithium", "Oxidation states": [1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "4.2 GPa", "Shannon radii": { 1: { IV: { "": { crystal_radius: 0.73, ionic_radius: 0.59 } }, VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } }, VIII: { "": { crystal_radius: 1.06, ionic_radius: 0.92 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "85 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.82, "Velocity of sound": "6000 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.98, "Youngs modulus": "4.9 GPa", "NMR Quadrupole Moment": { "Li-6": -0.808, "Li-7": -40.1 }, "Metallic radius": 1.52, iupac_ordering: 11, "IUPAC ordering": 11, "Ground level": "2S1/2", "Ionization energies": [5.391714996, 75.640097, 122.45435914], "Electron affinity": 0.61804922 }, Lr: { "Atomic mass": 262, "Atomic no": 103, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>14</sup>.7s<sup>2</sup>.7p<sup>1</sup> (tentative)", "Liquid range": "no data K", "Melting point": "about 1900 K", "Mendeleev no": 34, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Lawrencium", "Oxidation states": [3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": "no data", "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 18, "IUPAC ordering": 18, "Ground level": "2P°1/2", "Ionization energies": [4.96, 14.54, 21.8, 43.6, 56, 80, 96, 121, 143, 165, 197, 216, 244, 269, 290, 322, 344, 374, 403, 431, 459, 487, 510, 540, 560, 745, 779, 814, 852, 888, 922, 985, 1020, 1061, 1098, 1280, 1320, 1360, 1410, 1570, 1620, 1760, 1810, 2010, 2100, 2190, 2290, 2380, 2470, 2570, 2670, 2780, 2860, 2960, 3060, 3150, 3250, 3741, 3821, 3906, 3996, 4082, 4165, 4360, 4448, 4540, 4630, 4990, 5070, 5160, 5250, 5920, 6030, 6290, 6390, 9920, 10110, 10310, 10520, 10720, 10920, 11470, 11680, 11910, 12120, 12710, 12890, 13090, 13300, 15300, 15600, 16e3, 16200, 32400, 32900, 33400, 33900, 41600, 42300, 43200, 43759, null, 172930], "Electron affinity": -0.31 }, Lu: { "Atomic mass": 174.967, "Atomic no": 71, "Atomic orbitals": { "1s": -2146.885351, "2p": -334.330902, "2s": -349.390492, "3d": -58.592982, "3p": -71.538779, "3s": -78.462398, "4d": -7.113364, "4f": -0.568096, "4p": -12.250904, "4s": -15.08337, "5d": -0.103686, "5p": -1.111991, "5s": -1.872086, "6s": -0.155112 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.17, "Boiling point": "3675 K", "Brinell hardness": "893 MN m<sup>-2</sup>", "Bulk modulus": "48 GPa", "Coefficient of linear thermal expansion": "9.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "9841 kg m<sup>-3</sup>", "Electrical resistivity": "58 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>1</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 1.001 }, "Liquid range": "1750 K", "Melting point": "1925 K", "Mendeleev no": 20, "Mineral hardness": "no data", "Molar volume": "17.78 cm<sup>3</sup>", Name: "Lutetium", "Oxidation states": [3], "Poissons ratio": "0.26", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "27 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.001, ionic_radius: 0.861 } }, VIII: { "": { crystal_radius: 1.117, ionic_radius: 0.977 } }, IX: { "": { crystal_radius: 1.172, ionic_radius: 1.032 } } } }, "Superconduction temperature": "0.022 K", "Thermal conductivity": "16 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.24, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "1160 MN m<sup>-2</sup>", X: 1.27, "Youngs modulus": "69 GPa", "Metallic radius": 1.735, iupac_ordering: 33, "IUPAC ordering": 33, "Ground level": "2D3/2", "Ionization energies": [5.425871, 14.13, 20.9594, 45.249, 66.8, 98, 117, 136, 159, 185, 205, 238, 276, 305, 328, 361, 399, 438, 476, 520, 560, 600, 630, 670, 713, 941, 985, 1032, 1081, 1130, 1178, 1242, 1292, 1345, 1395, 1591, 1641, 1696, 1747, 1875, 1933, 2067, 2125.5, 3590, 3706, 3828, 3960, 4086, 4211, 4403, 4532, 4673, 4803, 5168, 5282, 5408, 5525, 5937, 6070, 6326, 6452, 14228, 14542, 14890, 15211, 16730, 17120, 17610, 17928.05, 72322.91, 73804.8], "Electron affinity": 0.23887 }, Md: { "Atomic mass": 258, "Atomic no": 101, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>13</sup>.7s<sup>2</sup>", "Liquid range": "no data K", "Melting point": "about 1100 K", "Mendeleev no": 36, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Mendelevium", "Oxidation states": [2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.46, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 20, "IUPAC ordering": 20, "Ground level": "2F°7/2", "Ionization energies": [6.58, 12.4, 24.3, 40, 54.1, 76, 96, 115.1, 143.9, 162, 187, 215, 240, 260, 282, 307, 334, 360, 386, 412, 438, 462, 486, 659, 690, 723, 760, 794, 828, 885, 920, 958, 994, 1160, 1210, 1250, 1290, 1430, 1480, 1620, 1660, 1840, 1930, 2020, 2110, 2200, 2290, 2390, 2480, 2580, 2680, 2760, 2860, 2950, 3050, 3513, 3592, 3675, 3762, 3845, 3926, 4109, 4194, 4286, 4371, 4720, 4800, 4890, 4970, 5580, 5680, 5930, 6030, 9430, 9620, 9810, 10020, 10220, 10410, 10930, 11130, 11350, 11560, 12130, 12310, 12500, 12680, 14560, 14800, 15200, 15400, 31e3, 31500, 32e3, 32500, 39500, 40100, 41e3, 41548, null, 164764], "Electron affinity": 0.98 }, Mg: { "Atomic mass": 24.305, "Atomic no": 12, "Atomic orbitals": { "1s": -45.973167, "2p": -1.71897, "2s": -2.903746, "3s": -0.175427 }, "Atomic radius": 1.5, "Atomic radius calculated": 1.45, "Boiling point": "1363 K", "Brinell hardness": "260 MN m<sup>-2</sup>", "Bulk modulus": "45 GPa", "Coefficient of linear thermal expansion": "8.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "1738 kg m<sup>-3</sup>", "Electrical resistivity": "4.4 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 0.86 }, "Liquid range": "440 K", "Melting point": "923 K", "Mendeleev no": 73, "Mineral hardness": "2.5", "Molar volume": "14.00 cm<sup>3</sup>", Name: "Magnesium", "Oxidation states": [1, 2], "Poissons ratio": "0.29", Reflectivity: "74 %", "Refractive index": "no data", "Rigidity modulus": "17 GPa", "Shannon radii": { 2: { IV: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } }, V: { "": { crystal_radius: 0.8, ionic_radius: 0.66 } }, VI: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } }, VIII: { "": { crystal_radius: 1.03, ionic_radius: 0.89 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "160 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.73, "Velocity of sound": "4602 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.31, "Youngs modulus": "45 GPa", "NMR Quadrupole Moment": { "Mg-25": 199.4 }, "Metallic radius": 1.6, iupac_ordering: 16, "IUPAC ordering": 16, "Ground level": "1S0", "Ionization energies": [7.646236, 15.035271, 80.1436, 109.2654, 141.33, 186.76, 225.02, 265.924, 327.99, 367.489, 1761.80488, 1962.66366], "Electron affinity": -0.42 }, Mn: { "Atomic mass": 54.938045, "Atomic no": 25, "Atomic orbitals": { "1s": -233.696912, "2p": -23.066297, "2s": -26.866646, "3d": -0.26654, "3p": -1.99145, "3s": -3.076637, "4s": -0.191136 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.61, "Boiling point": "2334 K", "Brinell hardness": "196 MN m<sup>-2</sup>", "Bulk modulus": "120 GPa", "Coefficient of linear thermal expansion": "21.7 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 4, 7], "Critical temperature": "no data K", "Density of solid": "7470 kg m<sup>-3</sup>", "Electrical resistivity": "144 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>5</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2, 3, 4, 7], "Ionic radii": { 2: 0.97, 3: 0.785, 4: 0.67, 5: 0.47, 6: 0.395, 7: 0.6 }, "Ionic radii hs": { 2: 0.97, 3: 0.785 }, "Ionic radii ls": { 2: 0.81, 3: 0.72, 4: 0.67, 5: 0.47, 6: 0.395, 7: 0.6 }, "Liquid range": "815 K", "Melting point": "1519 K", "Mendeleev no": 60, "Mineral hardness": "6.0", "Molar volume": "7.35 cm<sup>3</sup>", Name: "Manganese", "Oxidation states": [-3, -2, -1, 1, 2, 3, 4, 5, 6, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { IV: { "High Spin": { crystal_radius: 0.8, ionic_radius: 0.66 } }, V: { "High Spin": { crystal_radius: 0.89, ionic_radius: 0.75 } }, VI: { "Low Spin": { crystal_radius: 0.81, ionic_radius: 0.67 }, "High Spin": { crystal_radius: 0.97, ionic_radius: 0.83 } }, VII: { "High Spin": { crystal_radius: 1.04, ionic_radius: 0.9 } }, VIII: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } } }, 3: { V: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } }, VI: { "Low Spin": { crystal_radius: 0.72, ionic_radius: 0.58 }, "High Spin": { crystal_radius: 0.785, ionic_radius: 0.645 } } }, 4: { IV: { "": { crystal_radius: 0.53, ionic_radius: 0.39 } }, VI: { "": { crystal_radius: 0.67, ionic_radius: 0.53 } } }, 5: { IV: { "": { crystal_radius: 0.47, ionic_radius: 0.33 } } }, 6: { IV: { "": { crystal_radius: 0.395, ionic_radius: 0.255 } } }, 7: { IV: { "": { crystal_radius: 0.39, ionic_radius: 0.25 } }, VI: { "": { crystal_radius: 0.6, ionic_radius: 0.46 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "7.8 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.05, "Velocity of sound": "5150 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.55, "Youngs modulus": "198 GPa", "NMR Quadrupole Moment": { "Mn-55": 330.1 }, "Metallic radius": 1.292, iupac_ordering: 61, "IUPAC ordering": 61, "Ground level": "6S5/2", "Ionization energies": [7.434038, 15.63999, 33.668, 51.21, 72.41, 95.604, 119.203, 195.5, 221.89, 248.6, 286.1, 314.4, 343.6, 402.95, 435.172, 1133.7, 1224.1, 1320.3, 1430.9, 1537.2, 1643.2, 1788.7, 1879.873, 8140.7872, 8571.9488], "Electron affinity": -0.52 }, Mo: { "Atomic mass": 95.94, "Atomic no": 42, "Atomic orbitals": { "1s": -709.232119, "2p": -90.791541, "2s": -98.503638, "3d": -8.257721, "3p": -13.71481, "3s": -16.681545, "4d": -0.153347, "4p": -1.39005, "4s": -2.234824, "5s": -0.14788 }, "Atomic radius": 1.45, "Atomic radius calculated": 1.9, "Boiling point": "4912 K", "Brinell hardness": "1500 MN m<sup>-2</sup>", "Bulk modulus": "230 GPa", "Coefficient of linear thermal expansion": "4.8 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4, 6], "Critical temperature": "no data K", "Density of solid": "10280 kg m<sup>-3</sup>", "Electrical resistivity": "5.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>5</sup>.5s<sup>1</sup>", "ICSD oxidation states": [2, 3, 4, 5, 6], "Ionic radii": { 3: 0.83, 4: 0.79, 5: 0.75, 6: 0.73 }, "Liquid range": "2016 K", "Melting point": "2896 K", "Mendeleev no": 56, "Mineral hardness": "5.5", "Molar volume": "9.38 cm<sup>3</sup>", Name: "Molybdenum", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.31", Reflectivity: "58 %", "Refractive index": "no data", "Rigidity modulus": "20 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } } }, 4: { VI: { "": { crystal_radius: 0.79, ionic_radius: 0.65 } } }, 5: { IV: { "": { crystal_radius: 0.6, ionic_radius: 0.46 } }, VI: { "": { crystal_radius: 0.75, ionic_radius: 0.61 } } }, 6: { IV: { "": { crystal_radius: 0.55, ionic_radius: 0.41 } }, V: { "": { crystal_radius: 0.64, ionic_radius: 0.5 } }, VI: { "": { crystal_radius: 0.73, ionic_radius: 0.59 } }, VII: { "": { crystal_radius: 0.87, ionic_radius: 0.73 } } } }, "Superconduction temperature": "0.915 K", "Thermal conductivity": "139 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.17, "Velocity of sound": "6190 m s<sup>-1</sup>", "Vickers hardness": "1530 MN m<sup>-2</sup>", X: 2.16, "Youngs modulus": "329 GPa", "Metallic radius": 1.402, iupac_ordering: 57, "IUPAC ordering": 57, "Ground level": "7S3", "Ionization energies": [7.09243, 16.16, 27.13, 40.33, 54.417, 68.82704, 125.638, 143.6, 164.12, 186.3, 209.3, 230.28, 279.1, 302.6, 544, 591, 646, 702, 758, 829, 890, 953, 1019, 1082, 1263, 1319.6, 1385.1, 1462, 1537, 1587, 1730.1, 1790.93, 4259, 4430, 4618, 4800, 5084, 5287, 5548, 5713.194, 23810.654, 24572.156], "Electron affinity": 0.74733 }, N: { "Atomic mass": 14.0067, "Atomic no": 7, "Atomic orbitals": { "1s": -14.011501, "2p": -0.266297, "2s": -0.676151 }, "Atomic radius": 0.65, "Atomic radius calculated": 0.56, "Boiling point": "77.36 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-3, 3, 5], "Critical temperature": "126.2 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>3</sup>", "ICSD oxidation states": [1, 3, 5, -1, -3, -2], "Ionic radii": { "-3": 1.32, 3: 0.3, 5: 0.27 }, "Liquid range": "14.31 K", "Melting point": "63.05 K", "Mendeleev no": 100, "Mineral hardness": "no data", "Molar volume": "13.54 cm<sup>3</sup>", Name: "Nitrogen", "Oxidation states": [-3, -2, -1, 1, 2, 3, 4, 5], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000298 (gas; liquid 1.197)(no units)", "Rigidity modulus": "no data GPa", "Shannon radii": { "-3": { IV: { "": { crystal_radius: 1.32, ionic_radius: 1.46 } } }, 3: { VI: { "": { crystal_radius: 0.3, ionic_radius: 0.16 } } }, 5: { III: { "": { crystal_radius: 0.044, ionic_radius: -0.104 } }, VI: { "": { crystal_radius: 0.27, ionic_radius: 0.13 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.02583 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.55, "Velocity of sound": "333.6 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 3.04, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "N-14": 20.44 }, "Metallic radius": "no data", iupac_ordering: 91, "IUPAC ordering": 91, "Ground level": "4S°3/2", "Ionization energies": [14.53413, 29.60125, 47.4453, 77.4735, 97.8901, 552.06733, 667.046121], "Electron affinity": -0.07 }, Na: { "Atomic mass": 22.98976928, "Atomic no": 11, "Atomic orbitals": { "1s": -37.719975, "2p": -1.060636, "2s": -2.063401, "3s": -0.103415 }, "Atomic radius": 1.8, "Atomic radius calculated": 1.9, "Boiling point": "1156 K", "Brinell hardness": "0.69 MN m<sup>-2</sup>", "Bulk modulus": "6.3 GPa", "Coefficient of linear thermal expansion": "71 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "2573 K", "Density of solid": "968 kg m<sup>-3</sup>", "Electrical resistivity": "4.9 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>1</sup>", "ICSD oxidation states": [1], "Ionic radii": { 1: 1.16 }, "Liquid range": "785.13 K", "Melting point": "370.87 K", "Mendeleev no": 11, "Mineral hardness": "0.5", "Molar volume": "23.78 cm<sup>3</sup>", Name: "Sodium", "Oxidation states": [-1, 1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "3.3 GPa", "Shannon radii": { 1: { IV: { "": { crystal_radius: 1.13, ionic_radius: 0.99 } }, V: { "": { crystal_radius: 1.14, ionic_radius: 1 } }, VI: { "": { crystal_radius: 1.16, ionic_radius: 1.02 } }, VII: { "": { crystal_radius: 1.26, ionic_radius: 1.12 } }, VIII: { "": { crystal_radius: 1.32, ionic_radius: 1.18 } }, IX: { "": { crystal_radius: 1.38, ionic_radius: 1.24 } }, XII: { "": { crystal_radius: 1.53, ionic_radius: 1.39 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "140 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.27, "Velocity of sound": "3200 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.93, "Youngs modulus": "10 GPa", "NMR Quadrupole Moment": { "Na-23": 104.1 }, "Metallic radius": 1.86, iupac_ordering: 10, "IUPAC ordering": 10, "Ground level": "2S1/2", "Ionization energies": [5.13907696, 47.28636, 71.62, 98.936, 138.404, 172.23, 208.504, 264.192, 299.856, 1465.134502, 1648.7022], "Electron affinity": 0.54792625 }, Nb: { "Atomic mass": 92.90638, "Atomic no": 41, "Atomic orbitals": { "1s": -673.76253, "2p": -85.272175, "2s": -92.74086, "3d": -7.339839, "3p": -12.552855, "3s": -15.393727, "4d": -0.125252, "4p": -1.250049, "4s": -2.036693, "5s": -0.144272 }, "Atomic radius": 1.45, "Atomic radius calculated": 1.98, "Boiling point": "5017 K", "Brinell hardness": "736 MN m<sup>-2</sup>", "Bulk modulus": "170 GPa", "Coefficient of linear thermal expansion": "7.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [5], "Critical temperature": "no data K", "Density of solid": "8570 kg m<sup>-3</sup>", "Electrical resistivity": "15.2 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>4</sup>.5s<sup>1</sup>", "ICSD oxidation states": [2, 3, 4, 5], "Ionic radii": { 3: 0.86, 4: 0.82, 5: 0.78 }, "Liquid range": "2267 K", "Melting point": "2750 K", "Mendeleev no": 53, "Mineral hardness": "6.0", "Molar volume": "10.83 cm<sup>3</sup>", Name: "Niobium", "Oxidation states": [-1, 2, 3, 4, 5], "Poissons ratio": "0.40", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "38 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } } }, 4: { VI: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } }, VIII: { "": { crystal_radius: 0.93, ionic_radius: 0.79 } } }, 5: { IV: { "": { crystal_radius: 0.62, ionic_radius: 0.48 } }, VI: { "": { crystal_radius: 0.78, ionic_radius: 0.64 } }, VII: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } }, VIII: { "": { crystal_radius: 0.88, ionic_radius: 0.74 } } } }, "Superconduction temperature": "9.25 K", "Thermal conductivity": "54 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.18, "Velocity of sound": "3480 m s<sup>-1</sup>", "Vickers hardness": "1320 MN m<sup>-2</sup>", X: 1.6, "Youngs modulus": "105 GPa", "Metallic radius": 1.473, iupac_ordering: 54, "IUPAC ordering": 54, "Ground level": "6D1/2", "Ionization energies": [6.75885, 14.32, 25.04, 37.611, 50.5728, 102.069, 119.1, 136, 159.2, 180, 200.28, 246.1, 268.59, 482.5, 530, 581, 636, 688, 758, 816, 877, 940, 1e3, 1176, 1230.6, 1293.7, 1368, 1439, 1488, 1625.9, 1684.97, 4020.1, 4187, 4369, 4540, 4815, 5011, 5265, 5426.066, 22648.046, 23388.801], "Electron affinity": 0.917407 }, Nd: { "Atomic mass": 144.242, "Atomic no": 60, "Atomic orbitals": { "1s": -1509.698955, "2p": -224.351816, "2s": -236.613572, "3d": -35.754515, "3p": -45.791219, "3s": -51.161263, "4d": -4.377027, "4f": -0.179508, "4p": -7.96782, "4s": -10.000891, "5p": -0.798503, "5s": -1.334934, "6s": -0.125796 }, "Atomic radius": 1.85, "Atomic radius calculated": 2.06, "Boiling point": "3373 K", "Brinell hardness": "265 MN m<sup>-2</sup>", "Bulk modulus": "32 GPa", "Coefficient of linear thermal expansion": "9.6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "6800 kg m<sup>-3</sup>", "Electrical resistivity": "64.3 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>4</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 2: 1.43, 3: 1.123 }, "Liquid range": "2076 K", "Melting point": "1297 K", "Mendeleev no": 30, "Mineral hardness": "no data", "Molar volume": "20.59 cm<sup>3</sup>", Name: "Neodymium", "Oxidation states": [2, 3], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "16 GPa", "Shannon radii": { 2: { VIII: { "": { crystal_radius: 1.43, ionic_radius: 1.29 } }, IX: { "": { crystal_radius: 1.49, ionic_radius: 1.35 } } }, 3: { VI: { "": { crystal_radius: 1.123, ionic_radius: 0.983 } }, VIII: { "": { crystal_radius: 1.249, ionic_radius: 1.109 } }, IX: { "": { crystal_radius: 1.303, ionic_radius: 1.163 } }, XII: { "": { crystal_radius: 1.41, ionic_radius: 1.27 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "17 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.39, "Velocity of sound": "2330 m s<sup>-1</sup>", "Vickers hardness": "343 MN m<sup>-2</sup>", X: 1.14, "Youngs modulus": "41 GPa", "Metallic radius": 1.821, iupac_ordering: 44, "IUPAC ordering": 44, "Ground level": "5I4", "Ionization energies": [5.525, 10.783, 22.09, 40.6, 60, 84, 99, 114, 136, 152, 168, 195, 221, 243, 389, 420, 453, 489, 522, 562, 602, 638, 678, 714, 859, 896, 939, 978, 1049, 1092, 1191, 1238.42, 2134, 2224, 2321, 2425, 2525, 2627, 2758, 2861, 2974, 3078, 3371, 3465, 3567, 3662, 3891, 3997, 4198, 4302, 9742, 10002, 10288, 10555, 11384, 11694, 12082, 12341.66, 50339.59, 51515.58], "Electron affinity": 0.0974933 }, Ne: { "Atomic mass": 20.1797, "Atomic no": 10, "Atomic orbitals": { "1s": -30.305855, "2p": -0.498034, "2s": -1.322809 }, "Atomic radius": "no data", "Atomic radius calculated": 0.38, "Boiling point": "27.07 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "44.4 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>6</sup>", "Liquid range": "2.51 K", "Max oxidation state": 0, "Melting point": "24.56 K", "Mendeleev no": 2, "Min oxidation state": 0, "Mineral hardness": "no data", "Molar volume": "13.23 cm<sup>3</sup>", Name: "Neon", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000067", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "0.0491 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.54, "Velocity of sound": "936 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "Ne-21": 101.55 }, "Metallic radius": "no data", iupac_ordering: 4, "IUPAC ordering": 4, "Ground level": "1S0", "Ionization energies": [21.564541, 40.96297, 63.4233, 97.19, 126.247, 157.934, 207.271, 239.097, 1195.80784, 1362.19916], "Electron affinity": -1.22 }, Ni: { "Atomic mass": 58.6934, "Atomic no": 28, "Atomic orbitals": { "1s": -297.870824, "2p": -30.868027, "2s": -35.312112, "3d": -0.348699, "3p": -2.594158, "3s": -3.950717, "4s": -0.210764 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.49, "Boiling point": "3186 K", "Brinell hardness": "700 MN m<sup>-2</sup>", "Bulk modulus": "180 GPa", "Coefficient of linear thermal expansion": "13.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "8908 kg m<sup>-3</sup>", "Electrical resistivity": "7.2 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>8</sup>.4s<sup>2</sup>", "ICSD oxidation states": [1, 2, 3, 4], "Ionic radii": { 3: 0.74 }, "Ionic radii hs": { 3: 0.74 }, "Ionic radii ls": { 2: 0.83, 3: 0.7, 4: 0.62 }, "Liquid range": "1458 K", "Melting point": "1728 K", "Mendeleev no": 67, "Mineral hardness": "4.0", "Molar volume": "6.59 cm<sup>3</sup>", Name: "Nickel", "Oxidation states": [-1, 1, 2, 3, 4], "Poissons ratio": "0.31", Reflectivity: "72 %", "Refractive index": "no data", "Rigidity modulus": "76 GPa", "Shannon radii": { 2: { IV: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } }, IVSQ: { "": { crystal_radius: 0.63, ionic_radius: 0.49 } }, V: { "": { crystal_radius: 0.77, ionic_radius: 0.63 } }, VI: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } } }, 3: { VI: { "Low Spin": { crystal_radius: 0.7, ionic_radius: 0.56 }, "High Spin": { crystal_radius: 0.74, ionic_radius: 0.6 } } }, 4: { VI: { "Low Spin": { crystal_radius: 0.62, ionic_radius: 0.48 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "91 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.97, "Velocity of sound": "4970 m s<sup>-1</sup>", "Vickers hardness": "638 MN m<sup>-2</sup>", X: 1.91, "Youngs modulus": "200 GPa", "NMR Quadrupole Moment": { "Ni-61": 162.15 }, "Metallic radius": 1.246, iupac_ordering: 70, "IUPAC ordering": 70, "Ground level": "3F4", "Ionization energies": [7.639878, 18.168838, 35.187, 54.92, 76.06, 108, 132, 162, 193.2, 224.7, 319.5, 351.6, 384.5, 429.3, 462.8, 495.4, 571.07, 607.02, 1541, 1646, 1758, 1880, 2008.1, 2130.5, 2295.6, 2399.259, 10288.8862, 10775.386], "Electron affinity": 1.1571612 }, No: { "Atomic mass": 259, "Atomic no": 102, "Atomic orbitals": "no data", "Atomic radius": "no data", "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>14</sup>.7s<sup>2</sup>", "Liquid range": "no data K", "Melting point": "about 1100 K", "Mendeleev no": 35, "Mineral hardness": "no data", "Molar volume": "no data cm<sup>3</sup>", Name: "Nobelium", "Oxidation states": [2, 3], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.24, ionic_radius: 1.1 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "no data W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.46, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 19, "IUPAC ordering": 19, "Ground level": "1S0", "Ionization energies": [6.62621, 12.93, 25.8, 41.5, 60, 74, 97, 119, 140, 170, 187, 216, 246, 267, 285, 312, 341, 367, 394, 422, 448, 475, 496, 520, 701, 734, 768, 805, 840, 875, 934, 969, 1010, 1045, 1220, 1260, 1300, 1350, 1500, 1550, 1680, 1730, 1920, 2010, 2110, 2200, 2290, 2380, 2470, 2570, 2680, 2760, 2860, 2950, 3050, 3140, 3627, 3705, 3790, 3878, 3962, 4045, 4234, 4320, 4413, 4500, 4850, 4930, 5030, 5110, 5750, 5850, 6110, 6210, 9680, 9860, 10060, 10270, 10470, 10660, 11200, 11410, 11630, 11840, 12420, 12600, 12800, 12980, 15e3, 15200, 15600, 15800, 31700, 32200, 32700, 33200, 40500, 41200, 42100, 42632, null, 168806], "Electron affinity": -2.33 }, Np: { "Atomic mass": 237, "Atomic no": 93, "Atomic orbitals": "no data", "Atomic radius": 1.75, "Atomic radius calculated": "no data", "Boiling point": "4273 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [5], "Critical temperature": "no data K", "Density of solid": "20450 kg m<sup>-3</sup>", "Electrical resistivity": "120 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>4</sup>.6d<sup>1</sup>.7s<sup>2</sup>", "Ionic radii": { 2: 1.24, 3: 1.15, 4: 1.01, 5: 0.89, 6: 0.86, 7: 0.85 }, "Liquid range": "3363 K", "Melting point": "910 K", "Mendeleev no": 44, "Mineral hardness": "no data", "Molar volume": "11.59 cm<sup>3</sup>", Name: "Neptunium", "Oxidation states": [3, 4, 5, 6, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.24, ionic_radius: 1.1 } } }, 3: { VI: { "": { crystal_radius: 1.15, ionic_radius: 1.01 } } }, 4: { VI: { "": { crystal_radius: 1.01, ionic_radius: 0.87 } }, VIII: { "": { crystal_radius: 1.12, ionic_radius: 0.98 } } }, 5: { VI: { "": { crystal_radius: 0.89, ionic_radius: 0.75 } } }, 6: { VI: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } } }, 7: { VI: { "": { crystal_radius: 0.85, ionic_radius: 0.71 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "6 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.39, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.36, "Youngs modulus": "no data GPa", "Metallic radius": 1.503, iupac_ordering: 28, "IUPAC ordering": 28, "Ground level": "6L11/2", "Ionization energies": [6.26554, 11.5, 19.7, 33.8, 48, 65, 92, 107, 121, 136, 151, 179, 196, 233, 252, 355, 382, 408, 438, 466, 495, 535, 565, 596, 626, 770, 810, 850, 880, 980, 1020, 1130, 1170, 1280, 1360, 1430, 1510, 1590, 1670, 1740, 1820, 1910, 1990, 2070, 2140, 2230, 2310, 2675, 2745, 2817, 2894, 2969, 3041, 3181, 3255, 3338, 3413, 3718, 3792, 3872, 3947, 4353, 4441, 4658, 4744, 7610, 7770, 7950, 8130, 8310, 8480, 8890, 9070, 9270, 9450, 9970, 10130, 10300, 10470, 11730, 11930, 12320, 12500, 25870, 26300, 26770, 27210, 31910, 32500, 33300, 33722.2, 132901.8, 135202], "Electron affinity": 0.48 }, O: { "Atomic mass": 15.9994, "Atomic no": 8, "Atomic orbitals": { "1s": -18.758245, "2p": -0.338381, "2s": -0.871362 }, "Atomic radius": 0.6, "Atomic radius calculated": 0.48, "Boiling point": "90.2 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-2], "Critical temperature": "154.6 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[He].2s<sup>2</sup>.2p<sup>4</sup>", "ICSD oxidation states": [-2], "Ionic radii": { "-2": 1.26 }, "Liquid range": "35.4 K", "Melting point": "54.8 K", "Mendeleev no": 101, "Mineral hardness": "no data", "Molar volume": "17.36 cm<sup>3</sup>", Name: "Oxygen", "Oxidation states": [-2, -1, 1, 2], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000271 (gas; liquid 1.221)(no units)", "Rigidity modulus": "no data GPa", "Shannon radii": { "-2": { II: { "": { crystal_radius: 1.21, ionic_radius: 1.35 } }, III: { "": { crystal_radius: 1.22, ionic_radius: 1.36 } }, IV: { "": { crystal_radius: 1.24, ionic_radius: 1.38 } }, VI: { "": { crystal_radius: 1.26, ionic_radius: 1.4 } }, VIII: { "": { crystal_radius: 1.28, ionic_radius: 1.42 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.02658 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.52, "Velocity of sound": "317.5 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 3.44, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "O-17": -25.58 }, "Metallic radius": "no data", iupac_ordering: 97, "IUPAC ordering": 97, "Ground level": "3P2", "Ionization energies": [13.618055, 35.12112, 54.93554, 77.4135, 113.899, 138.1189, 739.32683, 871.409883], "Electron affinity": 1.4611053 }, Os: { "Atomic mass": 190.23, "Atomic no": 76, "Atomic orbitals": { "1s": -2475.238617, "2p": -393.15408, "2s": -409.522396, "3d": -72.497183, "3p": -86.837047, "3s": -94.501324, "4d": -10.176082, "4f": -2.321175, "4p": -16.119671, "4s": -19.362527, "5d": -0.296791, "5p": -1.757404, "5s": -2.738293, "6s": -0.191489 }, "Atomic radius": 1.3, "Atomic radius calculated": 1.85, "Boiling point": "5285 K", "Brinell hardness": "3920 MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "5.1 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "22610 kg m<sup>-3</sup>", "Electrical resistivity": "8.1 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>6</sup>.6s<sup>2</sup>", "Ionic radii": { 4: 0.77, 5: 0.715, 6: 0.685, 7: 0.665, 8: 0.53 }, "Liquid range": "1979 K", "Melting point": "3306 K", "Mendeleev no": 63, "Mineral hardness": "7.0", "Molar volume": "8.42 cm<sup>3</sup>", Name: "Osmium", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6, 7, 8], "Poissons ratio": "0.25", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "222 GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 0.77, ionic_radius: 0.63 } } }, 5: { VI: { "": { crystal_radius: 0.715, ionic_radius: 0.575 } } }, 6: { V: { "": { crystal_radius: 0.63, ionic_radius: 0.49 } }, VI: { "": { crystal_radius: 0.685, ionic_radius: 0.545 } } }, 7: { VI: { "": { crystal_radius: 0.665, ionic_radius: 0.525 } } }, 8: { IV: { "": { crystal_radius: 0.53, ionic_radius: 0.39 } } } }, "Superconduction temperature": "0.66 K", "Thermal conductivity": "88 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.16, "Velocity of sound": "4940 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "no data GPa", "Metallic radius": 1.352, iupac_ordering: 62, "IUPAC ordering": 62, "Ground level": "5D4", "Ionization energies": [8.43823, 17, 25, 41, 55, 70.1, 85.1, 102.02, 168.7, 190, 213, 235, 269, 298, 322, 367, 410, 436, 470, 520, 570, 620, 670, 720, 770, 820, 870, 920, 970, 1015, 1262, 1311, 1364, 1420, 1474, 1528, 1606, 1660, 1720, 1776, 1996, 2052, 2112, 2168, 2336, 2400, 2552, 2615.5, 4374, 4501, 4635, 4779, 4917, 5052, 5280, 5421, 5575, 5717, 6115, 6240, 6376, 6503, 7039, 7185, 7468, 7610, 16560, 16900, 17270, 17620, 19600, 20030, 20570, 20920.6, 83976.21, 85614.4], "Electron affinity": 1.0778013 }, P: { "Atomic mass": 30.973762, "Atomic no": 15, "Atomic orbitals": { "1s": -76.061897, "2p": -4.576617, "2s": -6.329346, "3p": -0.20608, "3s": -0.512364 }, "Atomic radius": 1, "Atomic radius calculated": 0.98, "Boiling point": "550 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "11 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-3, 3, 5], "Critical temperature": "994 K", "Density of solid": "1823 kg m<sup>-3</sup>", "Electrical resistivity": "about 10 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>3</sup>", "ICSD oxidation states": [3, 4, 5, -2, -3, -1], "Ionic radii": { 3: 0.58, 5: 0.52 }, "Liquid range": "232.7 K", "Melting point": "(white P) 317.3 K", "Mendeleev no": 90, "Mineral hardness": "no data", "Molar volume": "17.02 cm<sup>3</sup>", Name: "Phosphorus", "Oxidation states": [-3, -2, -1, 1, 2, 3, 4, 5], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.001212", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.58, ionic_radius: 0.44 } } }, 5: { IV: { "": { crystal_radius: 0.31, ionic_radius: 0.17 } }, V: { "": { crystal_radius: 0.43, ionic_radius: 0.29 } }, VI: { "": { crystal_radius: 0.52, ionic_radius: 0.38 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.236 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.8, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.19, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 90, "IUPAC ordering": 90, "Ground level": "4S°3/2", "Ionization energies": [10.486686, 19.76949, 30.20264, 51.44387, 65.02511, 220.43, 263.57, 309.6, 372.31, 424.4, 479.44, 560.62, 611.741, 2816.90879, 3069.8416], "Electron affinity": 0.7466071 }, Pa: { "Atomic mass": 231.03588, "Atomic no": 91, "Atomic orbitals": { "1s": -3606.333629, "2p": -603.470278, "2s": -623.870431, "3d": -127.781168, "3p": -146.485678, "3s": -156.466742, "4d": -25.933121, "4f": -14.105747, "4p": -34.48293, "4s": -39.064507, "5d": -3.659928, "5f": -0.316813, "5p": -6.709821, "5s": -8.463463, "6d": -0.142481, "6p": -0.799756, "6s": -1.287232, "7s": -0.129653 }, "Atomic radius": 1.8, "Atomic radius calculated": "no data", "Boiling point": "no data K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [5], "Critical temperature": "no data K", "Density of solid": "15370 kg m<sup>-3</sup>", "Electrical resistivity": "18 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>2</sup>.6d<sup>1</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.16, 4: 1.04, 5: 0.92 }, "Liquid range": "no data K", "Melting point": "1841 K", "Mendeleev no": 46, "Mineral hardness": "no data", "Molar volume": "15.18 cm<sup>3</sup>", Name: "Protactinium", "Oxidation states": [3, 4, 5], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.18, ionic_radius: 1.04 } } }, 4: { VI: { "": { crystal_radius: 1.04, ionic_radius: 0.9 } }, VIII: { "": { crystal_radius: 1.15, ionic_radius: 1.01 } } }, 5: { VI: { "": { crystal_radius: 0.92, ionic_radius: 0.78 } }, VIII: { "": { crystal_radius: 1.05, ionic_radius: 0.91 } }, IX: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } } } }, "Superconduction temperature": "1.4 K", "Thermal conductivity": "47 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.1, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.5, "Youngs modulus": "no data GPa", "Metallic radius": 1.642, iupac_ordering: 30, "IUPAC ordering": 30, "Ground level": "4K11/2", "Ionization energies": [5.89, 11.9, 18.6, 30.9, 44.3, 72, 85.1, 98.9, 111, 137, 153, 187, 203, 292, 316, 342, 369, 395, 423, 460, 488, 518, 546, 690, 720, 760, 790, 880, 920, 1020, 1060, 1150, 1220, 1300, 1370, 1450, 1520, 1600, 1670, 1760, 1830, 1910, 1980, 2060, 2130, 2483, 2550, 2620, 2696, 2766, 2837, 2968, 3040, 3119, 3193, 3488, 3558, 3637, 3709, 4077, 4161, 4370, 4454, 7181, 7341, 7510, 7690, 7870, 8040, 8410, 8590, 8780, 8960, 9460, 9620, 9790, 9950, 11100, 11290, 11660, 11840, 24660, 25080, 25540, 25970, 30230, 30800, 31520, 31971.6, 126296.6, 128507.1], "Electron affinity": 0.55 }, Pb: { "Atomic mass": 207.2, "Atomic no": 82, "Atomic orbitals": { "1s": -2901.078061, "2p": -470.877785, "2s": -488.843335, "3d": -91.889924, "3p": -107.950391, "3s": -116.526852, "4d": -15.030026, "4f": -5.592532, "4p": -21.990564, "4s": -25.75333, "5d": -0.902393, "5p": -2.941657, "5s": -4.206797, "6p": -0.141831, "6s": -0.357187 }, "Atomic radius": 1.8, "Atomic radius calculated": 1.54, "Boiling point": "2022 K", "Brinell hardness": "38.3 MN m<sup>-2</sup>", "Bulk modulus": "46 GPa", "Coefficient of linear thermal expansion": "28.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 4], "Critical temperature": "no data K", "Density of solid": "11340 kg m<sup>-3</sup>", "Electrical resistivity": "21 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>2</sup>", "ICSD oxidation states": [2, 4], "Ionic radii": { 2: 1.33, 4: 0.915 }, "Liquid range": "1421.39 K", "Melting point": "600.61 K", "Mendeleev no": 82, "Mineral hardness": "1.5", "Molar volume": "18.26 cm<sup>3</sup>", Name: "Lead", "Oxidation states": [-4, 2, 4], "Poissons ratio": "0.44", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "5.6 GPa", "Shannon radii": { 2: { IVPY: { "": { crystal_radius: 1.12, ionic_radius: 0.98 } }, VI: { "": { crystal_radius: 1.33, ionic_radius: 1.19 } }, VII: { "": { crystal_radius: 1.37, ionic_radius: 1.23 } }, VIII: { "": { crystal_radius: 1.43, ionic_radius: 1.29 } }, IX: { "": { crystal_radius: 1.49, ionic_radius: 1.35 } }, X: { "": { crystal_radius: 1.54, ionic_radius: 1.4 } }, XI: { "": { crystal_radius: 1.59, ionic_radius: 1.45 } }, XII: { "": { crystal_radius: 1.63, ionic_radius: 1.49 } } }, 4: { IV: { "": { crystal_radius: 0.79, ionic_radius: 0.65 } }, V: { "": { crystal_radius: 0.87, ionic_radius: 0.73 } }, VI: { "": { crystal_radius: 0.915, ionic_radius: 0.775 } }, VIII: { "": { crystal_radius: 1.08, ionic_radius: 0.94 } } } }, "Superconduction temperature": "7.2 K", "Thermal conductivity": "35 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.02, "Velocity of sound": "1260 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.33, "Youngs modulus": "16 GPa", "Metallic radius": 1.75, iupac_ordering: 82, "IUPAC ordering": 82, "Ground level": "1/2,1/2)0", "Ionization energies": [7.4166799, 15.032499, 31.9373, 42.33256, 68.8, 82.9, 100.1, 120, 138, 158, 182, 203, 224, 245.1, 338.1, 374, 401, 427, 478, 507, 570, 610, 650, 690, 750, 810, 870, 930, 990, 1050, 1120, 1180, 1240, 1300, 1360, 1430, 1704, 1760, 1819, 1884, 1945, 2004, 2101, 2163, 2230, 2292, 2543, 2605, 2671, 2735, 2965, 3036, 3211, 3282.1, 5414, 5555, 5703, 5862, 6015, 6162, 6442, 6597, 6767, 6924, 7362, 7500, 7650, 7790, 8520, 8680, 9e3, 9150, 19590, 19970, 20380, 20750, 23460, 23940, 24550, 24938.2, 99491.85, 101336.4], "Electron affinity": 0.3567212 }, Pd: { "Atomic mass": 106.42, "Atomic no": 46, "Atomic orbitals": { "1s": -860.134909, "2p": -114.408286, "2s": -123.105078, "3d": -12.132197, "3p": -18.580798, "3s": -22.060898, "4d": -0.160771, "4p": -1.815215, "4s": -2.889173 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.69, "Boiling point": "3236 K", "Brinell hardness": "37.3 MN m<sup>-2</sup>", "Bulk modulus": "180 GPa", "Coefficient of linear thermal expansion": "11.8 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 4], "Critical temperature": "no data K", "Density of solid": "12023 kg m<sup>-3</sup>", "Electrical resistivity": "10.8 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>", "ICSD oxidation states": [2, 4], "Ionic radii": { 1: 0.73, 2: 1, 3: 0.9, 4: 0.755 }, "Liquid range": "1407.95 K", "Melting point": "1828.05 K", "Mendeleev no": 69, "Mineral hardness": "4.75", "Molar volume": "8.56 cm<sup>3</sup>", Name: "Palladium", "Oxidation states": [2, 4], "Poissons ratio": "0.39", Reflectivity: "72 %", "Refractive index": "no data", "Rigidity modulus": "44 GPa", "Shannon radii": { 1: { II: { "": { crystal_radius: 0.73, ionic_radius: 0.59 } } }, 2: { IVSQ: { "": { crystal_radius: 0.78, ionic_radius: 0.64 } }, VI: { "": { crystal_radius: 1, ionic_radius: 0.86 } } }, 3: { VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } } }, 4: { VI: { "": { crystal_radius: 0.755, ionic_radius: 0.615 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "72 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.1, "Velocity of sound": "3070 m s<sup>-1</sup>", "Vickers hardness": "461 MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "121 GPa", "Metallic radius": 1.376, iupac_ordering: 69, "IUPAC ordering": 69, "Ground level": "1S0", "Ionization energies": [8.336839, 19.43, 32.93, 46, 61, 84.1, 101, 120, 141, 159.9, 238.57, 260, 286, 311, 342, 369.1, 427, 457.5, 810, 869, 933, 1e3, 1065, 1145, 1218, 1290, 1366, 1438, 1644, 1706.2, 1781.3, 1869, 1962, 2016, 2181, 2248.87, 5284, 5475, 5683, 5880, 6242, 6469, 6759, 6943.097, 28776.034, 29622.6], "Electron affinity": 0.5621412 }, Pm: { "Atomic mass": 145, "Atomic no": 61, "Atomic orbitals": { "1s": -1562.980284, "2p": -233.455114, "2s": -245.970548, "3d": -37.625433, "3p": -47.921132, "3s": -53.429311, "4d": -4.596822, "4f": -0.200159, "4p": -8.320495, "4s": -10.422756, "5p": -0.817702, "5s": -1.372265, "6s": -0.127053 }, "Atomic radius": 1.85, "Atomic radius calculated": 2.05, "Boiling point": "3273 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "33 GPa", "Coefficient of linear thermal expansion": "11 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "7264 kg m<sup>-3</sup>", "Electrical resistivity": "about 75 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>5</sup>.6s<sup>2</sup>", "Ionic radii": { 3: 1.11 }, "Liquid range": "1900 K", "Melting point": "1373 K", "Mendeleev no": 29, "Mineral hardness": "no data", "Molar volume": "20.23 cm<sup>3</sup>", Name: "Promethium", "Oxidation states": [3], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "18 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } }, VIII: { "": { crystal_radius: 1.233, ionic_radius: 1.093 } }, IX: { "": { crystal_radius: 1.284, ionic_radius: 1.144 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "15 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.38, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.13, "Youngs modulus": "46 GPa", "Metallic radius": 1.811, iupac_ordering: 43, "IUPAC ordering": 43, "Ground level": "6H°5/2", "Ionization energies": [5.58187, 10.938, 22.44, 41.17, 61.7, 85, 101, 116, 138, 155, 174, 202, 229, 248, 269, 430, 462, 497, 534, 569, 609, 651, 689, 730, 767, 916, 956, 998, 1040, 1113, 1158, 1261, 1308.7, 2251, 2344, 2443, 2549, 2652, 2755, 2892, 2997, 3112, 3219, 3519, 3613, 3718, 3816, 4056, 4166, 4371, 4476, 10115, 10378, 10671, 10942, 11819, 12136, 12532, 12797.26, 52144.29, 53346.1], "Electron affinity": 0.129 }, Po: { "Atomic mass": 210, "Atomic no": 84, "Atomic orbitals": { "1s": -3050.988417, "2p": -498.77192, "2s": -517.275843, "3d": -99.256068, "3p": -115.898384, "3s": -124.783683, "4d": -17.173307, "4f": -7.206499, "4p": -24.481337, "4s": -28.42254, "5d": -1.386458, "5p": -3.655382, "5s": -5.027447, "6p": -0.217889, "6s": -0.493528 }, "Atomic radius": 1.9, "Atomic radius calculated": 1.35, "Boiling point": "1235 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-2, 2, 4], "Critical temperature": "no data K", "Density of solid": "9196 kg m<sup>-3</sup>", "Electrical resistivity": "40 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>4</sup>", "Ionic radii": { 4: 1.08, 6: 0.81 }, "Liquid range": "708 K", "Melting point": "527 K", "Mendeleev no": 91, "Mineral hardness": "no data", "Molar volume": "22.97 cm<sup>3</sup>", Name: "Polonium", "Oxidation states": [-2, 2, 4, 6], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 1.08, ionic_radius: 0.94 } }, VIII: { "": { crystal_radius: 1.22, ionic_radius: 1.08 } } }, 6: { VI: { "": { crystal_radius: 0.81, ionic_radius: 0.67 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "20 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.97, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2, "Youngs modulus": "no data GPa", "Metallic radius": 1.53, iupac_ordering: 93, "IUPAC ordering": 93, "Ground level": "3P2", "Ionization energies": [8.41807, 19.3, 27.3, 36, 57, 69.1, 108, 125, 146.1, 166, 186, 209, 235, 257, 281, 304, 416, 444, 473, 502, 560, 590, 670, 700, 740, 800, 870, 930, 990, 1060, 1120, 1180, 1250, 1320, 1380, 1440, 1510, 1570, 1865, 1923, 1986, 2052, 2115, 2177, 2281, 2345, 2414, 2480, 2740, 2803, 2873, 2938, 3194, 3268, 3450, 3524.2, 5785, 5930, 6084, 6248, 6405, 6557, 6856, 7015, 7191, 7350, 7810, 7950, 8100, 8240, 9050, 9220, 9550, 9710, 20670, 21050, 21470, 21860, 24860, 25360, 25990, 26390.4, 105064.3, 106982.7], "Electron affinity": 1.407 }, Pr: { "Atomic mass": 140.90765, "Atomic no": 59, "Atomic orbitals": { "1s": -1457.338067, "2p": -215.418313, "2s": -227.426363, "3d": -33.913996, "3p": -43.692548, "3s": -48.924994, "4d": -4.154228, "4f": -0.155138, "4p": -7.613108, "4s": -9.577447, "5p": -0.778046, "5s": -1.296106, "6s": -0.124465 }, "Atomic radius": 1.85, "Atomic radius calculated": 2.47, "Boiling point": "3563 K", "Brinell hardness": "481 MN m<sup>-2</sup>", "Bulk modulus": "29 GPa", "Coefficient of linear thermal expansion": "6.7 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "6640 kg m<sup>-3</sup>", "Electrical resistivity": "70 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>3</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4], "Ionic radii": { 3: 1.13, 4: 0.99 }, "Liquid range": "2355 K", "Melting point": "1208 K", "Mendeleev no": 31, "Mineral hardness": "no data", "Molar volume": "20.80 cm<sup>3</sup>", Name: "Praseodymium", "Oxidation states": [2, 3, 4], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "15 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.13, ionic_radius: 0.99 } }, VIII: { "": { crystal_radius: 1.266, ionic_radius: 1.126 } }, IX: { "": { crystal_radius: 1.319, ionic_radius: 1.179 } } }, 4: { VI: { "": { crystal_radius: 0.99, ionic_radius: 0.85 } }, VIII: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "13 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.4, "Velocity of sound": "2280 m s<sup>-1</sup>", "Vickers hardness": "400 MN m<sup>-2</sup>", X: 1.13, "Youngs modulus": "37 GPa", "Metallic radius": 1.828, iupac_ordering: 45, "IUPAC ordering": 45, "Ground level": "4I°9/2", "Ionization energies": [5.4702, 10.631, 21.6237, 38.981, 57.53, 82, 97, 112, 131, 148, 162, 196, 217.02, 350, 378, 412, 445, 478, 516, 554, 590, 627, 663, 803, 840, 880, 920, 985, 1028, 1124, 1169.9, 2019, 2108, 2202, 2304, 2400, 2501, 2628, 2729, 2838, 2941, 3227, 3319, 3419, 3512, 3729, 3832, 4030, 4130, 9378, 9632, 9913, 10175, 10959, 11262, 11641, 11895.89, 48571.71, 49722.25], "Electron affinity": 0.1092346 }, Pt: { "Atomic mass": 195.084, "Atomic no": 78, "Atomic orbitals": { "1s": -2613.096532, "2p": -417.96053, "2s": -434.858003, "3d": -78.400271, "3p": -93.309108, "3s": -101.274869, "4d": -11.419476, "4f": -3.038049, "4p": -17.697297, "4s": -21.110651, "5d": -0.273634, "5p": -1.884256, "5s": -2.950526, "6s": -0.161308 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.77, "Boiling point": "4098 K", "Brinell hardness": "392 MN m<sup>-2</sup>", "Bulk modulus": "230 GPa", "Coefficient of linear thermal expansion": "8.8 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2, 4], "Critical temperature": "no data K", "Density of solid": "21090 kg m<sup>-3</sup>", "Electrical resistivity": "10.6 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>9</sup>.6s<sup>1</sup>", "Ionic radii": { 2: 0.94, 4: 0.765, 5: 0.71 }, "Liquid range": "2056.6 K", "Melting point": "2041.4 K", "Mendeleev no": 68, "Mineral hardness": "3.5", "Molar volume": "9.09 cm<sup>3</sup>", Name: "Platinum", "Oxidation states": [-2, 2, 4, 5, 6], "Poissons ratio": "0.38", Reflectivity: "73 %", "Refractive index": "no data", "Rigidity modulus": "61 GPa", "Shannon radii": { 2: { IVSQ: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } }, VI: { "": { crystal_radius: 0.94, ionic_radius: 0.8 } } }, 4: { VI: { "": { crystal_radius: 0.765, ionic_radius: 0.625 } } }, 5: { VI: { "": { crystal_radius: 0.71, ionic_radius: 0.57 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "72 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.13, "Velocity of sound": "2680 m s<sup>-1</sup>", "Vickers hardness": "549 MN m<sup>-2</sup>", X: 2.28, "Youngs modulus": "168 GPa", "Metallic radius": 1.387, iupac_ordering: 68, "IUPAC ordering": 68, "Ground level": "3D3", "Ionization energies": [8.95883, 18.56, 29, 43, 56, 75, 91, 109, 126, 144.9, 220.4, 245, 269, 293, 332, 358, 392, 445, 479, 507, 550, 610, 660, 710, 760, 820, 870, 930, 980, 1040, 1090, 1140, 1402, 1454, 1509, 1567, 1624, 1680, 1763, 1821, 1883, 1941, 2171, 2228, 2291, 2350, 2536, 2603, 2762, 2827.8, 4715, 4839, 4980, 5128, 5270, 5410, 5654, 5800, 5959, 6106, 6517, 6646, 6787, 6918, 7512, 7660, 7960, 8100, 17540, 17890, 18280, 18630, 20840, 21280, 21840, 22205.7, 88955.18, 90659.7], "Electron affinity": 2.125105 }, Pu: { "Atomic mass": 244, "Atomic no": 94, "Atomic orbitals": "no data", "Atomic radius": 1.75, "Atomic radius calculated": "no data", "Boiling point": "3503 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "19816 kg m<sup>-3</sup>", "Electrical resistivity": "150 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>6</sup>.7s<sup>2</sup>", "Ionic radii": { 3: 1.14, 4: 1, 5: 0.88, 6: 0.85 }, "Liquid range": "2590.5 K", "Melting point": "912.5 K", "Mendeleev no": 43, "Mineral hardness": "no data", "Molar volume": "12.29 cm<sup>3</sup>", Name: "Plutonium", "Oxidation states": [3, 4, 5, 6, 7], "Poissons ratio": "0.21", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "43 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.14, ionic_radius: 1 } } }, 4: { VI: { "": { crystal_radius: 1, ionic_radius: 0.86 } }, VIII: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } } }, 5: { VI: { "": { crystal_radius: 0.88, ionic_radius: 0.74 } } }, 6: { VI: { "": { crystal_radius: 0.85, ionic_radius: 0.71 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "6 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.43, "Velocity of sound": "2260 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.28, "Youngs modulus": "96 GPa", "Metallic radius": 1.523, iupac_ordering: 27, "IUPAC ordering": 27, "Ground level": "7F0", "Ionization energies": [6.02576, 11.5, 21.1, 35, 49, 80, 95, 109, 124, 139, 159, 179, 200, 219, 258, 278, 389, 416, 444, 474, 503, 532, 575, 605, 637, 668, 820, 850, 890, 930, 1030, 1070, 1180, 1220, 1340, 1420, 1500, 1580, 1660, 1740, 1820, 1890, 1990, 2070, 2150, 2230, 2310, 2390, 2774, 2844, 2918, 2997, 3072, 3146, 3290, 3366, 3449, 3527, 3836, 3911, 3993, 4068, 4496, 4585, 4807, 4890, 7830, 7990, 8170, 8360, 8540, 8710, 9130, 9310, 9520, 9700, 10230, 10390, 10570, 10730, 12060, 12260, 12660, 12840, 26480, 26920, 27400, 27840, 32800, 33400, 34100, 34625.8, 136299.2, 138646], "Electron affinity": -0.5 }, Ra: { "Atomic mass": 226, "Atomic no": 88, "Atomic orbitals": { "1s": -3362.736563, "2p": -557.513214, "2s": -577.101208, "3d": -115.306476, "3p": -133.12325, "3s": -142.632426, "4d": -22.208125, "4f": -11.181066, "4p": -30.221208, "4s": -34.525628, "5d": -2.819853, "5p": -5.547203, "5s": -7.139137, "6p": -0.634674, "6s": -1.05135, "7s": -0.113732 }, "Atomic radius": 2.15, "Atomic radius calculated": "no data", "Boiling point": "2010 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "5000 kg m<sup>-3</sup>", "Electrical resistivity": "100 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].7s<sup>2</sup>", "Ionic radii": { 2: 1.62 }, "Liquid range": "1037 K", "Melting point": "973 K", "Mendeleev no": 13, "Mineral hardness": "no data", "Molar volume": "41.09 cm<sup>3</sup>", Name: "Radium", "Oxidation states": [2], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 2: { VIII: { "": { crystal_radius: 1.62, ionic_radius: 1.48 } }, XII: { "": { crystal_radius: 1.84, ionic_radius: 1.7 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "19 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.83, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.9, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "Ra-223": 1210.3 }, "Metallic radius": 2.293, iupac_ordering: 12, "IUPAC ordering": 12, "Ground level": "1S0", "Ionization energies": [5.2784239, 10.14718, 31, 41, 52.9, 64, 82, 97, 124, 140, 204.9, 227, 250, 274, 299, 324, 356, 382, 409, 435, 570, 600, 630, 660, 740, 770, 860, 900, 970, 1040, 1110, 1180, 1250, 1320, 1390, 1460, 1530, 1610, 1680, 1750, 1820, 1880, 2208, 2271, 2338, 2409, 2477, 2544, 2662, 2731, 2806, 2876, 3155, 3224, 3298, 3368, 3682, 3762, 3959, 4040, 6565, 6718, 6881, 7056, 7222, 7380, 7720, 7890, 8080, 8250, 8730, 8880, 9040, 9200, 10190, 10360, 10720, 10890, 22900, 23300, 23750, 24160, 27830, 28370, 29050, 29479.8, 116848.7, 118931.3], "Electron affinity": 0.1 }, Rb: { "Atomic mass": 85.4678, "Atomic no": 37, "Atomic orbitals": { "1s": -540.957115, "2p": -64.784678, "2s": -71.291202, "3d": -3.915508, "3p": -8.165416, "3s": -10.513861, "4p": -0.59217, "4s": -1.135051, "5s": -0.085375 }, "Atomic radius": 2.35, "Atomic radius calculated": 2.65, "Boiling point": "961 K", "Brinell hardness": "0.216 MN m<sup>-2</sup>", "Bulk modulus": "2.5 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1], "Critical temperature": "2093 K", "Density of solid": "1532 kg m<sup>-3</sup>", "Electrical resistivity": "13.3 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].5s<sup>1</sup>", "ICSD oxidation states": [1], "Ionic radii": { 1: 1.66 }, "Liquid range": "648.54 K", "Melting point": "312.46 K", "Mendeleev no": 9, "Mineral hardness": "0.3", "Molar volume": "55.76 cm<sup>3</sup>", Name: "Rubidium", "Oxidation states": [1], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 1: { VI: { "": { crystal_radius: 1.66, ionic_radius: 1.52 } }, VII: { "": { crystal_radius: 1.7, ionic_radius: 1.56 } }, VIII: { "": { crystal_radius: 1.75, ionic_radius: 1.61 } }, IX: { "": { crystal_radius: 1.77, ionic_radius: 1.63 } }, X: { "": { crystal_radius: 1.8, ionic_radius: 1.66 } }, XI: { "": { crystal_radius: 1.83, ionic_radius: 1.69 } }, XII: { "": { crystal_radius: 1.86, ionic_radius: 1.72 } }, XIV: { "": { crystal_radius: 1.97, ionic_radius: 1.83 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "58 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 3.03, "Velocity of sound": "1300 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.82, "Youngs modulus": "2.4 GPa", "Metallic radius": 2.537, iupac_ordering: 8, "IUPAC ordering": 8, "Ground level": "2S1/2", "Ionization energies": [4.1771281, 27.28954, 39.247, 52.2, 68.44, 82.9, 98.67, 132.79, 150.628, 277.12, 313.1, 356, 400, 443, 502, 550, 601, 654, 706, 857, 905.3, 958.9, 1024, 1080, 1125, 1242.5, 1294.57, 3133.3, 3281, 3443, 3600, 3815, 3988, 4214, 4356.865, 18305.884, 18965.516], "Electron affinity": 0.48591621 }, Re: { "Atomic mass": 186.207, "Atomic no": 75, "Atomic orbitals": { "1s": -2407.665572, "2p": -380.982869, "2s": -397.087707, "3d": -69.57676, "3p": -83.634578, "3s": -91.149193, "4d": -9.516816, "4f": -1.92508, "4p": -15.295495, "4s": -18.454325, "5d": -0.258639, "5p": -1.631227, "5s": -2.567348, "6s": -0.186859 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.88, "Boiling point": "5869 K", "Brinell hardness": "1320 MN m<sup>-2</sup>", "Bulk modulus": "370 GPa", "Coefficient of linear thermal expansion": "6.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "21020 kg m<sup>-3</sup>", "Electrical resistivity": "18 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>5</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4, 5, 6, 7], "Ionic radii": { 4: 0.77, 5: 0.72, 6: 0.69, 7: 0.67 }, "Liquid range": "2410 K", "Melting point": "3459 K", "Mendeleev no": 58, "Mineral hardness": "7.0", "Molar volume": "8.86 cm<sup>3</sup>", Name: "Rhenium", "Oxidation states": [-3, -1, 1, 2, 3, 4, 5, 6, 7], "Poissons ratio": "0.30", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "178 GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 0.77, ionic_radius: 0.63 } } }, 5: { VI: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } } }, 6: { VI: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } } }, 7: { IV: { "": { crystal_radius: 0.52, ionic_radius: 0.38 } }, VI: { "": { crystal_radius: 0.67, ionic_radius: 0.53 } } } }, "Superconduction temperature": "1.70 K", "Thermal conductivity": "48 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.16, "Velocity of sound": "4700 m s<sup>-1</sup>", "Vickers hardness": "2450 MN m<sup>-2</sup>", X: 1.9, "Youngs modulus": "463 GPa", "Metallic radius": 1.375, iupac_ordering: 59, "IUPAC ordering": 59, "Ground level": "6S5/2", "Ionization energies": [7.83352, 16.6, 27, 39.1, 51.9, 67, 82.71, 144.4, 165, 187, 208, 236, 268, 291, 330, 377, 403, 429, 476, 520, 570, 620, 670, 720, 760, 810, 860, 910, 953, 1194, 1242, 1294, 1349, 1402, 1454, 1530, 1583, 1641, 1696, 1912, 1966, 2025, 2080, 2240, 2302, 2450, 2514.5, 4214, 4335, 4468, 4609, 4745, 4877, 5099, 5236, 5388, 5528, 5919, 6042, 6176, 6300, 6810, 6952, 7230, 7366, 16080, 16410, 16780, 17120, 19e3, 19420, 19950, 20297.4, 81556.9, 83162.3], "Electron affinity": 0.06039663 }, Rh: { "Atomic mass": 102.9055, "Atomic no": 45, "Atomic orbitals": { "1s": -821.136773, "2p": -108.357665, "2s": -116.80695, "3d": -11.21725, "3p": -17.415299, "3s": -20.765603, "4d": -0.239422, "4p": -1.806456, "4s": -2.825505, "5s": -0.154624 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.73, "Boiling point": "3968 K", "Brinell hardness": "1100 MN m<sup>-2</sup>", "Bulk modulus": "380 GPa", "Coefficient of linear thermal expansion": "8.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "12450 kg m<sup>-3</sup>", "Electrical resistivity": "4.3 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>8</sup>.5s<sup>1</sup>", "ICSD oxidation states": [3, 4], "Ionic radii": { 3: 0.805, 4: 0.74, 5: 0.69 }, "Liquid range": "1731 K", "Melting point": "2237 K", "Mendeleev no": 65, "Mineral hardness": "6.0", "Molar volume": "8.28 cm<sup>3</sup>", Name: "Rhodium", "Oxidation states": [-1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.26", Reflectivity: "84 %", "Refractive index": "no data", "Rigidity modulus": "150 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.805, ionic_radius: 0.665 } } }, 4: { VI: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } } }, 5: { VI: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "150 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.1, "Velocity of sound": "4700 m s<sup>-1</sup>", "Vickers hardness": "1246 MN m<sup>-2</sup>", X: 2.28, "Youngs modulus": "275 GPa", "Metallic radius": 1.345, iupac_ordering: 66, "IUPAC ordering": 66, "Ground level": "4F9/2", "Ionization energies": [7.4589, 18.08, 31.06, 42, 63, 80, 97, 115.1, 135, 207.51, 228, 252.1, 277, 306, 331.58, 389.3, 415.97, 739, 794, 857, 921, 984, 1061, 1131, 1202, 1274, 1344, 1544, 1604.9, 1677.6, 1763, 1851, 1903, 2063, 2129.22, 5018, 5203, 5406, 5600, 5940, 6161, 6444, 6623.262, 27486.983, 28311.965], "Electron affinity": 1.142892 }, Rn: { "Atomic mass": 220, "Atomic no": 86, "Atomic orbitals": { "1s": -3204.756288, "2p": -527.533025, "2s": -546.57796, "3d": -106.945006, "3p": -124.172862, "3s": -133.369144, "4d": -19.449994, "4f": -8.953318, "4p": -27.108985, "4s": -31.230804, "5d": -1.911329, "5p": -4.408702, "5s": -5.889683, "6p": -0.29318, "6s": -0.62657 }, "Atomic radius": "no data", "Atomic radius calculated": 1.2, "Boiling point": "211.3 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "377 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>6</sup>", "Liquid range": "9.3 K", "Max oxidation state": 0, "Melting point": "202 K", "Mendeleev no": 6, "Min oxidation state": 0, "Mineral hardness": "no data", "Molar volume": "50.50 cm<sup>3</sup>", Name: "Radon", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Superconduction temperature": "no data K", "Thermal conductivity": "0.00361 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.2, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 0, "IUPAC ordering": 0, "Ground level": "1S0", "Ionization energies": [10.7485, 21.4, 29.4, 36.9, 52.9, 64, 88, 102, 154, 173.9, 195, 218, 240, 264, 293, 317, 342, 367, 488, 520, 550, 580, 640, 680, 760, 800, 850, 920, 980, 1050, 1110, 1180, 1250, 1310, 1390, 1460, 1520, 1590, 1660, 1720, 2033, 2094, 2158, 2227, 2293, 2357, 2467, 2535, 2606, 2674, 2944, 3010, 3082, 3149, 3433, 3510, 3699, 3777, 6169, 6318, 6476, 6646, 6807, 6964, 7283, 7450, 7630, 7800, 8260, 8410, 8570, 8710, 9610, 9780, 10120, 10290, 21770, 22160, 22600, 22990, 26310, 26830, 27490, 27903.1, 110842, 112843.7], "Electron affinity": -0.72 }, Ru: { "Atomic mass": 101.07, "Atomic no": 44, "Atomic orbitals": { "1s": -782.918621, "2p": -102.333649, "2s": -110.536054, "3d": -10.195668, "3p": -16.145217, "3s": -19.366692, "4d": -0.210375, "4p": -1.667549, "4s": -2.628363, "5s": -0.152834 }, "Atomic radius": 1.3, "Atomic radius calculated": 1.78, "Boiling point": "4423 K", "Brinell hardness": "2160 MN m<sup>-2</sup>", "Bulk modulus": "220 GPa", "Coefficient of linear thermal expansion": "6.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3, 4], "Critical temperature": "no data K", "Density of solid": "12370 kg m<sup>-3</sup>", "Electrical resistivity": "7.1 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>7</sup>.5s<sup>1</sup>", "ICSD oxidation states": [2, 3, 4, 5, 6], "Ionic radii": { 3: 0.82, 4: 0.76, 5: 0.705, 7: 0.52, 8: 0.5 }, "Liquid range": "1816 K", "Melting point": "2607 K", "Mendeleev no": 62, "Mineral hardness": "6.5", "Molar volume": "8.17 cm<sup>3</sup>", Name: "Ruthenium", "Oxidation states": [-2, 1, 2, 3, 4, 5, 6, 7, 8], "Poissons ratio": "0.30", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "173 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } } }, 4: { VI: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } } }, 5: { VI: { "": { crystal_radius: 0.705, ionic_radius: 0.565 } } }, 7: { IV: { "": { crystal_radius: 0.52, ionic_radius: 0.38 } } }, 8: { IV: { "": { crystal_radius: 0.5, ionic_radius: 0.36 } } } }, "Superconduction temperature": "0.49 K", "Thermal conductivity": "120 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.13, "Velocity of sound": "5970 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.2, "Youngs modulus": "447 GPa", "Metallic radius": 1.339, iupac_ordering: 63, "IUPAC ordering": 63, "Ground level": "5F5", "Ionization energies": [7.3605, 16.76, 28.47, 45, 59, 76, 93, 110, 178.41, 198, 219.9, 245, 271, 295.9, 348, 376.25, 670, 723, 784, 845, 905, 981, 1048, 1115, 1187, 1253, 1447, 1506.7, 1577, 1659, 1743, 1794, 1949, 2013.04, 4758, 4939, 5136, 5330, 5647, 5861, 6137, 6311.721, 26229.895, 27033.502], "Electron affinity": 1.0463825 }, S: { "Atomic mass": 32.065, "Atomic no": 16, "Atomic orbitals": { "1s": -87.789937, "2p": -5.751257, "2s": -7.69994, "3p": -0.261676, "3s": -0.630912 }, "Atomic radius": 1, "Atomic radius calculated": 0.88, "Boiling point": "717.87 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "7.7 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-2, 2, 4, 6], "Critical temperature": "1314 K", "Density of solid": "1960 kg m<sup>-3</sup>", "Electrical resistivity": "&gt; 10<sup>23</sup>10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>4</sup>", "ICSD oxidation states": [-1, 2, 4, -2, 6], "Ionic radii": { "-2": 1.7, 4: 0.51, 6: 0.43 }, "Liquid range": "329.51 K", "Melting point": "388.36 K", "Mendeleev no": 94, "Mineral hardness": "2.0", "Molar volume": "15.53 cm<sup>3</sup>", Name: "Sulfur", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.001111", "Rigidity modulus": "no data GPa", "Shannon radii": { "-2": { VI: { "": { crystal_radius: 1.7, ionic_radius: 1.84 } } }, 4: { VI: { "": { crystal_radius: 0.51, ionic_radius: 0.37 } } }, 6: { IV: { "": { crystal_radius: 0.26, ionic_radius: 0.12 } }, VI: { "": { crystal_radius: 0.43, ionic_radius: 0.29 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.205 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.8, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.58, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "S-33": -67.8, "S-35": 47.1 }, "Metallic radius": "no data", iupac_ordering: 96, "IUPAC ordering": 96, "Ground level": "3P2", "Ionization energies": [10.36001, 23.33788, 34.86, 47.222, 72.5945, 88.0529, 280.954, 328.794, 379.84, 447.7, 504.55, 564.41, 651.96, 706.994, 3223.7807, 3494.1879], "Electron affinity": 2.077104512 }, Sb: { "Atomic mass": 121.76, "Atomic no": 51, "Atomic orbitals": { "1s": -1070.823495, "2p": -149.214271, "2s": -159.171745, "3d": -19.239895, "3p": -26.956184, "3s": -31.098242, "4d": -1.297338, "4p": -3.646579, "4s": -5.04964, "5p": -0.185623, "5s": -0.445605 }, "Atomic radius": 1.45, "Atomic radius calculated": 1.33, "Boiling point": "1860 K", "Brinell hardness": "294 MN m<sup>-2</sup>", "Bulk modulus": "42 GPa", "Coefficient of linear thermal expansion": "11 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-3, 3, 5], "Critical temperature": "no data K", "Density of solid": "6697 kg m<sup>-3</sup>", "Electrical resistivity": "40 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>3</sup>", "ICSD oxidation states": [-2, 3, 5, -1, -3], "Ionic radii": { 3: 0.9, 5: 0.76 }, "Liquid range": "956.22 K", "Melting point": "903.78 K", "Mendeleev no": 88, "Mineral hardness": "3.0", "Molar volume": "18.19 cm<sup>3</sup>", Name: "Antimony", "Oxidation states": [-3, 3, 5], "Poissons ratio": "no data", Reflectivity: "55 %", "Refractive index": "no data", "Rigidity modulus": "20 GPa", "Shannon radii": { 3: { IVPY: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } }, V: { "": { crystal_radius: 0.94, ionic_radius: 0.8 } }, VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } } }, 5: { VI: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "24 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.06, "Velocity of sound": "3420 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.05, "Youngs modulus": "55 GPa", "NMR Quadrupole Moment": { "Sb-121": -543.11, "Sb-123": -692.14 }, "Metallic radius": 1.61, iupac_ordering: 88, "IUPAC ordering": 88, "Ground level": "4S°3/2", "Ionization energies": [8.608389, 16.626, 25.3235, 43.804, 55, 99.51, 117, 139, 162, 185, 214, 238, 265, 292, 317, 420, 447, 479, 510, 552, 584, 657, 693.26, 1214, 1285, 1360, 1441, 1518, 1606, 1698, 1781, 1869, 1954, 2190, 2266, 2349, 2428, 2567, 2654, 2815, 2900, 6714, 6929, 7167, 7390, 7887, 8140, 8455, 8669.48, 35710.028, 36668.05], "Electron affinity": 1.04740119 }, Sc: { "Atomic mass": 44.955912, "Atomic no": 21, "Atomic orbitals": { "1s": -160.184109, "2p": -14.240006, "2s": -17.206464, "3d": -0.13108, "3p": -1.233165, "3s": -1.988378, "4s": -0.156478 }, "Atomic radius": 1.6, "Atomic radius calculated": 1.84, "Boiling point": "3103 K", "Brinell hardness": "750 MN m<sup>-2</sup>", "Bulk modulus": "57 GPa", "Coefficient of linear thermal expansion": "10.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "2985 kg m<sup>-3</sup>", "Electrical resistivity": "about 55 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>1</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 3: 0.885 }, "Liquid range": "1289 K", "Melting point": "1814 K", "Mendeleev no": 19, "Mineral hardness": "no data", "Molar volume": "15.00 cm<sup>3</sup>", Name: "Scandium", "Oxidation states": [1, 2, 3], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "29 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.885, ionic_radius: 0.745 } }, VIII: { "": { crystal_radius: 1.01, ionic_radius: 0.87 } } } }, "Superconduction temperature": "0.05  (under pressure)K", "Thermal conductivity": "16 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.15, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.36, "Youngs modulus": "74 GPa", "NMR Quadrupole Moment": { "Sc-45": -220.2 }, "Metallic radius": 1.641, iupac_ordering: 49, "IUPAC ordering": 49, "Ground level": "2D3/2", "Ionization energies": [6.56149, 12.79977, 24.756839, 73.4894, 91.95, 110.68, 137.99, 158.08, 180.03, 225.18, 249.798, 687.36, 757.7, 833.2, 926.5, 1008.6, 1093.5, 1213.1, 1287.957, 5674.9037, 6033.7542], "Electron affinity": 0.1882 }, Se: { "Atomic mass": 78.96, "Atomic no": 34, "Atomic orbitals": { "1s": -451.300258, "2p": -51.514388, "2s": -57.311948, "3d": -2.011392, "3p": -5.553517, "3s": -7.547186, "4p": -0.245806, "4s": -0.621248 }, "Atomic radius": 1.15, "Atomic radius calculated": 1.03, "Boiling point": "958 K", "Brinell hardness": "736 MN m<sup>-2</sup>", "Bulk modulus": "8.3 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-2, 2, 4, 6], "Critical temperature": "1766 K", "Density of solid": "4819 kg m<sup>-3</sup>", "Electrical resistivity": "high 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>.4p<sup>4</sup>", "ICSD oxidation states": [-1, 4, -2, 6], "Ionic radii": { "-2": 1.84, 4: 0.64, 6: 0.56 }, "Liquid range": "464 K", "Melting point": "494 K", "Mendeleev no": 93, "Mineral hardness": "2.0", "Molar volume": "16.42 cm<sup>3</sup>", Name: "Selenium", "Oxidation states": [-2, 2, 4, 6], "Poissons ratio": "0.33", Reflectivity: "no data %", "Refractive index": "1.000895", "Rigidity modulus": "3.7 GPa", "Shannon radii": { "-2": { VI: { "": { crystal_radius: 1.84, ionic_radius: 1.98 } } }, 4: { VI: { "": { crystal_radius: 0.64, ionic_radius: 0.5 } } }, 6: { IV: { "": { crystal_radius: 0.42, ionic_radius: 0.28 } }, VI: { "": { crystal_radius: 0.56, ionic_radius: 0.42 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.52 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.9, "Velocity of sound": "3350 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.55, "Youngs modulus": "10 GPa", "Metallic radius": "no data", iupac_ordering: 95, "IUPAC ordering": 95, "Ground level": "3P2", "Ionization energies": [9.752392, 21.196, 31.697, 42.947, 68.3, 81.83, 155.327, 184, 219, 255, 291, 342.9, 383, 426, 473, 517, 650.5, 693.4, 739.8, 798, 845.8, 887, 989.6, 1036.36, 2540.7, 2674, 2820, 2964, 3146, 3301.8, 3507, 3636.526, 15367.491, 15968.084], "Electron affinity": 2.020604712 }, Si: { "Atomic mass": 28.0855, "Atomic no": 14, "Atomic orbitals": { "1s": -65.184426, "2p": -3.514938, "2s": -5.075056, "3p": -0.153293, "3s": -0.398139 }, "Atomic radius": 1.1, "Atomic radius calculated": 1.11, "Boiling point": "3173 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "100 GPa", "Coefficient of linear thermal expansion": "2.6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-4, 4], "Critical temperature": "no data K", "Density of solid": "2330 kg m<sup>-3</sup>", "Electrical resistivity": "about 100000 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ne].3s<sup>2</sup>.3p<sup>2</sup>", "ICSD oxidation states": [-4, 4], "Ionic radii": { 4: 0.54 }, "Liquid range": "1486 K", "Melting point": "1687 K", "Mendeleev no": 85, "Mineral hardness": "6.5", "Molar volume": "12.06 cm<sup>3</sup>", Name: "Silicon", "Oxidation states": [-4, -3, -2, -1, 1, 2, 3, 4], "Poissons ratio": "no data", Reflectivity: "28 %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 4: { IV: { "": { crystal_radius: 0.4, ionic_radius: 0.26 } }, VI: { "": { crystal_radius: 0.54, ionic_radius: 0.4 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "150 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.1, "Velocity of sound": "2200 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.9, "Youngs modulus": "47 GPa", "Metallic radius": "no data", iupac_ordering: 85, "IUPAC ordering": 85, "Ground level": "3P0", "Ionization energies": [8.15168, 16.34585, 33.493, 45.14179, 166.767, 205.279, 246.57, 303.59, 351.28, 401.38, 476.273, 523.415, 2437.65815, 2673.17755], "Electron affinity": 1.38952128 }, Sm: { "Atomic mass": 150.36, "Atomic no": 62, "Atomic orbitals": { "1s": -1617.183426, "2p": -242.729726, "2s": -255.498846, "3d": -39.528656, "3p": -50.08426, "3s": -55.731133, "4d": -4.814978, "4f": -0.21776, "4p": -8.672685, "4s": -10.844667, "5p": -0.835987, "5s": -1.408552, "6s": -0.128259 }, "Atomic radius": 1.85, "Atomic radius calculated": 2.38, "Boiling point": "2076 K", "Brinell hardness": "441 MN m<sup>-2</sup>", "Bulk modulus": "38 GPa", "Coefficient of linear thermal expansion": "12.7 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "7353 kg m<sup>-3</sup>", "Electrical resistivity": "94 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>6</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 2: 1.36, 3: 1.0979999999999999 }, "Liquid range": "731 K", "Melting point": "1345 K", "Mendeleev no": 28, "Mineral hardness": "no data", "Molar volume": "19.98 cm<sup>3</sup>", Name: "Samarium", "Oxidation states": [2, 3], "Poissons ratio": "0.27", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "20 GPa", "Shannon radii": { 2: { VII: { "": { crystal_radius: 1.36, ionic_radius: 1.22 } }, VIII: { "": { crystal_radius: 1.41, ionic_radius: 1.27 } }, IX: { "": { crystal_radius: 1.46, ionic_radius: 1.32 } } }, 3: { VI: { "": { crystal_radius: 1.098, ionic_radius: 0.958 } }, VII: { "": { crystal_radius: 1.16, ionic_radius: 1.02 } }, VIII: { "": { crystal_radius: 1.219, ionic_radius: 1.079 } }, IX: { "": { crystal_radius: 1.272, ionic_radius: 1.132 } }, XII: { "": { crystal_radius: 1.38, ionic_radius: 1.24 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "13 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.36, "Velocity of sound": "2130 m s<sup>-1</sup>", "Vickers hardness": "412 MN m<sup>-2</sup>", X: 1.17, "Youngs modulus": "50 GPa", "Metallic radius": 1.804, iupac_ordering: 42, "IUPAC ordering": 42, "Ground level": "7F0", "Ionization energies": [5.64371, 11.078, 23.55, 41.64, 62.7, 87, 103, 118, 141, 158, 179, 208, 237, 257, 276, 306.5, 474, 506, 543, 581, 617, 658, 702, 742, 782, 822, 976, 1016, 1060, 1103, 1180, 1226, 1332, 1381.56, 2371, 2466, 2569, 2676, 2782, 2887, 3028, 3137, 3253, 3363, 3669, 3766, 3873, 3971, 4227, 4337, 4548, 4655, 10494, 10762, 11060, 11337, 12264, 12588, 12992, 13262.85, 53986.12, 55214.23], "Electron affinity": 0.162 }, Sn: { "Atomic mass": 118.71, "Atomic no": 50, "Atomic orbitals": { "1s": -1026.762169, "2p": -141.821093, "2s": -151.523991, "3d": -17.657276, "3p": -25.117913, "3s": -29.125969, "4d": -1.004952, "4p": -3.211998, "4s": -4.546335, "5p": -0.14445, "5s": -0.369349 }, "Atomic radius": 1.45, "Atomic radius calculated": 1.45, "Boiling point": "2875 K", "Brinell hardness": "51 MN m<sup>-2</sup>", "Bulk modulus": "58 GPa", "Coefficient of linear thermal expansion": "22 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-4, 2, 4], "Critical temperature": "no data K", "Density of solid": "7310 kg m<sup>-3</sup>", "Electrical resistivity": "11.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>2</sup>", "ICSD oxidation states": [2, 3, 4], "Ionic radii": { 4: 0.83 }, "Liquid range": "2369.92 K", "Melting point": "505.08 K", "Mendeleev no": 83, "Mineral hardness": "1.5", "Molar volume": "16.29 cm<sup>3</sup>", Name: "Tin", "Oxidation states": [-4, 2, 4], "Poissons ratio": "0.36", Reflectivity: "54 %", "Refractive index": "no data", "Rigidity modulus": "18 GPa", "Shannon radii": { 4: { IV: { "": { crystal_radius: 0.69, ionic_radius: 0.55 } }, V: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } }, VI: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } }, VII: { "": { crystal_radius: 0.89, ionic_radius: 0.75 } }, VIII: { "": { crystal_radius: 0.95, ionic_radius: 0.81 } } } }, "Superconduction temperature": "3.72 K", "Thermal conductivity": "67 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.17, "Velocity of sound": "2500 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.96, "Youngs modulus": "50 GPa", "NMR Quadrupole Moment": { "Sn-119": -132.1 }, "Metallic radius": 1.58, iupac_ordering: 83, "IUPAC ordering": 83, "Ground level": "3P0", "Ionization energies": [7.343918, 14.63307, 30.506, 40.74, 77.03, 94, 112.9, 135, 156, 184, 208, 232, 258, 282, 379, 407, 437, 466, 506, 537, 608, 642.35, 1127, 1195, 1269, 1347, 1421, 1508, 1596, 1676, 1763, 1844, 2074, 2142.1, 2227, 2326, 2443, 2499, 2687, 2762.49, 6421, 6631, 6859, 7080, 7531, 7790, 8103, 8306.95, 34257.143, 35192.39], "Electron affinity": 1.1120702 }, Sr: { "Atomic mass": 87.62, "Atomic no": 38, "Atomic orbitals": { "1s": -572.870169, "2p": -69.745941, "2s": -76.491823, "3d": -4.813498, "3p": -9.301863, "3s": -11.771585, "4p": -0.844489, "4s": -1.455317, "5s": -0.131793 }, "Atomic radius": 2, "Atomic radius calculated": 2.19, "Boiling point": "1655 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "22.5 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "2630 kg m<sup>-3</sup>", "Electrical resistivity": "13.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].5s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 1.32 }, "Liquid range": "605 K", "Melting point": "1050 K", "Mendeleev no": 15, "Mineral hardness": "1.5", "Molar volume": "33.94 cm<sup>3</sup>", Name: "Strontium", "Oxidation states": [2], "Poissons ratio": "0.28", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "6.1 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.32, ionic_radius: 1.18 } }, VII: { "": { crystal_radius: 1.35, ionic_radius: 1.21 } }, VIII: { "": { crystal_radius: 1.4, ionic_radius: 1.26 } }, IX: { "": { crystal_radius: 1.45, ionic_radius: 1.31 } }, X: { "": { crystal_radius: 1.5, ionic_radius: 1.36 } }, XII: { "": { crystal_radius: 1.58, ionic_radius: 1.44 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "35 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.49, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 0.95, "Youngs modulus": "no data GPa", "NMR Quadrupole Moment": { "Sr-87": 305.2 }, "Metallic radius": 2.151, iupac_ordering: 14, "IUPAC ordering": 14, "Ground level": "1S0", "Ionization energies": [5.69486745, 11.0302765, 42.88353, 56.28, 70.7, 88, 104, 121.21, 158.33, 177.3, 324.07, 362, 408, 454, 499, 562, 612, 665, 722, 774, 932, 982.1, 1038, 1105, 1165, 1211, 1333.4, 1387.19, 3344.7, 3497, 3664, 3830, 4053, 4232, 4465, 4612.397, 19345.588, 20025.233], "Electron affinity": 0.052066 }, Ta: { "Atomic mass": 180.94788, "Atomic no": 73, "Atomic orbitals": { "1s": -2275.371387, "2p": -357.248334, "2s": -372.828724, "3d": -63.942521, "3p": -77.440942, "3s": -84.658467, "4d": -8.265848, "4f": -1.199347, "4p": -13.71981, "4s": -16.713337, "5d": -0.182464, "5p": -1.37653, "5s": -2.223807, "6s": -0.174814 }, "Atomic radius": 1.45, "Atomic radius calculated": 2, "Boiling point": "5731 K", "Brinell hardness": "800 MN m<sup>-2</sup>", "Bulk modulus": "200 GPa", "Coefficient of linear thermal expansion": "6.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [5], "Critical temperature": "no data K", "Density of solid": "16650 kg m<sup>-3</sup>", "Electrical resistivity": "13.5 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>3</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4, 5], "Ionic radii": { 3: 0.86, 4: 0.82, 5: 0.78 }, "Liquid range": "2441 K", "Melting point": "3290 K", "Mendeleev no": 52, "Mineral hardness": "6.5", "Molar volume": "10.85 cm<sup>3</sup>", Name: "Tantalum", "Oxidation states": [-1, 2, 3, 4, 5], "Poissons ratio": "0.34", Reflectivity: "78 %", "Refractive index": "no data", "Rigidity modulus": "69 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } } }, 4: { VI: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } } }, 5: { VI: { "": { crystal_radius: 0.78, ionic_radius: 0.64 } }, VII: { "": { crystal_radius: 0.83, ionic_radius: 0.69 } }, VIII: { "": { crystal_radius: 0.88, ionic_radius: 0.74 } } } }, "Superconduction temperature": "4.47 K", "Thermal conductivity": "57 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.22, "Velocity of sound": "3400 m s<sup>-1</sup>", "Vickers hardness": "873 MN m<sup>-2</sup>", X: 1.5, "Youngs modulus": "186 GPa", "Metallic radius": 1.47, iupac_ordering: 53, "IUPAC ordering": 53, "Ground level": "4F3/2", "Ionization energies": [7.549571, 16.2, 23.1, 35, 48.272, 94.01, 119, 139, 159, 180, 213, 235, 262, 304, 338, 363, 396, 439, 482, 530, 570, 610, 660, 700, 750, 790, 832, 1064, 1110, 1160, 1211, 1262, 1313, 1382, 1434, 1490, 1542, 1748, 1799, 1857, 1910, 2053, 2113, 2254, 2314.7, 3898.7, 4014, 4143, 4278, 4410, 4537, 4745, 4877, 5024, 5159, 5537, 5655, 5785, 5907, 6364, 6502, 6769, 6900, 15137, 15461, 15820, 16150, 17840, 18250, 18760, 19088.51, 76852.03, 78394.7], "Electron affinity": 0.32312 }, Tb: { "Atomic mass": 158.92535, "Atomic no": 65, "Atomic orbitals": { "1s": -1785.331942, "2p": -271.590585, "2s": -285.121013, "3d": -45.443863, "3p": -56.785113, "3s": -62.851563, "4d": -5.467662, "4f": -0.256311, "4p": -9.735637, "4s": -12.120486, "5p": -0.88723, "5s": -1.513669, "6s": -0.131677 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.25, "Boiling point": "3503 K", "Brinell hardness": "677 MN m<sup>-2</sup>", "Bulk modulus": "38.7 GPa", "Coefficient of linear thermal expansion": "10.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "8219 kg m<sup>-3</sup>", "Electrical resistivity": "115 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>9</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3, 4], "Ionic radii": { 3: 1.063, 4: 0.9 }, "Liquid range": "1874 K", "Melting point": "1629 K", "Mendeleev no": 26, "Mineral hardness": "no data", "Molar volume": "19.30 cm<sup>3</sup>", Name: "Terbium", "Oxidation states": [1, 3, 4], "Poissons ratio": "0.26", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "22 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.063, ionic_radius: 0.923 } }, VII: { "": { crystal_radius: 1.12, ionic_radius: 0.98 } }, VIII: { "": { crystal_radius: 1.18, ionic_radius: 1.04 } }, IX: { "": { crystal_radius: 1.235, ionic_radius: 1.095 } } }, 4: { VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } }, VIII: { "": { crystal_radius: 1.02, ionic_radius: 0.88 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "11 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.33, "Velocity of sound": "2620 m s<sup>-1</sup>", "Vickers hardness": "863 MN m<sup>-2</sup>", X: 1.1, "Youngs modulus": "56 GPa", "Metallic radius": 1.781, iupac_ordering: 39, "IUPAC ordering": 39, "Ground level": "6H°15/2", "Ionization energies": [5.8638, 11.513, 21.82, 39.33, 66.5, 90, 108, 125, 143, 168, 186, 216, 250, 273, 294, 325, 358, 393, 426.6, 613, 651, 690, 732, 772, 816, 866, 909, 954, 997, 1165, 1208, 1256, 1301, 1393, 1443, 1559, 1610.4, 2750, 2852, 2961, 3078, 3189, 3300, 3458, 3573, 3698, 3814, 4139, 4242, 4355, 4460, 4760, 4877, 5103, 5217, 11673, 11957, 12272, 12563, 13658, 14003, 14434, 14721.02, 59739.3, 61049.65], "Electron affinity": 0.131318 }, Tc: { "Atomic mass": 98, "Atomic no": 43, "Atomic orbitals": { "1s": -745.742024, "2p": -96.61021, "2s": -104.567508, "3d": -9.33986, "3p": -15.041738, "3s": -18.135303, "4d": -0.270262, "4p": -1.64323, "4s": -2.550712, "5s": -0.183636 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.83, "Boiling point": "4538 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4, 7], "Critical temperature": "no data K", "Density of solid": "11500 kg m<sup>-3</sup>", "Electrical resistivity": "about 22 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>5</sup>.5s<sup>2</sup>", "Ionic radii": { 4: 0.785, 5: 0.74, 7: 0.7 }, "Liquid range": "2108 K", "Melting point": "2430 K", "Mendeleev no": 59, "Mineral hardness": "no data", "Molar volume": "8.63 cm<sup>3</sup>", Name: "Technetium", "Oxidation states": [-3, -1, 1, 2, 3, 4, 5, 6, 7], "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "no data GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 0.785, ionic_radius: 0.645 } } }, 5: { VI: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } } }, 7: { IV: { "": { crystal_radius: 0.51, ionic_radius: 0.37 } }, VI: { "": { crystal_radius: 0.7, ionic_radius: 0.56 } } } }, "Superconduction temperature": "7.8 K", "Thermal conductivity": "51 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.16, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.9, "Youngs modulus": "no data GPa", "Metallic radius": 1.363, iupac_ordering: 60, "IUPAC ordering": 60, "Ground level": "6S5/2", "Ionization energies": [7.11938, 15.26, 29.55, 41, 57, 72, 88, 150, 169, 189.9, 214, 239, 262.08, 311, 338.55, 604, 655, 713, 773, 829, 904, 968, 1032, 1102, 1166, 1354, 1411.6, 1479.5, 1559, 1638, 1689, 1838, 1900.28, 4505, 4681, 4874, 5060, 5361, 5570, 5838, 6008.391, 25004.533, 25786.99], "Electron affinity": 0.552 }, Te: { "Atomic mass": 127.6, "Atomic no": 52, "Atomic orbitals": { "1s": -1115.831819, "2p": -156.808583, "2s": -167.021776, "3d": -20.887801, "3p": -28.860685, "3s": -33.137485, "4d": -1.608381, "4p": -4.100084, "4s": -5.572846, "5p": -0.226594, "5s": -0.520997 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.23, "Boiling point": "1261 K", "Brinell hardness": "180 MN m<sup>-2</sup>", "Bulk modulus": "65 GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [-2, 2, 4, 6], "Critical temperature": "no data K", "Density of solid": "6240 kg m<sup>-3</sup>", "Electrical resistivity": "about 10000 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>4</sup>", "ICSD oxidation states": [-2, 4, -1, 6], "Ionic radii": { "-2": 2.07, 4: 1.11, 6: 0.7 }, "Liquid range": "538.34 K", "Melting point": "722.66 K", "Mendeleev no": 92, "Mineral hardness": "2.25", "Molar volume": "20.46 cm<sup>3</sup>", Name: "Tellurium", "Oxidation states": [-2, 2, 4, 5, 6], "Poissons ratio": "no data", Reflectivity: "50 %", "Refractive index": "1.000991", "Rigidity modulus": "16 GPa", "Shannon radii": { "-2": { VI: { "": { crystal_radius: 2.07, ionic_radius: 2.21 } } }, 4: { III: { "": { crystal_radius: 0.66, ionic_radius: 0.52 } }, IV: { "": { crystal_radius: 0.8, ionic_radius: 0.66 } }, VI: { "": { crystal_radius: 1.11, ionic_radius: 0.97 } } }, 6: { IV: { "": { crystal_radius: 0.57, ionic_radius: 0.43 } }, VI: { "": { crystal_radius: 0.7, ionic_radius: 0.56 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "3 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.06, "Velocity of sound": "2610 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.1, "Youngs modulus": "43 GPa", "Metallic radius": "no data", iupac_ordering: 94, "IUPAC ordering": 94, "Ground level": "3P2", "Ionization energies": [9.009808, 18.6, 27.84, 37.4155, 59.3, 69.1, 124.2, 143, 167, 191.1, 215, 245, 272, 299, 328, 354, 461, 491, 522, 555, 599, 633, 709, 746.12, 1304, 1377, 1455, 1538, 1618, 1707, 1803, 1889, 1979, 2066, 2309, 2386, 2472, 2552, 2700, 2788, 2954, 3041, 7022, 7243, 7485, 7714, 8240, 8499, 8821, 9040.83, 37196.522, 38177.56], "Electron affinity": 1.9708757 }, Th: { "Atomic mass": 232.03806, "Atomic no": 90, "Atomic orbitals": { "1s": -3524.439052, "2p": -588.218112, "2s": -608.350958, "3d": -123.846396, "3p": -142.25581, "3s": -152.079741, "4d": -24.955184, "4f": -13.397389, "4p": -33.325252, "4s": -37.814094, "5d": -3.625729, "5p": -6.58281, "5s": -8.287057, "6d": -0.172896, "6p": -0.846921, "6s": -1.333769, "7s": -0.135872 }, "Atomic radius": 1.8, "Atomic radius calculated": "no data", "Boiling point": "5093 K", "Brinell hardness": "400 MN m<sup>-2</sup>", "Bulk modulus": "54 GPa", "Coefficient of linear thermal expansion": "11.0 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "11724 kg m<sup>-3</sup>", "Electrical resistivity": "15 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].6d<sup>2</sup>.7s<sup>2</sup>", "ICSD oxidation states": [4], "Ionic radii": { 4: 1.08 }, "Liquid range": "2978 K", "Melting point": "2115 K", "Mendeleev no": 47, "Mineral hardness": "3.0", "Molar volume": "19.80 cm<sup>3</sup>", Name: "Thorium", "Oxidation states": [2, 3, 4], "Poissons ratio": "0.27", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "31 GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 1.08, ionic_radius: 0.94 } }, VIII: { "": { crystal_radius: 1.19, ionic_radius: 1.05 } }, IX: { "": { crystal_radius: 1.23, ionic_radius: 1.09 } }, X: { "": { crystal_radius: 1.27, ionic_radius: 1.13 } }, XI: { "": { crystal_radius: 1.32, ionic_radius: 1.18 } }, XII: { "": { crystal_radius: 1.35, ionic_radius: 1.21 } } } }, "Superconduction temperature": "1.38 K", "Thermal conductivity": "54 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.45, "Velocity of sound": "2490 m s<sup>-1</sup>", "Vickers hardness": "350 MN m<sup>-2</sup>", X: 1.3, "Youngs modulus": "79 GPa", "Metallic radius": 1.798, iupac_ordering: 31, "IUPAC ordering": 31, "Ground level": "3F2", "Ionization energies": [6.3067, 12.1, 18.32, 28.648, 58, 69.1, 82, 95, 118, 133, 165, 181, 262, 285, 310, 336, 362, 389, 424, 451, 480, 508, 650, 680, 720, 750, 830, 870, 970, 1010, 1090, 1160, 1240, 1310, 1380, 1460, 1530, 1600, 1680, 1760, 1830, 1910, 1980, 2060, 2390, 2455, 2524, 2598, 2669, 2737, 2864, 2935, 3013, 3086, 3375, 3445, 3522, 3593, 3943, 4025, 4230, 4313, 6972, 7130, 7299, 7480, 7650, 7810, 8180, 8350, 8550, 8720, 9220, 9370, 9540, 9690, 10790, 10970, 11340, 11510, 24060, 24480, 24940, 25360, 29410, 29970, 30680, 31122.8, 123086.4, 125253.4], "Electron affinity": 1.17 }, Ti: { "Atomic mass": 47.867, "Atomic no": 22, "Atomic orbitals": { "1s": -177.276643, "2p": -16.285339, "2s": -19.457901, "3d": -0.17001, "3p": -1.422947, "3s": -2.258007, "4s": -0.167106 }, "Atomic radius": 1.4, "Atomic radius calculated": 1.76, "Boiling point": "3560 K", "Brinell hardness": "716 MN m<sup>-2</sup>", "Bulk modulus": "110 GPa", "Coefficient of linear thermal expansion": "8.6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "4507 kg m<sup>-3</sup>", "Electrical resistivity": "about 40 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>2</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2, 3, 4], "Ionic radii": { 2: 1, 3: 0.81, 4: 0.745 }, "Liquid range": "1619 K", "Melting point": "1941 K", "Mendeleev no": 51, "Mineral hardness": "6.0", "Molar volume": "10.64 cm<sup>3</sup>", Name: "Titanium", "Oxidation states": [-1, 2, 3, 4], "Poissons ratio": "0.32", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "44 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1, ionic_radius: 0.86 } } }, 3: { VI: { "": { crystal_radius: 0.81, ionic_radius: 0.67 } } }, 4: { IV: { "": { crystal_radius: 0.56, ionic_radius: 0.42 } }, V: { "": { crystal_radius: 0.65, ionic_radius: 0.51 } }, VI: { "": { crystal_radius: 0.745, ionic_radius: 0.605 } }, VIII: { "": { crystal_radius: 0.88, ionic_radius: 0.74 } } } }, "Superconduction temperature": "0.40 K", "Thermal conductivity": "22 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.11, "Velocity of sound": "4140 m s<sup>-1</sup>", "Vickers hardness": "970 MN m<sup>-2</sup>", X: 1.54, "Youngs modulus": "116 GPa", "NMR Quadrupole Moment": { "Ti-47": 302.1, "Ti-49": 247.11 }, "Metallic radius": 1.462, iupac_ordering: 52, "IUPAC ordering": 52, "Ground level": "3F2", "Ionization energies": [6.82812, 13.5755, 27.49171, 43.26717, 99.299, 119.533, 140.68, 170.5, 192.1, 215.92, 265.07, 291.5, 787.67, 864, 944.5, 1042.5, 1130.2, 1220.3, 1346.3, 1425.257, 6249.0226, 6625.8073], "Electron affinity": 0.075545 }, Tl: { "Atomic mass": 204.3833, "Atomic no": 81, "Atomic orbitals": { "1s": -2827.569408, "2p": -457.255971, "2s": -474.953368, "3d": -88.328299, "3p": -104.099296, "3s": -112.52218, "4d": -14.008848, "4f": -4.835747, "4p": -20.797078, "4s": -24.471512, "5d": -0.674544, "5p": -2.59873, "5s": -3.811512, "6p": -0.101507, "6s": -0.28502 }, "Atomic radius": 1.9, "Atomic radius calculated": 1.56, "Boiling point": "1746 K", "Brinell hardness": "26.4 MN m<sup>-2</sup>", "Bulk modulus": "43 GPa", "Coefficient of linear thermal expansion": "29.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [1, 3], "Critical temperature": "no data K", "Density of solid": "11850 kg m<sup>-3</sup>", "Electrical resistivity": "15 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>10</sup>.6s<sup>2</sup>.6p<sup>1</sup>", "ICSD oxidation states": [1, 3], "Ionic radii": { 1: 1.64, 3: 1.025 }, "Liquid range": "1169 K", "Melting point": "577 K", "Mendeleev no": 78, "Mineral hardness": "1.2", "Molar volume": "17.22 cm<sup>3</sup>", Name: "Thallium", "Oxidation states": [1, 3], "Poissons ratio": "0.45", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "2.8 GPa", "Shannon radii": { 1: { VI: { "": { crystal_radius: 1.64, ionic_radius: 1.5 } }, VIII: { "": { crystal_radius: 1.73, ionic_radius: 1.59 } }, XII: { "": { crystal_radius: 1.84, ionic_radius: 1.7 } } }, 3: { IV: { "": { crystal_radius: 0.89, ionic_radius: 0.75 } }, VI: { "": { crystal_radius: 1.025, ionic_radius: 0.885 } }, VIII: { "": { crystal_radius: 1.12, ionic_radius: 0.98 } } } }, "Superconduction temperature": "2.38 K", "Thermal conductivity": "46 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 1.96, "Velocity of sound": "818 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.62, "Youngs modulus": "8 GPa", "Metallic radius": 1.7, iupac_ordering: 77, "IUPAC ordering": 77, "Ground level": "2P°1/2", "Ionization energies": [6.1082873, 20.4283, 29.852, 51.14, 62.6, 80, 97.9, 116, 135, 158, 177, 198, 218.3, 306.9, 340, 366, 392, 439, 467, 520, 570, 600, 640, 700, 760, 820, 880, 930, 990, 1060, 1110, 1170, 1230, 1290, 1350, 1625, 1681, 1740, 1802, 1862, 1920, 2014, 2075, 2140, 2202, 2447, 2508, 2574, 2635, 2854, 2925, 3094, 3164.7, 5234, 5371, 5518, 5674, 5824, 5969, 6241, 6392, 6560, 6714, 7146, 7281, 7430, 7570, 8260, 8420, 8730, 8880, 19070, 19440, 19840, 20210, 22780, 23250, 23850, 24234.1, 96783.21, 98591.6], "Electron affinity": 0.32005319 }, Tm: { "Atomic mass": 168.93421, "Atomic no": 69, "Atomic orbitals": { "1s": -2022.471608, "2p": -312.510608, "2s": -327.05712, "3d": -53.835494, "3p": -66.239338, "3s": -72.873753, "4d": -6.350307, "4f": -0.28312, "4p": -11.187151, "4s": -13.865665, "5p": -0.950748, "5s": -1.64999, "6s": -0.135953 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.22, "Boiling point": "2223 K", "Brinell hardness": "471 MN m<sup>-2</sup>", "Bulk modulus": "45 GPa", "Coefficient of linear thermal expansion": "13.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "9321 kg m<sup>-3</sup>", "Electrical resistivity": "67.6 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>13</sup>.6s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 2: 1.17, 3: 1.02 }, "Liquid range": "405 K", "Melting point": "1818 K", "Mendeleev no": 21, "Mineral hardness": "no data", "Molar volume": "19.1 cm<sup>3</sup>", Name: "Thulium", "Oxidation states": [2, 3], "Poissons ratio": "0.21", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "31 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.17, ionic_radius: 1.03 } }, VII: { "": { crystal_radius: 1.23, ionic_radius: 1.09 } } }, 3: { VI: { "": { crystal_radius: 1.02, ionic_radius: 0.88 } }, VIII: { "": { crystal_radius: 1.134, ionic_radius: 0.994 } }, IX: { "": { crystal_radius: 1.192, ionic_radius: 1.052 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "17 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.27, "Velocity of sound": "no data m s<sup>-1</sup>", "Vickers hardness": "520 MN m<sup>-2</sup>", X: 1.25, "Youngs modulus": "74 GPa", "Metallic radius": 1.747, iupac_ordering: 35, "IUPAC ordering": 35, "Ground level": "2F°7/2", "Ionization energies": [6.18431, 12.065, 23.66, 42.41, 65.4, 98, 116, 133, 160, 180, 205, 239, 274, 295, 317, 352, 387, 424, 460, 496, 530, 570, 603, 825, 866, 911, 958, 1004, 1050, 1110, 1157, 1207, 1255, 1442, 1490, 1542, 1591, 1706, 1761, 1889, 1945.2, 3298, 3409, 3528, 3653, 3775, 3895, 4075, 4199, 4335, 4461, 4812, 4922, 5044, 5157, 5527, 5656, 5901, 6023, 13347, 13651, 13988, 14300, 15663, 16036, 16510, 16814.34, 67965.26, 69387.3], "Electron affinity": 1.02922 }, U: { "Atomic mass": 238.02891, "Atomic no": 92, "Atomic orbitals": { "1s": -3689.355141, "2p": -619.10855, "2s": -639.778728, "3d": -131.977358, "3p": -150.97898, "3s": -161.118073, "4d": -27.123212, "4f": -15.02746, "4p": -35.853321, "4s": -40.528084, "5d": -3.866175, "5f": -0.366543, "5p": -7.018092, "5s": -8.824089, "6d": -0.14319, "6p": -0.822538, "6s": -1.325976, "7s": -0.130948 }, "Atomic radius": 1.75, "Atomic radius calculated": "no data", "Boiling point": "4200 K", "Brinell hardness": "2400 MN m<sup>-2</sup>", "Bulk modulus": "100 GPa", "Coefficient of linear thermal expansion": "13.9 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [6], "Critical temperature": "no data K", "Density of solid": "19050 kg m<sup>-3</sup>", "Electrical resistivity": "28 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Rn].5f<sup>3</sup>.6d<sup>1</sup>.7s<sup>2</sup>", "ICSD oxidation states": [3, 4, 5, 6], "Ionic radii": { 3: 1.165, 4: 1.03, 5: 0.9, 6: 0.87 }, "Liquid range": "2794.7 K", "Melting point": "1405.3 K", "Mendeleev no": 45, "Mineral hardness": "6.0", "Molar volume": "12.49 cm<sup>3</sup>", Name: "Uranium", "Oxidation states": [3, 4, 5, 6], "Poissons ratio": "0.23", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "111 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.165, ionic_radius: 1.025 } } }, 4: { VI: { "": { crystal_radius: 1.03, ionic_radius: 0.89 } }, VII: { "": { crystal_radius: 1.09, ionic_radius: 0.95 } }, VIII: { "": { crystal_radius: 1.14, ionic_radius: 1 } }, IX: { "": { crystal_radius: 1.19, ionic_radius: 1.05 } }, XII: { "": { crystal_radius: 1.31, ionic_radius: 1.17 } } }, 5: { VI: { "": { crystal_radius: 0.9, ionic_radius: 0.76 } }, VII: { "": { crystal_radius: 0.98, ionic_radius: 0.84 } } }, 6: { II: { "": { crystal_radius: 0.59, ionic_radius: 0.45 } }, IV: { "": { crystal_radius: 0.66, ionic_radius: 0.52 } }, VI: { "": { crystal_radius: 0.87, ionic_radius: 0.73 } }, VII: { "": { crystal_radius: 0.95, ionic_radius: 0.81 } }, VIII: { "": { crystal_radius: 1, ionic_radius: 0.86 } } } }, "Superconduction temperature": "0.2 K", "Thermal conductivity": "27 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.41, "Velocity of sound": "3155 m s<sup>-1</sup>", "Vickers hardness": "1960 MN m<sup>-2</sup>", X: 1.38, "Youngs modulus": "208 GPa", "Metallic radius": 1.542, iupac_ordering: 29, "IUPAC ordering": 29, "Ground level": "5L°6", "Ionization energies": [6.19405, 11.6, 19.8, 36.7, 46, 62, 89, 101, 116, 128.9, 158, 173, 210, 227, 323, 348, 375, 402, 431, 458, 497, 525, 557, 585, 730, 770, 800, 840, 930, 970, 1070, 1110, 1210, 1290, 1370, 1440, 1520, 1590, 1670, 1750, 1830, 1910, 1990, 2070, 2140, 2220, 2578, 2646, 2718, 2794, 2867, 2938, 3073, 3147, 3228, 3301, 3602, 3675, 3753, 3827, 4214, 4299, 4513, 4598, 7393, 7550, 7730, 7910, 8090, 8260, 8650, 8830, 9030, 9210, 9720, 9870, 10040, 10200, 11410, 11600, 11990, 12160, 25260, 25680, 26150, 26590, 31060, 31640, 32400, 32836.5, 129570.3, 131821], "Electron affinity": 0.53 }, V: { "Atomic mass": 50.9415, "Atomic no": 23, "Atomic orbitals": { "1s": -195.224014, "2p": -18.435189, "2s": -21.815346, "3d": -0.204634, "3p": -1.610516, "3s": -2.526904, "4s": -0.175968 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.71, "Boiling point": "3680 K", "Brinell hardness": "628 MN m<sup>-2</sup>", "Bulk modulus": "160 GPa", "Coefficient of linear thermal expansion": "8.4 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [5], "Critical temperature": "no data K", "Density of solid": "6110 kg m<sup>-3</sup>", "Electrical resistivity": "20 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>3</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2, 3, 4, 5], "Ionic radii": { 2: 0.93, 3: 0.78, 4: 0.72, 5: 0.68 }, "Liquid range": "1497 K", "Melting point": "2183 K", "Mendeleev no": 54, "Mineral hardness": "7.0", "Molar volume": "8.32 cm<sup>3</sup>", Name: "Vanadium", "Oxidation states": [-1, 1, 2, 3, 4, 5], "Poissons ratio": "0.37", Reflectivity: "61 %", "Refractive index": "no data", "Rigidity modulus": "47 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 0.93, ionic_radius: 0.79 } } }, 3: { VI: { "": { crystal_radius: 0.78, ionic_radius: 0.64 } } }, 4: { V: { "": { crystal_radius: 0.67, ionic_radius: 0.53 } }, VI: { "": { crystal_radius: 0.72, ionic_radius: 0.58 } }, VIII: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } } }, 5: { IV: { "": { crystal_radius: 0.495, ionic_radius: 0.355 } }, V: { "": { crystal_radius: 0.6, ionic_radius: 0.46 } }, VI: { "": { crystal_radius: 0.68, ionic_radius: 0.54 } } } }, "Superconduction temperature": "5.40 K", "Thermal conductivity": "31 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.07, "Velocity of sound": "4560 m s<sup>-1</sup>", "Vickers hardness": "628 MN m<sup>-2</sup>", X: 1.63, "Youngs modulus": "128 GPa", "NMR Quadrupole Moment": { "V-50": 210.4, "V-51": -52.1 }, "Metallic radius": 1.347, iupac_ordering: 55, "IUPAC ordering": 55, "Ground level": "4F3/2", "Ionization energies": [6.746187, 14.634, 29.3111, 46.709, 65.28165, 128.125, 150.72, 173.55, 206, 230.5, 254.8, 308.5, 336.274, 896, 977.2, 1062.9, 1165.2, 1258.9, 1354.2, 1486.7, 1569.656, 6851.3109, 7246.1226], "Electron affinity": 0.527662 }, W: { "Atomic mass": 183.84, "Atomic no": 74, "Atomic orbitals": { "1s": -2341.042887, "2p": -369.013973, "2s": -384.856157, "3d": -66.724787, "3p": -80.502102, "3s": -87.867792, "4d": -8.879693, "4f": -1.550835, "4p": -14.495102, "4s": -17.570797, "5d": -0.220603, "5p": -1.504457, "5s": -2.396018, "6s": -0.181413 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.93, "Boiling point": "5828 K", "Brinell hardness": "2570 MN m<sup>-2</sup>", "Bulk modulus": "310 GPa", "Coefficient of linear thermal expansion": "4.5 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4, 6], "Critical temperature": "no data K", "Density of solid": "19250 kg m<sup>-3</sup>", "Electrical resistivity": "5.4 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.5d<sup>4</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3, 4, 5, 6], "Ionic radii": { 4: 0.8, 5: 0.76, 6: 0.74 }, "Liquid range": "2133 K", "Melting point": "3695 K", "Mendeleev no": 55, "Mineral hardness": "7.5", "Molar volume": "9.47 cm<sup>3</sup>", Name: "Tungsten", "Oxidation states": [-2, -1, 1, 2, 3, 4, 5, 6], "Poissons ratio": "0.28", Reflectivity: "62 %", "Refractive index": "no data", "Rigidity modulus": "161 GPa", "Shannon radii": { 4: { VI: { "": { crystal_radius: 0.8, ionic_radius: 0.66 } } }, 5: { VI: { "": { crystal_radius: 0.76, ionic_radius: 0.62 } } }, 6: { IV: { "": { crystal_radius: 0.56, ionic_radius: 0.42 } }, V: { "": { crystal_radius: 0.65, ionic_radius: 0.51 } }, VI: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } } } }, "Superconduction temperature": "0.015 K", "Thermal conductivity": "170 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.18, "Velocity of sound": "5174 m s<sup>-1</sup>", "Vickers hardness": "3430 MN m<sup>-2</sup>", X: 2.36, "Youngs modulus": "411 GPa", "Metallic radius": 1.41, iupac_ordering: 56, "IUPAC ordering": 56, "Ground level": "5D0", "Ionization energies": [7.86403, 16.37, 26, 38.2, 51.6, 64.77, 122.01, 141.2, 160.2, 179, 208.9, 231.6, 258.3, 290.7, 325.3, 361.9, 387.9, 420.7, 462.1, 502.6, 543.4, 594.5, 640.6, 685.6, 734.1, 784.4, 833.4, 881.4, 1132.2, 1180, 1230.4, 1283.4, 1335.1, 1386.8, 1459.9, 1512.4, 1569.1, 1621.7, 1829.8, 1882.9, 1940.6, 1994.8, 2149.1, 2210, 2354.5, 2414.1, 4057, 4180, 4309, 4446, 4578, 4709, 4927, 5063, 5209, 5348, 5719, 5840, 5970, 6093, 6596, 6735, 7e3, 7130, 15566, 15896, 16252, 16588, 18476, 18872, 19362, 19686.74, 79181.94, 80755.6], "Electron affinity": 0.816268 }, Xe: { "Atomic mass": 131.293, "Atomic no": 54, "Atomic orbitals": { "1s": -1208.688993, "2p": -172.599583, "2s": -183.327495, "3d": -24.37823, "3p": -32.867042, "3s": -37.415454, "4d": -2.286666, "4p": -5.063802, "4s": -6.67834, "5p": -0.309835, "5s": -0.672086 }, "Atomic radius": "no data", "Atomic radius calculated": 1.08, "Boiling point": "165.1 K", "Brinell hardness": "no data MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "no data x10<sup>-6</sup>K<sup>-1</sup>", "Critical temperature": "289.7 K", "Density of solid": "no data kg m<sup>-3</sup>", "Electrical resistivity": "no data 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>10</sup>.5s<sup>2</sup>.5p<sup>6</sup>", "Ionic radii": { 8: 0.62 }, "Liquid range": "3.7 K", "Max oxidation state": 8, "Melting point": "161.4 K", "Mendeleev no": 5, "Min oxidation state": 2, "Mineral hardness": "no data", "Molar volume": "35.92 cm<sup>3</sup>", Name: "Xenon", "Poissons ratio": "no data", Reflectivity: "no data %", "Refractive index": "1.000702", "Rigidity modulus": "no data GPa", "Shannon radii": { 8: { IV: { "": { crystal_radius: 0.54, ionic_radius: 0.4 } }, VI: { "": { crystal_radius: 0.62, ionic_radius: 0.48 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "0.00565 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.16, "Velocity of sound": "1090 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 2.6, "Youngs modulus": "no data GPa", "Metallic radius": "no data", iupac_ordering: 1, "IUPAC ordering": 1, "Ground level": "1S0", "Ionization energies": [12.1298437, 20.975, 31.05, 42.2, 54.1, 66.703, 91.6, 105.9778, 179.84, 202, 229.02, 255, 281, 314, 343, 374, 404, 434, 549, 582, 616, 650, 700, 736, 818, 857, 1493, 1571, 1653, 1742, 1826, 1919, 2023, 2113, 2209, 2300, 2556, 2637, 2726, 2811, 2975, 3068, 3243, 3333.8, 7660, 7889, 8144, 8382, 8971, 9243, 9581, 9810.37, 40271.724, 41299.71], "Electron affinity": -0.82 }, Y: { "Atomic mass": 88.90585, "Atomic no": 39, "Atomic orbitals": { "1s": -605.631981, "2p": -74.803201, "2s": -81.789102, "3d": -5.671499, "3p": -10.399926, "3s": -12.992217, "4d": -0.108691, "4p": -1.02449, "4s": -1.697124, "5s": -0.150727 }, "Atomic radius": 1.8, "Atomic radius calculated": 2.12, "Boiling point": "3609 K", "Brinell hardness": "589 MN m<sup>-2</sup>", "Bulk modulus": "41 GPa", "Coefficient of linear thermal expansion": "10.6 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "4472 kg m<sup>-3</sup>", "Electrical resistivity": "about 60 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>1</sup>.5s<sup>2</sup>", "ICSD oxidation states": [3], "Ionic radii": { 3: 1.04 }, "Liquid range": "1810 K", "Melting point": "1799 K", "Mendeleev no": 25, "Mineral hardness": "no data", "Molar volume": "19.88 cm<sup>3</sup>", Name: "Yttrium", "Oxidation states": [1, 2, 3], "Poissons ratio": "0.24", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "26 GPa", "Shannon radii": { 3: { VI: { "": { crystal_radius: 1.04, ionic_radius: 0.9 } }, VII: { "": { crystal_radius: 1.1, ionic_radius: 0.96 } }, VIII: { "": { crystal_radius: 1.159, ionic_radius: 1.019 } }, IX: { "": { crystal_radius: 1.215, ionic_radius: 1.075 } } } }, "Superconduction temperature": "1.3  (under pressure)K", "Thermal conductivity": "17 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.32, "Velocity of sound": "3300 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.22, "Youngs modulus": "64 GPa", "Metallic radius": 1.8, iupac_ordering: 48, "IUPAC ordering": 48, "Ground level": "2D3/2", "Ionization energies": [6.21726, 12.2236, 20.52441, 60.6072, 75.35, 91.39, 110.02, 128.12, 145.64, 185.7, 205.814, 374.04, 414, 463, 512, 559, 624, 677, 733, 790, 847, 1010, 1061.9, 1120.2, 1190, 1253, 1300, 1427.6, 1483.12, 3562.9, 3720, 3892, 4060, 4299, 4484, 4724, 4875.731, 20415.717, 21115.55], "Electron affinity": 0.30712 }, Yb: { "Atomic mass": 173.04, "Atomic no": 70, "Atomic orbitals": { "1s": -2084.069389, "2p": -323.178219, "2s": -337.978976, "3d": -56.026315, "3p": -68.698655, "3s": -75.47663, "4d": -6.574963, "4f": -0.286408, "4p": -11.558246, "4s": -14.312076, "5p": -0.966137, "5s": -1.683886, "6s": -0.136989 }, "Atomic radius": 1.75, "Atomic radius calculated": 2.22, "Boiling point": "1469 K", "Brinell hardness": "343 MN m<sup>-2</sup>", "Bulk modulus": "31 GPa", "Coefficient of linear thermal expansion": "26.3 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [3], "Critical temperature": "no data K", "Density of solid": "6570 kg m<sup>-3</sup>", "Electrical resistivity": "25.0 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Xe].4f<sup>14</sup>.6s<sup>2</sup>", "ICSD oxidation states": [2, 3], "Ionic radii": { 2: 1.16, 3: 1.008 }, "Liquid range": "372 K", "Melting point": "1097 K", "Mendeleev no": 17, "Mineral hardness": "no data", "Molar volume": "24.84 cm<sup>3</sup>", Name: "Ytterbium", "Oxidation states": [2, 3], "Poissons ratio": "0.21", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "9.9 GPa", "Shannon radii": { 2: { VI: { "": { crystal_radius: 1.16, ionic_radius: 1.02 } }, VII: { "": { crystal_radius: 1.22, ionic_radius: 1.08 } }, VIII: { "": { crystal_radius: 1.28, ionic_radius: 1.14 } } }, 3: { VI: { "": { crystal_radius: 1.008, ionic_radius: 0.868 } }, VII: { "": { crystal_radius: 1.065, ionic_radius: 0.925 } }, VIII: { "": { crystal_radius: 1.125, ionic_radius: 0.985 } }, IX: { "": { crystal_radius: 1.182, ionic_radius: 1.042 } } } }, "Superconduction temperature": "no data K", "Thermal conductivity": "39 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.26, "Velocity of sound": "1590 m s<sup>-1</sup>", "Vickers hardness": "206 MN m<sup>-2</sup>", X: 1.1, "Youngs modulus": "24 GPa", "Metallic radius": 1.94, iupac_ordering: 34, "IUPAC ordering": 34, "Ground level": "1S0", "Ionization energies": [6.25416, 12.179185, 25.053, 43.61, 65.6, 99, 117, 135, 163, 182, 209, 244, 279, 301, 324, 360, 396, 431, 469, 505, 540, 580, 610, 651, 882, 924, 971, 1019, 1065, 1114, 1175, 1224, 1275, 1324, 1516, 1564, 1618, 1668, 1789, 1845, 1978, 2036.4, 3443, 3555, 3677, 3805, 3929, 4051, 4238, 4364, 4502, 4630, 4988, 5101, 5224, 5339, 5731, 5860, 6111, 6236, 13784, 14093, 14435, 14752, 16191, 16570, 17050, 17365.44, 70123.04, 71574.8], "Electron affinity": -0.02 }, Zn: { "Atomic mass": 65.409, "Atomic no": 30, "Atomic orbitals": { "1s": -344.969756, "2p": -36.648765, "2s": -41.531323, "3d": -0.398944, "3p": -3.022363, "3s": -4.573041, "4s": -0.222725 }, "Atomic radius": 1.35, "Atomic radius calculated": 1.42, "Boiling point": "1180 K", "Brinell hardness": "412 MN m<sup>-2</sup>", "Bulk modulus": "70 GPa", "Coefficient of linear thermal expansion": "30.2 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [2], "Critical temperature": "no data K", "Density of solid": "7140 kg m<sup>-3</sup>", "Electrical resistivity": "6.0 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Ar].3d<sup>10</sup>.4s<sup>2</sup>", "ICSD oxidation states": [2], "Ionic radii": { 2: 0.88 }, "Liquid range": "487.32 K", "Melting point": "692.68 K", "Mendeleev no": 76, "Mineral hardness": "2.5", "Molar volume": "9.16 cm<sup>3</sup>", Name: "Zinc", "Oxidation states": [1, 2], "Poissons ratio": "0.25", Reflectivity: "80 %", "Refractive index": "1.002050", "Rigidity modulus": "43 GPa", "Shannon radii": { 2: { IV: { "": { crystal_radius: 0.74, ionic_radius: 0.6 } }, V: { "": { crystal_radius: 0.82, ionic_radius: 0.68 } }, VI: { "": { crystal_radius: 0.88, ionic_radius: 0.74 } }, VIII: { "": { crystal_radius: 1.04, ionic_radius: 0.9 } } } }, "Superconduction temperature": "0.85 K", "Thermal conductivity": "120 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.01, "Velocity of sound": "3700 m s<sup>-1</sup>", "Vickers hardness": "no data MN m<sup>-2</sup>", X: 1.65, "Youngs modulus": "108 GPa", "NMR Quadrupole Moment": { "Zn-67": 150.15 }, "Metallic radius": 1.34, iupac_ordering: 76, "IUPAC ordering": 76, "Ground level": "1S0", "Ionization energies": [9.394197, 17.96439, 39.7233, 59.573, 82.6, 108, 133.9, 173.9, 203, 238, 274.4, 310.8, 417.6, 453.4, 490.6, 540, 577.8, 613.3, 697.5, 737.366, 1846.8, 1961, 2085, 2214, 2358, 2491.5, 2669.9, 2781.996, 11864.9399, 12388.929], "Electron affinity": -0.62 }, Zr: { "Atomic mass": 91.224, "Atomic no": 40, "Atomic orbitals": { "1s": -639.292236, "2p": -80.010043, "2s": -87.237062, "3d": -6.544643, "3p": -11.514415, "3s": -14.230432, "4d": -0.150673, "4p": -1.186597, "4s": -1.918971, "5s": -0.162391 }, "Atomic radius": 1.55, "Atomic radius calculated": 2.06, "Boiling point": "4682 K", "Brinell hardness": "650 MN m<sup>-2</sup>", "Bulk modulus": "no data GPa", "Coefficient of linear thermal expansion": "5.7 x10<sup>-6</sup>K<sup>-1</sup>", "Common oxidation states": [4], "Critical temperature": "no data K", "Density of solid": "6511 kg m<sup>-3</sup>", "Electrical resistivity": "43.3 10<sup>-8</sup> &Omega; m", "Electronic structure": "[Kr].4d<sup>2</sup>.5s<sup>2</sup>", "ICSD oxidation states": [2, 3, 4], "Ionic radii": { 4: 0.86 }, "Liquid range": "2554 K", "Melting point": "2128 K", "Mendeleev no": 49, "Mineral hardness": "5.0", "Molar volume": "14.02 cm<sup>3</sup>", Name: "Zirconium", "Oxidation states": [1, 2, 3, 4], "Poissons ratio": "0.34", Reflectivity: "no data %", "Refractive index": "no data", "Rigidity modulus": "33 GPa", "Shannon radii": { 4: { IV: { "": { crystal_radius: 0.73, ionic_radius: 0.59 } }, V: { "": { crystal_radius: 0.8, ionic_radius: 0.66 } }, VI: { "": { crystal_radius: 0.86, ionic_radius: 0.72 } }, VII: { "": { crystal_radius: 0.92, ionic_radius: 0.78 } }, VIII: { "": { crystal_radius: 0.98, ionic_radius: 0.84 } }, IX: { "": { crystal_radius: 1.03, ionic_radius: 0.89 } } } }, "Superconduction temperature": "0.61 K", "Thermal conductivity": "23 W m<sup>-1</sup> K<sup>-1</sup>", "Van der waals radius": 2.23, "Velocity of sound": "3800 m s<sup>-1</sup>", "Vickers hardness": "903 MN m<sup>-2</sup>", X: 1.33, "Youngs modulus": "68 GPa", "Metallic radius": 1.602, iupac_ordering: 51, "IUPAC ordering": 51, "Ground level": "3F2", "Ionization energies": [6.634126, 13.13, 23.17, 34.41836, 80.348, 96.38, 112, 133.7, 153, 172.02, 214.9, 236.252, 426, 470, 520, 573, 622, 690, 745, 803, 863, 922, 1092, 1144.7, 1205.4, 1277, 1344, 1392, 1525.1, 1582.37, 3788, 3950, 4127, 4300, 4553, 4744, 4991, 5146.935, 21516.469, 22236.678], "Electron affinity": 0.433289 }, Rf: { "Atomic mass": 267, "Atomic no": 104, Name: "Rutherfordium", "Ground level": "3F2", "Ionization energies": [6.02, 14.35, 23.84, 31.87, 64, 77, 102, 119, 146.1, 169, 193, 225, 244, 275, null, 791, 825, 860, 899, 936, 972, 1036, 1073, 1114, 1151, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3857, 3938, 4025, 4116, 4203, 4287, 4489, 4580, 4670, 4760, 5130, 5210, 5300, 5390, 6100, 6200, 6470, 6570, 10170, 10360, 10560, 10780, 10980, 11180, 11750, 11960, 12200, 12410, 13010, 13190, 13400, 13600, 15800, 16e3, 16400, 16700, 33100, 33600, 34100, 34600, 42700, 43400, 44300, null, null, 177148], "Electron affinity": null, "Van der waals radius": "no data" }, Db: { "Atomic mass": 268, "Atomic no": 105, Name: "Dubnium", "Ground level": "4F3/2", "Ionization energies": [6.8, 14, 23.1, 33, 43, 86, 98.9, 126, 145.1, 172, 196, 220.9, 254, 274, 307, null, 838, 872, 908, 948, 985, 1022, 1089, 1126, 1168, 1207, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3975, 4057, 4145, 4237, 4326, 4411, 4620, 4710, 4810, 4900, 5260, 5350, 5450, 5530, 6280, 6380, 6650, 6760, 10420, 10610, 10820, 11040, 11240, 11440, 12040, 12250, 12480, 12700, 13300, 13500, 13700, 13900, 16200, 16400, 16900, 17100, 33800, 34300, 34800, 35300, 43800, 44500, 45400, null, null, 181444], "Electron affinity": null, "Van der waals radius": "no data" }, Sg: { "Atomic mass": 269, "Atomic no": 106, Name: "Seaborgium", "Ground level": "0", "Ionization energies": [7.8, 17.1, 25.8, 35.5, 47.2, 59.3, 109, 122, 152, 170, 200, 224, 251, 285, 306, 339, null, 885, 921, 958, 998, 1036, 1073, 1143, 1181, 1223, 1263, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4095, 4178, 4267, 4360, 4450, 4540, 4750, 4840, 4940, 5030, 5410, 5490, 5590, 5680, 6460, 6570, 6840, 6950, 10680, 10870, 11080, 11300, 11510, 11710, 12320, 12540, 12780, 12990, 13600, 13800, 14e3, 14200, 16600, 16800, 17300, 17500, 34500, 35e3, 35600, 36100, 44900, 45700, 46600, null, null, 185839], "Electron affinity": null, "Van der waals radius": "no data" }, Bh: { "Atomic mass": 270, "Atomic no": 107, Name: "Bohrium", "Ground level": "5/2", "Ionization energies": [7.7, 17.5, 26.7, 37.3, 49, 62.1, 74.9, 134, 148, 178, 198, 228, 255, 281, 318, 337, 374, null, 934, 969, 1008, 1049, 1088, 1126, 1197, 1237, 1280, 1320, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4216, 4301, 4390, 4486, 4580, 4660, 4890, 4980, 5080, 5170, 5550, 5640, 5740, 5830, 6650, 6760, 7040, 7140, 10930, 11130, 11340, 11560, 11780, 11980, 12610, 12830, 13070, 13300, 13900, 14100, 14300, 14500, 17e3, 17300, 17700, 18e3, 35200, 35700, 36300, 36800, 46100, 46900, 47800, null, null, 190331], "Electron affinity": null, "Van der waals radius": "no data" }, Hs: { "Atomic mass": 270, "Atomic no": 108, Name: "Hassium", "Ground level": "4", "Ionization energies": [7.6, 18.2, 29.3, 37.7, 51.2, 64, 78.1, 91.7, 159.9, 173.9, 206.1, 227, 258, 285, 314, 351, 371, 409, null, 984, 1020, 1060, 1101, 1140, 1180, 1253, 1294, 1338, 1379, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4339, 4425, 4516, 4610, 4700, 4790, 5020, 5110, 5220, 5310, 5700, 5780, 5880, 5980, 6840, 6950, 7230, 7340, 11200, 11390, 11610, 11830, 12040, 12250, 12910, 13130, 13400, 13600, 14200, 14400, 14600, 14800, 17500, 17700, 18200, 18400, 35900, 36400, 37e3, 37500, 47300, 48100, 49e3, null, null, 194917], "Electron affinity": null, "Van der waals radius": "no data" }, Mt: { "Atomic mass": 278, "Atomic no": 109, Name: "Meitnerium", "Ground level": null, "Ionization energies": [50, null, null, 94, 109, 187, 202, 235.9, 257, 289, 318, 346, 386, 406, 445, null, 1035, 1072, 1112, 1154, 1195, 1234, 1311, 1352, 1397, 1439, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4464, 4551, 4640, 4740, 4830, 4920, 5160, 5250, 5360, 5450, 5840, 5930, 6030, 6130, 7030, 7150, 7430, 7550, 11460, 11660, 11870, 12100, 12320, 12530, 13200, 13400, 13700, 13900, 14500, 14700, 14900, 15100, 17900, 18200, 18700, 18900, 36700, 37200, 37800, 38300, 48500, 49400, 50300, null, null, 199606], "Electron affinity": null, "Van der waals radius": "no data" }, Ds: { "Atomic mass": 281, "Atomic no": 110, Name: "Darmstadtium", "Ground level": null, "Ionization energies": [65, null, null, 112.9, 128, 216, 231, 266, 288, 322, 352, 380, 422, 442, 483, null, 1087, 1125, 1165, 1208, 1250, 1290, 1369, 1412, 1457, 1500, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4590, 4680, 4770, 4870, 4960, 5060, 5300, 5400, 5500, 5600, 5990, 6080, 6190, 6280, 7230, 7350, 7640, 7750, 11730, 11930, 12140, 12380, 12600, 12810, 13500, 13700, 14e3, 14200, 14800, 15e3, 15300, 15500, 18400, 18600, 19100, 19400, 37400, 37900, 38500, 39100, 49800, 50700, 51600, null, null, 204400], "Electron affinity": null, "Van der waals radius": "no data" }, Rg: { "Atomic mass": 282, "Atomic no": 111, Name: "Roentgenium", "Ground level": null, "Ionization energies": [], "Electron affinity": 1.565, "Van der waals radius": "no data" }, Cn: { "Atomic mass": 285, "Atomic no": 112, Name: "Copernicium", "Ground level": null, "Ionization energies": [], "Electron affinity": null, "Van der waals radius": "no data" }, Nh: { "Atomic mass": 286, "Atomic no": 113, Name: "Nihonium", "Ground level": null, "Ionization energies": [], "Electron affinity": 0.69, "Van der waals radius": "no data" }, Fl: { "Atomic mass": 289, "Atomic no": 114, Name: "Flerovium", "Ground level": null, "Ionization energies": [], "Electron affinity": null, "Van der waals radius": "no data" }, Mc: { "Atomic mass": 290, "Atomic no": 115, Name: "Moscovium", "Ground level": null, "Ionization energies": [], "Electron affinity": 0.366, "Van der waals radius": "no data" }, Lv: { "Atomic mass": 293, "Atomic no": 116, Name: "Livermorium", "Ground level": null, "Ionization energies": [], "Electron affinity": 0.776, "Van der waals radius": "no data" }, Ts: { "Atomic mass": 294, "Atomic no": 117, Name: "Tennessine", "Ground level": null, "Ionization energies": [], "Electron affinity": 1.719, "Van der waals radius": "no data" }, Og: { "Atomic mass": 2949, "Atomic no": 118, Name: "Oganesson", "Ground level": null, "Ionization energies": [], "Electron affinity": 0.0561, "Van der waals radius": "no data" } }).forEach(function(e) {
  var t = e[0], n = e[1];
  BO[n["Atomic no"]] = O(O({}, n), { symbol: t });
}), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "material";
  }, e.create = function(t) {
    return { kind: "material", name: "material", data: t };
  }, e.formatMol = function(t) {
    var n = t.isMaterial, r = t.molecules;
    if (!n || r.length > 1 || !r[0].cell) return t;
    for (var i = r[0], a = i.cell, o = i.x, s = i.y, u = i.z, l = o.rowCount, c = new Float32Array(l), d = new Float32Array(l), f = new Float32Array(l), p = 0; p < l; p++) {
      var g = A.create(o.value(p), s.value(p), u.value(p)), m = A.transformMat4(A.zero(), g, a.invertMatrix);
      c[p] = m[0], d[p] = m[1], f[p] = m[2];
    }
    return { isMaterial: !0, molecules: [O(O({}, r[0]), { fractX: Q.ofFloatArray(c), fractY: Q.ofFloatArray(d), fractZ: Q.ofFloatArray(f) })] };
  };
}(wv || (wv = {}));
var y_, EQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, C8(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, hd(t.result).run()];
        case 2:
          return [2, n.sent().frames.map(function(r) {
            return ze.ofModel(r, { dynamicBonds: !0 });
          })];
      }
    });
  });
} };
function TQ(e) {
  var t = e.position >= e.data.length - 1 ? 0 : +je.readLine(e);
  isNaN(t) && (t = 0);
  for (var n = je.readLine(e), r = new Float64Array(t), i = new Float64Array(t), a = new Float64Array(t), o = new Array(t), s = 0; s < t; ++s) {
    var u = je.readLineTrim(e).split(/\s+/g);
    o[s] = u[0], r[s] = +u[1], i[s] = +u[2], a[s] = +u[3];
  }
  return { count: t, comment: n, x: Q.ofFloatArray(r), y: Q.ofFloatArray(i), z: Q.ofFloatArray(a), type_symbol: Q.ofStringArray(o) };
}
function kQ(e) {
  for (var t = je(e), n = []; ; ) {
    var r = TQ(t);
    if (r.count === 0) break;
    n.push(r);
  }
  var i = { molecules: n, isMaterial: !1 };
  return hi.success(i);
}
function RO(e) {
  var t = this;
  return Xt.create("Parse Mol", function() {
    return se(t, 0, void 0, function() {
      return ie(this, function(n) {
        return [2, kQ(e)];
      });
    });
  });
}
function LO(e) {
  return Xt.create("Parse XYZ", function(t) {
    return function(n, r) {
      for (var i = n.molecules, a = 0, o = 0, s = i; o < s.length; o++) a += (v = s[o]).count;
      for (var u = new Array(a), l = new Int32Array(a), c = new Float32Array(a), d = new Float32Array(a), f = new Float32Array(a), p = new Int32Array(a), g = 0, m = 0; m < i.length; m++) for (var v = i[m], h = 0; h < v.count; h++) u[g] = v.type_symbol.value(h), c[g] = v.x.value(h), d[g] = v.y.value(h), f[g] = v.z.value(h), l[g] = h, p[g] = m, g++;
      var y = Q.ofConst("MOL", a, Q.Schema.str), x = Q.ofConst("A", a, Q.Schema.str), S = Q.ofConst(1, a, Q.Schema.int), b = Q.ofStringArray(u), _ = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: x, auth_atom_id: b, auth_comp_id: y, auth_seq_id: S, Cartn_x: Q.ofFloatArray(c), Cartn_y: Q.ofFloatArray(d), Cartn_z: Q.ofFloatArray(f), id: Q.ofIntArray(l), label_asym_id: x, label_atom_id: b, label_comp_id: y, label_seq_id: S, label_entity_id: Q.ofConst("1", a, Q.Schema.str), occupancy: Q.ofConst(1, a, Q.Schema.float), type_symbol: b, pdbx_PDB_model_num: Q.ofIntArray(p) }, a), C = new Nf();
      C.setNames([["MOL", "Unknown Entity"]]), C.getEntityId("MOL", 0, "A");
      var w = new Lf(S, b);
      return w.setNames([["MOL", "Unknown Molecule"]]), w.add("MOL", 0), Ul(pd({ entity: C.getEntityTable(), chem_comp: w.getChemCompTable(), atom_site: _ }), y_.create(n), r);
    }(e, t);
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "xyz";
  }, e.create = function(t) {
    return { kind: "xyz", name: "xyz", data: t };
  };
})(y_ || (y_ = {}));
var Hp, DQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return e.trim() ? [4, RO(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = r.sent()).isError) throw t;
          return [4, LO(t.result).run()];
        case 2:
          return n = r.sent(), [2, [ze.ofModel(n.representative, { dynamicBonds: !0 })]];
      }
    });
  });
} };
function OQ(e, t, n) {
  var r;
  return se(this, 0, void 0, function() {
    var i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W, J, $, ee, ce, ae, he, Oe, Ne, Ue, Ze;
    return ie(this, function(Se) {
      switch (Se.label) {
        case 0:
          for (i = e.atom_site._rowCount, a = Q.ofConst("MOL", i, Q.Schema.str), o = Q.ofConst("A", i, Q.Schema.str), s = Q.ofConst(1, i, Q.Schema.int), u = function(qe) {
            var Pe = qe.cell, Xe = (de = qe.space_group, we = de.it_number.value(0), Ie = de["name_h-m_full"].value(0).replace("-", " "), de.it_number.isDefined ? (de["name_h-m_full"].isDefined, we) : Ie), Ke = os.create(Xe, A.create(Pe.length_a.value(0), Pe.length_b.value(0), Pe.length_c.value(0)), A.scale(A(), A.create(Pe.angle_alpha.value(0), Pe.angle_beta.value(0), Pe.angle_gamma.value(0)), Math.PI / 180)), de, we, Ie;
            return { spacegroup: za.create(Ke), assemblies: [], isNonStandardCrystalFrame: !1, ncsOperators: [] };
          }(e), l = u.spacegroup.cell.fromFractional, c = e.atom_site, d = c.fract_x, f = c.fract_y, p = c.fract_z, g = new Float32Array(i), m = new Float32Array(i), v = new Float32Array(i), h = A(), he = 0; he < i; ++he) A.set(h, d.value(he), f.value(he), p.value(he)), A.transformMat4(h, h, l), g[he] = h[0], m[he] = h[1], v[he] = h[2];
          if (y = e.atom_site, x = y.type_symbol, S = y.label, x.isDefined) {
            for (M = new Array(i), C = new Int8Array(i), he = 0; he < i; ++he) w = x.value(he), I = w.length, w[I - 1] === "+" ? C[he] = parseInt(w[I - 2]) : w[I - 2] === "+" ? C[he] = parseInt(w[I - 1]) : w[I - 1] === "-" ? C[he] = -parseInt(w[I - 2]) : w[I - 2] === "-" ? C[he] = -parseInt(w[I - 1]) : (M[he] = w, C[he] = 0), w = (w = (w = w.replace(/\-/g, "")).replace(/\+/g, "")).replace(/[0-9]/g, ""), M[he] = w;
            b = Q.ofStringArray(M), _ = Q.ofIntArray(C);
          } else {
            for (M = new Array(i), he = 0; he < i; ++he) M[he] = g8(S.value(he), "");
            b = Q.ofStringArray(M), _ = Q.Undefined(i, Q.Schema.int);
          }
          return E = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: o, auth_atom_id: S, auth_comp_id: a, auth_seq_id: s, Cartn_x: Q.ofFloatArray(g), Cartn_y: Q.ofFloatArray(m), Cartn_z: Q.ofFloatArray(v), id: Q.range(0, i - 1), label_asym_id: o, label_atom_id: S, label_comp_id: a, label_seq_id: s, label_entity_id: Q.ofConst("1", i, Q.Schema.str), occupancy: e.atom_site.occupancy.isDefined ? e.atom_site.occupancy : Q.ofConst(1, i, Q.Schema.float), type_symbol: b, pdbx_formal_charge: _, pdbx_PDB_model_num: Q.ofConst(1, i, Q.Schema.int), B_iso_or_equiv: e.atom_site.u_iso_or_equiv }, i), T = e.chemical.name_common.value(0) || e.chemical.name_systematic.value(0) || e.chemical_formula.sum.value(0), (P = new Nf()).setNames([["MOL", T || "Ligand"]]), P.getEntityId("MOL", 0, "A"), (k = new Lf(s, e.atom_site.type_symbol)).setNames([["MOL", T || "Unknown Molecule"]]), k.add("MOL", 0), [4, Ul(pd({ entity: P.getEntityTable(), chem_comp: k.getChemCompTable(), atom_site: E }), t, n)];
        case 1:
          if ((D = Se.sent()).frameCount > 0 && (B = D.representative, Gi.Provider.set(B, u), (L = e.geom_bond._rowCount) > 0)) {
            for (F = {}, V = e.atom_site.label, he = 0, G = V.rowCount; he < G; ++he) F[V.value(he)] = he;
            for (H = (r = t.data.frame.categories.ccdc_geom_bond_type) === null || r === void 0 ? void 0 : r.getField(""), q = [], z = [], K = [], Y = [], Z = [], X = /* @__PURE__ */ new Set(), W = 0, J = e.geom_bond, $ = J.atom_site_label_1, ee = J.atom_site_label_2, ce = J.valence, ae = J.distance, he = 0; he < L; ++he) Oe = F[$.value(he)], Ne = F[ee.value(he)], Ue = Oe < Ne ? as(Oe, Ne) : as(Ne, Oe), X.has(Ue) || (X.add(Ue), q[W] = Oe, z[W] = Ne, Y[W] = ae.value(he) || -1, H ? (Ze = H.str(he)) === "D" ? (K[W] = 2, Z[W] = 1) : Ze === "A" ? (K[W] = 1, Z[W] = 17) : (K[W] = 1, Z[W] = 1) : (Z[W] = 1, K[W] = ce.isDefined ? ce.value(he) : 1), W += 1);
            fi.Provider.set(B, fi.fromData({ pairs: { indexA: Q.ofIntArray(q), indexB: Q.ofIntArray(z), order: Q.ofIntArray(K), distance: Q.ofFloatArray(Y), flag: Q.ofIntArray(Z) }, count: i }));
          }
          return [2, D];
      }
    });
  });
}
function BQ(e) {
  var t = Hp.fromFrame(e);
  return Xt.create("Parse CIF Core", function(n) {
    return OQ(t.data.db, t, n);
  });
}
ed.Provider.formatRegistry.add("cifCore", function(e) {
  if (Hp.is(e.sourceData)) {
    var t = e.sourceData.data.db, n = t.atom_site, r = t.atom_site_aniso;
    return { data: On.ofPartialColumns(ed.Schema, { U: r.u }, r._rowCount), elementToAnsiotrop: ed.getElementToAnsiotropFromLabel(n.label, r.label) };
  }
}, function(e) {
  return !!Hp.is(e.sourceData) && e.sourceData.data.db.atom_site_aniso.u.isDefined;
}), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "cifCore";
  }, e.fromFrame = function(t, n) {
    return n || (n = Xk.cifCore(t)), { kind: "cifCore", name: n.database_code.depnum_ccdc_archive.value(0) || n.database_code.depnum_ccdc_fiz.value(0) || n.database_code.icsd.value(0) || n.database_code.mdf.value(0) || n.database_code.nbs.value(0) || n.database_code.csd.value(0) || n.database_code.cod.value(0) || n._name, data: { db: n, frame: t } };
  };
}(Hp || (Hp = {}));
var RQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s;
    return ie(this, function(u) {
      switch (u.label) {
        case 0:
          return e.trim() ? [4, Wk(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = u.sent()).isError) throw t;
          n = function(l) {
            return l.startsWith(`data_SERVER
#
_density_server_result`) ? "dscif" : l.startsWith(`data_SERVER
#
data_SEGMENTATION_DATA`) ? "segcif" : l.includes("atom_site_fract_x") || l.includes("atom_site.fract_x") ? "coreCif" : -1;
          }(e) === -1 ? Qk : BQ, r = [], i = 0, a = t.result.blocks.length, u.label = 2;
        case 2:
          return i < a ? (o = t.result.blocks[i], [4, n(o).run()]) : [3, 5];
        case 3:
          s = u.sent(), r.push(ze.ofModel(s.frames[0], { dynamicBonds: !0 })), u.label = 4;
        case 4:
          return i++, [3, 2];
        case 5:
          return [2, r];
      }
    });
  });
} }, xw = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a;
    return ie(this, function(o) {
      switch (o.label) {
        case 0:
          return e.trim() ? [4, Wk(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = o.sent()).isError) throw t;
          n = [], r = 0, i = t.result.blocks.length, o.label = 2;
        case 2:
          return r < i ? [4, Qk(t.result.blocks[r]).run()] : [3, 5];
        case 3:
          a = o.sent(), n.push(ze.ofModel(a.frames[0], { dynamicBonds: !0 })), o.label = 4;
        case 4:
          return r++, [3, 2];
        case 5:
          return [2, n];
      }
    });
  });
} };
function LQ(e) {
  var t = [], n = function(i) {
    var a = je.readLine(i), o = +je.readLine(i), s = new Float64Array(3), u = new Float64Array(3), l = new Float64Array(3);
    [s, u, l].forEach(function(D) {
      var B = je.readLineTrim(i).trim().split(/\s+/g);
      D[0] = +B[0], D[1] = +B[1], D[2] = +B[2];
    });
    for (var c = OO(s, u, l), d = je.readLineTrim(i).trim().split(/\s+/g), f = je.readLineTrim(i).trim().split(/\s+/g), p = je.readLineTrim(i), g = ["cartesian", "direct"].includes(p.toLowerCase()) ? "cartesian" : p, m = f.reduce(function(D, B) {
      return +D + +B;
    }, 0), v = new Float64Array(m), h = new Float64Array(m), y = new Float64Array(m), x = new Float64Array(m), S = new Float64Array(m), b = new Float64Array(m), _ = new Float64Array(m), C = new Float64Array(m), w = new Float64Array(m), I = new Array(m), M = function(D) {
      for (var B = D === 0 ? 0 : f.slice(0, D).reduce(function(G, H) {
        return +G + +H;
      }, 0), L = 0; L < Number(f[D]); L++) {
        var F = B + L, V = je.readLineTrim(i).trim().split(/\s+/g);
        I[F] = d[D], _[F] = +V[0], C[F] = +V[1], w[F] = +V[2];
      }
    }, E = 0; E < f.length; E++) M(E);
    if (g === "cartesian") for (E = 0; E < m; E++) {
      v[E] = _[E], h[E] = C[E], y[E] = w[E];
      var T = A.create(v[E], h[E], y[E]), P = A.transformMat4(A.zero(), T, c.invertMatrix);
      x[E] = P[0], S[E] = P[1], b[E] = P[2];
    }
    else for (E = 0; E < m; E++) {
      x[E] = _[E], S[E] = C[E], b[E] = w[E];
      var k = A.create(v[E], h[E], y[E]);
      P = A.transformMat4(A.zero(), k, c.matrix), v[E] = P[0], h[E] = P[1], y[E] = P[2];
    }
    return { count: m, comment: a, scalingFactor: o, dynamics: g, type_symbol: Q.ofStringArray(I), x: Q.ofFloatArray(v), y: Q.ofFloatArray(h), z: Q.ofFloatArray(y), fractX: Q.ofFloatArray(v), fractY: Q.ofFloatArray(h), fractZ: Q.ofFloatArray(y), cell: c };
  }(je(e));
  t.push(n);
  var r = { isMaterial: !0, molecules: t };
  return hi.success(r);
}
function NQ(e) {
  var t = this;
  return Xt.create("Parse Mol", function() {
    return se(t, 0, void 0, function() {
      return ie(this, function(n) {
        return [2, LQ(e)];
      });
    });
  });
}
var FQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return e.trim() ? [4, NQ(e).run()] : [2, [Fu()]];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, hd(t.result).run()];
        case 2:
          return [2, n.sent().frames.map(function(r) {
            return ze.ofModel(r, { dynamicBonds: !0 });
          })];
      }
    });
  });
} };
function VQ(e) {
  var t = [], n = function(r, i, a) {
    for (var o = function() {
      if (a) return DO(a.a, a.b, a.c, a.alpha, a.beta, a.gamma);
    }(), s = r.length, u = new Float64Array(s), l = new Float64Array(s), c = new Float64Array(s), d = new Array(s), f = 0; f < s; f++) d[f] = r[f], u[f] = i[f][0], l[f] = i[f][1], c[f] = i[f][2];
    return { count: s, comment: "", type_symbol: Q.ofStringArray(d), x: Q.ofFloatArray(u), y: Q.ofFloatArray(l), z: Q.ofFloatArray(c), cell: o };
  }(e.elements, e.xyzs, e.lattice);
  return t.push(n), { isMaterial: !0, molecules: t };
}
function NO(e) {
  return VQ(e);
}
var GQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    return ie(this, function(t) {
      switch (t.label) {
        case 0:
          return [4, hd(NO(e)).run()];
        case 1:
          return [2, t.sent().frames.map(function(n) {
            return ze.ofModel(n, { dynamicBonds: !0 });
          })];
      }
    });
  });
} }, qp = function(e, t, n, r) {
  this.name = e, this.visible = t, this.origin = n, this.contents = r;
};
(function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  Zi(t, e);
})(qp), function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  Zi(t, e);
}(qp), function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  Zi(t, e);
}(qp), function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  Zi(t, e);
}(qp);
var zQ = function(e) {
  function t() {
    return e !== null && e.apply(this, arguments) || this;
  }
  return Zi(t, e), t.create = function(n) {
    var r = n.name, i = n.visible, a = n.origin, o = n.contents, s = {};
    return o.forEach(function(u) {
      Reflect.defineProperty(s, u.name, { value: u });
    }), new t(r, i, a, s);
  }, t;
}(qp);
function UQ(e) {
  var t = e.scene, n = e.structure, r = zQ.create(t).contents, i = r.atoms, a = r.bonds, o = i.contents.length, s = new Float64Array(o), u = new Float64Array(o), l = new Float64Array(o), c = new Array(o), d = function() {
    if (n.lattice) {
      var h = n.lattice;
      return DO(h.a, h.b, h.c, h.alpha, h.beta, h.gamma);
    }
  }(), f = {};
  a.contents.forEach(function(h) {
    h.positionPairs.forEach(function(y) {
      var x = y[1].join(",");
      f[x] = f[x] || [], f[x].push(y[0]);
    });
  });
  var p = {};
  i.contents.forEach(function(h, y) {
    var x, S = h.positions, b = h.tooltip, _ = S[0];
    for (var C in s[y] = _[0], u[y] = _[1], l[y] = _[2], c[y] = ((x = b.split(/\s/)[0].match(/[A-Za-z]/g)) === null || x === void 0 ? void 0 : x.join("")) || "", f) {
      var w = f[C];
      p[C] = p[C] || [], w[0].every(function(I, M) {
        return I === _[M];
      }) && (p[C][0] = y), w[1].every(function(I, M) {
        return I === _[M];
      }) && (p[C][1] = y);
    }
  });
  var g = [], m = [];
  Object.values(p).forEach(function(h) {
    g.push(h[0]), m.push(h[1]);
  });
  var v = { count: 2 * g.length, atomA: Re(Re([], g, !0), m, !0), atomB: Re(Re([], m, !0), g, !0) };
  return { comment: "", count: o, x: Q.ofFloatArray(s), y: Q.ofFloatArray(u), z: Q.ofFloatArray(l), type_symbol: Q.ofStringArray(c), cell: d, bonds: v };
}
function HQ(e) {
  var t = { molecules: e.map(UQ), isMaterial: !0 };
  return hi.success(t);
}
function FO(e) {
  var t = this;
  return Xt.create("Parse Mol", function() {
    return se(t, 0, void 0, function() {
      return ie(this, function(n) {
        return [2, HQ(e)];
      });
    });
  });
}
var qQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, FO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw new Error(t.message);
          return [4, hd(t.result).run()];
        case 2:
          return [2, n.sent().frames.map(function(r) {
            return ze.ofModel(r, { dynamicBonds: !0 });
          })];
      }
    });
  });
} }, S8 = je.skipWhitespace, VO = je.eatValue, Ho = je.markLine, qo = je.getTokenString, GO = je.readLine, b_, Cw = /\s+/g;
function jQ(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _;
    return ie(this, function(C) {
      switch (C.label) {
        case 0:
          for (t = e.tokenizer, n = e.molecule; qo(t) !== "@<TRIPOS>ATOM" && t.position < t.data.length; ) Ho(t);
          return r = t.position, i = t.lineNumber, a = GO(t), o = a.trim().split(/\s+/g), s = o.length, u = We.create(t.data, 2 * n.num_atoms), l = We.create(t.data, 2 * n.num_atoms), c = We.create(t.data, 2 * n.num_atoms), d = We.create(t.data, 2 * n.num_atoms), f = We.create(t.data, 2 * n.num_atoms), p = We.create(t.data, 2 * n.num_atoms), g = We.create(t.data, 2 * n.num_atoms), m = We.create(t.data, 2 * n.num_atoms), v = We.create(t.data, 2 * n.num_atoms), h = We.create(t.data, 2 * n.num_atoms), y = Q.Undefined(n.num_atoms, Q.Schema.float), x = Q.Undefined(n.num_atoms, Q.Schema.int), S = Q.Undefined(n.num_atoms, Q.Schema.str), t.position = r, t.lineNumber = i, b = t.length, _ = 0, [4, C0(e.runtimeCtx, 1e5, void 0, function(w) {
            for (var I = Math.min(n.num_atoms - _, w), M = 0; M < I; M++) for (var E = 0; E < s; E++) switch (S8(t), t.tokenStart = t.position, VO(t), E) {
              case 0:
                We.addUnchecked(u, t.tokenStart, t.tokenEnd);
                break;
              case 1:
                We.addUnchecked(l, t.tokenStart, t.tokenEnd);
                break;
              case 2:
                We.addUnchecked(c, t.tokenStart, t.tokenEnd);
                break;
              case 3:
                We.addUnchecked(d, t.tokenStart, t.tokenEnd);
                break;
              case 4:
                We.addUnchecked(f, t.tokenStart, t.tokenEnd);
                break;
              case 5:
                We.addUnchecked(p, t.tokenStart, t.tokenEnd);
                break;
              case 6:
                We.addUnchecked(g, t.tokenStart, t.tokenEnd);
                break;
              case 7:
                We.addUnchecked(m, t.tokenStart, t.tokenEnd);
                break;
              case 8:
                We.addUnchecked(v, t.tokenStart, t.tokenEnd);
                break;
              case 9:
                We.addUnchecked(h, t.tokenStart, t.tokenEnd);
            }
            return _ += I, I;
          }, function(w) {
            return w.update({ message: "Parsing...", current: t.position, max: b });
          })];
        case 1:
          return C.sent(), [2, { count: n.num_atoms, atom_id: Fn(u)(Q.Schema.int), atom_name: Fn(l)(Q.Schema.str), x: Fn(c)(Q.Schema.float), y: Fn(d)(Q.Schema.float), z: Fn(f)(Q.Schema.float), atom_type: s > 5 ? Fn(p)(Q.Schema.str) : S, subst_id: s > 6 ? Fn(g)(Q.Schema.int) : x, subst_name: s > 7 ? Fn(m)(Q.Schema.str) : S, charge: s > 8 ? Fn(v)(Q.Schema.float) : y, status_bit: s > 9 ? Fn(h)(Q.Schema.str) : S }];
      }
    });
  });
}
function KQ(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o, s, u, l, c, d, f, p, g;
    return ie(this, function(m) {
      switch (m.label) {
        case 0:
          for (t = e.tokenizer, n = e.molecule; qo(t) !== "@<TRIPOS>BOND" && t.position < t.data.length; ) Ho(t);
          return r = t.position, i = t.lineNumber, a = GO(t), o = a.trim().split(/\s+/g), s = o.length, u = We.create(t.data, 2 * n.num_bonds), l = We.create(t.data, 2 * n.num_bonds), c = We.create(t.data, 2 * n.num_bonds), d = We.create(t.data, 2 * n.num_bonds), f = We.create(t.data, 2 * n.num_bonds), t.position = r, t.lineNumber = i, p = t.length, g = 0, [4, C0(e.runtimeCtx, 1e5, void 0, function(v) {
            for (var h = Math.min(n.num_bonds - g, v), y = 0; y < h; y++) for (var x = 0; x < s; x++) switch (S8(t), t.tokenStart = t.position, VO(t), x) {
              case 0:
                We.addUnchecked(u, t.tokenStart, t.tokenEnd);
                break;
              case 1:
                We.addUnchecked(l, t.tokenStart, t.tokenEnd);
                break;
              case 2:
                We.addUnchecked(c, t.tokenStart, t.tokenEnd);
                break;
              case 3:
                We.addUnchecked(d, t.tokenStart, t.tokenEnd);
                break;
              default:
                We.addUnchecked(f, t.tokenStart, t.tokenEnd);
            }
            return g += h, h;
          }, function(v) {
            return v.update({ message: "Parsing...", current: t.position, max: p });
          })];
        case 1:
          return m.sent(), [2, { count: n.num_bonds, bond_id: Fn(u)(Q.Schema.int), origin_atom_id: Fn(l)(Q.Schema.int), target_atom_id: Fn(c)(Q.Schema.int), bond_type: Fn(d)(Q.Schema.str), status_bits: s > 4 ? Fn(f)(Q.Schema.str) : Q.Undefined(n.num_bonds, Q.Schema.str) }];
      }
    });
  });
}
function YQ(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l;
    return ie(this, function(c) {
      switch (c.label) {
        case 0:
          r = je(t), e.update({ message: "Parsing...", current: 0, max: t.length }), i = [], c.label = 1;
        case 1:
          return r.position < t.length ? (a = /* @__PURE__ */ function(d, f) {
            return { tokenizer: d, molecule: { mol_name: "", num_atoms: 0, num_bonds: 0, num_subst: 0, num_feat: 0, num_sets: 0, mol_type: "", charge_type: "", status_bits: "", mol_comment: "" }, runtimeCtx: f };
          }(r, e), function(d) {
            for (var f = d.tokenizer, p = d.molecule; qo(f) !== "@<TRIPOS>MOLECULE" && f.position < f.data.length; ) Ho(f);
            Ho(f), p.mol_name = qo(f), Ho(f);
            var g = qo(f).trim().split(Cw);
            p.num_atoms = parseInt(g[0]), p.num_bonds = parseInt(g[1]), p.num_subst = parseInt(g[2]), p.num_feat = parseInt(g[3]), p.num_sets = parseInt(g[4]), Ho(f);
            var m = qo(f);
            if (!m.startsWith("@<TRIPOS>")) {
              p.mol_type = m, Ho(f);
              var v = qo(f);
              if (!v.startsWith("@<TRIPOS>")) {
                p.charge_type = v, Ho(f);
                var h = qo(f);
                if (!h.startsWith("@<TRIPOS>")) {
                  p.status_bits = h, Ho(f);
                  var y = qo(f);
                  y.startsWith("@<TRIPOS>") || (p.mol_comment = y);
                }
              }
            }
          }(a), [4, jQ(a)]) : [3, 4];
        case 2:
          return o = c.sent(), [4, KQ(a)];
        case 3:
          for (s = c.sent(), u = function(d) {
            for (var f = d.tokenizer; f.position < f.data.length; ) {
              var p = qo(f);
              if (p === "@<TRIPOS>MOLECULE") return;
              if (p === "@<TRIPOS>CRYSIN") break;
              Ho(f);
            }
            if (!(f.position >= f.data.length)) {
              Ho(f);
              var g = qo(f).trim().split(Cw);
              return { a: parseFloat(g[0]), b: parseFloat(g[1]), c: parseFloat(g[2]), alpha: parseFloat(g[3]), beta: parseFloat(g[4]), gamma: parseFloat(g[5]), spaceGroup: parseInt(g[6], 10), setting: parseInt(g[7], 10) };
            }
          }(a), i.push({ molecule: a.molecule, atoms: o, bonds: s, crysin: u }), S8(r); qo(r) !== "@<TRIPOS>MOLECULE" && r.position < r.data.length; ) Ho(r);
          return [3, 1];
        case 4:
          return l = { name: n, structures: i }, [2, hi.success(l)];
      }
    });
  });
}
function WQ(e, t) {
  var n = this;
  return Xt.create("Parse MOL2", function(r) {
    return se(n, 0, void 0, function() {
      return ie(this, function(i) {
        switch (i.label) {
          case 0:
            return [4, YQ(r, e, t)];
          case 1:
            return [2, i.sent()];
        }
      });
    });
  });
}
function XQ(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T;
    return ie(this, function(P) {
      switch (P.label) {
        case 0:
          n = [], r = 0, i = e.structures.length, P.label = 1;
        case 1:
          if (!(r < i)) return [3, 4];
          for (a = e.structures[r], o = a.molecule, s = a.atoms, u = a.bonds, l = a.crysin, c = Q.ofConst("A", s.count, Q.Schema.str), d = new Array(s.count), f = !1, p = 0; p < s.count; ++p) if (s.atom_type.value(p).includes(".")) {
            f = !0;
            break;
          }
          for (g = 0; g < s.count; ++g) d[g] = f ? s.atom_type.value(g).split(".")[0].toUpperCase() : g8(s.atom_name.value(g), s.subst_name.value(g));
          for (m = On.ofPartialColumns(Ka.atom_site, { auth_asym_id: c, auth_atom_id: Q.asArrayColumn(s.atom_name), auth_comp_id: s.subst_name, auth_seq_id: s.subst_id, Cartn_x: Q.asArrayColumn(s.x, Float32Array), Cartn_y: Q.asArrayColumn(s.y, Float32Array), Cartn_z: Q.asArrayColumn(s.z, Float32Array), id: Q.asArrayColumn(s.atom_id), label_asym_id: c, label_atom_id: Q.asArrayColumn(s.atom_name), label_comp_id: s.subst_name, label_seq_id: s.subst_id, label_entity_id: Q.ofConst("1", s.count, Q.Schema.str), occupancy: Q.ofConst(1, s.count, Q.Schema.float), type_symbol: Q.ofStringArray(d), pdbx_PDB_model_num: Q.ofConst(r, s.count, Q.Schema.int) }, s.count), (v = new Nf()).setNames([["MOL", o.mol_name || "Ligand"]]), v.getEntityId("MOL", 0, "A"), h = new Lf(s.subst_id, s.atom_name), y = 0, x = s.subst_name.rowCount; y < x; ++y) h.add(s.subst_name.value(y), y);
          return [4, Ul(pd({ entity: v.getEntityTable(), chem_comp: h.getChemCompTable(), atom_site: m }), b_.create(e), t)];
        case 2:
          (S = P.sent()).frameCount > 0 && (b = Q.ofIntArray(Q.mapToArray(u.origin_atom_id, function(k) {
            return k - 1;
          }, Int32Array)), _ = Q.ofIntArray(Q.mapToArray(u.target_atom_id, function(k) {
            return k - 1;
          }, Int32Array)), C = u.bond_id, w = Q.ofIntArray(Q.mapToArray(u.bond_type, function(k) {
            switch (k) {
              case "ar":
              case "am":
              case "un":
                return 1;
              case "du":
              case "nc":
                return 0;
              default:
                return parseInt(k);
            }
          }, Int8Array)), I = Q.ofIntArray(Q.mapToArray(u.bond_type, function(k) {
            switch (k) {
              case "ar":
              case "am":
                return 17;
              case "du":
              case "nc":
                return 0;
              default:
                return 1;
            }
          }, Int8Array)), M = fi.fromData({ pairs: { key: C, indexA: b, indexB: _, order: w, flag: I }, count: s.count }), E = S.representative, fi.Provider.set(E, M), Rl.Provider.set(E, { data: s.charge, type: o.charge_type }), l && (T = function(k) {
            if (k.setting === 1) {
              var D = os.create(k.spaceGroup, A.create(k.a, k.b, k.c), A.scale(A(), A.create(k.alpha, k.beta, k.gamma), Math.PI / 180));
              return { spacegroup: za.create(D), assemblies: [], isNonStandardCrystalFrame: !1, ncsOperators: [] };
            }
          }(l), T && Gi.Provider.set(E, T)), n.push(E)), P.label = 3;
        case 3:
          return ++r, [3, 1];
        case 4:
          return [2, new M0(n)];
      }
    });
  });
}
(function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "mol2";
  }, e.create = function(t) {
    return { kind: "mol2", name: t.name, data: t };
  };
})(b_ || (b_ = {}));
var ba, ZQ = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t, n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return e.trim() ? [4, WQ(e, "").run()] : [2, [Fu()]];
        case 1:
          if ((t = r.sent()).isError) throw t;
          return [4, (i = t.result, Xt.create("Parse MOL2", function(a) {
            return XQ(i, a);
          })).run()];
        case 2:
          return n = r.sent(), [2, [ze.ofModel(n.representative, { dynamicBonds: !0 })]];
      }
      var i;
    });
  });
} }, Nl = ((ba = {})[pn.Pdb] = JZ, ba[pn.Mol] = rQ, ba[pn.Sdf] = hQ, ba[pn.Gro] = _Q, ba[pn.Xtc] = wQ, ba[pn.Dump] = EQ, ba[pn.Xyz] = DQ, ba[pn.Cif] = RQ, ba[pn.MMCif] = xw, ba[pn.MCif] = xw, ba[pn.POSCAR] = FQ, ba[pn.Material] = GQ, ba[pn.Pymatgen] = qQ, ba[pn.Mol2] = ZQ, ba), kt = dv.Const, bt = dv.Dynamic, QQ = [kt(te.core.type.bool, function(e, t) {
  return !!t[0](e);
}), kt(te.core.type.num, function(e, t) {
  return +t[0](e);
}), kt(te.core.type.str, function(e, t) {
  return "" + t[0](e);
}), kt(te.core.type.list, function(e, t) {
  return a0.forEachEval(t, e, function(n, r, i) {
    return i[r] = n;
  }, []);
}), kt(te.core.type.set, function(e, t) {
  return a0.forEachEval(t, e, function(n, r, i) {
    return i.add(n);
  }, /* @__PURE__ */ new Set());
}), kt(te.core.type.regex, function(e, t) {
  return new RegExp(t[0](e), t[1] && t[1](e) || "");
}), kt(te.core.type.bitflags, function(e, t) {
  return +t[0](e);
}), kt(te.core.type.compositeKey, function(e, t) {
  return a0.forEachEval(t, e, function(n, r, i) {
    return i[r] = "" + n;
  }, []).join("-");
}), kt(te.core.logic.not, function(e, t) {
  return !t[0](e);
}), kt(te.core.logic.and, function(e, t) {
  if (typeof t.length == "number") {
    for (var n = 0, r = t.length; n < r; n++) if (!t[n](e)) return !1;
  } else for (var i = 0, a = Object.keys(t); i < a.length; i++)
    if (!t[a[i]](e)) return !1;
  return !0;
}), kt(te.core.logic.or, function(e, t) {
  if (typeof t.length == "number") {
    for (var n = 0, r = t.length; n < r; n++) if (t[n](e)) return !0;
  } else for (var i = 0, a = Object.keys(t); i < a.length; i++)
    if (t[a[i]](e)) return !0;
  return !1;
}), kt(te.core.rel.eq, function(e, t) {
  return t[0](e) === t[1](e);
}), kt(te.core.rel.neq, function(e, t) {
  return t[0](e) !== t[1](e);
}), kt(te.core.rel.lt, function(e, t) {
  return t[0](e) < t[1](e);
}), kt(te.core.rel.lte, function(e, t) {
  return t[0](e) <= t[1](e);
}), kt(te.core.rel.gr, function(e, t) {
  return t[0](e) > t[1](e);
}), kt(te.core.rel.gre, function(e, t) {
  return t[0](e) >= t[1](e);
}), kt(te.core.rel.inRange, function(e, t) {
  var n = t[0](e);
  return n >= t[1](e) && n <= t[2](e);
}), kt(te.core.math.add, function(e, t) {
  var n = 0;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n += t[r](e);
  else for (var a = 0, o = Object.keys(t); a < o.length; a++)
    n += t[o[a]](e);
  return n;
}), kt(te.core.math.sub, function(e, t) {
  var n = 0;
  if (typeof t.length == "number") {
    if (t.length === 1) return -t[0](e);
    n = t[0](e) || 0;
    for (var r = 1, i = t.length; r < i; r++) n -= t[r](e);
  } else {
    var a = Object.keys(t);
    if (a.length === 1) return -t[a[0]](e);
    for (n = t[a[0]](e) || 0, r = 1, i = a.length; r < i; r++) n -= t[a[r]](e);
  }
  return n;
}), kt(te.core.math.mult, function(e, t) {
  var n = 1;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n *= t[r](e);
  else for (var a = 0, o = Object.keys(t); a < o.length; a++)
    n *= t[o[a]](e);
  return n;
}), kt(te.core.math.div, function(e, t) {
  return t[0](e) / t[1](e);
}), kt(te.core.math.pow, function(e, t) {
  return Math.pow(t[0](e), t[1](e));
}), kt(te.core.math.mod, function(e, t) {
  return t[0](e) % t[1](e);
}), kt(te.core.math.min, function(e, t) {
  var n = Number.POSITIVE_INFINITY;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n = Math.min(t[r](e), n);
  else for (var a = 0, o = Object.keys(t); a < o.length; a++) {
    var s = o[a];
    n = Math.min(t[s](e), n);
  }
  return n;
}), kt(te.core.math.max, function(e, t) {
  var n = Number.NEGATIVE_INFINITY;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n = Math.max(t[r](e), n);
  else for (var a = 0, o = Object.keys(t); a < o.length; a++) {
    var s = o[a];
    n = Math.max(t[s](e), n);
  }
  return n;
}), kt(te.core.math.floor, function(e, t) {
  return Math.floor(t[0](e));
}), kt(te.core.math.ceil, function(e, t) {
  return Math.ceil(t[0](e));
}), kt(te.core.math.roundInt, function(e, t) {
  return Math.round(t[0](e));
}), kt(te.core.math.abs, function(e, t) {
  return Math.abs(t[0](e));
}), kt(te.core.math.sqrt, function(e, t) {
  return Math.sqrt(t[0](e));
}), kt(te.core.math.cbrt, function(e, t) {
  return Math.cbrt(t[0](e));
}), kt(te.core.math.sin, function(e, t) {
  return Math.sin(t[0](e));
}), kt(te.core.math.cos, function(e, t) {
  return Math.cos(t[0](e));
}), kt(te.core.math.tan, function(e, t) {
  return Math.tan(t[0](e));
}), kt(te.core.math.asin, function(e, t) {
  return Math.asin(t[0](e));
}), kt(te.core.math.acos, function(e, t) {
  return Math.acos(t[0](e));
}), kt(te.core.math.atan, function(e, t) {
  return Math.atan(t[0](e));
}), kt(te.core.math.sinh, function(e, t) {
  return Math.sinh(t[0](e));
}), kt(te.core.math.cosh, function(e, t) {
  return Math.cosh(t[0](e));
}), kt(te.core.math.tanh, function(e, t) {
  return Math.tanh(t[0](e));
}), kt(te.core.math.exp, function(e, t) {
  return Math.exp(t[0](e));
}), kt(te.core.math.log, function(e, t) {
  return Math.log(t[0](e));
}), kt(te.core.math.log10, function(e, t) {
  return Math.log10(t[0](e));
}), kt(te.core.math.atan2, function(e, t) {
  return Math.atan2(t[0](e), t[1](e));
}), kt(te.core.str.match, function(e, t) {
  return t[0](e).test(t[1](e));
}), kt(te.core.str.concat, function(e, t) {
  var n = [];
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n.push(t[r](e).toString());
  else for (var a = 0, o = Object.keys(t); a < o.length; a++) {
    var s = o[a];
    n.push(t[s](e).toString());
  }
  return n.join("");
}), kt(te.core.list.getAt, function(e, t) {
  return t[0](e)[t[1](e)];
}), kt(te.core.list.equal, function(e, t) {
  return function(n, r) {
    if (!n || n.length === 0) return !r || r.length === 0;
    if (!r) return !1;
    var i = n.length;
    if (i !== r.length) return !1;
    for (var a = 0; a < i; a++) if (n[a] !== r[a]) return !1;
    return !0;
  }(t[0](e), t[1](e));
}), kt(te.core.set.has, function(e, t) {
  return t[0](e).has(t[1](e));
}), kt(te.core.set.isSubset, function(e, t) {
  return ka.isSuperset(t[1](e), t[0](e));
}), kt(te.core.flags.hasAny, function(e, t) {
  var n = t[1](e), r = t[0](e);
  return n ? !!(r & n) : !!r;
}), kt(te.core.flags.hasAll, function(e, t) {
  var n = t[1](e), r = t[0](e);
  return n ? (r & n) === n : !r;
}), kt(te.structureQuery.type.elementSymbol, function(e, t) {
  return Q1(t[0](e));
}), kt(te.structureQuery.type.atomName, function(e, t) {
  return (n = t[0](e)) ? typeof n == "string" ? n.toUpperCase() : "".concat(n).toUpperCase() : "";
  var n;
}), kt(te.structureQuery.type.bondFlags, function(e, t) {
  var n = 0;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n = Sw(n, t[r](e));
  else for (var a = 0, o = Object.keys(t); a < o.length; a++)
    n = Sw(n, t[o[a]](e));
  return n;
}), kt(te.structureQuery.type.ringFingerprint, function(e, t) {
  return is.elementFingerprint(function(n, r) {
    var i = [];
    if (!r) return i;
    if (typeof r.length == "number") for (var a = 0, o = r.length; a < o; a++) i.push(r[a](n));
    else {
      var s = Object.keys(r);
      for (a = 1, o = s.length; a < o; a++) i.push(r[s[a]](n));
    }
    return i;
  }(e, t));
}), kt(te.structureQuery.type.secondaryStructureFlags, function(e, t) {
  var n = 0;
  if (typeof t.length == "number") for (var r = 0, i = t.length; r < i; r++) n = Aw(n, t[r](e));
  else for (var a = 0, o = Object.keys(t); a < o.length; a++)
    n = Aw(n, t[o[a]](e));
  return n;
}), bt(te.structureQuery.filter.pick, function(e, t) {
  return fr.filters.pick(t[0], t.test)(e);
}), bt(te.structureQuery.filter.first, function(e, t) {
  return fr.filters.first(t[0])(e);
}), bt(te.structureQuery.filter.withSameAtomProperties, function(e, t) {
  return fr.filters.withSameAtomProperties(t[0], t.source, t.property)(e);
}), bt(te.structureQuery.filter.intersectedBy, function(e, t) {
  return fr.filters.areIntersectedBy(t[0], t.by)(e);
}), bt(te.structureQuery.filter.within, function(e, t) {
  return fr.filters.within({ query: t[0], target: t.target, minRadius: t["min-radius"], maxRadius: t["max-radius"], elementRadius: t["atom-radius"], invert: t.invert })(e);
}), bt(te.structureQuery.filter.isConnectedTo, function(e, t) {
  return fr.filters.isConnectedTo({ query: t[0], target: t.target, disjunct: t.disjunct, invert: t.invert, bondTest: t["bond-test"] })(e);
}), bt(te.structureQuery.generator.atomGroups, function(e, t) {
  return fr.generators.atoms({ entityTest: t["entity-test"], chainTest: t["chain-test"], residueTest: t["residue-test"], atomTest: t["atom-test"], groupBy: t["group-by"] })(e);
}), bt(te.structureQuery.generator.all, function(e) {
  return fr.generators.all(e);
}), bt(te.structureQuery.generator.empty, function(e) {
  return fr.generators.none(e);
}), bt(te.structureQuery.generator.bondedAtomicPairs, function(e, t) {
  return fr.generators.bondedAtomicPairs(t && t[0])(e);
}), bt(te.structureQuery.generator.rings, function(e, t) {
  var n, r;
  return fr.generators.rings((n = t == null ? void 0 : t.fingerprint) === null || n === void 0 ? void 0 : n.call(t, e), (r = t == null ? void 0 : t["only-aromatic"]) === null || r === void 0 ? void 0 : r.call(t, e))(e);
}), bt(te.structureQuery.modifier.includeSurroundings, function(e, t) {
  return fr.modifiers.includeSurroundings(t[0], { radius: t.radius(e), wholeResidues: !(!t["as-whole-residues"] || !t["as-whole-residues"](e)), elementRadius: t["atom-radius"] })(e);
}), bt(te.structureQuery.modifier.surroundingLigands, function(e, t) {
  return fr.modifiers.surroundingLigands({ query: t[0], radius: t.radius(e), includeWater: !(!t["include-water"] || !t["include-water"](e)) })(e);
}), bt(te.structureQuery.modifier.wholeResidues, function(e, t) {
  return fr.modifiers.wholeResidues(t[0])(e);
}), bt(te.structureQuery.modifier.union, function(e, t) {
  return fr.modifiers.union(t[0])(e);
}), bt(te.structureQuery.modifier.expandProperty, function(e, t) {
  return fr.modifiers.expandProperty(t[0], t.property)(e);
}), bt(te.structureQuery.modifier.exceptBy, function(e, t) {
  return fr.modifiers.exceptBy(t[0], t.by)(e);
}), bt(te.structureQuery.modifier.intersectBy, function(e, t) {
  return fr.modifiers.intersectBy(t[0], t.by)(e);
}), bt(te.structureQuery.modifier.includeConnected, function(e, t) {
  var n, r;
  return fr.modifiers.includeConnected({ query: t[0], bondTest: t["bond-test"], wholeResidues: !(!t["as-whole-residues"] || !t["as-whole-residues"](e)), layerCount: t["layer-count"] && t["layer-count"](e) || 1, fixedPoint: (r = (n = t["fixed-point"]) === null || n === void 0 ? void 0 : n.call(t, e)) !== null && r !== void 0 && r })(e);
}), bt(te.structureQuery.combinator.merge, function(e, t) {
  return fr.combinators.merge(t)(e);
}), bt(te.structureQuery.atomProperty.core.elementSymbol, Wn(Fe.atom.type_symbol)), bt(te.structureQuery.atomProperty.core.vdw, function(e, t) {
  return f3(Fe.atom.type_symbol(t && t[0] && t[0](e) || e.element));
}), bt(te.structureQuery.atomProperty.core.mass, function(e, t) {
  return function(n) {
    var r = em[n];
    return r === void 0 ? 10.81 : Vq[r];
  }(Fe.atom.type_symbol(t && t[0] && t[0](e) || e.element));
}), bt(te.structureQuery.atomProperty.core.atomicNumber, function(e, t) {
  return P0(Fe.atom.type_symbol(t && t[0] && t[0](e) || e.element));
}), bt(te.structureQuery.atomProperty.core.x, Wn(Fe.atom.x)), bt(te.structureQuery.atomProperty.core.y, Wn(Fe.atom.y)), bt(te.structureQuery.atomProperty.core.z, Wn(Fe.atom.z)), bt(te.structureQuery.atomProperty.core.sourceIndex, Wn(Fe.atom.sourceIndex)), bt(te.structureQuery.atomProperty.core.operatorName, Wn(Fe.unit.operator_name)), bt(te.structureQuery.atomProperty.core.modelIndex, Wn(Fe.unit.model_index)), bt(te.structureQuery.atomProperty.core.modelLabel, Wn(Fe.unit.model_label)), bt(te.structureQuery.atomProperty.core.atomKey, function(e, t) {
  var n = t && t[0] && t[0](e) || e.element;
  return as(n.unit.id, n.element);
}), bt(te.structureQuery.atomProperty.macromolecular.residueKey, function(e, t) {
  return n = t && t[0] && t[0](e) || e.element, ve.isAtomic(n.unit) ? n.unit.residueIndex[n.element] : -1;
  var n;
}), bt(te.structureQuery.atomProperty.macromolecular.chainKey, function(e, t) {
  return n = t && t[0] && t[0](e) || e.element, ve.isAtomic(n.unit) ? n.unit.chainIndex[n.element] : -1;
  var n;
}), bt(te.structureQuery.atomProperty.macromolecular.entityKey, function(e, t) {
  return function(n) {
    return Fe.entity.key(n);
  }(t && t[0] && t[0](e) || e.element);
}), bt(te.structureQuery.atomProperty.macromolecular.id, Wn(Fe.atom.id)), bt(te.structureQuery.atomProperty.macromolecular.isHet, function(e, t) {
  return Fe.residue.group_PDB(t && t[0] && t[0](e) || e.element) !== "ATOM";
}), bt(te.structureQuery.atomProperty.macromolecular.label_atom_id, Wn(Fe.atom.label_atom_id)), bt(te.structureQuery.atomProperty.macromolecular.label_alt_id, Wn(Fe.atom.label_alt_id)), bt(te.structureQuery.atomProperty.macromolecular.label_comp_id, Wn(Fe.atom.label_comp_id)), bt(te.structureQuery.atomProperty.macromolecular.label_seq_id, Wn(Fe.residue.label_seq_id)), bt(te.structureQuery.atomProperty.macromolecular.label_asym_id, Wn(Fe.chain.label_asym_id)), bt(te.structureQuery.atomProperty.macromolecular.label_entity_id, Wn(Fe.entity.id)), bt(te.structureQuery.atomProperty.macromolecular.auth_atom_id, Wn(Fe.atom.auth_atom_id)), bt(te.structureQuery.atomProperty.macromolecular.auth_comp_id, Wn(Fe.atom.auth_comp_id)), bt(te.structureQuery.atomProperty.macromolecular.auth_seq_id, Wn(Fe.residue.auth_seq_id)), bt(te.structureQuery.atomProperty.macromolecular.auth_asym_id, Wn(Fe.chain.auth_asym_id)), bt(te.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code, Wn(Fe.residue.pdbx_PDB_ins_code)), bt(te.structureQuery.atomProperty.macromolecular.pdbx_formal_charge, Wn(Fe.atom.pdbx_formal_charge)), bt(te.structureQuery.atomProperty.macromolecular.occupancy, Wn(Fe.atom.occupancy)), bt(te.structureQuery.atomProperty.macromolecular.B_iso_or_equiv, Wn(Fe.atom.B_iso_or_equiv)), bt(te.structureQuery.atomProperty.macromolecular.entityType, Wn(Fe.entity.type)), bt(te.structureQuery.atomProperty.macromolecular.entitySubtype, Wn(Fe.entity.subtype)), bt(te.structureQuery.atomProperty.macromolecular.entityPrdId, Wn(Fe.entity.prd_id)), bt(te.structureQuery.atomProperty.macromolecular.entityDescription, Wn(Fe.entity.pdbx_description)), bt(te.structureQuery.atomProperty.macromolecular.objectPrimitive, Wn(Fe.unit.object_primitive)), bt(te.structureQuery.atomProperty.macromolecular.isNonStandard, Wn(Fe.residue.isNonStandard)), bt(te.structureQuery.atomProperty.macromolecular.secondaryStructureKey, Wn(Fe.residue.secondary_structure_key)), bt(te.structureQuery.atomProperty.macromolecular.secondaryStructureFlags, Wn(Fe.residue.secondary_structure_type)), bt(te.structureQuery.atomProperty.macromolecular.chemCompType, Wn(Fe.residue.chem_comp_type)), bt(te.structureQuery.bondProperty.order, function(e, t) {
  return e.atomicBond.order;
}), bt(te.structureQuery.bondProperty.flags, function(e, t) {
  return e.atomicBond.type;
}), bt(te.structureQuery.bondProperty.atomA, function(e, t) {
  return e.atomicBond.a;
}), bt(te.structureQuery.bondProperty.atomB, function(e, t) {
  return e.atomicBond.b;
}), bt(te.structureQuery.bondProperty.length, function(e, t) {
  return e.atomicBond.length;
}), bt(te.internal.generator.bundleElement, function(e, t) {
  return Uk(t.groupedUnits(e), t.ranges(e), t.set(e));
}), bt(te.internal.generator.bundle, function(e, t) {
  return Hk(t.elements(e))(e);
}), bt(te.internal.generator.current, function(e, t) {
  return e.tryGetCurrentSelection();
})];
function Wn(e) {
  return function(t, n) {
    return e(n && n[0] && n[0](t) || t.element);
  };
}
function Sw(e, t) {
  return e | (cn.isName(t) ? cn.fromName(t) : 0);
}
function Aw(e, t) {
  switch (t.toLowerCase()) {
    case "helix":
      return 2 | e;
    case "alpha":
      return 4098 | e;
    case "pi":
      return 32770 | e;
    case "310":
      return 2050 | e;
    case "beta":
      return 4 | e;
    case "strand":
      return 4194308 | e;
    case "sheet":
      return 8388612 | e;
    case "turn":
      return 16 | e;
    case "bend":
      return 8 | e;
    case "coil":
      return 536870912 | e;
    default:
      return e;
  }
}
(function() {
  for (var e = 0, t = QQ; e < t.length; e++) {
    var n = t[e];
    KD.addSymbol(n);
  }
})();
var F0, JQ = /* @__PURE__ */ new Set(["N", "O", "S", "F", "CL", "BR", "I"]);
function $Q(e, t, n) {
  var r = !1;
  return Ml(e, t, n, function(i, a) {
    var o;
    o = Tn(i, a), JQ.has(o) && (r = !0);
  }), r;
}
function ww(e, t, n) {
  var r, i;
  return n === void 0 && (n = {}), { label: e, expression: t, description: n.description || "", category: (r = n.category) !== null && r !== void 0 ? r : F0.Misc, isHidden: !!n.isHidden, priority: n.priority || 0, referencesCurrent: !!n.referencesCurrent, get query() {
    return i || (i = fv(t)), i;
  }, ensureCustomProperties: n.ensureCustomProperties };
}
(function(e) {
  e.Type = "Type", e.Structure = "Structure Property", e.Atom = "Atom Property", e.Bond = "Bond Property", e.Residue = "Residue Property", e.AminoAcid = "Amino Acid", e.NucleicBase = "Nucleic Base", e.Manipulate = "Manipulate Selection", e.Validation = "Validation", e.Misc = "Miscellaneous", e.Internal = "Internal";
})(F0 || (F0 = {}));
var A2 = { polymer: ww("Polymer", Ct.struct.modifier.union([Ct.struct.generator.atomGroups({ "entity-test": Ct.core.logic.and([Ct.core.rel.eq([Ct.ammp("entityType"), "polymer"]), Ct.core.str.match([Ct.re("(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)", "i"), Ct.ammp("entitySubtype")])]) })]), { category: F0.Type }), lipid: ww("Lipid", Ct.struct.modifier.union([Ct.struct.generator.atomGroups({ "entity-test": Ct.core.rel.eq([Ct.ammp("entitySubtype"), "lipid"]) })]), { category: F0.Type }) }, Fu = function() {
  return ze.Builder().getStructure();
}, zO = function(e, t) {
  for (var n = ze.Builder(), r = new Set(t), i = 0, a = e.units; i < a.length; i++) {
    var o = a[i], s = Re([], o.elements, !0).filter(function(u) {
      return !r.has(u);
    });
    s.length && n.addUnit(o.kind, o.model, o.conformation.operator, s, o.traits);
  }
  return n.getStructure();
}, qa = function(e) {
  var t = e.getLoci();
  return t.kind === "structure-loci" ? t.structure : t.kind === "element-loci" ? ke.toStructure(t) : ze.Empty;
}, dh = function(e) {
  var t = e.getLoci();
  return t.kind === "structure-loci" ? Ai(ze.toStructureElementLoci(t.structure)) : t.kind === "element-loci" ? Ai(t) : [];
}, Fr = function(e, t, n, r) {
  if ((t == null ? void 0 : t.length) === 0 && !n) return ze.Empty;
  for (var i = ze.Builder(), a = new Set(t), o = typeof r == "string" ? r : di.create22(), s = 0, u = e.units; s < u.length; s++) {
    var l = u[s], c = t != null && t.length ? Re([], l.elements, !0).filter(function(d) {
      return a.has(d);
    }) : l.elements;
    c.length && i.addUnit(l.kind, r ? O(O({}, l.model), { id: o }) : l.model, l.conformation.operator, c, l.traits);
  }
  return i.getStructure();
}, Cg = function(e, t) {
  for (var n = ze.Builder(), r = /* @__PURE__ */ new Map(), i = 0, a = function(u, l) {
    var c = e[u], d = c.ref, f = c.elementIds, p = jn(t.cells.get(d)), g = new Set(f);
    r.set(u, []);
    for (var m = 0, v = p.units; m < v.length; m++) {
      var h = v[m], y = f ? Re([], h.elements, !0).filter(function(x) {
        return g.has(x);
      }) : h.elements;
      y.length && (r.get(u).push(i), n.addUnit(h.kind, h.model, h.conformation.operator, y, h.traits, i), i++);
    }
  }, o = 0, s = e.length; o < s; o++) a(o);
  return { unitsMap: r, structure: n.getStructure() };
}, __ = function(e) {
  if (e.model.sourceData.kind === "gro") return { polymer: vo(gm(hm(e, Ct.struct.modifier.exceptBy({ 0: A2.polymer.expression, by: A2.lipid.expression })))), other: vo(gm(hm(e, Ct.struct.modifier.exceptBy({ 0: jc.toExpression(jc("(sel.atom.all)", "mol-script")), by: Ct.struct.modifier.exceptBy({ 0: A2.polymer.expression, by: A2.lipid.expression }) })))) };
  var t = {}, n = {}, r = /* @__PURE__ */ new Set(), i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
  e.units.forEach(function(u) {
    var l;
    u.elements.forEach(function(g) {
      var m = Ou(u, g);
      if (m.groupPDB === "ATOM" && !["UNK", "MOL"].includes(m.residueName) && !mf.has(m.residueName)) return Sa(t, m), r.add(m.elementId), void i.push(m.elementId);
      if (m.groupPDB !== "HETATM" && !["UNK", "MOL"].includes(m.residueName) && mf.has(m.residueName)) Sa(n, m);
      else {
        var v = "".concat(m.chainId, "_").concat(m.residueId);
        a.set(v, a.has(v) ? Re(Re([], a.get(v), !0), [m], !1) : [m]);
      }
    });
    for (var c = 0, d = u.bonds.a.length; c < d; c++) {
      var f = u.elements[u.bonds.a[c]], p = u.elements[u.bonds.b[c]];
      o.has(f) ? (l = o.get(f)) === null || l === void 0 || l.add(p) : o.set(f, /* @__PURE__ */ new Set([p]));
    }
  }), a.forEach(function(u) {
    var l = !1;
    new Set(u.map(function(c) {
      return c.elementId;
    })).forEach(function(c) {
      if (o.has(c)) {
        var d = o.get(c);
        d == null || d.forEach(function(f) {
          r.has(f) && (l = !0);
        });
      }
    }), u.forEach(function(c) {
      l ? (Object.assign(c, { isEutectic: !0 }), i.push(c.elementId), r.add(c.elementId)) : Sa(n, c);
    });
  });
  var s = [];
  return Object.keys(n).forEach(function(u) {
    Object.keys(n[u]).forEach(function(l) {
      s.push.apply(s, n[u][l].map(function(c) {
        return c.elementId;
      }));
    });
  }), { polymer: i, other: s };
}, C3 = function(e, t) {
  var n;
  if (!e.elementCount) return "";
  if (t === pn.Pdb) return x8(e, void 0, !0);
  var r = yo(e), i = (n = r == null ? void 0 : r.entryId) !== null && n !== void 0 ? n : "";
  return t === pn.Sdf || t === pn.Mol ? i ? Re([i], g_(e).split(`
`).slice(1), !0).join(`
`) : g_(e) : void 0;
}, eJ = function(e, t) {
  var n = yo(e);
  return t !== pn.Material ? n.sourceData.data : n.sourceData.data.molecules[0];
}, tJ = function(e, t, n, r) {
  return se(void 0, 0, void 0, function() {
    var i, a, o, s, u, l, c;
    return ie(this, function(d) {
      switch (d.label) {
        case 0:
          return i = !((u = e == null ? void 0 : e.models) === null || u === void 0) && u.length ? e.models[0] : e == null ? void 0 : e.model, ((c = r ?? (i ? i.sourceData.kind : (l = e == null ? void 0 : e.parent) === null || l === void 0 ? void 0 : l.model.sourceData.kind)) !== null && c !== void 0 ? c : "sdf") !== "mmCIF" ? [3, 3] : (o = (a = Nl[pn.Pdb]).parse, [4, x8(e, void 0, !0, n)]);
        case 1:
          return [4, o.apply(a, [d.sent()])];
        case 2:
        case 5:
          return [2, d.sent()];
        case 3:
          return [4, g_(e, void 0, 0, t)];
        case 4:
          return s = d.sent(), [4, Nl[pn.Sdf].parse(s)];
      }
    });
  });
}, hm = function(e, t) {
  return fv(t)(new xf(e));
}, gm = function(e) {
  var t;
  if (e.structure) t = e.structure;
  else if (e.structures) {
    var n = e.structures.map(function(a) {
      return (a == null ? void 0 : a.units.length) > 0 ? ze.toStructureElementLoci(a) : void 0;
    }).filter(function(a) {
      return a;
    });
    if (n.length === 0) return Fu();
    for (var r = n[0], i = 1; i < n.length; i++) r = ke.union(r, n[i]);
    t = ke.toStructure(r);
  }
  return t;
}, vo = function(e) {
  var t = [];
  return e.units.forEach(function(n) {
    t.push.apply(t, n.elements);
  }), t;
}, Ou = function(e, t) {
  var n;
  return { unitId: e.invariantId, elementId: t, chainId: e.model.atomicHierarchy.chains.auth_asym_id.value(e.chainIndex[t]), groupPDB: e.model.atomicHierarchy.residues.group_PDB.value(e.residueIndex[t]), residueId: e.model.atomicHierarchy.residues.auth_seq_id.value(e.residueIndex[t]), insertCode: e.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.residueIndex[t]), residueName: e.model.atomicHierarchy.atoms.label_comp_id.value(t), atomId: e.model.atomicConformation.atomId.value(t), atomName: e.model.atomicHierarchy.atoms.label_atom_id.value(t), typeSymbol: N0(e.model.atomicHierarchy.atoms.type_symbol.value(t)), charge: ((n = Rl.Provider.get(e.model)) === null || n === void 0 ? void 0 : n.data.value(t)) || 0, altId: e.model.atomicHierarchy.atoms.label_alt_id.value(t), cdr: e.model.atomicHierarchy.atoms.cdr.value(t) || 0, bfactor: e.model.atomicHierarchy.atoms.B_iso_or_equiv.value(t), em_confidence: e.model.atomicHierarchy.atoms.em_confidence.value(t), x: e.model.atomicConformation.x[t], y: e.model.atomicConformation.y[t], z: e.model.atomicConformation.z[t], residueIndex: e.residueIndex[t], occupancy: e.model.atomicConformation.occupancy.value(t) };
}, UO = function(e, t, n) {
  var r = n;
  if (e.units.some(function(a) {
    return !!a.elements.includes(t) && (r = a.invariantId, !0);
  }), r === void 0 || !e.unitMap.has(r)) return {};
  var i = e.unitMap.get(r);
  return Ou(i, t);
}, nJ = function(e, t) {
  e.units.forEach(function(n) {
    n.elements.forEach(function(r) {
      var i = Ou(n, r);
      t(i);
    });
  });
}, HO = function(e, t, n) {
  var r = [];
  return t.forEach(function(i) {
    var a = e.managers.cell.get(i.ref), o = jn(a), s = /* @__PURE__ */ new Map(), u = new Set(i.elementIds);
    o && (o.units.forEach(function(l) {
      l.elements.forEach(function(c) {
        var d;
        if (!i.elementIds || u.has(c)) {
          var f = Ou(l, c), p = Cv(f, n);
          s.has(p) ? (d = s.get(p)) === null || d === void 0 || d.push(f) : s.set(p, [f]);
        }
      });
    }), s.forEach(function(l) {
      r.push({ ref: i.ref, elementIds: l.map(function(c) {
        return c.elementId;
      }), props: DZ(l[0], n) });
    }));
  }), r;
}, A8 = function(e, t) {
  var n = {}, r = /* @__PURE__ */ new Set(), i = t ?? [];
  return t || e.managers.cell.traverse(function(a, o) {
    jn(a) && !o.isHidden && r.add(a.ref);
  }), r.forEach(function(a) {
    i.push({ ref: a });
  }), i.forEach(function(a) {
    var o, s = a.ref, u = a.elementIds, l = new Set(u), c = e.cells.get(s);
    if (c) {
      var d = jn(c);
      if (d) {
        var f = [], p = [], g = [], m = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
        d.units.forEach(function(S) {
          var b;
          S.elements.forEach(function(M) {
            var E, T;
            if (!u || l.has(M)) {
              var P = Ou(S, M), k = Cv(P, Dt.Residue);
              h8.has(P.residueName.toUpperCase()) ? f.push(P.elementId) : Lm.has(P.residueName.toUpperCase()) ? p.push(P.elementId) : p8.has(P.typeSymbol.toUpperCase()) || rh.has(P.residueName.toUpperCase()) || mf.has(P.residueName.toUpperCase()) ? g.push(P.elementId) : P.groupPDB !== "ATOM" || ["UNK", "MOL"].includes(P.residueName) ? P.groupPDB === "HETATM" || ["UNK", "MOL"].includes(P.residueName) ? y.has(k) ? (E = y.get(k)) === null || E === void 0 || E.push(P) : y.set(k, [P]) : h.has(k) ? (T = h.get(k)) === null || T === void 0 || T.push(P) : h.set(k, [P]) : m.add(P.elementId);
            }
          });
          for (var _ = 0, C = S.bonds.a.length; _ < C; _++) {
            var w = S.elements[S.bonds.a[_]], I = S.elements[S.bonds.b[_]];
            x.has(w) ? (b = x.get(w)) === null || b === void 0 || b.add(I) : x.set(w, /* @__PURE__ */ new Set([I]));
          }
        }), y.forEach(function(S, b) {
          var _ = !1, C = new Set(S.map(function(w) {
            return w.elementId;
          }));
          C.forEach(function(w) {
            if (x.has(w)) {
              var I = x.get(w);
              I == null || I.forEach(function(M) {
                m.has(M) && (_ = !0);
              });
            }
          }), S.forEach(function(w) {
            var I;
            _ ? m.add(w.elementId) : h.has(b) ? (I = h.get(b)) === null || I === void 0 || I.push(w) : h.set(b, [w]);
          });
        }), h.forEach(function(S, b) {
          var _ = S.filter(function(C) {
            return C.typeSymbol !== "H";
          });
          _.length > 10 && _.length < 150 ? v.set(b, S) : g.push.apply(g, S.map(function(C) {
            return C.elementId;
          }));
        }), n[s] = ((o = {})[ei.Protein] = m.size ? [{ ref: s, elementIds: Array.from(m.values()) }] : [], o[ei.Ligand] = Array.from(v.entries()).map(function(S) {
          var b = S[0], _ = S[1];
          return { ref: s, elementIds: _.map(function(C) {
            return C.elementId;
          }), name: b };
        }), o[ei.Solvent] = f.length ? [{ ref: s, elementIds: f }] : [], o[ei.Water] = p.length ? [{ ref: s, elementIds: p }] : [], o[ei.Other] = g.length ? [{ ref: s, elementIds: g }] : [], o);
      }
    }
  }), n;
}, yo = function(e) {
  var t;
  return (t = e.model) !== null && t !== void 0 ? t : e.models[0];
}, Ls = function(e) {
  var t, n;
  return (n = (t = e.model) !== null && t !== void 0 ? t : e.models[0]) === null || n === void 0 ? void 0 : n.id;
}, jn = function(e) {
  var t, n, r, i;
  return (t = e == null ? void 0 : e.model.structure) !== null && t !== void 0 ? t : !((n = e == null ? void 0 : e.model) === null || n === void 0) && n.trajectory ? ze.ofModel((r = e == null ? void 0 : e.model.trajectory) === null || r === void 0 ? void 0 : r.state.getFrameAtIndex((i = e == null ? void 0 : e.model.trajectory) === null || i === void 0 ? void 0 : i.frameIndex)) : void 0;
}, S3 = function(e, t) {
  var n = e.units.filter(function(a) {
    return Me.has(a.elements, t);
  })[0];
  if (!n || ve.isCoarse(n)) return ti.NotHydrogen;
  if (n.model.atomicHierarchy.derived.atom.atomicNumber[t] !== 1) {
    var r = ti.NotHydrogen;
    return Ml(e, n, n.elements.indexOf(t), function(a, o) {
      if (a.model.atomicHierarchy.derived.atom.atomicNumber[a.elements[o]] === 1) switch (S3(e, a.elements[o])) {
        case ti.Polar:
          r = ti.ConnectPolar;
          break;
        case ti.NonPolar:
          r = ti.ConnectNonPolar;
      }
    }), r;
  }
  var i = $Q(e, n, Me.indexOf(n.elements, t));
  return i ? ti.Polar : i ? ti.NotHydrogen : ti.NonPolar;
}, rJ = function(e, t) {
  return se(void 0, 0, void 0, function() {
    var n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return [4, Promise.all(t.filter(function(i) {
            return e.cells.has(i.ref);
          }).map(function(i) {
            return e.managers.cell.getStructure(i.ref);
          }))];
        case 1:
          return n = r.sent(), [2, cQ(n)];
      }
    });
  });
}, qO = function(e) {
  return Array.from(e.cells.entries()).map(function(t) {
    var n = t[0], r = t[1];
    return jn(r) ? r.representations.size === 0 || Array.from(r.representations.values()).filter(function(i) {
      return !i.isHidden;
    }).length === 0 ? { ref: "" } : { ref: n } : { ref: "" };
  }).filter(function(t) {
    return t.ref;
  });
}, up = function(e, t) {
  return UO(e, t).typeSymbol === "H" && S3(e, t) === ti.NonPolar;
}, N4 = function(e) {
  if (!e) return e;
  var t = [], n = e.sort(function(i, a) {
    return +i - +a;
  }), r = [];
  return n.forEach(function(i, a) {
    r.length !== 0 ? r.length !== 1 ? r.length === 2 && (r[1] === i - 1 ? r[1] = i : (t.push.apply(t, r), r = [i])) : r[0] === i - 1 ? r.push(i) : (t.push(r[0], r[0]), r = [i]) : r.push(i);
  }), r.length && t.push.apply(t, r.length === 2 ? r : [r[0], r[0]]), t;
}, w2 = function(e) {
  for (var t = [], n = 0, r = e.length; n < r; n += 2) for (var i = e[n]; i <= e[n + 1]; i++) t.push(i);
  return t;
};
function Mf(e, t, n, r) {
  var i, a, o, s, u = 0, l = t.webgl, c = new qr(), d = new en.GeometryState(), f = jl(), p = [], g = Ao.create(), m = us.createEmpty();
  function v(h) {
    if (Ao.update(g, h), h.visible !== void 0 && i && i.setVisibility(h.visible && (g.unitTransforms === null || g.unitTransforms.isIdentity)), h.alphaFactor !== void 0 && i && i.setAlphaFactor(h.alphaFactor), h.pickable !== void 0 && i && i.setPickable(h.pickable), h.overpaint !== void 0 && i) {
      var y = T0.remap(h.overpaint, a);
      i.setOverpaint(y, l);
    }
    if (h.transparency !== void 0 && i) {
      var x = k0.remap(h.transparency, a);
      i.setTransparency(x, l);
    }
    if (h.substance !== void 0 && i) {
      var S = O0.remap(h.substance, a);
      i.setSubstance(S, l);
    }
    if (h.clipping !== void 0 && i) {
      var b = D0.remap(h.clipping, a);
      i.setClipping(b);
    }
    h.transform !== void 0 && i && i.setTransform(h.transform), h.unitTransforms !== void 0 && i && i.setVisibility(g.visible && (h.unitTransforms === null || h.unitTransforms.isIdentity));
  }
  return { label: e, get groupCount() {
    return i ? i.groupCount : 0;
  }, get props() {
    return s;
  }, get params() {
    return o;
  }, get state() {
    return g;
  }, get theme() {
    return m;
  }, get geometryVersion() {
    return d.version;
  }, renderObjects: p, updated: c, createOrUpdate: function(h, y) {
    var x = this;
    return h === void 0 && (h = {}), y && y !== a && (o = n(t, y), a = y, s || (s = N.getDefaultValues(o))), s = Object.assign({}, s, h), Xt.create("Creating or updating ComplexRepresentation", function(S) {
      return se(x, 0, void 0, function() {
        var b, _, C;
        return ie(this, function(w) {
          switch (w.label) {
            case 0:
              return b = !1, i ? !((C = i.mustRecreate) === null || C === void 0) && C.call(i, a, s, l) && (i.destroy(), i = r(f, a, s, l), b = !0) : (i = r(f, a, s, l), b = !0), (_ = i.createOrUpdate({ webgl: l, runtime: S }, m, s, y)) ? [4, _] : [3, 2];
            case 1:
              w.sent(), w.label = 2;
            case 2:
              return b && v(g), p.length = 0, i && i.renderObject && (p.push(i.renderObject), d.add(i.renderObject.id, i.geometryVersion)), d.snapshot(), u += 1, c.next(u), [2];
          }
        });
      });
    });
  }, setState: v, setTheme: function(h) {
    m = h;
  }, getLoci: function(h) {
    return h === void 0 ? ze.Loci(a.target) : i ? i.getLoci(h) : cr;
  }, mark: function(h, y) {
    if (!a || !En.is(g.markerActions, y)) return !1;
    if (ze.isLoci(h) || ke.is(h) || pt.isLoci(h)) {
      if (!ze.areRootsEquivalent(h.structure, a)) return !1;
      h = zn.remap(h, a), (ze.isLoci(h) || ke.is(h) && ke.isWholeStructure(h)) && (h = t8);
    } else if (!Ya(h) && !i0(h)) return !1;
    return !zn.isEmpty(h) && !!i && i.mark(h, y);
  }, destroy: function() {
    i && i.destroy();
  } };
}
function jO(e, t, n) {
  var r = t.elements, i = t.model;
  if (_e.indexOf(r, n) !== -1) {
    for (var a = i.atomicHierarchy.residueAtomSegments, o = a.index, s = a.offsets, u = o[n], l = [], c = s[u], d = s[u + 1]; c < d; ++c) {
      var f = _e.indexOf(r, c);
      f !== -1 && l.push(f);
    }
    return ke(e, [{ unit: t, indices: _e.ofSortedArray(Me.ofSortedArray(l)) }]);
  }
  return cr;
}
function Iw(e, t, n) {
  for (var r = e.structure.child, i = t && r ? e.group.units.filter(function(l) {
    return r.unitMap.has(l.id);
  }) : e.group.units, a = i.length, o = 16 * a, s = n && n.aTransform.ref.value.length >= o ? n.aTransform.ref.value : new Float32Array(o), u = 0; u < a; u++) ne.toArray(i[u].conformation.operator.matrix, s, 16 * u);
  return K6(s, a, n);
}
var iJ = N.objectToOptions({ atomic: {}, spheres: {}, gaussians: {} }), Pw = 5e8;
function aJ(e, t, n) {
  n === void 0 && (n = Pw);
  var r = function(u, l, c) {
    c === void 0 && (c = Pw);
    var d = qn.size(A(), u);
    A.ceil(d, d), d.sort(function(g, m) {
      return m - g;
    });
    var f = Math.floor(Math.cbrt(c) * Math.cbrt(c)), p = d[0] * d[1];
    return { area: p, areaCells: Math.ceil(p / (l * l)), maxAreaCells: f };
  }(e, t.resolution, n), i = r.area, a = r.areaCells, o = r.maxAreaCells, s = a > o ? Math.sqrt(i / o) : t.resolution;
  return O(O({}, t), { resolution: s });
}
var w8 = { ignoreHydrogens: N.Boolean(!1, { description: "Whether or not to include hydrogen atoms in the surface calculation." }), traceOnly: N.Boolean(!1, { description: "Whether or not to only use trace atoms in the surface calculation." }), includeParent: N.Boolean(!1, { description: "Include elements of the parent structure in surface calculation to get a surface patch of the current structure." }) };
N.getDefaultValues(w8);
var oJ = A();
function sJ(e, t, n, r) {
  return A.squaredDistance(A.set(oJ, e, t, n), r);
}
function uJ(e, t, n, r) {
  var i, a, o = r.ignoreHydrogens, s = r.traceOnly, u = r.includeParent, l = u ? e.root.unitMap.get(t.id) : t, c = function(E) {
    switch (E.kind) {
      case 0:
        return E.model.atomicConformation;
      case 1:
        return E.model.coarseConformation.spheres;
      case 2:
        return E.model.coarseConformation.gaussians;
    }
  }(l), d = c.x, f = c.y, p = c.z, g = l.elements, m = t.boundary.sphere, v = m.center, h = m.radius, y = (h + 7) * (h + 7);
  if (o || s || u && l !== t) {
    for (var x = [], S = [], b = 0, _ = g.length; b < _; ++b) {
      var C = g[b];
      o && x_(l, C) || s && !YO(l, C) || u && sJ(d[C], f[C], p[C], v) > y || (x.push(C), S.push(b));
    }
    i = Me.ofSortedArray(x), a = S;
  } else i = g, a = Tu(new Int32Array(i.length));
  u && l !== t && function(E, T, P) {
    for (var k = 0, D = T.length, B = 0, L = P.length; B < L; ++B) {
      var F = Me.indexOfInRange(T, P[B], k, D);
      F === -1 ? E[B] = -2 : (E[B] = F, k = F);
    }
  }(a, t.elements, i);
  var w = { indices: i, x: d, y: f, z: p, id: a }, I = t === l ? t.boundary : $1(w), M = He.create(e, l);
  return { position: w, boundary: I, radius: function(E) {
    return M.element = E, n.size(M);
  } };
}
var KO = em.H;
function x_(e, t) {
  return !ve.isCoarse(e) && e.model.atomicHierarchy.derived.atom.atomicNumber[t] === KO;
}
function C_(e, t) {
  return e[t] === KO;
}
function YO(e, t) {
  if (ve.isCoarse(e)) return !0;
  var n = e.model.atomicHierarchy.atoms.label_atom_id.value(t);
  return n === "CA" || n === "BB" || n === "P";
}
function fh(e) {
  return N.MultiSelect(e, iJ, { description: "For which kinds of units/chains to show the representation visuals." });
}
var Wa = { unitKinds: fh(["atomic", "spheres"]), includeParent: N.Boolean(!1, { isHidden: !0 }) }, WO = O({}, Lt.Params), lJ = O({}, Hs.Params), XO = O({}, fa.Params), cJ = O({}, wf.Params), ZO = O({}, Mn.Params), QO = O({}, Co.Params), JO = O({}, lv.Params), $O = O({}, sd.Params);
function A3(e, t) {
  var n, r, i, a, o, s, u, l, c = e.defaultProps, d = e.createGeometry, f = e.createLocationIterator, p = e.getLoci, g = e.eachLocation, m = e.setUpdateState, v = e.mustRecreate, h = e.processValues, y = e.dispose, x = e.geometryUtils, S = x.updateValues, b = x.updateBoundingSphere, _ = x.updateRenderableState, C = x.createPositionIterator, w = Du.create(), I = { loci: cr, action: lt.None, status: -1 }, M = Object.assign({}, c), E = us.createEmpty(), T = -1;
  function P(B) {
    if (w.createNew) {
      if (u = f(a), !B) throw new Error("expected geometry to be given");
      n = function(L, F, V, G, H, q) {
        var z = Ui.getUtils(F), K = z.createValues, Y = z.createRenderableState, Z = K(F, W6(), V, G, H), X = Y(H);
        return Gm(F.kind, Z, X, q);
      }(0, B, u, i, r, t), l = C(B, n.values);
    } else {
      if (!n) throw new Error("expected renderObject to be available");
      if (w.updateTransform && ss((u = f(a)).instanceCount * u.groupCount, n.values), w.createGeometry) {
        if (!B) throw new Error("expected geometry to be given");
        R.updateIfChanged(n.values.drawCount, Ui.getDrawCount(B)), R.updateIfChanged(n.values.uVertexCount, Ui.getVertexCount(B));
      }
      (w.updateTransform || w.createGeometry) && (b(n.values, B || s), l = C(s, n.values)), w.updateSize && "uSize" in n.values && Hl(u, i.size, n.values), w.updateColor && bo(u, l, i.color, n.values), S(n.values, r), _(n.state, r);
    }
    M = r, E = i, o = a, B && (s = B, T += 1);
  }
  function k(B, L, F) {
    return function(V) {
      return !!Ya(V) || !(!ze.isLoci(V) || !ze.areRootsEquivalent(V.structure, o)) || !!(ke.is(V) && ze.areRootsEquivalent(V.structure, o) && ke.isWholeStructure(V));
    }(B) ? L(le.ofBounds(0, u.groupCount * u.instanceCount)) : g(B, o, L, F);
  }
  function D(B) {
    n && (h == null || h(n.values, s, M, E, B.webgl));
  }
  return { get groupCount() {
    return u ? u.count : 0;
  }, get renderObject() {
    return u && u.count ? n : void 0;
  }, get geometryVersion() {
    return T;
  }, createOrUpdate: function(B, L, F, V) {
    if (F === void 0 && (F = {}), function(H, q, z) {
      if (!z && !o) throw new Error("missing structure");
      if (r = Object.assign({}, M, q), i = H, a = z, Du.reset(w), !n || !o) return w.createNew = !0, void (w.createGeometry = !0);
      m(w, r, M, i, E, a, o), ze.areEquivalent(a, o) || (w.createGeometry = !0), ze.areHierarchiesEqual(a, o) || (w.updateTransform = !0, w.createGeometry = !0), Ll.areEqual(H.color, E.color) || (w.updateColor = !0), id(r.unitKinds, M.unitKinds) || (w.createGeometry = !0), o.child !== a.child && (w.createGeometry = !0), w.updateSize && !("uSize" in n.values) && (w.createGeometry = !0), w.createGeometry && (w.updateColor = !0, w.updateSize = !0);
    }(L, F, V || o), w.createGeometry) {
      var G = d(B, a, i, r, s);
      if (T6(G)) return G.then(function(H) {
        P(H), D(B);
      });
      P(G);
    } else P();
    D(B);
  }, getLoci: function(B) {
    return n ? p(B, o, n.id) : cr;
  }, mark: function(B, L) {
    return Qt.mark(n, B, L, k, I);
  }, setVisibility: function(B) {
    Qt.setVisibility(n, B);
  }, setAlphaFactor: function(B) {
    Qt.setAlphaFactor(n, B);
  }, setPickable: function(B) {
    Qt.setPickable(n, B);
  }, setColorOnly: function(B) {
    Qt.setColorOnly(n, B);
  }, setTransform: function(B, L) {
    Qt.setTransform(n, B, L);
  }, setOverpaint: function(B, L) {
    var F = { geometry: s, props: M, webgl: L };
    Qt.setOverpaint(n, B, k, !0, F);
  }, setTransparency: function(B, L) {
    var F = { geometry: s, props: M, webgl: L };
    Qt.setTransparency(n, B, k, !0, F);
  }, setSubstance: function(B, L) {
    var F = { geometry: s, props: M, webgl: L };
    Qt.setSubstance(n, B, k, !0, F);
  }, setClipping: function(B) {
    Qt.setClipping(n, B, k, !0);
  }, destroy: function() {
    y == null || y(s), n && (n.state.disposed = !0, n = void 0);
  }, mustRecreate: v };
}
var eB = O(O({}, WO), Wa);
function tB(e, t) {
  return A3(O(O({}, e), { setUpdateState: function(n, r, i, a, o, s, u) {
    e.setUpdateState(n, r, i, a, o, s, u), Ea.areEqual(a.size, o.size) || (n.createGeometry = !0);
  }, geometryUtils: Lt.Utils }), t);
}
var dJ = O(O({}, XO), Wa), fJ = O(O({}, ZO), Wa), mJ = O(O({}, QO), Wa);
function ca(e, t, n, r) {
  var i, a, o, s, u = 0, l = t.webgl, c = new qr(), d = jl(), f = [], p = new en.GeometryState(), g = Ao.create(), m = /* @__PURE__ */ new Map(), v = us.createEmpty();
  function h(y, x, S) {
    var b = S.visible, _ = S.alphaFactor, C = S.pickable, w = S.overpaint, I = S.transparency, M = S.substance, E = S.clipping, T = S.transform, P = S.unitTransforms;
    b !== void 0 && y.setVisibility(b), _ !== void 0 && y.setAlphaFactor(_), C !== void 0 && y.setPickable(C), w !== void 0 && y.setOverpaint(w, l), I !== void 0 && y.setTransparency(I, l), M !== void 0 && y.setSubstance(M, l), E !== void 0 && y.setClipping(E), T !== void 0 && y.setTransform(T), P !== void 0 && (P ? y.setTransform(void 0, P.getSymmetryGroupTransforms(x)) : y.setTransform(void 0, null));
  }
  return { label: e, get groupCount() {
    var y = 0;
    return m.forEach(function(x) {
      var S = x.visual;
      S.renderObject && (y += S.groupCount);
    }), y;
  }, get geometryVersion() {
    return p.version;
  }, get props() {
    return s;
  }, get params() {
    return o;
  }, get state() {
    return g;
  }, get theme() {
    return v;
  }, renderObjects: f, updated: c, createOrUpdate: function(y, x) {
    var S = this;
    return y === void 0 && (y = {}), x && x !== i && (o = n(t, x), s || (s = N.getDefaultValues(o))), s = Object.assign({}, s, y), Xt.create("Creating or updating UnitsRepresentation", function(b) {
      return se(S, 0, void 0, function() {
        var _, C, w, I, M, E, T, P, k, D, B, L, F;
        return ie(this, function(V) {
          switch (V.label) {
            case 0:
              if (i || x) return [3, 1];
              throw new Error("missing structure");
            case 1:
              if (!x || i) return [3, 8];
              a = x.unitSymmetryGroups, M = 0, V.label = 2;
            case 2:
              return M < a.length ? (k = a[M], P = r(d, x, s, l), (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 4]) : [3, 7];
            case 3:
              V.sent(), V.label = 4;
            case 4:
              return h(P, k, g), m.set(k.hashCode, { visual: P, group: k }), b.shouldUpdate ? [4, b.update({ message: "Creating or updating UnitsVisual", current: M, max: a.length })] : [3, 6];
            case 5:
              V.sent(), V.label = 6;
            case 6:
              return M++, [3, 2];
            case 7:
              return [3, 43];
            case 8:
              if (!x || ze.areUnitIdsAndIndicesEqual(x, i) && x.child === i.child) return [3, 22];
              a = x.unitSymmetryGroups, _ = m, m = /* @__PURE__ */ new Map(), M = 0, V.label = 9;
            case 9:
              return M < a.length ? (k = a[M], (w = _.get(k.hashCode)) ? (P = w.visual, !((B = P.mustRecreate) === null || B === void 0) && B.call(P, { group: k, structure: x }, s, l) ? (P.destroy(), P = r(d, x, s, l), (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 11]) : [3, 12]) : [3, 15]) : [3, 21];
            case 10:
              V.sent(), V.label = 11;
            case 11:
              return h(P, k, g), [3, 14];
            case 12:
              return (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 14];
            case 13:
              V.sent(), V.label = 14;
            case 14:
              return m.set(k.hashCode, { visual: P, group: k }), _.delete(k.hashCode), P.renderObject && Y5(C = P.renderObject.values.tMarker.ref.value.array, le.ofBounds(0, C.length), lt.RemoveHighlight), [3, 18];
            case 15:
              return P = r(d, x, s, l), (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 17];
            case 16:
              V.sent(), V.label = 17;
            case 17:
              h(P, k, g), m.set(k.hashCode, { visual: P, group: k }), V.label = 18;
            case 18:
              return b.shouldUpdate ? [4, b.update({ message: "Creating or updating UnitsVisual", current: M, max: a.length })] : [3, 20];
            case 19:
              V.sent(), V.label = 20;
            case 20:
              return M++, [3, 9];
            case 21:
              return _.forEach(function(G) {
                G.visual.destroy();
              }), [3, 43];
            case 22:
              if (!x || x === i || !ze.areUnitIdsAndIndicesEqual(x, i)) return [3, 34];
              a = x.unitSymmetryGroups, M = 0, V.label = 23;
            case 23:
              return M < a.length ? (k = a[M], (w = m.get(k.hashCode)) ? (P = w.visual, !((L = P.mustRecreate) === null || L === void 0) && L.call(P, { group: k, structure: x }, s, t.webgl) ? (P.destroy(), P = r(d, x, s, t.webgl), w.visual = P, (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 25]) : [3, 26]) : [3, 29]) : [3, 33];
            case 24:
              V.sent(), V.label = 25;
            case 25:
              return h(P, k, g), [3, 28];
            case 26:
              return (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: x })) ? [4, D] : [3, 28];
            case 27:
              V.sent(), V.label = 28;
            case 28:
              return w.group = k, [3, 30];
            case 29:
              throw new Error("expected to find visual for hashCode ".concat(k.hashCode));
            case 30:
              return b.shouldUpdate ? [4, b.update({ message: "Creating or updating UnitsVisual", current: M, max: a.length })] : [3, 32];
            case 31:
              V.sent(), V.label = 32;
            case 32:
              return M++, [3, 23];
            case 33:
              return [3, 43];
            case 34:
              I = [], m.forEach(function(G) {
                return I.push(G);
              }), M = 0, E = I.length, V.label = 35;
            case 35:
              return M < E ? (T = I[M], P = T.visual, k = T.group, !((F = P.mustRecreate) === null || F === void 0) && F.call(P, { group: k, structure: i }, s, t.webgl) ? (P.destroy(), P = r(d, i, s, l), I[M].visual = P, (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s, { group: k, structure: i })) ? [4, D] : [3, 37]) : [3, 38]) : [3, 43];
            case 36:
              V.sent(), V.label = 37;
            case 37:
              return h(P, k, g), [3, 40];
            case 38:
              return (D = P.createOrUpdate({ webgl: l, runtime: b }, v, s)) ? [4, D] : [3, 40];
            case 39:
              V.sent(), V.label = 40;
            case 40:
              return b.shouldUpdate ? [4, b.update({ message: "Creating or updating UnitsVisual", current: M, max: E })] : [3, 42];
            case 41:
              V.sent(), V.label = 42;
            case 42:
              return ++M, [3, 35];
            case 43:
              return f.length = 0, m.forEach(function(G) {
                var H = G.visual;
                H.renderObject && (f.push(H.renderObject), p.add(H.renderObject.id, H.geometryVersion));
              }), p.snapshot(), x && (i = x), c.next(u++), [2];
          }
        });
      });
    });
  }, setState: function(y) {
    var x = y.visible, S = y.alphaFactor, b = y.pickable, _ = y.overpaint, C = y.transparency, w = y.substance, I = y.clipping, M = y.transform, E = y.unitTransforms, T = y.syncManually, P = y.markerActions, k = {};
    x !== g.visible && (k.visible = x), S !== g.alphaFactor && (k.alphaFactor = S), b !== g.pickable && (k.pickable = b), _ !== void 0 && i && (k.overpaint = T0.remap(_, i)), C !== void 0 && i && (k.transparency = k0.remap(C, i)), w !== void 0 && i && (k.substance = O0.remap(w, i)), I !== void 0 && i && (k.clipping = D0.remap(I, i)), M === void 0 || ne.areEqual(M, g.transform, sr) || (k.transform = M), E === g.unitTransforms && (E == null ? void 0 : E.version) === y.unitTransformsVersion || (k.unitTransforms = E, g.unitTransformsVersion = E ? E == null ? void 0 : E.version : -1), T !== g.syncManually && (k.syncManually = T), P !== g.markerActions && (k.markerActions = P), m.forEach(function(D) {
      return h(D.visual, D.group, k);
    }), Ao.update(g, k);
  }, setTheme: function(y) {
    v = y;
  }, getLoci: function(y) {
    if (y === void 0) return ze.Loci(i.target);
    var x = cr;
    return m.forEach(function(S) {
      var b = S.visual.getLoci(y);
      td(b) || (x = b);
    }), x;
  }, mark: function(y, x) {
    if (!i || !En.is(g.markerActions, x)) return !1;
    if (ze.isLoci(y) || ke.is(y) || pt.isLoci(y)) {
      if (!ze.areRootsEquivalent(y.structure, i)) return !1;
      y = zn.remap(y, i), (ze.isLoci(y) || ke.is(y) && ke.isWholeStructure(y)) && (y = t8);
    } else if (!Ya(y) && !i0(y)) return !1;
    if (zn.isEmpty(y)) return !1;
    var S = !1;
    return m.forEach(function(b) {
      var _ = b.visual;
      S = _.mark(y, x) || S;
    }), S;
  }, destroy: function() {
    m.forEach(function(y) {
      return y.visual.destroy();
    }), m.clear();
  } };
}
function mh(e, t) {
  var n, r, i, a, o, s, u, l, c = e.defaultProps, d = e.createGeometry, f = e.createLocationIterator, p = e.getLoci, g = e.eachLocation, m = e.setUpdateState, v = e.mustRecreate, h = e.processValues, y = e.dispose, x = e.geometryUtils, S = x.createEmpty, b = x.updateValues, _ = x.updateBoundingSphere, C = x.updateRenderableState, w = x.createPositionIterator, I = Du.create(), M = { loci: cr, action: lt.None, status: -1 }, E = Object.assign({}, c), T = us.createEmpty(), P = -1;
  function k(F) {
    if (I.createNew) {
      if (u = f(r), !F) throw new Error("expected geometry to be given");
      n = function(V, G, H, q, z, K) {
        var Y = Ui.getUtils(G), Z = Y.createValues, X = Y.createRenderableState, W = Z(G, Iw(V, z.includeParent), H, q, z), J = X(z);
        return Gm(G.kind, W, J, K);
      }(r, F, u, T, E, t), l = w(F, n.values);
    } else {
      if (!n) throw new Error("expected renderObject to be available");
      if (I.updateTransform && ss((u = f(r)).instanceCount * u.groupCount, n.values), I.updateMatrix && Iw(r, E.includeParent, n.values), I.createGeometry) {
        if (!F) throw new Error("expected geometry to be given");
        R.updateIfChanged(n.values.drawCount, Ui.getDrawCount(F)), R.updateIfChanged(n.values.uVertexCount, Ui.getVertexCount(F));
      }
      (I.updateTransform || I.createGeometry) && (_(n.values, F || s), l = w(F || s, n.values)), I.updateSize && "uSize" in n.values && Hl(u, T.size, n.values), I.updateColor && bo(u, l, T.color, n.values), b(n.values, E), C(n.state, E);
    }
    i = E, a = T, o = r, F && (s = F, P += 1);
  }
  function D(F, V, G, H, q, z) {
    return function(K, Y) {
      for (var Z = 0, X = K.length; Z < X; ++Z)
        if (ve.isAtomic(Y) && K[Z] === "atomic" || ve.isSpheres(Y) && K[Z] === "spheres" || ve.isGaussians(Y) && K[Z] === "gaussians") return !0;
      return !1;
    }(q.unitKinds, V) ? d(F, V, G, H, q, z) : S(z);
  }
  function B(F, V, G) {
    return function(H) {
      return !!Ya(H) || !(!ze.isLoci(H) || !ze.areRootsEquivalent(H.structure, o.structure)) || !!(ke.is(H) && ze.areRootsEquivalent(H.structure, o.structure) && ke.isWholeStructure(H));
    }(F) ? V(le.ofBounds(0, u.groupCount * u.instanceCount)) : g(F, o, V, G);
  }
  function L(F) {
    n && (h == null || h(n.values, s, i, a, F.webgl));
  }
  return { get groupCount() {
    return u ? u.count : 0;
  }, get renderObject() {
    return u && u.count ? n : void 0;
  }, get geometryVersion() {
    return P;
  }, createOrUpdate: function(F, V, G, H) {
    if (function(z, K, Y) {
      if (!Y && !o) throw new Error("missing structureGroup");
      if (E = K, T = z, r = Y, Du.reset(I), !n || !o) return I.createNew = !0, void (I.createGeometry = !0);
      m(I, E, i, T, a, r, o), ze.areHierarchiesEqual(o.structure, r.structure) || (I.updateTransform = !0, I.updateColor = !0, I.updateSize = !0), Ll.areEqual(T.color, a.color) || (I.updateColor = !0), o.structure.child !== r.structure.child && (I.createGeometry = !0), id(E.unitKinds, i.unitKinds) || (I.createGeometry = !0), r.group.transformHash !== o.group.transformHash && (r.group.units.length !== o.group.units.length || I.updateColor ? I.updateTransform = !0 : I.updateMatrix = !0);
      var Z = r.group.units[0], X = o.group.units[0];
      ve.areOperatorsEqual(Z, X) || (I.updateTransform = !0), ve.areConformationsEqual(Z, X) || (I.createGeometry = !0), I.updateTransform && (I.updateMatrix = !0), I.updateSize && !("uSize" in n.values) && (I.createGeometry = !0), (I.createGeometry || I.updateTransform) && (o.structure.hashCode !== r.structure.hashCode && (I.updateColor = !0, I.updateSize = !0), (T.color.granularity.startsWith("vertex") || n.values.dColorType.ref.value.startsWith("vertex") || T.color.granularity.startsWith("volume") || n.values.dColorType.ref.value.startsWith("volume")) && (I.updateColor = !0));
    }(V, G, H || o), I.createGeometry) {
      var q = D(F, r.group.units[0], r.structure, T, E, s);
      if (T6(q)) return q.then(function(z) {
        k(z), L(F);
      });
      k(q);
    } else k();
    L(F);
  }, getLoci: function(F) {
    return n ? p(F, o, n.id) : cr;
  }, mark: function(F, V) {
    var G = !0;
    if (ke.is(F)) {
      G = !1;
      for (var H = o.group.units[0].invariantId, q = 0, z = F.elements; q < z.length; q++)
        if (z[q].unit.invariantId === H) {
          G = !0;
          break;
        }
    }
    return !!G && Qt.mark(n, F, V, B, M);
  }, setVisibility: function(F) {
    Qt.setVisibility(n, F);
  }, setAlphaFactor: function(F) {
    Qt.setAlphaFactor(n, F);
  }, setPickable: function(F) {
    Qt.setPickable(n, F);
  }, setColorOnly: function(F) {
    Qt.setColorOnly(n, F);
  }, setTransform: function(F, V) {
    Qt.setTransform(n, F, V);
  }, setOverpaint: function(F, V) {
    var G = { geometry: s, props: i, webgl: V };
    Qt.setOverpaint(n, F, B, !0, G);
  }, setTransparency: function(F, V) {
    var G = { geometry: s, props: i, webgl: V };
    Qt.setTransparency(n, F, B, !0, G);
  }, setSubstance: function(F, V) {
    var G = { geometry: s, props: i, webgl: V };
    Qt.setSubstance(n, F, B, !0, G);
  }, setClipping: function(F) {
    Qt.setClipping(n, F, B, !0);
  }, destroy: function() {
    y == null || y(s), n && (n.state.disposed = !0, n = void 0);
  }, mustRecreate: v };
}
O(O({}, JO), Wa), O(O({}, $O), Wa);
var Kl = O(O({}, WO), Wa);
function Yl(e, t) {
  return mh(O(O({}, e), { setUpdateState: function(n, r, i, a, o, s, u) {
    e.setUpdateState(n, r, i, a, o, s, u), Ea.areEqual(a.size, o.size) || (n.createGeometry = !0);
  }, geometryUtils: Lt.Utils }), t);
}
var pJ = O(O({}, lJ), Wa), hJ = O(O({}, XO), Wa), gJ = O(O({}, cJ), Wa), I8 = O(O({}, ZO), Wa);
function P8(e, t) {
  return mh(O(O({}, e), { setUpdateState: function(n, r, i, a, o, s, u) {
    e.setUpdateState(n, r, i, a, o, s, u), Ea.areEqual(a.size, o.size) || (n.updateSize = !0);
  }, geometryUtils: Mn.Utils }), t);
}
O(O({}, QO), Wa), O(O({}, JO), Wa), O(O({}, $O), Wa);
var Ao = { create: function() {
  return O(O({}, en.createState()), { unitTransforms: null, unitTransformsVersion: -1 });
}, update: function(e, t) {
  en.updateState(e, t), t.unitTransforms !== void 0 && (e.unitTransforms = t.unitTransforms);
} };
function nB(e, t) {
  return { centerA: He.create(e, t), centerB: He.create(e, t) };
}
var vJ = function() {
  function e(t, n) {
    this.unit = n, this.hasNext = !1, this.traceElementIndex = n.model.atomicHierarchy.derived.residue.traceElementIndex, this.gapIt = Zn.transientSegments(sB(n), n.elements), this.value = nB(t, n), this.hasNext = this.gapIt.hasNext;
  }
  return e.prototype.move = function() {
    var t = this.unit, n = t.elements, r = t.residueIndex, i = this.gapIt.move();
    return this.value.centerA.element = this.traceElementIndex[r[n[i.start]]], this.value.centerB.element = this.traceElementIndex[r[n[i.end - 1]]], this.hasNext = this.gapIt.hasNext, this.value;
  }, e;
}(), yJ = function() {
  function e(t, n) {
    this.unit = n, this.hasNext = !1, this.gapIt = Zn.transientSegments(sB(n), n.elements), this.value = nB(t, n), this.hasNext = this.gapIt.hasNext;
  }
  return e.prototype.move = function() {
    var t = this.gapIt.move();
    return this.value.centerA.element = this.unit.elements[t.start], this.value.centerB.element = this.unit.elements[t.end - 1], this.hasNext = this.gapIt.hasNext, this.value;
  }, e;
}();
function bJ(e) {
  for (var t = e.atomicConformation, n = t.x, r = t.y, i = t.z, a = e.atomicHierarchy.derived.residue, o = a.polymerType, s = a.traceElementIndex, u = o.length, l = _e.ofBounds(0, e.atomicConformation.atomId.rowCount), c = Zn.transientSegments(e.atomicRanges.polymerRanges, l), d = Kt.transientSegments(e.atomicHierarchy.residueAtomSegments, l), f = new Float32Array(3 * u), p = new Float32Array(3 * u), g = 0, m = -1, v = -1, h = A(), y = A(), x = A(), S = A(), b = A(), _ = A(), C = A(), w = A(), I = A(), M = A(), E = A(), T = A(), P = A(), k = A(); c.hasNext; ) {
    var D = c.move();
    for (d.setSegment(D), g = -1, v = -1; d.hasNext; ) {
      g += 1;
      var B = d.move().index;
      g === 0 && (v = B);
      var L = 3 * (m = B - 2);
      A.copy(h, y), A.copy(y, x), A.copy(x, S);
      var F = s[B];
      if (A.set(S, n[F], r[F], i[F]), !(g < 3)) {
        A.sub(b, y, h), A.sub(_, x, y), A.sub(C, S, x), A.sub(E, b, _), A.sub(T, _, C), A.cross(P, E, T), A.normalize(P, P), A.toArray(P, p, L);
        var V = Math.cos(A.angle(E, T)), G = A.magnitude(E), H = A.magnitude(T), q = Math.sqrt(H * G) / Math.max(2, 2 * (1 - V));
        A.scale(w, E, q / G), A.sub(w, y, w), A.toArray(w, f, L), A.scale(I, T, q / H), A.sub(I, x, I), A.toArray(I, f, L + 3), A.copy(k, P);
      }
    }
    var z = 3 * v;
    A.fromArray(w, f, z + 3), A.fromArray(I, f, z + 6), A.normalize(P, A.sub(P, w, I));
    var K = s[v];
    A.set(h, n[K], r[K], i[K]), A.copy(M, h), A.projectPointOnVector(M, M, P, w), A.toArray(M, f, z);
    var Y = m + 2, Z = 3 * Y;
    A.fromArray(w, f, Z - 3), A.fromArray(I, f, Z - 6), A.normalize(P, A.sub(P, w, I));
    var X = s[Y];
    A.set(h, n[X], r[X], i[X]), A.copy(M, h), A.projectPointOnVector(M, M, P, w), A.toArray(M, f, Z);
  }
  return { centers: f };
}
var S_ = V1.createProvider({ label: "Helix Orientation", descriptor: Us({ name: "molstar_helix_orientation" }), type: "dynamic", defaultParams: {}, getParams: function() {
  return {};
}, isApplicable: function(e) {
  return !0;
}, obtain: function(e, t) {
  return se(void 0, 0, void 0, function() {
    return ie(this, function(n) {
      return [2, { value: bJ(t) }];
    });
  });
} });
function Ss(e) {
  return gn.is(e, 2);
}
function rB(e, t, n) {
  switch (n === void 0 && (n = {}), e.kind) {
    case 0:
      return new _J(e, t, n);
    case 1:
    case 2:
      return new xJ(e, t);
  }
}
var Sg = gn.create(536870912);
function iB(e, t) {
  return { center: He.create(e, t), centerPrev: He.create(e, t), centerNext: He.create(e, t), first: !1, last: !1, initial: !1, final: !1, secStrucFirst: !1, secStrucLast: !1, secStrucType: Sg, moleculeType: 0, coarseBackboneFirst: !1, coarseBackboneLast: !1, isCoarseBackbone: !1, p0: A(), p1: A(), p2: A(), p3: A(), p4: A(), d12: A(), d23: A() };
}
var Et = A(), I2 = A(), P2 = A(), _J = function() {
  function e(t, n, r) {
    var i;
    if (r === void 0 && (r = {}), this.unit = t, this.state = 0, this.p0 = A(), this.p1 = A(), this.p2 = A(), this.p3 = A(), this.p4 = A(), this.p5 = A(), this.p6 = A(), this.d01 = A(), this.d12 = A(), this.d23 = A(), this.d34 = A(), this.hasNext = !1, this.atomicConformation = t.model.atomicConformation, this.residueAtomSegments = t.model.atomicHierarchy.residueAtomSegments, this.polymerRanges = t.model.atomicRanges.polymerRanges, this.traceElementIndex = t.model.atomicHierarchy.derived.residue.traceElementIndex, this.directionFromElementIndex = t.model.atomicHierarchy.derived.residue.directionFromElementIndex, this.directionToElementIndex = t.model.atomicHierarchy.derived.residue.directionToElementIndex, this.moleculeType = t.model.atomicHierarchy.derived.residue.moleculeType, this.cyclicPolymerMap = t.model.atomicRanges.cyclicPolymerMap, this.polymerIt = Zn.transientSegments(this.polymerRanges, t.elements), this.residueIt = Kt.transientSegments(this.residueAtomSegments, t.elements), this.value = iB(n, t), this.hasNext = this.residueIt.hasNext && this.polymerIt.hasNext, r.ignoreSecondaryStructure || (this.secondaryStructure = (i = na.get(n).value) === null || i === void 0 ? void 0 : i.get(t.invariantId)), r.useHelixOrientation) {
      var a = S_.get(t.model).value;
      if (!a) throw new Error("missing helix-orientation");
      this.helixOrientationCenters = a.centers;
    }
  }
  return e.prototype.atomicPos = function(t, n) {
    n !== -1 && (t[0] = this.atomicConformation.x[n], t[1] = this.atomicConformation.y[n], t[2] = this.atomicConformation.z[n]);
  }, e.prototype.pos = function(t, n, r) {
    var i = this.traceElementIndex[n];
    this.helixOrientationCenters && Ss(r) ? A.fromArray(t, this.helixOrientationCenters, 3 * n) : this.atomicPos(t, i);
  }, e.prototype.updateResidueSegmentRange = function(t) {
    var n = this.residueAtomSegments.index;
    this.residueSegmentMin = n[this.polymerRanges[2 * t.index]], this.residueSegmentMax = n[this.polymerRanges[2 * t.index + 1]];
  }, e.prototype.getResidueIndex = function(t) {
    if (t < this.residueSegmentMin) t = (n = this.cyclicPolymerMap.get(this.residueSegmentMin)) !== void 0 ? n - (this.residueSegmentMin - t - 1) : this.residueSegmentMin;
    else if (t > this.residueSegmentMax) {
      var n;
      t = (n = this.cyclicPolymerMap.get(this.residueSegmentMax)) !== void 0 ? n + (t - this.residueSegmentMax - 1) : this.residueSegmentMax;
    }
    return t;
  }, e.prototype.getSecStruc = function(t) {
    if (this.secondaryStructure) {
      var n = this.secondaryStructure, r = n.type[(0, n.getIndex)(t)];
      return Ss(r) ? 2 : r;
    }
    return Sg;
  }, e.prototype.setControlPoint = function(t, n, r, i, a) {
    (function(o) {
      return gn.is(o, 4);
    })(a) || this.helixOrientationCenters && Ss(a) ? A.scale(t, A.add(t, n, A.add(t, i, A.add(t, r, r))), 1 / 4) : A.copy(t, r);
  }, e.prototype.setFromToVector = function(t, n, r) {
    this.value.isCoarseBackbone || this.helixOrientationCenters && Ss(r) ? A.set(t, 1, 0, 0) : (this.atomicPos(I2, this.directionFromElementIndex[n]), this.atomicPos(P2, this.directionToElementIndex[n]), A.sub(t, P2, I2));
  }, e.prototype.setDirection = function(t, n, r, i) {
    A.matchDirection(I2, n, r), A.matchDirection(P2, i, r), A.scale(t, A.add(t, I2, A.add(t, P2, A.add(t, r, r))), 1 / 4);
  }, e.prototype.move = function() {
    var t = this, n = t.residueIt, r = t.polymerIt, i = t.value;
    if (this.state === 0) {
      for (; r.hasNext; ) if (this.polymerSegment = r.move(), n.setSegment(this.polymerSegment), this.updateResidueSegmentRange(this.polymerSegment), n.hasNext) {
        this.state = 1;
        var a = this.residueAtomSegments.index[this.unit.elements[this.polymerSegment.start]], o = this.getResidueIndex(a - 1);
        this.currSecStrucType = a === o ? Sg : this.getSecStruc(o), this.nextSecStrucType = this.getSecStruc(a), this.currCoarseBackbone = this.directionFromElementIndex[o] === -1 || this.directionToElementIndex[o] === -1, this.nextCoarseBackbone = this.directionFromElementIndex[a] === -1 || this.directionToElementIndex[a] === -1;
        break;
      }
    }
    if (this.state === 1) {
      var s = n.move().index, u = this.getResidueIndex(s - 3), l = this.getResidueIndex(s - 2), c = this.getResidueIndex(s - 1), d = this.getResidueIndex(s + 1), f = this.getResidueIndex(s + 2), p = this.getResidueIndex(s + 3);
      this.prevSecStrucType = this.currSecStrucType, this.currSecStrucType = this.nextSecStrucType, this.nextSecStrucType = s === d ? Sg : this.getSecStruc(d), this.prevCoarseBackbone = this.currCoarseBackbone, this.currCoarseBackbone = this.nextCoarseBackbone, this.nextCoarseBackbone = this.directionFromElementIndex[d] === -1 || this.directionToElementIndex[d] === -1, i.secStrucType = this.currSecStrucType, i.secStrucFirst = this.prevSecStrucType !== this.currSecStrucType, i.secStrucLast = this.currSecStrucType !== this.nextSecStrucType, i.isCoarseBackbone = this.currCoarseBackbone, i.coarseBackboneFirst = this.prevCoarseBackbone !== this.currCoarseBackbone, i.coarseBackboneLast = this.currCoarseBackbone !== this.nextCoarseBackbone, i.first = s === this.residueSegmentMin, i.last = s === this.residueSegmentMax, i.moleculeType = this.moleculeType[s], i.initial = s === c, i.final = s === d, i.centerPrev.element = this.traceElementIndex[c], i.center.element = this.traceElementIndex[s], i.centerNext.element = this.traceElementIndex[d];
      var g = this.getSecStruc(u), m = this.getSecStruc(l), v = this.getSecStruc(c), h = this.getSecStruc(s), y = this.getSecStruc(d), x = this.getSecStruc(f), S = this.getSecStruc(p);
      this.pos(this.p0, u, g), this.pos(this.p1, l, m), this.pos(this.p2, c, v), this.pos(this.p3, s, h), this.pos(this.p4, d, y), this.pos(this.p5, f, x), this.pos(this.p6, p, S);
      var b = Ss(g), _ = Ss(m), C = Ss(v), w = Ss(h), I = Ss(y), M = Ss(x), E = Ss(S);
      this.helixOrientationCenters && (w !== C ? w ? (A.copy(this.p0, this.p3), A.copy(this.p1, this.p3), A.copy(this.p2, this.p3)) : C && (A.scale(Et, A.sub(Et, this.p2, this.p3), 2), A.add(this.p2, this.p3, Et), A.add(this.p1, this.p2, Et), A.add(this.p0, this.p1, Et)) : w !== _ ? w ? (A.copy(this.p0, this.p2), A.copy(this.p1, this.p2)) : _ && (A.scale(Et, A.sub(Et, this.p1, this.p2), 2), A.add(this.p1, this.p2, Et), A.add(this.p0, this.p1, Et)) : w !== b && (w ? A.copy(this.p0, this.p1) : b && (A.scale(Et, A.sub(Et, this.p0, this.p1), 2), A.add(this.p0, this.p1, Et))), w !== I ? w ? (A.copy(this.p4, this.p3), A.copy(this.p5, this.p3), A.copy(this.p6, this.p3)) : I && (A.scale(Et, A.sub(Et, this.p4, this.p3), 2), A.add(this.p4, this.p3, Et), A.add(this.p5, this.p4, Et), A.add(this.p6, this.p5, Et)) : w !== M ? w ? (A.copy(this.p5, this.p4), A.copy(this.p6, this.p4)) : M && (A.scale(Et, A.sub(Et, this.p5, this.p4), 2), A.add(this.p5, this.p4, Et), A.add(this.p6, this.p5, Et)) : w !== E && (w ? A.copy(this.p6, this.p5) : E && (A.scale(Et, A.sub(Et, this.p6, this.p5), 2), A.add(this.p6, this.p5, Et)))), this.setFromToVector(this.d01, c, v), this.setFromToVector(this.d12, s, h), this.setFromToVector(this.d23, d, y), this.setFromToVector(this.d34, f, x);
      var T = w && this.helixOrientationCenters, P = 1.5;
      s === c || h !== v && T ? (A.setMagnitude(Et, A.sub(Et, this.p3, this.p4), P), A.add(this.p2, this.p3, Et), A.add(this.p1, this.p2, Et), A.add(this.p0, this.p1, Et)) : c === l || h !== m && T ? (A.setMagnitude(Et, A.sub(Et, this.p2, this.p3), P), A.add(this.p1, this.p2, Et), A.add(this.p0, this.p1, Et)) : (l === u || h !== g && T) && (A.setMagnitude(Et, A.sub(Et, this.p1, this.p2), P), A.add(this.p0, this.p1, Et)), s === d || h !== y && T ? (A.setMagnitude(Et, A.sub(Et, this.p3, this.p2), P), A.add(this.p4, this.p3, Et), A.add(this.p5, this.p4, Et), A.add(this.p6, this.p5, Et)) : d === f || h !== x && T ? (A.setMagnitude(Et, A.sub(Et, this.p4, this.p3), P), A.add(this.p5, this.p4, Et), A.add(this.p6, this.p5, Et)) : (f === p || h !== S && T) && (A.setMagnitude(Et, A.sub(Et, this.p5, this.p4), P), A.add(this.p6, this.p5, Et)), this.setControlPoint(i.p0, this.p0, this.p1, this.p2, m), this.setControlPoint(i.p1, this.p1, this.p2, this.p3, v), this.setControlPoint(i.p2, this.p2, this.p3, this.p4, h), this.setControlPoint(i.p3, this.p3, this.p4, this.p5, y), this.setControlPoint(i.p4, this.p4, this.p5, this.p6, x), this.setDirection(i.d12, this.d01, this.d12, this.d23), this.setDirection(i.d23, this.d12, this.d23, this.d34), n.hasNext || (this.state = 0);
    }
    return this.hasNext = n.hasNext || r.hasNext, this.value;
  }, e;
}(), xJ = function() {
  function e(t, n) {
    switch (this.unit = t, this.state = 0, this.hasNext = !1, this.polymerIt = Zn.transientSegments(function(r) {
      switch (r.kind) {
        case 0:
          return r.model.atomicRanges.polymerRanges;
        case 1:
          return r.model.coarseHierarchy.spheres.polymerRanges;
        case 2:
          return r.model.coarseHierarchy.gaussians.polymerRanges;
      }
    }(t), t.elements), this.value = iB(n, t), A.set(this.value.d12, 1, 0, 0), A.set(this.value.d23, 1, 0, 0), t.kind) {
      case 1:
        this.conformation = t.model.coarseConformation.spheres;
        break;
      case 2:
        this.conformation = t.model.coarseConformation.gaussians;
    }
    this.hasNext = this.polymerIt.hasNext;
  }
  return e.prototype.getElementIndex = function(t) {
    return Math.min(Math.max(this.polymerSegment.start, t), this.polymerSegment.end - 1);
  }, e.prototype.pos = function(t, n) {
    var r = this.unit.elements[n];
    t[0] = this.conformation.x[r], t[1] = this.conformation.y[r], t[2] = this.conformation.z[r];
  }, e.prototype.move = function() {
    if (this.state === 0) {
      for (; this.polymerIt.hasNext; ) if (this.polymerSegment = this.polymerIt.move(), this.elementIndex = this.polymerSegment.start, this.elementIndex < this.polymerSegment.end) {
        this.state = 1;
        break;
      }
    }
    if (this.state === 1) {
      var t = this.getElementIndex(this.elementIndex - 2), n = this.getElementIndex(this.elementIndex - 1), r = this.getElementIndex(this.elementIndex + 1), i = this.getElementIndex(this.elementIndex + 2);
      this.value.centerPrev.element = this.value.center.unit.elements[n], this.value.center.element = this.value.center.unit.elements[this.elementIndex], this.value.centerNext.element = this.value.center.unit.elements[r], this.pos(this.value.p0, t), this.pos(this.value.p1, n), this.pos(this.value.p2, this.elementIndex), this.pos(this.value.p3, r), this.pos(this.value.p4, i);
      var a = 0.5;
      this.elementIndex === n ? (A.scale(Et, A.sub(Et, this.value.p2, this.value.p3), a), A.add(this.value.p1, this.value.p2, Et), A.add(this.value.p0, this.value.p1, Et)) : n === t && (A.scale(Et, A.sub(Et, this.value.p1, this.value.p2), a), A.add(this.value.p0, this.value.p1, Et)), this.elementIndex === r ? (A.scale(Et, A.sub(Et, this.value.p2, this.value.p1), a), A.add(this.value.p3, this.value.p2, Et), A.add(this.value.p4, this.value.p3, Et)) : r === i && (A.scale(Et, A.sub(Et, this.value.p3, this.value.p2), a), A.add(this.value.p4, this.value.p3, Et)), this.value.first = this.elementIndex === this.polymerSegment.start, this.value.last = this.elementIndex === this.polymerSegment.end - 1, this.elementIndex + 1 >= this.polymerSegment.end && (this.state = 0);
    }
    return this.hasNext = this.elementIndex + 1 < this.polymerSegment.end || this.polymerIt.hasNext, this.elementIndex += 1, this.value;
  }, e;
}(), Td = A.fromArray, l1 = A.toArray, F4 = A.normalize, CJ = A.sub, c1 = A.spline, SJ = A.slerp, Mw = A.copy, Ew = A.cross, V4 = A.orthogonalize, AJ = A.matchDirection, wJ = A.scale, Tw = A.add;
function aB(e) {
  var t = e + 1, n = 3 * t;
  return { curvePoints: new Float32Array(n), tangentVectors: new Float32Array(n), normalVectors: new Float32Array(n), binormalVectors: new Float32Array(n), widthValues: new Float32Array(t), heightValues: new Float32Array(t), linearSegments: e };
}
function oB(e, t, n, r) {
  (function(i, a, o, s) {
    for (var u = i.curvePoints, l = i.tangentVectors, c = i.linearSegments, d = a.p0, f = a.p1, p = a.p2, g = a.p3, m = a.p4, v = a.secStrucFirst, h = a.secStrucLast, y = 1 - s, x = v ? 0.5 : o, S = h ? 0.5 : o, b = 0; b <= c; ++b) {
      var _ = 1 * b / c;
      if (_ < y) {
        var C = si(x, o, _);
        c1(U4, d, f, p, g, _ + s, C), c1(G4, d, f, p, g, _ + s + 0.01, x), c1(z4, d, f, p, g, _ + s - 0.01, x);
      } else
        C = si(o, S, _), c1(U4, f, p, g, m, _ - y, C), c1(G4, f, p, g, m, _ - y + 0.01, C), c1(z4, f, p, g, m, _ - y - 0.01, C);
      l1(U4, u, 3 * b), F4(cc, CJ(cc, G4, z4)), l1(cc, l, 3 * b);
    }
  })(e, t, n, r), function(i, a) {
    var o = i.curvePoints, s = i.tangentVectors, u = i.normalVectors, l = i.binormalVectors, c = a.d12, d = a.d23, f = o.length / 3;
    Td(Dw, s, 0), Td(Ow, s, 3 * (f - 1)), V4(H4, Dw, c), V4(M2, Ow, d), AJ(M2, M2, H4), Mw(lp, H4);
    for (var p = f - 1, g = 0; g < f; ++g) {
      var m = bT(0, p, g) * p, v = g === 0 ? 0 : 1 / (f - m);
      Td(cc, s, 3 * g), V4(As, cc, SJ(IJ, lp, M2, v)), l1(As, u, 3 * g), Mw(lp, As), F4(d1, Ew(d1, cc, As)), l1(d1, l, 3 * g);
    }
    for (g = 1; g < p; ++g) Td(lp, u, 3 * (g - 1)), Td(As, u, 3 * g), Td(kw, u, 3 * (g + 1)), wJ(As, Tw(As, lp, Tw(As, kw, As)), 1 / 3), l1(As, u, 3 * g), Td(cc, s, 3 * g), F4(d1, Ew(d1, cc, As)), l1(d1, l, 3 * g);
  }(e, t);
}
var G4 = A(), z4 = A(), U4 = A(), IJ = A(), cc = A(), As = A(), d1 = A(), lp = A(), kw = A(), Dw = A(), Ow = A(), H4 = A(), M2 = A();
function Bw(e, t, n, r, i, a, o, s) {
  for (var u = e.widthValues, l = e.heightValues, c = e.linearSegments, d = 1 - s, f = 0; f <= c; ++f) {
    var p = 1 * f / c;
    p < d ? (u[f] = si(t, n, p + s), l[f] = si(i, a, p + s)) : (u[f] = si(n, r, p - d), l[f] = si(a, o, p - d));
  }
}
var Iv, A_, Pv, PJ = 0.5, MJ = 0.9, EJ = 0.5, TJ = 0.3, Rw = 2;
function sB(e) {
  switch (e.kind) {
    case 0:
      return e.model.atomicRanges.gapRanges;
    case 1:
      return e.model.coarseHierarchy.spheres.gapRanges;
    case 2:
      return e.model.coarseHierarchy.gaussians.gapRanges;
  }
}
function uB(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group.units[i];
    if (ve.isAtomic(s)) return jO(o, s, s.polymerElements[a]);
    var u = s.elements, l = s.polymerElements[a], c = _e.indexOf(u, l);
    if (c !== -1) return ke(o, [{ unit: s, indices: _e.ofSingleton(c) }]);
  }
  return cr;
}
function Lw(e, t, n, r, i, a) {
  for (var o = -1, s = -1, u = i; u <= a; u++)
    if (!((c = n[u]) < 0) && (o = _e.indexOf(t, c)) >= 0) {
      s = u;
      break;
    }
  if (o < 0) return !1;
  var l = o;
  for (u = a; u > s; u--) {
    var c;
    if (!((c = n[u]) < 0)) {
      var d = _e.indexOf(t, c);
      if (d >= 0) {
        l = d;
        break;
      }
    }
  }
  return r(le.ofRange(e + o, e + l));
}
function lB(e, t, n, r, i) {
  var a = !1, o = i.unit.elements, s = i.unit.model.atomicHierarchy.derived.residue.traceElementIndex, u = i.unit.model.atomicHierarchy.residueAtomSegments.index, l = n(i.unit);
  if (le.is(i.indices)) a = le.start(i.indices) === 0 && le.end(i.indices) === i.unit.elements.length ? r(le.ofBounds(e, e + t)) || a : Lw(e, l, s, r, p = u[o[le.min(i.indices)]], g = u[o[le.max(i.indices)]]) || a;
  else for (var c = i.indices, d = 0, f = c.length; d < f; d++) {
    for (var p, g = p = u[o[c[d]]], m = d + 1; m < f; ) {
      var v = u[o[c[m]]];
      if (v - g > 1) break;
      g = v, m++;
    }
    d = m - 1, a = Lw(e, l, s, r, p, g) || a;
  }
  return a;
}
function kJ(e) {
  return e.polymerElements;
}
function cB(e, t, n) {
  var r = !1;
  if (!ke.is(e)) return !1;
  var i = t.structure, a = t.group;
  if (!ze.areEquivalent(e.structure, i)) return !1;
  for (var o = a.units[0].polymerElements.length, s = 0, u = e.elements; s < u.length; s++) {
    var l = u[s];
    if (a.unitIndexMap.has(l.unit.id)) {
      var c = a.unitIndexMap.get(l.unit.id) * o;
      if (ve.isAtomic(l.unit)) r = lB(c, o, kJ, n, l) || r;
      else if (le.is(l.indices)) {
        var d = c + le.start(l.indices), f = c + le.end(l.indices);
        r = n(le.ofBounds(d, f)) || r;
      } else for (var p = 0, g = l.indices.length; p < g; p++) {
        d = l.indices[p];
        for (var m = p + 1; m < g && l.indices[m] === d; ) m++;
        p = m - 1, f = l.indices[p], r = n(le.ofRange(c + d, c + f)) || r;
      }
    }
  }
  return r;
}
function DJ(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group.units[i], u = _e.indexOf(s.elements, s.gapElements[a]), l = _e.indexOf(s.elements, s.gapElements[a % 2 ? a - 1 : a + 1]);
    if (u !== -1 && l !== -1) return pt.Loci(o, [pt.Location(o, s, u, o, s, l), pt.Location(o, s, l, o, s, u)]);
  }
  return cr;
}
function OJ(e, t, n) {
  var r = !1;
  if (pt.isLoci(e)) {
    var i = t.structure, a = t.group;
    if (!ze.areRootsEquivalent(e.structure, i)) return !1;
    e = pt.remapLoci(e, i);
    for (var o = a.units[0].gapElements.length, s = 0, u = e.bonds; s < u.length; s++) {
      var l = u[s], c = a.unitIndexMap.get(l.aUnit.id);
      if (c !== void 0) {
        var d = _e.indexOf(l.aUnit.gapElements, l.aUnit.elements[l.aIndex]), f = _e.indexOf(l.bUnit.gapElements, l.bUnit.elements[l.bIndex]);
        d !== -1 && f !== -1 && n(le.ofSingleton(c * o + d)) && (r = !0);
      }
    }
  } else if (ke.is(e)) {
    if (i = t.structure, a = t.group, !ze.areRootsEquivalent(e.structure, i)) return !1;
    e = ke.remap(e, i);
    for (var p = a.units[0].gapElements.length, g = function(h) {
      var y = a.unitIndexMap.get(h.unit.id);
      y !== void 0 && _e.forEach(h.indices, function(x) {
        var S = _e.indexOf(h.unit.gapElements, h.unit.elements[x]);
        S !== -1 && n(le.ofSingleton(y * p + S)) && (r = !0);
      });
    }, m = 0, v = e.elements; m < v.length; m++)
      g(v[m]);
  }
  return r;
}
function dB(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group.units[i];
    if (ve.isAtomic(s)) return jO(o, s, s.nucleotideElements[a]);
  }
  return cr;
}
function BJ(e) {
  return e.nucleotideElements;
}
function fB(e, t, n) {
  var r = !1;
  if (!ke.is(e)) return !1;
  var i = t.structure, a = t.group;
  if (!ze.areEquivalent(e.structure, i)) return !1;
  var o = a.units[0];
  if (!ve.isAtomic(o)) return !1;
  for (var s = o.nucleotideElements.length, u = 0, l = e.elements; u < l.length; u++) {
    var c = l[u];
    if (ve.isAtomic(c.unit) && a.unitIndexMap.has(c.unit.id)) {
      var d = a.unitIndexMap.get(c.unit.id) * s;
      ve.isAtomic(c.unit) && (r = lB(d, s, BJ, n, c) || r);
    }
  }
  return r;
}
(function(e) {
  e.fromGroup = function(t) {
    var n = t.group, r = t.structure, i = n.units[0].polymerElements, a = i.length, o = n.units.length, s = He.create(r);
    return zr(a, o, 1, function(u, l) {
      var c = n.units[l];
      return s.unit = c, s.element = i[u], s;
    });
  };
})(Iv || (Iv = {})), function(e) {
  e.fromGroup = function(t) {
    var n = t.group, r = t.structure, i = n.units[0].gapElements, a = i.length, o = n.units.length, s = He.create(r);
    return zr(a, o, 1, function(u, l) {
      var c = n.units[l];
      return s.unit = c, s.element = i[u], s;
    });
  };
}(A_ || (A_ = {})), function(e) {
  e.fromGroup = function(t) {
    var n = t.group, r = t.structure, i = n.units[0], a = ve.isAtomic(i) ? i.nucleotideElements : [], o = a.length, s = n.units.length, u = He.create(r);
    return zr(o, s, 1, function(l, c) {
      var d = n.units[c];
      return u.unit = d, u.element = a[l], u;
    });
  };
}(Pv || (Pv = {}));
var cp = A(), E2 = A(), Nw = A(), Fw = A(), Vw = A(), Gw = A(), T2 = A(), q4 = A(), j4 = A(), zw = A(), dp = ne.identity(), RJ = A(), Uw = _D(), mB = { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), radialSegments: N.Numeric(16, { min: 2, max: 56, step: 2 }, Qe.CustomQualityParamInfo) };
function LJ(e, t, n, r, i, a) {
  if (!ve.isAtomic(t)) return Lt.createEmpty(a);
  var o = t.nucleotideElements.length;
  if (!o) return Lt.createEmpty(a);
  for (var s = i.sizeFactor, u = i.radialSegments, l = o * (Uw.vertices.length / 3 + 2 * u), c = mt.createState(l, l / 4, a), d = t.elements, f = t.model, p = f.atomicHierarchy, g = p.chainAtomSegments, m = p.residueAtomSegments, v = p.atoms, h = p.index, y = f.atomicHierarchy.derived.residue, x = y.moleculeType, S = y.traceElementIndex, b = v.label_comp_id, _ = t.conformation.invariantPosition, C = Kt.transientSegments(g, d), w = Kt.transientSegments(m, d), I = { radiusTop: 1 * s, radiusBottom: 1 * s, radialSegments: u, bottomCap: !0 }, M = 0; C.hasNext; ) for (w.setSegment(C.move()); w.hasNext; ) {
    var E = w.move().index;
    if (Nm(x[E])) {
      var T = b.value(m.offsets[E]), P = -1, k = -1, D = -1, B = -1, L = -1, F = -1, V = 2.5 * s, G = 4.5, H = Ik(T), q = Pk(T);
      if (!H && !q) {
        var z = h.findAtomOnResidue(E, "C4"), K = h.findAtomOnResidue(E, "N9");
        z !== -1 && K !== -1 && A.distance(_(z, cp), _(K, E2)) < 1.6 ? H = !0 : q = !0;
      }
      H ? (G = 4.5, P = h.findAtomOnResidue(E, "N1"), k = h.findAtomOnResidue(E, "C4"), D = h.findAtomOnResidue(E, "C6"), B = h.findAtomOnResidue(E, "C2"), L = h.findAtomOnResidue(E, "N9"), F = S[E]) : q && (G = 3, P = h.findAtomOnResidue(E, "N3"), k = h.findAtomOnResidue(E, "C6"), D = h.findAtomOnResidue(E, "C4"), B = h.findAtomOnResidue(E, "C2"), (L = h.findAtomOnResidue(E, "N1")) === -1 && (L = h.findAtomOnResidue(E, "C1")), F = S[E]), L !== -1 && F !== -1 && (_(L, Vw), _(F, Gw), c.currentGroup = M, li(c, Vw, Gw, 1, I), P !== -1 && k !== -1 && D !== -1 && B !== -1 && (_(P, cp), _(k, E2), _(D, Nw), _(B, Fw), A.normalize(T2, A.sub(T2, E2, cp)), A.normalize(q4, A.sub(q4, Fw, Nw)), A.normalize(j4, A.cross(j4, T2, q4)), ne.targetTo(dp, cp, E2, j4), A.scaleAndAdd(zw, cp, T2, G / 2 - 0.2), ne.scale(dp, dp, A.set(RJ, 4.5, V, G)), ne.setTranslation(dp, zw), mt.addPrimitive(c, dp, Uw))), ++M;
    }
  }
  var Y = mt.getMesh(c), Z = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return Y.setBoundingSphere(Z), Y;
}
N.getDefaultValues(mB);
var pB = O(O({}, Kl), mB);
function NJ(e) {
  return Yl({ defaultProps: N.getDefaultValues(pB), createGeometry: LJ, createLocationIterator: Pv.fromGroup, getLoci: dB, eachLocation: fB, setUpdateState: function(t, n, r) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.radialSegments !== r.radialSegments;
  } }, e);
}
var k2 = A.zero(), dc = A.zero(), D2 = A.zero(), O2 = A.zero(), kd = A.zero(), f1 = A.zero(), B2 = A.zero(), Hw = A.zero(), qw = A.zero(), fp = A.zero(), fc = A.zero(), hB = { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), radialSegments: N.Numeric(16, { min: 2, max: 56, step: 2 }, Qe.CustomQualityParamInfo), detail: N.Numeric(0, { min: 0, max: 3, step: 1 }, Qe.CustomQualityParamInfo) };
N.getDefaultValues(hB);
var R2 = new Float32Array(54), FJ = new Uint32Array([0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 14, 15, 12, 13, 8, 9, 10, 11, 0, 1]), VJ = new Uint32Array([8, 12, 14, 16, 6, 4, 2, 0, 10]), GJ = new Uint32Array([9, 11, 1, 3, 5, 7, 17, 15, 13]), L2 = new Float32Array(36), zJ = new Uint32Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1]), UJ = new Uint32Array([0, 10, 8, 6, 4, 2]), HJ = new Uint32Array([1, 3, 5, 7, 9, 11]), jw = A.zero();
function Kw(e, t) {
  for (var n = [], r = 2; r < arguments.length; r++) n[r - 2] = arguments[r];
  for (var i = 0, a = n.length; i < a; ++i) {
    var o = n[i];
    A.toArray(A.add(jw, o, t), e, 2 * i * 3), A.toArray(A.sub(jw, o, t), e, 3 * (2 * i + 1));
  }
}
function qJ(e, t, n, r, i, a) {
  if (!ve.isAtomic(t)) return Lt.createEmpty(a);
  var o = t.nucleotideElements.length;
  if (!o) return Lt.createEmpty(a);
  for (var s = i.sizeFactor, u = i.radialSegments, l = i.detail, c = o * (26 + 2 * u), d = mt.createState(c, c / 4, a), f = t.elements, p = t.model, g = p.atomicHierarchy, m = g.chainAtomSegments, v = g.residueAtomSegments, h = g.atoms, y = g.index, x = p.atomicHierarchy.derived.residue, S = x.moleculeType, b = x.traceElementIndex, _ = h.label_comp_id, C = t.conformation.invariantPosition, w = Kt.transientSegments(m, f), I = Kt.transientSegments(v, f), M = 1 * s, E = 1.25 * s, T = { radiusTop: 1 * s, radiusBottom: 1 * s, radialSegments: u }, P = 0; w.hasNext; ) for (I.setSegment(w.move()); I.hasNext; ) {
    var k = I.move().index;
    if (Nm(S[k])) {
      var D = _.value(v.offsets[k]), B = -1, L = -1, F = -1, V = -1, G = -1, H = -1, q = -1, z = -1, K = -1, Y = -1;
      d.currentGroup = P;
      var Z = Ik(D), X = Pk(D);
      if (!Z && !X) {
        var W = y.findAtomOnResidue(k, "C4"), J = y.findAtomOnResidue(k, "N9");
        W !== -1 && J !== -1 && A.distance(C(W, kd), C(J, fp)) < 1.6 ? Z = !0 : X = !0;
      }
      Z ? (B = b[k], L = y.findAtomOnResidue(k, "N1"), F = y.findAtomOnResidue(k, "C2"), V = y.findAtomOnResidue(k, "N3"), G = y.findAtomOnResidue(k, "C4"), (H = y.findAtomOnResidue(k, "C5")) === -1 && (H = y.findAtomOnResidue(k, "N5")), q = y.findAtomOnResidue(k, "C6"), (z = y.findAtomOnResidue(k, "N7")) === -1 && (z = y.findAtomOnResidue(k, "C7")), K = y.findAtomOnResidue(k, "C8"), (Y = y.findAtomOnResidue(k, "N9")) !== -1 && B !== -1 && (C(Y, fp), C(B, k2), d.currentGroup = P, li(d, fp, k2, 1, T), mi(d, fp, M, l)), L !== -1 && F !== -1 && V !== -1 && G !== -1 && H !== -1 && q !== -1 && z !== -1 && K !== -1 && Y !== -1 && (C(L, dc), C(F, D2), C(V, O2), C(G, kd), C(H, f1), C(q, B2), C(z, Hw), C(K, qw), A.triangleNormal(fc, dc, kd, f1), A.scale(fc, fc, E), Kw(R2, fc, dc, D2, O2, kd, f1, B2, Hw, qw, fp), mt.addTriangleStrip(d, R2, FJ), mt.addTriangleFan(d, R2, VJ), mt.addTriangleFan(d, R2, GJ))) : X && (B = b[k], (L = y.findAtomOnResidue(k, "N1")) === -1 && (L = y.findAtomOnResidue(k, "C1")), F = y.findAtomOnResidue(k, "C2"), V = y.findAtomOnResidue(k, "N3"), G = y.findAtomOnResidue(k, "C4"), H = y.findAtomOnResidue(k, "C5"), q = y.findAtomOnResidue(k, "C6"), L !== -1 && B !== -1 && (C(L, dc), C(B, k2), d.currentGroup = P, li(d, dc, k2, 1, T), mi(d, dc, M, l)), L !== -1 && F !== -1 && V !== -1 && G !== -1 && H !== -1 && q !== -1 && (C(F, D2), C(V, O2), C(G, kd), C(H, f1), C(q, B2), A.triangleNormal(fc, dc, kd, f1), A.scale(fc, fc, E), Kw(L2, fc, dc, D2, O2, kd, f1, B2), mt.addTriangleStrip(d, L2, zJ), mt.addTriangleFan(d, L2, UJ), mt.addTriangleFan(d, L2, HJ))), ++P;
    }
  }
  var $ = mt.getMesh(d), ee = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return $.setBoundingSphere(ee), $;
}
var gB = O(O({}, Kl), hB);
function jJ(e) {
  return Yl({ defaultProps: N.getDefaultValues(gB), createGeometry: qJ, createLocationIterator: Pv.fromGroup, getLoci: dB, eachLocation: fB, setUpdateState: function(t, n, r) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.radialSegments !== r.radialSegments;
  } }, e);
}
var K4, Dd = A.zero(), m1 = A.zero(), Od = A.zero(), Yw = A.zero(), ii = p3(3, !1), Bd = ne.identity(), KJ = A.zero(), Ww = A.zero(), Xw = A.zero(), Y4 = A.zero(), YJ = 4, WJ = 4, XJ = 6, ZJ = (K4 || (K4 = function() {
  for (var e = uh(8), t = 0; t < 3; ++t) {
    var n = (t + 1) % 3;
    A.set(Dd, ii[3 * t], ii[3 * t + 1], -0.5), A.set(m1, ii[3 * n], ii[3 * n + 1], -0.5), A.set(Od, ii[3 * n], ii[3 * n + 1], 0.5), A.set(Yw, ii[3 * t], ii[3 * t + 1], 0.5), e.add(Dd, m1, Od), e.add(Od, Yw, Dd);
  }
  return A.set(Dd, ii[0], ii[1], -0.5), A.set(m1, ii[3], ii[4], -0.5), A.set(Od, ii[6], ii[7], -0.5), e.add(Od, m1, Dd), A.set(Dd, ii[0], ii[1], 0.5), A.set(m1, ii[3], ii[4], 0.5), A.set(Od, ii[6], ii[7], 0.5), e.add(Dd, m1, Od), e.getPrimitive();
}()), K4), vB = { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }) };
function QJ(e, t, n, r, i, a) {
  var o = t.polymerElements.length;
  if (!o) return Lt.createEmpty(a);
  for (var s = i.sizeFactor, u = 24 * o, l = mt.createState(u, u / 10, a), c = aB(1), d = c.normalVectors, f = c.binormalVectors, p = 0, g = rB(t, n); g.hasNext; ) {
    var m = g.move();
    l.currentGroup = p;
    var v = Nm(m.moleculeType), h = gn.is(m.secStrucType, 4);
    if (oB(c, m, v || h ? 0.5 : 0.9, v ? 0.3 : 0.5), h && !m.secStrucLast || !h) {
      var y = r.size.size(m.center) * s, x = YJ * y, S = WJ * y, b = XJ * y, _ = v ? f : d;
      A.fromArray(Ww, _, 0), A.fromArray(Xw, _, 3), A.normalize(Y4, A.add(Y4, Ww, Xw)), ne.targetTo(Bd, m.p3, m.p1, Y4), ne.mul(Bd, Bd, ne.rotY90Z180), ne.scale(Bd, Bd, A.set(KJ, b, S, x)), ne.setTranslation(Bd, m.p2), mt.addPrimitive(l, Bd, ZJ);
    }
    ++p;
  }
  var C = mt.getMesh(l), w = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return C.setBoundingSphere(w), C;
}
N.getDefaultValues(vB);
var yB = O(O({}, Kl), vB);
function JJ(e) {
  return Yl({ defaultProps: N.getDefaultValues(yB), createGeometry: QJ, createLocationIterator: Iv.fromGroup, getLoci: uB, eachLocation: cB, setUpdateState: function(t, n, r) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor;
  } }, e);
}
var W4 = 10, bB = { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), radialSegments: N.Numeric(16, { min: 2, max: 56, step: 2 }, Qe.CustomQualityParamInfo) };
function $J(e, t, n, r, i, a) {
  var o = t.gapElements.length;
  if (!o) return Lt.createEmpty(a);
  for (var s = i.sizeFactor, u = i.radialSegments, l = W4 * u * 2 * o * 2, c = mt.createState(l, l / 10, a), d = t.conformation.invariantPosition, f = A.zero(), p = A.zero(), g = { radiusTop: 1, radiusBottom: 1, topCap: !0, bottomCap: !0, radialSegments: u }, m = 0, v = function(_, C) {
    switch (C.kind) {
      case 0:
        return new vJ(_, C);
      case 1:
      case 2:
        return new yJ(_, C);
    }
  }(n, t); v.hasNext; ) {
    var h = v.move(), y = h.centerA, x = h.centerB;
    y.element === x.element || (d(y.element, f), d(x.element, p), g.radiusTop = g.radiusBottom = r.size.size(y) * s, c.currentGroup = m, o0(c, f, p, 0.5, W4, g), g.radiusTop = g.radiusBottom = r.size.size(x) * s, c.currentGroup = m + 1, o0(c, p, f, 0.5, W4, g)), m += 2;
  }
  var S = mt.getMesh(c), b = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return S.setBoundingSphere(b), S;
}
N.getDefaultValues(bB);
var _B = O(O({}, Kl), bB);
function e$(e) {
  return Yl({ defaultProps: N.getDefaultValues(_B), createGeometry: $J, createLocationIterator: A_.fromGroup, getLoci: DJ, eachLocation: OJ, setUpdateState: function(t, n, r) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.radialSegments !== r.radialSegments;
  } }, e);
}
var xn = A(), Dn = A(), t$ = A(), mo = A(), mu = A(), N2 = A(), F2 = A(), mp = A(), Es = A(), pu = A(), X4 = A(), mc = A(), pc = A(), hc = A(), gc = A(), Ko = A.fromArray, G1 = A.scale, Zo = A.add, gl = A.sub, n$ = A.magnitude, Zw = A.negate, w_ = A.copy, xB = A.cross, r$ = A.set, Nn = be.add3, i$ = be.add;
function V2(e, t, n, r, i, a, o, s, u) {
  var l = t.vertices, c = t.normals, d = t.indices, f = l.elementCount;
  if (Ko(xn, r, e), G1(F2, xn, o), G1(N2, xn, s), Ko(Dn, i, e), G1(mo, Dn, a), xB(pu, Dn, xn), Ko(Es, n, e), Zo(mc, Zo(mc, Es, mo), N2), gl(pc, Zo(pc, Es, mo), F2), gl(hc, gl(hc, Es, mo), F2), Zo(gc, gl(gc, Es, mo), N2), o < s ? (Nn(l, gc[0], gc[1], gc[2]), Nn(l, hc[0], hc[1], hc[2]), Nn(l, pc[0], pc[1], pc[2]), Nn(l, mc[0], mc[1], mc[2]), w_(mu, N2)) : (Nn(l, mc[0], mc[1], mc[2]), Nn(l, pc[0], pc[1], pc[2]), Nn(l, hc[0], hc[1], hc[2]), Nn(l, gc[0], gc[1], gc[2]), w_(mu, F2)), u) {
    for (var p = 0; p < 4; ++p) Nn(c, -pu[0], -pu[1], -pu[2]);
    Nn(d, f, f + 1, f + 2), Nn(d, f + 2, f + 3, f);
  } else {
    for (p = 0; p < 4; ++p) Nn(c, pu[0], pu[1], pu[2]);
    Nn(d, f + 2, f + 1, f), Nn(d, f, f + 3, f + 2);
  }
}
function Z4(e, t, n, r, i, a, o, s, u, l) {
  var c = e.currentGroup, d = e.vertices, f = e.normals, p = e.indices, g = e.groups, m = d.elementCount, v = 0;
  s > 0 ? (Ko(xn, t, 0), Ko(Dn, t, 3 * i), v = s / n$(gl(t$, Dn, xn))) : r$(mp, 0, 0, 0);
  for (var h = 0; h <= i; ++h) {
    var y = a[h], x = o[h], S = s === 0 ? x : s * (1 - h / i), b = 3 * h;
    Ko(mu, n, b), G1(mu, mu, S), Ko(mo, r, b), G1(mo, mo, y), s > 0 && (Ko(xn, n, b), Ko(Dn, r, b), G1(mp, xB(mp, xn, Dn), v)), Ko(Es, t, b), Ko(pu, n, b), Ko(X4, r, b), Zo(xn, Zo(xn, Es, mo), mu), Zo(Dn, pu, mp), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), Zo(xn, gl(xn, Es, mo), mu), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), Zw(Dn, X4), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), gl(xn, gl(xn, Es, mo), mu), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), Zo(Dn, Zw(Dn, pu), mp), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), gl(xn, Zo(xn, Es, mo), mu), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), w_(Dn, X4), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]), Zo(xn, Zo(xn, Es, mo), mu), Nn(d, xn[0], xn[1], xn[2]), Nn(f, Dn[0], Dn[1], Dn[2]);
  }
  for (h = 0; h < i; ++h) {
    for (var _ = 0; _ < 2; _++) Nn(p, m + 8 * h + 2 * _, m + 8 * (h + 1) + 2 * _ + 1, m + 8 * h + 2 * _ + 1), Nn(p, m + 8 * h + 2 * _, m + 8 * (h + 1) + 2 * _, m + 8 * (h + 1) + 2 * _ + 1);
    for (_ = 2; _ < 4; _++) Nn(p, m + 8 * h + 2 * _, m + 8 * (h + 1) + 2 * _, m + 8 * h + 2 * _ + 1), Nn(p, m + 8 * (h + 1) + 2 * _, m + 8 * (h + 1) + 2 * _ + 1, m + 8 * h + 2 * _ + 1);
  }
  if (u) {
    var y = a[0], x = o[0], C = s === 0 ? x : s;
    V2(0, e, t, n, r, y, C, C, !1);
  } else s > 0 && (V2(0, e, t, n, r, y = a[0], s, -(x = o[0]), !1), V2(0, e, t, n, r, y, -s, x, !1));
  l && s === 0 && V2(3 * i, e, t, n, r, y = a[i], x = o[i], x, !0), h = 0;
  for (var w = 8 * (i + 1) + (u ? 4 : s > 0 ? 8 : 0) + (l && s === 0 ? 4 : 0); h < w; ++h) i$(g, c);
}
var Lr = A(), Zr = A(), _a = A(), ki = A(), aa = A();
function G2(e, t, n, r, i) {
  e[0] = t[0] * r + n[0] * i, e[1] = t[1] * r + n[1] * i, e[2] = t[2] * r + n[2] * i;
}
function p1(e, t, n, r, i, a) {
  e[0] = t[0] * i + n[0] * a + r[0], e[1] = t[1] * i + n[1] * a + r[1], e[2] = t[2] * i + n[2] * a + r[2];
}
var el = A.fromArray, a$ = A.normalize, Q4 = A.scaleAndAdd, Qw = A.cross, o$ = A.dot, s$ = A.unitX, oa = be.add3, J4 = /* @__PURE__ */ new Map();
function Jw(e, t, n, r, i, a, o, s, u, l, c) {
  for (var d = e.currentGroup, f = e.vertices, p = e.normals, g = e.indices, m = e.groups, v = f.elementCount, h = function(L, F) {
    var V = F ? 1 : 0, G = as(L, V);
    if (!J4.has(G)) {
      for (var H = [], q = [], z = 0; z < L; ++z) {
        var K = (2 * z + V) / L * Math.PI;
        H[z] = Math.cos(K), q[z] = Math.sin(K);
      }
      J4.set(G, { cos: H, sin: q });
    }
    return J4.get(G);
  }(a, c === "rounded"), y = h.cos, x = h.sin, S = Math.round(a / 4), b = 3 * S, _ = 0; _ <= i; ++_) {
    var C = 3 * _;
    el(ki, n, C), el(aa, r, C), el(_a, t, C);
    for (var w = o[_], I = s[_], M = c === "rounded" && I > w, E = 0; E < a; ++E) {
      if (M) {
        p1(Zr, ki, aa, _a, w * y[E], w * x[E]);
        var T = o$(aa, s$) < 0 ? E < S || E >= b ? I - w : -I + w : E >= S && E < b ? -I + w : I - w;
        Q4(Zr, Zr, ki, T), E === S || E === S - 1 ? G2(Lr, ki, aa, 0, 1) : E === b || E === b - 1 ? G2(Lr, ki, aa, 0, -1) : G2(Lr, ki, aa, y[E], x[E]);
      } else p1(Zr, ki, aa, _a, I * y[E], w * x[E]), G2(Lr, ki, aa, w * y[E], I * x[E]);
      a$(Lr, Lr), oa(f, Zr[0], Zr[1], Zr[2]), oa(p, Lr[0], Lr[1], Lr[2]);
    }
  }
  var P = Math.round(a / 2);
  for (_ = 0; _ < i; ++_) {
    for (E = 0; E < P; ++E) oa(g, v + _ * a + (E + 1) % a, v + (_ + 1) * a + (E + 1) % a, v + _ * a + E), oa(g, v + (_ + 1) * a + (E + 1) % a, v + (_ + 1) * a + E, v + _ * a + E);
    for (E = P; E < a; ++E) oa(g, v + _ * a + (E + 1) % a, v + (_ + 1) * a + E, v + _ * a + E), oa(g, v + (_ + 1) * a + (E + 1) % a, v + (_ + 1) * a + E, v + _ * a + (E + 1) % a);
  }
  if (u) {
    var k = 0, D = f.elementCount;
    for (el(ki, n, k), el(aa, r, k), el(_a, t, k), Qw(Lr, aa, ki), oa(f, _a[0], _a[1], _a[2]), oa(p, Lr[0], Lr[1], Lr[2]), w = o[0], I = s[0], (M = c === "rounded" && I > w) && (I -= w), v = f.elementCount, _ = 0; _ < a; ++_) M ? (p1(Zr, ki, aa, _a, w * y[_], w * x[_]), Q4(Zr, Zr, ki, _ < S || _ >= b ? I : -I)) : p1(Zr, ki, aa, _a, I * y[_], w * x[_]), oa(f, Zr[0], Zr[1], Zr[2]), oa(p, Lr[0], Lr[1], Lr[2]), oa(g, v + (_ + 1) % a, v + _, D);
  }
  if (l)
    for (k = 3 * i, D = f.elementCount, el(ki, n, k), el(aa, r, k), el(_a, t, k), Qw(Lr, ki, aa), oa(f, _a[0], _a[1], _a[2]), oa(p, Lr[0], Lr[1], Lr[2]), w = o[i], I = s[i], (M = c === "rounded" && I > w) && (I -= w), v = f.elementCount, _ = 0; _ < a; ++_) M ? (p1(Zr, ki, aa, _a, w * y[_], w * x[_]), Q4(Zr, Zr, ki, _ < S || _ >= b ? I : -I)) : p1(Zr, ki, aa, _a, I * y[_], w * x[_]), oa(f, Zr[0], Zr[1], Zr[2]), oa(p, Lr[0], Lr[1], Lr[2]), oa(g, v + _, v + (_ + 1) % a, D);
  var B = (i + 1) * a + (u ? a + 1 : 0) + (l ? a + 1 : 0);
  be.addRepeat(m, B, d);
}
var tl = A.fromArray, u$ = A.magnitude, $4 = A.sub, $w = A.add, eb = A.scale, l$ = A.negate, c$ = A.copy, d$ = A.cross, Go = be.add3, f$ = be.add, ai = A(), Di = A(), m$ = A(), tb = A(), Rd = A(), eI = A(), pp = A(), p$ = A(), nb = A();
function rb(e, t, n, r, i, a, o, s) {
  var u = e.currentGroup, l = e.vertices, c = e.normals, d = e.indices, f = e.groups, p = l.elementCount, g = 0;
  s > 0 && (tl(ai, t, 0), tl(Di, t, 3 * i), g = s / u$($4(m$, Di, ai)));
  for (var m = 0; m <= i; ++m) {
    var v = a[m], h = o[m], y = s === 0 ? h : s * (1 - m / i), x = 3 * m;
    tl(Rd, n, x), eb(Rd, Rd, y), tl(tb, r, x), eb(tb, tb, v), s > 0 && (tl(ai, n, x), tl(Di, r, x), eb(eI, d$(eI, ai, Di), g)), tl(pp, t, x), tl(p$, n, x), tl(nb, r, x), $w(ai, pp, Rd), l$(Di, nb), Go(l, ai[0], ai[1], ai[2]), Go(c, Di[0], Di[1], Di[2]), $4(ai, pp, Rd), Go(l, ai[0], ai[1], ai[2]), Go(c, Di[0], Di[1], Di[2]), $w(ai, pp, Rd), c$(Di, nb), Go(l, ai[0], ai[1], ai[2]), Go(c, Di[0], Di[1], Di[2]), $4(ai, pp, Rd), Go(l, ai[0], ai[1], ai[2]), Go(c, Di[0], Di[1], Di[2]);
  }
  for (m = 0; m < i; ++m) Go(d, p + 4 * m, p + 4 * (m + 1) + 1, p + 4 * m + 1), Go(d, p + 4 * m, p + 4 * (m + 1), p + 4 * (m + 1) + 1), Go(d, p + 4 * m + 2 + 1, p + 4 * (m + 1) + 2 + 1, p + 4 * m + 2), Go(d, p + 4 * m + 2, p + 4 * (m + 1) + 2 + 1, p + 4 * (m + 1) + 2);
  m = 0;
  for (var S = 4 * (i + 1); m < S; ++m) f$(f, u);
}
var CB = { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), aspectRatio: N.Numeric(5, { min: 0.1, max: 10, step: 0.1 }), arrowFactor: N.Numeric(1.5, { min: 0, max: 3, step: 0.1 }, { description: "Size factor for sheet arrows" }), tubularHelices: N.Boolean(!1, { description: "Draw alpha helices as tubes" }), helixProfile: N.Select("elliptical", N.arrayToOptions(["elliptical", "rounded", "square"]), { description: "Protein and nucleic helix trace profile" }), detail: N.Numeric(0, { min: 0, max: 3, step: 1 }, Qe.CustomQualityParamInfo), linearSegments: N.Numeric(8, { min: 1, max: 48, step: 1 }, Qe.CustomQualityParamInfo), radialSegments: N.Numeric(16, { min: 2, max: 56, step: 2 }, Qe.CustomQualityParamInfo) };
N.getDefaultValues(CB);
var Na = A();
function h$(e, t, n, r, i, a) {
  var o = t.polymerElements.length;
  if (!o) return Lt.createEmpty(a);
  for (var s = i.sizeFactor, u = i.detail, l = i.linearSegments, c = i.radialSegments, d = i.aspectRatio, f = i.arrowFactor, p = i.tubularHelices, g = i.helixProfile, m = l * c * o + (c + 1) * o * 2, v = mt.createState(m, m / 10, a), h = ve.isCoarse(t), y = aB(l), x = y.curvePoints, S = y.normalVectors, b = y.binormalVectors, _ = y.widthValues, C = y.heightValues, w = 0, I = rB(t, n, { ignoreSecondaryStructure: !1, useHelixOrientation: p }); I.hasNext; ) {
    var M = I.move();
    v.currentGroup = w;
    var E = Nm(M.moleculeType), T = gn.is(M.secStrucType, 4), P = gn.is(M.secStrucType, 2), k = E ? TJ : EJ;
    oB(y, M, P && !p ? MJ : PJ, k);
    var D = r.size.size(M.centerPrev) * s, B = r.size.size(M.center) * s, L = r.size.size(M.centerNext) * s;
    h && (D *= d / 2, B *= d / 2, L *= d / 2);
    var F = M.secStrucFirst || M.coarseBackboneFirst || M.first, V = M.secStrucLast || M.coarseBackboneLast || M.last, G = l;
    if (M.initial) {
      var H = l - (G = Math.max(Math.round(l * k), 1));
      x.copyWithin(0, 3 * H), b.copyWithin(0, 3 * H), S.copyWithin(0, 3 * H), A.fromArray(Na, x, 3), A.normalize(Na, A.sub(Na, M.p2, Na)), A.scaleAndAdd(Na, M.p2, Na, B * Rw), A.toArray(Na, x, 0);
    } else M.final && (G = Math.max(Math.round(l * (1 - k)), 1), A.fromArray(Na, x, 3 * G - 3), A.normalize(Na, A.sub(Na, M.p2, Na)), A.scaleAndAdd(Na, M.p2, Na, B * Rw), A.toArray(Na, x, 3 * G));
    if (M.initial === !0 && M.final === !0) mi(v, M.p2, 2 * B, u);
    else if (T) {
      var q = D * d, z = B * d, K = L * d, Y = M.secStrucLast ? z * f : 0;
      Bw(y, D, B, L, q, z, K, k), c === 2 ? rb(v, x, S, b, G, _, C, Y) : Z4(v, x, S, b, G, _, C, Y, F, V);
    } else {
      q = void 0, z = void 0, K = void 0, P && !M.isCoarseBackbone ? p ? (q = D *= 1.5 * d, z = B *= 1.5 * d, K = L *= 1.5 * d) : (q = D * d, z = B * d, K = L * d) : E && !M.isCoarseBackbone ? (q = D * d, z = B * d, K = L * d) : (q = D, z = B, K = L), Bw(y, D, B, L, q, z, K, k);
      var Z = E && !M.isCoarseBackbone ? [b, S] : [S, b], X = Z[0], W = Z[1];
      if (E && !M.isCoarseBackbone) for (var J = 0, $ = X.length; J < $; J++) X[J] *= -1;
      c === 2 ? E && !M.isCoarseBackbone ? rb(v, x, X, W, G, C, _, 0) : rb(v, x, X, W, G, _, C, 0) : c === 4 ? Z4(v, x, X, W, G, _, C, 0, F, V) : z === B ? Jw(v, x, X, W, G, c, _, C, F, V, "elliptical") : g === "square" ? Z4(v, x, X, W, G, _, C, 0, F, V) : Jw(v, x, X, W, G, c, _, C, F, V, g);
    }
    ++w;
  }
  var ee = mt.getMesh(v), ce = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return ee.setBoundingSphere(ce), ee;
}
var SB = O(O({}, Kl), CB);
function g$(e) {
  return Yl({ defaultProps: N.getDefaultValues(SB), createGeometry: h$, createLocationIterator: Iv.fromGroup, getLoci: uB, eachLocation: cB, setUpdateState: function(t, n, r, i, a, o, s) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.tubularHelices !== r.tubularHelices || n.detail !== r.detail || n.linearSegments !== r.linearSegments || n.radialSegments !== r.radialSegments || n.aspectRatio !== r.aspectRatio || n.arrowFactor !== r.arrowFactor || n.helixProfile !== r.helixProfile;
    var u = na.get(o.structure).version;
    t.info.secondaryStructureHash !== u && (t.createGeometry = t.info.secondaryStructureHash !== void 0, t.info.secondaryStructureHash = u);
  } }, e);
}
var AB = { "polymer-trace": function(e, t) {
  return ca("Polymer trace mesh", e, t, g$);
}, "polymer-gap": function(e, t) {
  return ca("Polymer gap cylinder", e, t, e$);
}, "nucleotide-block": function(e, t) {
  return ca("Nucleotide block mesh", e, t, NJ);
}, "nucleotide-ring": function(e, t) {
  return ca("Nucleotide ring mesh", e, t, jJ);
}, "direction-wedge": function(e, t) {
  return ca("Polymer direction wedge", e, t, JJ);
} }, tI = O(O(O(O(O(O({}, SB), _B), pB), gB), yB), { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.01 }), visuals: N.MultiSelect(["polymer-trace", "polymer-gap", "nucleotide-ring"], N.objectToOptions(AB)), bumpFrequency: N.Numeric(2, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory) }), V0, ml = { name: "cartoon", label: "Cartoon", description: "Displays ribbons, planks, tubes smoothly following the trace atoms of polymers.", factory: function(e, t) {
  return en.createMulti("Cartoon", e, t, Ao, AB);
}, getParams: function(e, t) {
  var n = N.clone(tI), r = !1, i = !1;
  return t.units.forEach(function(a) {
    !r && ve.isAtomic(a) && a.nucleotideElements.length && (r = !0), !i && a.gapElements.length && (i = !0);
  }), n.visuals.defaultValue = ["polymer-trace"], r && n.visuals.defaultValue.push("nucleotide-ring"), i && n.visuals.defaultValue.push("polymer-gap"), n;
}, defaultValues: N.getDefaultValues(tI), defaultColorTheme: { name: "chain-id" }, defaultSizeTheme: { name: "uniform" }, isApplicable: function(e) {
  return e.polymerResidueCount > 0;
}, ensureCustomProperties: { attach: function(e, t) {
  return se(void 0, 0, void 0, function() {
    var n, r, i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return [4, na.attach(e, t, void 0, !0)];
        case 1:
          a.sent(), n = 0, r = t.models, a.label = 2;
        case 2:
          return n < r.length ? (i = r[n], [4, S_.attach(e, i, void 0, !0)]) : [3, 5];
        case 3:
          a.sent(), a.label = 4;
        case 4:
          return n++, [3, 2];
        case 5:
          return [2];
      }
    });
  });
}, detach: function(e) {
  na.ref(e, !1);
  for (var t = 0, n = e.models; t < n.length; t++) {
    var r = n[t];
    S_.ref(r, !1);
  }
} } }, v$ = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.elementCount ? [4, na.attach({ runtime: go, assetManager: new vl() }, e)] : [3, 2];
        case 1:
          i.sent(), i.label = 2;
        case 2:
          return (r = ml.factory(t, ml.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("uniform", { structure: e }) }), [4, r.createOrUpdate(O(O({}, ml.defaultValues), { quality: "auto" }), e).run()];
        case 3:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("uniform", { structure: t }) }), t.elementCount ? [4, na.attach({ runtime: go, assetManager: new vl() }, t)] : [3, 2];
        case 1:
          i.sent(), i.label = 2;
        case 2:
          return [4, e.createOrUpdate({}, t).run()];
        case 3:
          return i.sent(), [2];
      }
    });
  });
} }, z2 = A(), U2 = A(), Ld = A(), ib = be.add, nI = be.add3;
(function(e) {
  e.create = function(t, n, r) {
    t === void 0 && (t = 2048), n === void 0 && (n = 1024);
    var i = be.create(Float32Array, 1, n, r ? r.groupBuffer.ref.value : t), a = be.create(Float32Array, 3, n, r ? r.startBuffer.ref.value : t), o = be.create(Float32Array, 3, n, r ? r.endBuffer.ref.value : t), s = be.create(Float32Array, 1, n, r ? r.scaleBuffer.ref.value : t), u = be.create(Float32Array, 1, n, r ? r.capBuffer.ref.value : t), l = function(d, f, p, g, m, v, h, y, x, S) {
      for (var b = 0; b < 6; ++b) nI(a, d, f, p), nI(o, g, m, v), ib(i, S), ib(s, h), ib(u, (y ? 1 : 0) + (x ? 2 : 0));
    }, c = function(d, f, p, g, m, v, h) {
      var y = A.distance(d, f), x = Math.floor(p / 2), S = 1 / p;
      A.sub(Ld, f, d);
      for (var b = 0; b < x; ++b) {
        var _ = S * (2 * b + 1);
        A.setMagnitude(Ld, Ld, y * _), A.add(z2, d, Ld), A.setMagnitude(Ld, Ld, y * S * (2 * (b + 1))), A.add(U2, d, Ld), l(z2[0], z2[1], z2[2], U2[0], U2[1], U2[2], g, m, v, h);
      }
    };
    return { add: l, addFixedCountDashes: c, addFixedLengthDashes: function(d, f, p, g, m, v, h) {
      var y = A.distance(d, f);
      c(d, f, y / p, g, m, v, h);
    }, getCylinders: function() {
      var d = i.elementCount / 6, f = be.compact(i, !0), p = be.compact(a, !0), g = be.compact(o, !0), m = be.compact(s, !0), v = be.compact(u, !0), h = r && d <= r.cylinderCount ? r.mappingBuffer.ref.value : new Float32Array(18 * d), y = r && d <= r.cylinderCount ? r.indexBuffer.ref.value : new Uint32Array(12 * d);
      return (!r || d > r.cylinderCount) && function(x, S, b) {
        for (var _ = 0; _ < x; ++_) {
          var C = 18 * _;
          S[C] = -1, S[C + 1] = 1, S[C + 2] = -1, S[C + 3] = -1, S[C + 4] = -1, S[C + 5] = -1, S[C + 6] = 1, S[C + 7] = 1, S[C + 8] = -1, S[C + 9] = 1, S[C + 10] = 1, S[C + 11] = 1, S[C + 12] = 1, S[C + 13] = -1, S[C + 14] = -1, S[C + 15] = 1, S[C + 16] = -1, S[C + 17] = 1;
        }
        for (_ = 0; _ < x; ++_) {
          var w = 6 * _, I = 12 * _;
          b[I] = w, b[I + 1] = w + 1, b[I + 2] = w + 2, b[I + 3] = w + 1, b[I + 4] = w + 4, b[I + 5] = w + 2, b[I + 6] = w + 2, b[I + 7] = w + 4, b[I + 8] = w + 3, b[I + 9] = w + 4, b[I + 10] = w + 5, b[I + 11] = w + 3;
        }
      }(d, h, y), fa.create(h, y, f, p, g, m, v, d, r);
    } };
  };
})(V0 || (V0 = {}));
var w3 = { linkScale: N.Numeric(0.45, { min: 0, max: 1, step: 0.01 }), linkSpacing: N.Numeric(1, { min: 0, max: 2, step: 0.01 }), linkCap: N.Boolean(!1), aromaticScale: N.Numeric(0.3, { min: 0, max: 1, step: 0.01 }), aromaticSpacing: N.Numeric(1.5, { min: 0, max: 3, step: 0.01 }), aromaticDashCount: N.Numeric(2, { min: 2, max: 6, step: 2 }), dashCount: N.Numeric(4, { min: 2, max: 10, step: 2 }), dashScale: N.Numeric(0.8, { min: 0, max: 2, step: 0.1 }), dashCap: N.Boolean(!0), stubCap: N.Boolean(!0), radialSegments: N.Numeric(16, { min: 2, max: 56, step: 2 }, Qe.CustomQualityParamInfo) };
N.getDefaultValues(w3);
var wB = { linkScale: N.Numeric(0.5, { min: 0, max: 1, step: 0.1 }), linkSpacing: N.Numeric(0.1, { min: 0, max: 2, step: 0.01 }), aromaticDashCount: N.Numeric(2, { min: 2, max: 6, step: 2 }), dashCount: N.Numeric(4, { min: 2, max: 10, step: 2 }) };
N.getDefaultValues(wB);
var bn = A(), vc = A(), zo = A(), y$ = A.create(0, 1, 0);
function M8(e, t, n, r) {
  A.normalize(vc, A.sub(vc, t, n)), r !== null ? A.sub(zo, t, r) : A.copy(zo, t), A.normalize(zo, zo);
  var i = A.dot(vc, zo);
  return 1 - Math.abs(i) < 1e-5 && (A.set(zo, 1, 0, 0), i = A.dot(vc, zo), 1 - Math.abs(i) < 1e-5 && (A.set(zo, 0, 1, 0), i = A.dot(vc, zo))), A.setMagnitude(vc, vc, i), A.sub(zo, zo, vc), A.normalize(e, zo);
}
var po = A.scale, Br = A.add, ar = A.sub, Ki = A.setMagnitude, b$ = A.dot;
function I3(e, t, n, r) {
  var i = t.linkCount, a = t.referencePosition, o = t.position, s = t.style, u = t.radius, l = t.ignore, c = t.stub;
  if (!i) return { mesh: Lt.createEmpty(r) };
  for (var d = n.linkScale, f = n.linkSpacing, p = n.radialSegments, g = n.linkCap, m = n.aromaticScale, v = n.aromaticSpacing, h = n.aromaticDashCount, y = n.dashCount, x = n.dashScale, S = n.dashCap, b = n.stubCap, _ = 2 * p * i * 2, C = mt.createState(_, _ / 4, r), w = A(), I = A(), M = A(), E = A(), T = 0, P = { radiusTop: 1, radiusBottom: 1, radialSegments: p, topCap: g, bottomCap: g }, k = y + 1, D = 0, B = i; D < B; ++D) if (!l || !l(D)) {
    o(w, I, D), Br(E, E, w), Br(E, E, I), T += 2, ar(bn, I, w);
    var L = b$(bn, y$) > 0, F = u(D), V = s ? s(D) : 0, G = b && !!c && c(D), H = L ? [G, g] : [g, G], q = H[0], z = H[1];
    C.currentGroup = D;
    var K = h + 1;
    if (V === 0) P.radiusTop = P.radiusBottom = F, P.topCap = q, P.bottomCap = z, li(C, w, I, 0.5, P);
    else if (V === 1) P.radiusTop = P.radiusBottom = F * x, P.topCap = P.bottomCap = S, o0(C, w, I, 0.5, k, P);
    else if (V === 2 || V === 3 || V === 4 || V === 5 || V === 7 || V === 8) {
      var Y = V === 2 || V === 3 ? 2 : V === 4 || V === 5 ? 3 : 1.5, Z = F * (d / (0.5 * Y)), X = (F - Z) * f;
      if (M8(M, w, I, a ? a(D) : null), P.topCap = q, P.bottomCap = z, V === 7 || V === 8) {
        P.radiusTop = P.radiusBottom = F, li(C, w, I, 0.5, P);
        var W = F + m * F + m * F * v;
        Ki(bn, ar(bn, I, w), 0.5 * F), Br(w, w, bn), ar(I, I, bn), P.radiusTop = P.radiusBottom = F * m, P.topCap = P.bottomCap = S, Ki(M, M, W), ar(w, w, M), ar(I, I, M), o0(C, w, I, 0.5, K, P), V === 8 && (Ki(M, M, 2 * W), Br(w, w, M), Br(I, I, M), o0(C, w, I, 0.5, K, P));
      } else if (V === 3 || V === 5) {
        var J = F + Z + d * F * f;
        Ki(M, M, J), P.radiusTop = P.radiusBottom = F, li(C, w, I, 0.5, P), po(bn, bn, f * d * 0.2), Br(w, w, bn), ar(I, I, bn), P.radiusTop = P.radiusBottom = Z, P.topCap = L ? G : S, P.bottomCap = L ? S : G, Ki(M, M, J), ar(w, w, M), ar(I, I, M), li(C, w, I, 0.5, P), Y === 3 && (Ki(M, M, 2 * J), Br(w, w, M), Br(I, I, M), li(C, w, I, 0.5, P));
      } else Ki(M, M, X), P.radiusTop = P.radiusBottom = Z, Y === 3 && li(C, w, I, 0.5, P), yW(C, w, I, 0.5, M, P);
    } else V === 6 && (po(bn, bn, 0.475), Br(w, w, bn), ar(I, I, bn), P.radiusTop = P.radiusBottom = F, P.topCap = q, P.bottomCap = z, li(C, w, I, 0.5, P));
  }
  var $ = r ? pe.clone(r.boundingSphere) : void 0, ee = mt.getMesh(C);
  return T === 0 ? { mesh: ee } : (A.scale(E, E, 1 / T), $ && A.distance(E, $.center) / $.radius < 1 ? { mesh: ee, boundingSphere: $ } : { mesh: ee });
}
function IB(e, t, n, r) {
  var i = t.linkCount, a = t.referencePosition, o = t.position, s = t.style, u = t.radius, l = t.ignore, c = t.stub;
  if (!i) return { cylinders: fa.createEmpty(r) };
  for (var d = n.linkScale, f = n.linkSpacing, p = n.linkCap, g = n.aromaticScale, m = n.aromaticSpacing, v = n.aromaticDashCount, h = n.dashCount, y = n.dashScale, x = n.dashCap, S = n.stubCap, b = 2 * i, _ = V0.create(b, b / 4, r), C = A(), w = A(), I = A(), M = A(), E = A(), T = 0, P = h % 2 == 1 ? h : h + 1, k = 0.5 - 0.25 / P, D = v + 1, B = 0.5 - 0.25 / D, L = 0, F = i; L < F; ++L) if (!l || !l(L)) {
    o(C, w, L), Br(E, E, C), Br(E, E, w), T += 2;
    var V = u(L), G = s ? s(L) : 0, H = S && !!c && c(L);
    if (G === 0) po(I, Br(I, C, w), 0.5), _.add(C[0], C[1], C[2], I[0], I[1], I[2], 1, p, H, L);
    else if (G === 1) po(bn, ar(bn, w, C), k), ar(w, w, bn), _.addFixedCountDashes(C, w, P, y, x, x, L);
    else if (G === 2 || G === 3 || G === 4 || G === 5 || G === 7 || G === 8) {
      var q = G === 2 || G === 3 ? 2 : G === 4 || G === 5 ? 3 : 1.5, z = d / (0.5 * q), K = (V - z * V) * f;
      if (po(I, Br(I, C, w), 0.5), M8(M, C, w, a ? a(L) : null), G === 7 || G === 8) {
        _.add(C[0], C[1], C[2], I[0], I[1], I[2], 1, p, H, L);
        var Y = V + g * V + g * V * m;
        po(bn, ar(bn, w, C), B), ar(w, w, bn), Ki(bn, ar(bn, w, C), 0.5 * V), Br(C, C, bn), Ki(M, M, Y), ar(C, C, M), ar(w, w, M), _.addFixedCountDashes(C, w, D, g, x, x, L), G === 8 && (Ki(M, M, 2 * Y), Br(C, C, M), Br(w, w, M), _.addFixedCountDashes(C, w, D, g, x, x, L));
      } else G === 3 || G === 5 ? (Ki(M, M, V + z * V + d * V * f), _.add(C[0], C[1], C[2], I[0], I[1], I[2], 1, p, H, L), Ki(bn, ar(bn, C, w), V / 1.5), ar(C, C, bn), q === 3 && _.add(C[0] + M[0], C[1] + M[1], C[2] + M[2], I[0] + M[0], I[1] + M[1], I[2] + M[2], z, p, H, L), _.add(C[0] - M[0], C[1] - M[1], C[2] - M[2], I[0] - M[0], I[1] - M[1], I[2] - M[2], z, x, H, L)) : (Ki(M, M, K), q === 3 && _.add(C[0], C[1], C[2], I[0], I[1], I[2], z, p, H, L), _.add(C[0] + M[0], C[1] + M[1], C[2] + M[2], I[0] + M[0], I[1] + M[1], I[2] + M[2], z, p, H, L), _.add(C[0] - M[0], C[1] - M[1], C[2] - M[2], I[0] - M[0], I[1] - M[1], I[2] - M[2], z, p, H, L));
    } else G === 6 && (po(bn, ar(bn, w, C), 0.475), Br(C, C, bn), ar(w, w, bn), _.add(C[0], C[1], C[2], w[0], w[1], w[2], 1, p, H, L));
  }
  var Z = r ? pe.clone(r.boundingSphere) : void 0, X = _.getCylinders();
  return T === 0 ? { cylinders: X } : (A.scale(E, E, 1 / T), Z && A.distance(E, Z.center) / Z.radius < 1 ? { cylinders: X, boundingSphere: Z } : { cylinders: X });
}
function PB(e, t, n, r) {
  var i = t.linkCount, a = t.referencePosition, o = t.position, s = t.style, u = t.ignore;
  if (!i) return { lines: Mn.createEmpty(r) };
  for (var l = n.linkScale, c = n.linkSpacing, d = n.aromaticDashCount, f = n.dashCount, p = 2 * i, g = zi.create(p, p / 4, r), m = A(), v = A(), h = A(), y = A(), x = A(), S = 0, b = f % 2 == 1 ? f : f + 1, _ = 0.5 - 0.25 / b, C = d + 1, w = 0.5 - 0.25 / C, I = 0, M = i; I < M; ++I) if (!u || !u(I)) {
    o(m, v, I), Br(x, x, m), Br(x, x, v), S += 2;
    var E = s ? s(I) : 0;
    if (E === 0) po(h, Br(h, m, v), 0.5), g.add(m[0], m[1], m[2], h[0], h[1], h[2], I);
    else if (E === 1) po(bn, ar(bn, v, m), _), ar(v, v, bn), g.addFixedCountDashes(m, v, b, I);
    else if (E === 2 || E === 3 || E === 4 || E === 5 || E === 7 || E === 8) {
      var T = E === 2 || E === 3 ? 2 : E === 4 || E === 5 ? 3 : 1.5, P = (1 - l / (0.5 * T) * 1) * c;
      po(h, Br(h, m, v), 0.5), M8(y, m, v, a ? a(I) : null), E === 7 || E === 8 ? (g.add(m[0], m[1], m[2], h[0], h[1], h[2], I), po(bn, ar(bn, v, m), w), ar(v, v, bn), Ki(y, y, 4.5 * P), ar(m, m, y), ar(v, v, y), g.addFixedCountDashes(m, v, C, I), E === 8 && (Ki(y, y, 4.5 * P * 2), Br(m, m, y), Br(v, v, y), g.addFixedCountDashes(m, v, C, I))) : E === 3 || E === 5 ? (Ki(y, y, 3 * P), g.add(m[0], m[1], m[2], h[0], h[1], h[2], I), po(bn, ar(bn, m, v), c * l), ar(m, m, bn), T === 3 && g.add(m[0] + y[0], m[1] + y[1], m[2] + y[2], h[0] + y[0], h[1] + y[1], h[2] + y[2], I), g.add(m[0] - y[0], m[1] - y[1], m[2] - y[2], h[0] - y[0], h[1] - y[1], h[2] - y[2], I)) : (Ki(y, y, 1.5 * P), T === 3 && g.add(m[0], m[1], m[2], h[0], h[1], h[2], I), g.add(m[0] + y[0], m[1] + y[1], m[2] + y[2], h[0] + y[0], h[1] + y[1], h[2] + y[2], I), g.add(m[0] - y[0], m[1] - y[1], m[2] - y[2], h[0] - y[0], h[1] - y[1], h[2] - y[2], I));
    } else E === 6 && (po(bn, ar(bn, v, m), 0.475), Br(m, m, bn), ar(v, v, bn), g.add(m[0], m[1], m[2], v[0], v[1], v[2], I));
  }
  var k = r ? pe.clone(r.boundingSphere) : void 0, D = g.getLines();
  return S === 0 ? { lines: D } : (A.scale(x, x, 1 / S), k && A.distance(x, k.center) / k.radius < 1 ? { lines: D, boundingSphere: k } : { lines: D });
}
var E8 = { includeTypes: N.MultiSelect(E6(cn.Names), N.objectToOptions(cn.Names)), excludeTypes: N.MultiSelect([], N.objectToOptions(cn.Names)), ignoreHydrogens: N.Boolean(!1), aromaticBonds: N.Boolean(!0, { description: "Display aromatic bonds with dashes" }), multipleBonds: N.Select("symmetric", N.arrayToOptions(["off", "symmetric", "offset"])) };
N.getDefaultValues(E8);
var T8 = O(O(O({}, w3), E8), { adjustCylinderLength: N.Boolean(!1, { description: "Shorten cylinders to reduce overlap with spheres. Useful for for transparent bonds. Not working well with aromatic bonds." }) });
N.getDefaultValues(T8);
var ld, k8 = O(O({}, wB), E8);
function P3(e, t, n) {
  return !cn.is(e, n) || cn.is(t, n);
}
function MB(e, t, n) {
  var r = t.elements, i = t.model.atomicHierarchy.derived.atom.atomicNumber, a = t.bonds, o = a.a, s = a.b, u = a.edgeProps.flags, l = n.ignoreHydrogens, c = n.includeTypes, d = n.excludeTypes, f = cn.fromNames(c), p = cn.fromNames(d), g = cn.isAll(f) && p === 0, m = e.child, v = m == null ? void 0 : m.unitMap.get(t.id);
  if (m && !v) throw new Error("expected childUnit to exist if child exists");
  if (!g || l || m) return function(h) {
    return !!v && !Me.has(v.elements, r[o[h]]) || l && (C_(i, r[o[h]]) || C_(i, r[s[h]])) || !g && P3(f, p, u[h]);
  };
}
function EB(e, t) {
  var n = e.interUnitBonds.edges, r = t.ignoreHydrogens, i = t.includeTypes, a = t.excludeTypes, o = cn.fromNames(i), s = cn.fromNames(a), u = cn.isAll(o) && s === 0, l = e.child;
  if (!u || r || l) return function(c) {
    if (l) {
      var d = n[c], f = l.unitMap.get(d.unitA);
      if (!f) return !0;
      var p = e.unitMap.get(d.unitA).elements[d.indexA];
      if (!Me.has(f.elements, p)) return !0;
    }
    if (r) {
      d = n[c];
      var g = e.unitMap.get(d.unitA), m = e.unitMap.get(d.unitB);
      if (x_(g, g.elements[d.indexA]) || x_(m, m.elements[d.indexB])) return !0;
    }
    return !(u || !P3(o, s, n[c].props.flag));
  };
}
function I_(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group.units[i];
    if (ve.isAtomic(s)) {
      var u = o.target, l = s.bonds.a[a], c = s.bonds.b[a];
      return pt.Loci(u, [pt.Location(u, s, l, u, s, c), pt.Location(u, s, c, u, s, l)]);
    }
  }
  return cr;
}
function P_(e, t, n, r) {
  var i = !1;
  if (pt.isLoci(e)) {
    var a = t.structure, o = t.group;
    if (!ze.areEquivalent(e.structure, a)) return !1;
    var s = o.units[0];
    if (!ve.isAtomic(s)) return !1;
    for (var u = 2 * s.bonds.edgeCount, l = 0, c = e.bonds; l < c.length; l++) {
      var d = c[l];
      if (d.aUnit === d.bUnit) {
        var f = o.unitIndexMap.get(d.aUnit.id);
        if (f !== void 0) {
          var p = s.bonds.getDirectedEdgeIndex(d.aIndex, d.bIndex);
          p !== -1 && n(le.ofSingleton(f * u + p)) && (i = !0);
        }
      }
    }
  } else if (ke.is(e)) {
    if (a = t.structure, o = t.group, !ze.areEquivalent(e.structure, a) || (s = o.units[0], !ve.isAtomic(s))) return !1;
    for (var g = 2 * s.bonds.edgeCount, m = function(y) {
      var x = o.unitIndexMap.get(y.unit.id);
      if (x !== void 0) {
        var S = s.bonds, b = S.offset, _ = S.b;
        _e.forEach(y.indices, function(C) {
          for (var w = b[C], I = b[C + 1]; w < I; w++) r && !_e.has(y.indices, _[w]) || n(le.ofSingleton(x * g + w)) && (i = !0);
        });
      }
    }, v = 0, h = e.elements; v < h.length; v++)
      m(h[v]);
  }
  return i;
}
function M_(e, t, n) {
  var r = e.objectId, i = e.groupId;
  if (n === r) {
    var a = t.target, o = t.interUnitBonds.edges[i], s = t.unitMap.get(o.unitA), u = t.unitMap.get(o.unitB);
    return pt.Loci(a, [pt.Location(a, s, o.indexA, a, u, o.indexB), pt.Location(a, u, o.indexB, a, s, o.indexA)]);
  }
  return cr;
}
N.getDefaultValues(k8), function(e) {
  e.fromGroup = function(t) {
    var n = t.group, r = t.structure, i = n.units[0], a = ve.isAtomic(i) ? 2 * i.bonds.edgeCount : 0, o = n.units.length, s = pt.Location(r, void 0, void 0, r, void 0, void 0);
    return zr(a, o, 1, function(u, l) {
      var c = n.units[l];
      return s.aUnit = c, s.bUnit = c, s.aIndex = c.bonds.a[u], s.bIndex = c.bonds.b[u], s;
    });
  }, e.fromStructure = function(t) {
    var n = t.interUnitBonds.edgeCount, r = pt.Location(t, void 0, void 0, t, void 0, void 0);
    return zr(n, 1, 1, function(i) {
      var a = t.interUnitBonds.edges[i];
      return r.aUnit = t.unitMap.get(a.unitA), r.aIndex = a.indexA, r.bUnit = t.unitMap.get(a.unitB), r.bIndex = a.indexB, r;
    }, !0);
  };
}(ld || (ld = {}));
var ab = /* @__PURE__ */ new Map();
function E_(e, t, n, r) {
  var i = !1;
  if (pt.isLoci(e)) {
    if (!ze.areEquivalent(e.structure, t)) return !1;
    for (var a = 0, o = e.bonds; a < o.length; a++) {
      var s = o[a], u = t.interUnitBonds.getBondIndexFromLocation(s);
      u !== -1 && n(le.ofSingleton(u)) && (i = !0);
    }
  } else if (ke.is(e)) {
    if (!ze.areEquivalent(e.structure, t) || r && e.elements.length === 1) return !1;
    for (var l = 0, c = e.elements; l < c.length; l++) {
      var d = c[l];
      ab.set(d.unit.id, d.indices);
    }
    for (var f = function(m) {
      var v = m.unit;
      if (!ve.isAtomic(v)) return "continue";
      t.interUnitBonds.getConnectedUnits(v.id).forEach(function(h) {
        var y = ab.get(h.unitB);
        r && !y || _e.forEach(m.indices, function(x) {
          h.connectedIndices.includes(x) && h.getEdges(x).forEach(function(S) {
            if (!r || y && _e.has(y, S.indexB)) {
              var b = t.interUnitBonds.getEdgeIndex(x, v.id, S.indexB, h.unitB);
              n(le.ofSingleton(b)) && (i = !0);
            }
          });
        });
      });
    }, p = 0, g = e.elements; p < g.length; p++)
      f(d = g[p]);
    ab.clear();
  }
  return i;
}
var ob = cn.is;
function TB(e, t, n, r) {
  var i, a = e.elements, o = e.bonds, s = o.edgeCount, u = o.a, l = o.b, c = o.edgeProps, d = o.offset, f = c.order, p = c.flags, g = r.sizeFactor, m = r.sizeAspectRatio, v = r.adjustCylinderLength, h = r.aromaticBonds, y = r.includeTypes, x = r.excludeTypes, S = r.multipleBonds, b = S === "off", _ = S === "symmetric", C = P3(cn.fromNames(y), cn.fromNames(x), 32), w = A(), I = A(), M = e.conformation.invariantPosition, E = He.create(t, e), T = pt.Location(t, e, void 0, t, e, void 0), P = t.child;
  if (r.includeParent && P) {
    var k = P.unitMap.get(e.id);
    if (!k) throw new Error("expected childUnit to exist");
    i = function(V) {
      var G = a[u[V]], H = a[l[V]];
      return Me.has(k.elements, G) && !Me.has(k.elements, H);
    };
  }
  var D = e.rings, B = D.elementRingIndices, L = D.elementAromaticRingIndices, F = h ? e.resonance.delocalizedTriplets : void 0;
  return { linkCount: 2 * s, referencePosition: function(V) {
    var G, H, q = u[V], z = l[V], K = F == null ? void 0 : F.getThirdElement(q, z);
    if (K !== void 0) return M(a[K], w);
    q > z && (q = (G = [z, q])[0], z = G[1]), d[q + 1] - d[q] == 1 && (q = (H = [z, q])[0], z = H[1]);
    for (var Y = L.get(q) || B.get(q), Z = 0, X = d[q], W = d[q + 1]; X < W; ++X) {
      var J = l[X];
      if (J !== z && J !== q) {
        if (!Y) return M(a[J], w);
        var $ = L.get(J) || B.get(J);
        if (!$) continue;
        var ee = Yg(Y, $);
        ee > Z && (Z = ee, M(a[J], w));
      }
    }
    return Z > 0 ? w : null;
  }, position: function(V, G, H) {
    if (M(a[u[H]], V), M(a[l[H]], G), v) {
      var q = function(X) {
        return E.element = a[u[X]], n.size.size(E) * g;
      }(H), z = function(X) {
        return E.element = a[l[X]], n.size.size(E) * g;
      }(H), K = Math.min(q, z) * m, Y = Math.sqrt(Math.max(0, q * q - K * K)) - 0.05, Z = Math.sqrt(Math.max(0, z * z - K * K)) - 0.05;
      if (Y <= 0.01 && Z <= 0.01) return;
      A.normalize(I, A.sub(I, G, V)), A.scaleAndAdd(V, V, I, Y), A.scaleAndAdd(G, G, I, -Z);
    }
  }, style: function(V) {
    var G = f[V], H = p[V];
    if (ob(H, 2) || ob(H, 4)) return 1;
    if (G === 3) return b ? 0 : _ ? 4 : 5;
    if (h) {
      var q = u[V], z = l[V], K = L.get(q), Y = L.get(z), Z = K && Y ? Yg(K, Y) : 0;
      if (ob(H, 16) || Z && !C) {
        if (Z === 2) return 8;
        if (Z === 1 || F != null && F.getThirdElement(q, z)) return 7;
      }
    }
    return G !== 2 || b ? 0 : _ ? 2 : 3;
  }, radius: function(V) {
    return function(G) {
      return T.aIndex = u[G], T.bIndex = l[G], n.size.size(T) * g;
    }(V) * m;
  }, ignore: MB(t, e, r), stub: i };
}
function _$(e, t, n, r, i, a) {
  if (!ve.isAtomic(t) || !t.bonds.edgeCount) return fa.createEmpty(a);
  var o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id);
  if (o && !s) return fa.createEmpty(a);
  var u = IB(0, TB(t, n, r, i), i, a), l = u.cylinders, c = u.boundingSphere;
  if (c) l.setBoundingSphere(c);
  else if (l.cylinderCount > 0) {
    var d = pe.expand(pe(), (s ?? t).boundary.sphere, 1 * i.sizeFactor);
    l.setBoundingSphere(d);
  }
  return l;
}
function x$(e, t, n, r, i, a) {
  if (!ve.isAtomic(t) || !t.bonds.edgeCount) return Lt.createEmpty(a);
  var o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id);
  if (o && !s) return Lt.createEmpty(a);
  var u = I3(0, TB(t, n, r, i), i, a), l = u.mesh, c = u.boundingSphere;
  if (c) l.setBoundingSphere(c);
  else if (l.triangleCount > 0) {
    var d = pe.expand(pe(), (s ?? t).boundary.sphere, 1 * i.sizeFactor);
    l.setBoundingSphere(d);
  }
  return l;
}
var Mv = O(O(O(O({}, Kl), hJ), T8), { sizeFactor: N.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), sizeAspectRatio: N.Numeric(2 / 3, { min: 0, max: 3, step: 0.01 }), tryUseImpostor: N.Boolean(!0), includeParent: N.Boolean(!1) });
function kB(e, t, n, r) {
  return n.tryUseImpostor && r && r.extensions.fragDepth ? function(i) {
    return function(a, o) {
      return mh(O(O({}, a), { setUpdateState: function(s, u, l, c, d, f, p) {
        a.setUpdateState(s, u, l, c, d, f, p), Ea.areEqual(c.size, d.size) || (s.updateSize = !0);
      }, geometryUtils: fa.Utils }), o);
    }({ defaultProps: N.getDefaultValues(Mv), createGeometry: _$, createLocationIterator: ld.fromGroup, getLoci: I_, eachLocation: P_, setUpdateState: function(a, o, s, u, l, c, d) {
      a.createGeometry = o.sizeAspectRatio !== s.sizeAspectRatio || o.linkScale !== s.linkScale || o.linkSpacing !== s.linkSpacing || o.ignoreHydrogens !== s.ignoreHydrogens || o.linkCap !== s.linkCap || o.aromaticScale !== s.aromaticScale || o.aromaticSpacing !== s.aromaticSpacing || o.aromaticDashCount !== s.aromaticDashCount || o.dashCount !== s.dashCount || o.dashScale !== s.dashScale || o.dashCap !== s.dashCap || o.stubCap !== s.stubCap || !Pa(o.includeTypes, s.includeTypes) || !Pa(o.excludeTypes, s.excludeTypes) || o.adjustCylinderLength !== s.adjustCylinderLength || o.aromaticBonds !== s.aromaticBonds || o.multipleBonds !== s.multipleBonds;
      var f = c.group.units[0], p = d.group.units[0];
      ve.isAtomic(f) && ve.isAtomic(p) && (to.areEqual(f.bonds, p.bonds) || (a.createGeometry = !0, a.updateTransform = !0, a.updateColor = !0, a.updateSize = !0));
    }, mustRecreate: function(a, o, s) {
      return !o.tryUseImpostor || !s;
    } }, i);
  }(e) : function(i) {
    return Yl({ defaultProps: N.getDefaultValues(Mv), createGeometry: x$, createLocationIterator: ld.fromGroup, getLoci: I_, eachLocation: P_, setUpdateState: function(a, o, s, u, l, c, d) {
      a.createGeometry = o.sizeFactor !== s.sizeFactor || o.sizeAspectRatio !== s.sizeAspectRatio || o.radialSegments !== s.radialSegments || o.linkScale !== s.linkScale || o.linkSpacing !== s.linkSpacing || o.ignoreHydrogens !== s.ignoreHydrogens || o.linkCap !== s.linkCap || o.aromaticScale !== s.aromaticScale || o.aromaticSpacing !== s.aromaticSpacing || o.aromaticDashCount !== s.aromaticDashCount || o.dashCount !== s.dashCount || o.dashScale !== s.dashScale || o.dashCap !== s.dashCap || o.stubCap !== s.stubCap || !Pa(o.includeTypes, s.includeTypes) || !Pa(o.excludeTypes, s.excludeTypes) || o.adjustCylinderLength !== s.adjustCylinderLength || o.aromaticBonds !== s.aromaticBonds || o.multipleBonds !== s.multipleBonds;
      var f = c.group.units[0], p = d.group.units[0];
      ve.isAtomic(f) && ve.isAtomic(p) && (to.areEqual(f.bonds, p.bonds) || (a.createGeometry = !0, a.updateTransform = !0, a.updateColor = !0, a.updateSize = !0));
    }, mustRecreate: function(a, o, s) {
      return o.tryUseImpostor && !!s;
    } }, i);
  }(e);
}
var sb = new pt.ElementBondIterator();
function rI(e, t, n, r) {
  for (sb.setElement(t, n, r); sb.hasNext; ) {
    var i = sb.move();
    return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex], e), e;
  }
  return null;
}
var iI = A();
function DB(e, t, n) {
  var r, i = He.create(e), a = pt.Location(e, void 0, void 0, e, void 0, void 0), o = e.interUnitBonds, s = o.edgeCount, u = o.edges, l = n.sizeFactor, c = n.sizeAspectRatio, d = n.adjustCylinderLength, f = n.aromaticBonds, p = n.multipleBonds, g = p === "off", m = p === "symmetric", v = A(), h = e.child;
  return n.includeParent && h && (r = function(y) {
    var x = u[y], S = h.unitMap.get(x.unitA), b = h.unitMap.get(x.unitB), _ = e.unitMap.get(x.unitA).elements[x.indexA], C = e.unitMap.get(x.unitB).elements[x.indexB];
    return S && Me.has(S.elements, _) && (!b || !Me.has(b.elements, C));
  }), { linkCount: s, referencePosition: function(y) {
    var x, S, b, _, C = u[y];
    if (C.unitA < C.unitB) x = e.unitMap.get(C.unitA), S = e.unitMap.get(C.unitB), b = C.indexA, _ = C.indexB;
    else {
      if (!(C.unitA > C.unitB)) throw new Error("same units in createInterUnitBondCylinderMesh");
      x = e.unitMap.get(C.unitB), S = e.unitMap.get(C.unitA), b = C.indexB, _ = C.indexA;
    }
    return rI(iI, e, x, b) || rI(iI, e, S, _);
  }, position: function(y, x, S) {
    var b = u[S], _ = e.unitMap.get(b.unitA), C = e.unitMap.get(b.unitB);
    if (_.conformation.position(_.elements[b.indexA], y), C.conformation.position(C.elements[b.indexB], x), d) {
      var w = function(P) {
        var k = u[P];
        return i.unit = e.unitMap.get(k.unitA), i.element = i.unit.elements[k.indexA], t.size.size(i) * l;
      }(S), I = function(P) {
        var k = u[P];
        return i.unit = e.unitMap.get(k.unitB), i.element = i.unit.elements[k.indexB], t.size.size(i) * l;
      }(S), M = Math.min(w, I) * c, E = Math.sqrt(Math.max(0, w * w - M * M)) - 0.05, T = Math.sqrt(Math.max(0, I * I - M * M)) - 0.05;
      if (E <= 0.01 && T <= 0.01) return;
      A.normalize(v, A.sub(v, x, y)), A.scaleAndAdd(y, y, v, E), A.scaleAndAdd(x, x, v, -T);
    }
  }, style: function(y) {
    var x = u[y].props.order, S = Qi.create(u[y].props.flag);
    return cn.is(S, 2) || cn.is(S, 4) ? 1 : x === 3 ? g ? 0 : m ? 4 : 5 : f && cn.is(S, 16) ? 7 : x !== 2 || g ? 0 : m ? 2 : 3;
  }, radius: function(y) {
    return function(x) {
      var S = u[x];
      return a.aUnit = e.unitMap.get(S.unitA), a.aIndex = S.indexA, a.bUnit = e.unitMap.get(S.unitB), a.bIndex = S.indexB, t.size.size(a) * l;
    }(y) * c;
  }, ignore: EB(e, n), stub: r };
}
function C$(e, t, n, r, i) {
  if (!t.interUnitBonds.edgeCount) return fa.createEmpty(i);
  var a = IB(0, DB(t, n, r), r, i), o = a.cylinders, s = a.boundingSphere;
  if (s) o.setBoundingSphere(s);
  else if (o.cylinderCount > 0) {
    var u = t.child, l = pe.expand(pe(), (u ?? t).boundary.sphere, 1 * r.sizeFactor);
    o.setBoundingSphere(l);
  }
  return o;
}
function S$(e, t, n, r, i) {
  if (!t.interUnitBonds.edgeCount) return Lt.createEmpty(i);
  var a = I3(0, DB(t, n, r), r, i), o = a.mesh, s = a.boundingSphere;
  if (s) o.setBoundingSphere(s);
  else if (o.triangleCount > 0) {
    var u = t.child, l = pe.expand(pe(), (u ?? t).boundary.sphere, 1 * r.sizeFactor);
    o.setBoundingSphere(l);
  }
  return o;
}
var Ev = O(O(O(O({}, eB), dJ), T8), { sizeFactor: N.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), sizeAspectRatio: N.Numeric(2 / 3, { min: 0, max: 3, step: 0.01 }), tryUseImpostor: N.Boolean(!0), includeParent: N.Boolean(!1) });
function OB(e, t, n, r) {
  return n.tryUseImpostor && r && r.extensions.fragDepth ? function(i) {
    return function(a, o) {
      return A3(O(O({}, a), { setUpdateState: function(s, u, l, c, d, f, p) {
        a.setUpdateState(s, u, l, c, d, f, p), Ea.areEqual(c.size, d.size) || (s.updateSize = !0);
      }, geometryUtils: fa.Utils }), o);
    }({ defaultProps: N.getDefaultValues(Ev), createGeometry: C$, createLocationIterator: ld.fromStructure, getLoci: M_, eachLocation: E_, setUpdateState: function(a, o, s, u, l, c, d) {
      a.createGeometry = o.sizeAspectRatio !== s.sizeAspectRatio || o.linkScale !== s.linkScale || o.linkSpacing !== s.linkSpacing || o.ignoreHydrogens !== s.ignoreHydrogens || o.linkCap !== s.linkCap || o.aromaticScale !== s.aromaticScale || o.aromaticSpacing !== s.aromaticSpacing || o.aromaticDashCount !== s.aromaticDashCount || o.dashCount !== s.dashCount || o.dashScale !== s.dashScale || o.dashCap !== s.dashCap || o.stubCap !== s.stubCap || !Pa(o.includeTypes, s.includeTypes) || !Pa(o.excludeTypes, s.excludeTypes) || o.adjustCylinderLength !== s.adjustCylinderLength || o.multipleBonds !== s.multipleBonds, c.interUnitBonds !== d.interUnitBonds && (a.createGeometry = !0, a.updateTransform = !0, a.updateColor = !0, a.updateSize = !0);
    }, mustRecreate: function(a, o, s) {
      return !o.tryUseImpostor || !s;
    } }, i);
  }(e) : function(i) {
    return tB({ defaultProps: N.getDefaultValues(Ev), createGeometry: S$, createLocationIterator: ld.fromStructure, getLoci: M_, eachLocation: E_, setUpdateState: function(a, o, s, u, l, c, d) {
      a.createGeometry = o.sizeFactor !== s.sizeFactor || o.sizeAspectRatio !== s.sizeAspectRatio || o.radialSegments !== s.radialSegments || o.linkScale !== s.linkScale || o.linkSpacing !== s.linkSpacing || o.ignoreHydrogens !== s.ignoreHydrogens || o.linkCap !== s.linkCap || o.aromaticScale !== s.aromaticScale || o.aromaticSpacing !== s.aromaticSpacing || o.aromaticDashCount !== s.aromaticDashCount || o.dashCount !== s.dashCount || o.dashScale !== s.dashScale || o.dashCap !== s.dashCap || o.stubCap !== s.stubCap || !Pa(o.includeTypes, s.includeTypes) || !Pa(o.excludeTypes, s.excludeTypes) || o.adjustCylinderLength !== s.adjustCylinderLength || o.multipleBonds !== s.multipleBonds, c.interUnitBonds !== d.interUnitBonds && (a.createGeometry = !0, a.updateTransform = !0, a.updateColor = !0, a.updateSize = !0);
    }, mustRecreate: function(a, o, s) {
      return o.tryUseImpostor && !!s;
    } }, i);
  }(e);
}
var G0, aI = new Float32Array([-1, 1, -1, -1, 1, 1, 1, -1]), h1 = new Uint16Array([0, 1, 2, 1, 3, 2]), ub = be.add3, A$ = be.add2, w$ = be.add;
(function(e) {
  e.create = function(t, n, r) {
    t === void 0 && (t = 2048), n === void 0 && (n = 1024), t *= 4, n *= 4;
    var i = be.create(Float32Array, 3, n, r ? r.centerBuffer.ref.value : t), a = be.create(Float32Array, 2, n, r ? r.mappingBuffer.ref.value : t), o = be.create(Uint32Array, 3, n / 2, r ? r.indexBuffer.ref.value : t / 2), s = be.create(Float32Array, 1, n, r ? r.groupBuffer.ref.value : t);
    return { add: function(u, l, c, d) {
      for (var f = i.elementCount, p = 0; p < 4; ++p) ub(i, u, l, c), A$(a, aI[2 * p], aI[2 * p + 1]), w$(s, d);
      ub(o, f + h1[0], f + h1[1], f + h1[2]), ub(o, f + h1[3], f + h1[4], f + h1[5]);
    }, getSpheres: function() {
      var u = be.compact(i, !0), l = be.compact(a, !0), c = be.compact(o, !0), d = be.compact(s, !0);
      return Hs.create(u, l, c, d, i.elementCount / 4, r);
    } };
  };
})(G0 || (G0 = {}));
var Fl, BB = A.add;
function M3(e, t, n) {
  var r = n.ignoreHydrogens, i = n.traceOnly, a = t.model.atomicHierarchy.derived.atom.atomicNumber, o = ve.isCoarse(t), s = e.child, u = s == null ? void 0 : s.unitMap.get(t.id);
  if (s && !u) throw new Error("expected childUnit to exist if child exists");
  if (s || r || i) return function(l) {
    return !!u && !Me.has(u.elements, l) || !o && r && C_(a, l) || i && !YO(t, l);
  };
}
function I$(e, t, n, r, i, a) {
  var o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id);
  if (o && !s) return Lt.createEmpty(a);
  for (var u = i.detail, l = i.sizeFactor, c = t.elements, d = c.length, f = d * WD(u), p = mt.createState(f, f / 2, a), g = A(), m = t.conformation.invariantPosition, v = M3(n, t, i), h = He.create(n, t), y = r.size.size, x = A(), S = 0, b = 0, _ = 0; _ < d; _++) if (!v || !v(c[_])) {
    h.element = c[_], m(c[_], g), BB(x, x, g), b += 1, p.currentGroup = _;
    var C = y(h);
    C > S && (S = C), mi(p, g, C * l, u);
  }
  var w, I = a ? pe.clone(a.boundingSphere) : void 0, M = mt.getMesh(p);
  return b === 0 || (A.scale(x, x, 1 / b), w = I && A.distance(x, I.center) / I.radius < 1 ? I : pe.expand(pe(), (s ?? t).boundary.sphere, S * l + 0.05), M.setBoundingSphere(w)), M;
}
function P$(e, t, n, r, i, a) {
  var o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id);
  if (o && !s) return Hs.createEmpty(a);
  for (var u = t.elements, l = u.length, c = G0.create(l, l / 2, a), d = A(), f = t.conformation.invariantPosition, p = M3(n, t, i), g = He.create(n, t), m = r.size.size, v = A(), h = 0, y = 0, x = 0; x < l; x++) if (!(p != null && p(u[x]))) {
    f(u[x], d), c.add(d[0], d[1], d[2], x), BB(v, v, d), y += 1, g.element = u[x];
    var S = m(g);
    S > h && (h = S);
  }
  var b, _ = a ? pe.clone(a.boundingSphere) : void 0, C = c.getSpheres();
  return y === 0 || (A.scale(v, v, 1 / y), b = _ && A.distance(v, _.center) / _.radius < 1 ? _ : pe.expand(pe(), (s ?? t).boundary.sphere, h * i.sizeFactor + 0.05), C.setBoundingSphere(b)), C;
}
function vm(e, t, n) {
  var r = !1;
  if (!ke.is(e)) return !1;
  var i = t.structure, a = t.group;
  if (!ze.areEquivalent(e.structure, i)) return !1;
  for (var o = a.elements.length, s = a.unitIndexMap, u = 0, l = e.elements; u < l.length; u++) {
    var c = l[u], d = s.get(c.unit.id);
    if (d !== void 0) {
      var f = d * o;
      if (le.is(c.indices)) {
        var p = f + le.start(c.indices), g = f + le.end(c.indices);
        n(le.ofBounds(p, g)) && (r = !0);
      } else for (var m = 0, v = c.indices.length; m < v; m++) {
        p = c.indices[m];
        for (var h = m + 1; h < v && c.indices[h] === p; ) h++;
        m = h - 1, g = c.indices[m], r = n(le.ofRange(f + p, f + g)) || r;
      }
    }
  }
  return r;
}
function ym(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group.units[i], u = _e.ofSingleton(a);
    return ke(o.target, [{ unit: s, indices: u }]);
  }
  return cr;
}
function M$(e, t, n) {
  var r = !1;
  if (!ke.is(e) || !ze.areEquivalent(e.structure, t)) return !1;
  for (var i = t.serialMapping.cumulativeUnitElementCount, a = 0, o = e.elements; a < o.length; a++) {
    var s = o[a], u = t.unitIndexMap.get(s.unit.id);
    if (u !== void 0) if (le.is(s.indices)) {
      var l = i[u] + le.start(s.indices), c = i[u] + le.end(s.indices);
      n(le.ofBounds(l, c)) && (r = !0);
    } else for (var d = 0, f = s.indices.length; d < f; d++) {
      var p = i[u] + s.indices[d];
      n(le.ofSingleton(p)) && (r = !0);
    }
  }
  return r;
}
function E$(e, t, n) {
  var r = e.objectId, i = e.groupId;
  if (n === r) {
    var a = t.serialMapping, o = a.unitIndices, s = a.cumulativeUnitElementCount, u = o[i], l = t.units[u], c = i - s[u];
    return ke(t, [{ unit: l, indices: _e.ofSingleton(c) }]);
  }
  return cr;
}
(function(e) {
  e.fromGroup = function(t) {
    var n = t.group, r = t.structure, i = n.elements.length, a = n.units.length, o = He.create(r);
    return zr(i, a, 1, function(s, u) {
      var l = n.units[u];
      return o.unit = l, o.element = l.elements[s], o;
    });
  }, e.fromStructure = function(t) {
    var n = t.units, r = t.elementCount, i = t.serialMapping, a = i.unitIndices, o = i.elementIndices, s = He.create(t);
    return zr(r, 1, 1, function(u) {
      return s.unit = n[a[u]], s.element = o[u], s;
    }, !0);
  };
})(Fl || (Fl = {}));
var z0 = O(O(O({}, Kl), pJ), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), detail: N.Numeric(0, { min: 0, max: 3, step: 1 }, Qe.CustomQualityParamInfo), ignoreHydrogens: N.Boolean(!1), traceOnly: N.Boolean(!1), tryUseImpostor: N.Boolean(!0) });
function D8(e, t, n, r) {
  return n.tryUseImpostor && r && r.extensions.fragDepth ? function(i) {
    return function(a, o) {
      return mh(O(O({}, a), { setUpdateState: function(s, u, l, c, d, f, p) {
        a.setUpdateState(s, u, l, c, d, f, p), Ea.areEqual(c.size, d.size) || (s.updateSize = !0);
      }, geometryUtils: Hs.Utils }), o);
    }({ defaultProps: N.getDefaultValues(z0), createGeometry: P$, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(a, o, s) {
      a.createGeometry = o.ignoreHydrogens !== s.ignoreHydrogens || o.traceOnly !== s.traceOnly;
    }, mustRecreate: function(a, o, s) {
      return !o.tryUseImpostor || !s;
    } }, i);
  }(e) : function(i) {
    return Yl({ defaultProps: N.getDefaultValues(z0), createGeometry: I$, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(a, o, s) {
      a.createGeometry = o.sizeFactor !== s.sizeFactor || o.detail !== s.detail || o.ignoreHydrogens !== s.ignoreHydrogens || o.traceOnly !== s.traceOnly;
    }, mustRecreate: function(a, o, s) {
      return o.tryUseImpostor && !!s;
    } }, i);
  }(e);
}
var T$ = O(O({}, mJ), { sizeFactor: N.Numeric(0.2, { min: 0, max: 10, step: 0.1 }), background: N.Boolean(!1), backgroundMargin: N.Numeric(0, { min: 0, max: 1, step: 0.01 }), backgroundColor: N.Color(qt.black), backgroundOpacity: N.Numeric(0.5, { min: 0, max: 1, step: 0.01 }), borderWidth: N.Numeric(0.25, { min: 0, max: 0.5, step: 0.01 }), level: N.Select("element", [["element", "Element"]], { isEssential: !0 }), chainScale: N.Numeric(10, { min: 0, max: 20, step: 0.1 }), residueScale: N.Numeric(1, { min: 0, max: 20, step: 0.1 }), elementScale: N.Numeric(2, { min: 0, max: 20, step: 0.1 }), attachment: N.Select("middle-left", [["bottom-left", "bottom-left"], ["bottom-center", "bottom-center"], ["bottom-right", "bottom-right"], ["middle-left", "middle-left"], ["middle-center", "middle-center"], ["middle-right", "middle-right"], ["top-left", "top-left"], ["top-center", "top-center"], ["top-right", "top-right"]]), tether: N.Boolean(!0), tetherLength: N.Numeric(0.2, { min: 0, max: 5, step: 0.1 }), tetherBaseWidth: N.Numeric(0, { min: 0, max: 1, step: 0.01 }) });
function O8(e) {
  return function(t, n) {
    return A3(O(O({}, t), { setUpdateState: function(r, i, a, o, s, u, l) {
      t.setUpdateState(r, i, a, o, s, u, l), Ea.areEqual(o.size, s.size) || (r.updateSize = !0), i.background !== a.background && (r.createGeometry = !0), i.backgroundMargin !== a.backgroundMargin && (r.createGeometry = !0), i.tether !== a.tether && (r.createGeometry = !0), i.tetherLength !== a.tetherLength && (r.createGeometry = !0), i.tetherBaseWidth !== a.tetherBaseWidth && (r.createGeometry = !0), i.attachment !== a.attachment && (r.createGeometry = !0), i.fontFamily !== a.fontFamily && (r.createGeometry = !0), i.fontQuality !== a.fontQuality && (r.createGeometry = !0), i.fontStyle !== a.fontStyle && (r.createGeometry = !0), i.fontVariant !== a.fontVariant && (r.createGeometry = !0), i.fontWeight !== a.fontWeight && (r.createGeometry = !0);
    }, geometryUtils: Co.Utils }), n);
  }({ defaultProps: N.getDefaultValues(T$), createGeometry: k$, createLocationIterator: Fl.fromStructure, getLoci: E$, eachLocation: M$, setUpdateState: function(t, n, r) {
    t.createGeometry = n.level !== r.level || n.level === "element" && n.elementScale !== r.elementScale;
  } }, e);
}
function k$(e, t, n, r, i) {
  return n.size.size = function() {
    return 1;
  }, n.color.color = function(a) {
    if (He.is(a) && ve.isAtomic(a.unit)) {
      var o = (0, Fe.atom.pdbx_formal_charge)(a);
      if (o > 0) return qt.red;
      if (o < 0) return qt.blue;
    }
    return qt.white;
  }, r.sizeFactor = 0.2, function(a, o, s, u, l) {
    for (var c = He.create(o), d = o.units, f = o.serialMapping, p = Fe.atom.pdbx_formal_charge, g = f.cumulativeUnitElementCount, m = o.elementCount, v = ud.create(u, m, m / 2, l), h = !1, y = 0, x = d.length; y < x; ++y) {
      var S = d[y], b = S.conformation.position, _ = S.elements;
      c.unit = S;
      for (var C = g[y], w = 0, I = _.length; w < I; w++) {
        c.element = _[w];
        var M = p(c);
        if (M !== 0) {
          b(c.element, H2);
          var E = "".concat(M > 0 ? "+" : "").concat(M);
          v.add(E, H2[0], H2[1], H2[2], 0, 5, C + w), h = !0;
        }
      }
      if (!h) {
        var T = o.boundary.sphere.center;
        v.add("", T[0], T[1], T[2], 0, 0, C + 1);
      }
    }
    return v.getText();
  }(0, t, 0, r, i);
}
var H2 = A(), RB = { "element-sphere": function(e, t) {
  return ca("Element sphere", e, t, D8);
}, "intra-bond": function(e, t) {
  return ca("Intra-unit bond cylinder", e, t, kB);
}, "inter-bond": function(e, t) {
  return Mf("Inter-unit bond cylinder", e, t, OB);
}, "charge-text": function(e, t) {
  return Mf("Charge Text", e, t, O8);
} }, oI = O(O(O(O(O({}, z0), { traceOnly: N.Boolean(!1, { isHidden: !0 }) }), Mv), Ev), { includeParent: N.Boolean(!1), unitKinds: fh(["atomic"]), sizeFactor: N.Numeric(0.2, { min: 0.01, max: 10, step: 0.01 }), sizeAspectRatio: N.Numeric(0.5, { min: 0.01, max: 3, step: 0.01 }), visuals: N.MultiSelect(["element-sphere", "intra-bond", "inter-bond", "charge-text"], N.objectToOptions(RB)), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory) }), Ca = { name: "ball-and-stick", label: "Ball & Stick", description: "Displays atoms as spheres and bonds as cylinders.", factory: function(e, t) {
  return en.createMulti("Ball & Stick", e, t, Ao, RB);
}, getParams: function(e, t) {
  return N.clone(oI);
}, defaultValues: N.getDefaultValues(oI), defaultColorTheme: { name: "element-symbol" }, defaultSizeTheme: { name: "physical" }, isApplicable: function(e) {
  return e.elementCount > 0;
}, getData: function(e, t) {
  return t.includeParent ? e.asParent() : e;
}, mustRecreate: function(e, t) {
  return e.includeParent !== t.includeParent;
} }, LB = { create: function(e, t, n) {
  var r;
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return (i = Ca.factory(t, Ca.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("uniform", { structure: e }) }), [4, i.createOrUpdate(O(O({}, Ca.defaultValues), { aromaticBonds: ((r = e.model) === null || r === void 0 ? void 0 : r.sourceData.kind) === "mmCIF", quality: "auto", visuals: t.props.hideBond ? ["element-sphere", "charge-text"] : ["element-sphere", "intra-bond", "inter-bond", "charge-text"] }), e).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("uniform", { structure: t }) }), [4, e.createOrUpdate({ visuals: n.props.hideBond ? ["element-sphere", "charge-text"] : ["element-sphere", "intra-bond", "inter-bond", "charge-text"] }, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} };
function hr(e, t, n) {
  n === void 0 && (n = {});
  var r, i, a, o, s = 0, u = new qr(), l = en.createState(), c = jl(), d = [], f = -1, p = us.createEmpty(), g = N.getDefaultValues(t.Params);
  n.modifyState && en.updateState(l, n.modifyState(l));
  var m = Du.create();
  function v(h, y) {
    return Ya(h) || Wt.isLoci(h) && h.shape === i ? y(le.ofBounds(0, i.groupCount * i.transforms.length)) : function(x, S, b) {
      if (!wa.isLoci(x) || x.shape !== S) return !1;
      for (var _ = !1, C = S.groupCount, w = x.groups, I = 0, M = w; I < M.length; I++) {
        var E = M[I], T = E.ids, P = E.instance;
        if (le.is(T)) {
          var k = P * C + le.start(T), D = P * C + le.end(T);
          b(le.ofBounds(k, D)) && (_ = !0);
        } else for (var B = 0, L = T.length; B < L; B++) {
          var F = P * C + T[B];
          b(le.ofSingleton(F)) && (_ = !0);
        }
      }
      return _;
    }(h, i, y);
  }
  return { label: "Shape geometry", get groupCount() {
    return a ? a.count : 0;
  }, get props() {
    return g;
  }, get params() {
  }, get state() {
    return l;
  }, get theme() {
    return p;
  }, renderObjects: d, get geometryVersion() {
    return f;
  }, updated: u, createOrUpdate: function(h, y) {
    var x = this;
    return h === void 0 && (h = {}), n.modifyProps && (h = n.modifyProps(h)), Xt.create("ShapeRepresentation.create", function(S) {
      return se(x, 0, void 0, function() {
        var b, _, C, w, I, M, E, T;
        return ie(this, function(P) {
          switch (P.label) {
            case 0:
              return b = Object.assign(g, h), y ? [4, e(S, y, b, i)] : [3, 2];
            case 1:
              return C = P.sent(), [3, 3];
            case 2:
              C = void 0, P.label = 3;
            case 3:
              if (function(k, D) {
                Du.reset(m), (D || i) && (D && !i ? m.createNew = !0 : D && i && D.id === i.id || (D && i && D.id !== i.id ? (m.updateTransform = !0, m.createGeometry = !0) : D && console.warn("unexpected state")), m.updateTransform && (m.updateColor = !0, m.updateSize = !0), m.createGeometry && (m.updateColor = !0, m.updateSize = !0));
              }(0, _ = C), _ && (i = _, Object.assign(p, Wt.getTheme(i))), m.createNew) d.length = 0, a = Wt.groupIterator(i), w = Wt.createTransform(i.transforms), I = t.createValues(i.geometry, w, a, p, b), M = t.createRenderableState(b), n.modifyState && Object.assign(M, n.modifyState(M)), en.updateState(l, M), (r = Gm(i.geometry.kind, I, M, c)) && d.push(r), o = t.createPositionIterator(i.geometry, r.values);
              else {
                if (!r) throw new Error("expected renderObject to be available");
                m.updateTransform && (Wt.createTransform(i.transforms, r.values), a = Wt.groupIterator(i), E = a.instanceCount, T = a.groupCount, ss(E * T, r.values)), m.createGeometry && (R.updateIfChanged(r.values.drawCount, Ui.getDrawCount(i.geometry)), R.updateIfChanged(r.values.uVertexCount, Ui.getVertexCount(i.geometry))), (m.updateTransform || m.createGeometry) && (t.updateBoundingSphere(r.values, i.geometry), o = t.createPositionIterator(i.geometry, r.values)), m.updateColor && bo(a, o, p.color, r.values), m.updateSize && "uSize" in r.values && Hl(a, p.size, r.values), t.updateValues(r.values, b), t.updateRenderableState(r.state, b);
              }
              return g = b, (m.createGeometry || m.createNew) && (f += 1), u.next(s++), [2];
          }
        });
      });
    });
  }, getLoci: function(h) {
    if (h === void 0) return Wt.Loci(i);
    var y = h.objectId, x = h.groupId, S = h.instanceId;
    return r && r.id === y ? wa.Loci(i, [{ ids: _e.ofSingleton(x), instance: S }]) : cr;
  }, mark: function(h, y) {
    if (!En.is(l.markerActions, y)) return !1;
    if (wa.isLoci(h) || Wt.isLoci(h)) {
      if (h.shape !== i) return !1;
    } else if (!Ya(h)) return !1;
    return Qt.mark(r, h, y, v);
  }, setState: function(h) {
    n.modifyState && (h = n.modifyState(h)), r && (h.visible !== void 0 && Qt.setVisibility(r, h.visible), h.alphaFactor !== void 0 && Qt.setAlphaFactor(r, h.alphaFactor), h.pickable !== void 0 && Qt.setPickable(r, h.pickable), h.colorOnly !== void 0 && Qt.setColorOnly(r, h.colorOnly), h.overpaint !== void 0 && Qt.setOverpaint(r, h.overpaint, v, !0), h.transparency !== void 0 && Qt.setTransparency(r, h.transparency, v, !0), h.substance !== void 0 && Qt.setSubstance(r, h.substance, v, !0), h.transform !== void 0 && Qt.setTransform(r, h.transform)), en.updateState(l, h);
  }, setTheme: function(h) {
    In && console.warn("The `ShapeRepresentation` theme is fixed to `ShapeGroupColorTheme` and `ShapeGroupSizeTheme`. Colors are taken from `Shape.getColor` and sizes from `Shape.getSize`");
  }, destroy: function() {
    d.length = 0, r && (r.state.disposed = !0, r = void 0);
  } };
}
var Um = { granularity: "element", condensed: !1, reverse: !1, countsOnly: !1, hidePrefix: !1, htmlStyling: !0 };
function NB(e, t) {
  switch (t === void 0 && (t = {}), e.kind) {
    case "structure-loci":
      return e.structure.models.map(function(l) {
        return l.entry;
      }).filter(function(l) {
        return !!l;
      }).join(", ");
    case "element-loci":
      return function(l, c) {
        c === void 0 && (c = {});
        var d = O(O({}, Um), c), f = function(p, g, m, v, h) {
          g === void 0 && (g = !1), m === void 0 && (m = !1), v === void 0 && (v = !1), h === void 0 && (h = !1);
          var y = p.structureCount, x = p.chainCount, S = p.residueCount, b = p.conformationCount, _ = p.elementCount;
          if (g || _ !== 1 || S !== 0 || x !== 0) {
            if (g || _ !== 0 || S !== 1 || x !== 0) {
              if (g || _ !== 0 || S !== 0 || x !== 1) {
                if (g)
                  return C = [], y > 0 && C.push(w1(y, "Structure")), x > 0 && C.push(w1(x, "Chain")), S > 0 && C.push(w1(S, "Residue")), b > 0 && C.push(w1(b, "Conformation")), _ > 0 && C.push(w1(_, "Element")), C.join("<small> + </small>");
                var C = [];
                return y > 0 && C.push(y === 1 ? sl(p.firstStructureLoc, { hidePrefix: m, condensed: v, granularity: "structure", reverse: h }, !0) : hp(y, p.firstStructureLoc, "structure", m, h, v)), x > 0 && (C.push(x === 1 ? sl(p.firstChainLoc, { condensed: v, granularity: "chain", hidePrefix: m, reverse: h }, !0) : hp(x, p.firstChainLoc, "chain", m, h, v)), m = !0), S > 0 && (C.push(S === 1 ? sl(p.firstResidueLoc, { condensed: v, granularity: "residue", hidePrefix: m, reverse: h }, !0) : hp(S, p.firstResidueLoc, "residue", m, h, v)), m = !0), b > 0 && (C.push(b === 1 ? sl(p.firstConformationLoc, { condensed: v, granularity: "conformation", hidePrefix: m, reverse: h }, !0) : hp(b, p.firstConformationLoc, "conformation", m, h, v)), m = !0), _ > 0 && C.push(_ === 1 ? sl(p.firstElementLoc, { condensed: v, granularity: "element", hidePrefix: m, reverse: h }, !0) : hp(_, p.firstElementLoc, "element", m, h, v)), C.join("<small> + </small>");
              }
              var w = p.firstChainLoc.unit, I = ve.isAtomic(w) && function(M) {
                var E = M.elements, T = M.model, P = T.atomicHierarchy, k = P.chainAtomSegments, D = P.residueAtomSegments, B = k.offsets[k.index[E[0]]], L = k.offsets[k.index[E[E.length - 1]] + 1] - 1;
                return D.index[L] - D.index[B] + 1;
              }(w) === 1 || ve.Traits.is(w.traits, 1) ? "residue" : "chain";
              return sl(p.firstChainLoc, { hidePrefix: m, condensed: v, granularity: I, reverse: h }, !0);
            }
            return sl(p.firstResidueLoc, { hidePrefix: m, condensed: v, granularity: "residue", reverse: h }, !0);
          }
          return sl(p.firstElementLoc, { hidePrefix: m, condensed: v, granularity: "element", reverse: h }, !0);
        }(l, d.countsOnly, d.hidePrefix, d.condensed, d.reverse);
        return d.htmlStyling ? f : A6(f);
      }(Sf.ofLoci(e), t);
    case "bond-loci":
      var n = e.bonds[0];
      return n ? FB(n) : "";
    case "shape-loci":
      return e.shape.name;
    case "group-loci":
      var r = e.groups[0];
      return r ? e.shape.getLabel(_e.start(r.ids), r.instance) : "";
    case "every-loci":
      return "Everything";
    case "empty-loci":
      return "Nothing";
    case "data-loci":
      return e.getLabel();
    case "volume-loci":
      return e.volume.label || "Volume";
    case "isosurface-loci":
      return ["".concat(e.volume.label || "Volume"), "Isosurface at ".concat($t.IsoValue.toString(e.isoValue))].join(" | ");
    case "cell-loci":
      var i = _e.size(e.indices), a = _e.start(e.indices), o = $t.IsoValue.absolute(e.volume.grid.cells.data[a]), s = $t.IsoValue.toRelative(o, e.volume.grid.stats), u = ["".concat(e.volume.label || "Volume"), "".concat(i === 1 ? "Cell #".concat(a) : "".concat(i, " Cells"))];
      return i === 1 && u.push("".concat($t.IsoValue.toString(o), " (").concat($t.IsoValue.toString(s), ")")), u.join(" | ");
  }
}
function w1(e, t) {
  return e === 1 ? "1 ".concat(t) : "".concat(e, " ").concat(t, "s");
}
function hp(e, t, n, r, i, a) {
  return "".concat(sl(t, { granularity: n, hidePrefix: r, reverse: i, condensed: a }), " <small>[+ ").concat(w1(e - 1, "other ".concat(S6(n))), "]</small>");
}
function FB(e, t) {
  return t === void 0 && (t = {}), E3({ loci: [ke(e.aStructure, [{ unit: e.aUnit, indices: _e.ofSingleton(e.aIndex) }]), ke(e.bStructure, [{ unit: e.bUnit, indices: _e.ofSingleton(e.bIndex) }])] }, t);
}
function E3(e, t) {
  t === void 0 && (t = {});
  var n = O(O({}, Um), t), r = function(i, a) {
    for (var o = a.granularity, s = a.hidePrefix, u = a.reverse, l = a.condensed, c = !0, d = 0, f = i.loci; d < f.length; d++) {
      var p = f[d];
      if (!ke.is(p) || ke.size(p) !== 1) {
        c = !1;
        break;
      }
    }
    if (c) {
      var g = i.loci.map(function(C) {
        var w = C.elements[0], I = w.unit, M = w.indices;
        return He.create(C.structure, I, I.elements[_e.start(M)]);
      }), m = g.map(function(C) {
        return VB(C, o, s, u || l);
      });
      if (l) return m.map(function(C) {
        return C[0].replace(/\[.*\]/g, "").trim();
      }).filter(function(C) {
        return !!C;
      }).join(" — ");
      for (var v = 0, h = 0, y = Math.min.apply(Math, m.map(function(C) {
        return C.length;
      })) - 1; h < y; ++h) {
        for (var x = !0, S = 1, b = m.length; S < b; ++S) if (m[0][h] !== m[S][h]) {
          x = !1;
          break;
        }
        if (!x) break;
        v += 1;
      }
      if (v > 0) {
        var _ = [m[0].join(" | ")];
        for (S = 1, b = m.length; S < b; ++S) _.push(m[S].slice(v).filter(function(C) {
          return !!C;
        }).join(" | "));
        return _.join(" — ");
      }
      return m.map(function(C) {
        return C.filter(function(w) {
          return !!w;
        }).join(" | ");
      }).filter(function(C) {
        return !!C;
      }).join("</br>");
    }
    return m = i.loci.map(function(C) {
      return NB(C, a);
    }), m.filter(function(C) {
      return !!C;
    }).join(l ? " — " : "</br>");
  }(e, n);
  return n.htmlStyling ? r : A6(r);
}
function sl(e, t, n) {
  var r, i;
  t === void 0 && (t = {});
  var a = O(O({}, Um), t), o = VB(e, a.granularity, a.hidePrefix, a.reverse || a.condensed), s = (a.condensed ? (i = (r = o[0]) === null || r === void 0 ? void 0 : r.replace(/\[.*\]/g, "").trim()) !== null && i !== void 0 ? i : "" : o.filter(function(u) {
    return !!u;
  }).join(" | ")) + (n ? function(u) {
    if (u >= 90) return "<div><small>Plddt ".concat(u, " (Very high)</small></div>");
    if (u < 90 && u >= 70) return "<div><small>Plddt ".concat(u, " (Confident)</small></div>");
    if (u < 70 && u >= 50) return "<div><small>Plddt ".concat(u, " (Low)</small></div>");
    if (u < 50) return "<div><small>Plddt ".concat(u, " (Very low)</small></div>");
  }(Fe.atom.B_iso_or_equiv(e)) : "");
  return a.htmlStyling ? s : A6(s);
}
function VB(e, t, n, r) {
  t === void 0 && (t = "element"), n === void 0 && (n = !1), r === void 0 && (r = !1);
  var i = [];
  if (!n) {
    var a = e.unit.model.entry;
    a.length > 30 && (a = a.substr(0, 27) + "…"), i.push("<small>".concat(a, "</small>")), t !== "structure" && (i.push("<small>Model ".concat(e.unit.model.modelNum, "</small>")), i.push("<small>Instance ".concat(e.unit.conformation.operator.name, "</small>")));
  }
  return ve.isAtomic(e.unit) ? i.push.apply(i, function(o, s, u) {
    u === void 0 && (u = !1);
    var l = He.residueIndex(o), c = Fe.chain.label_asym_id(o), d = Fe.chain.auth_asym_id(o), f = o.unit.model.atomicHierarchy.residues.label_seq_id.valueKind(l) === 0, p = Fe.residue.label_seq_id(o), g = Fe.residue.auth_seq_id(o), m = Fe.residue.pdbx_PDB_ins_code(o), v = Fe.atom.label_comp_id(o), h = Fe.atom.label_atom_id(o), y = Fe.atom.label_alt_id(o), x = Fe.atom.occupancy(o), S = Fe.atom.id(o), b = Fe.residue.microheterogeneityCompIds(o), _ = s === "residue" && b.length > 1 ? "(".concat(b.join("|"), ")") : v, C = [];
    switch (s) {
      case "element":
        C.push("<b>".concat(h, " ").concat(S, "</b>").concat(y ? "%".concat(y) : ""));
      case "conformation":
        s === "conformation" && y && C.push("<small>Conformation</small> <b>".concat(y, "</b>"));
      case "residue":
        var w = p === g && f ? p : g;
        C.push("<b>".concat(_, " ").concat(w, "</b>").concat(w !== p ? " <small>[auth</small> <b>".concat(p, "</b><small>]</small>") : "", "<b>").concat(m || "", "</b>"));
      case "chain":
        c === d ? C.push("<b>".concat(c, "</b>")) : s === "chain" && ve.Traits.is(o.unit.traits, 1) ? C.push("<small>[auth</small> <b>".concat(d, "</b><small>]</small>")) : C.push("<b>".concat(c, "</b> <small>[auth</small> <b>").concat(d, "</b><small>]</small>"));
    }
    return C.length > 0 && x !== 1 && !u && (C[0] = "".concat(C[0], " <small>[occupancy</small> <b>").concat(Math.round(100 * x) / 100, "</b><small>]</small>")), C.reverse();
  }(e, t, r)) : ve.isCoarse(e.unit) ? i.push.apply(i, function(o, s) {
    var u = Fe.coarse.asym_id(o), l = Fe.coarse.seq_id_begin(o), c = Fe.coarse.seq_id_end(o), d = [];
    switch (s) {
      case "element":
      case "conformation":
      case "residue":
        if (l === c) {
          var f = Fe.coarse.entityKey(o), p = o.unit.model.sequence.byEntityKey[f].sequence.compId.value(l - 1);
          d.push("<b>".concat(p, " ").concat(l, "</b>"));
        } else d.push("<b>".concat(l, "-").concat(c, "</b>"));
      case "chain":
        d.push("<b>".concat(u, "</b>"));
    }
    return d.reverse();
  }(e, t)) : i.push("Unknown"), r ? i.reverse() : i;
}
function U0(e, t) {
  t === void 0 && (t = {});
  var n = O(O(O({}, Um), { measureOnly: !1, unitLabel: "Å" }), t), r = e.loci.map(function(u) {
    return zn.getCenter(u);
  }), i = r[0], a = r[1], o = "".concat(A.distance(i, a).toFixed(2), " ").concat(n.unitLabel);
  if (n.measureOnly) return o;
  var s = E3(e, n);
  return n.condensed ? "".concat(o, " | ").concat(s) : "Distance ".concat(o, "</br>").concat(s);
}
function B8(e, t) {
  t === void 0 && (t = {});
  var n = O(O(O({}, Um), { measureOnly: !1 }), t), r = e.loci.map(function(d) {
    return zn.getCenter(d);
  }), i = r[0], a = r[1], o = r[2], s = A.sub(A(), i, a), u = A.sub(A(), o, a), l = "".concat(ta(A.angle(s, u)).toFixed(2), "°");
  if (n.measureOnly) return l;
  var c = E3(e, n);
  return n.condensed ? "".concat(l, " | ").concat(c) : "Angle ".concat(l, "</br>").concat(c);
}
function R8(e, t) {
  t === void 0 && (t = {});
  var n = O(O(O({}, Um), { measureOnly: !1 }), t), r = e.loci.map(function(c) {
    return zn.getCenter(c);
  }), i = r[0], a = r[1], o = r[2], s = r[3], u = "".concat(ta(A.dihedralAngle(i, a, o, s)).toFixed(2), "°");
  if (n.measureOnly) return u;
  var l = E3(e, n);
  return n.condensed ? "".concat(u, " | ").concat(l) : "Dihedral ".concat(u, "</br>").concat(l);
}
var D$ = { customText: N.Text("", { label: "Text", description: "Override the label with custom value.", isEssential: !0 }), textColor: N.Color(qt.black, { isEssential: !0 }), textSize: N.Numeric(0.5, { min: 0.1, max: 10, step: 0.1 }, { isEssential: !0 }) }, T3 = O(O(O({}, Co.Params), D$), { borderWidth: N.Numeric(0.2, { min: 0, max: 0.5, step: 0.01 }) }), O$ = O(O({}, T3), { offsetZ: N.Numeric(2, { min: 0, max: 10, step: 0.1 }), textSize: N.Numeric(0.7, { min: 0.1, max: 10, step: 0.1 }, { isEssential: !0 }) }), GB = { text: function(e, t) {
  return hr(L$, Co.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !0 });
  } });
} }, B$ = O(O({}, O$), { scaleByRadius: N.Boolean(!1), visuals: N.MultiSelect(["text"], N.objectToOptions(GB)), textColor: N.Color(Ae.fromRgb(241, 160, 119), { isEssential: !0 }) }), R$ = pe();
function lb(e, t) {
  return t === void 0 && (t = !1), e.label || NB(e.loci, { hidePrefix: !0, htmlStyling: !1, condensed: t }).split("Plddt")[0];
}
function L$(e, t, n, r) {
  var i = function(u, l, c) {
    for (var d = ud.create(l, 128, 64, c), f = l.customText.trim(), p = 0, g = u.infos.length; p < g; ++p) {
      var m = u.infos[p], v = zn.getBoundingSphere(m.loci, R$);
      if (v) {
        var h = v.center, y = v.radius, x = f || lb(m, !0);
        d.add(x, h[0], h[1], h[2], l.scaleByRadius ? y / 0.9 : 0, l.scaleByRadius ? Math.max(1, y) : 1, p);
      }
    }
    return d.getText();
  }(t, n, r && r.geometry), a = function(u) {
    return u.infos.length === 1 ? lb(u.infos[0]) : "".concat(u.infos.length, " Labels");
  }(t), o = n.customText.trim(), s = o ? function(u) {
    return o;
  } : function(u) {
    return lb(t.infos[u]);
  };
  return Wt.create(a, t, i, function() {
    return n.textColor;
  }, function() {
    return n.textSize;
  }, s);
}
var N$ = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            var u = en.createMulti("Label", o, s, en.StateBuilder, GB);
            return u.setState({ pickable: !0, markerActions: En.All }), u;
          }(t, function() {
            return B$;
          }), [4, i.createOrUpdate(n ?? {}, { infos: e[0].loci ? e : e.map(function(o) {
            return { loci: o };
          }) }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r && e.setTheme(r), [4, e.createOrUpdate(n ?? {}, { infos: t.map(function(a) {
            return { loci: a };
          }) }).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, zB = { unitLabel: N.Text("Å", { isEssential: !0 }) }, F$ = O(O(O({}, Mn.Params), zB), { lineSizeAttenuation: N.Boolean(!0), linesColor: N.Color(qt.lightgreen, { isEssential: !0 }), linesSize: N.Numeric(0.075, { min: 0.01, max: 5, step: 0.01 }), dashLength: N.Numeric(0.2, { min: 0.01, max: 0.2, step: 0.01 }) }), V$ = O(O({}, T3), zB), UB = { lines: function(e, t) {
  return hr(z$, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !0, markerActions: En.All });
  } });
}, text: function(e, t) {
  return hr(U$, Co.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
} }, G$ = O(O(O({}, F$), V$), { visuals: N.MultiSelect(["lines", "text"], N.objectToOptions(UB)) });
function HB(e, t) {
  var n = t.sphereA, r = t.sphereB, i = t.center, a = e.loci, o = a[0], s = a[1];
  return zn.getBoundingSphere(o, n), zn.getBoundingSphere(s, r), A.add(i, n.center, r.center), A.scale(i, i, 0.5), t.distance = A.distance(n.center, r.center), t;
}
var Bc = { sphereA: pe(), sphereB: pe(), center: A(), distance: 0 };
function qB(e, t) {
  return e.pairs.length === 1 ? "Distance ".concat(U0(e.pairs[0], { unitLabel: t, measureOnly: !0 })) : "".concat(e.pairs.length, " Distances");
}
function z$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.pairs.length; c < d; ++c) HB(o.pairs[c], Bc), l.addFixedLengthDashes(Bc.sphereA.center, Bc.sphereB.center, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = qB(t, n.unitLabel);
  return Wt.create(a, t, i, function() {
    return n.linesColor;
  }, function() {
    return n.linesSize;
  }, function(o) {
    return U0(t.pairs[o], n);
  });
}
function U$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = ud.create(s, 128, 64, u), c = 0, d = o.pairs.length; c < d; ++c) {
      HB(o.pairs[c], Bc);
      var f = Bc.center, p = Bc.distance, g = Bc.sphereA, m = Bc.sphereB, v = s.customText || "".concat(p.toFixed(2), " ").concat(s.unitLabel), h = Math.max(2, g.radius, m.radius) / 2;
      l.add(v, f[0], f[1], f[2], 1, h, c);
    }
    return l.getText();
  }(t, n, r && r.geometry), a = qB(t, n.unitLabel);
  return Wt.create(a, t, i, function() {
    return n.textColor;
  }, function() {
    return n.textSize;
  }, function(o) {
    return U0(t.pairs[o], n);
  });
}
var H$ = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            var u = en.createMulti("Distance", o, s, en.StateBuilder, UB);
            return u.setState({ pickable: !0, markerActions: En.All }), u;
          }(t, function() {
            return G$;
          }), [4, i.createOrUpdate(n ?? {}, { pairs: [{ loci: e.slice(-2) }] }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r && e.setTheme(r), [4, e.createOrUpdate(n ?? {}, { pairs: [{ loci: t }] }).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, q$ = { radius: 1, segments: 36, thetaStart: 0, thetaLength: 2 * Math.PI };
function L8(e) {
  var t = O(O({}, q$), e), n = t.radius, r = t.segments, i = t.thetaStart, a = t.thetaLength, o = a === 2 * Math.PI, s = o ? r + 1 : r + 2, u = new Float32Array(3 * s), l = new Float32Array(3 * s), c = new Uint32Array(3 * r);
  u[0] = 0, u[1] = 0, u[2] = 0, l[0] = 0, l[1] = 1, l[2] = 0;
  for (var d = 0, f = 3; d < r; ++d, f += 3) {
    var p = i + d / r * a;
    u[f] = n * Math.sin(p), u[f + 1] = 0, u[f + 2] = n * Math.cos(p), l[f] = 0, l[f + 1] = 1, l[f + 2] = 0;
  }
  for (d = 1, f = 0; d < r; ++d, f += 3) c[f] = d, c[f + 1] = d + 1, c[f + 2] = 0;
  if (o)
    c[g = 3 * (r - 1)] = r, c[g + 1] = 1, c[g + 2] = 0;
  else {
    var g;
    p = i + a, u[f = 3 * (r + 1)] = n * Math.sin(p), u[f + 1] = 0, u[f + 2] = n * Math.cos(p), l[f] = 0, l[f + 1] = 1, l[f + 2] = 0, c[g = 3 * (r - 1)] = r, c[g + 1] = r + 1, c[g + 2] = 0;
  }
  return { vertices: u, normals: l, indices: c };
}
var jB = { color: N.Color(qt.lightgreen), arcScale: N.Numeric(0.7, { min: 0.01, max: 1, step: 0.01 }) }, KB = O(O(O({}, Mn.Params), jB), { lineSizeAttenuation: N.Boolean(!0), linesSize: N.Numeric(0.04, { min: 0.01, max: 5, step: 0.01 }), dashLength: N.Numeric(0.04, { min: 0.01, max: 0.2, step: 0.01 }) }), j$ = O({}, KB), K$ = O({}, KB), Y$ = O(O(O({}, Lt.Params), jB), { ignoreLight: N.Boolean(!0), sectorOpacity: N.Numeric(0.75, { min: 0, max: 1, step: 0.01 }) }), YB = { vectors: function(e, t) {
  return hr(X$, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1 });
  } });
}, arc: function(e, t) {
  return hr(Z$, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1 });
  } });
}, sector: function(e, t) {
  return hr(Q$, Lt.Utils, { modifyProps: function(n) {
    return O(O({}, n), { alpha: n.sectorOpacity });
  }, modifyState: function(n) {
    return O(O({}, n), { markerActions: En.Highlighting });
  } });
}, text: function(e, t) {
  return hr(J$, Co.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: lt.None });
  } });
} }, W$ = O(O(O(O(O({}, j$), K$), Y$), T3), { visuals: N.MultiSelect(["vectors", "sector", "text"], N.objectToOptions(YB)) }), yc = A(), gp = ne();
function k3(e, t, n) {
  var r = t.sphereA, i = t.sphereB, a = t.sphereC, o = t.arcDirA, s = t.arcDirC, u = t.arcNormal, l = e.loci, c = l[0], d = l[1], f = l[2];
  zn.getBoundingSphere(c, r), zn.getBoundingSphere(d, i), zn.getBoundingSphere(f, a), A.sub(o, r.center, i.center), A.sub(s, a.center, i.center), A.cross(u, o, s);
  var p = Math.min(A.magnitude(o), A.magnitude(s)) * n;
  return t.radius = p, t.angle = A.angle(o, s), t;
}
function WB(e, t) {
  var n = e.radius, r = e.angle, i = t ? yT(r, n) / t : 32;
  return ne.targetTo(gp, e.sphereB.center, e.sphereA.center, e.arcNormal), ne.setTranslation(gp, e.sphereB.center), ne.mul(gp, gp, ne.rotY180), m3(L8({ radius: n, thetaLength: r, segments: i }), gp);
}
var Li = { sphereA: pe(), sphereB: pe(), sphereC: pe(), arcDirA: A(), arcDirC: A(), arcNormal: A(), radius: 0, angle: 0 };
function D3(e) {
  return e.triples.length === 1 ? "Angle ".concat(B8(e.triples[0], { measureOnly: !0 })) : "".concat(e.triples.length, " Angles");
}
function X$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.triples.length; c < d; ++c) k3(o.triples[c], Li, s.arcScale), l.addFixedLengthDashes(Li.sphereB.center, Li.sphereA.center, s.dashLength, c), l.addFixedLengthDashes(Li.sphereB.center, Li.sphereC.center, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = D3(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function Z$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.triples.length; c < d; ++c) {
      k3(o.triples[c], Li, s.arcScale);
      for (var f = WB(Li, s.dashLength), p = f.indices, g = f.vertices, m = 0, v = p.length; m < v; m += 3) if (m % 2 != 1) {
        var h = 3 * p[m], y = 3 * p[m + 1], x = g[h], S = g[h + 1], b = g[h + 2], _ = g[y], C = g[y + 1], w = g[y + 2];
        l.add(x, S, b, _, C, w, c);
      }
    }
    return l.getLines();
  }(t, n, r && r.geometry), a = D3(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function Q$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = mt.createState(128, 64, u), c = 0, d = o.triples.length; c < d; ++c) {
      k3(o.triples[c], Li, s.arcScale);
      var f = WB(Li);
      l.currentGroup = c, mt.addPrimitive(l, ne.id, f), mt.addPrimitiveFlipped(l, ne.id, f);
    }
    return mt.getMesh(l);
  }(t, n, r && r.geometry), a = D3(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return 1;
  }, function(o) {
    return B8(t.triples[o]);
  });
}
function J$(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = ud.create(s, 128, 64, u), c = 0, d = o.triples.length; c < d; ++c) {
      k3(o.triples[c], Li, s.arcScale), A.add(yc, Li.arcDirA, Li.arcDirC), A.setMagnitude(yc, yc, Li.radius), A.add(yc, Li.sphereB.center, yc);
      var f = ta(Li.angle).toFixed(2), p = s.customText || "".concat(f, "°"), g = Math.max(2, Li.sphereA.radius, Li.sphereB.radius, Li.sphereC.radius) / 2;
      l.add(p, yc[0], yc[1], yc[2], 0.1, g, c);
    }
    return l.getText();
  }(t, n, r && r.geometry), a = D3(t);
  return Wt.create(a, t, i, function() {
    return n.textColor;
  }, function() {
    return n.textSize;
  }, function(o) {
    return B8(t.triples[o]);
  });
}
var $$ = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            return en.createMulti("Angle", o, s, en.StateBuilder, YB);
          }(t, function() {
            return W$;
          }), [4, i.createOrUpdate(n ?? {}, { triples: [{ loci: e.slice(-3) }] }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r && e.setTheme(r), [4, e.createOrUpdate(n ?? {}, { triples: [{ loci: t.slice(-3) }] }).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, XB = { color: N.Color(qt.lightgreen), arcScale: N.Numeric(0.7, { min: 0.01, max: 1, step: 0.01 }) }, O3 = O(O(O({}, Mn.Params), XB), { lineSizeAttenuation: N.Boolean(!0), linesSize: N.Numeric(0.04, { min: 0.01, max: 5, step: 0.01 }), dashLength: N.Numeric(0.04, { min: 0.01, max: 0.2, step: 0.01 }) }), eee = O({}, O3), tee = O({}, O3), nee = O({}, O3), ree = O({}, O3), iee = O(O(O({}, Lt.Params), XB), { ignoreLight: N.Boolean(!0), sectorOpacity: N.Numeric(0.75, { min: 0, max: 1, step: 0.01 }) }), ZB = { vectors: function(e, t) {
  return hr(oee, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
}, extenders: function(e, t) {
  return hr(lee, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
}, connector: function(e, t) {
  return hr(see, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
}, arms: function(e, t) {
  return hr(uee, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
}, arc: function(e, t) {
  return hr(cee, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { pickable: !1, markerActions: En.All });
  } });
}, sector: function(e, t) {
  return hr(dee, Lt.Utils, { modifyProps: function(n) {
    return O(O({}, n), { alpha: n.sectorOpacity });
  }, modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, text: function(e, t) {
  return hr(fee, Co.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
} }, aee = O(O(O(O(O(O(O({}, eee), tee), nee), ree), iee), T3), { visuals: N.MultiSelect(["extenders", "arms", "sector", "text"], N.objectToOptions(ZB)) }), ua = A(), vp = ne();
function Ff(e, t, n) {
  var r = t.sphereA, i = t.sphereB, a = t.sphereC, o = t.sphereD, s = t.dirBA, u = t.dirCD, l = t.projA, c = t.projD, d = t.arcPointA, f = t.arcPointD, p = t.arcDirA, g = t.arcDirD, m = t.arcCenter, v = t.arcNormal, h = e.loci, y = h[0], x = h[1], S = h[2], b = h[3];
  zn.getBoundingSphere(y, r), zn.getBoundingSphere(x, i), zn.getBoundingSphere(S, a), zn.getBoundingSphere(b, o), A.add(m, i.center, a.center), A.scale(m, m, 0.5), A.sub(s, r.center, i.center), A.sub(u, o.center, a.center), A.add(d, m, s), A.add(f, m, u), A.sub(v, a.center, i.center), A.orthogonalize(p, v, s), A.orthogonalize(g, v, u), A.projectPointOnVector(l, d, p, m), A.projectPointOnVector(c, f, g, m);
  var _ = Math.min(A.distance(l, m), A.distance(c, m)) * n;
  A.setMagnitude(p, p, _), A.setMagnitude(g, g, _), A.add(d, m, p), A.add(f, m, g), t.radius = _, t.angle = A.dihedralAngle(r.center, i.center, a.center, o.center), A.matchDirection(ua, v, A.sub(ua, d, r.center));
  var C = A.angle(s, ua), w = _ / Math.cos(C - B9);
  A.add(l, i.center, A.setMagnitude(ua, s, w)), A.matchDirection(ua, v, A.sub(ua, f, o.center));
  var I = A.angle(u, ua), M = _ / Math.cos(I - B9);
  return A.add(c, a.center, A.setMagnitude(ua, u, M)), t;
}
function QB(e, t) {
  var n = e.radius, r = e.angle, i = t ? yT(r, n) / t : 32;
  return ne.targetTo(vp, e.arcCenter, r < 0 ? e.arcPointD : e.arcPointA, e.arcNormal), ne.setTranslation(vp, e.arcCenter), ne.mul(vp, vp, ne.rotY180), m3(L8({ radius: n, thetaLength: Math.abs(r), segments: i }), vp);
}
var Qn = { sphereA: pe(), sphereB: pe(), sphereC: pe(), sphereD: pe(), dirBA: A(), dirCD: A(), projA: A(), projD: A(), arcPointA: A(), arcPointD: A(), arcDirA: A(), arcDirD: A(), arcCenter: A(), arcNormal: A(), radius: 0, angle: 0 };
function Vf(e) {
  return e.quads.length === 1 ? "Dihedral ".concat(R8(e.quads[0], { measureOnly: !0 })) : "".concat(e.quads.length, " Dihedrals");
}
function oee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) Ff(o.quads[c], Qn, s.arcScale), l.addFixedLengthDashes(Qn.arcCenter, Qn.arcPointA, s.dashLength, c), l.addFixedLengthDashes(Qn.arcCenter, Qn.arcPointD, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function see(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) Ff(o.quads[c], Qn, s.arcScale), l.addFixedLengthDashes(Qn.sphereB.center, Qn.sphereC.center, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function uee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) Ff(o.quads[c], Qn, s.arcScale), l.addFixedLengthDashes(Qn.sphereB.center, Qn.sphereA.center, s.dashLength, c), l.addFixedLengthDashes(Qn.sphereC.center, Qn.sphereD.center, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function lee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) Ff(o.quads[c], Qn, s.arcScale), l.addFixedLengthDashes(Qn.arcPointA, Qn.projA, s.dashLength, c), l.addFixedLengthDashes(Qn.arcPointD, Qn.projD, s.dashLength, c);
    return l.getLines();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function cee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) {
      Ff(o.quads[c], Qn, s.arcScale);
      for (var f = QB(Qn, s.dashLength), p = f.indices, g = f.vertices, m = 0, v = p.length; m < v; m += 3) if (m % 2 != 1) {
        var h = 3 * p[m], y = 3 * p[m + 1], x = g[h], S = g[h + 1], b = g[h + 2], _ = g[y], C = g[y + 1], w = g[y + 2];
        l.add(x, S, b, _, C, w, c);
      }
    }
    return l.getLines();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "";
  });
}
function dee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = mt.createState(128, 64, u), c = 0, d = o.quads.length; c < d; ++c) {
      Ff(o.quads[c], Qn, s.arcScale);
      var f = QB(Qn);
      l.currentGroup = c, mt.addPrimitive(l, ne.id, f), mt.addPrimitiveFlipped(l, ne.id, f);
    }
    return mt.getMesh(l);
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.color;
  }, function() {
    return 1;
  }, function(o) {
    return R8(t.quads[o]);
  });
}
function fee(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = ud.create(s, 128, 64, u), c = 0, d = o.quads.length; c < d; ++c) {
      Ff(o.quads[c], Qn, s.arcScale), A.add(ua, Qn.arcDirA, Qn.arcDirD), A.setMagnitude(ua, ua, Qn.radius), A.add(ua, Qn.arcCenter, ua);
      var f = ta(Qn.angle).toFixed(2);
      f === "-0.00" && (f = "0.00");
      var p = s.customText || "".concat(f, "°"), g = Math.max(2, Qn.sphereA.radius, Qn.sphereB.radius, Qn.sphereC.radius, Qn.sphereD.radius) / 2;
      l.add(p, ua[0], ua[1], ua[2], 0.1, g, c);
    }
    return l.getText();
  }(t, n, r && r.geometry), a = Vf(t);
  return Wt.create(a, t, i, function() {
    return n.textColor;
  }, function() {
    return n.textSize;
  }, function(o) {
    return R8(t.quads[o]);
  });
}
var mee = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            var u = en.createMulti("Dihedral", o, s, en.StateBuilder, ZB);
            return u.setState({ pickable: !0, markerActions: En.All }), u;
          }(t, function() {
            return aee;
          }), [4, i.createOrUpdate(n ?? {}, { quads: [{ loci: e.slice(-4) }] }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r && e.setTheme(r), [4, e.createOrUpdate(n ?? {}, { quads: [{ loci: t.slice(-4) }] }).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, cb = cn.is;
function pee(e, t, n, r, i, a) {
  if (!ve.isAtomic(t)) return Mn.createEmpty(a);
  var o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id);
  if (o && !s) return Mn.createEmpty(a);
  var u = He.create(n, t), l = t.elements, c = t.bonds, d = c.edgeCount, f = c.a, p = c.b, g = c.edgeProps, m = c.offset;
  if (!d) return Mn.createEmpty(a);
  var v = g.order, h = g.flags, y = i.sizeFactor, x = i.aromaticBonds, S = i.includeTypes, b = i.excludeTypes, _ = i.multipleBonds, C = _ === "off", w = _ === "symmetric", I = P3(cn.fromNames(S), cn.fromNames(b), 32), M = A(), E = t.conformation.invariantPosition, T = t.rings, P = T.elementRingIndices, k = T.elementAromaticRingIndices, D = x ? t.resonance.delocalizedTriplets : void 0, B = { linkCount: 2 * d, referencePosition: function(H) {
    var q, z, K = f[H], Y = p[H], Z = D == null ? void 0 : D.getThirdElement(K, Y);
    if (Z !== void 0) return E(l[Z], M);
    K > Y && (K = (q = [Y, K])[0], Y = q[1]), m[K + 1] - m[K] == 1 && (K = (z = [Y, K])[0], Y = z[1]);
    for (var X = k.get(K) || P.get(K), W = 0, J = m[K], $ = m[K + 1]; J < $; ++J) {
      var ee = p[J];
      if (ee !== Y && ee !== K) {
        if (!X) return E(l[ee], M);
        var ce = k.get(ee) || P.get(ee);
        if (!ce) continue;
        var ae = Yg(X, ce);
        ae > W && (W = ae, E(l[ee], M));
      }
    }
    return W > 0 ? M : null;
  }, position: function(H, q, z) {
    E(l[f[z]], H), E(l[p[z]], q);
  }, style: function(H) {
    var q = v[H], z = h[H];
    if (cb(z, 2) || cb(z, 4)) return 1;
    if (q === 3) return C ? 0 : w ? 4 : 5;
    if (x) {
      var K = f[H], Y = p[H], Z = k.get(K), X = k.get(Y), W = Z && X ? Yg(Z, X) : 0;
      if (cb(z, 16) || W && !I) {
        if (W === 2) return 8;
        if (W === 1 || D != null && D.getThirdElement(K, Y)) return 7;
      }
    }
    return q !== 2 || C ? 0 : w ? 2 : 3;
  }, radius: function(H) {
    u.element = l[f[H]];
    var q = r.size.size(u);
    u.element = l[p[H]];
    var z = r.size.size(u);
    return Math.min(q, z) * y;
  }, ignore: MB(n, t, i) }, L = PB(0, B, i, a), F = L.lines, V = L.boundingSphere;
  if (V) F.setBoundingSphere(V);
  else if (F.lineCount > 0) {
    var G = pe.expand(pe(), (s ?? t).boundary.sphere, 1 * y);
    F.setBoundingSphere(G);
  }
  return F;
}
var JB = O(O(O({}, I8), k8), { includeParent: N.Boolean(!1) });
function hee(e) {
  return P8({ defaultProps: N.getDefaultValues(JB), createGeometry: pee, createLocationIterator: ld.fromGroup, getLoci: I_, eachLocation: P_, setUpdateState: function(t, n, r, i, a, o, s) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.linkScale !== r.linkScale || n.linkSpacing !== r.linkSpacing || n.aromaticDashCount !== r.aromaticDashCount || n.dashCount !== r.dashCount || n.ignoreHydrogens !== r.ignoreHydrogens || !Pa(n.includeTypes, r.includeTypes) || !Pa(n.excludeTypes, r.excludeTypes) || n.aromaticBonds !== r.aromaticBonds || n.multipleBonds !== r.multipleBonds;
    var u = o.group.units[0], l = s.group.units[0];
    ve.isAtomic(u) && ve.isAtomic(l) && (to.areEqual(u.bonds, l.bonds) || (t.createGeometry = !0, t.updateTransform = !0, t.updateColor = !0, t.updateSize = !0));
  } }, e);
}
var db = new pt.ElementBondIterator();
function sI(e, t, n, r) {
  for (db.setElement(t, n, r); db.hasNext; ) {
    var i = db.move();
    return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex], e), e;
  }
  return null;
}
function gee(e, t, n, r, i) {
  var a = t.interUnitBonds, o = a.edgeCount, s = a.edges;
  if (!o) return Mn.createEmpty(i);
  var u = r.sizeFactor, l = r.aromaticBonds, c = r.multipleBonds, d = c === "off", f = c === "symmetric", p = A(), g = He.create(), m = { linkCount: o, referencePosition: function(b) {
    var _, C, w, I, M = s[b];
    if (M.unitA < M.unitB) _ = t.unitMap.get(M.unitA), C = t.unitMap.get(M.unitB), w = M.indexA, I = M.indexB;
    else {
      if (!(M.unitA > M.unitB)) throw new Error("same units in createInterUnitBondLines");
      _ = t.unitMap.get(M.unitB), C = t.unitMap.get(M.unitA), w = M.indexB, I = M.indexA;
    }
    return sI(p, t, _, w) || sI(p, t, C, I);
  }, position: function(b, _, C) {
    var w = s[C], I = t.unitMap.get(w.unitA), M = t.unitMap.get(w.unitB);
    I.conformation.position(I.elements[w.indexA], b), M.conformation.position(M.elements[w.indexB], _);
  }, style: function(b) {
    var _ = s[b].props.order, C = Qi.create(s[b].props.flag);
    return cn.is(C, 2) || cn.is(C, 4) ? 1 : _ === 3 ? d ? 0 : f ? 4 : 5 : l && cn.is(C, 16) ? 7 : _ !== 2 || d ? 0 : f ? 2 : 3;
  }, radius: function(b) {
    var _ = s[b];
    g.structure = t, g.unit = t.unitMap.get(_.unitA), g.element = g.unit.elements[_.indexA];
    var C = n.size.size(g);
    g.unit = t.unitMap.get(_.unitB), g.element = g.unit.elements[_.indexB];
    var w = n.size.size(g);
    return Math.min(C, w) * u;
  }, ignore: EB(t, r) }, v = PB(0, m, r, i), h = v.lines, y = v.boundingSphere;
  if (y) h.setBoundingSphere(y);
  else if (h.lineCount > 0) {
    var x = t.child, S = pe.expand(pe(), (x ?? t).boundary.sphere, 1 * u);
    h.setBoundingSphere(S);
  }
  return h;
}
var $B = O(O(O({}, fJ), k8), { includeParent: N.Boolean(!1) });
function vee(e) {
  return function(t, n) {
    return A3(O(O({}, t), { setUpdateState: function(r, i, a, o, s, u, l) {
      t.setUpdateState(r, i, a, o, s, u, l), Ea.areEqual(o.size, s.size) || (r.updateSize = !0);
    }, geometryUtils: Mn.Utils }), n);
  }({ defaultProps: N.getDefaultValues($B), createGeometry: gee, createLocationIterator: ld.fromStructure, getLoci: M_, eachLocation: E_, setUpdateState: function(t, n, r, i, a, o, s) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.linkScale !== r.linkScale || n.linkSpacing !== r.linkSpacing || n.aromaticDashCount !== r.aromaticDashCount || n.dashCount !== r.dashCount || n.ignoreHydrogens !== r.ignoreHydrogens || !Pa(n.includeTypes, r.includeTypes) || !Pa(n.excludeTypes, r.excludeTypes) || n.multipleBonds !== r.multipleBonds, o.interUnitBonds !== s.interUnitBonds && (t.createGeometry = !0, t.updateTransform = !0, t.updateColor = !0, t.updateSize = !0);
  } }, e);
}
var T_, yee = be.add3, bee = be.add;
(function(e) {
  e.create = function(t, n, r) {
    t === void 0 && (t = 2048), n === void 0 && (n = 1024);
    var i = be.create(Float32Array, 3, n, r ? r.centerBuffer.ref.value : t), a = be.create(Float32Array, 1, n, r ? r.groupBuffer.ref.value : t);
    return { add: function(o, s, u, l) {
      yee(i, o, s, u), bee(a, l);
    }, getPoints: function() {
      var o = be.compact(i, !0), s = be.compact(a, !0);
      return wf.create(o, s, i.elementCount, r);
    } };
  };
})(T_ || (T_ = {}));
var uI = A.add, eR = O(O({}, gJ), { pointSizeAttenuation: N.Boolean(!1), ignoreHydrogens: N.Boolean(!1), traceOnly: N.Boolean(!1) });
function _ee(e, t, n, r, i, a) {
  var o = n.child;
  if (o && !o.unitMap.get(t.id)) return wf.createEmpty(a);
  var s = t.elements, u = s.length, l = T_.create(u, u / 10, a), c = A(), d = t.conformation.invariantPosition, f = M3(n, t, i), p = A(), g = 0;
  if (f) for (var m = 0; m < u; ++m) f(s[m]) || (d(s[m], c), uI(p, p, c), g += 1, l.add(c[0], c[1], c[2], m));
  else for (m = 0; m < u; ++m) d(s[m], c), uI(p, p, c), g += 1, l.add(c[0], c[1], c[2], m);
  var v, h = a ? pe.clone(a.boundingSphere) : void 0, y = l.getPoints();
  return g === 0 || (A.scale(p, p, 1 / g), v = h && A.distance(p, h.center) / h.radius < 1 ? h : pe.expand(pe(), t.boundary.sphere, 1), y.setBoundingSphere(v)), y;
}
function xee(e) {
  return function(t, n) {
    return mh(O(O({}, t), { setUpdateState: function(r, i, a, o, s, u, l) {
      t.setUpdateState(r, i, a, o, s, u, l), Ea.areEqual(o.size, s.size) || (r.updateSize = !0);
    }, geometryUtils: wf.Utils }), n);
  }({ defaultProps: N.getDefaultValues(eR), createGeometry: _ee, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(t, n, r) {
    t.createGeometry = n.ignoreHydrogens !== r.ignoreHydrogens || n.traceOnly !== r.traceOnly;
  } }, e);
}
var g1 = A.scaleAndAdd, lI = A.unitX, cI = A.unitY, dI = A.unitZ, tR = O(O({}, I8), { lineSizeAttenuation: N.Boolean(!1), ignoreHydrogens: N.Boolean(!1), traceOnly: N.Boolean(!1), crosses: N.Select("lone", N.arrayToOptions(["lone", "all"])), crossSize: N.Numeric(0.35, { min: 0, max: 2, step: 0.01 }) });
function Cee(e, t, n, r, i, a) {
  var o = n.child;
  if (o && !o.unitMap.get(t.id)) return Mn.createEmpty(a);
  for (var s = t.elements, u = s.length, l = zi.create(u, u / 10, a), c = A(), d = A(), f = A(), p = t.conformation.invariantPosition, g = M3(n, t, i), m = i.crossSize / 2, v = i.crosses === "lone", h = 0; h < u; ++h) g && g(s[h]) || v && ve.isAtomic(t) && L0(n, t, h) !== 0 || (p(s[h], c), g1(d, c, lI, m), g1(f, c, lI, -m), l.add(d[0], d[1], d[2], f[0], f[1], f[2], h), g1(d, c, cI, m), g1(f, c, cI, -m), l.add(d[0], d[1], d[2], f[0], f[1], f[2], h), g1(d, c, dI, m), g1(f, c, dI, -m), l.add(d[0], d[1], d[2], f[0], f[1], f[2], h));
  var y = l.getLines(), x = pe.expand(pe(), t.boundary.sphere, 1 * i.sizeFactor);
  return y.setBoundingSphere(x), y;
}
function See(e) {
  return P8({ defaultProps: N.getDefaultValues(tR), createGeometry: Cee, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(t, n, r) {
    t.createGeometry = n.ignoreHydrogens !== r.ignoreHydrogens || n.traceOnly !== r.traceOnly || n.crosses !== r.crosses || n.crossSize !== r.crossSize;
  } }, e);
}
var nR = { "intra-bond": function(e, t) {
  return ca("Intra-unit bond line", e, t, hee);
}, "inter-bond": function(e, t) {
  return Mf("Inter-unit bond line", e, t, vee);
}, "element-point": function(e, t) {
  return ca("Points", e, t, xee);
}, "element-cross": function(e, t) {
  return ca("Crosses", e, t, See);
}, "charge-text": function(e, t) {
  return Mf("Charge Text", e, t, O8);
} }, fI = O(O(O(O(O({}, JB), $B), eR), tR), { multipleBonds: N.Select("offset", N.arrayToOptions(["off", "symmetric", "offset"])), includeParent: N.Boolean(!1), sizeFactor: N.Numeric(0.01, { min: 0.01, max: 10, step: 0.01 }), unitKinds: fh(["atomic"]), visuals: N.MultiSelect(["intra-bond", "inter-bond", "element-point", "element-cross", "charge-text"], N.objectToOptions(nR)), lineSizeAttenuation: N.Boolean(!0), traceOnly: N.Boolean(!1, { isHidden: !0 }), pointSizeAttenuation: N.Boolean(!0), pointStyle: N.Select("circle", N.objectToOptions({ square: "Square", circle: "Circle", fuzzy: "Fuzzy" })) }), fb = { name: "line", label: "Line", description: "Displays bonds as lines and atoms as points or croses.", factory: function(e, t) {
  return en.createMulti("Line", e, t, Ao, nR);
}, getParams: function(e, t) {
  var n = N.clone(fI);
  return n.pointStyle.defaultValue = "circle", n;
}, defaultValues: N.getDefaultValues(fI), defaultColorTheme: { name: "element-symbol" }, defaultSizeTheme: { name: "uniform" }, isApplicable: function(e) {
  return e.elementCount > 0;
}, getData: function(e, t) {
  return t.includeParent ? e.asParent() : e;
}, mustRecreate: function(e, t) {
  return e.includeParent !== t.includeParent;
} }, Aee = { create: function(e, t, n) {
  var r;
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return (i = fb.factory(t, fb.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("uniform", { structure: e }) }), [4, i.createOrUpdate(O(O({}, fb.defaultValues), { aromaticBonds: ((r = e.model) === null || r === void 0 ? void 0 : r.sourceData.kind) === "mmCIF", quality: "auto", visuals: t.props.hideBond ? ["element-point", "element-cross", "charge-text"] : ["element-point", "element-cross", "charge-text", "intra-bond", "inter-bond"] }), e).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("uniform", { structure: t }) }), [4, e.createOrUpdate({ visuals: n.props.hideBond ? ["element-point", "element-cross", "charge-text"] : ["element-point", "element-cross", "charge-text", "intra-bond", "inter-bond"] }, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, rR = { "element-sphere": function(e, t) {
  return ca("Element sphere", e, t, D8);
}, "intra-bond": function(e, t) {
  return ca("Intra-unit bond cylinder", e, t, kB);
}, "inter-bond": function(e, t) {
  return Mf("Inter-unit bond cylinder", e, t, OB);
}, "charge-text": function(e, t) {
  return Mf("Charge Text", e, t, O8);
} }, mI = O(O(O(O(O({}, z0), { traceOnly: N.Boolean(!1, { isHidden: !0 }) }), Mv), Ev), { includeParent: N.Boolean(!1), unitKinds: fh(["atomic"]), visuals: N.MultiSelect(["element-sphere", "intra-bond", "inter-bond", "charge-text"], N.objectToOptions(rR)), bumpFrequency: N.Numeric(0, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), sizeFactor: N.Numeric(0.15, { min: 0.01, max: 10, step: 0.01 }), sizeAspectRatio: N.Numeric(1, { min: 0.01, max: 3, step: 0.01 }), multipleBonds: N.Select("offset", N.arrayToOptions(["off", "symmetric", "offset"])), tryUseImpostor: N.Boolean(!0), linkScale: N.Numeric(0.55, { min: 0, max: 1, step: 0.01 }) }), mb = { name: "stick", label: "Stick", description: "Displays atoms as spheres and bonds as cylinders.", factory: function(e, t) {
  return en.createMulti("Ball & Stick", e, t, Ao, rR);
}, getParams: function(e, t) {
  return N.clone(mI);
}, defaultValues: N.getDefaultValues(mI), defaultColorTheme: { name: "element-symbol" }, defaultSizeTheme: { name: "uniform" }, isApplicable: function(e) {
  return e.elementCount > 0;
}, getData: function(e, t) {
  return t.includeParent ? e.asParent() : e;
}, mustRecreate: function(e, t) {
  return e.includeParent !== t.includeParent;
} }, wee = { create: function(e, t, n) {
  var r;
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return (i = mb.factory(t, mb.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("uniform", { structure: e }) }), [4, i.createOrUpdate(O(O({}, mb.defaultValues), { aromaticBonds: ((r = e.model) === null || r === void 0 ? void 0 : r.sourceData.kind) === "mmCIF", quality: "auto", visuals: t.props.hideBond ? ["element-sphere", "charge-text"] : ["element-sphere", "intra-bond", "inter-bond", "charge-text"] }), e).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("uniform", { structure: t }) }), [4, e.createOrUpdate({ visuals: n.props.hideBond ? ["element-sphere", "charge-text"] : ["element-sphere", "intra-bond", "inter-bond", "charge-text"] }, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, N8 = { probeRadius: N.Numeric(1.4, { min: 0, max: 10, step: 0.1 }, { description: "Radius of the probe tracing the molecular surface." }), resolution: N.Numeric(0.5, { min: 0.01, max: 20, step: 0.01 }, O({ description: "Grid resolution/cell spacing." }, Qe.CustomQualityParamInfo)), probePositions: N.Numeric(36, { min: 12, max: 90, step: 1 }, O({ description: "Number of positions tested for probe target intersection." }, Qe.CustomQualityParamInfo)) };
function Iee(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    function o(Pe, Xe, Ke, de, we) {
      if (d !== -1) {
        if ((Le = d) !== de && Le !== we && s(Le, Pe, Xe, Ke)) return Le;
        d = -1;
      }
      for (var Ie = 0, Ee = C.count; Ie < Ee; ++Ie) {
        var Le;
        if ((Le = _e.getAt(w, C.indices[Ie])) !== de && Le !== we && s(Le, Pe, Xe, Ke)) return d = Le, Le;
      }
      return -1;
    }
    function s(Pe, Xe, Ke, de) {
      var we = P[Pe], Ie = I[Pe] - Xe, Ee = M[Pe] - Ke, Le = E[Pe] - de;
      return Ie * Ie + Ee * Ee + Le * Le < we * we;
    }
    function u() {
      return se(this, 0, void 0, function() {
        var Pe;
        return ie(this, function(Xe) {
          switch (Xe.label) {
            case 0:
              Pe = 0, Xe.label = 1;
            case 1:
              return Pe < k ? (function(Ke, de) {
                for (var we = Ke; we < de; ++we) {
                  var Ie = _e.getAt(w, we), Ee = I[Ie], Le = M[Ie], De = E[Ie], rt = P[Ie], st = rt * rt;
                  _.find(Ee, Le, De, rt);
                  for (var gt = Math.ceil(rt * x), ft = Math.floor(x * (Ee - F)), yt = Math.floor(x * (Le - V)), It = Math.floor(x * (De - G)), ge = Math.max(0, ft - gt), Je = Math.max(0, yt - gt), Mt = Math.max(0, It - gt), wn = Math.min(z, ft + gt + 2), tn = Math.min(K, yt + gt + 2), Te = Math.min(Y, It + gt + 2), At = ge; At < wn; ++At) for (var Gt = he[At] - Ee, Tt = At * X, nn = Je; nn < tn; ++nn) for (var Pt = Oe[nn] - Le, Yt = Gt * Gt + Pt * Pt, Rn = nn * Z + Tt, kn = Mt; kn < Te; ++kn) {
                    var Pn = Ne[kn] - De, Kn = Yt + Pn * Pn;
                    if (Kn < st) {
                      var br = kn + Rn;
                      ce[br] < 0 && (ce[br] *= -1);
                      var ra = Math.sqrt(Kn), dr = rt / ra;
                      if (o(Gt * dr + Ee, Pt * dr + Le, Pn * dr + De, Ie, -1) === -1) {
                        var Ln = rt - ra;
                        Ln < ce[br] && (ce[br] = Ln, ae[br] = T[we]);
                      }
                    }
                  }
                }
              }(Pe, Math.min(Pe + Ue, k)), e.shouldUpdate ? [4, e.update({ message: "projecting points", current: Pe, max: k })] : [3, 3]) : [3, 4];
            case 2:
              Xe.sent(), Xe.label = 3;
            case 3:
              return Pe += Ue, [3, 1];
            case 4:
              return [2];
          }
        });
      });
    }
    function l(Pe, Xe) {
      var Ke = P[Pe], de = P[Xe], we = f[0] = I[Xe] - I[Pe], Ie = f[1] = M[Xe] - M[Pe], Ee = f[2] = E[Xe] - E[Pe], Le = we * we + Ie * Ie + Ee * Ee, De = Math.sqrt(Le), rt = Ke * ((Ke * Ke + De * De - de * de) / (2 * Ke * De));
      A.normalize(f, f), function(ia, Mr) {
        ia[0] = ia[1] = ia[2] = 1, Mr[0] !== 0 ? ia[0] = (Mr[1] + Mr[2]) / -Mr[0] : Mr[1] !== 0 ? ia[1] = (Mr[0] + Mr[2]) / -Mr[1] : Mr[2] !== 0 && (ia[2] = (Mr[0] + Mr[1]) / -Mr[2]);
      }(g, f), A.normalize(g, g), A.cross(m, f, g), A.normalize(m, m);
      var st = Math.sqrt(Ke * Ke - rt * rt);
      A.scale(g, g, st), A.scale(m, m, st), A.scale(f, f, rt), p[0] = f[0] + I[Pe], p[1] = f[1] + M[Pe], p[2] = f[2] + E[Pe], d = -1;
      for (var gt = 0; gt < y; ++gt) {
        var ft = J[gt], yt = $[gt], It = p[0] + ft * g[0] + yt * m[0], ge = p[1] + ft * g[1] + yt * m[1], Je = p[2] + ft * g[2] + yt * m[2];
        if (o(It, ge, Je, Pe, Xe) === -1) for (var Mt = Math.floor(x * (It - F)), wn = Math.floor(x * (ge - V)), tn = Math.floor(x * (Je - G)), Te = Math.max(0, Mt - S), At = Math.max(0, wn - S), Gt = Math.max(0, tn - S), Tt = Math.min(z, Mt + S + 2), nn = Math.min(K, wn + S + 2), Pt = Math.min(Y, tn + S + 2), Yt = Te; Yt < Tt; ++Yt) for (var Rn = It - he[Yt], kn = Yt * X, Pn = At; Pn < nn; ++Pn) for (var Kn = ge - Oe[Pn], br = Rn * Rn + Kn * Kn, ra = Pn * Z + kn, dr = Gt; dr < Pt; ++dr) {
          var Ln = Je - Ne[dr], Cr = br + Ln * Ln, yi = dr + ra, ri = ce[yi];
          if (ri > 0 && Cr < ri * ri) {
            ce[yi] = Math.sqrt(Cr);
            var Hi = Rn * f[0] + Kn * f[1] + Ln * f[2];
            ae[yi] = T[_e.indexOf(w, Hi < 0 ? Xe : Pe)];
          }
        }
      }
    }
    function c() {
      return se(this, 0, void 0, function() {
        var Pe;
        return ie(this, function(Xe) {
          switch (Xe.label) {
            case 0:
              Pe = 0, Xe.label = 1;
            case 1:
              return Pe < k ? (function(Ke, de) {
                for (var we = Ke; we < de; ++we) {
                  var Ie = _e.getAt(w, we);
                  _.find(I[Ie], M[Ie], E[Ie], P[Ie]);
                  for (var Ee = 0, Le = C.count; Ee < Le; ++Ee) {
                    var De = _e.getAt(w, C.indices[Ee]);
                    Ie < De && l(Ie, De);
                  }
                }
              }(Pe, Math.min(Pe + Ue, k)), e.shouldUpdate ? [4, e.update({ message: "projecting torii", current: Pe, max: k })] : [3, 3]) : [3, 4];
            case 2:
              Xe.sent(), Xe.label = 3;
            case 3:
              return Pe += Ue, [3, 1];
            case 4:
              return [2];
          }
        });
      });
    }
    var d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W, J, $, ee, ce, ae, he, Oe, Ne, Ue, Ze, Se, qe;
    return ie(this, function(Pe) {
      switch (Pe.label) {
        case 0:
          return d = -1, f = A(), p = A(), g = A(), m = A(), v = a.resolution, h = a.probeRadius, y = a.probePositions, x = 1 / v, S = Math.max(5, 2 + Math.floor(h * x)), b = A.create(r, r, r), A.scale(b, b, 2), _ = bf(t, n, b), C = _.result, i === null && (i = _.boundary.box), w = t.indices, I = t.x, M = t.y, E = t.z, T = t.id, P = t.radius, k = _e.size(w), D = r + v, B = qn.expand(qn(), i, A.create(D, D, D)), L = B.min, F = L[0], V = L[1], G = L[2], H = qn.scale(qn(), B, x), q = qn.size(A(), H), A.ceil(q, q), z = q[0], K = q[1], Y = q[2], X = (Z = Y) * K, W = function(Xe) {
            for (var Ke = 0, de = 2 * Math.PI / Xe, we = new Float32Array(Xe), Ie = new Float32Array(Xe), Ee = 0; Ee < Xe; Ee++) we[Ee] = Math.cos(Ke), Ie[Ee] = Math.sin(Ke), Ke += de;
            return { cosTable: we, sinTable: Ie };
          }(y), J = W.cosTable, $ = W.sinTable, ee = wr.Space(q, [0, 1, 2], Float32Array), ce = ee.create(), ae = ee.create(), ce.fill(-1001), ae.fill(-1), he = _y(z, F, v), Oe = _y(K, V, v), Ne = _y(Y, G, v), Ue = Math.ceil(1e5 / (Math.pow(Math.pow(r, 3), 3) * x)), [4, u()];
        case 1:
          return Pe.sent(), [4, c()];
        case 2:
          return Pe.sent(), Ze = wr.create(ee, ce), Se = wr.create(ee, ae), qe = ne.identity(), ne.fromScaling(qe, A.create(v, v, v)), ne.setTranslation(qe, B.min), [2, { field: Ze, idField: Se, transform: qe, resolution: v, maxRadius: r }];
      }
    });
  });
}
function iR(e, t, n, r) {
  var i = this, a = t.lookup3d.boundary.box, o = aJ(a, r), s = function(d, f, p, g) {
    for (var m = g.probeRadius, v = uJ(d, f, p, g), h = v.position, y = v.boundary, x = v.radius, S = h.indices, b = _e.size(S), _ = new Float32Array(_e.end(S)), C = 0, w = 0; w < b; ++w) {
      var I = _e.getAt(S, w), M = x(I);
      C < M && (C = M), _[I] = M + m;
    }
    return { position: O(O({}, h), { radius: _ }), boundary: y, maxRadius: C };
  }(e, t, n, o), u = s.position, l = s.boundary, c = s.maxRadius;
  return Xt.create("Molecular Surface", function(d) {
    return se(i, 0, void 0, function() {
      return ie(this, function(f) {
        switch (f.label) {
          case 0:
            return [4, Pee(d, u, l, c, a, o)];
          case 1:
            return [2, f.sent()];
        }
      });
    });
  });
}
function Pee(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    return ie(this, function(o) {
      return [2, Iee(e, t, n, r, i, a)];
    });
  });
}
function bc(e, t, n) {
  return { i: e, j: t, k: n };
}
function Uo(e, t) {
  return { a: e, b: t };
}
N.getDefaultValues(N8);
var Dr = [bc(0, 0, 0), bc(1, 0, 0), bc(1, 1, 0), bc(0, 1, 0), bc(0, 0, 1), bc(1, 0, 1), bc(1, 1, 1), bc(0, 1, 1)], Mee = [Uo(Dr[0], Dr[1]), Uo(Dr[1], Dr[2]), Uo(Dr[2], Dr[3]), Uo(Dr[3], Dr[0]), Uo(Dr[4], Dr[5]), Uo(Dr[5], Dr[6]), Uo(Dr[6], Dr[7]), Uo(Dr[7], Dr[4]), Uo(Dr[0], Dr[4]), Uo(Dr[1], Dr[5]), Uo(Dr[2], Dr[6]), Uo(Dr[3], Dr[7])], Eee = [{ i: 0, j: 0, k: 0, e: 0 }, { i: 1, j: 0, k: 0, e: 1 }, { i: 0, j: 1, k: 0, e: 0 }, { i: 0, j: 0, k: 0, e: 1 }, { i: 0, j: 0, k: 1, e: 0 }, { i: 1, j: 0, k: 1, e: 1 }, { i: 0, j: 1, k: 1, e: 0 }, { i: 0, j: 0, k: 1, e: 1 }, { i: 0, j: 0, k: 0, e: 2 }, { i: 1, j: 0, k: 0, e: 2 }, { i: 1, j: 1, k: 0, e: 2 }, { i: 0, j: 1, k: 0, e: 2 }], Tee = [0, 265, 515, 778, 1030, 1295, 1541, 1804, 2060, 2309, 2575, 2822, 3082, 3331, 3593, 3840, 400, 153, 915, 666, 1430, 1183, 1941, 1692, 2460, 2197, 2975, 2710, 3482, 3219, 3993, 3728, 560, 825, 51, 314, 1590, 1855, 1077, 1340, 2620, 2869, 2111, 2358, 3642, 3891, 3129, 3376, 928, 681, 419, 170, 1958, 1711, 1445, 1196, 2988, 2725, 2479, 2214, 4010, 3747, 3497, 3232, 1120, 1385, 1635, 1898, 102, 367, 613, 876, 3180, 3429, 3695, 3942, 2154, 2403, 2665, 2912, 1520, 1273, 2035, 1786, 502, 255, 1013, 764, 3580, 3317, 4095, 3830, 2554, 2291, 3065, 2800, 1616, 1881, 1107, 1370, 598, 863, 85, 348, 3676, 3925, 3167, 3414, 2650, 2899, 2137, 2384, 1984, 1737, 1475, 1226, 966, 719, 453, 204, 4044, 3781, 3535, 3270, 3018, 2755, 2505, 2240, 2240, 2505, 2755, 3018, 3270, 3535, 3781, 4044, 204, 453, 719, 966, 1226, 1475, 1737, 1984, 2384, 2137, 2899, 2650, 3414, 3167, 3925, 3676, 348, 85, 863, 598, 1370, 1107, 1881, 1616, 2800, 3065, 2291, 2554, 3830, 4095, 3317, 3580, 764, 1013, 255, 502, 1786, 2035, 1273, 1520, 2912, 2665, 2403, 2154, 3942, 3695, 3429, 3180, 876, 613, 367, 102, 1898, 1635, 1385, 1120, 3232, 3497, 3747, 4010, 2214, 2479, 2725, 2988, 1196, 1445, 1711, 1958, 170, 419, 681, 928, 3376, 3129, 3891, 3642, 2358, 2111, 2869, 2620, 1340, 1077, 1855, 1590, 314, 51, 825, 560, 3728, 3993, 3219, 3482, 2710, 2975, 2197, 2460, 1692, 1941, 1183, 1430, 666, 915, 153, 400, 3840, 3593, 3331, 3082, 2822, 2575, 2309, 2060, 1804, 1541, 1295, 1030, 778, 515, 265, 0], z1 = [[], [0, 8, 3], [0, 1, 9], [1, 8, 3, 9, 8, 1], [1, 2, 10], [0, 8, 3, 1, 2, 10], [9, 2, 10, 0, 2, 9], [2, 8, 3, 2, 10, 8, 10, 9, 8], [3, 11, 2], [0, 11, 2, 8, 11, 0], [1, 9, 0, 2, 3, 11], [1, 11, 2, 1, 9, 11, 9, 8, 11], [3, 10, 1, 11, 10, 3], [0, 10, 1, 0, 8, 10, 8, 11, 10], [3, 9, 0, 3, 11, 9, 11, 10, 9], [9, 8, 10, 10, 8, 11], [4, 7, 8], [4, 3, 0, 7, 3, 4], [0, 1, 9, 8, 4, 7], [4, 1, 9, 4, 7, 1, 7, 3, 1], [1, 2, 10, 8, 4, 7], [3, 4, 7, 3, 0, 4, 1, 2, 10], [9, 2, 10, 9, 0, 2, 8, 4, 7], [2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4], [8, 4, 7, 3, 11, 2], [11, 4, 7, 11, 2, 4, 2, 0, 4], [9, 0, 1, 8, 4, 7, 2, 3, 11], [4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1], [3, 10, 1, 3, 11, 10, 7, 8, 4], [1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4], [4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3], [4, 7, 11, 4, 11, 9, 9, 11, 10], [9, 5, 4], [9, 5, 4, 0, 8, 3], [0, 5, 4, 1, 5, 0], [8, 5, 4, 8, 3, 5, 3, 1, 5], [1, 2, 10, 9, 5, 4], [3, 0, 8, 1, 2, 10, 4, 9, 5], [5, 2, 10, 5, 4, 2, 4, 0, 2], [2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8], [9, 5, 4, 2, 3, 11], [0, 11, 2, 0, 8, 11, 4, 9, 5], [0, 5, 4, 0, 1, 5, 2, 3, 11], [2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5], [10, 3, 11, 10, 1, 3, 9, 5, 4], [4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10], [5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3], [5, 4, 8, 5, 8, 10, 10, 8, 11], [9, 7, 8, 5, 7, 9], [9, 3, 0, 9, 5, 3, 5, 7, 3], [0, 7, 8, 0, 1, 7, 1, 5, 7], [1, 5, 3, 3, 5, 7], [9, 7, 8, 9, 5, 7, 10, 1, 2], [10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3], [8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2], [2, 10, 5, 2, 5, 3, 3, 5, 7], [7, 9, 5, 7, 8, 9, 3, 11, 2], [9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11], [2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7], [11, 2, 1, 11, 1, 7, 7, 1, 5], [9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11], [5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0], [11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0], [11, 10, 5, 7, 11, 5], [10, 6, 5], [0, 8, 3, 5, 10, 6], [9, 0, 1, 5, 10, 6], [1, 8, 3, 1, 9, 8, 5, 10, 6], [1, 6, 5, 2, 6, 1], [1, 6, 5, 1, 2, 6, 3, 0, 8], [9, 6, 5, 9, 0, 6, 0, 2, 6], [5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8], [2, 3, 11, 10, 6, 5], [11, 0, 8, 11, 2, 0, 10, 6, 5], [0, 1, 9, 2, 3, 11, 5, 10, 6], [5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11], [6, 3, 11, 6, 5, 3, 5, 1, 3], [0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6], [3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9], [6, 5, 9, 6, 9, 11, 11, 9, 8], [5, 10, 6, 4, 7, 8], [4, 3, 0, 4, 7, 3, 6, 5, 10], [1, 9, 0, 5, 10, 6, 8, 4, 7], [10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4], [6, 1, 2, 6, 5, 1, 4, 7, 8], [1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7], [8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6], [7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9], [3, 11, 2, 7, 8, 4, 10, 6, 5], [5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11], [0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6], [9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6], [8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6], [5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11], [0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7], [6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9], [10, 4, 9, 6, 4, 10], [4, 10, 6, 4, 9, 10, 0, 8, 3], [10, 0, 1, 10, 6, 0, 6, 4, 0], [8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10], [1, 4, 9, 1, 2, 4, 2, 6, 4], [3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4], [0, 2, 4, 4, 2, 6], [8, 3, 2, 8, 2, 4, 4, 2, 6], [10, 4, 9, 10, 6, 4, 11, 2, 3], [0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6], [3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10], [6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1], [9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3], [8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1], [3, 11, 6, 3, 6, 0, 0, 6, 4], [6, 4, 8, 11, 6, 8], [7, 10, 6, 7, 8, 10, 8, 9, 10], [0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10], [10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0], [10, 6, 7, 10, 7, 1, 1, 7, 3], [1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7], [2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9], [7, 8, 0, 7, 0, 6, 6, 0, 2], [7, 3, 2, 6, 7, 2], [2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7], [2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7], [1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11], [11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1], [8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6], [0, 9, 1, 11, 6, 7], [7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0], [7, 11, 6], [7, 6, 11], [3, 0, 8, 11, 7, 6], [0, 1, 9, 11, 7, 6], [8, 1, 9, 8, 3, 1, 11, 7, 6], [10, 1, 2, 6, 11, 7], [1, 2, 10, 3, 0, 8, 6, 11, 7], [2, 9, 0, 2, 10, 9, 6, 11, 7], [6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8], [7, 2, 3, 6, 2, 7], [7, 0, 8, 7, 6, 0, 6, 2, 0], [2, 7, 6, 2, 3, 7, 0, 1, 9], [1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6], [10, 7, 6, 10, 1, 7, 1, 3, 7], [10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8], [0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7], [7, 6, 10, 7, 10, 8, 8, 10, 9], [6, 8, 4, 11, 8, 6], [3, 6, 11, 3, 0, 6, 0, 4, 6], [8, 6, 11, 8, 4, 6, 9, 0, 1], [9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6], [6, 8, 4, 6, 11, 8, 2, 10, 1], [1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6], [4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9], [10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3], [8, 2, 3, 8, 4, 2, 4, 6, 2], [0, 4, 2, 4, 6, 2], [1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8], [1, 9, 4, 1, 4, 2, 2, 4, 6], [8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1], [10, 1, 0, 10, 0, 6, 6, 0, 4], [4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3], [10, 9, 4, 6, 10, 4], [4, 9, 5, 7, 6, 11], [0, 8, 3, 4, 9, 5, 11, 7, 6], [5, 0, 1, 5, 4, 0, 7, 6, 11], [11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5], [9, 5, 4, 10, 1, 2, 7, 6, 11], [6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5], [7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2], [3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6], [7, 2, 3, 7, 6, 2, 5, 4, 9], [9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7], [3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0], [6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8], [9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7], [1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4], [4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10], [7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10], [6, 9, 5, 6, 11, 9, 11, 8, 9], [3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5], [0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11], [6, 11, 3, 6, 3, 5, 5, 3, 1], [1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6], [0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10], [11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5], [6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3], [5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2], [9, 5, 6, 9, 6, 0, 0, 6, 2], [1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8], [1, 5, 6, 2, 1, 6], [1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6], [10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0], [0, 3, 8, 5, 6, 10], [10, 5, 6], [11, 5, 10, 7, 5, 11], [11, 5, 10, 11, 7, 5, 8, 3, 0], [5, 11, 7, 5, 10, 11, 1, 9, 0], [10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1], [11, 1, 2, 11, 7, 1, 7, 5, 1], [0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11], [9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7], [7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2], [2, 5, 10, 2, 3, 5, 3, 7, 5], [8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5], [9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2], [9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2], [1, 3, 5, 3, 7, 5], [0, 8, 7, 0, 7, 1, 1, 7, 5], [9, 0, 3, 9, 3, 5, 5, 3, 7], [9, 8, 7, 5, 9, 7], [5, 8, 4, 5, 10, 8, 10, 11, 8], [5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0], [0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5], [10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4], [2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8], [0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11], [0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5], [9, 4, 5, 2, 11, 3], [2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4], [5, 10, 2, 5, 2, 4, 4, 2, 0], [3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9], [5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2], [8, 4, 5, 8, 5, 3, 3, 5, 1], [0, 4, 5, 1, 0, 5], [8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5], [9, 4, 5], [4, 11, 7, 4, 9, 11, 9, 10, 11], [0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11], [1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11], [3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4], [4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2], [9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3], [11, 7, 4, 11, 4, 2, 2, 4, 0], [11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4], [2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9], [9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7], [3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10], [1, 10, 2, 8, 7, 4], [4, 9, 1, 4, 1, 7, 7, 1, 3], [4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1], [4, 0, 3, 7, 4, 3], [4, 8, 7], [9, 10, 8, 10, 11, 8], [3, 0, 9, 3, 9, 11, 11, 9, 10], [0, 1, 10, 0, 10, 8, 8, 10, 11], [3, 1, 10, 11, 3, 10], [1, 2, 11, 1, 11, 9, 9, 11, 8], [3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9], [0, 2, 11, 8, 0, 11], [3, 2, 11], [2, 3, 8, 2, 8, 10, 10, 8, 9], [9, 10, 2, 0, 9, 2], [2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8], [1, 10, 2], [1, 3, 8, 9, 1, 8], [0, 9, 1], [0, 3, 8], []], pb = [[0, 4, 4, 4, 2, 0, 0, 0, 2, 2, 0, 0], [4, 0, 4, 4, 0, 8, 0, 0, 0, 8, 8, 0], [4, 4, 0, 4, 0, 0, 8, 0, 0, 0, 8, 8], [4, 4, 4, 0, 0, 0, 0, 1, 1, 0, 0, 1], [2, 0, 0, 0, 0, 8, 8, 8, 2, 2, 0, 0], [0, 8, 0, 0, 8, 0, 8, 8, 0, 8, 8, 0], [0, 0, 8, 0, 8, 8, 0, 8, 0, 0, 8, 8], [0, 0, 0, 1, 8, 8, 8, 0, 1, 0, 0, 1], [2, 0, 0, 1, 2, 0, 0, 1, 0, 2, 0, 1], [2, 8, 0, 0, 2, 8, 0, 0, 2, 0, 8, 0], [0, 8, 8, 0, 0, 8, 8, 0, 0, 8, 0, 8], [0, 0, 8, 1, 0, 0, 8, 1, 1, 0, 8, 0]];
function aR(e) {
  return O(O({}, e), { bottomLeft: ui(e.bottomLeft, [0, 0, 0]), topRight: ui(e.topRight, e.scalarField.space.dimensions) });
}
function oR(e) {
  return { dX: e.topRight[0] - e.bottomLeft[0], dY: e.topRight[1] - e.bottomLeft[1], dZ: e.topRight[2] - e.bottomLeft[2] };
}
function sR(e, t) {
  var n = this;
  return Xt.create("Marching Cubes Mesh", function(r) {
    return se(n, 0, void 0, function() {
      var i, a, o, s, u, l, c;
      return ie(this, function(d) {
        switch (d.label) {
          case 0:
            return i = aR(e), a = oR(i), o = a.dX, s = a.dY, u = a.dZ, l = Math.min(262144, Math.max(o * s * u / 32, 1024)), c = function(f, p) {
              var g = Math.min(65536, 4 * f), m = be.create(Float32Array, 3, f, p && p.vertexBuffer.ref.value), v = be.create(Float32Array, 3, f, p && p.normalBuffer.ref.value), h = be.create(Float32Array, 1, f, p && p.groupBuffer.ref.value), y = be.create(Uint32Array, 3, g, p && p.indexBuffer.ref.value), x = 0, S = 0;
              return { addVertex: function(b, _, C) {
                return ++x, be.add3(m, b, _, C);
              }, addNormal: function(b, _, C) {
                be.add3(v, b, _, C);
              }, addGroup: function(b) {
                be.add(h, b);
              }, addTriangle: function(b, _, C, w) {
                var I = b[_], M = b[C], E = b[w];
                I >= 0 && M >= 0 && E >= 0 && (++S, be.add3(y, I, M, E));
              }, get: function() {
                var b = be.compact(m, !0), _ = be.compact(v, !0), C = be.compact(y, !0), w = be.compact(h, !0);
                return Lt.create(b, C, _, w, x, S, p);
              } };
            }(l, t), [4, new lR(r, c, i).run()];
          case 1:
            return d.sent(), [2, c.get()];
        }
      });
    });
  });
}
function uR(e, t) {
  var n = this;
  return Xt.create("Marching Cubes Lines", function(r) {
    return se(n, 0, void 0, function() {
      var i, a, o, s, u, l, c;
      return ie(this, function(d) {
        switch (d.label) {
          case 0:
            return i = aR(e), a = oR(i), o = a.dX, s = a.dY, u = a.dZ, l = Math.min(262144, Math.max(o * s * u / 32, 1024)), c = function(f, p) {
              var g = be.create(Float32Array, 3, f), m = be.create(Float32Array, 1, f), v = be.create(Float32Array, 2, f), h = 0;
              return { addVertex: function(y, x, S) {
                return be.add3(g, y, x, S);
              }, addNormal: function() {
                return k6;
              }, addGroup: function(y) {
                be.add(m, y);
              }, addTriangle: function(y, x, S, b, _) {
                var C = y[x], w = y[S], I = y[b];
                C >= 0 && w >= 0 && I >= 0 && (pb[x][S] & _ && (++h, be.add2(v, y[x], y[S])), pb[S][b] & _ && (++h, be.add2(v, y[S], y[b])), pb[x][b] & _ && (++h, be.add2(v, y[x], y[b])));
              }, get: function() {
                for (var y = be.compact(g, !0), x = be.compact(v, !0), S = be.compact(m, !0), b = zi.create(h, h / 10, p), _ = 0; _ < h; ++_) {
                  var C = x[2 * _], w = x[2 * _ + 1];
                  b.add(y[3 * C], y[3 * C + 1], y[3 * C + 2], y[3 * w], y[3 * w + 1], y[3 * w + 2], S[C]);
                }
                return b.getLines();
              } };
            }(l, t), [4, new lR(r, c, i).run()];
          case 1:
            return d.sent(), [2, c.get()];
        }
      });
    });
  });
}
var lR = function() {
  function e(t, n, r) {
    this.ctx = t, this.minX = 0, this.minY = 0, this.minZ = 0, this.maxX = 0, this.maxY = 0, this.maxZ = 0, this.state = new kee(n, r), this.minX = r.bottomLeft[0], this.minY = r.bottomLeft[1], this.minZ = r.bottomLeft[2], this.maxX = r.topRight[0] - 1, this.maxY = r.topRight[1] - 1, this.maxZ = r.topRight[2] - 1, this.size = (this.maxX - this.minX) * (this.maxY - this.minY) * (this.maxZ - this.minZ), this.sliceSize = (this.maxX - this.minX) * (this.maxY - this.minY);
  }
  return e.prototype.doSlices = function() {
    return se(this, 0, void 0, function() {
      var t, n;
      return ie(this, function(r) {
        switch (r.label) {
          case 0:
            t = 0, this.edgeFilter = 15, n = this.minZ, r.label = 1;
          case 1:
            return n < this.maxZ ? (this.slice(n), t += this.sliceSize, this.ctx.shouldUpdate ? [4, this.ctx.update({ message: "Computing surface...", current: t, max: this.size })] : [3, 3]) : [3, 4];
          case 2:
            r.sent(), r.label = 3;
          case 3:
            return n++, this.edgeFilter &= -5, [3, 1];
          case 4:
            return [2];
        }
      });
    });
  }, e.prototype.slice = function(t) {
    this.edgeFilter |= 2;
    for (var n = this.minY; n < this.maxY; n++, this.edgeFilter &= -3) {
      this.edgeFilter |= 1;
      for (var r = this.minX; r < this.maxX; r++, this.edgeFilter &= -2) this.state.processCell(r, n, t, this.edgeFilter);
    }
    this.state.clearEdgeVertexIndexSlice(t);
  }, e.prototype.run = function() {
    return se(this, 0, void 0, function() {
      return ie(this, function(t) {
        switch (t.label) {
          case 0:
            return [4, this.doSlices()];
          case 1:
            return t.sent(), [2];
        }
      });
    });
  }, e;
}(), kee = function() {
  function e(t, n) {
    this.builder = t, this.vertList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], this.i = 0, this.j = 0, this.k = 0;
    var r = n.scalarField.space.dimensions;
    this.nX = r[0], this.nY = r[1], this.nZ = r[2], this.isoLevel = n.isoLevel, this.scalarFieldGet = n.scalarField.space.get, this.scalarField = n.scalarField.data, n.idField && (this.idField = n.idField.data, this.idFieldGet = n.idField.space.get), this.verticesOnEdges = new Int32Array(3 * this.nX * this.nY * 2);
  }
  return e.prototype.get3dOffsetFromEdgeInfo = function(t) {
    return this.nX * ((this.k + t.k) % 2 * this.nY + this.j + t.j) + this.i + t.i;
  }, e.prototype.clearEdgeVertexIndexSlice = function(t) {
    var n = t % 2 == 0 ? 0 : 3 * this.nX * this.nY, r = t % 2 == 0 ? 3 * this.nX * this.nY : this.verticesOnEdges.length;
    this.verticesOnEdges.fill(0, n, r);
  }, e.prototype.interpolate = function(t) {
    var n = Eee[t], r = 3 * this.get3dOffsetFromEdgeInfo(n) + n.e, i = this.verticesOnEdges[r];
    if (i > 0) return i - 1;
    var a = this.scalarField, o = this.scalarFieldGet, s = Mee[t], u = s.a, l = s.b, c = u.i + this.i, d = u.j + this.j, f = u.k + this.k, p = l.i + this.i, g = l.j + this.j, m = l.k + this.k, v = o(a, c, d, f), h = o(a, p, g, m), y = (this.isoLevel - v) / (v - h);
    if (this.idField) {
      var x = this.idFieldGet(this.idField, c, d, f), S = this.idFieldGet(this.idField, p, g, m), b = y < 0.5 ? x : S;
      if (b === -1 && (b = y < 0.5 ? S : x), b === -2) return -1;
      this.builder.addGroup(b);
    } else this.builder.addGroup(0);
    var _ = this.builder.addVertex(c + y * (c - p), d + y * (d - g), f + y * (f - m));
    this.verticesOnEdges[r] = _ + 1;
    var C = o(a, Math.max(0, c - 1), d, f) - o(a, Math.min(this.nX - 1, c + 1), d, f), w = o(a, c, Math.max(0, d - 1), f) - o(a, c, Math.min(this.nY - 1, d + 1), f), I = o(a, c, d, Math.max(0, f - 1)) - o(a, c, d, Math.min(this.nZ, f + 1)), M = C + y * (C - (o(a, Math.max(0, p - 1), g, m) - o(a, Math.min(this.nX - 1, p + 1), g, m))), E = w + y * (w - (o(a, p, Math.max(0, g - 1), m) - o(a, p, Math.min(this.nY - 1, g + 1), m))), T = I + y * (I - (o(a, p, g, Math.max(0, m - 1)) - o(a, p, g, Math.min(this.nZ - 1, m + 1))));
    return this.isoLevel >= 0 ? this.builder.addNormal(M, E, T) : this.builder.addNormal(-M, -E, -T), _;
  }, e.prototype.get = function(t, n, r) {
    return this.scalarFieldGet(this.scalarField, t, n, r);
  }, e.prototype.processCell = function(t, n, r, i) {
    var a = 0;
    if (this.get(t, n, r) < this.isoLevel && (a |= 1), this.get(t + 1, n, r) < this.isoLevel && (a |= 2), this.get(t + 1, n + 1, r) < this.isoLevel && (a |= 4), this.get(t, n + 1, r) < this.isoLevel && (a |= 8), this.get(t, n, r + 1) < this.isoLevel && (a |= 16), this.get(t + 1, n, r + 1) < this.isoLevel && (a |= 32), this.get(t + 1, n + 1, r + 1) < this.isoLevel && (a |= 64), this.get(t, n + 1, r + 1) < this.isoLevel && (a |= 128), a !== 0 && a !== 255) {
      this.i = t, this.j = n, this.k = r;
      var o = Tee[a];
      (1 & o) > 0 && (this.vertList[0] = this.interpolate(0)), (2 & o) > 0 && (this.vertList[1] = this.interpolate(1)), (4 & o) > 0 && (this.vertList[2] = this.interpolate(2)), (8 & o) > 0 && (this.vertList[3] = this.interpolate(3)), (16 & o) > 0 && (this.vertList[4] = this.interpolate(4)), (32 & o) > 0 && (this.vertList[5] = this.interpolate(5)), (64 & o) > 0 && (this.vertList[6] = this.interpolate(6)), (128 & o) > 0 && (this.vertList[7] = this.interpolate(7)), (256 & o) > 0 && (this.vertList[8] = this.interpolate(8)), (512 & o) > 0 && (this.vertList[9] = this.interpolate(9)), (1024 & o) > 0 && (this.vertList[10] = this.interpolate(10)), (2048 & o) > 0 && (this.vertList[11] = this.interpolate(11));
      for (var s = z1[a], u = 0; u < s.length; u += 3) {
        var l = s[u], c = s[u + 1], d = s[u + 2];
        this.isoLevel >= 0 ? this.builder.addTriangle(this.vertList, l, c, d, i) : this.builder.addTriangle(this.vertList, d, c, l, i);
      }
    }
  }, e;
}(), cR = O(O(O(O({}, Kl), N8), w8), dK);
function Dee(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    var o, s, u, l, c, d, f, p, g;
    return ie(this, function(m) {
      switch (m.label) {
        case 0:
          return [4, iR(n, t, r.size, i).runInContext(e.runtime)];
        case 1:
          return o = m.sent(), s = o.transform, u = o.field, l = o.idField, c = o.resolution, d = o.maxRadius, [4, sR({ isoLevel: i.probeRadius, scalarField: u, idField: l }, a).runAsChild(e.runtime)];
        case 2:
          return f = m.sent(), i.includeParent && (p = Math.ceil(2 / i.resolution), Lt.smoothEdges(f, { iterations: p, maxNewEdgeLength: Math.sqrt(2) })), Lt.transform(f, s), e.webgl && !e.webgl.isWebGL2 && Lt.uniformTriangleGroup(f), g = pe.expand(pe(), t.boundary.sphere, d), f.setBoundingSphere(g), f.meta.resolution = c, [2, f];
      }
    });
  });
}
function Oee(e) {
  return Yl({ defaultProps: N.getDefaultValues(cR), createGeometry: Dee, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(t, n, r) {
    n.resolution !== r.resolution && (t.createGeometry = !0), n.probeRadius !== r.probeRadius && (t.createGeometry = !0), n.probePositions !== r.probePositions && (t.createGeometry = !0), n.ignoreHydrogens !== r.ignoreHydrogens && (t.createGeometry = !0), n.traceOnly !== r.traceOnly && (t.createGeometry = !0), n.includeParent !== r.includeParent && (t.createGeometry = !0), n.smoothColors.name !== r.smoothColors.name ? t.updateColor = !0 : n.smoothColors.name === "on" && r.smoothColors.name === "on" && (n.smoothColors.params.resolutionFactor !== r.smoothColors.params.resolutionFactor && (t.updateColor = !0), n.smoothColors.params.sampleStride !== r.smoothColors.params.sampleStride && (t.updateColor = !0));
  }, processValues: function(t, n, r, i, a) {
    var o = n.meta, s = o.resolution, u = o.colorTexture, l = jd(r.smoothColors, i.color.preferSmoothing, s);
    l && (function(c, d, f, p, g) {
      if (/* @__PURE__ */ function(v) {
        return v === "group" || v === "groupInstance";
      }(c.dColorType.ref.value)) {
        var m = _g({ vertexCount: c.uVertexCount.ref.value, instanceCount: c.uInstanceCount.ref.value, groupCount: c.uGroupCount.ref.value, transformBuffer: c.aTransform.ref.value, instanceBuffer: c.aInstance.ref.value, positionBuffer: c.aPosition.ref.value, groupBuffer: c.aGroup.ref.value, colorData: c.tColor.ref.value, colorType: c.dColorType.ref.value, boundingSphere: c.boundingSphere.ref.value, invariantBoundingSphere: c.invariantBoundingSphere.ref.value, itemSize: 3 }, d, f, p, g);
        m.kind === "volume" ? (R.updateIfChanged(c.dColorType, m.type), R.update(c.tColorGrid, m.texture), R.update(c.uColorTexDim, m.gridTexDim), R.update(c.uColorGridDim, m.gridDim), R.update(c.uColorGridTransform, m.gridTransform)) : m.kind === "vertex" && (R.updateIfChanged(c.dColorType, m.type), R.update(c.tColor, m.texture), R.update(c.uColorTexDim, m.texDim));
      }
    }(t, l.resolution, l.stride, a, u), n.meta.colorTexture = t.tColorGrid.ref.value);
  }, dispose: function(t) {
    var n;
    (n = t.meta.colorTexture) === null || n === void 0 || n.destroy();
  } }, e);
}
var dR = O(O(O(O({}, I8), N8), w8), { sizeFactor: N.Numeric(1.5, { min: 0, max: 10, step: 0.1 }) });
function Bee(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    var o, s, u, l, c, d, f;
    return ie(this, function(p) {
      switch (p.label) {
        case 0:
          return [4, iR(n, t, r.size, i).runInContext(e.runtime)];
        case 1:
          return o = p.sent(), s = o.transform, u = o.field, l = o.idField, c = o.maxRadius, [4, uR({ isoLevel: i.probeRadius, scalarField: u, idField: l }, a).runAsChild(e.runtime)];
        case 2:
          return d = p.sent(), Mn.transform(d, s), f = pe.expand(pe(), t.boundary.sphere, c), d.setBoundingSphere(f), [2, d];
      }
    });
  });
}
function Ree(e) {
  return P8({ defaultProps: N.getDefaultValues(dR), createGeometry: Bee, createLocationIterator: Fl.fromGroup, getLoci: ym, eachLocation: vm, setUpdateState: function(t, n, r) {
    n.resolution !== r.resolution && (t.createGeometry = !0), n.probeRadius !== r.probeRadius && (t.createGeometry = !0), n.probePositions !== r.probePositions && (t.createGeometry = !0), n.ignoreHydrogens !== r.ignoreHydrogens && (t.createGeometry = !0), n.includeParent !== r.includeParent && (t.createGeometry = !0);
  } }, e);
}
var fR = { "molecular-surface-mesh": function(e, t) {
  return ca("Molecular surface mesh", e, t, Oee);
}, "molecular-surface-wireframe": function(e, t) {
  return ca("Molecular surface wireframe", e, t, Ree);
} }, pI = O(O(O({}, cR), dR), { visuals: N.MultiSelect(["molecular-surface-mesh"], N.objectToOptions(fR)), bumpFrequency: N.Numeric(1, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory) }), hb, gb = { name: "molecular-surface", label: "Molecular Surface", description: "Displays a molecular surface.", factory: function(e, t) {
  return en.createMulti("Molecular Surface", e, t, Ao, fR);
}, getParams: function(e, t) {
  return N.clone(pI);
}, defaultValues: N.getDefaultValues(pI), defaultColorTheme: { name: "chain-id" }, defaultSizeTheme: { name: "physical" }, isApplicable: function(e) {
  return e.elementCount > 0;
} }, Lee = { parse: function(e, t) {
  var n, r = t.managers.cell.get(e.ref), i = jn(r);
  return i ? Fr(i, (n = e.elementIds) !== null && n !== void 0 ? n : [], !0) : ze.Empty;
}, createTheme: function(e, t, n) {
  return t.managers.representation.createTheme(fe.Surface, this.parse(e, t), n);
}, create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return (r = gb.factory(t, gb.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("physical", { structure: e }) }), [4, r.createOrUpdate(O(O({}, gb.defaultValues), { quality: "auto" }), e).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("physical", { structure: t }) }), [4, e.createOrUpdate({}, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, Nee = A.create(0, 0, -0.5), Fee = A.create(0, 0, 0.5), _c = A(), xc = A(), q2 = A(), hI = A();
function Vee() {
  return hb || (hb = function(e) {
    for (var t = e.length / 3, n = (t === 3 ? 1 : t === 4 ? 2 : t) + t, r = uh(n, t === 4 ? 3 * t + 4 : 3 * n), i = 0; i < t; ++i) {
      var a = (i + 1) % t;
      A.set(_c, e[3 * i], e[3 * i + 1], -0.5), A.set(xc, e[3 * a], e[3 * a + 1], -0.5), r.add(_c, xc, Fee);
    }
    if (t === 3) A.set(_c, e[0], e[1], -0.5), A.set(xc, e[3], e[4], -0.5), A.set(q2, e[6], e[7], -0.5), r.add(q2, xc, _c);
    else if (t === 4) A.set(_c, e[0], e[1], -0.5), A.set(xc, e[3], e[4], -0.5), A.set(q2, e[6], e[7], -0.5), A.set(hI, e[9], e[10], -0.5), r.addQuad(hI, q2, xc, _c);
    else for (i = 0; i < t; ++i) a = (i + 1) % t, A.set(_c, e[3 * i], e[3 * i + 1], -0.5), A.set(xc, e[3 * a], e[3 * a + 1], -0.5), r.add(Nee, xc, _c);
    return r.getPrimitive();
  }(p3(8, !0))), hb;
}
var k_ = { center: N.Vec3(A()), vec: N.Vec3(A()), color: N.Color(Ae.fromRgb(255, 196, 36)), alpha: N.Numeric(0.9, { min: 0, max: 1, step: 0.1 }) }, mR = { "rotate-arrow-cylinder": function(e, t) {
  return hr(zee, fa.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "rotate-arrow-arrowhead": function(e, t) {
  return hr(Uee, Lt.Utils);
} }, Gee = O(O(O({}, Mn.Params), k_), { visuals: N.MultiSelect(["rotate-arrow-cylinder", "rotate-arrow-arrowhead"], N.objectToOptions(mR)) });
function zee(e, t, n, r) {
  var i = n.center, a = n.vec, o = A.create(0, 0, 0);
  A.normalize(o, a);
  var s = A.create(0, 0, 0);
  A.scale(s, o, 0.25);
  var u = A.create(0, 0, 0);
  A.sub(u, a, s);
  var l = A.create(0, 0, 0);
  A.add(l, i, u);
  var c = A.create(0, 0, 0);
  A.scale(c, o, 0.45), A.sub(l, l, c);
  var d = V0.create(128, 64);
  return d.add(i[0], i[1], i[2], l[0], l[1], l[2], 0.05, !0, !0, 2), Wt.create("RotateArrow-cylinder", n, d.getCylinders(), function() {
    return n.color;
  }, function() {
    return n.sizeFactor;
  }, function() {
    return "RotateArrow";
  });
}
function Uee(e, t, n, r) {
  var i = mt.createState(256, 128), a = Vee(), o = n.center, s = n.vec, u = A.create(0, 0, 0);
  A.normalize(u, s);
  var l = A.create(0, 0, 0);
  A.scale(l, u, 0.1);
  var c = A.create(0, 0, 0);
  A.sub(c, s, l);
  var d = A.create(0, 0, 0);
  A.add(d, o, c);
  var f = A.create(0, 0, 0), p = A.create(0, 0, 0);
  A.scale(p, u, 0.35), A.sub(f, d, p);
  var g = ne.identity(), m = A();
  return A.add(m, f, s), ne.targetTo(g, m, f, A.create(1, 0, 0)), ne.setTranslation(g, f), i.currentGroup = 0, ne.scaleUniformly(g, g, 0.4 * 1.5), mt.addPrimitive(i, g, a), Wt.create("axes", n, mt.getMesh(i), function() {
    return n.color;
  }, function() {
    return 0.05;
  }, function() {
    return "";
  });
}
O(O(O({}, fa.Params), k_), { color: N.Color(Ae.fromRgb(255, 196, 36)), sizeFactor: N.Numeric(0.1, { min: 0, max: 10, step: 0.1 }) }), O(O(O({}, Lt.Params), k_), { color: N.Color(qt.brown) });
var Hee = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r = function(a, o) {
            var s = en.createMulti("RotateArrow", a, o, Ao, mR);
            return s.setState({ markerActions: En.All }), s;
          }(t, function() {
            return Gee;
          }), [4, r.createOrUpdate(e, e).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return [4, e.createOrUpdate(t, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, qee = { "element-sphere": function(e, t) {
  return ca("Sphere mesh", e, t, D8);
} }, gI = O(O({}, z0), { bumpFrequency: N.Numeric(1, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory) }), vb = { name: "spacefill", label: "Spacefill", description: "Displays atomic/coarse elements as spheres.", factory: function(e, t) {
  return en.createMulti("Spacefill", e, t, Ao, qee);
}, getParams: function(e, t) {
  var n = N.clone(gI);
  return t.isCoarseGrained && (n.sizeFactor.defaultValue = 2), n;
}, defaultValues: N.getDefaultValues(gI), defaultColorTheme: { name: "element-symbol" }, defaultSizeTheme: { name: "physical" }, isApplicable: function(e) {
  return e.elementCount > 0;
} }, jee = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return (r = vb.factory(t, vb.getParams)).setTheme(n ?? { color: t.colorThemeRegistry.create("element-symbol", { structure: e }), size: t.sizeThemeRegistry.create("physical", { structure: e }) }), [4, r.createOrUpdate(O(O({}, vb.defaultValues), { quality: "auto" }), e).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return e.setTheme(r ?? { color: n.colorThemeRegistry.create("element-symbol", { structure: t }), size: n.sizeThemeRegistry.create("physical", { structure: t }) }), [4, e.createOrUpdate({}, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, Kee = ne.fromTranslation(ne(), A.create(0.5, 0.5, 0.5)), Yee = g3(h3(xD()), Kee), Nd = A(), vI = ne(), pR = O(O({}, Lt.Params), { alpha: O(O({}, Lt.Params.alpha), { defaultValue: 0.51 }), ignoreLight: O(O({}, Lt.Params.ignoreLight), { defaultValue: !0 }), colorX: N.Color(qt.red, { isEssential: !0 }), colorY: N.Color(qt.green, { isEssential: !0 }), colorZ: N.Color(qt.blue, { isEssential: !0 }), scale: N.Numeric(2, { min: 0.1, max: 5, step: 0.1 }) }), Wee = O(O(O({}, Lt.Params), pR), { pocketColor: N.Color(qt.red), pocketScale: N.Numeric(4, { min: 0.1, max: 5, step: 0.1 }), x: N.Numeric(10), y: N.Numeric(10), z: N.Numeric(10), center: N.Vec3(A()) }), Xee = O(O({}, Wee), pR), Zee = { axes: function(e, t) {
  return hr(Jee, Lt.Utils);
}, mesh: function(e, t) {
  return hr(Qee, Lt.Utils);
} };
function Qee(e, t, n, r) {
  var i = function(o, s, u) {
    var l = mt.createState(256, 128, u), c = o.gridPocket.fromFractional;
    A.copy(Nd, o.ref), A.subScalar(Nd, Nd, 0.5), ne.fromTranslation(vI, Nd);
    var d = g3(h3(Yee), vI), f = Math.cbrt(o.gridPocket.volume) / 300 * s.pocketScale;
    l.currentGroup = 1, mt.addCage(l, c, d, f, 2, 20);
    var p = pe.fromDimensionsAndTransform(pe(), A.unit, c);
    A.transformMat4(Nd, Nd, c), pe.translate(p, p, Nd), pe.expand(p, p, f);
    var g = mt.getMesh(l);
    return g.setBoundingSphere(p), g;
  }(t, n, r && r.geometry), a = "Grid Pocket Box";
  return Wt.create(a, t, i, function() {
    return n.pocketColor;
  }, function() {
    return 1;
  }, function() {
    return a;
  });
}
function yI(e, t, n, r) {
  var i = A(), a = ne.ofRows([[e, 0, 0, 0], [0, t, 0, 0], [0, 0, n, 0], [0, 0, 0, 1]]), o = ne.invert(ne.zero(), a);
  return { ref: A.transformMat4(i, r, o), gridPocket: { fromFractional: a, toFractional: o, x: e, y: t, z: n, center: r, volume: e * t * n } };
}
function Jee(e, t, n, r) {
  var i = n.scale, a = function(o, s, u) {
    var l = s.gridPocket, c = l.x, d = l.y, f = l.z, p = l.center, g = l.volume, m = mt.createState(512, 256, u), v = Math.cbrt(g) / 300 * o, h = p[0], y = p[1], x = p[2], S = Math.min(c, d, f), b = A.create(h + S / 3, y, x), _ = A.create(h, y + S / 3, x), C = A.create(h, y, x + S / 3), w = { radiusTop: v, radiusBottom: v, radialSegments: 32 };
    return m.currentGroup = 0, mi(m, p, v, 2), m.currentGroup = 1, mi(m, b, v, 2), li(m, p, b, 1, w), m.currentGroup = 2, mi(m, _, v, 2), li(m, p, _, 1, w), m.currentGroup = 3, mi(m, C, v, 2), li(m, p, C, 1, w), A.scale(b, b, 0.5), A.scale(_, _, 0.5), A.scale(C, C, 0.5), mt.getMesh(m);
  }(i, t, r == null ? void 0 : r.geometry);
  return a.setBoundingSphere(pe.create(A.create(i / 2, i / 2, i / 2), i + i / 4)), Wt.create("axes", {}, a, function(o) {
    switch (o) {
      case 1:
        return n.colorX;
      case 2:
        return n.colorY;
      case 3:
        return n.colorZ;
      default:
        return qt.grey;
    }
  }, function() {
    return 1;
  }, function() {
    return "";
  });
}
var $ee = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s;
    return ie(this, function(u) {
      switch (u.label) {
        case 0:
          return r = function(l, c) {
            return en.createMulti("Grid Pocket", l, c, en.StateBuilder, Zee);
          }(t, function() {
            return Xee;
          }), i = e.x, a = e.y, o = e.z, s = e.center, [4, r.createOrUpdate(e, yI(i, a, o, s)).run()];
        case 1:
          return u.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i, a, o, s;
    return ie(this, function(u) {
      switch (u.label) {
        case 0:
          return i = t.x, a = t.y, o = t.z, s = t.center, [4, e.createOrUpdate(t, yI(i, a, o, s)).run()];
        case 1:
          return u.sent(), [2];
      }
    });
  });
} }, ete = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1], k1 = { radiusFactor: N.Numeric(1, { min: 0.1, max: 3, step: 0.01 }, { description: "Scale the radius of the membrane layer" }), center: N.Vec3(A()), radius: N.Numeric(1), vec: N.Vec3(A()) }, hR = { "pharmacophore-ball-1": function(e, t) {
  return hr(ite, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "pharmacophore-ball-2": function(e, t) {
  return hr(ate, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "pharmacophore-sphere-1": function(e, t) {
  return hr(ste, Hs.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "pharmacophore-sphere-2": function(e, t) {
  return hr(ute, Hs.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "pharmacophore-cylinder": function(e, t) {
  return hr(lte, fa.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.All });
  } });
}, "pharmacophore-arrowhead": function(e, t) {
  return hr(cte, Lt.Utils);
} }, tte = O(O(O({}, Mn.Params), k1), { color: N.Color(qt.blue), lineSizeAttenuation: N.Boolean(!1), linesSize: N.Numeric(1, { min: 0.01, max: 50, step: 0.01 }), dashedLines: N.Boolean(!1), alpha: N.Numeric(0.2, { min: 0, max: 0.4, step: 0.1 }) }), nte = O(O(O({}, Mn.Params), k1), { color: N.Color(qt.blue), lineSizeAttenuation: N.Boolean(!1), linesSize: N.Numeric(1, { min: 0.01, max: 50, step: 0.01 }), dashedLines: N.Boolean(!1), alpha: N.Numeric(0.2, { min: 0, max: 0.4, step: 0.1 }) }), rte = O(O(O({}, tte), nte), { visuals: N.MultiSelect(["pharmacophore-ball-1", "pharmacophore-ball-2", "pharmacophore-sphere-1", "pharmacophore-sphere-2", "pharmacophore-cylinder", "pharmacophore-arrowhead"], N.objectToOptions(hR)), alpha: N.Numeric(0.2, { min: 0, max: 1, step: 0.1 }) });
function ite(e, t, n, r) {
  var i = n.radiusFactor, a = n.center, o = i * n.radius, s = zi.create(128, 64, r == null ? void 0 : r.geometry), u = A.create(0, 0, 0);
  A.add(u, a, A.create(0, 1, 0));
  var l = A.create(0, 0, 0);
  A.add(l, a, A.create(0, 0, 1));
  var c = A.create(0, 0, 0);
  A.add(c, a, A.create(1, 0, 0)), Ni(s, a, u, o, n), Ni(s, a, l, o, n), Ni(s, a, c, o, n);
  var d = A.create(0, 0, 0);
  A.add(d, a, A.create(0, 0.5 * o, 0));
  var f = A.create(0, 0, 0);
  A.add(f, d, A.create(0, Math.sqrt(0.75), 0)), Ni(s, d, f, Math.sqrt(0.75) * o, n);
  var p = A.create(0, 0, 0);
  A.add(p, a, A.create(0, -0.5 * o, 0));
  var g = A.create(0, 0, 0);
  return A.add(g, p, A.create(0, -Math.sqrt(0.75), 0)), Ni(s, p, g, Math.sqrt(0.75) * o, n), d = A.create(0, 0, 0), A.add(d, a, A.create(0.5 * o, 0, 0)), f = A.create(0, 0, 0), A.add(f, d, A.create(Math.sqrt(0.75), 0, 0)), Ni(s, d, f, Math.sqrt(0.75) * o, n), p = A.create(0, 0, 0), A.add(p, a, A.create(-0.5 * o, 0, 0)), g = A.create(0, 0, 0), A.add(g, p, A.create(-Math.sqrt(0.75), 0, 0)), Ni(s, p, g, Math.sqrt(0.75) * o, n), d = A.create(0, 0, 0), A.add(d, a, A.create(0, 0, 0.5 * o)), f = A.create(0, 0, 0), A.add(f, d, A.create(0, 0, Math.sqrt(0.75))), Ni(s, d, f, Math.sqrt(0.75) * o, n), p = A.create(0, 0, 0), A.add(p, a, A.create(0, 0, -0.5 * o)), g = A.create(0, 0, 0), A.add(g, p, A.create(0, 0, -Math.sqrt(0.75))), Ni(s, p, g, Math.sqrt(0.75) * o, n), Wt.create("pharmacophore-ball-1", n, s.getLines(), function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "pharmacophore";
  });
}
function ate(e, t, n, r) {
  var i = n.radiusFactor, a = n.center, o = n.radius, s = n.vec, u = i * o, l = A.create(0, 0, 0);
  A.add(l, a, s);
  var c = zi.create(128, 64, r == null ? void 0 : r.geometry), d = A.create(0, 0, 0);
  A.add(d, l, A.create(0, 1, 0));
  var f = A.create(0, 0, 0);
  A.add(f, l, A.create(0, 0, 1));
  var p = A.create(0, 0, 0);
  A.add(p, l, A.create(1, 0, 0)), Ni(c, l, d, u, n), Ni(c, l, f, u, n), Ni(c, l, p, u, n);
  var g = A.create(0, 0, 0);
  A.add(g, l, A.create(0, 0.5 * u, 0));
  var m = A.create(0, 0, 0);
  A.add(m, g, A.create(0, Math.sqrt(0.75), 0)), Ni(c, g, m, Math.sqrt(0.75) * u, n);
  var v = A.create(0, 0, 0);
  A.add(v, l, A.create(0, -0.5 * u, 0));
  var h = A.create(0, 0, 0);
  return A.add(h, v, A.create(0, -Math.sqrt(0.75), 0)), Ni(c, v, h, Math.sqrt(0.75) * u, n), g = A.create(0, 0, 0), A.add(g, l, A.create(0.5 * u, 0, 0)), m = A.create(0, 0, 0), A.add(m, g, A.create(Math.sqrt(0.75), 0, 0)), Ni(c, g, m, Math.sqrt(0.75) * u, n), v = A.create(0, 0, 0), A.add(v, l, A.create(-0.5 * u, 0, 0)), h = A.create(0, 0, 0), A.add(h, v, A.create(-Math.sqrt(0.75), 0, 0)), Ni(c, v, h, Math.sqrt(0.75) * u, n), g = A.create(0, 0, 0), A.add(g, l, A.create(0, 0, 0.5 * u)), m = A.create(0, 0, 0), A.add(m, g, A.create(0, 0, Math.sqrt(0.75))), Ni(c, g, m, Math.sqrt(0.75) * u, n), v = A.create(0, 0, 0), A.add(v, l, A.create(0, 0, -0.5 * u)), h = A.create(0, 0, 0), A.add(h, v, A.create(0, 0, -Math.sqrt(0.75))), Ni(c, v, h, Math.sqrt(0.75) * u, n), Wt.create("pharmacophore-ball-2", n, c.getLines(), function() {
    return n.color;
  }, function() {
    return n.linesSize;
  }, function() {
    return "pharmacophore";
  });
}
function Ni(e, t, n, r, i, a) {
  for (var o = function(x, S, b) {
    A.dot(A.unitY, A.sub(ote, x, S)) === 0 ? ne.targetTo(v1, x, S, A.unitY) : ne.targetTo(v1, x, S, A.unitX), ne.setTranslation(v1, x), ne.mul(v1, v1, ne.rotX90);
    var _ = L8({ radius: b, segments: 64 });
    return m3(_, v1);
  }(t, n, r), s = o.indices, u = o.vertices, l = 0, c = s.length; l < c; l += 3) if (!i.dashedLines || l % 2 != 1) {
    var d = 3 * s[l], f = 3 * s[l + 1], p = u[d], g = u[d + 1], m = u[d + 2], v = u[f], h = u[f + 1], y = u[f + 2];
    e.add(p, g, m, v, h, y, 0);
  }
}
O(O(O({}, Hs.Params), k1), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), color: N.Color(qt.green), alpha: N.Numeric(0.2, { min: 0, max: 0.4, step: 0.1 }) }), O(O(O({}, Hs.Params), k1), { sizeFactor: N.Numeric(1, { min: 0, max: 10, step: 0.1 }), color: N.Color(qt.brown), alpha: N.Numeric(0.2, { min: 0, max: 0.4, step: 0.1 }) }), O(O(O({}, fa.Params), k1), { color: N.Color(qt.brown), sizeFactor: N.Numeric(0.1, { min: 0, max: 10, step: 0.1 }) }), O(O(O({}, Lt.Params), k1), { color: N.Color(qt.brown) });
var v1 = ne(), ote = A();
function gR(e, t, n, r) {
  e.add(t[0], t[1], t[2], r);
}
function ste(e, t, n, r) {
  var i = n.center, a = n.radius, o = n.radiusFactor, s = G0.create(128, 64);
  return gR(s, i, 0, 0), Wt.create("pharmacophore-sphere-1", O(O({}, n), { sizeFactor: 0.1 * n.radius }), s.getSpheres(), function() {
    return n.color;
  }, function() {
    return a * o / 2;
  }, function() {
    return "pharmacophore";
  });
}
function ute(e, t, n, r) {
  var i = n.center, a = n.radius, o = n.vec, s = n.radiusFactor, u = A.create(0, 0, 0);
  A.add(u, i, o);
  var l = G0.create(128, 64);
  return gR(l, u, 0, 1), Wt.create("pharmacophore-sphere-2", O(O({}, n), { sizeFactor: 0.1 * n.radius }), l.getSpheres(), function() {
    return n.color;
  }, function() {
    return a * s / 2;
  }, function() {
    return "pharmacophore";
  });
}
function lte(e, t, n, r) {
  var i = n.center, a = n.vec, o = A.create(0, 0, 0);
  A.normalize(o, a);
  var s = A.create(0, 0, 0);
  A.scale(s, o, 0.25);
  var u = A.create(0, 0, 0);
  A.sub(u, a, s);
  var l = A.create(0, 0, 0);
  A.add(l, i, u);
  var c = A.create(0, 0, 0);
  A.scale(c, o, 0.3), A.sub(l, l, c);
  var d = V0.create(128, 64);
  return d.add(i[0], i[1], i[2], l[0], l[1], l[2], 0.025, !0, !0, 2), Wt.create("pharmacophore-cylinder", n, d.getCylinders(), function() {
    return n.color;
  }, function() {
    return n.sizeFactor;
  }, function() {
    return "pharmacophore";
  });
}
function cte(e, t, n, r) {
  var i = n.center, a = n.vec, o = A.create(0, 0, 0);
  A.normalize(o, a);
  var s = A.create(0, 0, 0);
  A.scale(s, o, 0.25);
  var u = A.create(0, 0, 0);
  A.sub(u, a, s);
  var l = A.create(0, 0, 0);
  A.add(l, i, u);
  var c = A.create(0, 0, 0), d = A.create(0, 0, 0);
  A.scale(d, o, 0.3), A.sub(c, l, d);
  var f = A.create(0, 0, 0), p = A.create(1, 2, c[2] - (o[0] * (1 - c[0]) + o[1] * (2 - c[1])) / o[2]);
  A.sub(f, p, c), A.normalize(f, f);
  var g = A.create(0, 0, 0);
  A.scale(g, f, 0.3);
  var m = A.create(0, 0, 0);
  A.add(m, c, g);
  var v = A.create(0, 0, 0);
  A.sub(v, m, c);
  var h = A.create(0, 0, 0), y = A.create(0, 0, 0);
  A.scale(y, v, Math.cos(120 * Math.PI / 180));
  var x = A.create(0, 0, 0);
  A.cross(x, o, v), A.scale(x, x, Math.sin(120 * Math.PI / 180));
  var S = A.create(0, 0, 0);
  A.scale(S, o, A.dot(o, v) * (1 - Math.cos(120 * Math.PI / 180))), A.add(h, y, x), A.add(h, h, S), A.add(h, h, c);
  var b = A.create(0, 0, 0);
  y = A.create(0, 0, 0), A.scale(y, v, Math.cos(240 * Math.PI / 180)), x = A.create(0, 0, 0), A.cross(x, o, v), A.scale(x, x, Math.sin(240 * Math.PI / 180)), S = A.create(0, 0, 0), A.scale(S, o, A.dot(o, v) * (1 - Math.cos(240 * Math.PI / 180))), A.add(b, y, x), A.add(b, b, S), A.add(b, b, c);
  var _ = mt.createState(128, 64), C = function(M) {
    return bD(M, ete);
  }([l[0], l[1], l[2], m[0], m[1], m[2], h[0], h[1], h[2], b[0], b[1], b[2]]), w = ne.ofRows([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]), I = ne.invert(ne.zero(), w);
  return mt.addPrimitive(_, I, C), Wt.create("axes", {}, mt.getMesh(_), function() {
    return n.color;
  }, function() {
    return 0.15;
  }, function() {
    return "";
  });
}
var dte = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r = function(a, o) {
            var s = en.createMulti("Pharmacophore", a, o, Ao, hR);
            return s.setState({ markerActions: En.All }), s;
          }(t, function() {
            return rte;
          }), [4, r.createOrUpdate(e, e).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return [4, e.createOrUpdate(t, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} };
function D_(e, t) {
  var n, r, i, a, o, s, u, l, c = e.defaultProps, d = e.createGeometry, f = e.createLocationIterator, p = e.getLoci, g = e.eachLocation, m = e.setUpdateState, v = e.mustRecreate, h = e.dispose, y = e.geometryUtils, x = y.updateValues, S = y.updateBoundingSphere, b = y.updateRenderableState, _ = y.createPositionIterator, C = Du.create(), w = Object.assign({}, c), I = us.createEmpty(), M = -1;
  function E(P) {
    if (C.createNew) {
      if (u = f(a), !P) throw new Error("expected geometry to be given");
      n = function(k, D, B, L, F, V) {
        var G = Ui.getUtils(D), H = G.createValues, q = G.createRenderableState, z = H(D, W6(), B, L, F), K = q(F);
        return Gm(D.kind, z, K, V);
      }(0, P, u, i, r, t), l = _(P, n.values);
    } else {
      if (!n) throw new Error("expected renderObject to be available");
      if (u.reset(), C.createGeometry) {
        if (!P) throw new Error("expected geometry to be given");
        R.updateIfChanged(n.values.drawCount, Ui.getDrawCount(P)), R.updateIfChanged(n.values.uVertexCount, Ui.getVertexCount(P));
      }
      (C.updateTransform || C.createGeometry) && (S(n.values, P || s), l = _(P || s, n.values)), C.updateSize && "uSize" in n.values && Hl(u, i.size, n.values), C.updateColor && bo(u, l, i.color, n.values), x(n.values, r), b(n.state, r);
    }
    w = r, I = i, o = a, P && (s = P, M += 1);
  }
  function T(P, k) {
    return Ya(P) ? k(le.ofBounds(0, u.groupCount * u.instanceCount)) : g(P, o, w, k);
  }
  return { get groupCount() {
    return u ? u.count : 0;
  }, get renderObject() {
    return n;
  }, get geometryVersion() {
    return M;
  }, createOrUpdate: function(P, k, D, B) {
    return D === void 0 && (D = {}), se(this, 0, void 0, function() {
      var L;
      return ie(this, function(F) {
        return function(V, G, H) {
          if (!H && !o) throw new Error("missing volume");
          r = Object.assign({}, w, G), i = V, a = H, Du.reset(C), n && o && $t.areEquivalent(a, o) || (C.createNew = !0), C.createNew ? C.createGeometry = !0 : (m(C, H, r, w, i, I), Ll.areEqual(V.color, I.color) || (C.updateColor = !0), C.createGeometry && (C.updateColor = !0));
        }(k, D, B || o), C.createGeometry ? [2, T6(L = d(P, a, i, r, s)) ? L.then(E) : E(L)] : (E(), [2]);
      });
    });
  }, getLoci: function(P) {
    return n ? p(P, o, w, n.id) : cr;
  }, mark: function(P, k) {
    return Qt.mark(n, P, k, T);
  }, setVisibility: function(P) {
    Qt.setVisibility(n, P);
  }, setAlphaFactor: function(P) {
    Qt.setAlphaFactor(n, P);
  }, setPickable: function(P) {
    Qt.setPickable(n, P);
  }, setColorOnly: function(P) {
    Qt.setColorOnly(n, P);
  }, setTransform: function(P, k) {
    Qt.setTransform(n, P, k);
  }, setOverpaint: function(P) {
    return Qt.setOverpaint(n, P, T, !0);
  }, setTransparency: function(P) {
    return Qt.setTransparency(n, P, T, !0);
  }, setSubstance: function(P) {
    return Qt.setSubstance(n, P, T, !0);
  }, setClipping: function(P) {
    return Qt.setClipping(n, P, T, !0);
  }, destroy: function() {
    h == null || h(s), n && (n.state.disposed = !0, n = void 0);
  }, mustRecreate: v };
}
function bI(e, t, n, r, i) {
  var a, o, s, u, l = 0, c = t.webgl, d = new qr(), f = new en.GeometryState(), p = jl(), g = [], m = en.createState(), v = us.createEmpty();
  return { label: e, get groupCount() {
    return a ? a.groupCount : 0;
  }, get props() {
    return u;
  }, get params() {
    return s;
  }, get state() {
    return m;
  }, get theme() {
    return v;
  }, get geometryVersion() {
    return f.version;
  }, renderObjects: g, updated: d, createOrUpdate: function(h, y) {
    var x = this;
    h === void 0 && (h = {}), y && y !== o && (s = n(t, y), o = y, u || (u = N.getDefaultValues(s)));
    var S = Z5(Object.assign({}, u, h), o);
    return Object.assign(u, h, S), Xt.create("Creating or updating VolumeRepresentation", function(b) {
      return se(x, 0, void 0, function() {
        var _, C;
        return ie(this, function(w) {
          switch (w.label) {
            case 0:
              return a ? !((C = a.mustRecreate) === null || C === void 0) && C.call(a, o, u, c) && (a.destroy(), a = r(p, o, u, c)) : a = r(p, o, u, c), (_ = a.createOrUpdate({ webgl: c, runtime: b }, v, u, y)) ? [4, _] : [3, 2];
            case 1:
              w.sent(), w.label = 2;
            case 2:
              return g.length = 0, a && a.renderObject && (g.push(a.renderObject), f.add(a.renderObject.id, a.geometryVersion)), f.snapshot(), d.next(l++), [2];
          }
        });
      });
    });
  }, setState: function(h) {
    h.visible !== void 0 && a && a.setVisibility(h.visible), h.alphaFactor !== void 0 && a && a.setAlphaFactor(h.alphaFactor), h.pickable !== void 0 && a && a.setPickable(h.pickable), h.overpaint !== void 0 && a && a.setOverpaint(h.overpaint), h.transparency !== void 0 && a && a.setTransparency(h.transparency), h.transform !== void 0 && a && a.setTransform(h.transform), en.updateState(m, h);
  }, setTheme: function(h) {
    v = h;
  }, getLoci: function(h) {
    return h === void 0 ? i(o, u) : a ? a.getLoci(h) : cr;
  }, mark: function(h, y) {
    return !!a && a.mark(h, y);
  }, destroy: function() {
    a && a.destroy();
  } };
}
O({}, Qe.Params);
var fte = `
precision highp float;
precision highp int;

#if __VERSION__ == 100
    precision highp sampler2D;
    uniform sampler2D tTexture;
#else
    precision highp isampler2D;
    uniform isampler2D tTexture;
#endif

void main(void) {
    #if __VERSION__ == 100
        gl_FragColor = texture2D(tTexture, vec2(0.5));
    #else
        gl_FragColor = ivec4(texture2D(tTexture, vec2(0.5)).r);
    #endif
}
`, mte = O(O({}, Ei), { tTexture: Rt("texture", "rgba", "float", "nearest") }), $o = "histopyramid-sum";
function pte(e, t) {
  if (e.namedComputeRenderables[$o]) {
    var n = e.namedComputeRenderables[$o].values;
    R.update(n.tTexture, t), e.namedComputeRenderables[$o].update();
  } else e.namedComputeRenderables[$o] = function(r, i) {
    var a = O(O({}, Pi), { tTexture: R.create(i) }), o = O({}, mte), s = gr("sum", da, fte, {}, { 0: "ivec4" }), u = gi(r, "triangles", s, o, a);
    return vi(u, a);
  }(e, t);
  return e.namedComputeRenderables[$o];
}
var j2 = new Uint8Array(4), _I = new Int32Array(4), K2, Y2, hte = `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tInputLevel;

// previous level used to evaluate the new level
#if __VERSION__ == 100
    uniform sampler2D tPreviousLevel;
#else
    precision highp isampler2D;
    uniform isampler2D tPreviousLevel;
#endif

// inverted size of the previous level texture.
uniform float uSize;
uniform float uTexSize;
uniform bool uFirst;

#include common

void main(void) {
    float k = 0.5 * uSize;
    vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;

    #if __VERSION__ == 100
        float a, b, c, d;

        if (uFirst) {
            a = texture2D(tInputLevel, position).r * 255.0;
            b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;
            c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;
            d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;
        } else {
            a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);
            b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);
            c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);
            d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);
        }
        gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);
    #else
        int a, b, c, d;

        if (uFirst) {
            a = int(texture2D(tInputLevel, position).r * 255.0);
            b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);
            c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);
            d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);
        } else {
            a = texture2D(tPreviousLevel, position).r;
            b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;
            c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;
            d = texture2D(tPreviousLevel, position + vec2(k, k)).r;
        }
        gl_FragColor = ivec4(a + b + c + d);
    #endif
}
`, gte = O(O({}, Ei), { tInputLevel: Rt("texture", "rgba", "float", "nearest"), tPreviousLevel: Rt("texture", "rgba", "float", "nearest"), uSize: me("f"), uTexSize: me("f"), uFirst: me("b") }), Rc = "histogram-pyramid";
function vte(e, t, n) {
  if (e.namedComputeRenderables[Rc]) {
    var r = e.namedComputeRenderables[Rc].values;
    R.update(r.tInputLevel, t), R.update(r.tPreviousLevel, n), e.namedComputeRenderables[Rc].update();
  } else e.namedComputeRenderables[Rc] = function(i, a, o) {
    var s = O(O({}, Pi), { tInputLevel: R.create(a), tPreviousLevel: R.create(o), uSize: R.create(0), uTexSize: R.create(0), uFirst: R.create(!0) }), u = O({}, gte), l = gr("reduction", da, hte, {}, { 0: "ivec4" }), c = gi(i, "triangles", l, u, s);
    return vi(c, s);
  }(e, t, n);
  return e.namedComputeRenderables[Rc];
}
function yte(e, t) {
  var n = Math.pow(2, t), r = "level".concat(t), i = e.isWebGL2 ? Tv(r, e, "image-int32", "alpha", "int", "nearest") : Tv(r, e, "image-uint8", "rgba", "ubyte", "nearest");
  i.define(n, n);
  var a = function(o, s) {
    var u = "".concat(Rc, "-").concat(o);
    return s.namedFramebuffers[u];
  }(r, e);
  return a || (a = vR(r, e), i.attachFramebuffer(a, 0)), { texture: i, framebuffer: a };
}
function vR(e, t) {
  var n = "".concat(Rc, "-").concat(e);
  return t.namedFramebuffers[n] || (t.namedFramebuffers[n] = t.resources.framebuffer()), t.namedFramebuffers[n];
}
function Tv(e, t, n, r, i, a) {
  var o = "".concat(Rc, "-").concat(e);
  return t.namedTextures[o] || (t.namedTextures[o] = t.resources.texture(n, r, i, a)), t.namedTextures[o];
}
function bte(e, t, n, r) {
  var i = e.gl, a = t.getWidth();
  if (a !== t.getHeight() || !function(x) {
    return x !== 0 && !(x & x - 1);
  }(a)) throw new Error("inputTexture must be of square power-of-two size");
  var o = Math.ceil(Math.log(a) / Math.log(2)), s = Math.pow(2, o), u = Math.pow(2, o), l = Math.pow(2, o - 1), c = e.isWebGL2 ? Tv("pyramid", e, "image-int32", "alpha", "int", "nearest") : Tv("pyramid", e, "image-uint8", "rgba", "ubyte", "nearest");
  c.define(u, l);
  var d = vR("pyramid", e);
  c.attachFramebuffer(d, 0), i.viewport(0, 0, u, l), Jt(i) ? i.clearBufferiv(i.COLOR, 0, [0, 0, 0, 0]) : i.clear(i.COLOR_BUFFER_BIT);
  for (var f = [], p = 0; p < o; ++p) f.push(yte(e, p));
  var g = vte(e, t, f[0].texture);
  e.state.currentRenderItemId = -1, function(x) {
    var S = x.gl, b = x.state;
    b.disable(S.CULL_FACE), b.disable(S.BLEND), b.disable(S.DEPTH_TEST), b.enable(S.SCISSOR_TEST), b.depthMask(!1), b.colorMask(!0, !0, !0, !0), b.clearColor(0, 0, 0, 0);
  }(e);
  var m = 0;
  for (p = 0; p < o; p++) {
    var v = o - 1 - p;
    f[v].framebuffer.bind();
    var h = Math.pow(2, v);
    R.update(g.values.uSize, Math.pow(2, p + 1) / s), R.update(g.values.uTexSize, h), R.updateIfChanged(g.values.uFirst, p === 0), p > 0 && (R.update(g.values.tPreviousLevel, f[o - p].texture), g.update()), e.state.currentRenderItemId = -1, i.viewport(0, 0, h, h), i.scissor(0, 0, h, h), Jt(i) ? i.clearBufferiv(i.COLOR, 0, [0, 0, 0, 0]) : i.clear(i.COLOR_BUFFER_BIT), i.scissor(0, 0, r[0], r[1]), g.render(), c.bind(0), i.copyTexSubImage2D(i.TEXTURE_2D, 0, m, 0, 0, 0, h, h), c.unbind(0), m += h;
  }
  i.finish();
  var y = Math.max(1, function(x, S) {
    var b = x.gl, _ = x.resources, C = pte(x, S);
    x.state.currentRenderItemId = -1, x.namedFramebuffers[$o] || (x.namedFramebuffers[$o] = _.framebuffer());
    var w = x.namedFramebuffers[$o];
    return x.namedTextures[$o] || (x.namedTextures[$o] = Jt(b) ? _.texture("image-int32", "rgba", "int", "nearest") : _.texture("image-uint8", "rgba", "ubyte", "nearest"), x.namedTextures[$o].define(1, 1)), x.namedTextures[$o].attachFramebuffer(w, 0), function(I) {
      var M = I.gl, E = I.state;
      E.disable(M.CULL_FACE), E.disable(M.BLEND), E.disable(M.DEPTH_TEST), E.disable(M.SCISSOR_TEST), E.depthMask(!1), E.colorMask(!0, !0, !0, !0), E.clearColor(0, 0, 0, 0);
    }(x), b.viewport(0, 0, 1, 1), C.render(), b.finish(), x.readPixels(0, 0, 1, 1, Jt(b) ? _I : j2), x.unbindFramebuffer(), Jt(b) ? _I[0] : X6(j2[0], j2[1], j2[2]);
  }(e, f[0].texture));
  return { pyramidTex: c, count: y, height: Math.ceil(y / Math.pow(2, o)), levels: o, scale: n };
}
function _te() {
  if (K2 !== void 0) return K2;
  for (var e = (K2 = ci(256, 1, Uint8Array)).array, t = 0, n = z1.length; t < n; ++t) e[t] = z1[t].length / 3;
  return K2;
}
function xte() {
  if (Y2 !== void 0) return Y2;
  for (var e = (Y2 = ci(4096, 1, Uint8Array)).array, t = 0, n = z1.length; t < n; ++t) for (var r = 0; r < 16; ++r) r < z1[t].length ? e[16 * t + r] = z1[t][r] : e[16 * t + r] = 255;
  return Y2;
}
var Cte = `
precision highp float;
precision highp int;
precision highp sampler2D;

#if __VERSION__ == 100
    uniform sampler2D tActiveVoxelsPyramid;
#else
    precision highp isampler2D;
    uniform isampler2D tActiveVoxelsPyramid;
#endif

uniform sampler2D tActiveVoxelsBase;
uniform sampler2D tVolumeData;
uniform sampler2D tTriIndices;

uniform float uIsoValue;
uniform float uLevels;
uniform float uSize;
uniform float uCount;
uniform bool uInvert;

uniform vec3 uGridDim;
uniform vec3 uGridTexDim;
uniform mat4 uGridTransform;

// scale to volume data coord
uniform vec2 uScale;

#include common

// cube corners (excluding origin)
const vec3 c1 = vec3(1., 0., 0.);
const vec3 c2 = vec3(1., 1., 0.);
const vec3 c3 = vec3(0., 1., 0.);
const vec3 c4 = vec3(0., 0., 1.);
const vec3 c5 = vec3(1., 0., 1.);
const vec3 c6 = vec3(1., 1., 1.);
const vec3 c7 = vec3(0., 1., 1.);

vec3 index3dFrom2d(vec2 coord) {
    vec2 gridTexPos = coord * uGridTexDim.xy;
    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);
    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;
    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;
    return vec3(posXY, posZ);
}

vec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {
    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice
    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);
    float row = intDiv(zSlice * gridDim.x, texDim.x);
    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);
    return texture2D(tex, coord + 0.5 / (texDim / uScale));
}

vec4 voxel(vec3 pos) {
    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));
    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);
}

vec4 voxelPadded(vec3 pos) {
    pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding
    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);
}

int idot2(const in ivec2 a, const in ivec2 b) {
    return a.x * b.x + a.y * b.y;
}

int idot4(const in ivec4 a, const in ivec4 b) {
    return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
}

#if __VERSION__ == 100
    int pyramidVoxel(vec2 pos) {
        return int(unpackRGBToInt(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));
    }
#else
    int pyramidVoxel(vec2 pos) {
        return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;
    }
#endif

vec4 baseVoxel(vec2 pos) {
    return texture2D(tActiveVoxelsBase, pos / uSize);
}

vec4 getGroup(const in vec3 p) {
    vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding
    // note that we swap x and z because the texture is flipped around y
    #if defined(dAxisOrder_012)
        float group = p.z + p.y * gridDim.z + p.x * gridDim.z * gridDim.y; // 210
    #elif defined(dAxisOrder_021)
        float group = p.y + p.z * gridDim.y + p.x * gridDim.y * gridDim.z; // 120
    #elif defined(dAxisOrder_102)
        float group = p.z + p.x * gridDim.z + p.y * gridDim.z * gridDim.x; // 201
    #elif defined(dAxisOrder_120)
        float group = p.x + p.z * gridDim.x + p.y * gridDim.x * gridDim.z; // 021
    #elif defined(dAxisOrder_201)
        float group = p.y + p.x * gridDim.y + p.z * gridDim.y * gridDim.x; // 102
    #elif defined(dAxisOrder_210)
        float group = p.x + p.y * gridDim.x + p.z * gridDim.x * gridDim.y; // 012
    #endif
    return vec4(group > 16777215.5 ? vec3(1.0) : packIntToRGB(group), 1.0);
}

void main(void) {
    // get 1D index
    int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);

    // ignore 1D indices outside of the grid
    if(vI >= int(uCount)) discard;

    ivec2 offset = ivec2(int(uSize) - 2, 0);

    int start = 0;
    ivec4 starts = ivec4(0);
    ivec4 ends = ivec4(0);
    int diff = 2;
    ivec4 m = ivec4(0);
    ivec2 position = ivec2(0);
    ivec4 vI4 = ivec4(vI);

    ivec2 relativePosition = ivec2(0);
    int end = 0;
    ivec2 pos1 = ivec2(0);
    ivec2 pos2 = ivec2(0);
    ivec2 pos3 = ivec2(0);
    ivec2 pos4 = ivec2(0);
    ivec3 vI3 = ivec3(vI);
    ivec3 mask = ivec3(0);

    // traverse the different levels of the pyramid
    for(int i = 1; i < 14; i++) {
        if(float(i) >= uLevels) break;

        offset.x -= diff;
        diff *= 2;
        relativePosition = position + offset;

        end = start + pyramidVoxel(vec2(relativePosition));
        pos1 = ivec2(relativePosition);
        starts.x = start;
        ends.x = end;
        pos2 = ivec2(relativePosition + ivec2(1, 0));
        starts.y = ends.x;
        ends.y = ends.x + pyramidVoxel(vec2(pos2));
        pos3 = relativePosition + ivec2(0, 1);
        starts.z = ends.y;
        ends.z = ends.y + pyramidVoxel(vec2(pos3));
        pos4 = relativePosition + ivec2(1, 1);
        starts.w = ends.z;
        mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));
        m = ivec4(mask, 1 - int(any(bvec3(mask))));

        relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;
        start = idot4(m, starts);
        position = 2 * (relativePosition - offset);
    }

    end = start + int(baseVoxel(vec2(position)).r * 255.0);
    pos1 = position;
    starts.x = start;
    ends.x = end;
    pos2 = position + ivec2(1, 0);
    starts.y = ends.x;
    ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);
    pos3 = position + ivec2(0, 1);
    starts.z = ends.y;
    ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);
    pos4 = position + ivec2(1, 1);
    starts.w = ends.z;
    mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));
    m = ivec4(mask, 1 - int(any(bvec3(mask))));
    position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;

    vec2 coord2d = (vec2(position) / uSize) / uScale;
    vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);

    float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);

    // current vertex for the up to 15 MC cases
    int currentVertex = vI - idot4(m, starts);

    // ensure winding-order is the same for negative and positive iso-levels
    if (uInvert) {
        int v = imod(currentVertex + 1, 3);
        if (v == 1) currentVertex += 2;
        else if (v == 0) currentVertex -= 2;
    }

    // get index into triIndices table
    int mcIndex = 16 * int(edgeIndex) + currentVertex;
    vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);

    // bit mask to avoid conditionals (see comment below) for getting MC case corner
    vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));

    // get edge value masks
    vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));
    vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));
    vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));

    // apply bit masks
    vec3 b0 = coord3d +
                m1.y * c1 +
                m1.z * c2 +
                m1.w * c3 +
                m2.x * c4 +
                m2.y * c5 +
                m2.z * c6 +
                m2.w * c7 +
                m3.y * c1 +
                m3.z * c2 +
                m3.w * c3;
    vec3 b1 = coord3d +
                m1.x * c1 +
                m1.y * c2 +
                m1.z * c3 +
                m2.x * c5 +
                m2.y * c6 +
                m2.z * c7 +
                m2.w * c4 +
                m3.x * c4 +
                m3.y * c5 +
                m3.z * c6 +
                m3.w * c7;

    // the conditionals that are avoided by above bitmasks
    // vec3 b0 = coord3d;
    // vec3 b1 = coord3d;
    // if (mcIndex == 0.0) {
    //     b1 += c1;
    // } else if (mcIndex == 1.0) {
    //     b0 += c1; b1 += c2;
    // } else if (mcIndex == 2.0) {
    //     b0 += c2; b1 += c3;
    // } else if (mcIndex == 3.0) {
    //     b0 += c3;
    // } else if (mcIndex == 4.0) {
    //     b0 += c4; b1 += c5;
    // } else if (mcIndex == 5.0) {
    //     b0 += c5; b1 += c6;
    // } else if (mcIndex == 6.0) {
    //     b0 += c6; b1 += c7;
    // } else if (mcIndex == 7.0) {
    //     b0 += c7; b1 += c4;
    // } else if (mcIndex == 8.0) {
    //     b1 += c4;
    // } else if (mcIndex == 9.0) {
    //     b0 += c1; b1 += c5;
    // } else if (mcIndex == 10.0) {
    //     b0 += c2; b1 += c6;
    // } else if (mcIndex == 11.0) {
    //     b0 += c3; b1 += c7;
    // }
    // b0 = floor(b0 + 0.5);
    // b1 = floor(b1 + 0.5);

    vec4 d0 = voxel(b0);
    vec4 d1 = voxel(b1);

    float v0 = d0.a;
    float v1 = d1.a;

    float t = (uIsoValue - v0) / (v0 - v1);
    gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;

    // group id
    #if __VERSION__ == 100
        // webgl1 does not support 'flat' interpolation (i.e. no interpolation)
        // so we ensure a constant group id per triangle here
        #ifdef dPackedGroup
            gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);
        #else
            gl_FragData[1] = getGroup(coord3d);
        #endif
    #else
        #ifdef dPackedGroup
            gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);
        #else
            gl_FragData[1] = getGroup(t < 0.5 ? b0 : b1);
        #endif
    #endif

    // normals from gradients
    vec3 n0 = -normalize(vec3(
        voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,
        voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,
        voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a
    ));
    vec3 n1 = -normalize(vec3(
        voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,
        voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,
        voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a
    ));
    gl_FragData[2].xyz = -vec3(
        n0.x + t * (n0.x - n1.x),
        n0.y + t * (n0.y - n1.y),
        n0.z + t * (n0.z - n1.z)
    );

    // ensure normal-direction is the same for negative and positive iso-levels
    if (uInvert) {
        gl_FragData[2].xyz *= -1.0;
    }

    // apply normal matrix
    gl_FragData[2].xyz *= transpose3(inverse3(mat3(uGridTransform)));
}
`, Ste = `
precision highp float;
precision highp int;
precision highp sampler2D;

uniform sampler2D tTriCount;
uniform sampler2D tVolumeData;

uniform float uIsoValue;
uniform vec3 uGridDim;
uniform vec3 uGridTexDim;
uniform vec2 uScale;

#include common

// cube corners (excluding origin)
const vec3 c1 = vec3(1., 0., 0.);
const vec3 c2 = vec3(1., 1., 0.);
const vec3 c3 = vec3(0., 1., 0.);
const vec3 c4 = vec3(0., 0., 1.);
const vec3 c5 = vec3(1., 0., 1.);
const vec3 c6 = vec3(1., 1., 1.);
const vec3 c7 = vec3(0., 1., 1.);

vec3 index3dFrom2d(vec2 coord) {
    vec2 gridTexPos = coord * uGridTexDim.xy;
    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);
    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;
    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;
    return vec3(posXY, posZ);
}

vec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {
    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice
    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);
    float row = intDiv(zSlice * gridDim.x, texDim.x);
    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);
    return texture2D(tex, coord);
}

vec4 voxel(vec3 pos) {
    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));
    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);
}

void main(void) {
    vec2 uv = gl_FragCoord.xy / uGridTexDim.xy;
    vec3 posXYZ = index3dFrom2d(uv);

    // get MC case as the sum of corners that are below the given iso level
    float c = step(voxel(posXYZ).a, uIsoValue)
        + 2. * step(voxel(posXYZ + c1).a, uIsoValue)
        + 4. * step(voxel(posXYZ + c2).a, uIsoValue)
        + 8. * step(voxel(posXYZ + c3).a, uIsoValue)
        + 16. * step(voxel(posXYZ + c4).a, uIsoValue)
        + 32. * step(voxel(posXYZ + c5).a, uIsoValue)
        + 64. * step(voxel(posXYZ + c6).a, uIsoValue)
        + 128. * step(voxel(posXYZ + c7).a, uIsoValue);
    c *= step(c, 254.);

    // handle out of bounds positions
    posXYZ += 1.0;
    posXYZ.xy += 1.0; // pixel padding (usually ok even if the texture has no padding)
    if (posXYZ.x >= uGridDim.x || posXYZ.y >= uGridDim.y || posXYZ.z >= uGridDim.z)
        c = 0.0;

    // get total triangles to generate for calculated MC case from triCount texture
    float totalTrianglesToGenerate = texture2D(tTriCount, vec2(intMod(c, 16.), floor(c / 16.)) / 16.).a;
    gl_FragColor = vec4(vec3(totalTrianglesToGenerate * 3.0), c / 255.0);
}
`, Ate = O(O({}, Ei), { tTriCount: Rt("image-uint8", "alpha", "ubyte", "nearest"), tVolumeData: Rt("texture", "rgba", "ubyte", "nearest"), uIsoValue: me("f"), uGridDim: me("v3"), uGridTexDim: me("v3"), uScale: me("v2") }), Ts = "active-voxels";
function wte(e, t, n, r, i, a) {
  if (e.namedComputeRenderables[Ts]) {
    var o = e.namedComputeRenderables[Ts].values;
    R.update(o.uQuadScale, a), R.update(o.tVolumeData, t), R.updateIfChanged(o.uIsoValue, i), R.update(o.uGridDim, n), R.update(o.uGridTexDim, r), R.update(o.uScale, a), e.namedComputeRenderables[Ts].update();
  } else e.namedComputeRenderables[Ts] = function(s, u, l, c, d, f) {
    var p = O(O({}, Pi), { tTriCount: R.create(_te()), uQuadScale: R.create(f), tVolumeData: R.create(u), uIsoValue: R.create(d), uGridDim: R.create(l), uGridTexDim: R.create(c), uScale: R.create(f) }), g = O({}, Ate), m = gr("active-voxels", da, Ste), v = gi(s, "triangles", m, g, p);
    return vi(v, p);
  }(e, t, n, r, i, a);
  return e.namedComputeRenderables[Ts];
}
var Ite = O(O({}, Ei), { tTriIndices: Rt("image-uint8", "alpha", "ubyte", "nearest"), tActiveVoxelsPyramid: Rt("texture", "rgba", "float", "nearest"), tActiveVoxelsBase: Rt("texture", "rgba", "float", "nearest"), tVolumeData: Rt("texture", "rgba", "ubyte", "nearest"), uIsoValue: me("f"), uSize: me("f"), uLevels: me("f"), uCount: me("f"), uInvert: me("b"), uGridDim: me("v3"), uGridTexDim: me("v3"), uGridTransform: me("m4"), uScale: me("v2"), dPackedGroup: Bt("boolean"), dAxisOrder: Bt("string", ["012", "021", "102", "120", "201", "210"]) }), Lc = "isosurface";
function Pte(e, t, n, r, i, a, o, s, u, l, c, d, f, p) {
  if (e.namedComputeRenderables[Lc]) {
    var g = e.namedComputeRenderables[Lc].values;
    R.update(g.tActiveVoxelsPyramid, t), R.update(g.tActiveVoxelsBase, n), R.update(g.tVolumeData, r), R.updateIfChanged(g.uIsoValue, s), R.updateIfChanged(g.uSize, Math.pow(2, u)), R.updateIfChanged(g.uLevels, u), R.updateIfChanged(g.uCount, c), R.updateIfChanged(g.uInvert, d), R.update(g.uGridDim, i), R.update(g.uGridTexDim, a), R.update(g.uGridTransform, o), R.update(g.uScale, l), R.update(g.dPackedGroup, f), R.updateIfChanged(g.dAxisOrder, p.join("")), e.namedComputeRenderables[Lc].update();
  } else e.namedComputeRenderables[Lc] = function(m, v, h, y, x, S, b, _, C, w, I, M, E, T) {
    var P = O(O({}, Pi), { tTriIndices: R.create(xte()), tActiveVoxelsPyramid: R.create(v), tActiveVoxelsBase: R.create(h), tVolumeData: R.create(y), uIsoValue: R.create(_), uSize: R.create(Math.pow(2, C)), uLevels: R.create(C), uCount: R.create(I), uInvert: R.create(M), uGridDim: R.create(x), uGridTexDim: R.create(S), uGridTransform: R.create(b), uScale: R.create(w), dPackedGroup: R.create(E), dAxisOrder: R.create(T.join("")) }), k = O({}, Ite), D = gr("isosurface", da, Cte, { drawBuffers: "required" }), B = gi(m, "triangles", D, k, P);
    return vi(B, P);
  }(e, t, n, r, i, a, o, s, u, l, c, d, f, p);
  return e.namedComputeRenderables[Lc];
}
function Mte(e, t, n, r, i, a, o, s, u, l, c, d, f) {
  var p = function(m, v, h, y, x, S) {
    var b = m.gl, _ = m.resources, C = v.getWidth(), w = v.getHeight();
    m.namedFramebuffers[Ts] || (m.namedFramebuffers[Ts] = _.framebuffer());
    var I = m.namedFramebuffers[Ts];
    I.bind(), m.namedTextures[Ts] || (m.namedTextures[Ts] = _.texture("image-uint8", "rgba", "ubyte", "nearest"));
    var M = m.namedTextures[Ts];
    M.define(C, w);
    var E = wte(m, v, h, y, x, S);
    return m.state.currentRenderItemId = -1, M.attachFramebuffer(I, 0), function(T) {
      var P = T.gl, k = T.state;
      k.disable(P.CULL_FACE), k.disable(P.BLEND), k.disable(P.DEPTH_TEST), k.enable(P.SCISSOR_TEST), k.depthMask(!1), k.colorMask(!0, !0, !0, !0), k.clearColor(0, 0, 0, 0);
    }(m), b.viewport(0, 0, C, w), b.scissor(0, 0, C, w), b.clear(b.COLOR_BUFFER_BIT), b.scissor(0, 0, y[0], y[1]), E.render(), b.finish(), M;
  }(e, t, n, r, o, i), g = function(m, v, h, y, x, S, b, _, C, w, I, M, E, T) {
    var P = m.extensions.drawBuffers;
    if (!P) throw new Error("need WebGL draw buffers");
    var k = m.gl, D = m.resources, B = m.extensions, L = y.pyramidTex, F = y.height, V = y.levels, G = y.scale, H = y.count, q = L.getWidth();
    m.namedFramebuffers[Lc] || (m.namedFramebuffers[Lc] = D.framebuffer());
    var z = m.namedFramebuffers[Lc];
    Jt(k) ? (M || (M = B.colorBufferHalfFloat && B.textureHalfFloat ? D.texture("image-float16", "rgba", "fp16", "nearest") : D.texture("image-float32", "rgba", "float", "nearest")), E || (E = D.texture("image-uint8", "rgba", "ubyte", "nearest")), T || (T = B.colorBufferHalfFloat && B.textureHalfFloat ? D.texture("image-float16", "rgba", "fp16", "nearest") : D.texture("image-float32", "rgba", "float", "nearest"))) : (M || (M = D.texture("image-float32", "rgba", "float", "nearest")), E || (E = D.texture("image-float32", "rgba", "float", "nearest")), T || (T = D.texture("image-float32", "rgba", "float", "nearest"))), M.define(q, F), E.define(q, F), T.define(q, F), M.attachFramebuffer(z, 0), E.attachFramebuffer(z, 1), T.attachFramebuffer(z, 2);
    var K = Pte(m, L, v, h, x, S, b, _, V, G, H, C, w, I);
    return m.state.currentRenderItemId = -1, z.bind(), P.drawBuffers([P.COLOR_ATTACHMENT0, P.COLOR_ATTACHMENT1, P.COLOR_ATTACHMENT2]), function(Y) {
      var Z = Y.gl, X = Y.state;
      X.disable(Z.CULL_FACE), X.disable(Z.BLEND), X.disable(Z.DEPTH_TEST), X.disable(Z.SCISSOR_TEST), X.depthMask(!1), X.colorMask(!0, !0, !0, !0), X.clearColor(0, 0, 0, 0);
    }(m), k.viewport(0, 0, q, F), k.clear(k.COLOR_BUFFER_BIT), K.render(), k.finish(), { vertexTexture: M, groupTexture: E, normalTexture: T, vertexCount: H };
  }(e, p, t, bte(e, p, i, r), n, r, a, o, s, u, l, c, d, f);
  return g;
}
var yR = { isoValue: $t.IsoValueParam }, jp = 1;
function yb(e, t) {
  return !(e.grid.cells.data.length < Math.pow(10, 3)) && mv(e.grid.cells.space.dimensions, jp).powerOfTwoSize <= t.maxTextureSize / 2;
}
function Ete(e, t, n, r) {
  return n.tryUseGpu && r && function(i) {
    return i.extensions.colorBufferFloat && i.extensions.textureFloat && i.extensions.drawBuffers;
  }(r) && yb(t, r) ? function(i) {
    return D_({ defaultProps: N.getDefaultValues(L_), createGeometry: kte, createLocationIterator: function(a) {
      return zr(a.grid.cells.data.length, 1, 1, function() {
        return ku;
      });
    }, getLoci: O_, eachLocation: B_, setUpdateState: function(a, o, s, u) {
      $t.IsoValue.areSame(s.isoValue, u.isoValue, o.grid.stats) || (a.createGeometry = !0);
    }, geometryUtils: sd.Utils, mustRecreate: function(a, o, s) {
      return !o.tryUseGpu || !s || !yb(a, s);
    }, dispose: function(a) {
      a.vertexTexture.ref.value.destroy(), a.groupTexture.ref.value.destroy(), a.normalTexture.ref.value.destroy(), a.doubleBuffer.destroy();
    } }, i);
  }(e) : function(i) {
    return D_({ defaultProps: N.getDefaultValues(L_), createGeometry: Tte, createLocationIterator: function(a) {
      return zr(a.grid.cells.data.length, 1, 1, function() {
        return ku;
      });
    }, getLoci: O_, eachLocation: B_, setUpdateState: function(a, o, s, u) {
      $t.IsoValue.areSame(s.isoValue, u.isoValue, o.grid.stats) || (a.createGeometry = !0);
    }, geometryUtils: Lt.Utils, mustRecreate: function(a, o, s) {
      return o.tryUseGpu && !!s && yb(a, s);
    } }, i);
  }(e);
}
function xI(e, t) {
  return $t.Isosurface.Loci(e, t.isoValue);
}
function O_(e, t, n, r) {
  var i = e.objectId, a = e.groupId;
  return r === i ? $t.Cell.Loci(t, le.ofSingleton(a)) : cr;
}
function B_(e, t, n, r) {
  return function(i, a, o, s) {
    var u = !1;
    if ($t.isLoci(i)) {
      if (!$t.areEquivalent(i.volume, a)) return !1;
      s(le.ofLength(a.grid.cells.data.length)) && (u = !0);
    } else if ($t.Isosurface.isLoci(i)) {
      if (!$t.areEquivalent(i.volume, a)) return !1;
      if (o) {
        if (!$t.IsoValue.areSame(i.isoValue, o, a.grid.stats)) return !1;
        s(le.ofLength(a.grid.cells.data.length)) && (u = !0);
      } else for (var l = a.grid, c = l.stats, d = l.cells.data, f = c.sigma, p = $t.IsoValue.toAbsolute(i.isoValue, c).absoluteValue, g = 0, m = d.length; g < m; ++g) Ar(p, d[g], f) && s(le.ofSingleton(g)) && (u = !0);
    } else if ($t.Cell.isLoci(i)) {
      if (!$t.areEquivalent(i.volume, a)) return !1;
      le.is(i.indices) ? s(i.indices) && (u = !0) : _e.forEach(i.indices, function(v) {
        s(le.ofSingleton(v)) && (u = !0);
      });
    }
    return u;
  }(e, t, n.isoValue, r);
}
function Tte(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s;
    return ie(this, function(u) {
      switch (u.label) {
        case 0:
          return e.runtime.update({ message: "Marching cubes..." }), a = Tu(new Int32Array(t.grid.cells.data.length)), [4, sR({ isoLevel: $t.IsoValue.toAbsolute(r.isoValue, t.grid.stats).absoluteValue, scalarField: t.grid.cells, idField: wr.create(t.grid.cells.space, wr.Data1(a)) }, i).runAsChild(e.runtime)];
        case 1:
          return o = u.sent(), s = Ga.getGridToCartesianTransform(t.grid), Lt.transform(o, s), e.webgl && !e.webgl.isWebGL2 && Lt.uniformTriangleGroup(o, !1), o.setBoundingSphere($t.getBoundingSphere(t)), [2, o];
      }
    });
  });
}
var R_, L_ = O(O(O(O({}, Lt.Params), sd.Params), yR), { quality: O(O({}, Lt.Params.quality), { isEssential: !1 }), tryUseGpu: N.Boolean(!0) });
function kte(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s, u, l, c, d, f, p, g, m, v, h, y, x;
    return ie(this, function(S) {
      if (!e.webgl) throw new Error("webgl context required to create volume isosurface texture-mesh");
      return t.grid.cells.data.length <= 1 ? [2, sd.createEmpty(i)] : (a = t.grid.stats, o = a.max, s = a.min, u = o - s, l = $t.IsoValue.toAbsolute(r.isoValue, t.grid.stats).absoluteValue, c = (l - s) / u, d = R_.get(t, e.webgl), f = d.texture, p = d.gridDimension, g = d.gridTexDim, m = d.gridTexScale, v = d.transform, h = t.grid.cells.space.axisOrderSlowToFast, y = i == null ? void 0 : i.doubleBuffer.get(), x = Mte(e.webgl, f, p, g, m, v, c, l < 0, !1, h, y == null ? void 0 : y.vertex, y == null ? void 0 : y.group, y == null ? void 0 : y.normal), [2, sd.create(x.vertexCount, 1, x.vertexTexture, x.groupTexture, x.normalTexture, $t.getBoundingSphere(t), i)]);
    });
  });
}
function Dte(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s;
    return ie(this, function(u) {
      switch (u.label) {
        case 0:
          return e.runtime.update({ message: "Marching cubes..." }), a = Tu(new Int32Array(t.grid.cells.data.length)), [4, uR({ isoLevel: $t.IsoValue.toAbsolute(r.isoValue, t.grid.stats).absoluteValue, scalarField: t.grid.cells, idField: wr.create(t.grid.cells.space, wr.Data1(a)) }, i).runAsChild(e.runtime)];
        case 1:
          return o = u.sent(), s = Ga.getGridToCartesianTransform(t.grid), Mn.transform(o, s), o.setBoundingSphere($t.getBoundingSphere(t)), [2, o];
      }
    });
  });
}
(function(e) {
  var t = "volume-isosurface-texture";
  e.descriptor = Us({ name: t }), e.get = function(n, r) {
    var i = r.resources, a = Ga.getGridToCartesianTransform(n.grid), o = A.clone(n.grid.cells.space.dimensions), s = mv(o, jp), u = s.width, l = s.height, c = s.powerOfTwoSize, d = A.create(u, l, 0), f = xe.create(u / c, l / c);
    if (c > r.maxTextureSize / 2) throw new Error("volume too large for gpu isosurface extraction");
    if (!n._propertyData[t]) {
      n._propertyData[t] = i.texture("image-uint8", "alpha", "ubyte", "linear");
      var p = n._propertyData[t];
      p.define(c, c), p.load(function(g, m, v) {
        var h = g.grid, y = h.cells, x = y.space, S = y.data, b = h.stats, _ = b.max, C = b.min, w = x.dimensions, I = x.dataOffset, M = mv(w, v), E = M.width, T = M.height, P = new Uint8Array(E * T * 1), k = { array: P, width: E, height: T }, D = _ - C, B = w[0], L = w[1], F = w[2], V = B + v, G = L + v;
        A(), A();
        for (var H = 0; H < F; ++H) for (var q = 0; q < L; ++q) for (var z = 0; z < B; ++z) {
          var K = Math.floor(H * V % E / V), Y = 1 * (Math.floor(H * V / E) * G * E + q * E + (K * V + z)), Z = I(z, q, H);
          P[Y] = Math.round((S[Z] - C) / D * 255);
        }
        return k;
      }(n, 0, jp), !0), n.customProperties.add(e.descriptor), n.customProperties.assets(e.descriptor, [{ dispose: function() {
        return p.destroy();
      } }]);
    }
    return o[0] += jp, o[1] += jp, { texture: n._propertyData[t], transform: a, gridDimension: o, gridTexDim: d, gridTexScale: f };
  };
})(R_ || (R_ = {}));
var bR = O(O(O({}, Mn.Params), yR), { quality: O(O({}, Mn.Params.quality), { isEssential: !1 }), sizeFactor: N.Numeric(3, { min: 0, max: 10, step: 0.1 }) });
function Ote(e) {
  return D_({ defaultProps: N.getDefaultValues(bR), createGeometry: Dte, createLocationIterator: function(t) {
    return zr(t.grid.cells.data.length, 1, 1, function() {
      return ku;
    });
  }, getLoci: O_, eachLocation: B_, setUpdateState: function(t, n, r, i) {
    $t.IsoValue.areSame(r.isoValue, i.isoValue, n.grid.stats) || (t.createGeometry = !0);
  }, geometryUtils: Mn.Utils }, e);
}
var El, N_, Ji, F_, _R = { solid: function(e, t) {
  return bI("Isosurface mesh", e, t, Ete, xI);
}, wireframe: function(e, t) {
  return bI("Isosurface wireframe", e, t, Ote, xI);
} }, xR = O(O(O({}, L_), bR), { visuals: N.MultiSelect(["solid"], N.objectToOptions(_R)), bumpFrequency: N.Numeric(1, { min: 0, max: 10, step: 0.1 }, Qe.ShadingCategory), alpha: N.Numeric(0.12, { min: 0, max: 1, step: 0.01 }, { label: "Opacity", isEssential: !0, description: "How opaque/transparent the representation is rendered." }) });
function Bte(e, t) {
  return en.createMulti("Isosurface", e, t, en.StateBuilder, _R);
}
function CI(e) {
  return e === Ji.Float32 ? 4 : e === Ji.Int16 || e === Ji.Uint16 ? 2 : 1;
}
function Rte(e, t, n, r) {
  return n === void 0 && (n = 0), e === Ji.Float32 ? new Float32Array(t, n, r) : e === Ji.Int16 ? new Int16Array(t, n, r) : e === Ji.Uint16 ? new Uint16Array(t, n, r) : new Int8Array(t, n, r);
}
function Lte(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    return ie(this, function(o) {
      switch (o.label) {
        case 0:
          return [4, t.readBuffer(n, e.readBuffer, r, i)];
        case 1:
          return o.sent(), e.elementByteSize > 1 && (a !== void 0 && a !== El.IsNativeEndianLittle || !El.IsNativeEndianLittle) && El.flipByteOrder(e.readBuffer, e.valuesBuffer, r, e.elementByteSize, i), [2, e.values];
      }
    });
  });
}
function Nte(e) {
  return se(this, 0, void 0, function() {
    var t, n, r, i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          return [4, e.readBuffer(0, 1024)];
        case 1:
          if (t = s.sent().buffer, (n = String.fromCharCode(t.readUInt8(208), t.readUInt8(209), t.readUInt8(210), t.readUInt8(211))) !== "MAP ") throw new Error('ccp4 format error, missing "MAP " string');
          return r = [t.readUInt8(212), t.readUInt8(213)], i = !1, r[0] === 68 && r[1] === 65 ? i = !0 : r[0] === 17 && r[1] === 17 ? i = !1 : t.readInt32LE(12) <= 16 && (i = !0), a = i ? function(u) {
            return t.readInt32LE(4 * u);
          } : function(u) {
            return t.readInt32BE(4 * u);
          }, o = i ? function(u) {
            return t.readFloatLE(4 * u);
          } : function(u) {
            return t.readFloatBE(4 * u);
          }, [2, { header: { NC: a(0), NR: a(1), NS: a(2), MODE: a(3), NCSTART: a(4), NRSTART: a(5), NSSTART: a(6), NX: a(7), NY: a(8), NZ: a(9), xLength: o(10), yLength: o(11), zLength: o(12), alpha: o(13), beta: o(14), gamma: o(15), MAPC: a(16), MAPR: a(17), MAPS: a(18), AMIN: o(19), AMAX: o(20), AMEAN: o(21), ISPG: a(22), NSYMBT: a(23), LSKFLG: a(24), SKWMAT: [], SKWTRN: [], userFlag1: a(39), userFlag2: a(40), originX: o(49), originY: o(50), originZ: o(51), MAP: n, MACHST: r, ARMS: o(54) }, littleEndian: i }];
      }
    });
  });
}
function CR(e) {
  switch (e) {
    case 0:
      return Ji.Int8;
    case 1:
      return Ji.Int16;
    case 2:
      return Ji.Float32;
    case 3:
      throw new Error("mode 3 unsupported, complex 16-bit integers");
    case 4:
      throw new Error("mode 4 unsupported, complex 32-bit reals");
    case 6:
      Ji.Uint16;
    case 16:
      throw new Error("mode 16 unsupported, unsigned char * 3 (for rgb data, non-standard)");
  }
  throw new Error("unknown mode '".concat(e, "'"));
}
function SR(e) {
  return e.userFlag1 === -128 && e.userFlag2 === 127;
}
function AR(e) {
  return SR(e) ? Ji.Float32 : CR(e.MODE);
}
function Fte(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l, c, d, f;
    return ie(this, function(p) {
      switch (p.label) {
        case 0:
          return [4, n.update({ message: "Parsing CCP4/MRC/MAP file..." })];
        case 1:
          return p.sent(), [4, Nte(e)];
        case 2:
          return r = p.sent(), i = r.header, a = r.littleEndian, o = function(g) {
            return 1024 + g.NSYMBT;
          }(i), s = CR(i.MODE), u = AR(i), l = i.NC * i.NR * i.NS, c = CI(s), d = l * c, f = function(g, m) {
            var v = CI(m), h = new ArrayBuffer(v * g), y = El.fromArrayBuffer(h), x = El.IsNativeEndianLittle ? h : new ArrayBuffer(v * g);
            return { type: m, elementByteSize: v, readBuffer: y, valuesBuffer: new Uint8Array(x), values: Rte(m, x) };
          }(l, u), function(g, m, v, h, y, x) {
            se(this, 0, void 0, function() {
              var S, b, _, C, w, I;
              return ie(this, function(M) {
                switch (M.label) {
                  case 0:
                    return SR(g) ? (S = 3 * y, [4, v.readBuffer(h, m.readBuffer, y, S)]) : [3, 2];
                  case 1:
                    for (M.sent(), b = new Int8Array(m.valuesBuffer.buffer, S), _ = (g.AMAX - g.AMIN) / 255, C = 0.5 * (g.AMIN + g.AMAX + _), w = 0, I = y; w < I; ++w) m.values[w] = _ * b[w] + C;
                    return [3, 4];
                  case 2:
                    return [4, Lte(m, v, h, y, 0, x)];
                  case 3:
                    M.sent(), M.label = 4;
                  case 4:
                    return [2];
                }
              });
            });
          }(i, f, e, o, d, a), [2, { header: i, values: f.values, name: e.name }];
      }
    });
  });
}
function Vte(e, t) {
  return function(n, r) {
    var i = this;
    return Xt.create("Parse CCP4/MRC/MAP", function(a) {
      return se(i, 0, void 0, function() {
        var o, s, u;
        return ie(this, function(l) {
          switch (l.label) {
            case 0:
              return l.trys.push([0, 2, , 3]), s = (o = hi).success, [4, Fte(n, 0, a)];
            case 1:
              return [2, s.apply(o, [l.sent()])];
            case 2:
              return u = l.sent(), [2, hi.error(u)];
            case 3:
              return [2];
          }
        });
      });
    });
  }(N_.fromBuffer(El.fromUint8Array(e), t), e.length);
}
function Gte(e, t) {
  var n = this;
  return Xt.create("Create Volume", function(r) {
    return se(n, 0, void 0, function() {
      var i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S;
      return ie(this, function(b) {
        return i = e.header, a = e.values, o = A.create(i.xLength, i.yLength, i.zLength), s = A.create(xr(i.alpha), xr(i.beta), xr(i.gamma)), u = i.ISPG > 65536 ? 0 : i.ISPG, l = os.create(u || "P 1", o, s), c = A.create(i.MAPC - 1, i.MAPR - 1, i.MAPS - 1), d = wr.convertToCanonicalAxisIndicesFastToSlow(c), f = [i.NX, i.NY, i.NZ], p = d([i.NC, i.NR, i.NS]), g = function(_) {
          return _.originX === 0 && _.originY === 0 && _.originZ === 0 ? A.create(_.NCSTART, _.NRSTART, _.NSSTART) : A.create(_.originX / (_.xLength / _.NX), _.originY / (_.yLength / _.NY), _.originZ / (_.zLength / _.NZ));
        }(i), m = d(g), v = A.create(m[0] / f[0], m[1] / f[1], m[2] / f[2]), h = A.create(p[0] / f[0], p[1] / f[1], p[2] / f[2]), y = wr.Space(p, wr.invertAxisOrder(c), function(_) {
          var C = AR(_);
          switch (C) {
            case Ji.Float32:
              return Float32Array;
            case Ji.Int8:
              return Int8Array;
            case Ji.Int16:
              return Int16Array;
            case Ji.Uint16:
              return Uint16Array;
          }
          throw Error("".concat(C, " is not a supported value format."));
        }(i)), x = wr.create(y, wr.Data1(a)), S = i.AMIN === 0 && i.AMAX === 0 && i.AMEAN === 0 && i.ARMS === 0, [2, { label: void 0, entryId: void 0, grid: { transform: { kind: "spacegroup", cell: l, fractionalBox: qn.create(v, A.add(A.zero(), v, h)) }, cells: x, stats: { min: isNaN(i.AMIN) || S ? Uz(a) : i.AMIN, max: isNaN(i.AMAX) || S ? Kg(a) : i.AMAX, mean: isNaN(i.AMEAN) || S ? Hz(a) : i.AMEAN, sigma: isNaN(i.ARMS) || i.ARMS === 0 ? qz(a) : i.ARMS } }, sourceData: F_.create(e), customProperties: new Rm(), _propertyData: /* @__PURE__ */ Object.create(null) }];
      });
    });
  });
}
N.getDefaultValues(xR), function(e) {
  function t(r) {
    var i = new DataView(r.buffer);
    return Object.assign(r.subarray(0), { readInt8: function(a) {
      return i.getInt8(a);
    }, readUInt8: function(a) {
      return i.getUint8(a);
    }, writeInt8: function(a, o) {
      return i.setInt8(o, a);
    }, writeUInt8: function(a, o) {
      return i.setUint8(o, a);
    }, readInt16LE: function(a) {
      return i.getInt16(a, !0);
    }, readInt32LE: function(a) {
      return i.getInt32(a, !0);
    }, readUInt16LE: function(a) {
      return i.getUint16(a, !0);
    }, readUInt32LE: function(a) {
      return i.getUint32(a, !0);
    }, readFloatLE: function(a) {
      return i.getFloat32(a, !0);
    }, readDoubleLE: function(a) {
      return i.getFloat64(a, !0);
    }, writeInt16LE: function(a, o) {
      return i.setInt16(o, a, !0);
    }, writeInt32LE: function(a, o) {
      return i.setInt32(o, a, !0);
    }, writeUInt16LE: function(a, o) {
      return i.setUint16(o, a, !0);
    }, writeUInt32LE: function(a, o) {
      return i.setUint32(o, a, !0);
    }, writeFloatLE: function(a, o) {
      return i.setFloat32(o, a, !0);
    }, writeDoubleLE: function(a, o) {
      return i.setFloat64(o, a, !0);
    }, readInt16BE: function(a) {
      return i.getInt16(a, !1);
    }, readInt32BE: function(a) {
      return i.getInt32(a, !1);
    }, readUInt16BE: function(a) {
      return i.getUint16(a, !1);
    }, readUInt32BE: function(a) {
      return i.getUint32(a, !1);
    }, readFloatBE: function(a) {
      return i.getFloat32(a, !1);
    }, readDoubleBE: function(a) {
      return i.getFloat64(a, !1);
    }, writeInt16BE: function(a, o) {
      return i.setInt16(o, a, !1);
    }, writeInt32BE: function(a, o) {
      return i.setInt32(o, a, !1);
    }, writeUInt16BE: function(a, o) {
      return i.setUint16(o, a, !1);
    }, writeUInt32BE: function(a, o) {
      return i.setUint32(o, a, !1);
    }, writeFloatBE: function(a, o) {
      return i.setFloat32(o, a, !1);
    }, writeDoubleBE: function(a, o) {
      return i.setFloat64(o, a, !1);
    }, copy: function(a, o, s, u) {
      return o = ui(o, 0), s = ui(s, 0), u = ui(u, r.length), a.set(r.subarray(s, u), o), u - s;
    } });
  }
  function n(r, i, a, o, s) {
    for (var u = 0, l = a; u < l; u += o) for (var c = 0; c < o; c++) i[s + u + o - c - 1] = r[s + u + c];
  }
  e.fromUint8Array = t, e.fromArrayBuffer = function(r) {
    return t(new Uint8Array(r));
  }, e.fromBuffer = function(r) {
    return t(new Uint8Array(r));
  }, e.IsNativeEndianLittle = new Uint16Array(new Uint8Array([18, 52]).buffer)[0] === 13330, e.flipByteOrder = n, e.flipByteOrderInPlace2 = function(r, i, a) {
    i === void 0 && (i = 0);
    for (var o = new Int16Array(r, i, a), s = 0, u = o.length; s < u; ++s) {
      var l = o[s];
      o[s] = (255 & l) << 8 | l >> 8 & 255;
    }
  }, e.ensureLittleEndian = function(r, i, a, o, s) {
    e.IsNativeEndianLittle || !a || o <= 1 || n(r, i, a, o, s);
  };
}(El || (El = {})), function(e) {
  e.fromBuffer = function(t, n) {
    return { name: n, readBuffer: function(r, i, a, o) {
      var s, u;
      if (typeof i == "number") {
        a = ui(a, i);
        var l = r;
        s = (c = Math.min(t.length, l + a)) - l, u = El.fromUint8Array(new Uint8Array(t.buffer, l, c - l));
      } else {
        a = ui(a, i.length), l = r;
        var c = Math.min(t.length, l + a);
        i.set(t.subarray(l, c), o), s = c - l, u = i;
      }
      return a !== s && console.warn("byteCount ".concat(a, " and bytesRead ").concat(s, " differ")), Promise.resolve({ bytesRead: s, buffer: u });
    }, writeBuffer: function(r, i, a) {
      return a = ui(a, i.length), console.error(".writeBuffer not implemented for FileHandle.fromBuffer"), Promise.resolve(0);
    }, writeBufferSync: function(r, i, a) {
      return a = ui(a, i.length), console.error(".writeSync not implemented for FileHandle.fromBuffer"), 0;
    }, close: k6 };
  };
}(N_ || (N_ = {})), function(e) {
  e.Float32 = "float32", e.Int8 = "int8", e.Int16 = "int16", e.Uint16 = "uint16";
}(Ji || (Ji = {})), function(e) {
  e.is = function(t) {
    return (t == null ? void 0 : t.kind) === "ccp4";
  }, e.create = function(t) {
    return { kind: "ccp4", name: t.name, data: t };
  };
}(F_ || (F_ = {}));
var zte = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, Vte(e, "Hermite").run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, Gte(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, Ute = { createTheme: function(e, t, n) {
  var r, i;
  if (n != null && n.color) return { color: (r = t.managers.representation.ctx) === null || r === void 0 ? void 0 : r.colorThemeRegistry.create(n.color.name, { volume: e }, n.color.props), size: (i = t.managers.representation.ctx) === null || i === void 0 ? void 0 : i.colorThemeRegistry.create("uniform", {}, {}) };
}, parse: function(e, t) {
  return se(this, 0, void 0, function() {
    var n;
    return ie(this, function(r) {
      switch (r.label) {
        case 0:
          return [4, e.arrayBuffer()];
        case 1:
          return n = r.sent(), [4, zte.parse(new Uint8Array(n))];
        case 2:
          return [2, r.sent()];
      }
    });
  });
}, create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = Bte(t, function() {
            return xR;
          }), n && i.setTheme(n), [4, i.createOrUpdate(r ?? {}, e).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return [4, e.createOrUpdate(i ?? {}, t).run()];
        case 1:
          return a.sent(), r && e.setTheme(r), [2];
      }
    });
  });
} }, Hte = { unitLabel: N.Text("Å", { isEssential: !0 }) }, qte = O(O(O({}, Mn.Params), Hte), { lineSizeAttenuation: N.Boolean(!1), linesColor: N.Color(Ae(14080239), { isEssential: !0 }), linesSize: N.Numeric(0.8), alpha: N.Numeric(0.6, { min: 0, max: 1, step: 0.01 }, { label: "Opacity", isEssential: !0, description: "How opaque/transparent the representation is rendered." }) }), wR = { lines: function(e, t) {
  return hr(Yte, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.Highlighting });
  } });
} }, jte = O(O({}, qte), { visuals: N.MultiSelect(["lines"], N.objectToOptions(wR)) });
function Kte(e, t) {
  var n = t.sphereA, r = t.sphereB, i = t.center, a = e.loci, o = a[0], s = a[1];
  return zn.getBoundingSphere(o, n), zn.getBoundingSphere(s, r), A.add(i, n.center, r.center), A.scale(i, i, 0.5), t.distance = A.distance(n.center, r.center), t;
}
var Fd = { sphereA: pe(), sphereB: pe(), center: A(), distance: 0 };
function Yte(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.pairs.length; c < d; ++c) Kte(o.pairs[c], Fd), l.add(Fd.sphereA.center[0], Fd.sphereA.center[1], Fd.sphereA.center[2], Fd.sphereB.center[0], Fd.sphereB.center[1], Fd.sphereB.center[2], c);
    return l.getLines();
  }(t, 0, r && r.geometry), a = function(o, s) {
    return o.pairs.length === 1 ? "interactionLine ".concat(U0(o.pairs[0], { unitLabel: s, measureOnly: !0 })) : "".concat(o.pairs.length, " interactionLines");
  }(t, n.unitLabel);
  return Wt.create(a, t, i, function() {
    return n.linesColor;
  }, function() {
    return n.linesSize;
  }, function(o) {
    return U0(t.pairs[o], n);
  });
}
var Wte = { parse: function(e, t) {
  return e.map(function(n) {
    var r = t.managers.cell.get(n.ref), i = jn(r);
    return Vr(i, n.elementIds);
  });
}, create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r = function(a, o) {
            var s = en.createMulti("interactionLine", a, o, en.StateBuilder, wR);
            return s.setState({ pickable: !0, markerActions: En.All }), s;
          }(t, function() {
            return jte;
          }), [4, r.createOrUpdate({}, { pairs: [{ loci: e }] }).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return [4, e.createOrUpdate({}, { pairs: [{ loci: t }] }).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, Xte = ne.fromTranslation(ne(), A.create(0.5, 0.5, 0.5)), Zte = g3(h3(xD()), Xte), ws = A(), SI = ne(), Qte = O(O({}, Lt.Params), { cellColor: N.Color(qt.black), cellScale: N.Numeric(2, { min: 0.1, max: 5, step: 0.1 }), ref: N.Select("model", N.objectToOptions({ origin: "Origin", model: "Model" }), { isEssential: !0 }), attachment: N.Select("corner", N.objectToOptions({ corner: "Corner", center: "Center" }), { isEssential: !0 }) }), Jte = { mesh: function(e, t) {
  return hr(ene, Lt.Utils);
} }, $te = O({}, Qte);
function ene(e, t, n, r) {
  var i = function(o, s, u) {
    var l = mt.createState(256, 128, u), c = o.symmetry.spacegroup.cell.fromFractional;
    A.copy(ws, o.ref), s.attachment === "center" ? (A.trunc(ws, ws), A.subScalar(ws, ws, 0.5)) : A.floor(ws, ws), ne.fromTranslation(SI, ws);
    var d = g3(h3(Zte), SI), f = Math.cbrt(o.symmetry.spacegroup.cell.volume) / 300 * s.cellScale;
    l.currentGroup = 1, mt.addCage(l, c, d, f, 2, 20);
    var p = pe.fromDimensionsAndTransform(pe(), A.unit, c);
    A.transformMat4(ws, ws, c), pe.translate(p, p, ws), pe.expand(p, p, f);
    var g = mt.getMesh(l);
    return g.setBoundingSphere(p), g;
  }(t, n, r && r.geometry), a = nv.getUnitcellLabel(t.symmetry);
  return Wt.create(a, t, i, function() {
    return n.cellColor;
  }, function() {
    return 1;
  }, function() {
    return a;
  });
}
var tne = { create: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r;
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return r = function(a, o) {
            return en.createMulti("Unit Cell", a, o, en.StateBuilder, Jte);
          }(t, function() {
            return $te;
          }), [4, r.createOrUpdate({}, e).run()];
        case 1:
          return i.sent(), [2, r];
      }
    });
  });
}, update: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    return ie(this, function(i) {
      switch (i.label) {
        case 0:
          return [4, e.createOrUpdate({}, t).run()];
        case 1:
          return i.sent(), [2];
      }
    });
  });
} }, nne = { unitLabel: N.Text("Å", { isEssential: !0 }) }, rne = O(O(O({}, Mn.Params), nne), { lineSizeAttenuation: N.Boolean(!1), linesColor: N.Color(qt.black), linesSize: N.Numeric(2), alpha: N.Numeric(0.6, { min: 0, max: 1, step: 0.01 }, { label: "Opacity", isEssential: !0, description: "How opaque/transparent the representation is rendered." }), isDash: N.Boolean(!1), dashLength: N.Numeric(0.04, { min: 0.01, max: 0.2, step: 0.01 }) }), IR = { lines: function(e, t) {
  return hr(ane, Mn.Utils, { modifyState: function(n) {
    return O(O({}, n), { markerActions: En.Selecting });
  } });
} }, ine = O(O({}, rne), { visuals: N.MultiSelect(["lines"], N.objectToOptions(IR)) });
function ane(e, t, n, r) {
  var i = function(o, s, u) {
    for (var l = zi.create(128, 64, u), c = 0, d = o.lines.length; c < d; ++c) s.isDash ? l.addFixedLengthDashes(A.create(o.lines[c][0][0], o.lines[c][0][1], o.lines[c][0][2]), A.create(o.lines[c][1][0], o.lines[c][1][1], o.lines[c][1][2]), s.dashLength, c) : l.add(o.lines[c][0][0], o.lines[c][0][1], o.lines[c][0][2], o.lines[c][1][0], o.lines[c][1][1], o.lines[c][1][2], c);
    return l.getLines();
  }(t, n, r && r.geometry), a = function(o, s) {
    return "".concat(o.lines.length, " interactionLines");
  }(t, n.unitLabel);
  return Wt.create(a, t, i, function() {
    return n.linesColor;
  }, function() {
    return n.linesSize;
  }, function() {
    return "CustomLines";
  });
}
var one = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            var u = en.createMulti("customLines", o, s, en.StateBuilder, IR);
            return u.setState({ pickable: !1, markerActions: En.Selecting }), u;
          }(t, function() {
            return ine;
          }), [4, i.createOrUpdate(r ?? {}, { lines: e }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return [4, e.createOrUpdate(i ?? {}, { lines: t }).run()];
        case 1:
          return a.sent(), [2];
      }
    });
  });
} }, sne = O(O({}, Lt.Params), { color: N.Color(qt.orange), scaleFactor: N.Numeric(1, { min: 0.1, max: 10, step: 0.1 }) }), PR = { plane: function(e, t) {
  return hr(lne, Lt.Utils);
} }, une = O(O({}, sne), { visuals: N.MultiSelect(["plane"], N.objectToOptions(PR)) });
function lne(e, t, n, r) {
  var i = function(a, o, s) {
    var u = mt.createState(256, 128, s);
    return a.planes.forEach(function(l) {
      mt.addTriangle(u, A.create.apply(A, l[0]), A.create.apply(A, l[1]), A.create.apply(A, l[2]));
    }), mt.getMesh(u);
  }(t, 0, r && r.geometry);
  return Wt.create("CustomPlanes", t, i, function() {
    return n.color;
  }, function() {
    return 1;
  }, function() {
    return "CustomPlanes";
  });
}
var y1, yp, cu, Yr, bp, cne = { create: function(e, t, n, r) {
  return se(this, 0, void 0, function() {
    var i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return i = function(o, s) {
            var u = en.createMulti("CustomPlanes", o, s, en.StateBuilder, PR);
            return u.setState({ pickable: !1, markerActions: En.Selecting }), u;
          }(t, function() {
            return une;
          }), [4, i.createOrUpdate(r ?? {}, { planes: e }).run()];
        case 1:
          return a.sent(), [2, i];
      }
    });
  });
}, update: function(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return [4, e.createOrUpdate(i ?? {}, { planes: t }).run()];
        case 1:
          return a.sent(), [2];
      }
    });
  });
} }, es = ((y1 = {})[fe.Ribbon] = v$, y1[fe.BallAndStick] = LB, y1[fe.Line] = Aee, y1[fe.Stick] = wee, y1[fe.CPK] = jee, y1), Kp = ((yp = {})[fe.Label] = N$, yp[fe.Distance] = H$, yp[fe.Angle] = $$, yp[fe.Dihedral] = mee, yp), Ag = ((cu = {})[fe.Surface] = Lee, cu[fe.IsoSurface] = Ute, cu[fe.RotateArrow] = Hee, cu[fe.Pocket] = $ee, cu[fe.Pharmacophore] = dte, cu[fe.MappingLine] = Wte, cu[fe.UnitCell] = tne, cu[fe.CustomLines] = one, cu[fe.CustomPlanes] = cne, cu);
(function(e) {
  e.LigandReceptor = "ligand-receptor", e.IntraLigand = "intra-ligand", e.IntraReceptor = "intra-receptor", e.All = "all";
})(Yr || (Yr = {}));
var dne = function(e, t) {
  var n, r, i, a = Yi(e.getLoci());
  if (!a || !(!((i = (r = (n = a == null ? void 0 : a.elements) === null || n === void 0 ? void 0 : n[0]) === null || r === void 0 ? void 0 : r.unit) === null || i === void 0) && i.elements)) return Oc.Not;
  var o = new Set(Ai(a)), s = 0;
  return t.forEach(function(u) {
    o.has(u) && s++;
  }), s ? s === t.length ? Oc.Include : s === o.size ? Oc.BeIncluded : Oc.Cross : Oc.Not;
}, fne = function(e, t) {
  var n, r;
  if (e.ref !== t.ref) return !1;
  if (!(!((n = e.elementIds) === null || n === void 0) && n.length) || !(!((r = t.elementIds) === null || r === void 0) && r.length)) return !0;
  var i = new Set(t.elementIds);
  return e.elementIds.some(function(a) {
    return i.has(a);
  });
}, kv = function(e, t) {
  var n = Yi(e.getLoci());
  if (!n) return [];
  var r = Vr(n == null ? void 0 : n.structure, t), i = ke.intersect(n, r);
  return Ai(i);
}, V_ = function(e, t, n, r, i) {
  var a = qa(e);
  if (a) {
    var o = zO(a, t);
    return es[n].update(e, o, Pc.managers.representation.ctx, r ? r(o) : e.theme), i && e.setState({ transparency: i(o) }), e;
  }
  console.warn("removeElementIdsInRepresentation");
}, mne = ((bp = {})[fe.Label] = ["customText", "textColor", "textSize"], bp[fe.Distance] = ["linesColor", "textSize", "textColor"], bp[fe.Angle] = ["color", "textSize", "textColor"], bp[fe.Dihedral] = ["color", "textSize", "textColor"], bp), MR = function(e, t) {
  if (pm.has(e)) {
    var n = {};
    return mne[e].forEach(function(r) {
      n[r] = t.props[r];
    }), n;
  }
}, AI = function(e, t, n, r) {
  var i = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], a = e[0], o = e[1], s = e[2], u = function(P) {
    var k = A.create(P[0], P[1], P[2]);
    return A.normalize(k, k), [k[0], k[1], k[2]];
  }(function(P, k) {
    return [k[0] - P[0], k[1] - P[1], k[2] - P[2]];
  }(e, t)), l = u[0], c = u[1], d = u[2], f = l * l, p = l * c, g = l * d, m = c * c, v = c * d, h = d * d, y = a * l, x = a * c, S = a * d, b = o * l, _ = o * c, C = o * d, w = s * l, I = s * c, M = s * d, E = Math.cos(n * (Math.PI / 180)), T = Math.sin(n * (Math.PI / 180));
  return i[0][0] = f + (m + h) * E, i[0][1] = p * (1 - E) + d * T, i[0][2] = g * (1 - E) - c * T, i[0][3] = 0, i[1][0] = p * (1 - E) - d * T, i[1][1] = m + (f + h) * E, i[1][2] = v * (1 - E) + l * T, i[1][3] = 0, i[2][0] = g * (1 - E) + c * T, i[2][1] = v * (1 - E) - l * T, i[2][2] = h + (f + m) * E, i[2][3] = 0, i[3][0] = (a * (m + h) - l * (_ + M)) * (1 - E) + (C - I) * T, i[3][1] = (o * (f + h) - c * (y + M)) * (1 - E) + (w - S) * T, i[3][2] = (s * (f + m) - d * (y + _)) * (1 - E) + (x - b) * T, i[3][3] = 1, [r[0] * i[0][0] + r[1] * i[1][0] + r[2] * i[2][0] + i[3][0], r[0] * i[0][1] + r[1] * i[1][1] + r[2] * i[2][1] + i[3][1], r[0] * i[0][2] + r[1] * i[1][2] + r[2] * i[2][2] + i[3][2]];
}, ER = function(e, t, n) {
  var r, i, a, o, s, u;
  if (!e.canvas3d) return A.create(0, 0, 0);
  var l = xe.create(0, 0), c = A.create(0, 0, 0), d = A.create(0, 0, 0);
  if (xe.sub(l, xe.copy(l, n), t), xe.squaredMagnitude(l)) {
    var f = (i = (r = e.canvas3d) === null || r === void 0 ? void 0 : r.input.pixelRatio) !== null && i !== void 0 ? i : 1;
    return l[0] *= 1 / e.canvas3d.camera.zoom * e.canvas3d.camera.viewport.width * f, l[1] *= 1 / e.canvas3d.camera.zoom * e.canvas3d.camera.viewport.height * f * (((o = (a = e.layout) === null || a === void 0 ? void 0 : a.canvas.clientWidth) !== null && o !== void 0 ? o : 1) / ((u = (s = e.layout) === null || s === void 0 ? void 0 : s.canvas.clientHeight) !== null && u !== void 0 ? u : 1)), A.cross(c, A.sub(c, e.canvas3d.camera.position, e.canvas3d.camera.target), e.canvas3d.camera.up), A.setMagnitude(c, c, l[0]), A.setMagnitude(d, e.canvas3d.camera.up, l[1]), A.add(c, c, d), A.scale(c, c, 1 / 2100), c;
  }
  return A.create(0, 0, 0);
}, pne = function(e, t) {
  var n = ke.getBoundary(Vr(e, t));
  return { center: A.create((n.box.max[0] + n.box.min[0]) / 2, (n.box.max[1] + n.box.min[1]) / 2, (n.box.max[2] + n.box.min[2]) / 2), size: A.create(n.box.max[0] - n.box.min[0], n.box.max[1] - n.box.min[1], n.box.max[2] - n.box.min[2]) };
}, hne = function(e) {
  var t = yo(e);
  if (t) {
    var n = Gi.Provider.get(t);
    if (n) {
      var r = function(i, a, o) {
        var s = A();
        return o.ref === "model" && A.transformMat4(s, nr.getCenter(i), a.spacegroup.cell.toFractional), { symmetry: a, ref: s };
      }(t, n, {});
      return r;
    }
  }
};
window.requestIdleCallback = window.requestIdleCallback || function(e) {
  var t = Date.now();
  return setTimeout(function() {
    e({ didTimeout: !1, timeRemaining: function() {
      return Math.max(0, 50 - (Date.now() - t));
    } });
  }, 1);
};
var G_, z_, _p = new ms("98"), wI = function() {
  function e(t) {
    this.boundaryHelper = new ms("98"), this.plugin = t;
  }
  return e.prototype.focus = function(t) {
    var n;
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x = this;
      return ie(this, function(S) {
        switch (S.label) {
          case 0:
            if (r = !1, i = [], a = [], t ? t.forEach(function(b) {
              var _ = x.plugin.cells.get(b.ref);
              _ && (Array.from(_.representations.keys()).some(function(C) {
                return pm.has(C) || hZ.has(C);
              }) ? a.push(b) : i.push(b));
            }) : (a.push.apply(a, Array.from(this.plugin.managers.selection.shape.selection.values()).map(function(b) {
              return { ref: b };
            })), i.push.apply(i, this.plugin.managers.selection.structure.getSelectionCellItems().length ? this.plugin.managers.selection.structure.getSelectionCellItems() : a.length ? [] : this.plugin.managers.cell.getAllDisplayedCellsRef().map(function(b) {
              return { ref: b };
            }))), !i.length && !a.length) return [2];
            o = A.create(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), s = A.create(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), _p.reset(), u = [], a.forEach(function(b) {
              var _ = x.plugin.cells.get(b.ref);
              if (_) if (_.representations.has(fe.Surface)) i.push(_.model.other);
              else {
                if (_.representations.has(fe.Pharmacophore)) {
                  var C = _.model.other, w = C.center, I = C.normal, M = C.radius;
                  if (!I) return A.min(o, o, A.create(w[0] - M, w[1] - M, w[2] - M)), A.max(s, s, A.create(w[0] + M, w[1] + M, w[2] + M)), void (r = !0);
                  var E = A.create((w[0] + I[0]) / 2, (w[1] + I[1]) / 2, (w[2] + I[2]) / 2), T = (A.distance(I, w) + M) / 2;
                  return A.min(o, o, A.create(E[0] - T, E[1] - T, E[2] - T)), A.max(s, s, A.create(E[0] + T, E[1] + T, E[2] + T)), void (r = !0);
                }
                if (_.representations.has(fe.Pocket)) {
                  var P = _.model.other, k = (w = P.center, P.size), D = [(2 * w[0] + k[0]) / 2, (2 * w[1] + k[1]) / 2, (2 * w[2] + k[2]) / 2], B = [(2 * w[0] - k[0]) / 2, (2 * w[1] - k[1]) / 2, (2 * w[2] - k[2]) / 2], L = { min: A.fromArray(A.zero(), B, 0), max: A.fromArray(A.zero(), D, 0) };
                  return A.min(o, o, L.min), A.max(s, s, L.max), void (r = !0);
                }
                i.push.apply(i, _.dependency.on);
              }
            }), l = 0, c = i, S.label = 1;
          case 1:
            return l < c.length ? (d = c[l], this.plugin.cells.get(d.ref) ? [4, this.plugin.managers.cell.getStructure(d.ref)] : [2]) : [3, 4];
          case 2:
            if (!(f = S.sent())) return [2];
            p = Vr(f, d.elementIds), (!ke.isEmpty(p) || ((n = p == null ? void 0 : p.elements) === null || n === void 0 ? void 0 : n.length) > 0) && u.push(ke.getBoundary(p)), S.label = 3;
          case 3:
            return l++, [3, 1];
          case 4:
            if (!u.length) return r && this.focusSphere({ center: A.create((s[0] + o[0]) / 2, (s[1] + o[1]) / 2, (s[2] + o[2]) / 2), radius: A.distance(s, o) / 2 }), [2];
            for (v = 0, h = u.length; v < h; ++v) g = u[v], m = g.box, y = g.sphere, A.min(o, o, m.min), A.max(s, s, m.max), _p.includePositionRadius(y.center, y.radius);
            for (_p.finishedIncludeStep(), v = 0, h = u.length; v < h; ++v) y = u[v].sphere, _p.radiusPositionRadius(y.center, y.radius);
            return this.focusSphere(_p.getSphere()), [2];
        }
      });
    });
  }, e.prototype.focusSphere = function(t, n) {
    var r, i, a = O({ minRadius: 5, extraRadius: 4, durationMs: 250 }, n), o = a.extraRadius, s = a.minRadius, u = a.durationMs, l = Math.max(t.radius + o, s), c = (r = this.plugin.canvas3d) === null || r === void 0 ? void 0 : r.camera.getFocus(t.center, l);
    (i = this.plugin.canvas3d) === null || i === void 0 || i.requestCameraReset({ durationMs: u, snapshot: c });
  }, e.prototype.reset = function() {
    var t;
    (t = this.plugin.canvas3d) === null || t === void 0 || t.requestCameraReset({ durationMs: 200 });
  }, e.prototype.zoomIn = function() {
    var t, n, r = (t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.camera.getSnapshot();
    if (r) {
      var i = II(r, 1);
      A.distance(r.target, i) < 10 || (r.position = i, (n = this.plugin.canvas3d) === null || n === void 0 || n.camera.setState(r, 200));
    }
  }, e.prototype.zoomOut = function() {
    var t, n, r = (t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.camera.getSnapshot();
    if (r) {
      var i = II(r, -1);
      r.position = i, (n = this.plugin.canvas3d) === null || n === void 0 || n.camera.setState(r, 200);
    }
  }, e.prototype.updateAxes = function(t) {
    var n, r, i, a, o, s, u, l, c = { vecA: A.unitX, vecB: A.unitY, vecC: A.unitZ }, d = this.plugin.cells.get(t);
    if (d) {
      var f = jn(d);
      if (f && (!((a = (i = (r = (n = yo(f)) === null || n === void 0 ? void 0 : n.sourceData) === null || r === void 0 ? void 0 : r.data) === null || i === void 0 ? void 0 : i.molecules) === null || a === void 0) && a.length)) {
        var p = (u = (s = (o = yo(f)) === null || o === void 0 ? void 0 : o.sourceData) === null || s === void 0 ? void 0 : s.data) === null || u === void 0 ? void 0 : u.molecules[0].cell, g = p.vecA, m = p.vecB, v = p.vecC;
        c = { vecA: A.scale(A(), g, 1 / A.distance(A(), g)), vecB: A.scale(A(), m, 1 / A.distance(A(), m)), vecC: A.scale(A(), v, 1 / A.distance(A(), v)) };
      }
    }
    (l = this.plugin.canvas3d) === null || l === void 0 || l.setProps({ camera: { helper: { axes: { name: "on", params: c } } } });
  }, e;
}();
function II(e, t) {
  var n = A();
  A.sub(n, e.target, e.position), A.normalize(n, n), A.scale(n, n, 5 * t);
  var r = e.position;
  return A.add(r, r, n), r;
}
(function(e) {
  e.create = function(t, n) {
    var r = [], i = [], a = [];
    return { add: function(o, s, u) {
      r[r.length] = o, i[i.length] = s, a[a.length] = u;
    }, getContacts: function() {
      for (var o = new to.EdgeBuilder(t.count, r, i), s = new Int8Array(o.slotCount), u = new Int8Array(o.slotCount), l = 0, c = o.edgeCount; l < c; l++) o.addNextEdge(), o.assignProperty(s, a[l]);
      var d, f = o.createGraph({ type: s, flag: u });
      return Object.defineProperty(f, "elementsIndex", { get: function() {
        return d || (d = u_.createElementsIndex(f, t, n));
      } });
    } };
  };
})(G_ || (G_ = {})), function(e) {
  e.create = function() {
    var t = new _f.Builder();
    return { startUnitPair: function(n, r) {
      t.startUnitPair(n.id, r.id);
    }, finishUnitPair: function() {
      t.finishUnitPair();
    }, add: function(n, r, i) {
      t.add(n, r, { type: i, flag: Oa.None });
    }, getContacts: function(n) {
      return new OX(t.getMap(), n);
    } };
  };
}(z_ || (z_ = {}));
var gne = { lineOfSightDistFactor: N.Numeric(1, { min: 0, max: 3, step: 0.1 }) }, vne = 3;
function TR(e, t, n) {
  var r = t.members[t.offsets[t.feature]], i = n.members[n.offsets[n.feature]];
  if (r === i && t.unit === n.unit) return !1;
  var a = xv(t.unit, r), o = xv(n.unit, i);
  return (!a || !o || a === o) && (t.unit.residueIndex[t.unit.elements[r]] !== n.unit.residueIndex[n.unit.elements[i]] || t.unit !== n.unit) && !SX(e, t.unit, r, n.unit, i);
}
function PI(e, t, n, r) {
  var i = xv(e, t), a = xv(n, r);
  return i && a && i !== a;
}
function MI(e, t) {
  for (var n = t.feature, r = t.offsets, i = t.members, a = r[n], o = r[n + 1]; a < o; ++a) if (i[a] === e) return !0;
  return !1;
}
var Cc = A(), bb = A(), _b = A(), yne = Gk();
function bne(e, t, n, r) {
  var i = t.feature, a = n.feature, o = t.members[t.offsets[i]], s = n.members[n.offsets[a]];
  Gn.position(bb, t), Gn.position(_b, n), A.scale(Cc, A.add(Cc, bb, _b), 0.5);
  var u = r * vne, l = e.lookup3d.find(Cc[0], Cc[1], Cc[2], u, yne), c = l.count, d = l.indices, f = l.units, p = l.squaredDistances;
  if (c === 0) return !0;
  for (var g = 0; g < c; ++g) {
    var m = d[g], v = f[g];
    if (ve.isAtomic(v)) {
      var h = Tn(v, m);
      if (h !== "H") {
        var y = f3(h);
        if (!(y * y * r * r <= p[g] || PI(v, m, t.unit, o) || PI(v, m, n.unit, s) || t.unit === v && MI(m, t) || n.unit === v && MI(m, n) || (v.conformation.position(v.elements[m], Cc), A.squaredDistance(Cc, bb) < 1 || A.squaredDistance(Cc, _b) < 1))) return !1;
      }
    }
  }
  return !0;
}
function _ne(e, t, n, r, i, a, o) {
  for (var s = n.x, u = n.y, l = n.z, c = n.subset(i.requiredFeatures), d = c.lookup3d, f = c.indices, p = Gn.Info(e, t, n), g = O({}, p), m = 0, v = _e.size(f); m < v; ++m) {
    var h = _e.getAt(f, m), y = d.find(s[h], u[h], l[h], i.maxDistance), x = y.count, S = y.indices, b = y.squaredDistances;
    if (x !== 0) {
      p.feature = h;
      for (var _ = 0; _ < x; ++_) {
        var C = _e.getAt(f, S[_]);
        if (!(C <= h)) {
          g.feature = C;
          var w = p.unit.elements[p.members[p.offsets[p.feature]]], I = g.unit.elements[g.members[g.offsets[g.feature]]];
          if ((!o || o(p.unit, w, g.unit, I)) && TR(e, p, g)) {
            var M = i.getType(e, p, g, b[_]);
            M && r.add(h, C, M);
          }
        }
      }
    }
  }
}
var xne = ne(), Cne = { distanceMax: N.Numeric(4, { min: 1, max: 5, step: 0.1 }) }, Sne = Gn.Provider([8], function(e, t, n) {
  for (var r = t.elements, i = t.model.atomicConformation, a = i.x, o = i.y, s = i.z, u = function(d, f) {
    var p = Tn(t, d), g = !1;
    p === "C" ? (g = !0, Ml(e, t, d, function(m, v) {
      var h = Tn(m, v);
      h !== "C" && h !== "H" && (g = !1);
    })) : p === "F" && (g = !0), g && n.add(8, 0, a[r[d]], o[r[d]], s[r[d]], d);
  }, l = 0, c = r.length; l < c; ++l) u(l);
}), Ane = { name: "hydrophobic", params: Cne, createTester: function(e) {
  return { maxDistance: e.distanceMax, requiredFeatures: /* @__PURE__ */ new Set([8]), getType: function(t, n, r, i) {
    return function(a, o, s, u) {
      var l = o.types[o.feature], c = s.types[s.feature];
      if (d = c, l === 8 && d === 8) {
        var d, f = o.members[o.offsets[o.feature]], p = s.members[s.offsets[s.feature]];
        if (Tn(o.unit, f) !== "F" || Tn(s.unit, p) !== "F") return hn.Hydrophobic;
      }
    }(0, n, r);
  } };
} };
function wne(e, t) {
  var n = t.contacts, r = function(l, c, d, f, p) {
    var g = f.get(d) || [1 / 0, -1], m = g[0], v = g[1];
    l < m ? (v !== -1 && p(v), f.set(d, [l, c])) : p(c);
  };
  function i(l, c, d, f, p) {
    var g = c.members[c.offsets[c.feature]], m = d.members[d.offsets[d.feature]], v = c.unit.getResidueIndex(g), h = d.unit.getResidueIndex(m), y = "".concat(g, "|").concat(c.unit.id, "|").concat(h, "|").concat(d.unit.id, "|A"), x = "".concat(m, "|").concat(d.unit.id, "|").concat(v, "|").concat(c.unit.id, "|B"), S = Gn.distance(c, d);
    r(S, l, y, f, p), r(S, l, x, f, p);
  }
  var a, o, s = /* @__PURE__ */ new Map(), u = function(l) {
    return n.edges[l].props.flag = Oa.Filtered;
  };
  return { isApplicable: function(l) {
    return l === hn.Hydrophobic;
  }, handleInterContact: function(l, c, d) {
    i(l, c, d, s, u);
  }, startUnit: function(l, c, d) {
    a = /* @__PURE__ */ new Map(), o = function(f) {
      return c.edgeProps.flag[f] = Oa.Filtered;
    };
  }, handleIntraContact: function(l, c, d) {
    i(l, c, d, a, o);
  } };
}
function Ine(e, t) {
  var n = t.contacts, r = function(i, a) {
    for (var o = i.types[i.feature] === 9 ? a : i, s = o.members[o.offsets[o.feature]], u = t.unitsContacts.get(o.unit.id), l = u.edgeProps.type, c = u.elementsIndex, d = c.offsets, f = c.indices, p = d[s], g = d[s + 1]; p < g; ++p) if (l[f[p]] === hn.HydrogenBond) return !0;
    var m = n.getEdgeIndices(o.feature, o.unit.id);
    for (p = 0, g = m.length; p < g; ++p) if (n.edges[m[p]].props.type === hn.HydrogenBond) return !0;
    return !1;
  };
  return { isApplicable: function(i) {
    return i === hn.WeakHydrogenBond;
  }, handleInterContact: function(i, a, o) {
    r(a, o) && (n.edges[i].props.flag = Oa.Filtered);
  }, startUnit: function() {
  }, handleIntraContact: function(i, a, o) {
    r(a, o) && (t.unitsContacts.get(a.unit.id).edgeProps.flag[i] = Oa.Filtered);
  } };
}
function F8(e, t, n, r, i) {
  for (var a = n.offsets, o = n.feature, s = r.offsets, u = r.feature, l = a[o], c = a[o + 1]; l < c; ++l) for (var d = n.members[l], f = i.getContactIndicesForElement(d, n.unit), p = 0, g = f.length; p < g; ++p) {
    var m = f[p];
    if (e.includes(i.edges[m].props.type)) for (var v = s[u], h = s[u + 1]; v < h; ++v) {
      var y = r.members[v];
      if (i.getContactIndicesForElement(y, r.unit).includes(m)) return void (i.edges[t].props.flag = Oa.Filtered);
    }
  }
}
function V8(e, t, n, r, i) {
  for (var a = i.edgeProps, o = a.type, s = a.flag, u = i.elementsIndex, l = u.offsets, c = u.indices, d = n.offsets, f = n.feature, p = r.offsets, g = r.feature, m = d[f], v = d[f + 1]; m < v; ++m) for (var h = n.members[m], y = l[h], x = l[h + 1]; y < x; ++y) {
    var S = c[y];
    if (e.includes(o[S])) {
      for (var b = p[g], _ = p[g + 1]; b < _; ++b) for (var C = r.members[b], w = l[C], I = l[C + 1]; w < I; ++w) if (S === c[w]) return void (s[t] = Oa.Filtered);
    }
  }
}
function Pne(e, t) {
  var n = t.contacts;
  return { isApplicable: function(r) {
    return r === hn.Ionic;
  }, handleInterContact: function(r, i, a) {
    F8([hn.HydrogenBond, hn.WeakHydrogenBond], r, i, a, n);
  }, startUnit: function() {
  }, handleIntraContact: function(r, i, a) {
    V8([hn.HydrogenBond, hn.WeakHydrogenBond], r, i, a, t.unitsContacts.get(i.unit.id));
  } };
}
function Mne(e, t) {
  var n = t.contacts;
  return { isApplicable: function(r) {
    return r === hn.Hydrophobic || r === hn.CationPi;
  }, handleInterContact: function(r, i, a) {
    F8([hn.PiStacking], r, i, a, n);
  }, startUnit: function() {
  }, handleIntraContact: function(r, i, a) {
    V8([hn.PiStacking], r, i, a, t.unitsContacts.get(i.unit.id));
  } };
}
function Ene(e, t) {
  var n = t.contacts;
  return { isApplicable: function(r) {
    return r === hn.Ionic;
  }, handleInterContact: function(r, i, a) {
    F8([hn.MetalCoordination], r, i, a, n);
  }, startUnit: function() {
  }, handleIntraContact: function(r, i, a) {
    V8([hn.MetalCoordination], r, i, a, t.unitsContacts.get(i.unit.id));
  } };
}
function Tne(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    var o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M;
    return ie(this, function(E) {
      return ve.isAtomic(t) ? (o = n.child, s = o == null ? void 0 : o.unitMap.get(t.id), o && !s ? [2, Lt.createEmpty(a)] : (u = He.create(n, t), l = Rr.get(n).value, c = l.unitsFeatures.get(t.id), d = l.unitsContacts.get(t.id), f = c.x, p = c.y, g = c.z, m = c.members, v = c.offsets, h = d.edgeCount, y = d.a, x = d.b, S = d.edgeProps.flag, b = i.sizeFactor, h ? (_ = { linkCount: 2 * h, position: function(T, P, k) {
        A.set(T, f[y[k]], p[y[k]], g[y[k]]), A.set(P, f[x[k]], p[x[k]], g[x[k]]);
      }, style: function(T) {
        return 1;
      }, radius: function(T) {
        u.element = t.elements[m[v[y[T]]]];
        var P = r.size.size(u);
        u.element = t.elements[m[v[x[T]]]];
        var k = r.size.size(u);
        return Math.min(P, k) * b;
      }, ignore: function(T) {
        if (S[T] === Oa.Filtered) return !0;
        if (s) for (var P = y[T], k = v[P], D = v[P + 1]; k < D; ++k) {
          var B = t.elements[m[v[k]]];
          if (!Me.has(s.elements, B)) return !0;
        }
        return !1;
      } }, C = I3(0, _, i, a), w = C.mesh, (I = C.boundingSphere) ? w.setBoundingSphere(I) : w.triangleCount > 0 && (M = pe.expand(pe(), (s ?? t).boundary.sphere, 1 * b), w.setBoundingSphere(M)), [2, w]) : [2, Lt.createEmpty(a)])) : [2, Lt.createEmpty(a)];
    });
  });
}
var kR = O(O(O({}, Kl), w3), { sizeFactor: N.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), dashCount: N.Numeric(6, { min: 2, max: 10, step: 2 }), dashScale: N.Numeric(0.6, { min: 0, max: 2, step: 0.1 }), includeParent: N.Boolean(!1) });
function kne(e) {
  return Yl({ defaultProps: N.getDefaultValues(kR), createGeometry: Tne, createLocationIterator: Bne, getLoci: Dne, eachLocation: One, setUpdateState: function(t, n, r, i, a, o, s) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.dashCount !== r.dashCount || n.dashScale !== r.dashScale || n.dashCap !== r.dashCap || n.radialSegments !== r.radialSegments;
    var u = Rr.get(o.structure).version;
    t.info.interactionsHash !== u && (t.createGeometry = !0, t.updateTransform = !0, t.updateColor = !0, t.info.interactionsHash = u);
  } }, e);
}
function Dne(e, t, n) {
  var r = e.objectId, i = e.instanceId, a = e.groupId;
  if (n === r) {
    var o = t.structure, s = t.group, u = o.unitMap.get(s.units[i].id), l = Rr.get(o).value, c = l.unitsContacts.get(u.id), d = c.a, f = c.b;
    return Vl.Loci(o, l, [{ unitA: u, indexA: d[a], unitB: u, indexB: f[a] }, { unitA: u, indexA: f[a], unitB: u, indexB: d[a] }]);
  }
  return cr;
}
var xb = /* @__PURE__ */ new Set();
function One(e, t, n, r) {
  var i = !1;
  if (Vl.isLoci(e)) {
    var a = t.structure, o = t.group;
    if (!ze.areEquivalent(e.data.structure, a)) return !1;
    var s = Rr.get(a).value;
    if (e.data.interactions !== s) return !1;
    for (var u = o.units[0], l = s.unitsContacts.get(u.id), c = 2 * l.edgeCount, d = 0, f = e.elements; d < f.length; d++)
      if ((E = f[d]).unitA === E.unitB) {
        var p = o.unitIndexMap.get(E.unitA.id);
        if (p !== void 0) {
          var g = l.getDirectedEdgeIndex(E.indexA, E.indexB);
          g !== -1 && n(le.ofSingleton(p * c + g)) && (i = !0);
        }
      }
  } else if (ke.is(e)) {
    if (a = t.structure, o = t.group, !ze.areEquivalent(e.structure, a) || !(s = Rr.get(a).value)) return !1;
    u = o.units[0];
    for (var m = s.unitsContacts.get(u.id), v = s.unitsFeatures.get(u.id), h = 2 * m.edgeCount, y = m.offset, x = v.elementsIndex, S = x.offsets, b = x.indices, _ = v.members, C = v.offsets, w = function(T) {
      var P = o.unitIndexMap.get(T.unit.id);
      if (P === void 0) return "continue";
      _e.forEach(T.indices, function(k) {
        for (var D = S[k], B = S[k + 1]; D < B; ++D) for (var L = b[D], F = y[L], V = y[L + 1]; F < V; ++F) xb.add(F);
      }), xb.forEach(function(k) {
        if (r) {
          for (var D = m.a[k], B = C[D], L = C[D + 1]; B < L; ++B) if (!_e.has(T.indices, _[B])) return;
          var F = m.b[k];
          for (B = C[F], L = C[F + 1]; B < L; ++B) if (!_e.has(T.indices, _[B])) return;
        }
        n(le.ofSingleton(P * h + k)) && (i = !0);
      }), xb.clear();
    }, I = 0, M = e.elements; I < M.length; I++) {
      var E;
      w(E = M[I]);
    }
  }
  return i;
}
function Bne(e) {
  var t = e.structure, n = e.group, r = n.units[0], i = Rr.get(t).value, a = i.unitsContacts.get(r.id), o = 2 * a.edgeCount, s = n.units.length, u = Vl.Location(i, t), l = u.element;
  return zr(o, s, 1, function(c, d) {
    var f = n.units[d];
    return l.unitA = f, l.indexA = a.a[c], l.unitB = f, l.indexB = a.b[c], u;
  });
}
function Rne(e, t, n, r, i) {
  if (!t.hasAtomic) return Lt.createEmpty(i);
  var a = He.create(t), o = Rr.get(t).value, s = o.contacts, u = o.unitsFeatures, l = s.edgeCount, c = s.edges, d = r.sizeFactor;
  if (!l) return Lt.createEmpty(i);
  var f = t.child, p = { linkCount: l, position: function(x, S, b) {
    var _ = c[b], C = _.unitA, w = _.indexA, I = _.unitB, M = _.indexB, E = u.get(C), T = u.get(I), P = t.unitMap.get(C), k = t.unitMap.get(I);
    A.set(x, E.x[w], E.y[w], E.z[w]), A.transformMat4(x, x, P.conformation.operator.matrix), A.set(S, T.x[M], T.y[M], T.z[M]), A.transformMat4(S, S, k.conformation.operator.matrix);
  }, style: function(x) {
    return 1;
  }, radius: function(x) {
    var S = c[x], b = u.get(S.unitA);
    a.unit = t.unitMap.get(S.unitA), a.element = a.unit.elements[b.members[b.offsets[S.indexA]]];
    var _ = n.size.size(a), C = u.get(S.unitB);
    a.unit = t.unitMap.get(S.unitB), a.element = a.unit.elements[C.members[C.offsets[S.indexB]]];
    var w = n.size.size(a);
    return Math.min(_, w) * d;
  }, ignore: function(x) {
    if (c[x].props.flag === Oa.Filtered) return !0;
    if (f) {
      var S = c[x], b = f.unitMap.get(S.unitA);
      if (!b) return !0;
      for (var _ = t.unitMap.get(S.unitA), C = u.get(S.unitA), w = C.offsets, I = C.members, M = w[S.indexA], E = w[S.indexA + 1]; M < E; ++M) {
        var T = _.elements[I[M]];
        if (!Me.has(b.elements, T)) return !0;
      }
    }
    return !1;
  } }, g = I3(0, p, r, i), m = g.mesh, v = g.boundingSphere;
  if (v) m.setBoundingSphere(v);
  else if (m.triangleCount > 0) {
    var h = t.child, y = pe.expand(pe(), (h ?? t).boundary.sphere, 1 * d);
    m.setBoundingSphere(y);
  }
  return m;
}
var DR = O(O(O({}, eB), w3), { sizeFactor: N.Numeric(0.3, { min: 0, max: 10, step: 0.01 }), dashCount: N.Numeric(6, { min: 2, max: 10, step: 2 }), dashScale: N.Numeric(0.6, { min: 0, max: 2, step: 0.1 }), includeParent: N.Boolean(!1) });
function Lne(e) {
  return tB({ defaultProps: N.getDefaultValues(DR), createGeometry: Rne, createLocationIterator: Vne, getLoci: Nne, eachLocation: Fne, setUpdateState: function(t, n, r, i, a, o, s) {
    t.createGeometry = n.sizeFactor !== r.sizeFactor || n.dashCount !== r.dashCount || n.dashScale !== r.dashScale || n.dashCap !== r.dashCap || n.radialSegments !== r.radialSegments;
    var u = Rr.get(o).version;
    t.info.interactionsHash !== u && (t.createGeometry = !0, t.updateTransform = !0, t.updateColor = !0, t.info.interactionsHash = u);
  } }, e);
}
function Nne(e, t, n) {
  var r = e.objectId, i = e.groupId;
  if (n === r) {
    var a = Rr.get(t).value, o = a.contacts.edges[i], s = t.unitMap.get(o.unitA), u = t.unitMap.get(o.unitB);
    return Vl.Loci(t, a, [{ unitA: s, indexA: o.indexA, unitB: u, indexB: o.indexB }, { unitA: u, indexA: o.indexB, unitB: s, indexB: o.indexA }]);
  }
  return cr;
}
var W2 = /* @__PURE__ */ new Map(), Cb = /* @__PURE__ */ new Set();
function Fne(e, t, n, r) {
  var i = !1;
  if (Vl.isLoci(e)) {
    if (!ze.areEquivalent(e.data.structure, t)) return !1;
    var a = Rr.get(t).value;
    if (e.data.interactions !== a) return !1;
    for (var o = a.contacts, s = 0, u = e.elements; s < u.length; s++) {
      var l = u[s], c = o.getEdgeIndex(l.indexA, l.unitA.id, l.indexB, l.unitB.id);
      c !== -1 && n(le.ofSingleton(c)) && (i = !0);
    }
  } else if (ke.is(e)) {
    if (!ze.areEquivalent(e.structure, t) || r && e.elements.length === 1 || !(a = Rr.get(t).value)) return !1;
    for (var d = a.contacts, f = a.unitsFeatures, p = 0, g = e.elements; p < g.length; p++) {
      var m = g[p];
      W2.set(m.unit.id, m.indices);
    }
    for (var v = function(x) {
      var S = x.unit;
      if (!ve.isAtomic(S)) return "continue";
      _e.forEach(x.indices, function(b) {
        for (var _ = 0, C = d.getContactIndicesForElement(b, S); _ < C.length; _++) {
          var w = C[_];
          Cb.add(w);
        }
      });
    }, h = 0, y = e.elements; h < y.length; h++)
      v(m = y[h]);
    Cb.forEach(function(x) {
      if (r) {
        var S = d.edges[x], b = S.indexA, _ = S.unitA, C = S.indexB, w = S.unitB, I = W2.get(_), M = W2.get(w);
        if (!I || !M) return;
        for (var E = f.get(_), T = E.offsets, P = E.members, k = T[b], D = T[b + 1]; k < D; ++k) if (!_e.has(I, P[k])) return;
        var B = f.get(w), L = B.offsets, F = B.members;
        for (k = L[C], D = L[C + 1]; k < D; ++k) if (!_e.has(M, F[k])) return;
      }
      n(le.ofSingleton(x)) && (i = !0);
    }), W2.clear(), Cb.clear();
  }
  return i;
}
function Vne(e) {
  var t = Rr.get(e).value, n = t.contacts, r = n.edgeCount, i = Vl.Location(t, e), a = i.element;
  return zr(r, 1, 1, function(o) {
    var s = n.edges[o];
    return a.unitA = e.unitMap.get(s.unitA), a.indexA = s.indexA, a.unitB = e.unitMap.get(s.unitB), a.indexB = s.indexB, i;
  }, !0);
}
var OR = { "intra-unit": function(e, t) {
  return ca("Intra-unit interactions cylinder", e, t, kne);
}, "inter-unit": function(e, t) {
  return Mf("Inter-unit interactions cylinder", e, t, Lne);
} }, EI = O(O(O({}, kR), DR), { unitKinds: fh(["atomic"]), sizeFactor: N.Numeric(0.15, { min: 0.01, max: 1, step: 0.01 }), visuals: N.MultiSelect(["intra-unit", "inter-unit"], N.objectToOptions(OR)) }), xp, Vl, b1 = { name: "interactions", label: "Non-covalent Interactions", description: "Displays non-covalent interactions as dashed cylinders.", factory: function(e, t) {
  return en.createMulti("Interactions", e, t, Ao, OR);
}, getParams: function(e, t) {
  return N.clone(EI);
}, defaultValues: N.getDefaultValues(EI), defaultColorTheme: { name: "interaction-type" }, defaultSizeTheme: { name: "uniform" }, isApplicable: function(e) {
  return e.elementCount > 0 && Rr.isApplicable(e);
}, ensureCustomProperties: { attach: function(e, t) {
  return Rr.attach(e, t, void 0, !0);
}, detach: function(e) {
  return Rr.ref(e, !1);
} }, getData: function(e, t) {
  return t.includeParent ? e.asParent() : e;
}, mustRecreate: function(e, t) {
  return e.includeParent !== t.includeParent;
} }, Sb = { createOrUpdateInCellItems: function(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s, u;
    return ie(this, function(l) {
      switch (l.label) {
        case 0:
          return a = Cg(e, t).structure, o = O(O({}, Rr.defaultParams), { type: n }), r && (o.providers.defaultValue = r), [4, Rr.attach({ runtime: go, assetManager: new vl() }, a, o)];
        case 1:
          return l.sent(), t.managers.cell.traverse(function(c, d) {
            var f;
            d.type === fe.IntraInteractions && (s = c.ref, d.state && ((f = t.canvas3d) === null || f === void 0 || f.remove(d.state), d.state.destroy())), d.type === fe.BetweenInteractions && t.managers.cell.remove([{ ref: c.ref }]);
          }), (u = b1.factory(t.managers.representation.ctx, b1.getParams)).setTheme({ color: t.managers.representation.ctx.colorThemeRegistry.create("interaction-type", { structure: a }), size: t.managers.representation.ctx.sizeThemeRegistry.create("uniform", { structure: a }) }), [4, u.createOrUpdate({}, a).run()];
        case 2:
          return l.sent(), [2, { representation: u, structure: a, ref: s }];
      }
    });
  });
}, createOrUpdateBetweenCellItems: function(e, t, n, r, i) {
  return se(this, 0, void 0, function() {
    var a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _;
    return ie(this, function(C) {
      switch (C.label) {
        case 0:
          for (a = Cg(Re(Re([], e, !0), t, !0), n), o = a.unitsMap, s = a.structure, u = O({}, Rr.defaultParams), r && (u.providers.defaultValue = r), l = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), m = 0, d = e.length; m < d; m++) o.get(m).forEach(function(w) {
            return l.add(w);
          });
          for (m = 0, d = t.length; m < d; m++) o.get(m + e.length).forEach(function(w) {
            return c.add(w);
          });
          return [4, Rr.attach({ runtime: go, assetManager: new vl() }, s, u)];
        case 1:
          if (C.sent(), !s.state.propertyData.molstar_computed_interactions) return [2, {}];
          for (f = s.state.propertyData.molstar_computed_interactions.data.value, p = f.contacts, g = f.unitsFeatures, m = 0, v = p.edgeCount; m < v; ++m) h = p.edges[m], y = s.unitMap.get(h.unitA), x = s.unitMap.get(h.unitB), Gn.Info(s, y, g.get(h.unitA)).feature = h.indexA, Gn.Info(s, x, g.get(h.unitB)).feature = h.indexB, l.has(h.unitA) && c.has(h.unitB) || c.has(h.unitA) && l.has(h.unitB) || (p.edges[m].props.flag = Oa.Filtered);
          return b = [], n.managers.cell.traverse(function(w, I) {
            var M;
            I.type === fe.BetweenInteractions && (S = w.ref, I.state && ((M = n.canvas3d) === null || M === void 0 || M.remove(I.state), I.state.destroy())), I.type === fe.IntraInteractions && b.push({ ref: w.ref });
          }), [4, n.managers.cell.remove(b)];
        case 2:
          return C.sent(), (_ = b1.factory(n.managers.representation.ctx, b1.getParams)).setTheme({ color: n.managers.representation.ctx.colorThemeRegistry.create("interaction-type", { structure: s }), size: n.managers.representation.ctx.sizeThemeRegistry.create("uniform", { structure: s }) }), [4, _.createOrUpdate({ visuals: ["inter-unit"] }, s).run()];
        case 3:
          return C.sent(), [2, { representation: _, structure: s, ref: S }];
      }
    });
  });
}, createOrUpdateGlobal: function(e, t, n, r, i, a) {
  return se(this, 0, void 0, function() {
    var o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F;
    return ie(this, function(V) {
      switch (V.label) {
        case 0:
          o = /* @__PURE__ */ new Map(), s = [], u = 0, l = [], E6(bm).forEach(function(G) {
            var H = (r ?? T.providers.defaultValue)[G], q = H.name, z = H.params;
            q === "on" && l.push(bm[G].createTester(z));
          }), c = /* @__PURE__ */ new Set(), l.forEach(function(G) {
            return ka.add(c, G.requiredFeatures);
          }), d = BR.filter(function(G) {
            return ka.areIntersecting(c, G.types);
          }), I = 0, M = e.length, V.label = 1;
        case 1:
          return I < M ? (f = e[I], (p = t.cells.get(f.ref)) ? (g = f.elementIds ? Fr(jn(p), f.elementIds) : jn(p), [4, ch.attach({ runtime: go, assetManager: new vl() }, g)]) : [3, 3]) : [3, 4];
        case 2:
          for (V.sent(), g.currentPropertyData.molstar_computed_valence_model.data.value.forEach(function(G) {
            o.set(u, G), u++;
          }), m = 0, v = g.units.length; m < v; m++) h = LR(g, g.units[m], d), s.push(h);
          V.label = 3;
        case 3:
          return I++, [3, 1];
        case 4:
          for (y = Cg(e, t), x = y.unitsMap, S = y.structure, b = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), w = function(G, H) {
            C.set(e[G].ref, /* @__PURE__ */ new Set());
            var q = x.get(G), z = t.cells.get(e[G].ref);
            if (z) {
              var K = jn(z).units;
              q.forEach(function(Y, Z) {
                b.set(Y, e[G].ref), K && K[Z] && _.set("".concat(e[G].ref, "_").concat(K[Z].invariantId), Y);
              });
            }
          }, I = 0, M = e.length; I < M; I++) w(I);
          return Object.assign(S.currentPropertyData, { molstar_computed_valence_model: { props: { assignCharge: "auto", assignH: "auto" }, data: { id: 3224, version: 1, value: o } } }), E = /* @__PURE__ */ new Set(), a == null || a.map(function(G) {
            var H = G.ref, q = G.elementIds, z = t.cells.get(H);
            z && jn(z).units.forEach(function(K) {
              K.elements.filter(function(Y) {
                return q == null ? void 0 : q.includes(Y);
              }).forEach(function(Y) {
                return E.add("".concat(_.get("".concat(H, "_").concat(K.invariantId)), "_").concat(Y));
              });
            });
          }), T = O(O({}, Rr.defaultParams), { type: n, featuresList: s, filterKeys: a ? Array.from(E.values()) : void 0 }), r && (T.providers.defaultValue = r), [4, Rr.attach({ runtime: go, assetManager: new vl() }, S, T)];
        case 5:
          return V.sent(), P = S.state.propertyData.molstar_computed_interactions.data.value, k = P.contacts, D = P.unitsContacts, B = P.unitsFeatures, k.edges.forEach(function(G) {
            var H = G.indexA, q = G.indexB, z = G.unitA, K = G.unitB, Y = G.props.flag, Z = B.get(z), X = Z.members, W = Z.offsets, J = B.get(K), $ = J.members, ee = J.offsets;
            if (Y !== Oa.Filtered) {
              var ce = S.unitMap.get(z).elements[X[W[H]]], ae = S.unitMap.get(K).elements[$[ee[q]]];
              C.get(b.get(z)).add(ce), C.get(b.get(K)).add(ae);
            }
          }), Array.from(D.entries()).forEach(function(G) {
            for (var H = G[0], q = G[1], z = B.get(H), K = z.members, Y = z.offsets, Z = q.a, X = q.b, W = 0, J = Z.length; W < J; W++) {
              var $ = S.unitMap.get(H).elements[K[Y[Z[W]]]], ee = S.unitMap.get(H).elements[K[Y[X[W]]]];
              C.get(b.get(H)).add($), C.get(b.get(H)).add(ee);
            }
          }), t.managers.cell.traverse(function(G, H) {
            var q;
            H.type === fe.IntraInteractions && (L = G.ref, H.state && ((q = t.canvas3d) === null || q === void 0 || q.remove(H.state), H.state.destroy()));
          }), (F = b1.factory(t.managers.representation.ctx, b1.getParams)).setTheme({ color: t.managers.representation.ctx.colorThemeRegistry.create("interaction-type", { structure: S }), size: t.managers.representation.ctx.sizeThemeRegistry.create("uniform", { structure: S }) }), [4, F.createOrUpdate({}, S).run()];
        case 6:
          return V.sent(), [2, { representation: F, structure: S, ref: L, interactionElementIds: Array.from(C.keys()).map(function(G) {
            return { ref: G, elementIds: Array.from(C.get(G).values()) };
          }).filter(function(G) {
            return G.elementIds.length;
          }) }];
      }
    });
  });
} };
(function(e) {
  function t(i, a) {
    var o = a.unitA, s = a.indexA, u = a.unitB, l = a.indexB, c = i.contacts, d = i.unitsContacts;
    if (o === u) {
      var f = d.get(o.id), p = f.getDirectedEdgeIndex(s, l);
      return l_(f.edgeProps.type[p]);
    }
    return p = c.getEdgeIndex(s, o.id, l, u.id), l_(c.edges[p].props.type);
  }
  function n(i, a, o) {
    var s = i.unitsFeatures;
    return J1.fromPairProvider(a.length, function(u, l, c) {
      var d = a[u];
      Gn.setPosition(l, d.unitA, d.indexA, s.get(d.unitA.id)), Gn.setPosition(c, d.unitB, d.indexB, s.get(d.unitB.id));
    }, o);
  }
  function r(i, a, o) {
    var s = o[0];
    if (s === void 0) return "";
    var u = s.unitA, l = s.indexA, c = s.unitB, d = s.indexB, f = a.unitsFeatures, p = f.get(u.id), g = p.members, m = p.offsets, v = f.get(c.id), h = v.members, y = v.offsets, x = { granularity: "element" };
    return (m[l + 1] - m[l] > 1 || y[d + 1] - y[d] > 1) && (x.granularity = "residue"), [t(a, s), FB(pt.Location(i, u, g[m[l]], i, c, h[y[d]]), x)].join("</br>");
  }
  e.Location = function(i, a, o, s, u, l) {
    return { kind: "data-location", tag: "interactions", data: { structure: a, interactions: i }, element: { unitA: o, indexA: s, unitB: u, indexB: l } };
  }, e.isLocation = function(i) {
    return !!i && i.kind === "data-location" && i.tag === "interactions";
  }, e.areLocationsEqual = function(i, a) {
    return i.data.structure === a.data.structure && i.data.interactions === a.data.interactions && i.element.indexA === a.element.indexA && i.element.indexB === a.element.indexB && i.element.unitA === a.element.unitA && i.element.unitB === a.element.unitB;
  }, e.locationLabel = function(i) {
    return t(i.data.interactions, i.element);
  }, e.Loci = function(i, a, o) {
    return n8("interactions", { structure: i, interactions: a }, o, function(s) {
      return n(a, o, s);
    }, function() {
      return r(i, a, o);
    });
  }, e.isLoci = function(i) {
    return !!i && i.kind === "data-loci" && i.tag === "interactions";
  }, e.getBoundingSphere = n, e.getLabel = r;
})(Vl || (Vl = {}));
var BR = [NX, FX, VX, eZ, tZ, nZ, KX, YX, Sne, cZ, dZ], bm = { ionic: rZ, "pi-stacking": iZ, "cation-pi": aZ, "halogen-bonds": WX, "hydrogen-bonds": GX, "weak-hydrogen-bonds": zX, hydrophobic: Ane, "metal-coordination": fZ }, Gne = function(e) {
  e === void 0 && (e = []);
  var t = /* @__PURE__ */ Object.create(null);
  return Object.keys(bm).forEach(function(n) {
    t[n] = N.MappedStatic(e.includes(n) ? "on" : "off", { on: N.Group(bm[n].params), off: N.Group({}) }, { cycle: !0 });
  }), t;
}(["ionic", "cation-pi", "pi-stacking", "hydrogen-bonds", "halogen-bonds", "metal-coordination", "weak-hydrogen-bonds"]), zne = ((xp = {})[Yr.LigandReceptor] = {}, xp[Yr.IntraLigand] = {}, xp[Yr.IntraReceptor] = {}, xp[Yr.All] = {}, xp), Une = Object.keys(zne), Hne = N.arrayToOptions(Une), RR = { providers: N.Group(Gne, { isFlat: !0 }), contacts: N.Group(gne, { label: "Advanced Options" }), type: N.Select(Yr.LigandReceptor, Hne, { isEssential: !0, description: "Visual/rendering quality of the representation." }), featuresList: N.Value([], { isHidden: !0 }), filterKeys: N.Value(void 0, { isHidden: !0 }) };
function qne(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E;
    return ie(this, function(T) {
      switch (T.label) {
        case 0:
          r = O(O({}, N.getDefaultValues(RR)), n), i = r.type, a = r.featuresList, o = r.filterKeys, s = new Set(o), u = wO(t).data, l = u.ligand, c = u.other, d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), Object.keys(l).forEach(function(P) {
            Object.keys(l[P]).forEach(function(k) {
              l[P][k].forEach(function(D) {
                d.add(D.unitId), f.add("".concat(D.unitId, "_").concat(D.elementId));
              });
            });
          }), Object.keys(c).forEach(function(P) {
            Object.keys(c[P]).forEach(function(k) {
              c[P][k].forEach(function(D) {
                d.add(D.unitId), f.add("".concat(D.unitId, "_").concat(D.elementId));
              });
            });
          }), p = [], E6(bm).forEach(function(P) {
            var k = r.providers[P], D = k.name, B = k.params;
            D === "on" && p.push(bm[P].createTester(i === Yr.All && ["hydrogen-bonds", "weak-hydrogen-bonds"].includes(P) ? O(O({}, B), { water: !0 }) : B));
          }), g = /* @__PURE__ */ new Set(), p.forEach(function(P) {
            return ka.add(g, P.requiredFeatures);
          }), m = BR.filter(function(P) {
            return ka.areIntersecting(g, P.types);
          }), v = Mu.Mutable(), h = Mu.Mutable(), y = 0, x = t.unitSymmetryGroups.length, T.label = 1;
        case 1:
          return y < x ? (S = t.unitSymmetryGroups[y], e.runtime.shouldUpdate ? [4, e.runtime.update({ message: "computing interactions", current: y, max: x })] : [3, 3]) : [3, 5];
        case 2:
          T.sent(), T.label = 3;
        case 3:
          for (b = a && a[y] ? a[y] : LR(t, S.units[0], m), _ = function(P, k, D, B, L, F) {
            var V = G_.create(D, k.elements.length);
            return ve.isAtomic(k) && function(G, H, q, z, K, Y, Z) {
              for (var X = 0, W = K; X < W.length; X++) _ne(G, H, q, z, W[X], 0, Z);
            }(P, k, D, V, B, 0, F), V.getContacts();
          }(t, S.units[0], b, p, r.contacts, function(P, k, D, B) {
            return !!(!o || s.has("".concat(P.invariantId, "_").concat(k)) && s.has("".concat(D.invariantId, "_").concat(B))) && i !== Yr.IntraReceptor && (i === Yr.All || ["".concat(P.invariantId, "_").concat(k), "".concat(D.invariantId, "_").concat(B)].filter(function(L) {
              return f.has(L);
            }).length === (i === Yr.LigandReceptor ? 1 : 2));
          }), C = 0, w = S.units.length; C < w; ++C) I = S.units[C], v.set(I.id, b), h.set(I.id, _);
          T.label = 4;
        case 4:
          return ++y, [3, 1];
        case 5:
          return M = function(P, k, D, B, L) {
            var F = z_.create();
            return ze.eachUnitPair(P, function(V, G) {
              var H = k.get(V.id), q = k.get(G.id);
              (function(z, K, Y, Z, X, W, J, $, ee) {
                var ce = Y.count, ae = Y.x, he = Y.y, Oe = Y.z, Ne = X.lookup3d, Ue = ne.mul(xne, Z.conformation.operator.inverse, K.conformation.operator.matrix), Ze = !ne.isIdentity(Ue), Se = A(), qe = Math.max.apply(Math, J.map(function(tn) {
                  return tn.maxDistance;
                })), Pe = Ne.boundary.sphere, Xe = Pe.center, Ke = Pe.radius, de = (Ke + qe) * (Ke + qe), we = $.lineOfSightDistFactor, Ie = Gn.Info(z, K, Y), Ee = Gn.Info(z, Z, X);
                W.startUnitPair(K, Z);
                for (var Le = 0; Le < ce; ++Le) if (A.set(Se, ae[Le], he[Le], Oe[Le]), Ze && A.transformMat4(Se, Se, Ue), !(A.squaredDistance(Se, Xe) > de)) {
                  var De = Ne.find(Se[0], Se[1], Se[2], qe), rt = De.indices, st = De.count, gt = De.squaredDistances;
                  if (st !== 0) {
                    Ie.feature = Le;
                    for (var ft = 0; ft < st; ++ft) {
                      var yt = rt[ft];
                      if (Ee.feature = yt, (!ee || ee(Ie.unit, Ie.unit.elements[Ie.members[Ie.offsets[Le]]], Ee.unit, Ee.unit.elements[Ee.members[Ee.offsets[yt]]])) && TR(z, Ie, Ee)) for (var It = gt[ft], ge = 0, Je = J; ge < Je.length; ge++) {
                        var Mt = Je[ge];
                        if (It < Mt.maxDistance * Mt.maxDistance) {
                          var wn = Mt.getType(z, Ie, Ee, It);
                          if (wn && bne(z, Ie, Ee, we)) {
                            W.add(Le, yt, wn);
                            break;
                          }
                        }
                      }
                    }
                  }
                }
                W.finishUnitPair();
              })(P, V, H, G, q, F, D, B, L == null ? void 0 : L.elementIdFilter);
            }, { maxRadius: Math.max.apply(Math, D.map(function(V) {
              return V.maxDistance;
            })), validUnit: function(V) {
              return ve.isAtomic(V);
            }, validUnitPair: function(V, G) {
              return ze.validUnitPair(P, V, G) && (!(L != null && L.unitFilter) || L.unitFilter(V, G));
            } }), F.getContacts(k);
          }(t, v, p, r.contacts, { unitFilter: function(P, k) {
            return i === Yr.LigandReceptor ? [P.invariantId, k.invariantId].filter(function(D) {
              return d.has(D);
            }).length >= 1 : i !== Yr.IntraLigand || [P.invariantId, k.invariantId].filter(function(D) {
              return d.has(D);
            }).length === 2;
          }, elementIdFilter: function(P, k, D, B) {
            return !!(!o || s.has("".concat(P.invariantId, "_").concat(k)) && s.has("".concat(D.invariantId, "_").concat(B))) && (i === Yr.All || ["".concat(P.invariantId, "_").concat(k), "".concat(D.invariantId, "_").concat(B)].filter(function(L) {
              return f.has(L);
            }).length === (i === Yr.LigandReceptor ? 1 : i === Yr.IntraReceptor ? 0 : 2));
          } }), function(P, k) {
            for (var D = k.contacts, B = k.unitsContacts, L = k.unitsFeatures, F = [wne(0, k), Ine(0, k), Pne(0, k), Mne(0, k), Ene(0, k)], V = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), q = 0, z = D.edgeCount; q < z; ++q) {
              var K = D.edges[q], Y = P.unitMap.get(K.unitA), Z = P.unitMap.get(K.unitB);
              if ((Se = Gn.Info(P, Y, L.get(K.unitA))).feature = K.indexA, (qe = Gn.Info(P, Z, L.get(K.unitB))).feature = K.indexB, K.props.type === 5) {
                for (var X = [], W = (Ke = Se.types[Se.feature] === 5 ? Se : qe).offsets[Ke.feature], J = Ke.offsets[Ke.feature + 1]; W < J; W++) X.push(Ke.members[W]);
                X.length > 1 && G.set(q, X), X.length === 1 && V.add(X[0]);
              }
              if (B.size) for (var $ = 0, ee = F; $ < ee.length; $++) (Ie = ee[$]).isApplicable(K.props.type) && Ie.handleInterContact(q, Se, qe);
            }
            for (var ce = B.keys(); ; ) {
              var ae = ce.next(), he = ae.done, Oe = ae.value;
              if (he) break;
              var Ne = B.get(Oe), Ue = L.get(Oe), Ze = P.unitMap.get(Oe);
              if (ve.isAtomic(Ze)) {
                for (var Se = Gn.Info(P, Ze, Ue), qe = Gn.Info(P, Ze, Ue), Pe = 0, Xe = F; Pe < Xe.length; Pe++) (Ie = Xe[Pe]).startUnit(Ze, Ne, Ue);
                for (q = 0, z = 2 * Ne.edgeCount; q < z; ++q) {
                  if (Se.feature = Ne.a[q], qe.feature = Ne.b[q], Ne.edgeProps.type[q] === 5) {
                    var Ke;
                    for (X = [], W = (Ke = Se.types[Se.feature] === 5 ? Se : qe).offsets[Ke.feature], J = Ke.offsets[Ke.feature + 1]; W < J; W++) X.push(Ke.members[W]);
                    X.length > 1 && H.set(q, { elements: X, value: Oe }), X.length === 1 && V.add(X[0]);
                  }
                  for (var de = 0, we = F; de < we.length; de++) {
                    var Ie;
                    (Ie = we[de]).isApplicable(Ne.edgeProps.type[q]) && Ie.handleIntraContact(q, Se, qe);
                  }
                }
              }
            }
            G.forEach(function(Ee, Le) {
              Ee.filter(function(De) {
                return V.has(De);
              }).length > 0 && (D.edges[Le].props.flag = Oa.Filtered);
            }), H.forEach(function(Ee, Le) {
              var De = Ee.elements, rt = Ee.value;
              De.filter(function(st) {
                return V.has(st);
              }).length > 0 && (B.get(rt).edgeProps.flag[Le] = Oa.Filtered);
            });
          }(t, E = { unitsFeatures: v, unitsContacts: h, contacts: M }), [2, E];
      }
    });
  });
}
function LR(e, t, n) {
  var r = t.elements.length, i = s_.create(r, r / 2);
  if (ve.isAtomic(t)) for (var a = 0, o = n; a < o.length; a++)
    o[a].add(e, t, i);
  return i.getFeatures(r);
}
var Ab = O({}, RR), Rr = tm.createProvider({ label: "Interactions", descriptor: Us({ name: "molstar_computed_interactions" }), type: "local", defaultParams: Ab, getParams: function(e) {
  return Ab;
}, isApplicable: function(e) {
  return !e.isCoarseGrained;
}, obtain: function(e, t, n) {
  return se(void 0, 0, void 0, function() {
    var r, i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return r = O(O({}, N.getDefaultValues(Ab)), n), i = {}, [4, qne(e, t, r)];
        case 1:
          return [2, (i.value = a.sent(), i)];
      }
    });
  });
} }), U_ = Ae(13421772), la = { HydrogenBond: 16751667, Hydrophobic: 8421504, HalogenBond: 6154474, Ionic: 15820019, MetalCoordination: 11646163, CationPi: 3392621, PiStacking: 4436985, WeakHydrogenBond: 16771231 }, jne = [["Hydrogen Bond", la.HydrogenBond], ["Hydrophobic", la.Hydrophobic], ["Halogen Bond", la.HalogenBond], ["Ionic", la.Ionic], ["Metal Coordination", la.MetalCoordination], ["Cation Pi", la.CationPi], ["Pi Stacking", la.PiStacking], ["Weak HydrogenBond", la.WeakHydrogenBond]];
function TI(e) {
  switch (e) {
    case hn.HydrogenBond:
      return la.HydrogenBond;
    case hn.Hydrophobic:
      return la.Hydrophobic;
    case hn.HalogenBond:
      return la.HalogenBond;
    case hn.Ionic:
      return la.Ionic;
    case hn.MetalCoordination:
      return la.MetalCoordination;
    case hn.CationPi:
      return la.CationPi;
    case hn.PiStacking:
      return la.PiStacking;
    case hn.WeakHydrogenBond:
      return la.WeakHydrogenBond;
    case hn.Unknown:
      return U_;
  }
}
var kI = {}, Cp, Sc, Sp, Vd, X2, Kne = { name: "interaction-type", label: "Interaction Type", category: "Miscellaneous", factory: function e(t, n) {
  var r, i = t.structure ? Rr.get(t.structure) : void 0, a = i ? Bm(i.id, i.version) : -1;
  return r = i && i.value ? function(o) {
    if (Vl.isLocation(o)) {
      var s = o.data.interactions, u = s.unitsContacts, l = s.contacts, c = o.element, d = c.unitA, f = c.unitB, p = c.indexA, g = c.indexB;
      if (d === f) {
        var m = u.get(d.id), v = m.getDirectedEdgeIndex(p, g);
        return TI(m.edgeProps.type[v]);
      }
      return v = l.getEdgeIndex(p, d.id, g, f.id), TI(l.edges[v].props.type);
    }
    return U_;
  } : function() {
    return U_;
  }, { factory: e, granularity: "group", color: r, props: n, contextHash: a, description: "Assigns colors according the interaction type of a link.", legend: Ws(jne) };
}, getParams: function(e) {
  return kI;
}, defaultValues: N.getDefaultValues(kI), isApplicable: function(e) {
  return !!e.structure;
}, ensureCustomProperties: { attach: function(e, t) {
  return t.structure ? Rr.attach(e, t.structure, void 0, !0) : Promise.resolve();
}, detach: function(e) {
  return e.structure && Rr.ref(e.structure, !1);
} } }, H_ = { color: (Cp = {}, Cp[dt.ATOM] = { name: "element-symbol", props: { carbonColor: { name: "uniform", params: { value: Ae(14474728) } } } }, Cp[dt.RIBBON] = { name: "uniform", props: { value: Ae(14474728) } }, Cp[dt.SURFACE] = { name: "uniform" }, Cp), size: (Sc = {}, Sc[fe.BallAndStick] = { name: "physical" }, Sc[fe.Stick] = { name: "uniform" }, Sc[fe.Line] = { name: "physical" }, Sc[fe.CPK] = { name: "physical" }, Sc[fe.Ribbon] = { name: "uniform" }, Sc[fe.Surface] = { name: "physical" }, Sc), transparency: (Sp = {}, Sp[dt.ATOM] = 0, Sp[dt.RIBBON] = 0, Sp[dt.SURFACE] = 0, Sp) }, wb = { name: "element-symbol", props: { carbonColor: { name: "uniform", params: { value: Ae(4777267) } } } }, Yne = function() {
  function e(t, n) {
    this.plugin = t, this.defaultTheme = O(O({}, H_), n);
  }
  return e.prototype.createColorTheme = function(t, n, r) {
    var i, a, o, s, u, l = this;
    return t.name === "multi-theme" ? (i = this.ctx) === null || i === void 0 ? void 0 : i.colorThemeRegistry.create("multi-theme", { structure: n }, { themes: (s = !((o = (a = t.props) === null || a === void 0 ? void 0 : a.themes) === null || o === void 0) && o.length ? t.props.themes : [this.defaultTheme.color[r]]) === null || s === void 0 ? void 0 : s.map(function(c) {
      return { colorTheme: l.createColorTheme(c, c.elementIds ? Fr(n, c.elementIds) : n, r), bundle: Ma.fromLoci(Vr(n, c.elementIds)) };
    }) }) : (u = this.ctx) === null || u === void 0 ? void 0 : u.colorThemeRegistry.create(t.name, { structure: t.elementIds ? Fr(n, t.elementIds) : n }, t.props);
  }, e.prototype.createTheme = function(t, n, r) {
    var i = Object.keys(pr).find(function(s) {
      return pr[s].includes(t);
    }), a = r != null && r.color ? r == null ? void 0 : r.color : this.defaultTheme.color[i], o = r != null && r.size ? r == null ? void 0 : r.size : this.defaultTheme.size[t];
    return { color: this.createColorTheme(a, n, i), size: this.ctx.sizeThemeRegistry.create(o.name, { structure: n }, o.props) };
  }, e.prototype.createTransparencyLayers = function(t, n) {
    if (!(n != null && n.length)) return { kind: "empty-loci", layers: [] };
    var r = n.map(function(i) {
      var a = i.elementIds, o = i.value;
      return { loci: Vr(t, a), value: o !== void 0 ? 1 - o : 0 };
    });
    return { kind: "element-loci", layers: r };
  }, e.prototype.setColorTheme = function(t, n, r) {
    var i = this;
    t.forEach(function(a) {
      var o, s, u, l, c = a.ref, d = a.elementIds, f = i.plugin.cells.get(c);
      if (!(f != null && f.model.structure) && (f != null && f.representations.has(fe.Surface))) {
        if (r !== dt.SURFACE) return;
        var p = ke.toStructure(Yi(f.representations.get(fe.Surface).state.getLoci())), g = vo(p);
        return f.theme.color = ((o = { Atom: [], Ribbon: [] })[dt.SURFACE] = [O({ elementIds: g }, n)], o), void Ag[fe.Surface].update((u = f == null ? void 0 : f.representations.get(fe.Surface)) === null || u === void 0 ? void 0 : u.state, p, i.ctx, i.createTheme(fe.Surface, p, { color: n }));
      }
      var m = Re([], d ?? [], !0);
      d || m.push.apply(m, Ai(ze.toStructureElementLoci(jn(f))));
      var v = new Set(m);
      f && (f.theme.color ? (!((l = f.theme.color[r]) === null || l === void 0) && l.length && (f.theme.color[r].forEach(function(h, y) {
        f.theme.color[r][y].elementIds = f.theme.color[r][y].elementIds.filter(function(x) {
          return !v.has(x);
        });
      }), f.theme.color[r] = f.theme.color[r].filter(function(h) {
        var y = h.elementIds;
        return y == null ? void 0 : y.length;
      })), f.theme.color[r].push(O({ elementIds: Array.from(v.values()) }, n))) : f.theme.color = ((s = { Atom: [], Ribbon: [], Surface: [] })[r] = [O({ elementIds: Array.from(v.values()) }, n)], s), pr[r].forEach(function(h) {
        var y, x = f.representations.get(h);
        if (x) {
          var S = qa(x.state);
          es[h].update(x.state, S, i.ctx, { color: i.ctx.colorThemeRegistry.create("multi-theme", { structure: S }, { themes: (y = f.theme.color[r]) === null || y === void 0 ? void 0 : y.map(function(b) {
            return { colorTheme: i.createColorTheme(b, S, r), bundle: Ma.fromLoci(Vr(S, b.elementIds)) };
          }) }), size: x.state.theme.size });
        }
      }));
    }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: setColorTheme" });
  }, e.prototype.setTransparency = function(t, n, r) {
    var i = this, a = /* @__PURE__ */ new Set();
    t.forEach(function(s) {
      var u, l, c, d, f = s.ref, p = s.elementIds, g = i.plugin.cells.get(f);
      if (!(g != null && g.model.structure) && (g != null && g.representations.has(fe.Surface))) {
        if (r !== dt.SURFACE) return;
        var m = ke.toStructure(Yi(g.representations.get(fe.Surface).state.getLoci())), v = vo(m);
        return g.theme.transparency = ((u = {})[dt.SURFACE] = [{ elementIds: v, value: n }], u), void ((c = g == null ? void 0 : g.representations.get(fe.Surface)) === null || c === void 0 || c.state.setState({ transparency: i.createTransparencyLayers(qa((d = g == null ? void 0 : g.representations.get(fe.Surface)) === null || d === void 0 ? void 0 : d.state), g == null ? void 0 : g.theme.transparency[r]) }));
      }
      var h = Re([], p ?? [], !0);
      !p && g && (m = jn(g)) && h.push.apply(h, Ai(ze.toStructureElementLoci(m)));
      var y = new Set(h);
      if (g) if (a.add(f), g.theme.transparency) {
        var x = g.theme.transparency[r];
        x.length && (x.forEach(function(S, b) {
          S.elementIds, x[b].elementIds = h.filter(function(_) {
            return !y.has(_);
          });
        }), g.theme.transparency[r] = x.filter(function(S) {
          return S.elementIds, h.length;
        })), g.theme.transparency[r].push({ elementIds: Array.from(y.values()), value: n });
      } else g.theme.transparency = ((l = {})[dt.ATOM] = [], l[dt.RIBBON] = [], l[dt.SURFACE] = [], l[r] = { elementIds: Array.from(y.values()), value: n }, l);
    });
    var o = pr[r];
    a.forEach(function(s) {
      var u = i.plugin.cells.get(s);
      o.forEach(function(l) {
        var c = u == null ? void 0 : u.representations.get(l);
        if (c) {
          var d = qa(c.state), f = i.createTransparencyLayers(d, u == null ? void 0 : u.theme.transparency[r]);
          c.state.setState({ transparency: f });
        }
      });
    }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: setColorTheme" });
  }, e.prototype.setDefaultTheme = function(t) {
    var n;
    this.defaultTheme = O(O(O({}, H_), (n = this.defaultTheme) !== null && n !== void 0 ? n : {}), t);
  }, e;
}(), Ap = [fe.BallAndStick, fe.Line, fe.Stick, fe.CPK], Wne = function(e) {
  function t(n, r, i) {
    var a = e.call(this, n, r) || this;
    return a.ev = Da.create(), a.event = { interactionParamsUpdated: a.ev(), interactionUpdated: a.ev() }, a.plugin = n, a.type = Yr.LigandReceptor, a.interactionParams = O(O({}, i), d_()), a;
  }
  return Zi(t, e), t.prototype.showInteractionInCellItems = function(n, r, i, a) {
    var o;
    return se(this, 0, void 0, function() {
      var s, u, l, c, d, f, p = this;
      return ie(this, function(g) {
        switch (g.label) {
          case 0:
            return s = /* @__PURE__ */ new Map(), a && Array.from(n.map(function(m) {
              return m.ref;
            })).forEach(function(m) {
              var v = p.plugin.cells.get(m);
              if (v) {
                var h = [];
                pr[dt.ATOM].forEach(function(y) {
                  v.representations.has(y) && v.representations.get(y).state && h.push.apply(h, Ai(Yi(v.representations.get(y).state.getLoci())));
                }), s.set(m, new Set(h));
              }
            }), u = a ? n.map(function(m) {
              var v, h, y = m.ref, x = m.elementIds, S = x ? x.filter(function(b) {
                var _;
                return (_ = s.get(y)) === null || _ === void 0 ? void 0 : _.has(b);
              }) : Array.from((h = (v = s.get(y)) === null || v === void 0 ? void 0 : v.values()) !== null && h !== void 0 ? h : []);
              return { ref: y, elementIds: S };
            }).filter(function(m) {
              return m.elementIds.length;
            }) : n, [4, Sb.createOrUpdateInCellItems(u, this.plugin, r, this.interactionParams, i)];
          case 1:
            return l = g.sent(), c = l.representation, d = l.ref, f = { representations: [{ state: c, isHidden: !1, type: fe.IntraInteractions }], model: { other: null }, dependency: { on: n } }, (o = this.plugin.canvas3d) === null || o === void 0 || o.add(c), d ? (this.plugin.managers.cell.update(d, f), [2, d]) : [2, this.plugin.managers.cell.create(f)];
        }
      });
    });
  }, t.prototype.showInteractionBetweenCellItems = function(n, r, i, a) {
    var o;
    return a === void 0 && (a = !1), se(this, 0, void 0, function() {
      var s, u, l, c, d, f, p, g = this;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            return s = /* @__PURE__ */ new Map(), a && Array.from(Re(Re([], n, !0), r, !0).map(function(v) {
              return v.ref;
            })).forEach(function(v) {
              var h = g.plugin.cells.get(v);
              if (h) {
                var y = [];
                pr[dt.ATOM].forEach(function(x) {
                  h.representations.has(x) && h.representations.get(x).state && y.push.apply(y, Ai(Yi(h.representations.get(x).state.getLoci())));
                }), s.set(v, new Set(y));
              }
            }), u = a ? n.map(function(v) {
              var h, y, x = v.ref, S = v.elementIds, b = S ? S.filter(function(_) {
                var C;
                return (C = s.get(x)) === null || C === void 0 ? void 0 : C.has(_);
              }) : Array.from((y = (h = s.get(x)) === null || h === void 0 ? void 0 : h.values()) !== null && y !== void 0 ? y : []);
              return { ref: x, elementIds: b };
            }).filter(function(v) {
              return v.elementIds.length;
            }) : n, l = a ? r.map(function(v) {
              var h, y, x = v.ref, S = v.elementIds, b = S ? S.filter(function(_) {
                var C;
                return (C = s.get(x)) === null || C === void 0 ? void 0 : C.has(_);
              }) : Array.from((y = (h = s.get(x)) === null || h === void 0 ? void 0 : h.values()) !== null && y !== void 0 ? y : []);
              return { ref: x, elementIds: b };
            }).filter(function(v) {
              return v.elementIds.length;
            }) : r, [4, Sb.createOrUpdateBetweenCellItems(u, l, this.plugin, this.interactionParams, i)];
          case 1:
            return c = m.sent(), d = c.representation, f = c.ref, d ? (p = { representations: [{ state: d, isHidden: !1, type: fe.BetweenInteractions }], model: { other: { itemsA: u, itemsB: l } }, dependency: { on: u.concat(l) } }, (o = this.plugin.canvas3d) === null || o === void 0 || o.add(d), f ? (this.plugin.managers.cell.update(f, p), [2]) : [2, this.plugin.managers.cell.create(p)]) : [2];
        }
      });
    });
  }, t.prototype.setInteractionParams = function(n, r) {
    var i = this, a = new Set(Object.keys(this.interactionParams).filter(function(s) {
      var u;
      return ((u = i.interactionParams[s]) === null || u === void 0 ? void 0 : u.name) === "on";
    }));
    if (this.type === r && n.length === a.size && n.every(function(s) {
      return a.has(s);
    })) return !1;
    this.type = r, this.interactionParams = d_(n);
    var o = !1;
    return this.plugin.managers.cell.traverse(function(s, u) {
      u.type === fe.IntraInteractions && (o = !0, i.showGlobalInteraction(void 0, "lightPlugin.managers.representation.interactions.setInteractionParams"));
    }), this.event.interactionParamsUpdated.next({ params: this.interactionParams, type: r }), o;
  }, t.prototype.showGlobalInteraction = function(n, r) {
    var i;
    return se(this, 0, void 0, function() {
      var a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S = this;
      return ie(this, function(b) {
        switch (b.label) {
          case 0:
            return a = /* @__PURE__ */ new Map(), o = qO(this.plugin), n && Array.from(o.map(function(_) {
              return _.ref;
            })).forEach(function(_) {
              var C = S.plugin.cells.get(_);
              if (C) {
                var w = [];
                pr[dt.ATOM].forEach(function(I) {
                  C.representations.has(I) && C.representations.get(I).state && w.push.apply(w, Ai(Yi(C.representations.get(I).state.getLoci())));
                }), a.set(_, new Set(w));
              }
            }), s = n ? o.map(function(_) {
              var C, w, I = _.ref, M = _.elementIds, E = M ? M.filter(function(T) {
                var P;
                return (P = a.get(I)) === null || P === void 0 ? void 0 : P.has(T);
              }) : Array.from((w = (C = a.get(I)) === null || C === void 0 ? void 0 : C.values()) !== null && w !== void 0 ? w : []);
              return { ref: I, elementIds: E };
            }).filter(function(_) {
              return _.elementIds.length;
            }) : void 0, [4, Sb.createOrUpdateGlobal(o, this.plugin, this.type, this.interactionParams, void 0, s)];
          case 1:
            if (u = b.sent(), l = u.representation, c = u.ref, d = u.interactionElementIds, f = { representations: [{ state: l, isHidden: !1, type: fe.IntraInteractions }], model: { other: { type: this.type } }, dependency: { on: o } }, (i = this.plugin.canvas3d) === null || i === void 0 || i.add(l), n) return [3, 5];
            p = [], g = {}, d.forEach(function(_) {
              var C, w = _.ref, I = _.elementIds, M = S.plugin.cells.get(w);
              if (M) {
                g[w] = ((C = {})[fe.BallAndStick] = /* @__PURE__ */ new Set(), C[fe.Line] = /* @__PURE__ */ new Set(), C[fe.Stick] = /* @__PURE__ */ new Set(), C[fe.CPK] = /* @__PURE__ */ new Set(), C);
                var E = new Set(I);
                Ap.forEach(function(T) {
                  if (M.representations.has(T) && M.representations.get(T).state) {
                    var P = dh(M.representations.get(T).state);
                    g[w][T] = new Set(P), E.forEach(function(k) {
                      g[w][T].has(k) && E.delete(k);
                    });
                  }
                }), E.size && p.push({ ref: w, elementIds: Array.from(E.values()) });
              }
            }), (x = {})[fe.BallAndStick] = [], x[fe.Line] = [], x[fe.Stick] = [], x[fe.CPK] = [], m = x, p.forEach(function(_) {
              var C, w = _.ref, I = _.elementIds, M = ((C = {})[fe.BallAndStick] = [], C[fe.Line] = [], C[fe.Stick] = [], C[fe.CPK] = [], C), E = /* @__PURE__ */ new Map();
              if (I != null && I.length) {
                var T = S.plugin.managers.cell.get(w), P = jn(T);
                if (P) {
                  var k = new Set(I), D = new Set(I.map(function(L) {
                    return Cv(UO(P, L), Dt.Residue);
                  })), B = /* @__PURE__ */ new Map();
                  P.units.forEach(function(L) {
                    L.elements.forEach(function(F) {
                      var V = Ou(L, F), G = Cv(V, Dt.Residue);
                      D.has(G) && (E.has(G) || E.set(G, /* @__PURE__ */ new Set()), (k.has(F) || V.typeSymbol !== "H" || S3(P, F) === ti.Polar) && B.set(G, Re([F], B.has(G) ? B.get(G) : [], !0)), Ap.some(function(H) {
                        var q, z;
                        !((q = g[w][H]) === null || q === void 0) && q.has(F) && ((z = E.get(G)) === null || z === void 0 || z.add(H));
                      }));
                    });
                  }), D.forEach(function(L) {
                    var F, V, G = E.get(L);
                    G && G.size !== 0 ? G.size > 0 && (V = M[Array.from(G.values())[0]]).push.apply(V, B.get(L)) : (F = M[fe.Stick]).push.apply(F, B.get(L));
                  }), Ap.forEach(function(L) {
                    M[L].length && m[L].push({ ref: w, elementIds: M[L] });
                  });
                }
              }
            }), v = 0, h = Ap.length, b.label = 2;
          case 2:
            return v < h ? (y = Ap[v], m[y].length ? [4, this.plugin.managers.representation.setMolecularRepr(m[y], y, !0, !1)] : [3, 4]) : [3, 5];
          case 3:
            b.sent(), b.label = 4;
          case 4:
            return v++, [3, 2];
          case 5:
            return c ? (this.plugin.managers.cell.update(c, f), this.event.interactionUpdated.next({ from: r }), [2, d]) : (this.event.interactionUpdated.next({ from: r }), [4, this.plugin.managers.cell.create(f)]);
          case 6:
            return b.sent(), [2, d];
        }
      });
    });
  }, t;
}(Yne), NR = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, TO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, kO(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, Xne = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, C8(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, hd(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, Zne = function(e, t) {
  return se(void 0, 0, void 0, function() {
    var n, r, i;
    return ie(this, function(a) {
      switch (a.label) {
        case 0:
          return [4, C8(e).run()];
        case 1:
          if ((n = a.sent()).isError) throw n;
          return r = n.result, t && (o = t[0], r.molecules[0], s = o.graph.graphs, u = s.nodes, l = s.adjacency, c = [], d = [], u.forEach(function(f, p) {
            l[p].forEach(function(g) {
              g.to_jimage.some(function(m) {
                return m !== 0;
              }) || (c.push(f.id), d.push(g.id));
            });
          }), i = { count: c.length, atomA: c, atomB: d }, r.molecules[0] = O(O({}, r.molecules[0]), { bonds: i })), [4, hd(r).run()];
        case 2:
          return [2, a.sent()];
      }
      var o, s, u, l, c, d;
    });
  });
}, Qne = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, IO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, PO(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, Jne = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, RO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw t;
          return [4, LO(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, $ne = { parse: function(e) {
  return se(this, 0, void 0, function() {
    return ie(this, function(t) {
      switch (t.label) {
        case 0:
          return [4, hd(NO(e)).run()];
        case 1:
          return [2, t.sent()];
      }
    });
  });
} }, ere = { parse: function(e) {
  return se(this, 0, void 0, function() {
    var t;
    return ie(this, function(n) {
      switch (n.label) {
        case 0:
          return [4, FO(e).run()];
        case 1:
          if ((t = n.sent()).isError) throw new Error(t.message);
          return [4, hd(t.result).run()];
        case 2:
          return [2, n.sent()];
      }
    });
  });
} }, q_ = ((Vd = {})[pn.Dump] = Xne, Vd[pn.Gro] = NR, Vd[pn.Pdb] = Qne, Vd[pn.Xyz] = Jne, Vd[pn.Material] = $ne, Vd[pn.Pymatgen] = ere, Vd), DI = function(e) {
  function t(n, r, i) {
    var a = e.call(this, n, r) || this;
    return a.defaultTheme = O(O({}, H_), r), a.plugin = n, a.interactionParams = O(O({}, i), d_()), a.showPolarHydrogenOnly = !0, a.ctx = { webgl: void 0, colorThemeRegistry: Ll.createRegistry(), sizeThemeRegistry: Ea.createRegistry(), props: { hideBond: !1 } }, a;
  }
  return Zi(t, e), Object.defineProperty(t.prototype, "hideBond", { get: function() {
    var n, r;
    return (r = (n = this.ctx) === null || n === void 0 ? void 0 : n.props.hideBond) !== null && r !== void 0 && r;
  }, set: function(n) {
    this.ctx.props.hideBond !== n && (this.ctx.props.hideBond = n, this.plugin.managers.cell.traverse(function(r, i) {
      var a, o, s, u, l;
      if (pZ.has(i.type)) {
        var c = n ? (s = (o = (a = i.state) === null || a === void 0 ? void 0 : a.props) === null || o === void 0 ? void 0 : o.visuals) === null || s === void 0 ? void 0 : s.filter(function(d) {
          return d !== "intra-bond" && d !== "inter-bond";
        }) : Array.from(new Set(Re(Re([], (l = (u = i.state) === null || u === void 0 ? void 0 : u.props) === null || l === void 0 ? void 0 : l.visuals, !0), ["inter-bond", "intra-bond"], !1)));
        i.state.createOrUpdate({ visuals: c }, qa(i.state)).run();
      }
    }));
  }, enumerable: !1, configurable: !0 }), t.prototype.createContext = function() {
    this.ctx = { webgl: this.plugin.canvas3d.webgl, colorThemeRegistry: Ll.createRegistry(), sizeThemeRegistry: Ea.createRegistry(), props: { hideBond: !1 } }, this.ctx.colorThemeRegistry.add(Kne);
  }, t.prototype.createMolecular = function(n) {
    var r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I;
    return se(this, 0, void 0, function() {
      var M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W, J, $, ee, ce, ae, he, Oe, Ne, Ue = this;
      return ie(this, function(Ze) {
        switch (Ze.label) {
          case 0:
            M = n.format, E = n.reprType, T = n.theme, P = T === void 0 ? {} : T, k = n.elementIds, D = n.ref, B = n.defaultShown, L = n.updateInteraction, F = L === void 0 || L, V = n.autoConvertToTrajectory, G = V !== void 0 && V, Ze.label = 1;
          case 1:
            return Ze.trys.push([1, 12, , 13]), (H = typeof n.data == "string" || n.data instanceof File) ? [4, ff(n.data)] : [3, 3];
          case 2:
            return z = Ze.sent(), [3, 4];
          case 3:
            z = n.data, Ze.label = 4;
          case 4:
            return q = z, [4, Nl[M].parse(q)];
          case 5:
            return (K = Ze.sent()).length > 1 && G && q_[M] ? [4, this.plugin.managers.trajectory.importTrajectory({ data: q, format: M })] : [3, 7];
          case 6:
            return [2, (Y = Ze.sent()) ? [Y] : []];
          case 7:
            Z = n.data instanceof File ? n.data.name : "", X = B ?? K.length, W = Object.keys(pr).find(function(Se) {
              return pr[Se].includes(E);
            }), J = [], $ = 0, ee = function(Se) {
              var qe, Pe, Xe, Ke, de, we, Ie, Ee, Le, De, rt, st, gt, ft, yt, It, ge, Je, Mt, wn;
              return ie(this, function(tn) {
                switch (tn.label) {
                  case 0:
                    return qe = Re([], k ?? [], !0), Pe = Se, ce.showPolarHydrogenOnly && A1.has(E) && (qe = (k ?? vo(Se)).filter(function(Te) {
                      return !up(Se, Te);
                    }), Pe = Fr(Se, qe)), Xe = !X, Ke = M === pn.Material || ((r = C3(Se, M)) !== null && r !== void 0 ? r : H) ? q : eJ(Se, M), de = { representations: [{ isHidden: Xe, type: E }], model: {}, assets: [{ format: M, data: ["sdf", "mol"].includes(M) && Z && !(Ke != null && Ke.split(`
`)[0].trim()) ? Re(["".concat(Z).concat($ > 0 ? "_".concat($) : "")], Ke.split(`
`).slice(1), !0).join(`
`) : Ke }], theme: { color: (gt = {}, gt[W] = [O({ elementIds: k ?? Ai(ze.toStructureElementLoci(Se)) }, (a = (i = P[W]) === null || i === void 0 ? void 0 : i.color) !== null && a !== void 0 ? a : W === dt.ATOM ? wb : ce.defaultTheme.color[W])], gt), transparency: (ft = {}, ft[dt.ATOM] = [], ft[dt.RIBBON] = [], ft[dt.SURFACE] = [], ft[W] = !((o = P[W]) === null || o === void 0) && o.transparency ? [(s = P[W]) === null || s === void 0 ? void 0 : s.transparency] : [], ft), size: (yt = {}, yt[dt.ATOM] = [], yt[dt.RIBBON] = [], yt[dt.SURFACE] = [], yt[W] = !((u = P[W]) === null || u === void 0) && u.size ? [(l = P[W]) === null || l === void 0 ? void 0 : l.size] : [], yt) }, ref: D }, $++, Xe ? [3, 2] : [4, es[E].create(Pe, ce.ctx, ce.createTheme(E, Se, O(O({}, P[W]), W !== dt.ATOM || !((c = P[W]) === null || c === void 0) && c.color ? {} : { color: wb })))];
                  case 1:
                    return we = tn.sent(), !((d = P[W]) === null || d === void 0) && d.transparency && we.setState({ transparency: ce.createTransparencyLayers(Se, [(f = P[W]) === null || f === void 0 ? void 0 : f.transparency]) }), X--, (p = ce.plugin.canvas3d) === null || p === void 0 || p.add(we), Object.assign(de.representations[0], { state: we }), [3, 3];
                  case 2:
                    Object.assign(de.representations[0], { cache: { isHidden: Xe, type: E, elementIds: qe } }), tn.label = 3;
                  case 3:
                    return Ie = ce.plugin.managers.cell.create(de), J.push(Ie), M !== pn.Pdb || k != null && k.length ? [3, 7] : (Ee = __(Se), Le = Ee.polymer, (De = Ee.other).length ? Xe ? [3, 6] : (rt = Fr(Se, Le), [4, es[fe.Ribbon].update(de.representations[0].state, Fr(Se, Le), ce.ctx, ce.createTheme(fe.Ribbon, rt, P[dt.RIBBON]))]) : [3, 7]);
                  case 4:
                    return tn.sent(), st = Fr(Se, De), ce.plugin.managers.cell.update(Ie, { representations: [], model: { structure: Se }, theme: { color: (It = {}, It[dt.ATOM] = [O({ elementIds: De ?? Ai(ze.toStructureElementLoci(Se)) }, (m = (g = P[dt.ATOM]) === null || g === void 0 ? void 0 : g.color) !== null && m !== void 0 ? m : { name: "element-symbol", props: { carbonColor: { name: "uniform", params: { value: Ae(4777267) } } } })], It), transparency: (ge = {}, ge[dt.ATOM] = !((v = P[dt.ATOM]) === null || v === void 0) && v.transparency ? [(h = P[dt.ATOM]) === null || h === void 0 ? void 0 : h.transparency] : [], ge), size: (Je = {}, Je[dt.ATOM] = [], Je[dt.RIBBON] = [], Je[dt.SURFACE] = [], Je[W] = !((y = P[dt.ATOM]) === null || y === void 0) && y.size ? [(x = P[dt.ATOM]) === null || x === void 0 ? void 0 : x.size] : [], Je) } }), [4, ce.addMolecularRepr(Ie, { elementIds: De, reprType: fe.BallAndStick, isHidden: Xe, theme: ce.createTheme(fe.BallAndStick, st, O({ color: O({ elementIds: De }, wb) }, P[dt.ATOM])), transparency: !((S = P[dt.ATOM]) === null || S === void 0) && S.transparency ? [(b = P[dt.ATOM]) === null || b === void 0 ? void 0 : b.transparency] : void 0 })];
                  case 5:
                    return tn.sent(), [3, 7];
                  case 6:
                    ce.plugin.managers.cell.update(Ie, { representations: [O(O({}, de.representations[0]), { cache: O(O({}, de.representations[0].cache), { elementIds: Le }) }), { isHidden: Xe, type: fe.BallAndStick, cache: { isHidden: Xe, type: fe.BallAndStick, elementIds: De } }], model: {}, theme: { color: (Mt = {}, Mt[dt.ATOM] = [O({ elementIds: De ?? Ai(ze.toStructureElementLoci(Se)) }, (C = (_ = P[dt.ATOM]) === null || _ === void 0 ? void 0 : _.color) !== null && C !== void 0 ? C : { name: "element-symbol", props: { carbonColor: { name: "uniform", params: { value: Ae(4777267) } } } })], Mt), transparency: (wn = {}, wn[dt.ATOM] = !((w = P[dt.ATOM]) === null || w === void 0) && w.transparency ? [(I = P[dt.ATOM]) === null || I === void 0 ? void 0 : I.transparency] : [], wn) } }), tn.label = 7;
                  case 7:
                    return Xe || ce.plugin.managers.cell.update(Ie, { model: { structure: Se } }), F && ce.plugin.managers.cell.traverse(function(Te, At) {
                      At.type === fe.IntraInteractions && Ue.plugin.managers.representation.showGlobalInteraction(void 0, "lightPlugin.managers.representation.createMolecular");
                    }), ce.plugin.managers.snapshot.event.changed.next({ from: "repr: createMolecular" }), [2];
                }
              });
            }, ce = this, ae = 0, he = K, Ze.label = 8;
          case 8:
            return ae < he.length ? (Oe = he[ae], [5, ee(Oe)]) : [3, 11];
          case 9:
            Ze.sent(), Ze.label = 10;
          case 10:
            return ae++, [3, 8];
          case 11:
            return [2, J];
          case 12:
            return Ne = Ze.sent(), console.log(Ne), [2, []];
          case 13:
            return [2];
        }
      });
    });
  }, t.prototype.updateMolecular = function(n) {
    var r;
    return se(this, 0, void 0, function() {
      var i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M = this;
      return ie(this, function(E) {
        for (i = n.ref, a = n.structure, o = this.plugin.managers.cell.get(i), s = ke.toExpression(ze.toStructureElementLoci(o.model.structure)), u = ke.toExpression(ze.toStructureElementLoci(a)), l = Ct.struct.modifier.exceptBy({ 0: u, by: s }), (c = vo(gm(hm(a, l)))).length && (((d = o.theme.color[dt.ATOM]) == null ? void 0 : d.length) === 1 ? d[0].elementIds ? (w = d[0].elementIds).push.apply(w, c) : d[0].elementIds = Re([], c, !0) : d == null || d.push(O({ elementIds: c }, this.defaultTheme.color[dt.ATOM])), this.plugin.managers.cell.update(i, { representations: [], model: {}, theme: { color: (I = {}, I[dt.ATOM] = d, I) } })), (f = [fe.BallAndStick, fe.Stick, fe.Line, fe.CPK]).forEach(function(T) {
          !p && o.representations.has(T) && (p = T);
        }), g = function(T) {
          var P = T[0], k = T[1], D = Object.keys(pr).find(function(G) {
            return pr[G].includes(P);
          }), B = o.theme.color[D], L = k.state.getLoci(), F = ke.toExpression(ze.toStructureElementLoci(L.structure));
          f.includes(P) && P !== p || (F = Ct.struct.modifier.union([Ct.struct.combinator.merge([l, F])]));
          var V = gm(hm(a, F));
          es[P].update(k.state, V, m.ctx, m.createTheme(P, a, { color: { name: "multi-theme", props: { themes: B } }, size: o.theme.size && (!((r = o.theme.size[D]) === null || r === void 0) && r.length) ? o.theme.size[D][0] : m.defaultTheme.size[P] })), k.state.setState({ transparency: m.createTransparencyLayers(V, o == null ? void 0 : o.theme.transparency[D]) });
        }, m = this, v = 0, h = Array.from(o.representations); v < h.length; v++) y = h[v], g(y);
        for (x = function(T) {
          var P = S.plugin.cells.get(T);
          P && P.representations.forEach(function(k, D) {
            D === fe.IntraInteractions && M.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.representation.updateMolecular"), Object.keys(Kp).includes(D) && M.plugin.managers.representation.updateMeasurement({ items: P.dependency.on, ref: T });
          });
        }, S = this, b = 0, _ = o.dependency.by; b < _.length; b++) C = _[b], x(C);
        return this.plugin.managers.snapshot.event.changed.next({ from: "repr: updateMolecular" }), [2, o];
      });
    });
  }, t.prototype.createMeasurement = function(n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f, p, g;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            if (r = n.type, i = n.theme, a = n.items, o = n.ref, s = n.isHidden, !pm.has(r)) return console.warn("There is no ".concat(r, " type ")), [2, ""];
            u = [], l = 0, c = a, m.label = 1;
          case 1:
            return l < c.length ? (d = c[l], [4, this.plugin.managers.cell.getStructure(d.ref)]) : [3, 4];
          case 2:
            if (!(f = m.sent())) return [2, ""];
            u.push(Vr(f, d.elementIds)), m.label = 3;
          case 3:
            return l++, [3, 1];
          case 4:
            return [4, Kp[r].create(u, this.ctx, n.props, i)];
          case 5:
            return p = m.sent(), g = this.plugin.managers.cell.create({ representations: [{ state: p, isHidden: s != null && s, type: r }], model: { loci: u }, dependency: { on: a }, ref: o }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: createMeasurement" }), [2, g];
        }
      });
    });
  }, t.prototype.updateMeasurement = function(n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f = this;
      return ie(this, function(p) {
        switch (p.label) {
          case 0:
            return r = n.items, i = n.ref, a = n.params, o = this.plugin.cells.get(i), s = r.filter(function(g) {
              return jn(f.plugin.cells.get(g.ref));
            }), u = s.map(function(g) {
              return Vr(jn(f.plugin.cells.get(g.ref)), g.elementIds);
            }), o ? (l = Array.from(o.representations)[0], c = l[0], d = l[1], c && d ? d.state ? [4, Kp[c].update(d.state, u, a)] : [3, 2] : (console.error("There is no ".concat(c)), [2, !1])) : (console.warn("There is no ".concat(i)), [2, !1]);
          case 1:
            p.sent(), p.label = 2;
          case 2:
            return this.plugin.managers.cell.update(i, { model: { loci: u } }), [2, !0];
        }
      });
    });
  }, t.prototype.createStaticLabel = function(n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f, p;
      return ie(this, function(g) {
        switch (g.label) {
          case 0:
            r = n.theme, i = n.items, a = n.ref, o = n.isHidden, s = [], u = 0, l = i, g.label = 1;
          case 1:
            return u < l.length ? (c = l[u], [4, this.plugin.managers.cell.getStructure(c.item.ref)]) : [3, 4];
          case 2:
            if (!(d = g.sent())) return [2, ""];
            s.push({ loci: Vr(d, c.item.elementIds), label: c.label }), g.label = 3;
          case 3:
            return u++, [3, 1];
          case 4:
            return [4, Kp[fe.Label].create(s, this.ctx, n.props, r)];
          case 5:
            return f = g.sent(), p = this.plugin.managers.cell.create({ representations: [{ state: f, isHidden: o != null && o, type: fe.Label }], model: { loci: s.map(function(m) {
              return m.loci;
            }) }, dependency: { on: i.map(function(m) {
              return m.item;
            }) }, ref: a }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: createMeasurement" }), [2, p];
        }
      });
    });
  }, t.prototype.createOther = function(n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y;
      return ie(this, function(x) {
        switch (x.label) {
          case 0:
            return r = n.type, i = n.theme, a = n.data, o = n.ref, s = n.isHidden, u = s !== void 0 && s, l = n.serverData, c = n.params, Ag[r] ? (d = Ag[r]).parse ? [4, d.parse(a, this.plugin)] : [3, 2] : (console.warn("There is no ".concat(r, " type ")), [2]);
          case 1:
            return p = x.sent(), [3, 3];
          case 2:
            p = a, x.label = 3;
          case 3:
            return f = p, [4, d.create(f, this.ctx, d.createTheme ? d.createTheme(r === fe.IsoSurface ? f : a, this.plugin, i) : void 0, c)];
          case 4:
            return g = x.sent(), r === fe.Surface && (i != null && i.transparency) && g.setState({ transparency: this.createTransparencyLayers(f, [i == null ? void 0 : i.transparency]) }), m = this.plugin.managers.cell.create({ representations: [{ state: g, isHidden: u, type: r }], model: { other: l ? { serverData: l, data: a } : a }, theme: r === fe.Surface ? { color: (v = {}, v[dt.SURFACE] = i != null && i.color ? [i == null ? void 0 : i.color] : [], v), transparency: (h = {}, h[dt.SURFACE] = i != null && i.transparency ? [i == null ? void 0 : i.transparency] : [], h), size: (y = {}, y[dt.SURFACE] = i != null && i.size ? [i == null ? void 0 : i.size] : [], y) } : void 0, ref: o, dependency: r === fe.Surface ? { on: [a] } : r === fe.MappingLine ? { on: a } : void 0 }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: createOther" }), [2, m];
        }
      });
    });
  }, t.prototype.updateOther = function(n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u;
      return ie(this, function(l) {
        switch (l.label) {
          case 0:
            return r = n.data, i = n.ref, (a = this.plugin.cells.get(i)) ? (o = Array.from(a.representations)[0], s = o[0], u = o[1], s && u ? [4, Ag[s].update(u.state, r, this.ctx)] : (console.error("There is no ".concat(s)), [2, !1])) : (console.warn("There is no ".concat(i)), [2, !1]);
          case 1:
            return l.sent(), this.plugin.managers.cell.update(i, { model: { other: r } }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: updateOther" }), [2, !0];
        }
      });
    });
  }, t.prototype.addMolecularRepr = function(n, r) {
    var i;
    return se(this, 0, void 0, function() {
      var a, o, s, u, l, c, d, f, p, g;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            return a = r.elementIds, o = r.reprType, s = r.isHidden, u = r.theme, l = r.transparency, c = this.plugin.managers.cell.get(n), d = jn(c), c && d ? (f = Re([], a ?? [], !0), A1.has(o) && this.showPolarHydrogenOnly && (f = (a || vo(d)).filter(function(v) {
              return !up(d, v);
            })), p = Fr(d, f, !0), [4, es[o].create(p, this.ctx, u)]) : [2];
          case 1:
            return g = m.sent(), l && g.setState({ transparency: this.createTransparencyLayers(p, l) }), s || (i = this.plugin.canvas3d) === null || i === void 0 || i.add(g), c.representations.set(o, { state: g, isHidden: s, type: o }), this.plugin.managers.snapshot.event.changed.next({ from: "repr: addMolecularRepr" }), [2];
        }
      });
    });
  }, t.prototype.checkStructuresDisplayed = function(n, r) {
    var i, a = this.plugin.managers.cell.get(n.ref), o = jn(a), s = new Set(r && !A1.has(r) || !this.showPolarHydrogenOnly ? n.elementIds : ((i = n.elementIds) !== null && i !== void 0 ? i : []).filter(function(u) {
      return !up(o, u);
    }));
    return (r ? [a.representations.get(r)] : Array.from(a.representations.values())).filter(function(u) {
      return (u == null ? void 0 : u.isHidden) !== !0 && (u == null ? void 0 : u.state);
    }).forEach(function(u) {
      var l, c, d;
      if (s.size) {
        var f = Yi(u.state.getLoci());
        f && (!((d = (c = (l = f == null ? void 0 : f.elements) === null || l === void 0 ? void 0 : l[0]) === null || c === void 0 ? void 0 : c.unit) === null || d === void 0) && d.elements) && Ai(f).forEach(function(p) {
          return s.delete(p);
        });
      }
    }), s.size === 0;
  }, t.prototype.setMolecularRepr = function(n, r, i, a, o) {
    var s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C;
    return a === void 0 && (a = !0), o === void 0 && (o = !0), se(this, 0, void 0, function() {
      var w, I, M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W = this;
      return ie(this, function(J) {
        switch (J.label) {
          case 0:
            if (w = /* @__PURE__ */ new Map(), I = n.filter(function($) {
              return jn(W.plugin.managers.cell.get($.ref));
            }), M = !!a && I.every(function($) {
              return W.checkStructuresDisplayed($, r);
            }), E = Object.keys(pr).find(function($) {
              return pr[$].includes(r);
            }), T = [], !M) return [3, 5];
            P = function($) {
              var ee, ce, ae;
              return ie(this, function(he) {
                switch (he.label) {
                  case 0:
                    return w.set($.ref, /* @__PURE__ */ new Set()), ee = k.plugin.managers.cell.get($.ref), ce = ee.representations.get(r), ae = ee.theme.color[E], [4, V_(ce == null ? void 0 : ce.state, (s = $.elementIds) !== null && s !== void 0 ? s : [], r, function(Oe) {
                      var Ne;
                      return W.createTheme(r, Oe, { color: { name: "multi-theme", props: { themes: ae } }, size: ee.theme.size && (!((Ne = ee.theme.size[E]) === null || Ne === void 0) && Ne.length) ? ee.theme.size[E][0] : W.defaultTheme.size[r] });
                    }, function(Oe) {
                      return W.createTransparencyLayers(Oe, ee == null ? void 0 : ee.theme.transparency[E]);
                    })];
                  case 1:
                    return he.sent(), (u = w.get($.ref)) === null || u === void 0 || u.add(r), ee.dependency.by.length && T.push.apply(T, ee.dependency.by), [2];
                }
              });
            }, k = this, D = 0, B = I, J.label = 1;
          case 1:
            return D < B.length ? (H = B[D], [5, P(H)]) : [3, 4];
          case 2:
            J.sent(), J.label = 3;
          case 3:
            return D++, [3, 1];
          case 4:
            return [3, 9];
          case 5:
            L = function($) {
              var ee, ce, ae, he, Oe, Ne, Ue, Ze, Se, qe, Pe, Xe, Ke, de, we, Ie, Ee, Le, De;
              return ie(this, function(rt) {
                switch (rt.label) {
                  case 0:
                    if (w.set($.ref, /* @__PURE__ */ new Set()), ee = F.plugin.managers.cell.get($.ref), ce = ee.representations.get(r), ae = jn(ee), he = ee.theme.color[E], Oe = [], he == null || he.forEach(function(st) {
                      var gt;
                      Oe.push.apply(Oe, (gt = st.elementIds) !== null && gt !== void 0 ? gt : []);
                    }), Ne = new Set(Oe), (Ue = ((l = $.elementIds) !== null && l !== void 0 ? l : []).filter(function(st) {
                      return !Ne.has(st);
                    })).length && (he == null || he.push(O({ elementIds: Ue }, F.defaultTheme.color[E])), ee.theme.color = O(O({}, ee.theme.color), ((De = {})[E] = he, De))), Ze = [], !i) return [3, 4];
                    Se = function(st) {
                      var gt;
                      return ie(this, function(ft) {
                        switch (ft.label) {
                          case 0:
                            return !a && st.type !== fe.Ribbon && r !== fe.Ribbon && (gt = kv(st.state, (c = $.elementIds) !== null && c !== void 0 ? c : [])).length ? ($.elementIds = (d = $.elementIds) === null || d === void 0 ? void 0 : d.filter(function(yt) {
                              return !gt.includes(yt);
                            }), [2, "continue"]) : st.type === r || st.type === fe.Ribbon || st.isHidden || dne(st.state, (f = $.elementIds) !== null && f !== void 0 ? f : []) === Oc.Not ? [2, "continue"] : (Ze.push.apply(Ze, kv(st == null ? void 0 : st.state, (p = $.elementIds) !== null && p !== void 0 ? p : [])), [4, V_(st == null ? void 0 : st.state, (g = $.elementIds) !== null && g !== void 0 ? g : [], st == null ? void 0 : st.type, function(yt) {
                              var It;
                              return W.createTheme(st == null ? void 0 : st.type, yt, { color: { name: "multi-theme", props: { themes: he } }, size: ee.theme.size && (!((It = ee.theme.size[E]) === null || It === void 0) && It.length) ? ee.theme.size[E][0] : W.defaultTheme.size[st == null ? void 0 : st.type] });
                            }, function(yt) {
                              return W.createTransparencyLayers(yt, ee == null ? void 0 : ee.theme.transparency[E]);
                            })]);
                          case 1:
                            return ft.sent(), (m = w.get($.ref)) === null || m === void 0 || m.add(st.type), [2];
                        }
                      });
                    }, qe = 0, Pe = Array.from(ee.representations), rt.label = 1;
                  case 1:
                    return qe < Pe.length ? (Xe = Pe[qe], Ke = Xe[1], [5, Se(Ke)]) : [3, 4];
                  case 2:
                    rt.sent(), rt.label = 3;
                  case 3:
                    return qe++, [3, 1];
                  case 4:
                    return de = new Set(Ze), ce ? (we = (v = dh(ce.state)) !== null && v !== void 0 ? v : [], Ie = Fr(ae, Array.from(new Set(we.concat(A1.has(r) && F.showPolarHydrogenOnly ? ((h = $.elementIds) !== null && h !== void 0 ? h : []).filter(function(st) {
                      return de.has(st) || !up(ae, st);
                    }) : (y = $.elementIds) !== null && y !== void 0 ? y : [])))), Ee = F.createTransparencyLayers(Ie, ee == null ? void 0 : ee.theme.transparency[E]), [4, es[r].update(ce == null ? void 0 : ce.state, Ie, F.ctx, F.createTheme(r, Ie, { color: { name: "multi-theme", props: { themes: he } }, size: ee.theme.size && (!((x = ee.theme.size[E]) === null || x === void 0) && x.length) ? ee.theme.size[E][0] : F.defaultTheme.size[r] }))]) : [3, 6];
                  case 5:
                    return rt.sent(), (S = w.get($.ref)) === null || S === void 0 || S.add(r), ce.state.setState({ transparency: Ee }), [3, 8];
                  case 6:
                    return Ie = Fr(ae, A1.has(r) && F.showPolarHydrogenOnly ? $.elementIds.filter(function(st) {
                      return de.has(st) || !up(ae, st);
                    }) : $.elementIds), Ee = F.createTransparencyLayers(ee == null ? void 0 : ee.model.structure, ee == null ? void 0 : ee.theme.transparency[E]), [4, es[r].create(Ie, F.plugin.managers.representation.ctx, F.createTheme(r, Ie, { color: { name: "multi-theme", props: { themes: he } }, size: ee.theme.size && (!((b = ee.theme.size[E]) === null || b === void 0) && b.length) ? ee.theme.size[E][0] : F.defaultTheme.size[r] }))];
                  case 7:
                    Le = rt.sent(), (_ = w.get($.ref)) === null || _ === void 0 || _.add(r), (C = F.plugin.canvas3d) === null || C === void 0 || C.add(Le), Le.setState({ transparency: Ee }), ee.representations.set(r, { state: Le, isHidden: !1, type: r }), rt.label = 8;
                  case 8:
                    return ee.dependency.by.length && T.push.apply(T, ee.dependency.by), [2];
                }
              });
            }, F = this, V = 0, G = I, J.label = 6;
          case 6:
            return V < G.length ? (H = G[V], [5, L(H)]) : [3, 9];
          case 7:
            J.sent(), J.label = 8;
          case 8:
            return V++, [3, 6];
          case 9:
            for (q = this.plugin.managers.selection.structure.getSelection(), w.forEach(function($, ee) {
              var ce;
              if ($.size) {
                var ae = W.plugin.cells.get(ee), he = (ce = q[ee]) !== null && ce !== void 0 ? ce : [];
                $.forEach(function(Oe) {
                  var Ne, Ue = ae == null ? void 0 : ae.representations.get(Oe);
                  if (Ue) {
                    var Ze = Vr(qa(Ue.state), he);
                    (Ne = W.plugin.canvas3d) === null || Ne === void 0 || Ne.mark({ loci: Ze, repr: Ue.state }, lt.Select);
                  }
                });
              }
            }), z = Array.from(new Set(T).values()), K = 0, Y = z; K < Y.length; K++) Z = Y[K], (X = this.plugin.cells.get(Z)) && X.representations.forEach(function($, ee) {
              ee === fe.IntraInteractions && o && W.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.representation.setMolecularRepr");
            });
            return this.plugin.managers.snapshot.event.changed.next({ from: "repr: setMolecularRepr" }), [2];
        }
      });
    });
  }, t.prototype.showOrHideHs = function(n, r, i) {
    var a = this, o = i ?? this.plugin.managers.selection.structure.getSelectionCellItems(), s = [];
    o.forEach(function(f) {
      var p = a.plugin.cells.get(f.ref);
      if (p) {
        var g = jn(p);
        if (g) {
          f.elementIds || Object.assign(f, { elementIds: vo(g) });
          var m = f.elementIds.map(function(S) {
            return S3(g, S);
          }), v = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
          p.representations.forEach(function(S, b) {
            if ([fe.BallAndStick, fe.CPK, fe.Stick, fe.Line].includes(b)) {
              var _ = Yi(S.state.getLoci());
              if (!_) return;
              var C = Ai(_);
              h.set(b, Re([], C, !0)), C.forEach(function(w) {
                v.set(w, b);
              });
            }
          });
          var y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
          m.forEach(function(S, b) {
            var _;
            if (f.elementIds) {
              var C = f.elementIds[b], w = g.units.filter(function(I) {
                return Me.indexOf(I.elements, C) !== -1;
              })[0];
              (!r && S === ti.NonPolar || !n && S === ti.Polar) && v.has(C) ? y.has(v.get(C)) ? (_ = y.get(v.get(C))) === null || _ === void 0 || _.add(C) : y.set(v.get(C), /* @__PURE__ */ new Set([C])) : ((!r && S === ti.ConnectNonPolar || !n && S === ti.ConnectPolar) && Ml(g, w, w.elements.indexOf(C), function(I, M) {
                var E;
                I.model.atomicHierarchy.derived.atom.atomicNumber[I.elements[M]] === 1 && v.has(I.elements[M]) && (y.has(v.get(C)) ? (E = y.get(v.get(C))) === null || E === void 0 || E.add(I.elements[M]) : y.set(v.get(C), /* @__PURE__ */ new Set([I.elements[M]])));
              }), !(r && S === ti.NonPolar || n && S === ti.Polar) || v.has(C) ? (r && S === ti.ConnectNonPolar || n && S === ti.ConnectPolar) && v.has(C) && Ml(g, w, w.elements.indexOf(C), function(I, M) {
                var E;
                I.model.atomicHierarchy.derived.atom.atomicNumber[I.elements[M]] !== 1 || v.has(I.elements[M]) || (x.has(v.get(C)) ? (E = x.get(v.get(C))) === null || E === void 0 || E.add(I.elements[M]) : x.set(v.get(C), /* @__PURE__ */ new Set([I.elements[M]])));
              }) : Ml(g, w, w.elements.indexOf(C), function(I, M) {
                var E;
                I.model.atomicHierarchy.derived.atom.atomicNumber[I.elements[M]] !== 1 && v.has(I.elements[M]) && (x.has(v.get(I.elements[M])) ? (E = x.get(v.get(I.elements[M]))) === null || E === void 0 || E.add(C) : x.set(v.get(I.elements[M]), /* @__PURE__ */ new Set([C])));
              }));
            }
          }), p.representations.forEach(function(S, b) {
            var _;
            if ([fe.BallAndStick, fe.CPK, fe.Stick, fe.Line].includes(b)) {
              var C = !1, w = h.get(b);
              if (y.has(b) && y.get(b).size > 0) {
                var I = y.get(b);
                w = w == null ? void 0 : w.filter(function(P) {
                  return !I.has(P);
                }), C = !0;
              }
              if (x.has(b) && x.get(b).size > 0) {
                var M = x.get(b);
                w = Array.from(new Set(Re(Re([], Array.from(M.values()), !0), w, !0))), C = !0;
              }
              if (C) {
                var E = Fr(g, w), T = p.theme.color[dt.ATOM];
                es[b].update(S.state, E, a.ctx, a.createTheme(b, E, { color: { name: "multi-theme", props: { themes: T } }, size: p.theme.size && (!((_ = p.theme.size[dt.ATOM]) === null || _ === void 0) && _.length) ? p.theme.size[dt.ATOM][0] : a.defaultTheme.size[b] }));
              }
            }
          }), p.dependency.by.length && s.push.apply(s, p.dependency.by);
        }
      }
    });
    for (var u = 0, l = Array.from(new Set(s).values()); u < l.length; u++) {
      var c = l[u], d = this.plugin.cells.get(c);
      d && d.representations.forEach(function(f, p) {
        p === fe.IntraInteractions && a.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.representation.showOrHideHs");
      });
    }
  }, t.prototype.redraw = function() {
    var n = this;
    this.plugin.canvas3d && (this.plugin.canvas3d.clear(), Array.from(this.plugin.cells.values()).forEach(function(r) {
      r.representations.forEach(function(i) {
        var a;
        i.isHidden !== !0 && i.state && ((a = n.plugin.canvas3d) === null || a === void 0 || a.add(i.state));
      });
    }));
  }, t.prototype.updateBondThresholds = function(n) {
    var r = this, i = n.reduce(function(o, s) {
      var u;
      return O(O({}, o), ((u = {})[Bk(A0[s.atomA], A0[s.atomB])] = s.distance, u));
    }, {});
    Object.assign(Ok, i), Object.assign(Dk, i);
    var a = /* @__PURE__ */ new Set();
    this.plugin.managers.cell.traverse(function(o, s) {
      return se(r, 0, void 0, function() {
        var u, l, c, d;
        return ie(this, function(f) {
          switch (f.label) {
            case 0:
              return a.has(o.ref) || !o.model.structure ? [2] : (u = o.assets[0], l = u.format, c = u.data, [4, Nl[l].parse(c)]);
            case 1:
              return d = f.sent(), this.plugin.managers.editor.coverStructure(o.ref, d[0], o.assets[0]), a.add(o.ref), [2];
          }
        });
      });
    });
  }, t;
}(Wne), Ib = ((X2 = {})[dt.ATOM] = [], X2[dt.RIBBON] = [], X2[dt.SURFACE] = [], X2), OI = function() {
  function e(t) {
    var n, r = this;
    this.plugin = t, (n = this.plugin.canvas3d) === null || n === void 0 || n.reprCount.subscribe(function(i) {
      if (i > 100 && r.idleCellSet.size) {
        var a = Array.from(r.idleCellSet.values())[0];
        r.idleCellSet.delete(a), r.clearReprState(a);
      }
    }), this.idleCellSet = /* @__PURE__ */ new Set();
  }
  return e.prototype.get = function(t) {
    var n = this.plugin.cells.get(t);
    if (n) return n;
    console.error("no ".concat(t, " cell"));
  }, e.prototype.getHierarchy = function(t) {
    var n = this, r = this.get(t);
    if (!(r != null && r.model.structure)) return console.error("".concat(t, " cell does not have structure")), { data: { polymer: {}, water: {}, otherSolvent: {}, metal: {}, ion: {}, ligand: {}, other: {} }, extraData: { sequenceData: {} } };
    var i = [], a = [];
    r.dependency.by.forEach(function(s) {
      var u, l, c;
      if (n.plugin.cells.has(s)) {
        var d = n.get(s);
        d && (d.representations.has(fe.Label) && a.push({ ref: s, dependencies: Re([], d.dependency.on, !0), label: ((l = (u = d.representations.get(fe.Label)) === null || u === void 0 ? void 0 : u.state) !== null && l !== void 0 ? l : (c = d.representations.get(fe.Label)) === null || c === void 0 ? void 0 : c.cache).props.customText }), d.representations.has(fe.Surface) && i.push({ ref: s, dependencies: Re([], d.dependency.on, !0) }));
      }
    });
    var o = wO(r.model.structure);
    return O(O({}, o), { extraData: O(O({}, o.extraData), { label: a, surface: i }) });
  }, e.prototype.getSequence = function(t) {
    return se(this, 0, void 0, function() {
      var n;
      return ie(this, function(r) {
        switch (r.label) {
          case 0:
            return [4, this.getStructure(t)];
          case 1:
            return (n = r.sent()) ? [2, kZ(n)] : [2];
        }
      });
    });
  }, e.prototype.getStructure = function(t) {
    var n;
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u, l, c;
      return ie(this, function(d) {
        switch (d.label) {
          case 0:
            return (r = this.get(t)) ? (i = jn(r)) ? [2, i] : i || !(!((n = r.assets) === null || n === void 0) && n.length) ? [3, 5] : (a = r.assets[0], o = a.data, s = a.format, c = (l = Nl[s]).parse, [4, ff(o)]) : [2];
          case 1:
            return [4, c.apply(l, [d.sent()])];
          case 2:
            return u = d.sent()[0], s !== pn.Pdb || !u.elementCount || nr.hasSecondaryStructure(u == null ? void 0 : u.model) ? [3, 4] : [4, na.attach({}, u, { type: { name: "dssp", params: { oldDefinition: !0, oldOrdering: !0 } } }, !0)];
          case 3:
            d.sent(), d.label = 4;
          case 4:
            return this.update(t, { model: { structure: u } }), [2, u];
          case 5:
            return [2];
        }
      });
    });
  }, e.prototype.getLoci = function(t) {
    return se(this, 0, void 0, function() {
      var n;
      return ie(this, function(r) {
        switch (r.label) {
          case 0:
            return [4, this.getStructure(t.ref)];
          case 1:
            return (n = r.sent()) ? [2, Vr(n, t.elementIds)] : [2, cr];
        }
      });
    });
  }, e.prototype.getMolecularName = function(t) {
    var n, r, i, a, o, s, u = this.get(t);
    if (!u.model.structure) return !((n = u.assets) === null || n === void 0) && n.length && ["sdf", "mol"].includes(u.assets[0].format) ? "".concat(u.assets[0].data).split(`
`)[0] : "";
    var l = ((i = (r = u.model.structure) === null || r === void 0 ? void 0 : r.state.model) !== null && i !== void 0 ? i : !((a = u.model.structure) === null || a === void 0) && a.state.models) ? (o = u.model.structure) === null || o === void 0 ? void 0 : o.state.models[0] : void 0;
    if (!l) return "";
    var c = (s = l.sourceData) === null || s === void 0 ? void 0 : s.kind;
    return c === "sdf" || c === "mol" ? l.entryId : "";
  }, e.prototype.isFromPdb = function(t) {
    var n, r = this.plugin.cells.get(t);
    if (!r) return !1;
    var i = jn(r);
    return !!i && ((n = yo(i)) === null || n === void 0 ? void 0 : n.sourceData.kind) === "mmCIF";
  }, e.prototype.getCellPdbId = function(t) {
    if (!this.isFromPdb(t)) return "";
    var n = this.plugin.cells.get(t);
    if (!n) return "";
    var r = jn(n);
    if (!r) return "";
    var i = "";
    if (this.plugin.managers.cell.isFromPdb(t)) {
      for (var a = _8(r, ["HEADER"]), o = 0, s = a.length; o < s && !i; o++) if (a[o].startsWith("HEADER") && a[o].length >= 66) {
        var u = a[o].slice(62, 66).replace(" ", "");
        u.length === 4 && /^[A-Za-z0-9]*$/.test(u) && (i = u);
      }
    }
    return i;
  }, e.prototype.getMeasurementName = function(t, n) {
    var r, i, a = this.get(t);
    if (!a.representations.get(n)) return console.warn("There is no ".concat(n, " in ").concat(t, " cell"));
    var o = ((i = (r = a.model) === null || r === void 0 ? void 0 : r.loci) !== null && i !== void 0 ? i : []).map(function(s) {
      return zn.getCenter(s);
    });
    return n === fe.Distance ? "".concat(A.distance(o[0], o[1]).toFixed(2), "Å") : n === fe.Angle ? "".concat(ta(A.angle(A.sub(A(), o[0], o[1]), A.sub(A(), o[2], o[1]))).toFixed(2), "°") : n === fe.Dihedral ? "".concat(ta(A.dihedralAngle(o[0], o[1], o[2], o[3])).toFixed(2), "°") : "";
  }, e.prototype.create = function(t) {
    var n, r, i = this, a = t.representations, o = t.model, s = t.assets, u = t.dependency, l = t.ref, c = t.theme, d = l ?? di.create22(), f = /* @__PURE__ */ new Map();
    return a.forEach(function(p) {
      var g;
      !p.isHidden && p.state && ((g = i.plugin.canvas3d) === null || g === void 0 || g.add(p.state)), f.set(p.type, p);
    }), this.plugin.cells.set(d, { ref: d, representations: f, dependency: O({ on: [], by: [] }, u), theme: { color: O(O({}, Ib), c == null ? void 0 : c.color), size: O(O({}, Ib), c == null ? void 0 : c.size), transparency: O(O({}, Ib), c == null ? void 0 : c.transparency) }, assets: s, model: o }), !((n = u == null ? void 0 : u.on) === null || n === void 0) && n.length && Array.from(new Set(u == null ? void 0 : u.on)).forEach(function(p) {
      i.addDependency(p.ref, { by: [d] });
    }), !((r = u == null ? void 0 : u.by) === null || r === void 0) && r.length && Array.from(new Set(u == null ? void 0 : u.by)).forEach(function(p) {
      i.addDependency(p, { on: [{ ref: d }] });
    }), this.plugin.managers.snapshot.event.changed.next({ from: "cell:create" }), d;
  }, e.prototype.createEmptyMolecularCell = function(t) {
    var n, r, i, a;
    return se(this, 0, void 0, function() {
      var o, s, u, l;
      return ie(this, function(c) {
        switch (c.label) {
          case 0:
            return o = Fu(), [4, LB.create(o, this.plugin.managers.representation.ctx)];
          case 1:
            return s = c.sent(), [2, this.create({ representations: [{ state: s, isHidden: !1, type: fe.BallAndStick }], model: { structure: o }, assets: [{ format: pn.Sdf, data: "" }], theme: { transparency: (u = {}, u[dt.ATOM] = t && (!((n = t[dt.ATOM]) === null || n === void 0) && n.transparency) ? [(r = t[dt.ATOM]) === null || r === void 0 ? void 0 : r.transparency] : [], u[dt.RIBBON] = [], u[dt.SURFACE] = [], u), size: (l = {}, l[dt.ATOM] = t && (!((i = t[dt.ATOM]) === null || i === void 0) && i.size) ? [(a = t[dt.ATOM]) === null || a === void 0 ? void 0 : a.size] : [], l[dt.RIBBON] = [], l[dt.SURFACE] = [], l) } })];
        }
      });
    });
  }, e.prototype.copyMolecular = function(t, n) {
    var r, i, a, o, s, u;
    return se(this, 0, void 0, function() {
      var l, c, d, f, p, g;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            l = [], c = function(v) {
              var h, y, x, S, b, _, C, w, I, M, E, T, P;
              return ie(this, function(k) {
                switch (k.label) {
                  case 0:
                    return h = d.get(v.ref), [4, d.getStructure(v.ref)];
                  case 1:
                    return y = k.sent(), x = [], (S = Fr(y, (r = v.elementIds) !== null && r !== void 0 ? r : [], !0, !0)).elementCount ? [4, na.attach({}, S, void 0, !0)] : [3, 3];
                  case 2:
                    k.sent(), k.label = 3;
                  case 3:
                    return b = Ls(S), v.representationType ? (_ = Object.keys(pr).find(function(D) {
                      return pr[D].includes(v.representationType);
                    }), [4, es[v.representationType].create(S, d.plugin.managers.representation.ctx, d.plugin.managers.representation.createTheme(v.representationType, S, { color: { name: "multi-theme", props: { themes: h.theme.color[_] } }, size: h.theme.size && (!((i = h.theme.size[_]) === null || i === void 0) && i.length) ? h.theme.size[_][0] : d.plugin.managers.representation.defaultTheme.size[v.representationType] }))]) : [3, 5];
                  case 4:
                    return C = k.sent(), x.push({ state: C, isHidden: (a = n == null ? void 0 : n.isHidden) === null || a === void 0 || a, type: v.representationType }), [3, 9];
                  case 5:
                    w = function(D, B) {
                      var L, F, V;
                      return ie(this, function(G) {
                        switch (G.label) {
                          case 0:
                            return L = Object.keys(pr).find(function(H) {
                              return pr[H].includes(D);
                            }), !(!((o = v.elementIds) === null || o === void 0) && o.length) || kv(B.state, v.elementIds).length ? (F = Fr(B.state ? qa(B.state) : Fr(S, B.cache.elementIds, !0), (s = v.elementIds) !== null && s !== void 0 ? s : [], !0, b), [4, es[D].create(F, d.plugin.managers.representation.ctx, d.plugin.managers.representation.createTheme(D, F, { color: { name: "multi-theme", props: { themes: h.theme.color[L] } }, size: d.plugin.managers.representation.defaultTheme.size[D] }))]) : [3, 2];
                          case 1:
                            V = G.sent(), x.push({ state: V, isHidden: (u = n == null ? void 0 : n.isHidden) === null || u === void 0 || u, type: D }), G.label = 2;
                          case 2:
                            return [2];
                        }
                      });
                    }, I = 0, M = Array.from(h.representations), k.label = 6;
                  case 6:
                    return I < M.length ? (E = M[I], T = E[0], P = E[1], [5, w(T, P)]) : [3, 9];
                  case 7:
                    k.sent(), k.label = 8;
                  case 8:
                    return I++, [3, 6];
                  case 9:
                    return l.push(d.create({ representations: x, model: { structure: S }, assets: h.assets, theme: O({}, h.theme) })), [2];
                }
              });
            }, d = this, f = 0, p = t, m.label = 1;
          case 1:
            return f < p.length ? (g = p[f], [5, c(g)]) : [3, 4];
          case 2:
            m.sent(), m.label = 3;
          case 3:
            return f++, [3, 1];
          case 4:
            return this.plugin.managers.snapshot.event.changed.next({ from: "cell:copyMolecular" }), [2, l];
        }
      });
    });
  }, e.prototype.update = function(t, n) {
    var r, i, a, o, s, u, l, c = this, d = this.plugin.managers.cell.get(t);
    d.model = Object.assign(d.model, n.model), n.theme && (d.theme = { color: O(O({}, d.theme.color), n.theme.color), size: O(O({}, d.theme.size), n.theme.size), transparency: O(O({}, d.theme.transparency), n.theme.transparency) }), !((r = n.representations) === null || r === void 0) && r.length && n.representations.forEach(function(f) {
      var p;
      d.representations.set(f.type, Object.assign((p = d.representations.get(f.type)) !== null && p !== void 0 ? p : {}, f));
    }), !((a = (i = n.dependency) === null || i === void 0 ? void 0 : i.on) === null || a === void 0) && a.length && (this.removeDependency(t, { on: d.dependency.on }), Array.from(new Set((o = n.dependency) === null || o === void 0 ? void 0 : o.on)).forEach(function(f) {
      c.addDependency(f.ref, { by: [t] });
    })), !((u = (s = n.dependency) === null || s === void 0 ? void 0 : s.by) === null || u === void 0) && u.length && (this.removeDependency(t, { by: d.dependency.by }), Array.from(new Set((l = n.dependency) === null || l === void 0 ? void 0 : l.by)).forEach(function(f) {
      c.addDependency(f, { on: [{ ref: t }] });
    })), d.dependency = O(O({}, d.dependency), n.dependency), n.assets && (d.assets = n.assets), this.plugin.managers.snapshot.event.changed.next({ from: "cell:update" });
  }, e.prototype.remove = function(t, n) {
    var r, i;
    return se(this, 0, void 0, function() {
      var a, o, s, u, l, c, d, f = this;
      return ie(this, function(p) {
        switch (p.label) {
          case 0:
            a = "", o = /* @__PURE__ */ new Map(), s = function(g) {
              var m, v, h, y, x, S, b, _, C, w, I, M;
              return ie(this, function(E) {
                switch (E.label) {
                  case 0:
                    return u.plugin.cells.has(g.ref) ? (m = u.get(g.ref), [4, u.getStructure(g.ref)]) : [2, "continue"];
                  case 1:
                    if (v = E.sent(), g.ref && v && u.plugin.managers.selection.structure.remove({ item: { ref: g.ref, elementIds: (r = g.elementIds) !== null && r !== void 0 ? r : vo(v) } }), o.has(g.ref) && o.get(g.ref) !== void 0 ? o.set(g.ref, g.elementIds === void 0 ? void 0 : Re(Re([], g.elementIds, !0), o.get(g.ref), !0)) : o.set(g.ref, g.elementIds), n) m.representations.forEach(function(T) {
                      var P, k;
                      if (pm.has(T.type) && m.dependency.on.length) {
                        var D = m.dependency.on.some(function(B) {
                          return fne(B, n);
                        });
                        D && (!T.isHidden && T.state && ((P = f.plugin.canvas3d) === null || P === void 0 || P.remove(T.state)), m.representations.delete(T.type));
                      }
                      T.type === fe.Surface && (n.elementIds || (T.state && ((k = f.plugin.canvas3d) === null || k === void 0 || k.remove(T.state)), m.representations.delete(T.type)));
                    });
                    else if (!((i = g == null ? void 0 : g.elementIds) === null || i === void 0) && i.length) {
                      for (h = function(T, P) {
                        var k = Object.keys(pr).find(function(D) {
                          return pr[D].includes(T);
                        });
                        V_(P.state, g.elementIds, T, function(D) {
                          var B;
                          return f.plugin.managers.representation.createTheme(T, D, { color: { name: "multi-theme", props: { themes: m.theme.color[k] } }, size: m.theme.size && (!((B = m.theme.size[k]) === null || B === void 0) && B.length) ? m.theme.size[k][0] : f.plugin.managers.representation.defaultTheme.size[P.type] });
                        }, function(D) {
                          var B;
                          return f.plugin.managers.representation.createTransparencyLayers(D, Re([], (B = m == null ? void 0 : m.theme.transparency[k]) !== null && B !== void 0 ? B : [], !0));
                        });
                      }, y = 0, x = Array.from(m.representations); y < x.length; y++) S = x[y], b = S[0], _ = S[1], h(b, _);
                      v && (m.model.structure = zO(v, g.elementIds));
                    } else m.representations.forEach(function(T) {
                      var P;
                      !T.isHidden && T.state && ((P = f.plugin.canvas3d) === null || P === void 0 || P.remove(T.state)), m.representations.delete(T.type);
                    });
                    if (!m.dependency.by.length) return [3, 6];
                    C = 0, w = Array.from(new Set(m.dependency.by)), E.label = 2;
                  case 2:
                    return C < w.length ? (I = w[C], (M = u.plugin.cells.get(I)) != null && M.representations.has(fe.IntraInteractions) ? (a = I, [3, 5]) : [3, 3]) : [3, 6];
                  case 3:
                    return [4, u.remove([{ ref: I }], g)];
                  case 4:
                    E.sent(), E.label = 5;
                  case 5:
                    return C++, [3, 2];
                  case 6:
                    return m.representations.size || (m.dependency.on.length && Array.from(new Set(m.dependency.on)).forEach(function(T) {
                      var P = f.plugin.cells.get(T.ref);
                      if (P) {
                        var k = P.dependency.by.findIndex(function(D) {
                          return D === g.ref;
                        });
                        k !== -1 && P.dependency.by.splice(k, 1);
                      }
                    }), u.plugin.cells.delete(g.ref)), [2];
                }
              });
            }, u = this, l = 0, c = t, p.label = 1;
          case 1:
            return l < c.length ? (d = c[l], [5, s(d)]) : [3, 4];
          case 2:
            p.sent(), p.label = 3;
          case 3:
            return l++, [3, 1];
          case 4:
            return a && this.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.cell.remove"), this.plugin.managers.snapshot.event.changed.next({ from: "cell:remove" }), [2];
        }
      });
    });
  }, e.prototype.extractMolecular = function(t, n) {
    var r, i, a, o, s;
    return se(this, 0, void 0, function() {
      var u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C;
      return ie(this, function(w) {
        switch (w.label) {
          case 0:
            u = [], l = 0, c = t, w.label = 1;
          case 1:
            return l < c.length ? (d = c[l], f = this.get(d.ref), [4, this.getStructure(d.ref)]) : [3, 8];
          case 2:
            p = w.sent(), g = Fr(p, (r = d.elementIds) !== null && r !== void 0 ? r : [], !0, !0), m = !((i = f.assets) === null || i === void 0) && i.length && (!((a = f.assets[0]) === null || a === void 0) && a.format) ? f.assets[0].format : pn.Pdb, v = [], h = function(I, M) {
              var E, T, P, k;
              return ie(this, function(D) {
                switch (D.label) {
                  case 0:
                    return E = Object.keys(pr).find(function(B) {
                      return pr[B].includes(I);
                    }), (T = kv(M.state, d.elementIds)).length ? (P = Fr(g, T), [4, es[I].create(P, y.plugin.managers.representation.ctx, y.plugin.managers.representation.createTheme(I, P, { color: { name: "multi-theme", props: { themes: f.theme.color[E] } }, size: f.theme.size && (!((o = f.theme.size[E]) === null || o === void 0) && o.length) ? f.theme.size[E][0] : y.plugin.managers.representation.defaultTheme.size[M.type] }))]) : [3, 2];
                  case 1:
                    k = D.sent(), v.push({ state: k, isHidden: (s = n == null ? void 0 : n.isHidden) === null || s === void 0 || s, type: I }), D.label = 2;
                  case 2:
                    return [2];
                }
              });
            }, y = this, x = 0, S = Array.from(f.representations), w.label = 3;
          case 3:
            return x < S.length ? (b = S[x], _ = b[0], C = b[1], [5, h(_, C)]) : [3, 6];
          case 4:
            w.sent(), w.label = 5;
          case 5:
            return x++, [3, 3];
          case 6:
            u.push(this.create({ representations: v, model: { structure: g }, assets: [{ format: m, data: C3(g, m) }], theme: O({}, f.theme) })), this.remove([d]), w.label = 7;
          case 7:
            return l++, [3, 1];
          case 8:
            return this.plugin.managers.snapshot.event.changed.next({ from: "cell:extractMolecular" }), [2, u];
        }
      });
    });
  }, e.prototype.addDependency = function(t, n) {
    var r, i, a = this.get(t);
    !((r = n.on) === null || r === void 0) && r.length && (a.dependency.on = a.dependency.on.concat(n.on)), !((i = n.by) === null || i === void 0) && i.length && (a.dependency.by = Array.from(new Set(a.dependency.by.concat(n.by))));
  }, e.prototype.removeDependency = function(t, n) {
    var r, i, a = this;
    !((r = n.on) === null || r === void 0) && r.length && n.on.forEach(function(o) {
      a.plugin.cells.has(o.ref) && (a.get(o.ref).dependency.by = a.get(o.ref).dependency.by.filter(function(s) {
        return s !== t;
      }));
    }), !((i = n.by) === null || i === void 0) && i.length && n.by.forEach(function(o) {
      a.plugin.cells.has(o) && (a.get(o).dependency.on = a.get(o).dependency.on.filter(function(s) {
        return s.ref !== t;
      }));
    });
  }, e.prototype.query = function(t) {
    var n = [];
    return this.plugin.cells.forEach(function(r) {
      r.representations.forEach(function(i) {
        t(r, i) && n.push(r);
      });
    }), n;
  }, e.prototype.traverse = function(t) {
    this.plugin.cells.forEach(function(n) {
      n.representations.forEach(function(r) {
        t(n, r);
      });
    });
  }, e.prototype.getAllDisplayedCellsRef = function() {
    var t = /* @__PURE__ */ new Set();
    return this.plugin.managers.cell.traverse(function(n, r) {
      [fe.Ribbon, fe.BallAndStick, fe.Line, fe.Stick, fe.CPK].includes(r.type) && !r.isHidden && jn(n) && t.add(n.ref);
    }), Array.from(t.values());
  }, e.prototype.clearReprState = function(t) {
    var n = this, r = this.get(t), i = /* @__PURE__ */ new Map(), a = r.model.structure;
    if (a) {
      if (a) {
        var o = 0;
        a.units.forEach(function(s) {
          s.elements.forEach(function(u) {
            i.set(u, o++);
          });
        });
      }
      Array.from(r.representations.entries()).forEach(function(s) {
        var u;
        s[0];
        var l = s[1];
        l.state && ((u = n.plugin.canvas3d) === null || u === void 0 || u.remove(l.state), r.representations.set(l.type, { isHidden: l.isHidden, type: l.type, cache: { type: l.type, elementIds: dh(l.state).map(function(c) {
          return i && (i != null && i.has(c)) ? i == null ? void 0 : i.get(c) : c;
        }), isHidden: l.isHidden, params: pm.has(l.type) ? MR(l.type, l.state) : void 0 } }));
      });
    }
  }, e.prototype.recoveryCache = function(t, n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s;
      return ie(this, function(u) {
        switch (u.label) {
          case 0:
            return r = this.get(t), i = Array.from(r.representations.values()), n ? [4, this.recoveryReprCache(r, n)] : [3, 2];
          case 1:
            u.sent(), u.label = 2;
          case 2:
            a = 0, o = i, u.label = 3;
          case 3:
            return a < o.length ? (s = o[a]).cache ? [4, this.recoveryReprCache(r, s.cache)] : [3, 5] : [3, 6];
          case 4:
            u.sent(), u.label = 5;
          case 5:
            return a++, [3, 3];
          case 6:
            return [2];
        }
      });
    });
  }, e.prototype.recoveryReprCache = function(t, n) {
    var r, i;
    return se(this, 0, void 0, function() {
      var a, o, s, u;
      return ie(this, function(l) {
        switch (l.label) {
          case 0:
            return [4, this.getStructure(t.ref)];
          case 1:
            return (a = l.sent()) ? (o = Object.keys(pr).find(function(c) {
              return pr[c].includes(n.type);
            }), s = t.theme.color[o], u = t.theme.transparency ? t.theme.transparency[o] : void 0, [4, this.plugin.managers.representation.addMolecularRepr(t.ref, { reprType: n.type, elementIds: n.elementIds, isHidden: n.isHidden, theme: this.plugin.managers.representation.createTheme(n.type, Fr(a, (r = n.elementIds) !== null && r !== void 0 ? r : [], !0), { color: { name: "multi-theme", props: { themes: s } }, size: t.theme.size && (!((i = t.theme.size[o]) === null || i === void 0) && i.length) ? t.theme.size[o][0] : this.plugin.managers.representation.defaultTheme.size[n.type] }), transparency: u })]) : [2];
          case 2:
            return l.sent(), [2];
        }
      });
    });
  }, e.prototype.overlapLigands = function(t, n, r) {
    return se(this, 0, void 0, function() {
      var i, a, o, s, u, l, c, d, f, p, g;
      return ie(this, function(m) {
        switch (m.label) {
          case 0:
            return i = function(v) {
              var h = je(v), y = je.readLine(h).trim(), x = je.readLine(h).trim(), S = je.readLine(h).trim(), b = je.readLine(h), _ = +b.substr(0, 3), C = +b.substr(3, 3);
              return { title: y, program: x, comment: S, atoms: v8(h, _), bonds: y8(h, C), formalCharges: b8(h) };
            }(r), a = [Array.from(i.atoms.x.toArray()).reduce(function(v, h) {
              return v + h;
            }) / i.atoms.count, Array.from(i.atoms.y.toArray()).reduce(function(v, h) {
              return v + h;
            }) / i.atoms.count, Array.from(i.atoms.z.toArray()).reduce(function(v, h) {
              return v + h;
            }) / i.atoms.count], [4, this.getStructure(t)];
          case 1:
            for (o = m.sent(), s = Vr(o, n), u = ke.getBoundary(s).sphere.center, l = [u[0] - a[0], u[1] - a[1], u[2] - a[2]], c = [], d = /* @__PURE__ */ new Map(), p = 0, g = i.formalCharges.atomIdx.rowCount; p < g; p++) d.set(i.formalCharges.atomIdx.value(p) - 1, i.formalCharges.charge.value(p));
            for (p = 0, g = i.atoms.count; p < g; p++) c.push({ x: i.atoms.x.value(p) + l[0], y: i.atoms.y.value(p) + l[1], z: i.atoms.z.value(p) + l[2], type_symbol: i.atoms.type_symbol.value(p), charge: d.get(p) || 0 });
            for (f = [], p = 0, g = i.bonds.count; p < g; p++) f.push({ a: i.bonds.atomIdxA.value(p), b: i.bonds.atomIdxB.value(p), order: i.bonds.order.value(p) });
            return [2, { atoms: c, bonds: f }];
        }
      });
    });
  }, e.prototype.getUnitCellData = function(t) {
    var n = this.get(t);
    if (n) {
      var r = jn(n);
      return hne(r);
    }
  }, e;
}(), _1 = { createByTrajectory: function(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m;
    return ie(this, function(v) {
      switch (v.label) {
        case 0:
          return n = e.trajectory, r = e.frameIndex, i = e.mode, a = n, o = ze.ofModel(a.getFrameAtIndex(r)), s = [], i !== $d.Drug ? [3, 7] : (u = __(o), l = u.polymer, c = u.other, l.length ? (d = Fr(o, l)).elementCount ? [4, na.attach({ runtime: go, assetManager: new vl() }, d, { type: { name: "dssp", params: { oldDefinition: !0, oldOrdering: !0 } } })] : [3, 2] : [3, 4]);
        case 1:
          v.sent(), v.label = 2;
        case 2:
          return (f = ml.factory(t, ml.getParams)).setTheme({ color: t.colorThemeRegistry.create("uniform", { structure: d }, { value: Ae(14474728) }), size: t.sizeThemeRegistry.create("uniform", { structure: d }) }), [4, f.createOrUpdate(O(O({}, ml.defaultValues), { quality: "auto" }), d).run()];
        case 3:
          v.sent(), s.push({ state: f, type: fe.Ribbon }), v.label = 4;
        case 4:
          return c.length ? (p = Fr(o, c), (g = Ca.factory(t, Ca.getParams)).setTheme({ color: t.colorThemeRegistry.create("element-symbol", { structure: p }, { carbonColor: { name: "uniform", params: { value: Ae(14474728) } } }), size: t.sizeThemeRegistry.create("physical", { structure: p }) }), [4, g.createOrUpdate(O(O({}, Ca.defaultValues), { quality: "auto" }), p).run()]) : [3, 6];
        case 5:
          v.sent(), s.push({ state: g, type: fe.BallAndStick }), v.label = 6;
        case 6:
          return [3, 9];
        case 7:
          return (m = Ca.factory(t, Ca.getParams)).setTheme({ color: t.colorThemeRegistry.create("material-element-symbol", { structure: o }), size: t.sizeThemeRegistry.create("physical", { structure: o }) }), [4, m.createOrUpdate(O(O({}, Ca.defaultValues), { quality: "auto" }), o).run()];
        case 8:
          v.sent(), s.push({ state: m, type: fe.BallAndStick }), v.label = 9;
        case 9:
          return [2, { model: a, reprs: s }];
      }
    });
  });
}, create: function(e, t) {
  return se(this, 0, void 0, function() {
    var n, r, i, a, o, s, u, l, c, d, f, p, g, m, v;
    return ie(this, function(h) {
      switch (h.label) {
        case 0:
          return n = e.model, r = e.coordinates, i = e.frameIndex, a = e.mode, o = nr.trajectoryFromModelAndCoordinates(n, r), s = ze.ofModel(o.getFrameAtIndex(i)), u = [], a !== $d.Drug ? [3, 7] : (l = __(s), c = l.polymer, d = l.other, c.length ? (f = Fr(s, c)).elementCount ? [4, na.attach({ runtime: go, assetManager: new vl() }, f, { type: { name: "dssp", params: { oldDefinition: !0, oldOrdering: !0 } } })] : [3, 2] : [3, 4]);
        case 1:
          h.sent(), h.label = 2;
        case 2:
          return (p = ml.factory(t, ml.getParams)).setTheme({ color: t.colorThemeRegistry.create("uniform", { structure: f }, { value: Ae(14474728) }), size: t.sizeThemeRegistry.create("uniform", { structure: f }) }), [4, p.createOrUpdate(O(O({}, ml.defaultValues), { quality: "auto" }), f).run()];
        case 3:
          h.sent(), u.push({ state: p, type: fe.Ribbon }), h.label = 4;
        case 4:
          return d.length ? (g = Fr(s, d), (m = Ca.factory(t, Ca.getParams)).setTheme({ color: t.colorThemeRegistry.create("element-symbol", { structure: g }, { carbonColor: { name: "uniform", params: { value: Ae(14474728) } } }), size: t.sizeThemeRegistry.create("physical", { structure: g }) }), [4, m.createOrUpdate(O(O({}, Ca.defaultValues), { quality: "auto" }), g).run()]) : [3, 6];
        case 5:
          h.sent(), u.push({ state: m, type: fe.BallAndStick }), h.label = 6;
        case 6:
          return [3, 9];
        case 7:
          return (v = Ca.factory(t, Ca.getParams)).setTheme({ color: t.colorThemeRegistry.create("material-element-symbol", { structure: s }), size: t.sizeThemeRegistry.create("physical", { structure: s }) }), [4, v.createOrUpdate(O(O({}, Ca.defaultValues), { quality: "auto" }), s).run()];
        case 8:
          h.sent(), u.push({ state: v, type: fe.BallAndStick }), h.label = 9;
        case 9:
          return [2, { model: o, reprs: u }];
      }
    });
  });
}, update: function(e, t, n) {
  return se(this, 0, void 0, function() {
    var r, i, a, o;
    return ie(this, function(s) {
      switch (s.label) {
        case 0:
          return r = t.trajectory, i = t.frameIndex, a = t.mode, (o = ze.ofModel(r.getFrameAtIndex(i))).elementCount ? [4, na.attach({ runtime: go, assetManager: new vl() }, o, { type: { name: "dssp", params: { oldDefinition: !0, oldOrdering: !0 } } })] : [3, 2];
        case 1:
          s.sent(), s.label = 2;
        case 2:
          return [4, Promise.all(e.map(function(u) {
            var l = Object.keys(pr).find(function(f) {
              return pr[f].includes(u.type);
            }), c = ke.toExpression(ze.toStructureElementLoci(u.getLoci().structure)), d = gm(hm(o, c));
            u.setTheme({ color: n.colorThemeRegistry.create(a === $d.Drug ? l === dt.RIBBON ? "uniform" : "element-symbol" : "material-element-symbol", { structure: d }, a === $d.Drug ? l === dt.RIBBON ? { value: Ae(14474728) } : { carbonColor: { name: "uniform", params: { value: Ae(14474728) } } } : {}), size: n.sizeThemeRegistry.create(l === dt.RIBBON ? "uniform" : "physical", { structure: d }, u.theme.size.props) }), u.createOrUpdate({}, d).run();
          }))];
        case 3:
          return s.sent(), [2];
      }
    });
  });
} }, BI = function() {
  function e(t) {
    this.ev = Da.create(), this.updated = this.ev(), this.plugin = t, this.paused = !1;
  }
  return e.prototype.import = function(t, n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o, s, u;
      return ie(this, function(l) {
        switch (l.label) {
          case 0:
            return [4, ff(t.data)];
          case 1:
            return r = l.sent(), [4, Nl[t.format].parse(r)];
          case 2:
            return i = l.sent(), [4, AZ(n.data)];
          case 3:
            return a = l.sent(), [4, Nl[n.format].parse(a)];
          case 4:
            return o = l.sent(), [4, _1.create({ model: t.format === pn.Gro ? i : i[0].model, coordinates: o, frameIndex: 0, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)];
          case 5:
            return s = l.sent(), u = Ai(ze.toStructureElementLoci(t.format === pn.Gro ? ze.ofModel(s.model.frames[0], { dynamicBonds: !0 }) : i[0])), [2, this.plugin.managers.cell.create({ representations: s.reprs.map(function(c) {
              return O({ isHidden: !1 }, c);
            }), model: { trajectory: { state: s.model, frameIndex: 0 } }, assets: [{ data: r, format: t.format }, { data: a, format: n.format }], theme: { color: { Atom: [O({ elementIds: u }, this.plugin.managers.representation.defaultTheme.color[dt.ATOM])], Ribbon: [O({ elementIds: u }, this.plugin.managers.representation.defaultTheme.color[dt.RIBBON])] } } })];
        }
      });
    });
  }, e.prototype.importWithGro = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i;
      return ie(this, function(a) {
        switch (a.label) {
          case 0:
            return [4, ff(t.data)];
          case 1:
            return n = a.sent(), [4, NR.parse(n)];
          case 2:
            return r = a.sent(), [4, _1.createByTrajectory({ trajectory: r, frameIndex: 0, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)];
          case 3:
            return i = a.sent(), [2, this.plugin.managers.cell.create({ representations: i.reprs.map(function(o) {
              return O({ isHidden: !1 }, o);
            }), model: { trajectory: { state: i.model, frameIndex: 0 } }, assets: [{ data: n, format: t.format }] })];
        }
      });
    });
  }, e.prototype.importTrajectory = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i, a;
      return ie(this, function(o) {
        switch (o.label) {
          case 0:
            return q_[t.format] ? typeof t.data == "string" || t.data instanceof File ? [4, ff(t.data)] : [3, 2] : [2];
          case 1:
            return r = o.sent(), [3, 3];
          case 2:
            r = t.data, o.label = 3;
          case 3:
            return n = r, [4, q_[t.format].parse(n)];
          case 4:
            return i = o.sent(), [4, _1.createByTrajectory({ trajectory: i, frameIndex: 0, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)];
          case 5:
            return a = o.sent(), [2, this.plugin.managers.cell.create({ representations: a.reprs.map(function(s) {
              return O({ isHidden: !1 }, s);
            }), model: { trajectory: { state: a.model, frameIndex: 0 } }, assets: [{ data: n, format: t.format }] })];
        }
      });
    });
  }, e.prototype.getTrajectoryCell = function(t) {
    var n = [];
    if (t) {
      var r = this.plugin.cells.get(t);
      if (!(r != null && r.model.trajectory)) return [];
      n.push(r);
    } else this.plugin.cells.forEach(function(i) {
      i.model.trajectory && n.push(i);
    });
    return n;
  }, e.prototype.play = function(t) {
    var n = this;
    this.paused = !1;
    var r = function() {
      n.next(t), n.paused || window.requestAnimationFrame(r);
    };
    window.requestAnimationFrame(r);
  }, e.prototype.next = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i, a, o, s, u, l;
      return ie(this, function(c) {
        switch (c.label) {
          case 0:
            n = this.getTrajectoryCell(t), r = 0, i = n, c.label = 1;
          case 1:
            return r < i.length ? (a = i[r], o = a.model.trajectory, s = o.state, u = o.frameIndex, l = u >= s.frameCount - 1 ? 0 : u + 1, [4, _1.update(Array.from(a.representations).map(function(d) {
              return d[0], d[1].state;
            }), { trajectory: s, frameIndex: l, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)]) : [3, 4];
          case 2:
            c.sent(), a.model.trajectory.frameIndex = l, this.updateDependencyByCells(t), t && this.updated.next({ ref: t, frame: l }), c.label = 3;
          case 3:
            return r++, [3, 1];
          case 4:
            return [2];
        }
      });
    });
  }, e.prototype.setFrameIndex = function(t, n) {
    var r;
    return se(this, 0, void 0, function() {
      var i, a, o, s;
      return ie(this, function(u) {
        switch (u.label) {
          case 0:
            i = this.getTrajectoryCell(n), a = 0, o = i, u.label = 1;
          case 1:
            return a < o.length ? (s = o[a], [4, _1.update(Array.from(s.representations).map(function(l) {
              return l[0], l[1].state;
            }), { trajectory: (r = s.model.trajectory) === null || r === void 0 ? void 0 : r.state, frameIndex: t, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)]) : [3, 4];
          case 2:
            u.sent(), s.model.trajectory.frameIndex = t, u.label = 3;
          case 3:
            return a++, [3, 1];
          case 4:
            return [2];
        }
      });
    });
  }, e.prototype.updateDependencyByCells = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i, a, o, s, u, l, c, d = this;
      return ie(this, function(f) {
        for (n = this.getTrajectoryCell(t), r = 0, i = n; r < i.length; r++) if ((a = i[r]).dependency.by.length) for (o = function(p) {
          var g = s.plugin.cells.get(p);
          g && g.representations.forEach(function(m, v) {
            v === fe.IntraInteractions && d.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.trajectory.updateDependencyByCells"), Object.keys(Kp).includes(v) && d.plugin.managers.representation.updateMeasurement({ items: g.dependency.on, ref: p });
          });
        }, s = this, u = 0, l = a.dependency.by; u < l.length; u++) c = l[u], o(c);
        return [2];
      });
    });
  }, e.prototype.mergeDumpAndPymatgen = function(t, n) {
    return se(this, 0, void 0, function() {
      var r, i, a;
      return ie(this, function(o) {
        switch (o.label) {
          case 0:
            return (r = this.getTrajectoryCell(n)).length && r[0].assets[0].format === pn.Dump ? (i = r[0], [4, Zne(i.assets[0].data, t)]) : [2];
          case 1:
            return a = o.sent(), i.model.trajectory = { state: a, frameIndex: i.model.trajectory.frameIndex }, [4, _1.update(Array.from(i.representations).map(function(s) {
              return s[0], s[1].state;
            }), { trajectory: a, frameIndex: i.model.trajectory.frameIndex, mode: this.plugin.mode }, this.plugin.managers.representation.ctx)];
          case 2:
            return o.sent(), i.model.trajectory.frameIndex = i.model.trajectory.frameIndex, this.updateDependencyByCells(n), [2];
        }
      });
    });
  }, e.prototype.pause = function() {
    this.paused = !0;
  }, e;
}();
function RI(e) {
  try {
    e.dispatchEvent(new MouseEvent("click"));
  } catch {
    var t = document.createEvent("MouseEvents");
    t.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), e.dispatchEvent(t);
  }
}
function FR(e, t) {
  if (t === void 0 && (t = "download"), e) if ("download" in HTMLAnchorElement.prototype) {
    var n = document.createElement("a");
    n.download = t, n.rel = "noopener", typeof e == "string" ? (n.href = e, RI(n)) : (n.href = URL.createObjectURL(e), setTimeout(function() {
      return URL.revokeObjectURL(n.href);
    }, 4e4), setTimeout(function() {
      return RI(n);
    }));
  } else if (typeof navigator < "u" && navigator.msSaveOrOpenBlob) navigator.msSaveOrOpenBlob(e, t);
  else {
    var r = window.navigator.userAgent, i = /Safari/i.test(r), a = /CriOS\/[\d]+/.test(r), o = function(l) {
      var c;
      c = a ? l : l.replace(/^data:[^;]*;/, "data:attachment/file;"), window.open(c, "_blank") || (window.location.href = c);
    };
    if ((i || a) && FileReader) if (e instanceof Blob) {
      var s = new FileReader();
      s.onloadend = function() {
        return o(s.result);
      }, s.readAsDataURL(e);
    } else o(e);
    else {
      var u = URL.createObjectURL(typeof e == "string" ? new Blob([e]) : e);
      location.href = u, setTimeout(function() {
        return URL.revokeObjectURL(u);
      }, 4e4);
    }
  }
}
var Yo, c0, LI = function() {
  function e(t) {
    this.ev = Da.create(), this.event = { changed: this.ev() }, this.plugin = t;
  }
  return e.prototype.setSnapshot = function(t, n) {
    var r, i, a, o, s;
    return se(this, 0, void 0, function() {
      var u, l, c, d, f, p, g, m;
      return ie(this, function(v) {
        switch (v.label) {
          case 0:
            for (u = /* @__PURE__ */ new Map(), ((r = t == null ? void 0 : t.params) === null || r === void 0 ? void 0 : r.showPolarHydrogenOnly) !== void 0 && (this.plugin.managers.representation.showPolarHydrogenOnly = t.params.showPolarHydrogenOnly), ((i = t == null ? void 0 : t.params) === null || i === void 0 ? void 0 : i.interactionParams) !== void 0 && (this.plugin.managers.representation.interactionParams = t.params.interactionParams), l = 0, c = t.cells; l < c.length; l++) m = c[l], u.set(m.ref, { ref: m.ref, assets: m.assets, dependency: m.dependency, model: {}, representations: /* @__PURE__ */ new Map(), theme: m.theme });
            this.plugin.cells = u, d = function(h) {
              var y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G, H, q;
              return ie(this, function(z) {
                switch (z.label) {
                  case 0:
                    return y = h.model, x = y.structure, y.trajectory, S = y.other, b = h.representations, _ = h.dependency, C = h.theme, w = void 0, x ? b != null && b.some(function(K) {
                      return K.isHidden !== !0;
                    }) ? (I = typeof x.data == "string" || x.data instanceof File, T = (E = Nl[x.format]).parse, I ? [4, ff(x.data)] : [3, 2]) : [3, 7] : [3, 8];
                  case 1:
                    return P = z.sent(), [3, 3];
                  case 2:
                    P = x.data, z.label = 3;
                  case 3:
                    return [4, T.apply(E, [P])];
                  case 4:
                    return M = z.sent(), x.format !== pn.Pdb || !M[0].elementCount || nr.hasSecondaryStructure((a = M[0]) === null || a === void 0 ? void 0 : a.model) ? [3, 6] : [4, na.attach({}, M[0], { type: { name: "dssp", params: { oldDefinition: !0, oldOrdering: !0 } } }, !0)];
                  case 5:
                    z.sent(), z.label = 6;
                  case 6:
                    return w = M[0], f.plugin.managers.cell.update(h.ref, { representations: [], model: { structure: M[0] }, assets: [{ format: x.format, data: x.data }] }), [3, 8];
                  case 7:
                    f.plugin.managers.cell.update(h.ref, { representations: [], model: { structure: void 0 }, assets: [{ format: x.format, data: x.data }] }), z.label = 8;
                  case 8:
                    return k = h.theme, C && (D = {}, Object.keys(C).forEach(function(K) {
                      var Y = C[K];
                      if (Y) {
                        var Z = {};
                        Object.keys(Y).forEach(function(X) {
                          var W = Y[X], J = [];
                          W != null && W.length && W.forEach(function($) {
                            J.push(O(O({}, $), { elementIds: $.elementIds ? w2($.elementIds) : $.elementIds }));
                          }), Z[X] = J;
                        }), D[K] = Z;
                      }
                    }), k = D, f.plugin.managers.cell.update(h.ref, { representations: [], model: {}, theme: D })), b != null && b.length ? w ? [3, 9] : (f.plugin.managers.cell.update(h.ref, { representations: b == null ? void 0 : b.map(function(K) {
                      var Y;
                      return K.cache ? K : O(O({}, K), { elementIds: [], cache: O(O({}, K), { elementIds: !((Y = K.elementIds) === null || Y === void 0) && Y.length ? w2(K.elementIds) : K.elementIds }) });
                    }), model: {} }), [3, 13]) : [3, 13];
                  case 9:
                    B = function(K) {
                      var Y, Z, X, W;
                      return ie(this, function(J) {
                        switch (J.label) {
                          case 0:
                            return !((o = K.elementIds) === null || o === void 0) && o.length ? (Y = Object.keys(pr).find(function($) {
                              return pr[$].includes(K.type);
                            }), Z = k.color[Y], X = k.transparency ? k.transparency[Y] : void 0, W = K.elementIds ? w2(K.elementIds) : [], [4, f.plugin.managers.representation.addMolecularRepr(h.ref, { reprType: K.type, elementIds: W, isHidden: K.isHidden, theme: f.plugin.managers.representation.createTheme(K.type, Fr(w, W, !0), { color: { name: "multi-theme", props: { themes: Z } }, size: k.size && (!((s = k.size[Y]) === null || s === void 0) && s.length) ? k.size[Y][0] : f.plugin.managers.representation.defaultTheme.size[K.type] }), transparency: X })]) : [3, 2];
                          case 1:
                            J.sent(), J.label = 2;
                          case 2:
                            return [2];
                        }
                      });
                    }, L = 0, F = b, z.label = 10;
                  case 10:
                    return L < F.length ? (V = F[L], [5, B(V)]) : [3, 13];
                  case 11:
                    z.sent(), z.label = 12;
                  case 12:
                    return L++, [3, 10];
                  case 13:
                    return S ? (V = b[0], S.serverData && !S.data && n ? [4, n(S.serverData)] : [3, 15]) : [3, 18];
                  case 14:
                    return H = z.sent(), [3, 16];
                  case 15:
                    H = S, z.label = 16;
                  case 16:
                    return G = H, [4, f.plugin.managers.representation.createOther({ data: V.type === fe.IsoSurface ? new File([G.data], G.name) : G, serverData: S.serverData, type: V.type, ref: h.ref, isHidden: V.isHidden })];
                  case 17:
                    z.sent(), z.label = 18;
                  case 18:
                    return _.on.length ? (q = _.on.map(function(K) {
                      return O(O({}, K), { elementIds: K.elementIds ? w2(K.elementIds) : K.elementIds });
                    }), [4, f.plugin.managers.representation.createMeasurement({ items: q, type: b[0].type, ref: h.ref, props: b[0].params, isHidden: b[0].isHidden })]) : [3, 20];
                  case 19:
                    z.sent(), f.plugin.managers.cell.update(h.ref, { representations: [], model: {}, dependency: O(O({}, h.dependency), { on: q }) }), z.label = 20;
                  case 20:
                    return [2];
                }
              });
            }, f = this, p = 0, g = t.cells, v.label = 1;
          case 1:
            return p < g.length ? (m = g[p], [5, d(m)]) : [3, 4];
          case 2:
            v.sent(), v.label = 3;
          case 3:
            return p++, [3, 1];
          case 4:
            return this.refresh(), [2];
        }
      });
    });
  }, e.prototype.getSnapshot = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i = this;
      return ie(this, function(a) {
        switch (a.label) {
          case 0:
            return this.timestamp = Date.now(), n = [], r = {}, Array.from(this.plugin.cells.values()).map(function(o) {
              var s = o.model.structure, u = o.ref;
              if (s) {
                var l = /* @__PURE__ */ new Map(), c = 0;
                s.units.forEach(function(d) {
                  d.elements.forEach(function(f) {
                    l.set(f, c++);
                  });
                }), r[u] = l;
              }
            }), [4, Promise.all(Array.from(this.plugin.cells.values()).map(function(o) {
              return se(i, 0, void 0, function() {
                var s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E;
                return ie(this, function(T) {
                  switch (T.label) {
                    case 0:
                      return s = o.representations, u = o.assets, l = o.model, c = l.structure, d = l.trajectory, f = l.other, p = function(P, k) {
                        var D = {};
                        for (var B in P) Object.prototype.hasOwnProperty.call(P, B) && k.indexOf(B) < 0 && (D[B] = P[B]);
                        if (P != null && typeof Object.getOwnPropertySymbols == "function") {
                          var L = 0;
                          for (B = Object.getOwnPropertySymbols(P); L < B.length; L++) k.indexOf(B[L]) < 0 && Object.prototype.propertyIsEnumerable.call(P, B[L]) && (D[B[L]] = P[B[L]]);
                        }
                        return D;
                      }(o, ["representations", "assets", "model"]), (g = Bl(p)).model = {}, s.get(fe.IntraInteractions) || s.get(fe.BetweenInteractions) ? [2] : (c ? g.model.structure = { data: (w = (C = C3(c, u == null ? void 0 : u[0].format)) !== null && C !== void 0 ? C : u == null ? void 0 : u[0].data) !== null && w !== void 0 ? w : yo(c).sourceData.data, format: u == null ? void 0 : u[0].format } : u && (g.assets = u), d && (g.model.trajectory = { data: "提取的结构信息", format: u == null ? void 0 : u[0].format }), f ? s.get(fe.IsoSurface) ? (m = !!o.model.other.serverData, v = m ? o.model.other.data : o.model.other, h = g.model, t ? (y = { serverData: m ? o.model.other.serverData : o.model.other }, [3, 3]) : [3, 1]) : [3, 4] : [3, 5]);
                    case 1:
                      return _ = {}, x = Uint8Array.bind, [4, v.arrayBuffer()];
                    case 2:
                      _.data = new (x.apply(Uint8Array, [void 0, T.sent()]))(), _.name = v.name, _.serverData = m ? o.model.other.serverData : o.model.other, y = _, T.label = 3;
                    case 3:
                      return h.other = y, [3, 5];
                    case 4:
                      g.model.other = o.model.other, T.label = 5;
                    case 5:
                      return s != null && s.size && (g.representations = [], S = r[p.ref], s.forEach(function(P) {
                        g.representations.push({ type: P.type, elementIds: P.state ? N4(dh(P.state).map(function(k) {
                          return S && (S != null && S.has(k)) ? S == null ? void 0 : S.get(k) : k;
                        })) : [], isHidden: P.isHidden, params: pm.has(P.type) && P.state ? MR(P.type, P.state) : void 0, cache: P.cache });
                      }), p.theme && Object.keys(p.theme).forEach(function(P) {
                        var k = p.theme[P];
                        if (k) {
                          var D = {};
                          Object.keys(k).forEach(function(B) {
                            var L = k[B], F = [];
                            L != null && L.length && L.forEach(function(V) {
                              F.push(O(O({}, V), { elementIds: N4(V.elementIds && S ? V.elementIds.map(function(G) {
                                var H;
                                return (H = S.get(G)) !== null && H !== void 0 ? H : G;
                              }) : V.elementIds) }));
                            }), D[B] = F;
                          }), g.theme[P] = D;
                        }
                      })), !((M = (I = p.dependency) === null || I === void 0 ? void 0 : I.on) === null || M === void 0) && M.length && (b = [], (E = p.dependency) === null || E === void 0 || E.on.forEach(function(P) {
                        var k = r[p.ref];
                        b.push(O(O({}, P), { elementIds: N4(P.elementIds && k ? P.elementIds.map(function(D) {
                          var B;
                          return (B = k.get(D)) !== null && B !== void 0 ? B : D;
                        }) : P.elementIds) }));
                      }), g.dependency.on = b), n.push(g), [2];
                  }
                });
              });
            }))];
          case 1:
            return a.sent(), [2, { cells: n, timestamp: this.timestamp, params: { interactionParams: Bl(this.plugin.managers.representation.interactionParams), showPolarHydrogenOnly: this.plugin.managers.representation.showPolarHydrogenOnly } }];
        }
      });
    });
  }, e.prototype.refresh = function() {
    var t, n, r, i = this.plugin;
    (t = i.canvas3d) === null || t === void 0 || t.pause(!0), (n = i.canvas3d) === null || n === void 0 || n.clear(), i.cells.forEach(function(a) {
      a.representations.forEach(function(o) {
        var s;
        !o.isHidden && o.state && ((s = i.canvas3d) === null || s === void 0 || s.add(o.state));
      });
    }), (r = i.canvas3d) === null || r === void 0 || r.animate();
  }, e.prototype.downloadAsImage = function(t, n) {
    var r, i;
    return se(this, 0, void 0, function() {
      var a, o, s, u, l, c, d, f, p, g, m, v, h, y;
      return ie(this, function(x) {
        switch (x.label) {
          case 0:
            if (a = n || { width: ((r = this.plugin.canvas3d) === null || r === void 0 ? void 0 : r.webgl.gl.drawingBufferWidth) || 0, height: ((i = this.plugin.canvas3d) === null || i === void 0 ? void 0 : i.webgl.gl.drawingBufferHeight) || 0 }, o = a.width, s = a.height, u = { x: 0, y: 0, width: 1, height: 1 }, (l = { x: Math.floor(u.x * o), y: Math.floor(u.y * s), width: Math.ceil(u.width * o), height: Math.ceil(u.height * s) }).width + l.x > o && (l.width = o - l.x), l.height + l.y > s && (l.height = s - l.y), o <= 0 || s <= 0) return [2];
            if (c = this.plugin.canvas3d, d = c.webgl.extensions, f = d.colorBufferFloat, p = d.textureFloat, g = c.props.postprocessing.occlusion, m = c.getImagePass({ transparentBackground: !0, cameraHelper: { axes: { name: "off", params: {} } }, multiSample: O(O({}, c.props.multiSample), { mode: "on", sampleLevel: f && p ? 4 : 2 }), postprocessing: O(O({}, c.props.postprocessing), { occlusion: g.name === "on" ? { name: "on", params: O(O({}, g.params), { samples: 128, resolutionScale: c.webgl.pixelRatio }) } : g }), marking: O({}, c.props.marking) }), v = m.getImageData(o, s, l), (h = document.createElement("canvas")).width = v.width, h.height = v.height, !(y = h.getContext("2d"))) throw new Error("Could not create canvas 2d context");
            return y.putImageData(v, 0, 0), [4, wZ(h, "png")];
          case 1:
            return FR(x.sent(), t), [2];
        }
      });
    });
  }, e;
}(), tre = { Dihedral: fe.Dihedral, Distance: fe.Distance, Angle: fe.Angle, Label: fe.Label, "Molecular Surface": fe.Surface }, nre = function() {
  function e(t) {
    var n = this;
    this.ev = Da.create(), this.prev = /* @__PURE__ */ new Map(), this.event = { change: this.ev(), add: this.ev(), remove: this.ev(), clear: this.ev() }, this.plugin = t, this.selection = /* @__PURE__ */ new Set(), this.event.change.subscribe(function(r) {
      var i = r.current, a = i.repr;
      if (i.loci.kind !== "empty-loci") {
        var o = tre[a.label];
        o === fe.Surface && (r.current.loci = r.current.repr.getLoci()), t.cells.forEach(function(s) {
          var u;
          s.representations.has(o) && ((u = s.representations.get(o)) === null || u === void 0 ? void 0 : u.state) === a && (n.selection.has(s.ref) ? r.button !== 2 && n.remove({ item: { ref: s.ref }, loci: r.current }) : n.add({ item: { ref: s.ref }, loci: r.current }));
        });
      } else n.clear();
    });
  }
  return e.prototype.add = function(t) {
    var n, r, i = t.item.ref;
    this.selection.add(i);
    var a = this.plugin.cells.get(i);
    if (a) {
      var o = Array.from(a.representations.values())[0];
      if (t != null && t.loci || o.state) {
        var s = (n = t.loci) !== null && n !== void 0 ? n : { repr: o.state, loci: o.state.getLoci() };
        (r = this.plugin.canvas3d) === null || r === void 0 || r.mark(s, lt.Select), this.event.add.next({ ref: i, loci: s }), this.prev.set(i, s), this.plugin.managers.selection.event.changed.next({});
      }
    }
  }, e.prototype.remove = function(t) {
    var n, r, i = t.item.ref;
    this.selection.delete(i);
    var a = this.plugin.cells.get(i);
    if (a) {
      var o = Array.from(a.representations.values())[0];
      if (o.state) {
        var s = (n = t.loci) !== null && n !== void 0 ? n : { repr: o.state, loci: o.state.getLoci() };
        (r = this.plugin.canvas3d) === null || r === void 0 || r.mark(s, lt.Deselect), this.event.remove.next({ ref: i, loci: s }), this.prev.delete(i), this.plugin.managers.selection.event.changed.next({});
      }
    }
  }, e.prototype.clear = function() {
    var t = this;
    this.selection.clear(), this.prev.forEach(function(n) {
      var r;
      (r = t.plugin.canvas3d) === null || r === void 0 || r.mark(n, lt.Deselect);
    }), this.prev.clear(), this.event.clear.next({}), this.plugin.managers.selection.event.changed.next({});
  }, e;
}(), rre = function() {
  function e(t) {
    var n = this;
    this.ev = Da.create(), this.lociGranularity = "residue", this.prev = [], this.event = { change: this.ev(), add: this.ev(), remove: this.ev(), clear: this.ev() }, this.plugin = t, this.selection = /* @__PURE__ */ new Map(), this.event.change.subscribe(function(r) {
      if (r.current.loci.kind === "element-loci" && n.plugin.cells.forEach(function(s, u) {
        var l;
        if (s != null && s.model.structure && Ls(s == null ? void 0 : s.model.structure) === Ls(r.current.loci.structure) || s.model.trajectory && (s == null ? void 0 : s.model.trajectory.state.getFrameAtIndex(s.model.trajectory.frameIndex).id) === Ls(r.current.loci.structure)) {
          var c = jn(s);
          r.current.loci = zn.normalize(Vr(c, Ai(r.current.loci)), n.lociGranularity, !0);
          var d = Ai(r.current.loci), f = new Set((l = n.selection.get(u)) !== null && l !== void 0 ? l : []), p = f.size ? d.filter(function(g) {
            return !f.has(g);
          }) : d;
          r.button !== 2 && p.length === 0 ? n.remove({ item: { ref: u, elementIds: d }, reprLoci: r.current }) : n.add({ item: { ref: u, elementIds: p }, reprLoci: r.current });
        }
      }), r.current.loci.kind === "bond-loci") {
        var i = r.current.loci;
        r.current.loci = zn.normalize(r.current.loci, n.lociGranularity, !0);
        var a = /* @__PURE__ */ new Set();
        i.bonds.forEach(function(s) {
          a.add(s.aUnit.elements[s.aIndex]), a.add(s.bUnit.elements[s.bIndex]);
        });
        var o = Ai(r.current.loci);
        n.plugin.cells.forEach(function(s, u) {
          var l;
          if (s != null && s.model.structure && Ls(s == null ? void 0 : s.model.structure) === Ls(i.bonds[0].aStructure)) {
            var c = new Set((l = n.selection.get(u)) !== null && l !== void 0 ? l : []), d = c.size ? o.filter(function(f) {
              return !c.has(f);
            }) : o;
            r.button !== 2 && d.length === 0 ? n.remove({ item: { ref: u, elementIds: o }, reprLoci: r.current }) : n.add({ item: { ref: u, elementIds: d }, reprLoci: r.current });
          }
        });
      }
      r.current.loci.kind === "empty-loci" && n.clear();
    });
  }
  return Object.defineProperty(e.prototype, "granularity", { get: function() {
    return vZ[this.lociGranularity];
  }, enumerable: !1, configurable: !0 }), e.prototype.getSelectionCellItems = function(t, n) {
    var r = this;
    t === void 0 && (t = !1), n === void 0 && (n = !1);
    var i = /* @__PURE__ */ new Map();
    n && Array.from(this.selection.keys()).forEach(function(o) {
      var s = r.plugin.managers.cell.get(o);
      if (s) {
        var u = Array.from(s.representations.entries()).filter(function(l) {
          var c = l[0];
          return A1.has(c);
        }).reduce(function(l, c) {
          c[0];
          var d = c[1], f = d.state ? dh(d.state) : [];
          return Re(Re([], l, !0), f, !0);
        }, []);
        i.set(o, new Set(u));
      }
    });
    var a = Array.from(this.selection).map(function(o) {
      var s = o[0], u = o[1], l = [];
      if (n) {
        var c = r.plugin.managers.cell.get(s), d = jn(c);
        u.forEach(function(f) {
          var p = d.units.filter(function(g) {
            return Me.has(g.elements, f);
          })[0];
          Ml(d, p, p.elements.indexOf(f), function(g, m) {
            var v;
            g.model.atomicHierarchy.derived.atom.atomicNumber[g.elements[m]] !== 1 || !((v = i.get(s)) === null || v === void 0) && v.has(g.elements[m]) || l.push(g.elements[m]);
          });
        });
      }
      return { ref: s, elementIds: Array.from(new Set(Re(Re([], u, !0), l, !0)).values()) };
    }).filter(function(o) {
      var s;
      return (s = o.elementIds) === null || s === void 0 ? void 0 : s.length;
    });
    return t && !a.length ? qO(this.plugin) : a;
  }, e.prototype.getSelection = function() {
    return Array.from(this.selection).reduce(function(t, n) {
      var r;
      return O(O({}, t), ((r = {})[n[0]] = n[1], r));
    }, {});
  }, e.prototype.add = function(t, n, r) {
    var i, a, o = this;
    n === void 0 && (n = !0), r === void 0 && (r = !1);
    var s = t.item, u = s.ref, l = s.elementIds;
    if (!l || l.length) {
      this.selection.set(u, Array.from(new Set(Re(Re([], (i = this.selection.get(u)) !== null && i !== void 0 ? i : [], !0), l ?? [], !0))));
      var c = this.plugin.cells.get(u);
      if (c) {
        var d = jn(c);
        if (d) {
          var f, p = this.selection.get(u);
          c == null || c.representations.forEach(function(g) {
            var m;
            if (!g.isHidden && g.state) {
              var v = n ? zn.normalize(ke.intersect(Vr(qa(g.state), p), Yi(g.state.getLoci())), o.lociGranularity, !0) : ke.intersect(Vr(qa(g.state), p), Yi(g.state.getLoci()));
              f = { loci: v, repr: g.state }, (m = o.plugin.canvas3d) === null || m === void 0 || m.mark(f, lt.Select);
            }
          }), this.prev.push({ ref: u, elementIds: l }), r || (this.event.add.next({ loci: (a = t.reprLoci) !== null && a !== void 0 ? a : { loci: Vr(d, p) }, item: t.item }), this.plugin.managers.selection.event.changed.next({}));
        }
      }
    } else console.warn("add selection, elementIds is empty");
  }, e.prototype.remove = function(t, n, r) {
    var i, a = this;
    n === void 0 && (n = !0), r === void 0 && (r = !1);
    var o = t.item, s = o.ref, u = o.elementIds;
    if (!u || u.length) {
      if (this.selection.has(s)) {
        var l = /* @__PURE__ */ new Set(), c = [], d = new Set(u);
        this.selection.get(s).forEach(function(v) {
          d.has(v) ? l.add(v) : c.push(v);
        }), c.length ? this.selection.set(s, c) : this.selection.delete(s);
        var f, p = this.plugin.cells.get(s), g = (i = this.selection.get(s)) !== null && i !== void 0 ? i : [];
        p == null || p.representations.forEach(function(v) {
          var h, y;
          if (!v.isHidden && v.state) {
            var x = n ? zn.normalize(ke.intersect(Vr(qa(v.state), g), Yi(v.state.getLoci())), a.lociGranularity, !0) : ke.intersect(Vr(qa(v.state), g), Yi(v.state.getLoci()));
            (h = a.plugin.canvas3d) === null || h === void 0 || h.mark({ loci: Yi(v.state.getLoci()), repr: v.state }, lt.Deselect), f = { loci: x, repr: v.state }, (y = a.plugin.canvas3d) === null || y === void 0 || y.mark(f, lt.Select);
          }
        });
        var m = [];
        this.prev.forEach(function(v) {
          var h = v.ref, y = v.elementIds;
          if (h === s) {
            var x = [];
            y == null || y.forEach(function(S) {
              l.has(S) || x.push(S);
            }), x.length && m.push({ ref: h, elementIds: x });
          }
        }), this.prev = m, r || (this.event.remove.next({ loci: f, item: t.item }), this.plugin.managers.selection.event.changed.next({}));
      }
    } else console.warn("remove selection, elementIds is empty");
  }, e.prototype.clear = function() {
    var t = this;
    Array.from(this.selection.keys()).forEach(function(n) {
      var r = t.plugin.cells.get(n);
      r && (r == null || r.representations.forEach(function(i) {
        var a;
        !i.isHidden && i.state && ((a = t.plugin.canvas3d) === null || a === void 0 || a.mark({ loci: Yi(i.state.getLoci()), repr: i.state }, lt.Deselect));
      }));
    }), this.selection.clear(), this.prev = [], this.event.clear.next({}), this.plugin.managers.selection.event.changed.next({});
  }, e.prototype.setGranularity = function(t) {
    this.lociGranularity = gZ[t];
  }, e.prototype.expand = function(t, n) {
    var r = this, i = n ?? this.getSelectionCellItems(), a = this.plugin.managers.cell.getAllDisplayedCellsRef(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), u = Cg(a.map(function(S) {
      return { ref: S };
    }), this.plugin), l = u.unitsMap, c = u.structure;
    l.forEach(function(S, b) {
      o.set(a[b], S.map(function(_) {
        return c.unitMap.get(_);
      })), S.forEach(function(_) {
        return s.set(_, a[b]);
      });
    });
    var d = CO(i.map(function(S) {
      var b, _ = o.get(S.ref), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
      _.forEach(function(M, E) {
        C.set(E, new Set(M.elements)), w.set(E, []);
      }), (b = S.elementIds) === null || b === void 0 || b.forEach(function(M) {
        C.forEach(function(E, T) {
          var P;
          E.has(M) && ((P = w.get(T)) === null || P === void 0 || P.push(_[T].elements.indexOf(M)));
        });
      });
      var I = Array.from(w.entries()).filter(function(M) {
        return M[0], M[1].length;
      }).map(function(M) {
        var E = M[0], T = M[1];
        return { unit: _[E], indices: T };
      });
      return I;
    })), f = ke(c, d), p = ke.toExpression(f), g = Ct.struct.modifier.union([Ct.struct.modifier.exceptBy({ 0: Ct.struct.modifier.includeSurroundings({ 0: p, radius: t.radius, "as-whole-residues": t.asWholeResidue }), by: p })]), m = gm(hm(c, g)), v = /* @__PURE__ */ new Map();
    m.units.forEach(function(S) {
      var b, _ = s.get(S.id);
      _ && (v.has(_) ? (b = v.get(_)) === null || b === void 0 || b.push.apply(b, S.elements) : v.set(_, Re([], S.elements, !0)));
    });
    var h = Array.from(v.entries()).map(function(S) {
      return { ref: S[0], elementIds: S[1] };
    }), y = A8(this.plugin, h), x = yZ[t.filter];
    t.excludeSelectedAtoms && this.clear(), Object.keys(y).forEach(function(S) {
      var b = [];
      x.forEach(function(_) {
        y[S][_].forEach(function(C) {
          return b.push.apply(b, C.elementIds);
        });
      }), r.add({ item: { ref: S, elementIds: b } }, !1);
    });
  }, e;
}(), NI = function() {
  function e(t) {
    this.ev = Da.create(), this.event = { changed: this.ev() }, this.plugin = t, this.structure = new rre(t), this.shape = new nre(t);
  }
  return e.prototype.clear = function() {
    this.structure.clear(), this.shape.clear();
  }, e;
}(), FI = function() {
  function e(t) {
    this.ev = Da.create(), this.allowEmptyClick = !0, this.allowSelect = !0, this.rightClick = this.ev(), this.plugin = t, this.allowEmptyClick = !0, this.allowSelect = !0;
  }
  return e.prototype.subscribe = function() {
    var t, n, r = this;
    (t = this.plugin.canvas3d) === null || t === void 0 || t.interaction.click.subscribe(function(i) {
      if (i.current.loci.kind === "empty-loci") {
        if (!r.allowEmptyClick || i.button === 2) return;
        r.plugin.managers.selection.shape.event.change.next(i), r.plugin.managers.selection.structure.event.change.next(i);
      } else if (r.allowSelect) i.current.repr.label === "Molecular Surface" || i.current.loci.kind === "group-loci" ? r.plugin.managers.selection.shape.event.change.next(i) : i.current.loci.kind !== "element-loci" && i.current.loci.kind !== "bond-loci" || r.plugin.managers.selection.structure.event.change.next(i);
      else if (i.button !== 2) return;
      i.button === 2 && r.rightClick.next({ loci: i.current, modifiers: i.modifiers, isEmpty: i.current.loci.kind === "empty-loci", isSelection: !1, reprType: SO[i.current.repr.label] });
    }), (n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.hover.subscribe(function(i) {
      i.current.loci.kind !== "empty-loci" ? r.plugin.managers.highlight.setHoverSelection(i.current) : r.plugin.managers.highlight.setHoverSelection();
    });
  }, e.prototype.setAllowEmptyClick = function(t) {
    this.allowEmptyClick = t;
  }, e.prototype.setAllowSelect = function(t) {
    this.allowSelect = t;
  }, e;
}(), ire = { interval: void 0, observers: void 0, cRef: "", elementId: -1, totalOffset: A.create(0, 0, 0) }, are = function() {
  function e(t) {
    this.state = ire, this.intervalTime = 300, this.plugin = t;
  }
  return e.prototype.start = function() {
    var t, n, r = this;
    this.plugin.managers.editor.disabledInteraction = ["click", "drag"], this.plugin.managers.selection.structure.setGranularity(Dt.Atom), this.state.observers = (t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.interaction.drag.observers.pop(), this.state.interval = setInterval(function() {
      if (r.state.totalOffset.filter(function(a) {
        return a !== 0;
      }).length !== 0 && r.state.elementId !== -1) {
        var i = Re([], r.state.totalOffset, !0);
        r.state.totalOffset = A.create(0, 0, 0), r.plugin.managers.editor.executeEdit(r.state.cRef, function(a, o) {
          var s = Re([], a, !0), u = Re([], o, !0);
          return s.forEach(function(l) {
            l.elementId === r.state.elementId && (l.x -= i[0], l.y -= i[1], l.z -= i[2]);
          }), { editedAtomList: s, editedBondList: u };
        }, function(a, o) {
          var s = Re([], a, !0), u = Re([], o, !0);
          return s.forEach(function(l) {
            l.elementId === r.state.elementId && (l.x -= i[0], l.y -= i[1], l.z -= i[2]);
          }), { editedAtomList: s, editedBondList: u };
        });
      }
    }, this.intervalTime), (n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.drag.subscribe(function(i) {
      var a = i.current.loci;
      if (a.kind === "element-loci") {
        var o = _e.toArray(a.elements[0].indices);
        if (o.length === 1) {
          r.plugin.cells.forEach(function(u, l) {
            u.model.structure && ke.isSubset(ze.toStructureElementLoci(u.model.structure), a) && (r.state.cRef = l);
          });
          var s = ER(r.plugin, i.pageStart, i.pageEnd);
          A.add(r.state.totalOffset, r.state.totalOffset, s), r.state.elementId = a.elements[0].unit.elements[o[0]];
        }
      }
    });
  }, e.prototype.end = function() {
    var t, n;
    this.state.interval && clearInterval(this.state.interval), (t = this.plugin.canvas3d) === null || t === void 0 || t.interaction.drag.observers.pop(), this.state.observers && ((n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.drag.subscribe(this.state.observers)), this.state.observers = void 0, this.state.cRef = "", this.state.elementId = -1, this.state.totalOffset = A.create(0, 0, 0);
  }, e;
}(), ore = { elementType: "C", drawClickObserver: void 0, position: void 0, isDelete: !1 }, sre = function() {
  function e(t) {
    this.ev = Da.create(), this.state = ore, this.event = { update: this.ev() }, this.plugin = t;
  }
  return e.prototype.setElementType = function(t) {
    this.state.elementType = t;
  }, e.prototype.setPosition = function(t) {
    this.state.position = t;
  }, e.prototype.setIsDelete = function(t) {
    this.state.isDelete = t;
  }, e.prototype.start = function() {
    var t, n, r = this;
    this.plugin.managers.editor.disabledInteraction = ["click"], this.plugin.managers.selection.structure.setGranularity(Dt.Atom), this.state.drawClickObserver = (t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.interaction.click.observers.pop(), (n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.click.subscribe(function(i) {
      return se(r, 0, void 0, function() {
        var a, o, s, u, l, c, d, f, p, g, m, v, h, y = this;
        return ie(this, function(x) {
          switch (x.label) {
            case 0:
              return i.current.loci && i.current.loci.kind === "element-loci" ? (a = i.current.loci, (o = _e.toArray(a.elements[0].indices)).length !== 1 ? [3, 5] : (this.plugin.cells.forEach(function(S, b) {
                S.model.structure && ke.isSubset(ze.toStructureElementLoci(S.model.structure), a) && (s = b);
              }), u = a.elements[0].unit.elements[o[0]], s ? this.state.isDelete ? [3, 2] : [4, this.plugin.managers.editor.editAtomType(this.state.elementType, [{ ref: s, elementIds: [u] }])] : [2])) : [3, 6];
            case 1:
              return x.sent(), [3, 4];
            case 2:
              return [4, this.plugin.managers.cell.remove([{ ref: s, elementIds: [u] }])];
            case 3:
              x.sent(), x.label = 4;
            case 4:
              this.event.update.next({ isUpdateHierarchy: !0, cRef: s }), x.label = 5;
            case 5:
              return [3, 9];
            case 6:
              return !i.current.loci || i.current.loci.kind !== "empty-loci" || this.state.isDelete ? [3, 9] : (l = Array.from(this.plugin.cells.entries()).filter(function(S) {
                S[0];
                var b = S[1];
                return b.model.structure && (Array.from(b.representations.values()).findIndex(function(_) {
                  return _.isHidden === !1;
                }) !== -1 || !b.representations.size);
              }), l.length ? (c = ((g = l[0][1].model.structure) === null || g === void 0 ? void 0 : g.units.length) === 0, (d = (((m = this.plugin.canvas3d) === null || m === void 0 ? void 0 : m.getPosition(i.page[0], i.page[1])) || { position: void 0 }).position) ? l.length !== 1 ? [3, 8] : (f = l[0][1].model.structure) ? (p = "".concat(Math.max.apply(Math, Array.from((h = (v = f.model) === null || v === void 0 ? void 0 : v.atomicConformation.atomId.toArray()) !== null && h !== void 0 ? h : [0])) + 1), [4, this.plugin.managers.editor.executeEdit(l[0][0], function(S, b) {
                return { editedAtomList: Re(Re([], S, !0), [sp(p, y.state.elementType, d)], !1), editedBondList: Re([], b, !0), affectedAtomIds: [+p] };
              }, function(S, b) {
                return { editedAtomList: Re(Re([], S, !0), [sp(p, y.state.elementType, d)], !1), editedBondList: Re([], b, !0) };
              })]) : [2] : [3, 9]) : (this.event.update.next({ hasMultiRef: !0 }), [2]));
            case 7:
              return x.sent(), this.event.update.next({ isUpdateHierarchy: !0, cRef: l[0][0], isEmpty: c }), [3, 9];
            case 8:
              this.setPosition(d), this.event.update.next({ hasMultiRef: !0, newAtom: sp("", this.state.elementType, d) }), x.label = 9;
            case 9:
              return [2];
          }
        });
      });
    });
  }, e.prototype.end = function() {
    var t, n;
    (t = this.plugin.canvas3d) === null || t === void 0 || t.interaction.click.observers.pop(), this.state.drawClickObserver && ((n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.click.subscribe(this.state.drawClickObserver)), this.state.drawClickObserver = void 0;
  }, e.prototype.addAtomByRef = function(t) {
    var n, r, i = this;
    if (this.state.position) {
      var a = this.plugin.cells.get(t);
      if (a) {
        var o = a.model.structure;
        if (o) {
          var s = "".concat(Math.max.apply(Math, Array.from((r = (n = o.model) === null || n === void 0 ? void 0 : n.atomicConformation.atomId.toArray()) !== null && r !== void 0 ? r : [0])) + 1);
          this.plugin.managers.editor.executeEdit(t, function(u, l) {
            return { editedAtomList: Re(Re([], u, !0), [sp(s, i.state.elementType, i.state.position)], !1), editedBondList: Re([], l, !0), affectedAtomIds: [+s] };
          }, function(u, l) {
            return { editedAtomList: Re(Re([], u, !0), [sp(s, i.state.elementType, i.state.position)], !1), editedBondList: Re([], l, !0) };
          }), this.setPosition();
        }
      }
    }
  }, e;
}(), ure = { interval: void 0, dragObserver: void 0, cRef: "", elementIds: [], unit: void 0, rotateOffset: A.create(0, 0, 0), rotateAtoms: [], arrowCRef: void 0, invert: !1, pointA: A.create(0, 0, 0), pointB: A.create(0, 0, 0) }, lre = function() {
  function e(t) {
    this.state = ure, this.intervalTime = 300, this.plugin = t;
  }
  return e.prototype.start = function() {
    var t, n, r;
    return se(this, 0, void 0, function() {
      var i, a = this;
      return ie(this, function(o) {
        switch (o.label) {
          case 0:
            return this.plugin.managers.editor.disabledInteraction = ["drag"], this.plugin.managers.selection.structure.setGranularity(Dt.Atom), this.state.dragObserver = (t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.interaction.drag.observers.pop(), i = function() {
              return se(a, 0, void 0, function() {
                var s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k;
                return ie(this, function(D) {
                  switch (D.label) {
                    case 0:
                      if (this.state.arrowCRef && (this.plugin.managers.cell.remove([{ ref: this.state.arrowCRef }]), this.state.arrowCRef = void 0), s = this.plugin.managers.selection.structure.selection, this.state.cRef = "", this.state.elementIds = [], this.state.unit = void 0, u = Array.from(s.entries()).filter(function(B) {
                        return B[0], B[1].length > 0;
                      }), u.length !== 1) return [3, 2];
                      if ((l = u[0][1]).length !== 2) return [3, 2];
                      if (this.state.cRef = u[0][0], this.state.elementIds = Re([], l, !0), !(c = (k = this.plugin.cells.get(u[0][0])) === null || k === void 0 ? void 0 : k.model.structure)) return [2];
                      for (d = c.units.find(function(B) {
                        return Me.has(B.elements, l[0]) && Me.has(B.elements, l[1]);
                      }), this.state.unit = d, p = (f = d).bonds, g = f.conformation, m = f.rings, v = f.elements, h = /* @__PURE__ */ new Map(), y = -1, x = 0, S = p.a.length; x < S; x++) {
                        if (y === -1 && (v[p.a[x]] === l[0] && v[p.b[x]] === l[1] && p.edgeProps.order[x] === 1 || v[p.a[x]] === l[1] && v[p.b[x]] === l[0] && p.edgeProps.order[x] === 1)) {
                          for (b = 0, _ = m.all.length; b < _; b++) if (m.all[b].includes(l[0]) && m.all[b].includes(l[1])) return [2];
                          y = x;
                        }
                        h.has(v[p.a[x]]) ? h.set(v[p.a[x]], Re(Re([], h.get(v[p.a[x]]), !0), [v[p.b[x]]], !1)) : h.set(v[p.a[x]], [v[p.b[x]]]);
                      }
                      return y !== -1 && h.get(l[0]).length > 1 && h.get(l[1]).length > 1 ? (C = this.state.invert ? 1 : 0, w = this.state.invert ? 0 : 1, this.state.pointA = A.create(g.x(l[w]), g.y(l[w]), g.z(l[w])), this.state.pointB = A.create(g.x(l[C]), g.y(l[C]), g.z(l[C])), I = this.state, [4, this.plugin.managers.representation.createOther({ data: { center: this.state.pointA, vec: A.create(this.state.pointB[0] - this.state.pointA[0], this.state.pointB[1] - this.state.pointA[1], this.state.pointB[2] - this.state.pointA[2]), color: Ae.fromRgb(255, 196, 36), alpha: 0.9 }, type: fe.RotateArrow })]) : [3, 2];
                    case 1:
                      for (I.arrowCRef = D.sent(), M = Re([], h.get(l[C]).filter(function(B) {
                        return B !== l[w] && B !== l[C];
                      }), !0), E = [l[C]], this.state.rotateAtoms = Re([], M, !0); M.length; ) T = M.shift(), (P = this.state.rotateAtoms).push.apply(P, h.get(T)), E.push(T), M.push.apply(M, h.get(T).filter(function(B) {
                        return !E.includes(B);
                      }));
                      this.state.rotateAtoms = Array.from(new Set(this.state.rotateAtoms.filter(function(B) {
                        return B !== l[w] && B !== l[C];
                      }))), D.label = 2;
                    case 2:
                      return [2];
                  }
                });
              });
            }, [4, i()];
          case 1:
            return o.sent(), this.plugin.managers.selection.structure.event.add.subscribe(function() {
              a.state.invert = !1, a.state.rotateOffset = A.create(0, 0, 0), a.state.rotateAtoms = [], a.state.cRef = "", a.state.elementIds = [], a.state.unit = void 0, i();
            }), this.plugin.managers.selection.structure.event.remove.subscribe(function() {
              a.state.invert = !1, a.state.rotateOffset = A.create(0, 0, 0), a.state.rotateAtoms = [], a.state.cRef = "", a.state.elementIds = [], a.state.unit = void 0, i();
            }), this.plugin.managers.selection.structure.event.clear.subscribe(function() {
              a.state.invert = !1, a.state.rotateOffset = A.create(0, 0, 0), a.state.rotateAtoms = [], a.state.cRef = "", a.state.elementIds = [], a.state.unit = void 0, a.state.arrowCRef && a.plugin.managers.cell.remove([{ ref: a.state.arrowCRef }]);
            }), (n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.click.subscribe(function(s) {
              s.current.loci.kind === "group-loci" && (s.current.repr ? s.current.repr.label === "RotateArrow" : s.current.loci.shape.name.split("-").shift() === "RotateArrow") && (a.state.invert = !a.state.invert, i());
            }), this.state.interval = setInterval(function() {
              if (a.state.rotateOffset.filter(function(d) {
                return d !== 0;
              }).length !== 0 && a.state.cRef && a.state.elementIds.length === 2 && a.state.rotateAtoms.length !== 0) {
                var s = a.state.elementIds, u = a.state.unit.conformation, l = A.angle(A.sub(A.create(0, 0, 0), a.state.pointA, a.state.pointB), A.create(a.state.rotateOffset[0], a.state.rotateOffset[1], a.state.rotateOffset[2]));
                A.cross(A.create(0, 0, 0), A.sub(A.create(0, 0, 0), a.state.pointA, a.state.pointB), A.create(a.state.rotateOffset[0], a.state.rotateOffset[1], a.state.rotateOffset[2]))[2] < 0 && (l = 2 * Math.PI - l);
                var c = 5 * A.distance(A.create(0, 0, 0), A.create(a.state.rotateOffset[0], a.state.rotateOffset[1], a.state.rotateOffset[2])) * (l < Math.PI && l > 0 ? -1 : 1);
                a.state.rotateOffset = A.create(0, 0, 0), a.plugin.managers.editor.executeEdit(a.state.cRef, function(d, f) {
                  var p = Re([], d, !0), g = Re([], f, !0);
                  return p.forEach(function(m) {
                    if (a.state.rotateAtoms.includes(m.elementId)) {
                      var v = AI([u.x(s[1]), u.y(s[1]), u.z(s[1])], [u.x(s[0]), u.y(s[0]), u.z(s[0])], c, [m.x, m.y, m.z]);
                      m.x = v[0], m.y = v[1], m.z = v[2];
                    }
                  }), { editedAtomList: p, editedBondList: g };
                }, function(d, f) {
                  var p = Re([], d, !0), g = Re([], f, !0);
                  return p.forEach(function(m) {
                    if (a.state.rotateAtoms.includes(m.elementId)) {
                      var v = AI([u.x(s[1]), u.y(s[1]), u.z(s[1])], [u.x(s[0]), u.y(s[0]), u.z(s[0])], c, [m.x, m.y, m.z]);
                      m.x = v[0], m.y = v[1], m.z = v[2];
                    }
                  }), { editedAtomList: p, editedBondList: g };
                });
              }
            }, this.intervalTime), (r = this.plugin.canvas3d) === null || r === void 0 || r.interaction.drag.subscribe(function(s) {
              if (a.state.rotateAtoms.length) {
                var u = ER(a.plugin, s.pageStart, s.pageEnd);
                a.state.rotateOffset[0] += u[0], a.state.rotateOffset[1] += u[1], a.state.rotateOffset[2] += u[2];
              }
            }), [2];
        }
      });
    });
  }, e.prototype.end = function() {
    var t, n, r;
    this.state.arrowCRef && (this.plugin.managers.cell.remove([{ ref: this.state.arrowCRef }]), this.state.arrowCRef = void 0), this.state.interval && clearInterval(this.state.interval), (t = this.plugin.canvas3d) === null || t === void 0 || t.interaction.drag.observers.pop(), this.state.dragObserver && ((n = this.plugin.canvas3d) === null || n === void 0 || n.interaction.drag.subscribe(this.state.dragObserver)), this.state.invert = !1, this.state.dragObserver = void 0, this.state.rotateOffset = A.create(0, 0, 0), this.state.rotateAtoms = [], this.state.elementIds = [], this.state.unit = void 0, this.plugin.managers.selection.structure.event.add.observers.pop(), this.plugin.managers.selection.structure.event.remove.observers.pop(), this.plugin.managers.selection.structure.event.clear.observers.pop(), (r = this.plugin.canvas3d) === null || r === void 0 || r.interaction.click.observers.pop();
  }, e;
}();
(function(e) {
  e[e.None = 0] = "None", e[e.Drag = 1] = "Drag", e[e.Rotate = 2] = "Rotate", e[e.Draw = 3] = "Draw";
})(Yo || (Yo = {})), function(e) {
  e[e.SINGLE = 1] = "SINGLE", e[e.DOUBLE = 2] = "DOUBLE", e[e.TRIPLE = 3] = "TRIPLE", e[e.AROMATIC = 4] = "AROMATIC", e[e.SINGLE_OR_DOUBLE = 5] = "SINGLE_OR_DOUBLE", e[e.SINGLE_OR_AROMATIC = 6] = "SINGLE_OR_AROMATIC", e[e.DOUBLE_OR_AROMATIC = 7] = "DOUBLE_OR_AROMATIC", e[e.ANY = 8] = "ANY";
}(c0 || (c0 = {}));
var VI = [c0.SINGLE, c0.DOUBLE, c0.TRIPLE], GI = function() {
  function e(t) {
    var n;
    this.state = { mode: Yo.None, editAtomDisabled: !1, addBondDisabled: !1, editBondDisabled: !1, selectedPdb: !1, isMergeNeeded: !1 }, this.ev = Da.create(), this.editStateUpdated = this.ev(), this.editStructureUpdated = this.ev(), this.plugin = t, this.instance = ((n = {})[Yo.Drag] = new are(t), n[Yo.Rotate] = new lre(t), n[Yo.Draw] = new sre(t), n[Yo.None] = void 0, n);
  }
  return Object.defineProperty(e.prototype, "isEditing", { get: function() {
    var t;
    return !!(!((t = this.plugin.canvas3d) === null || t === void 0) && t.controls.isEditing);
  }, set: function(t) {
    var n, r, i = ((n = this.plugin.canvas3d) === null || n === void 0 ? void 0 : n.controls.isEditing) === !1 && t;
    if ((r = this.plugin.canvas3d) === null || r === void 0 || r.controls.setEditState(t), i && this.setState(this.getEditState()), !t) {
      var a = [];
      this.plugin.cells.forEach(function(o, s) {
        o.representations.has(fe.RotateArrow) && a.push({ ref: s });
      }), this.plugin.managers.cell.remove(a);
    }
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "disabledInteraction", { get: function() {
    var t;
    return ((t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.controls.disabledInteraction) || [];
  }, set: function(t) {
    var n;
    (n = this.plugin.canvas3d) === null || n === void 0 || n.controls.setDisabledInteractionState(t);
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "isLockCamera", { get: function() {
    var t;
    return !!(!((t = this.plugin.canvas3d) === null || t === void 0) && t.controls.isLockCamera);
  }, set: function(t) {
    var n;
    (n = this.plugin.canvas3d) === null || n === void 0 || n.controls.setLockCameraState(t);
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "drawEditor", { get: function() {
    return this.instance[Yo.Draw];
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "rotateEditor", { get: function() {
    return this.instance[Yo.Rotate];
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "dragEditor", { get: function() {
    return this.instance[Yo.Drag];
  }, enumerable: !1, configurable: !0 }), e.prototype.setState = function(t) {
    Object.assign(this.state, t), this.editStateUpdated.next(this.state);
  }, e.prototype.setEditorMode = function(t, n, r) {
    n === void 0 && (n = !1), r === void 0 && (r = ["click", "drag"]), this.isEditing = t, this.isLockCamera = n, this.disabledInteraction = r;
  }, e.prototype.getEditState = function() {
    var t, n, r, i, a = this, o = !0, s = !0, u = !0, l = !1, c = !1;
    if (!this.isEditing) return { editAtomDisabled: o, addBondDisabled: s, editBondDisabled: u, selectedPdb: l, isMergeNeeded: c };
    var d = this.plugin.managers.selection.structure.selection, f = [];
    if (d.forEach(function(y, x) {
      f.push(x), l = l || a.plugin.managers.cell.isFromPdb(x);
    }), f.length > 0) for (var p = 0, g = f.length; p < g; p++) {
      var m = f[p];
      d.has(m) && (o = !1);
    }
    if (f.length === 0 || f.length > 2) return { editAtomDisabled: o, addBondDisabled: s, editBondDisabled: u, selectedPdb: l, isMergeNeeded: c };
    if (f.length === 2) (v = Re(Re([], (t = d.get(f[0])) !== null && t !== void 0 ? t : [], !0), (n = d.get(f[1])) !== null && n !== void 0 ? n : [], !0)).length === 2 && (s = !1, c = !0);
    else if (f.length === 1) {
      var v;
      if (((v = d.get(f[0])) == null ? void 0 : v.length) === 2) {
        s = !1;
        var h = this.plugin.cells.get(f[0]);
        !((r = h == null ? void 0 : h.model.structure) === null || r === void 0) && r.units.length && ((i = h == null ? void 0 : h.model.structure) === null || i === void 0 ? void 0 : i.units[0]).bonds.getEdgeIndex(v[0], v[1]) !== -1 && (u = !1);
      }
    }
    return { editAtomDisabled: o, addBondDisabled: s, editBondDisabled: u, selectedPdb: l, isMergeNeeded: c };
  }, e.prototype.coverStructure = function(t, n, r) {
    return se(this, 0, void 0, function() {
      var i, a, o, s = this;
      return ie(this, function(u) {
        switch (u.label) {
          case 0:
            return i = r.format, a = r.data, [4, this.plugin.managers.representation.updateMolecular({ ref: t, structure: n })];
          case 1:
            return (o = u.sent()).model.structure = n, this.plugin.managers.cell.update(t, { model: o.model, representations: Array.from(o.representations.values()), assets: [{ format: i, data: a }] }), this.editStructureUpdated.next(t), this.plugin.managers.cell.traverse(function(l, c) {
              c.type === fe.IntraInteractions && s.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.editor.executeEdit");
            }), [2];
        }
      });
    });
  }, e.prototype.executeEdit = function(t, n, r, i) {
    var a, o, s;
    return se(this, 0, void 0, function() {
      var u, l, c, d, f, p = this;
      return ie(this, function(g) {
        switch (g.label) {
          case 0:
            return u = this.plugin.cells.get(t), (l = (a = u == null ? void 0 : u.model) === null || a === void 0 ? void 0 : a.structure) ? [4, tJ(l, n, r, i)] : [2];
          case 1:
            return (c = g.sent()).length <= 0 ? [2] : [4, this.plugin.managers.representation.updateMolecular({ ref: t, structure: c[0] })];
          case 2:
            return (d = g.sent()).model.structure = c[0], f = ((s = (o = yo(c[0])) === null || o === void 0 ? void 0 : o.sourceData) === null || s === void 0 ? void 0 : s.kind) !== "mmCIF" ? pn.Sdf : pn.Pdb, this.plugin.managers.cell.update(t, { model: d.model, representations: Array.from(d.representations.values()), assets: [{ format: f, data: C3(c[0], f) }] }), this.editStructureUpdated.next(t), this.plugin.managers.cell.traverse(function(m, v) {
              v.type === fe.IntraInteractions && p.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.editor.executeEdit");
            }), [2];
        }
      });
    });
  }, e.prototype.coverSourceData = function(t, n, r, i) {
    var a, o, s, u, l, c, d;
    return se(this, 0, void 0, function() {
      var f, p, g, m, v, h, y, x, S, b, _, C = this;
      return ie(this, function(w) {
        switch (w.label) {
          case 0:
            return this.plugin.cells.has(t) ? (g = (p = Nl[n]).parse, [4, ff(r)]) : [2];
          case 1:
            return [4, g.apply(p, [w.sent()])];
          case 2:
            return f = w.sent(), i ? ((m = this.plugin.cells.get(t)) == null || m.representations.forEach(function(I) {
              var M;
              I.state && ((M = C.plugin.canvas3d) === null || M === void 0 || M.remove(I.state));
            }), this.plugin.managers.cell.update(t, { model: { structure: f[0] }, representations: [], assets: [{ format: n, data: r }] }), m.representations = /* @__PURE__ */ new Map(), [4, this.plugin.managers.representation.setMolecularRepr([{ ref: t, elementIds: vo(f[0]) }], i, !1)]) : [3, 4];
          case 3:
            return w.sent(), v = this.plugin.managers.selection.structure.getSelection(), h = (a = v[t]) !== null && a !== void 0 ? a : [], (y = (o = this.plugin.cells.get(t)) === null || o === void 0 ? void 0 : o.representations.get(i)) && (x = Vr(qa(y.state), h), (s = this.plugin.canvas3d) === null || s === void 0 || s.mark({ loci: x, repr: y.state }, lt.Select)), [2];
          case 4:
            return [4, this.plugin.managers.representation.updateMolecular({ ref: t, structure: f[0] })];
          case 5:
            return (S = w.sent()).model.structure = f[0], this.plugin.managers.cell.update(t, { model: S.model, representations: Array.from(S.representations.values()), assets: [{ format: n, data: r }] }), b = this.plugin.managers.selection.structure.getSelection(), _ = (u = b[t]) !== null && u !== void 0 ? u : [], (l = this.plugin.cells.get(t)) === null || l === void 0 || l.representations.values(), Array.from((d = (c = this.plugin.cells.get(t)) === null || c === void 0 ? void 0 : c.representations.values()) !== null && d !== void 0 ? d : []).forEach(function(I) {
              var M, E = Vr(qa(I.state), _);
              (M = C.plugin.canvas3d) === null || M === void 0 || M.mark({ loci: E, repr: I.state }, lt.Select);
            }), this.plugin.managers.cell.traverse(function(I, M) {
              M.type === fe.IntraInteractions && C.plugin.managers.representation.showGlobalInteraction(!0, "lightPlugin.managers.editor.coverSourceData");
            }), [2];
        }
      });
    });
  }, e.prototype.edit = function(t, n) {
    return se(this, 0, void 0, function() {
      var r, i, a, o = this;
      return ie(this, function(s) {
        switch (s.label) {
          case 0:
            return r = this.isLockCamera, this.isLockCamera = !0, i = n ?? this.plugin.managers.selection.structure.getSelectionCellItems(), [4, Promise.all(i.map(function(u) {
              var l = u.ref, c = u.elementIds;
              return t(l, c ?? []);
            }))];
          case 1:
            return s.sent(), a = this.plugin.managers.selection.structure.getSelection(), i.forEach(function(u) {
              var l, c, d = u.ref, f = o.plugin.cells.get(d), p = (l = a[d]) !== null && l !== void 0 ? l : [];
              Array.from((c = f == null ? void 0 : f.representations.values()) !== null && c !== void 0 ? c : []).forEach(function(g) {
                var m, v = Vr(qa(g.state), p);
                (m = o.plugin.canvas3d) === null || m === void 0 || m.mark({ loci: v, repr: g.state }, lt.Select);
              });
            }), this.isLockCamera = r, [2];
        }
      });
    });
  }, e.prototype.deleteAtoms = function(t) {
    return se(this, 0, void 0, function() {
      var n, r, i = this;
      return ie(this, function(a) {
        switch (a.label) {
          case 0:
            return n = {}, r = function(o, s) {
              return i.executeEdit(o, function(u, l) {
                var c = new Set(s), d = /* @__PURE__ */ new Map(), f = [];
                u.forEach(function(g) {
                  var m = c.has(g.elementId);
                  return m || (n[g.elementId] = f.length, f.push(O({}, g)), d.set(g.elementId + 1, f.length)), !m;
                });
                var p = l.filter(function(g) {
                  var m = c.has(g.a - 1) || c.has(g.b - 1);
                  return d.has(g.a) && (g.a = d.get(g.a)), d.has(g.b) && (g.b = d.get(g.b)), !m;
                });
                return { editedAtomList: f, editedBondList: p };
              }, function(u, l) {
                var c = new Set(s), d = [];
                u.forEach(function(p) {
                  c.has(p.elementId) || (n[p.elementId] = d.length, d.push(p));
                });
                var f = Re([], l, !0);
                return { editedAtomList: d, editedBondList: f, affectedAtomIds: [] };
              });
            }, [4, this.edit(r, t)];
          case 1:
            return a.sent(), [2, n];
        }
      });
    });
  }, e.prototype.editAtomCharge = function(t, n) {
    var r = this;
    return this.edit(function(i, a) {
      return r.executeEdit(i, function(o, s) {
        var u = new Set(a), l = Re([], o, !0), c = Re([], s, !0), d = [];
        return l.forEach(function(f) {
          if (u.has(f.elementId)) {
            var p = f.charge !== void 0 ? f.charge + t : t;
            p <= 3 && p >= -3 && (f.charge = p, d.push(parseInt(f.atom_id, 10)));
          }
        }), { editedAtomList: l, editedBondList: c, affectedAtomIds: d };
      }, function(o, s) {
        var u = new Set(a), l = Re([], o, !0), c = Re([], s, !0), d = [];
        return l.forEach(function(f) {
          if (u.has(f.elementId)) {
            var p = f.charge !== void 0 ? f.charge + t : t;
            p <= 3 && p >= -3 && (f.charge = p, d.push(parseInt(f.atom_id, 10)));
          }
        }), { editedAtomList: l, editedBondList: c, affectedAtomIds: d };
      });
    }, n);
  }, e.prototype.editAtomType = function(t, n) {
    var r = this, i = t ?? this.instance[Yo.Draw].state.elementType;
    return this.edit(function(a, o) {
      return r.executeEdit(a, function(s, u) {
        var l = new Set(o), c = Re([], s, !0), d = Re([], u, !0), f = [];
        return c.forEach(function(p) {
          l.has(p.elementId) && (p.auth_atom_id = i, p.type_symbol = i, f.push(parseInt(p.atom_id, 10)));
        }), { editedAtomList: c, editedBondList: d, affectedAtomIds: f };
      }, function(s, u) {
        var l = new Set(o), c = Re([], s, !0), d = Re([], u, !0), f = [];
        return c.forEach(function(p) {
          l.has(p.elementId) && (p.auth_atom_id = i, p.type_symbol = i, f.push(parseInt(p.atom_id, 10)));
        }), { editedAtomList: c, editedBondList: d, affectedAtomIds: f };
      });
    }, n);
  }, e.prototype.editBondOrder = function(t, n) {
    var r = this;
    return this.edit(function(i, a) {
      return r.executeEdit(i, function(o, s) {
        var u = Re([], o, !0), l = Re([], s, !0), c = /* @__PURE__ */ new Set();
        return l.forEach(function(d) {
          if (d.a - 1 === a[0] && d.b - 1 === a[1] || d.a - 1 === a[1] && d.b - 1 === a[0]) {
            var f = d.order + t;
            VI.includes(f) && (d.order = f, c.add(d.a - 1), c.add(d.b - 1));
          }
        }), { editedAtomList: u, editedBondList: l, affectedAtomIds: Array.from(c) };
      }, function(o, s) {
        var u = Re([], o, !0), l = Re([], s, !0), c = /* @__PURE__ */ new Set();
        return l.forEach(function(d) {
          if (d.a === a[0] && d.b === a[1] || d.a === a[1] && d.b === a[0]) {
            var f = d.order + t;
            VI.includes(f) && (d.order = f, c.add(d.atom_idA === void 0 ? d.a - 1 : parseInt(d.atom_idA, 10)), c.add(d.atom_idB === void 0 ? d.b - 1 : parseInt(d.atom_idB, 10)));
          }
        }), { editedAtomList: u, editedBondList: l, affectedAtomIds: Array.from(c) };
      });
    }, n);
  }, e.prototype.addOrDelBond = function(t, n) {
    var r, i = this;
    if (!n || n.length === 1 && ((r = n[0].elementIds) === null || r === void 0 ? void 0 : r.length) === 2) {
      if (!n) {
        var a = this.plugin.managers.selection.structure.selection;
        if (a.size !== 1 && Array.from(a.values())[0].length !== 2) return;
      }
      return this.edit(function(o, s) {
        return i.executeEdit(o, function(u, l) {
          var c = Re([], u, !0), d = Re([], l, !0), f = Re([], s, !0);
          return t ? d.filter(function(p) {
            return p.a - 1 === s[0] && p.b - 1 === s[1] || p.a - 1 === s[1] && p.b - 1 === s[0];
          }).length === 0 && d.push({ a: s[0] + 1, b: s[1] + 1, order: 1 }) : d = d.filter(function(p) {
            return !(p.a - 1 === s[0] && p.b - 1 === s[1] || p.a - 1 === s[1] && p.b - 1 === s[0]);
          }), { editedAtomList: c, editedBondList: d, affectedAtomIds: f };
        }, function(u, l) {
          var c, d = Re([], u, !0), f = Re([], l, !0), p = [];
          if (t) {
            if (f.filter(function(y) {
              return y.a === s[0] && y.b === s[1] || y.a === s[1] && y.b === s[0];
            }).length === 0) {
              var g = (c = i.plugin.cells.get(o)) === null || c === void 0 ? void 0 : c.model.structure;
              if (g && g.units.length > 0) {
                var m = g.units[0], v = m.model.atomicConformation.atomId.value(s[0]), h = m.model.atomicConformation.atomId.value(s[1]);
                f.push({ a: s[0], b: s[1], order: 1, atom_idA: "".concat(v), atom_idB: "".concat(h) }), p.push(v, h);
              }
            }
          } else f = f.filter(function(y) {
            return !(y.a === s[0] && y.b === s[1] || y.a === s[1] && y.b === s[0]) || (p.push(y.atom_idA === void 0 ? y.a - 1 : parseInt(y.atom_idA, 10), y.atom_idB === void 0 ? y.b - 1 : parseInt(y.atom_idB, 10)), !1);
          });
          return { editedAtomList: d, editedBondList: f, affectedAtomIds: p };
        });
      }, n);
    }
  }, e.prototype.changeEditorMode = function(t) {
    var n = this.instance[this.state.mode];
    this.isLockCamera = !1, this.disabledInteraction = [], n && n.end();
    var r = this.instance[t];
    r && (this.isEditing = !0, this.isLockCamera = !0, r.start()), this.setState({ mode: t });
  }, e.prototype.start = function() {
    var t = this;
    this.plugin.managers.selection.event.changed.subscribe(function() {
      t.setState(t.getEditState());
    });
  }, e;
}(), zI = function() {
  function e(t) {
    this.ev = Da.create(), this.info = this.ev(), this.handleHighlightLocis = [], this.plugin = t;
  }
  return e.prototype.setHoverSelection = function(t, n) {
    var r, i, a, o = this;
    if (n === void 0 && (n = !0), this.hoverLoci && ((r = this.plugin.canvas3d) === null || r === void 0 || r.mark(this.hoverLoci, lt.RemoveHighlight)), !((i = this.handleHighlightLocis) === null || i === void 0) && i.length && this.handleHighlightLocis.forEach(function(u) {
      var l;
      (l = o.plugin.canvas3d) === null || l === void 0 || l.mark(u, lt.RemoveHighlight);
    }), t) {
      var s = { loci: zn.normalize(t.loci, this.plugin.managers.selection.structure.lociGranularity), repr: t.repr };
      (a = this.plugin.canvas3d) === null || a === void 0 || a.mark(s, lt.Highlight), this.hoverLoci = s, n && this.info.next({ loci: s, info: this.createHighlightInfo(s) });
    } else this.info.next({});
  }, e.prototype.addHighlightLocis = function(t, n) {
    var r, i = this;
    n === void 0 && (n = !0), n && (this.handleHighlightLocis.forEach(function(a) {
      var o;
      (o = i.plugin.canvas3d) === null || o === void 0 || o.mark(a, lt.RemoveHighlight);
    }), this.handleHighlightLocis = []), t.forEach(function(a) {
      var o;
      (o = i.plugin.canvas3d) === null || o === void 0 || o.mark(a, lt.Highlight);
    }), (r = this.handleHighlightLocis).push.apply(r, t);
  }, e.prototype.createHighlightInfo = function(t) {
    if (t.loci.kind === "element-loci") {
      var n = "";
      if (Array.from(this.plugin.cells.entries()).some(function(m) {
        var v = m[0], h = m[1];
        return !(n || !jn(h) || Ls(jn(h)) !== Ls(t.loci.structure)) && (n = v, !0);
      }), !n) return;
      var r, i = this.plugin.cells.get(n), a = "";
      if (Object.entries(pr).forEach(function(m) {
        var v = m[0];
        m[1].includes(SO[t.repr.label]) && (r = v);
      }), r && i.theme.color && i.theme.color[r]) {
        var o = i.theme.color[r], s = Ai(t.loci);
        o.forEach(function(m) {
          var v = new Set(m.elementIds);
          s.filter(function(h) {
            return !v.has(h);
          }).length === 0 && (a = m.name);
        });
      }
      return p = O({ type: u0.Structure, ref: n, colorThemeName: a }, bZ(t.loci, this.plugin.managers.selection.structure.granularity));
    }
    if (t.loci.kind === "data-loci" && t.loci.tag === "interactions") {
      var u = "", l = "", c = t.loci.elements[0], d = c.unitA, f = c.unitB;
      Array.from(this.plugin.cells.entries()).some(function(m) {
        var v = m[0], h = m[1];
        if (u && l) return !0;
        if (h.model.structure) {
          var y = Ls(h.model.structure);
          y === d.model.id && (u = v), y === f.model.id && (l = v);
        }
        return !1;
      });
      var p = O({ type: u0.Interaction }, _Z(t.loci));
      return Object.assign(p.infoA, { ref: u }), Object.assign(p.infoB, { ref: l }), p;
    }
    if (t.loci.kind === "group-loci") return {};
    if (t.loci.kind === "bond-loci") {
      var g = "";
      return Array.from(this.plugin.cells.entries()).some(function(m) {
        var v = m[0], h = m[1];
        return !(g || !h.model.structure || Ls(h.model.structure) !== Ls(t.loci.structure)) && (g = v, !0);
      }), p = { infoA: Ou(t.loci.bonds[0].aUnit, t.loci.bonds[0].aUnit.elements[t.loci.bonds[0].aIndex]), infoB: Ou(t.loci.bonds[0].bUnit, t.loci.bonds[0].bUnit.elements[t.loci.bonds[0].bIndex]), ref: g, type: u0.Bond };
    }
  }, e.prototype.clear = function() {
    this.hoverLoci = void 0;
  }, e;
}(), cre = [["viewport", "Viewport"], ["hd", "HD (1280 * 720 pixels)"], ["full-hd", "Full HD (1920 x 1080 pixels)"], ["ultra-hd", "Ultra HD (3840 x 2160 pixels)"], ["custom", "Custom"]], UI = function() {
  function e(t) {
    this.plugin = t, this.ev = Da.create(), this._params = void 0, this.behaviors = { values: this.ev.behavior({ transparent: this.params.transparent.defaultValue, axes: { name: "off", params: {} }, resolution: this.params.resolution.defaultValue }), cropParams: this.ev.behavior({ auto: !1, relativePadding: 0.1 }), relativeCrop: this.ev.behavior({ x: 0, y: 0, width: 1, height: 1 }) }, this.events = { previewed: this.ev() }, this._previewPass = void 0, this._imagePass = void 0, this.canvas = document.createElement("canvas"), this.previewCanvas = document.createElement("canvas"), this.previewData = { image: { data: new Uint8ClampedArray(1), width: 1, height: 0 }, background: Ae(0), transparent: !1 };
  }
  return e.prototype.createParams = function() {
    var t = Math.min(this.plugin.canvas3d ? this.plugin.canvas3d.webgl.maxRenderbufferSize : 4096, 4096);
    return { resolution: N.MappedStatic("ultra-hd", { viewport: N.Group({}), hd: N.Group({}), "full-hd": N.Group({}), "ultra-hd": N.Group({}), custom: N.Group({ width: N.Numeric(1920, { min: 128, max: t, step: 1 }), height: N.Numeric(1080, { min: 128, max: t, step: 1 }) }, { isFlat: !0 }) }, { options: cre }), transparent: N.Boolean(!1), axes: x3.axes };
  }, Object.defineProperty(e.prototype, "params", { get: function() {
    return this._params ? this._params : this._params = this.createParams();
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "values", { get: function() {
    return this.behaviors.values.value;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "cropParams", { get: function() {
    return this.behaviors.cropParams.value;
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "relativeCrop", { get: function() {
    return this.behaviors.relativeCrop.value;
  }, enumerable: !1, configurable: !0 }), e.prototype.getCanvasSize = function() {
    var t, n;
    return { width: ((t = this.plugin.canvas3d) === null || t === void 0 ? void 0 : t.webgl.gl.drawingBufferWidth) || 0, height: ((n = this.plugin.canvas3d) === null || n === void 0 ? void 0 : n.webgl.gl.drawingBufferHeight) || 0 };
  }, e.prototype.getSize = function() {
    var t = this.values;
    switch (t.resolution.name) {
      case "viewport":
        return this.getCanvasSize();
      case "hd":
        return { width: 1280, height: 720 };
      case "full-hd":
        return { width: 1920, height: 1080 };
      case "ultra-hd":
        return { width: 3840, height: 2160 };
      default:
        return { width: t.resolution.params.width, height: t.resolution.params.height };
    }
  }, e.prototype.createPass = function(t) {
    var n = this.plugin.canvas3d, r = n.webgl.extensions, i = r.colorBufferFloat, a = r.textureFloat, o = n.props.postprocessing.occlusion;
    return n.getImagePass({ transparentBackground: this.values.transparent, cameraHelper: { axes: this.values.axes }, multiSample: { mode: t ? "on" : "off", sampleLevel: i && a ? 4 : 2 }, postprocessing: O(O({}, n.props.postprocessing), { occlusion: o.name === "on" ? { name: "on", params: O(O({}, o.params), { samples: 128, resolutionScale: 1 }) } : o }), marking: O({}, n.props.marking) });
  }, Object.defineProperty(e.prototype, "previewPass", { get: function() {
    return this._previewPass || (this._previewPass = this.createPass(!1));
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "imagePass", { get: function() {
    if (this._imagePass) {
      var t = this.plugin.canvas3d, n = t.props.postprocessing.occlusion;
      return this._imagePass.setProps({ cameraHelper: { axes: this.values.axes }, transparentBackground: this.values.transparent, postprocessing: O(O({}, t.props.postprocessing), { occlusion: n.name === "on" ? { name: "on", params: O(O({}, n.params), { samples: 128, resolutionScale: 1 }) } : n }), marking: O({}, t.props.marking) }), this._imagePass;
    }
    return this._imagePass = this.createPass(!0);
  }, enumerable: !1, configurable: !0 }), e.prototype.resetCrop = function() {
    this.behaviors.relativeCrop.next({ x: 0, y: 0, width: 1, height: 1 });
  }, e.prototype.toggleAutocrop = function() {
    this.cropParams.auto ? (this.behaviors.cropParams.next(O(O({}, this.cropParams), { auto: !1 })), this.resetCrop()) : this.behaviors.cropParams.next(O(O({}, this.cropParams), { auto: !0 }));
  }, Object.defineProperty(e.prototype, "isFullFrame", { get: function() {
    var t = this.relativeCrop;
    return Ar(t.x, 0, 1e-5) && Ar(t.y, 0, 1e-5) && Ar(t.width, 1, 1e-5) && Ar(t.height, 1, 1e-5);
  }, enumerable: !1, configurable: !0 }), e.prototype.autocrop = function(t) {
    t === void 0 && (t = this.cropParams.relativePadding);
    for (var n = this.previewData.image, r = n.data, i = n.width, a = n.height, o = this.previewData.transparent, s = o ? this.previewData.background : 4278190080 | this.previewData.background, u = i, l = 0, c = a, d = 0, f = 0; f < a; f++) for (var p = f * i, g = 0; g < i; g++) {
      var m = 4 * (p + g);
      if (o) {
        if (r[m + 3] === 0) continue;
      } else if ((r[m] << 16 | r[m + 1] << 8 | r[m + 2] | r[m + 3] << 24) === s) continue;
      g < u && (u = g), g > l && (l = g), f < c && (c = f), f > d && (d = f);
    }
    if (u > l) {
      var v = u;
      u = l, l = v;
    }
    c > d && (v = c, c = d, d = v);
    var h = l - u + 1, y = d - c + 1;
    u -= t * h, l += t * h, c -= t * y, d += t * y;
    var x = { x: Math.max(0, u / i), y: Math.max(0, c / a), width: Math.min(1, (l - u + 1) / i), height: Math.min(1, (d - c + 1) / a) };
    this.behaviors.relativeCrop.next(x);
  }, e.prototype.getPreview = function(t) {
    t === void 0 && (t = 320);
    var n = this.getSize(), r = n.width, i = n.height;
    if (!(r <= 0 || i <= 0)) {
      var a = r / i, o = 0, s = 0;
      a > 1 ? (o = t, s = Math.round(t / a)) : (s = t, o = Math.round(t * a));
      var u = this.plugin.canvas3d.props;
      this.previewPass.setProps({ cameraHelper: { axes: this.values.axes }, transparentBackground: this.values.transparent, postprocessing: u.postprocessing, marking: u.marking });
      var l = this.previewPass.getImageData(o, s), c = this.previewCanvas;
      c.width = l.width, c.height = l.height, this.previewData.image = l, this.previewData.background = u.renderer.backgroundColor, this.previewData.transparent = this.values.transparent;
      var d = c.getContext("2d");
      if (!d) throw new Error("Could not create canvas 2d context");
      return d.putImageData(l, 0, 0), this.cropParams.auto && this.autocrop(), this.events.previewed.next(void 0), { canvas: c, width: o, height: s };
    }
  }, e.prototype.getSizeAndViewport = function() {
    var t = this.getSize(), n = t.width, r = t.height, i = this.relativeCrop, a = { x: Math.floor(i.x * n), y: Math.floor(i.y * r), width: Math.ceil(i.width * n), height: Math.ceil(i.height * r) };
    return a.width + a.x > n && (a.width = n - a.x), a.height + a.y > r && (a.height = r - a.y), { width: n, height: r, viewport: a };
  }, e.prototype.draw = function() {
    return se(this, 0, void 0, function() {
      var t, n, r, i, a, o, s;
      return ie(this, function(u) {
        if (t = this.getSizeAndViewport(), n = t.width, r = t.height, i = t.viewport, n <= 0 || r <= 0) return [2];
        if (a = this.imagePass.getImageData(n, r, i), (o = this.canvas).width = a.width, o.height = a.height, !(s = o.getContext("2d"))) throw new Error("Could not create canvas 2d context");
        return s.putImageData(a, 0, 0), [2];
      });
    });
  }, e.prototype.getImageDataUri = function() {
    return se(this, 0, void 0, function() {
      return ie(this, function(t) {
        switch (t.label) {
          case 0:
            return [4, this.draw()];
          case 1:
            return t.sent(), [2, this.canvas.toDataURL("png")];
        }
      });
    });
  }, e.prototype.copyToClipboard = function() {
    return se(this, 0, void 0, function() {
      var t, n, r;
      return ie(this, function(i) {
        switch (i.label) {
          case 0:
            return (t = navigator.clipboard) != null && t.write ? [4, this.draw()] : [2];
          case 1:
            return i.sent(), [4, iw(this.canvas, "png")];
          case 2:
            return n = i.sent(), r = new ClipboardItem({ "image/png": n }), [4, t.write([r])];
          case 3:
            return i.sent(), [2];
        }
      });
    });
  }, e.prototype.getAxesScale = function() {
    var t = this.getSize(), n = t.width * t.height;
    switch (!0) {
      case n <= 921600:
        return 0.22;
      case n <= 2073600:
        return 0.33;
      case n <= 8294400:
        return 0.5;
      default:
        return 0.65;
    }
  }, e.prototype.download = function(t) {
    return se(this, 0, void 0, function() {
      return ie(this, function(n) {
        switch (n.label) {
          case 0:
            return this.behaviors.values.next({ transparent: this.values.transparent, axes: O(O({}, this.values.axes), { params: O(O(O({}, this.params.axes.defaultValue), this.values.axes.params), { scale: this.getAxesScale() }) }), resolution: this.values.resolution }), [4, this.draw()];
          case 1:
            return n.sent(), this.behaviors.cropParams.next(O(O({}, this.cropParams), { auto: !1 })), this.resetCrop(), [4, iw(this.canvas, "png")];
          case 2:
            return FR(n.sent(), t), this.behaviors.values.next({ transparent: this.values.transparent, axes: O(O({}, this.values.axes), { params: O(O(O({}, this.params.axes.defaultValue), this.values.axes.params), { scale: 0.11 }) }), resolution: this.values.resolution }), [2];
        }
      });
    });
  }, e;
}(), dre = N.getDefaultValues(_v), VR = function() {
  function e() {
    this.mode = $d.Drug, this.cells = /* @__PURE__ */ new Map(), this.managers = { camera: new wI(this), representation: new DI(this), cell: new OI(this), trajectory: new BI(this), snapshot: new LI(this), selection: new NI(this), events: new FI(this), highlight: new zI(this), editor: new GI(this), screenshot: new UI(this) };
  }
  var t;
  return e.prototype.createCanvas = function(n, r) {
    var i = document.createElement("canvas");
    n.appendChild(i), rw(i, n), this.layout = { root: n, canvas: i }, this.canvas3d = a_.create(i_.fromCanvas(i), N.merge(_v, N.getDefaultValues(_v), O({ camera: { mode: "orthographic", helper: { axes: { name: "on", params: {} } }, stereo: { name: "off", params: {} }, fov: 90, manualReset: !1 }, cameraResetDurationMs: 0, cameraFog: { name: "on", params: { intensity: 50 } }, renderer: O(O({}, dre.renderer), { backgroundColor: Ae(15922682) }), postprocessing: { occlusion: { name: "off", params: {} }, outline: { name: "off", params: {} }, antialiasing: { name: "fxaa", params: { edgeThresholdMin: 0.0312, edgeThresholdMax: 0.063, iterations: 12, subpixelQuality: 0.3 } }, background: { variant: { name: "off", params: {} } }, shadow: { name: "off", params: {} } }, helper: { handle: { handle: { name: "off" } } }, transparentBackground: !1 }, r))), this.canvas3d.animate(), this.managers.representation.createContext(), this.managers.events.subscribe(), this.managers.editor.start();
  }, e.prototype.focus = function(n, r) {
    return se(this, 0, void 0, function() {
      var i, a, o, s, u = this;
      return ie(this, function(l) {
        switch (l.label) {
          case 0:
            return i = [], a = new Set(n.map(function(c) {
              var d, f, p;
              return i.push.apply(i, (p = (f = (d = u.cells.get(c.ref)) === null || d === void 0 ? void 0 : d.dependency) === null || f === void 0 ? void 0 : f.by) !== null && p !== void 0 ? p : []), c.ref;
            })), o = new Set(i), s = Array.from(this.cells).map(function(c) {
              return { ref: c[0] };
            }).filter(function(c) {
              return !a.has(c.ref) && !o.has(c.ref);
            }), this.hide(s, !0), [4, this.show(n, r)];
          case 1:
            return l.sent(), [2, s];
        }
      });
    });
  }, e.prototype.show = function(n, r) {
    var i;
    return se(this, 0, void 0, function() {
      var a, o, s, u, l, c = this;
      return ie(this, function(d) {
        switch (d.label) {
          case 0:
            a = function(f) {
              var p, g, m, v, h, y, x, S;
              return ie(this, function(b) {
                switch (b.label) {
                  case 0:
                    return o.managers.cell.idleCellSet.delete(f.ref), p = o.managers.cell.get(f.ref), [4, o.managers.cell.getStructure(f.ref)];
                  case 1:
                    if (b.sent(), !p || !f.representationType && Array.from(p.representations.values()).some(function(_) {
                      return !_.isHidden;
                    })) return [2, "continue"];
                    g = 0, m = Array.from(p.representations), b.label = 2;
                  case 2:
                    return g < m.length ? (v = m[g], h = v[0], (y = v[1]).state ? (!y.isHidden || f.representationType && f.representationType !== h || ((i = o.canvas3d) === null || i === void 0 || i.add(y.state), p.representations.set(h, O(O({}, y), { isHidden: !1 }))), [3, 5]) : [3, 3]) : [3, 6];
                  case 3:
                    return y.cache ? [4, Pc.managers.cell.recoveryReprCache(p, O(O({}, y.cache), { isHidden: !1 }))] : [3, 5];
                  case 4:
                    b.sent(), b.label = 5;
                  case 5:
                    return g++, [3, 2];
                  case 6:
                    return p.dependency.by.length && (x = [], S = p.dependency.by.filter(function(_) {
                      var C = c.cells.has(_);
                      if (C) {
                        if (c.cells.get(_).dependency.on.some(function(w) {
                          var I, M;
                          return Array.from((M = (I = c.cells.get(w.ref)) === null || I === void 0 ? void 0 : I.representations.values()) !== null && M !== void 0 ? M : []).filter(function(E) {
                            return E.isHidden !== !0;
                          }).length === 0;
                        })) return !1;
                      } else x.push(_);
                      return C;
                    }), o.show(S.map(function(_) {
                      return { ref: _ };
                    }), !0), x.length && o.managers.cell.update(f.ref, { model: {}, dependency: { by: S } })), [2];
                }
              });
            }, o = this, s = 0, u = n, d.label = 1;
          case 1:
            return s < u.length ? (l = u[s], [5, a(l)]) : [3, 4];
          case 2:
            d.sent(), d.label = 3;
          case 3:
            return s++, [3, 1];
          case 4:
            return r || this.managers.cell.traverse(function(f, p) {
              p.type === fe.IntraInteractions && c.managers.representation.showGlobalInteraction(void 0, "lightPlugin.show");
            }), this.managers.snapshot.event.changed.next({ from: "show" }), [2];
        }
      });
    });
  }, e.prototype.hide = function(n, r) {
    var i = this;
    n.forEach(function(a) {
      i.managers.cell.idleCellSet.add(a.ref);
      var o = i.cells.get(a.ref);
      if (o && (i.managers.selection.shape.selection.has(a.ref) && i.managers.selection.shape.remove({ item: a }), i.managers.selection.structure.selection.has(a.ref) && i.managers.selection.structure.remove({ item: { ref: a.ref, elementIds: vo(jn(o)) } }), o.representations.forEach(function(l, c) {
        var d;
        l.isHidden || a.representationType && a.representationType !== c || (l.state && ((d = i.canvas3d) === null || d === void 0 || d.remove(l.state)), o.representations.set(c, O(O(O({}, l), { isHidden: !0 }), l.cache ? { cache: O(O({}, l.cache), { isHidden: !0 }) } : {})));
      }), o.dependency.by.length)) {
        var s = [], u = o.dependency.by.filter(function(l) {
          var c = i.cells.has(l);
          c || s.push(l);
          var d = i.cells.get(l);
          return !(d != null && d.representations.has(fe.IntraInteractions)) && c;
        });
        i.hide(u.map(function(l) {
          return { ref: l };
        }), !0), s.length && i.managers.cell.update(a.ref, { model: {}, dependency: { by: u } });
      }
    }), r || this.managers.cell.traverse(function(a, o) {
      o.type === fe.IntraInteractions && i.managers.representation.showGlobalInteraction(void 0, "lightPlugin.show");
    }), this.managers.snapshot.event.changed.next({ from: "hide" });
  }, e.prototype.toggle = function(n) {
    var r = this, i = n.types, a = n.forceAction, o = n.refs, s = Array.from(this.cells).filter(function(c) {
      var d = c[0], f = c[1], p = (!o || o.includes(d)) && i.some(function(g) {
        return f.representations.get(g);
      });
      return !!p && !!f.dependency.on.every(function(g) {
        var m = r.cells.get(g.ref);
        return !!m && !Array.from(m.representations.values()).every(function(v) {
          return v.isHidden === !0;
        });
      });
    });
    if (s.length) {
      var u = a ?? s.some(function(c) {
        c[0];
        var d = c[1];
        return i.some(function(f) {
          var p;
          return (p = d.representations.get(f)) === null || p === void 0 ? void 0 : p.isHidden;
        });
      }) ? "show" : "hide", l = CO(s.map(function(c) {
        var d = c[0], f = c[1];
        return Array.from(f.representations).filter(function(p) {
          var g = p[0];
          return i.includes(g);
        }).map(function(p) {
          return { representationType: p[0], ref: d };
        });
      }));
      this[u](l);
    }
  }, e.prototype.refresh = function(n) {
    var r, i, a, o, s;
    this.canvas3d && (!((i = (r = this.layout) === null || r === void 0 ? void 0 : r.root.children[0]) === null || i === void 0) && i.clientWidth) && (n != null && n.fixCamera && (s = this.canvas3d.camera.getSnapshot()), rw(this.layout.canvas, this.layout.root), (a = this.canvas3d) === null || a === void 0 || a.handleResize(), n != null && n.fixCamera ? (o = this.canvas3d) === null || o === void 0 || o.camera.setState(s) : this.managers.camera.focus());
  }, e.prototype.clear = function() {
    var n;
    this.managers.selection.clear(), this.managers.highlight.clear(), this.managers.editor.changeEditorMode(Yo.None), this.cells = /* @__PURE__ */ new Map(), (n = this.canvas3d) === null || n === void 0 || n.clear();
  }, e.prototype.dispose = function() {
    var n;
    (n = this.canvas3d) === null || n === void 0 || n.dispose(), this.layout = void 0, this.canvas3d = void 0, this.cells = /* @__PURE__ */ new Map(), this.managers = { camera: new wI(this), representation: new DI(this), cell: new OI(this), trajectory: new BI(this), snapshot: new LI(this), selection: new NI(this), events: new FI(this), highlight: new zI(this), editor: new GI(this), screenshot: new UI(this) };
  }, t = e, e.Utils = { sliceCellItems: function(n, r) {
    return HO(Pc, n, r);
  }, queryCellItems: function(n) {
    return A8(Pc, n);
  }, exportToPdb: function(n) {
    return se(void 0, 0, void 0, function() {
      return ie(t, function(r) {
        switch (r.label) {
          case 0:
            return [4, Pc.managers.cell.getStructure(n.ref)];
          case 1:
            return [2, x8(r.sent(), n.elementIds, !1)];
        }
      });
    });
  }, getBox: function(n) {
    return se(void 0, 0, void 0, function() {
      var r, i;
      return ie(t, function(a) {
        switch (a.label) {
          case 0:
            return [4, Pc.managers.cell.getStructure(n.ref)];
          case 1:
            return r = a.sent(), [2, pne(r, (i = n.elementIds) !== null && i !== void 0 ? i : [])];
        }
      });
    });
  }, splitMolecularContent: function(n, r) {
    return dQ(n, r);
  }, checkMolecularContentVerify: function(n, r) {
    return pQ(n, r);
  }, getMergedContent: function(n) {
    return rJ(Pc, n);
  }, traverseAtoms: function(n, r) {
    return se(void 0, 0, void 0, function() {
      var i;
      return ie(t, function(a) {
        switch (a.label) {
          case 0:
            return [4, Pc.managers.cell.getStructure(n)];
          case 1:
            return (i = a.sent()) ? (nJ(i, r), [2]) : [2];
        }
      });
    });
  } }, e;
}(), Pc = new VR(), j_ = function(e, t) {
  return j_ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
    n.__proto__ = r;
  } || function(n, r) {
    for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
  }, j_(e, t);
};
function ph(e, t) {
  if (typeof t != "function" && t !== null)
    throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
  j_(e, t);
  function n() {
    this.constructor = e;
  }
  e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var _o = function() {
  return _o = Object.assign || function(t) {
    for (var n, r = 1, i = arguments.length; r < i; r++) {
      n = arguments[r];
      for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (t[a] = n[a]);
    }
    return t;
  }, _o.apply(this, arguments);
};
function Wc(e) {
  var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
  if (n) return n.call(e);
  if (e && typeof e.length == "number") return {
    next: function() {
      return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e };
    }
  };
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var hh = (
  /** @class */
  function() {
    function e(t) {
      t === void 0 && (t = {}), this.adapter = t;
    }
    return Object.defineProperty(e, "cssClasses", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "strings", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "numbers", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "defaultAdapter", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.init = function() {
    }, e.prototype.destroy = function() {
    }, e;
  }()
);
/**
 * @license
 * Copyright 2019 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
function fre(e) {
  return e === void 0 && (e = window), mre(e) ? { passive: !0 } : !1;
}
function mre(e) {
  e === void 0 && (e = window);
  var t = !1;
  try {
    var n = {
      // This function will be called when the browser
      // attempts to access the passive property.
      get passive() {
        return t = !0, !1;
      }
    }, r = function() {
    };
    e.document.addEventListener("test", r, n), e.document.removeEventListener("test", r, n);
  } catch {
    t = !1;
  }
  return t;
}
const GR = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  applyPassive: fre
}, Symbol.toStringTag, { value: "Module" }));
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
function pre(e, t) {
  if (e.closest)
    return e.closest(t);
  for (var n = e; n; ) {
    if (zR(n, t))
      return n;
    n = n.parentElement;
  }
  return null;
}
function zR(e, t) {
  var n = e.matches || e.webkitMatchesSelector || e.msMatchesSelector;
  return n.call(e, t);
}
function hre(e) {
  var t = e;
  if (t.offsetParent !== null)
    return t.scrollWidth;
  var n = t.cloneNode(!0);
  n.style.setProperty("position", "absolute"), n.style.setProperty("transform", "translate(-9999px, -9999px)"), document.documentElement.appendChild(n);
  var r = n.scrollWidth;
  return document.documentElement.removeChild(n), r;
}
const gre = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  closest: pre,
  estimateScrollWidth: hre,
  matches: zR
}, Symbol.toStringTag, { value: "Module" }));
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var vre = {
  LABEL_FLOAT_ABOVE: "mdc-floating-label--float-above",
  LABEL_REQUIRED: "mdc-floating-label--required",
  LABEL_SHAKE: "mdc-floating-label--shake",
  ROOT: "mdc-floating-label"
};
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var yre = (
  /** @class */
  function(e) {
    ph(t, e);
    function t(n) {
      var r = e.call(this, _o(_o({}, t.defaultAdapter), n)) || this;
      return r.shakeAnimationEndHandler = function() {
        r.handleShakeAnimationEnd();
      }, r;
    }
    return Object.defineProperty(t, "cssClasses", {
      get: function() {
        return vre;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "defaultAdapter", {
      /**
       * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
       */
      get: function() {
        return {
          addClass: function() {
          },
          removeClass: function() {
          },
          getWidth: function() {
            return 0;
          },
          registerInteractionHandler: function() {
          },
          deregisterInteractionHandler: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), t.prototype.init = function() {
      this.adapter.registerInteractionHandler("animationend", this.shakeAnimationEndHandler);
    }, t.prototype.destroy = function() {
      this.adapter.deregisterInteractionHandler("animationend", this.shakeAnimationEndHandler);
    }, t.prototype.getWidth = function() {
      return this.adapter.getWidth();
    }, t.prototype.shake = function(n) {
      var r = t.cssClasses.LABEL_SHAKE;
      n ? this.adapter.addClass(r) : this.adapter.removeClass(r);
    }, t.prototype.float = function(n) {
      var r = t.cssClasses, i = r.LABEL_FLOAT_ABOVE, a = r.LABEL_SHAKE;
      n ? this.adapter.addClass(i) : (this.adapter.removeClass(i), this.adapter.removeClass(a));
    }, t.prototype.setRequired = function(n) {
      var r = t.cssClasses.LABEL_REQUIRED;
      n ? this.adapter.addClass(r) : this.adapter.removeClass(r);
    }, t.prototype.handleShakeAnimationEnd = function() {
      var n = t.cssClasses.LABEL_SHAKE;
      this.adapter.removeClass(n);
    }, t;
  }(hh)
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var Gd = {
  LINE_RIPPLE_ACTIVE: "mdc-line-ripple--active",
  LINE_RIPPLE_DEACTIVATING: "mdc-line-ripple--deactivating"
};
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var bre = (
  /** @class */
  function(e) {
    ph(t, e);
    function t(n) {
      var r = e.call(this, _o(_o({}, t.defaultAdapter), n)) || this;
      return r.transitionEndHandler = function(i) {
        r.handleTransitionEnd(i);
      }, r;
    }
    return Object.defineProperty(t, "cssClasses", {
      get: function() {
        return Gd;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "defaultAdapter", {
      /**
       * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
       */
      get: function() {
        return {
          addClass: function() {
          },
          removeClass: function() {
          },
          hasClass: function() {
            return !1;
          },
          setStyle: function() {
          },
          registerEventHandler: function() {
          },
          deregisterEventHandler: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), t.prototype.init = function() {
      this.adapter.registerEventHandler("transitionend", this.transitionEndHandler);
    }, t.prototype.destroy = function() {
      this.adapter.deregisterEventHandler("transitionend", this.transitionEndHandler);
    }, t.prototype.activate = function() {
      this.adapter.removeClass(Gd.LINE_RIPPLE_DEACTIVATING), this.adapter.addClass(Gd.LINE_RIPPLE_ACTIVE);
    }, t.prototype.setRippleCenter = function(n) {
      this.adapter.setStyle("transform-origin", n + "px center");
    }, t.prototype.deactivate = function() {
      this.adapter.addClass(Gd.LINE_RIPPLE_DEACTIVATING);
    }, t.prototype.handleTransitionEnd = function(n) {
      var r = this.adapter.hasClass(Gd.LINE_RIPPLE_DEACTIVATING);
      n.propertyName === "opacity" && r && (this.adapter.removeClass(Gd.LINE_RIPPLE_ACTIVE), this.adapter.removeClass(Gd.LINE_RIPPLE_DEACTIVATING));
    }, t;
  }(hh)
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var _re = {
  NOTCH_ELEMENT_SELECTOR: ".mdc-notched-outline__notch"
}, HI = {
  // This should stay in sync with $mdc-notched-outline-padding * 2.
  NOTCH_ELEMENT_PADDING: 8
}, xre = {
  NO_LABEL: "mdc-notched-outline--no-label",
  OUTLINE_NOTCHED: "mdc-notched-outline--notched",
  OUTLINE_UPGRADED: "mdc-notched-outline--upgraded"
};
/**
 * @license
 * Copyright 2017 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var Cre = (
  /** @class */
  function(e) {
    ph(t, e);
    function t(n) {
      return e.call(this, _o(_o({}, t.defaultAdapter), n)) || this;
    }
    return Object.defineProperty(t, "strings", {
      get: function() {
        return _re;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "cssClasses", {
      get: function() {
        return xre;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "numbers", {
      get: function() {
        return HI;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "defaultAdapter", {
      /**
       * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
       */
      get: function() {
        return {
          addClass: function() {
          },
          removeClass: function() {
          },
          setNotchWidthProperty: function() {
          },
          removeNotchWidthProperty: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), t.prototype.notch = function(n) {
      var r = t.cssClasses.OUTLINE_NOTCHED;
      n > 0 && (n += HI.NOTCH_ELEMENT_PADDING), this.adapter.setNotchWidthProperty(n), this.adapter.addClass(r);
    }, t.prototype.closeNotch = function() {
      var n = t.cssClasses.OUTLINE_NOTCHED;
      this.adapter.removeClass(n), this.adapter.removeNotchWidthProperty();
    }, t;
  }(hh)
);
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var Sre = {
  // Ripple is a special case where the "root" component is really a "mixin" of sorts,
  // given that it's an 'upgrade' to an existing component. That being said it is the root
  // CSS class that all other CSS classes derive from.
  BG_FOCUSED: "mdc-ripple-upgraded--background-focused",
  FG_ACTIVATION: "mdc-ripple-upgraded--foreground-activation",
  FG_DEACTIVATION: "mdc-ripple-upgraded--foreground-deactivation",
  ROOT: "mdc-ripple-upgraded",
  UNBOUNDED: "mdc-ripple-upgraded--unbounded"
}, Are = {
  VAR_FG_SCALE: "--mdc-ripple-fg-scale",
  VAR_FG_SIZE: "--mdc-ripple-fg-size",
  VAR_FG_TRANSLATE_END: "--mdc-ripple-fg-translate-end",
  VAR_FG_TRANSLATE_START: "--mdc-ripple-fg-translate-start",
  VAR_LEFT: "--mdc-ripple-left",
  VAR_TOP: "--mdc-ripple-top"
}, qI = {
  DEACTIVATION_TIMEOUT_MS: 225,
  FG_DEACTIVATION_MS: 150,
  INITIAL_ORIGIN_SCALE: 0.6,
  PADDING: 10,
  TAP_DELAY_MS: 300
  // Delay between touch and simulated mouse events on touch devices
}, Z2;
function wre(e, t) {
  t === void 0 && (t = !1);
  var n = e.CSS, r = Z2;
  if (typeof Z2 == "boolean" && !t)
    return Z2;
  var i = n && typeof n.supports == "function";
  if (!i)
    return !1;
  var a = n.supports("--css-vars", "yes"), o = n.supports("(--css-vars: yes)") && n.supports("color", "#00000000");
  return r = a || o, t || (Z2 = r), r;
}
function Ire(e, t, n) {
  if (!e)
    return { x: 0, y: 0 };
  var r = t.x, i = t.y, a = r + n.left, o = i + n.top, s, u;
  if (e.type === "touchstart") {
    var l = e;
    s = l.changedTouches[0].pageX - a, u = l.changedTouches[0].pageY - o;
  } else {
    var c = e;
    s = c.pageX - a, u = c.pageY - o;
  }
  return { x: s, y: u };
}
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var jI = [
  "touchstart",
  "pointerdown",
  "mousedown",
  "keydown"
], KI = [
  "touchend",
  "pointerup",
  "mouseup",
  "contextmenu"
], Q2 = [], Pre = (
  /** @class */
  function(e) {
    ph(t, e);
    function t(n) {
      var r = e.call(this, _o(_o({}, t.defaultAdapter), n)) || this;
      return r.activationAnimationHasEnded = !1, r.activationTimer = 0, r.fgDeactivationRemovalTimer = 0, r.fgScale = "0", r.frame = { width: 0, height: 0 }, r.initialSize = 0, r.layoutFrame = 0, r.maxRadius = 0, r.unboundedCoords = { left: 0, top: 0 }, r.activationState = r.defaultActivationState(), r.activationTimerCallback = function() {
        r.activationAnimationHasEnded = !0, r.runDeactivationUXLogicIfReady();
      }, r.activateHandler = function(i) {
        r.activateImpl(i);
      }, r.deactivateHandler = function() {
        r.deactivateImpl();
      }, r.focusHandler = function() {
        r.handleFocus();
      }, r.blurHandler = function() {
        r.handleBlur();
      }, r.resizeHandler = function() {
        r.layout();
      }, r;
    }
    return Object.defineProperty(t, "cssClasses", {
      get: function() {
        return Sre;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "strings", {
      get: function() {
        return Are;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "numbers", {
      get: function() {
        return qI;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "defaultAdapter", {
      get: function() {
        return {
          addClass: function() {
          },
          browserSupportsCssVars: function() {
            return !0;
          },
          computeBoundingRect: function() {
            return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
          },
          containsEventTarget: function() {
            return !0;
          },
          deregisterDocumentInteractionHandler: function() {
          },
          deregisterInteractionHandler: function() {
          },
          deregisterResizeHandler: function() {
          },
          getWindowPageOffset: function() {
            return { x: 0, y: 0 };
          },
          isSurfaceActive: function() {
            return !0;
          },
          isSurfaceDisabled: function() {
            return !0;
          },
          isUnbounded: function() {
            return !0;
          },
          registerDocumentInteractionHandler: function() {
          },
          registerInteractionHandler: function() {
          },
          registerResizeHandler: function() {
          },
          removeClass: function() {
          },
          updateCssVariable: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), t.prototype.init = function() {
      var n = this, r = this.supportsPressRipple();
      if (this.registerRootHandlers(r), r) {
        var i = t.cssClasses, a = i.ROOT, o = i.UNBOUNDED;
        requestAnimationFrame(function() {
          n.adapter.addClass(a), n.adapter.isUnbounded() && (n.adapter.addClass(o), n.layoutInternal());
        });
      }
    }, t.prototype.destroy = function() {
      var n = this;
      if (this.supportsPressRipple()) {
        this.activationTimer && (clearTimeout(this.activationTimer), this.activationTimer = 0, this.adapter.removeClass(t.cssClasses.FG_ACTIVATION)), this.fgDeactivationRemovalTimer && (clearTimeout(this.fgDeactivationRemovalTimer), this.fgDeactivationRemovalTimer = 0, this.adapter.removeClass(t.cssClasses.FG_DEACTIVATION));
        var r = t.cssClasses, i = r.ROOT, a = r.UNBOUNDED;
        requestAnimationFrame(function() {
          n.adapter.removeClass(i), n.adapter.removeClass(a), n.removeCssVars();
        });
      }
      this.deregisterRootHandlers(), this.deregisterDeactivationHandlers();
    }, t.prototype.activate = function(n) {
      this.activateImpl(n);
    }, t.prototype.deactivate = function() {
      this.deactivateImpl();
    }, t.prototype.layout = function() {
      var n = this;
      this.layoutFrame && cancelAnimationFrame(this.layoutFrame), this.layoutFrame = requestAnimationFrame(function() {
        n.layoutInternal(), n.layoutFrame = 0;
      });
    }, t.prototype.setUnbounded = function(n) {
      var r = t.cssClasses.UNBOUNDED;
      n ? this.adapter.addClass(r) : this.adapter.removeClass(r);
    }, t.prototype.handleFocus = function() {
      var n = this;
      requestAnimationFrame(function() {
        return n.adapter.addClass(t.cssClasses.BG_FOCUSED);
      });
    }, t.prototype.handleBlur = function() {
      var n = this;
      requestAnimationFrame(function() {
        return n.adapter.removeClass(t.cssClasses.BG_FOCUSED);
      });
    }, t.prototype.supportsPressRipple = function() {
      return this.adapter.browserSupportsCssVars();
    }, t.prototype.defaultActivationState = function() {
      return {
        activationEvent: void 0,
        hasDeactivationUXRun: !1,
        isActivated: !1,
        isProgrammatic: !1,
        wasActivatedByPointer: !1,
        wasElementMadeActive: !1
      };
    }, t.prototype.registerRootHandlers = function(n) {
      var r, i;
      if (n) {
        try {
          for (var a = Wc(jI), o = a.next(); !o.done; o = a.next()) {
            var s = o.value;
            this.adapter.registerInteractionHandler(s, this.activateHandler);
          }
        } catch (u) {
          r = { error: u };
        } finally {
          try {
            o && !o.done && (i = a.return) && i.call(a);
          } finally {
            if (r) throw r.error;
          }
        }
        this.adapter.isUnbounded() && this.adapter.registerResizeHandler(this.resizeHandler);
      }
      this.adapter.registerInteractionHandler("focus", this.focusHandler), this.adapter.registerInteractionHandler("blur", this.blurHandler);
    }, t.prototype.registerDeactivationHandlers = function(n) {
      var r, i;
      if (n.type === "keydown")
        this.adapter.registerInteractionHandler("keyup", this.deactivateHandler);
      else
        try {
          for (var a = Wc(KI), o = a.next(); !o.done; o = a.next()) {
            var s = o.value;
            this.adapter.registerDocumentInteractionHandler(s, this.deactivateHandler);
          }
        } catch (u) {
          r = { error: u };
        } finally {
          try {
            o && !o.done && (i = a.return) && i.call(a);
          } finally {
            if (r) throw r.error;
          }
        }
    }, t.prototype.deregisterRootHandlers = function() {
      var n, r;
      try {
        for (var i = Wc(jI), a = i.next(); !a.done; a = i.next()) {
          var o = a.value;
          this.adapter.deregisterInteractionHandler(o, this.activateHandler);
        }
      } catch (s) {
        n = { error: s };
      } finally {
        try {
          a && !a.done && (r = i.return) && r.call(i);
        } finally {
          if (n) throw n.error;
        }
      }
      this.adapter.deregisterInteractionHandler("focus", this.focusHandler), this.adapter.deregisterInteractionHandler("blur", this.blurHandler), this.adapter.isUnbounded() && this.adapter.deregisterResizeHandler(this.resizeHandler);
    }, t.prototype.deregisterDeactivationHandlers = function() {
      var n, r;
      this.adapter.deregisterInteractionHandler("keyup", this.deactivateHandler);
      try {
        for (var i = Wc(KI), a = i.next(); !a.done; a = i.next()) {
          var o = a.value;
          this.adapter.deregisterDocumentInteractionHandler(o, this.deactivateHandler);
        }
      } catch (s) {
        n = { error: s };
      } finally {
        try {
          a && !a.done && (r = i.return) && r.call(i);
        } finally {
          if (n) throw n.error;
        }
      }
    }, t.prototype.removeCssVars = function() {
      var n = this, r = t.strings, i = Object.keys(r);
      i.forEach(function(a) {
        a.indexOf("VAR_") === 0 && n.adapter.updateCssVariable(r[a], null);
      });
    }, t.prototype.activateImpl = function(n) {
      var r = this;
      if (!this.adapter.isSurfaceDisabled()) {
        var i = this.activationState;
        if (!i.isActivated) {
          var a = this.previousActivationEvent, o = a && n !== void 0 && a.type !== n.type;
          if (!o) {
            i.isActivated = !0, i.isProgrammatic = n === void 0, i.activationEvent = n, i.wasActivatedByPointer = i.isProgrammatic ? !1 : n !== void 0 && (n.type === "mousedown" || n.type === "touchstart" || n.type === "pointerdown");
            var s = n !== void 0 && Q2.length > 0 && Q2.some(function(u) {
              return r.adapter.containsEventTarget(u);
            });
            if (s) {
              this.resetActivationState();
              return;
            }
            n !== void 0 && (Q2.push(n.target), this.registerDeactivationHandlers(n)), i.wasElementMadeActive = this.checkElementMadeActive(n), i.wasElementMadeActive && this.animateActivation(), requestAnimationFrame(function() {
              Q2 = [], !i.wasElementMadeActive && n !== void 0 && (n.key === " " || n.keyCode === 32) && (i.wasElementMadeActive = r.checkElementMadeActive(n), i.wasElementMadeActive && r.animateActivation()), i.wasElementMadeActive || (r.activationState = r.defaultActivationState());
            });
          }
        }
      }
    }, t.prototype.checkElementMadeActive = function(n) {
      return n !== void 0 && n.type === "keydown" ? this.adapter.isSurfaceActive() : !0;
    }, t.prototype.animateActivation = function() {
      var n = this, r = t.strings, i = r.VAR_FG_TRANSLATE_START, a = r.VAR_FG_TRANSLATE_END, o = t.cssClasses, s = o.FG_DEACTIVATION, u = o.FG_ACTIVATION, l = t.numbers.DEACTIVATION_TIMEOUT_MS;
      this.layoutInternal();
      var c = "", d = "";
      if (!this.adapter.isUnbounded()) {
        var f = this.getFgTranslationCoordinates(), p = f.startPoint, g = f.endPoint;
        c = p.x + "px, " + p.y + "px", d = g.x + "px, " + g.y + "px";
      }
      this.adapter.updateCssVariable(i, c), this.adapter.updateCssVariable(a, d), clearTimeout(this.activationTimer), clearTimeout(this.fgDeactivationRemovalTimer), this.rmBoundedActivationClasses(), this.adapter.removeClass(s), this.adapter.computeBoundingRect(), this.adapter.addClass(u), this.activationTimer = setTimeout(function() {
        n.activationTimerCallback();
      }, l);
    }, t.prototype.getFgTranslationCoordinates = function() {
      var n = this.activationState, r = n.activationEvent, i = n.wasActivatedByPointer, a;
      i ? a = Ire(r, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()) : a = {
        x: this.frame.width / 2,
        y: this.frame.height / 2
      }, a = {
        x: a.x - this.initialSize / 2,
        y: a.y - this.initialSize / 2
      };
      var o = {
        x: this.frame.width / 2 - this.initialSize / 2,
        y: this.frame.height / 2 - this.initialSize / 2
      };
      return { startPoint: a, endPoint: o };
    }, t.prototype.runDeactivationUXLogicIfReady = function() {
      var n = this, r = t.cssClasses.FG_DEACTIVATION, i = this.activationState, a = i.hasDeactivationUXRun, o = i.isActivated, s = a || !o;
      s && this.activationAnimationHasEnded && (this.rmBoundedActivationClasses(), this.adapter.addClass(r), this.fgDeactivationRemovalTimer = setTimeout(function() {
        n.adapter.removeClass(r);
      }, qI.FG_DEACTIVATION_MS));
    }, t.prototype.rmBoundedActivationClasses = function() {
      var n = t.cssClasses.FG_ACTIVATION;
      this.adapter.removeClass(n), this.activationAnimationHasEnded = !1, this.adapter.computeBoundingRect();
    }, t.prototype.resetActivationState = function() {
      var n = this;
      this.previousActivationEvent = this.activationState.activationEvent, this.activationState = this.defaultActivationState(), setTimeout(function() {
        return n.previousActivationEvent = void 0;
      }, t.numbers.TAP_DELAY_MS);
    }, t.prototype.deactivateImpl = function() {
      var n = this, r = this.activationState;
      if (r.isActivated) {
        var i = _o({}, r);
        r.isProgrammatic ? (requestAnimationFrame(function() {
          n.animateDeactivation(i);
        }), this.resetActivationState()) : (this.deregisterDeactivationHandlers(), requestAnimationFrame(function() {
          n.activationState.hasDeactivationUXRun = !0, n.animateDeactivation(i), n.resetActivationState();
        }));
      }
    }, t.prototype.animateDeactivation = function(n) {
      var r = n.wasActivatedByPointer, i = n.wasElementMadeActive;
      (r || i) && this.runDeactivationUXLogicIfReady();
    }, t.prototype.layoutInternal = function() {
      var n = this;
      this.frame = this.adapter.computeBoundingRect();
      var r = Math.max(this.frame.height, this.frame.width), i = function() {
        var o = Math.sqrt(Math.pow(n.frame.width, 2) + Math.pow(n.frame.height, 2));
        return o + t.numbers.PADDING;
      };
      this.maxRadius = this.adapter.isUnbounded() ? r : i();
      var a = Math.floor(r * t.numbers.INITIAL_ORIGIN_SCALE);
      this.adapter.isUnbounded() && a % 2 !== 0 ? this.initialSize = a - 1 : this.initialSize = a, this.fgScale = "" + this.maxRadius / this.initialSize, this.updateLayoutCssVars();
    }, t.prototype.updateLayoutCssVars = function() {
      var n = t.strings, r = n.VAR_FG_SIZE, i = n.VAR_LEFT, a = n.VAR_TOP, o = n.VAR_FG_SCALE;
      this.adapter.updateCssVariable(r, this.initialSize + "px"), this.adapter.updateCssVariable(o, this.fgScale), this.adapter.isUnbounded() && (this.unboundedCoords = {
        left: Math.round(this.frame.width / 2 - this.initialSize / 2),
        top: Math.round(this.frame.height / 2 - this.initialSize / 2)
      }, this.adapter.updateCssVariable(i, this.unboundedCoords.left + "px"), this.adapter.updateCssVariable(a, this.unboundedCoords.top + "px"));
    }, t;
  }(hh)
);
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var Pb = {
  ARIA_CONTROLS: "aria-controls",
  ARIA_DESCRIBEDBY: "aria-describedby",
  INPUT_SELECTOR: ".mdc-text-field__input",
  LABEL_SELECTOR: ".mdc-floating-label",
  LEADING_ICON_SELECTOR: ".mdc-text-field__icon--leading",
  LINE_RIPPLE_SELECTOR: ".mdc-line-ripple",
  OUTLINE_SELECTOR: ".mdc-notched-outline",
  PREFIX_SELECTOR: ".mdc-text-field__affix--prefix",
  SUFFIX_SELECTOR: ".mdc-text-field__affix--suffix",
  TRAILING_ICON_SELECTOR: ".mdc-text-field__icon--trailing"
}, Mre = {
  DISABLED: "mdc-text-field--disabled",
  FOCUSED: "mdc-text-field--focused",
  HELPER_LINE: "mdc-text-field-helper-line",
  INVALID: "mdc-text-field--invalid",
  LABEL_FLOATING: "mdc-text-field--label-floating",
  NO_LABEL: "mdc-text-field--no-label",
  OUTLINED: "mdc-text-field--outlined",
  ROOT: "mdc-text-field",
  TEXTAREA: "mdc-text-field--textarea",
  WITH_LEADING_ICON: "mdc-text-field--with-leading-icon",
  WITH_TRAILING_ICON: "mdc-text-field--with-trailing-icon",
  WITH_INTERNAL_COUNTER: "mdc-text-field--with-internal-counter"
}, YI = {
  LABEL_SCALE: 0.75
}, Ere = [
  "pattern",
  "min",
  "max",
  "required",
  "step",
  "minlength",
  "maxlength"
], Tre = [
  "color",
  "date",
  "datetime-local",
  "month",
  "range",
  "time",
  "week"
];
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var WI = ["mousedown", "touchstart"], XI = ["click", "keydown"], kre = (
  /** @class */
  function(e) {
    ph(t, e);
    function t(n, r) {
      r === void 0 && (r = {});
      var i = e.call(this, _o(_o({}, t.defaultAdapter), n)) || this;
      return i.isFocused = !1, i.receivedUserInput = !1, i.valid = !0, i.useNativeValidation = !0, i.validateOnValueChange = !0, i.helperText = r.helperText, i.characterCounter = r.characterCounter, i.leadingIcon = r.leadingIcon, i.trailingIcon = r.trailingIcon, i.inputFocusHandler = function() {
        i.activateFocus();
      }, i.inputBlurHandler = function() {
        i.deactivateFocus();
      }, i.inputInputHandler = function() {
        i.handleInput();
      }, i.setPointerXOffset = function(a) {
        i.setTransformOrigin(a);
      }, i.textFieldInteractionHandler = function() {
        i.handleTextFieldInteraction();
      }, i.validationAttributeChangeHandler = function(a) {
        i.handleValidationAttributeChange(a);
      }, i;
    }
    return Object.defineProperty(t, "cssClasses", {
      get: function() {
        return Mre;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "strings", {
      get: function() {
        return Pb;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "numbers", {
      get: function() {
        return YI;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t.prototype, "shouldAlwaysFloat", {
      get: function() {
        var n = this.getNativeInput().type;
        return Tre.indexOf(n) >= 0;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t.prototype, "shouldFloat", {
      get: function() {
        return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() || this.isBadInput();
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t.prototype, "shouldShake", {
      get: function() {
        return !this.isFocused && !this.isValid() && !!this.getValue();
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(t, "defaultAdapter", {
      /**
       * See {@link MDCTextFieldAdapter} for typing information on parameters and
       * return types.
       */
      get: function() {
        return {
          addClass: function() {
          },
          removeClass: function() {
          },
          hasClass: function() {
            return !0;
          },
          setInputAttr: function() {
          },
          removeInputAttr: function() {
          },
          registerTextFieldInteractionHandler: function() {
          },
          deregisterTextFieldInteractionHandler: function() {
          },
          registerInputInteractionHandler: function() {
          },
          deregisterInputInteractionHandler: function() {
          },
          registerValidationAttributeChangeHandler: function() {
            return new MutationObserver(function() {
            });
          },
          deregisterValidationAttributeChangeHandler: function() {
          },
          getNativeInput: function() {
            return null;
          },
          isFocused: function() {
            return !1;
          },
          activateLineRipple: function() {
          },
          deactivateLineRipple: function() {
          },
          setLineRippleTransformOrigin: function() {
          },
          shakeLabel: function() {
          },
          floatLabel: function() {
          },
          setLabelRequired: function() {
          },
          hasLabel: function() {
            return !1;
          },
          getLabelWidth: function() {
            return 0;
          },
          hasOutline: function() {
            return !1;
          },
          notchOutline: function() {
          },
          closeOutline: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), t.prototype.init = function() {
      var n, r, i, a;
      this.adapter.hasLabel() && this.getNativeInput().required && this.adapter.setLabelRequired(!0), this.adapter.isFocused() ? this.inputFocusHandler() : this.adapter.hasLabel() && this.shouldFloat && (this.notchOutline(!0), this.adapter.floatLabel(!0), this.styleFloating(!0)), this.adapter.registerInputInteractionHandler("focus", this.inputFocusHandler), this.adapter.registerInputInteractionHandler("blur", this.inputBlurHandler), this.adapter.registerInputInteractionHandler("input", this.inputInputHandler);
      try {
        for (var o = Wc(WI), s = o.next(); !s.done; s = o.next()) {
          var u = s.value;
          this.adapter.registerInputInteractionHandler(u, this.setPointerXOffset);
        }
      } catch (d) {
        n = { error: d };
      } finally {
        try {
          s && !s.done && (r = o.return) && r.call(o);
        } finally {
          if (n) throw n.error;
        }
      }
      try {
        for (var l = Wc(XI), c = l.next(); !c.done; c = l.next()) {
          var u = c.value;
          this.adapter.registerTextFieldInteractionHandler(u, this.textFieldInteractionHandler);
        }
      } catch (d) {
        i = { error: d };
      } finally {
        try {
          c && !c.done && (a = l.return) && a.call(l);
        } finally {
          if (i) throw i.error;
        }
      }
      this.validationObserver = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler), this.setcharacterCounter(this.getValue().length);
    }, t.prototype.destroy = function() {
      var n, r, i, a;
      this.adapter.deregisterInputInteractionHandler("focus", this.inputFocusHandler), this.adapter.deregisterInputInteractionHandler("blur", this.inputBlurHandler), this.adapter.deregisterInputInteractionHandler("input", this.inputInputHandler);
      try {
        for (var o = Wc(WI), s = o.next(); !s.done; s = o.next()) {
          var u = s.value;
          this.adapter.deregisterInputInteractionHandler(u, this.setPointerXOffset);
        }
      } catch (d) {
        n = { error: d };
      } finally {
        try {
          s && !s.done && (r = o.return) && r.call(o);
        } finally {
          if (n) throw n.error;
        }
      }
      try {
        for (var l = Wc(XI), c = l.next(); !c.done; c = l.next()) {
          var u = c.value;
          this.adapter.deregisterTextFieldInteractionHandler(u, this.textFieldInteractionHandler);
        }
      } catch (d) {
        i = { error: d };
      } finally {
        try {
          c && !c.done && (a = l.return) && a.call(l);
        } finally {
          if (i) throw i.error;
        }
      }
      this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);
    }, t.prototype.handleTextFieldInteraction = function() {
      var n = this.adapter.getNativeInput();
      n && n.disabled || (this.receivedUserInput = !0);
    }, t.prototype.handleValidationAttributeChange = function(n) {
      var r = this;
      n.some(function(i) {
        return Ere.indexOf(i) > -1 ? (r.styleValidity(!0), r.adapter.setLabelRequired(r.getNativeInput().required), !0) : !1;
      }), n.indexOf("maxlength") > -1 && this.setcharacterCounter(this.getValue().length);
    }, t.prototype.notchOutline = function(n) {
      if (!(!this.adapter.hasOutline() || !this.adapter.hasLabel()))
        if (n) {
          var r = this.adapter.getLabelWidth() * YI.LABEL_SCALE;
          this.adapter.notchOutline(r);
        } else
          this.adapter.closeOutline();
    }, t.prototype.activateFocus = function() {
      this.isFocused = !0, this.styleFocused(this.isFocused), this.adapter.activateLineRipple(), this.adapter.hasLabel() && (this.notchOutline(this.shouldFloat), this.adapter.floatLabel(this.shouldFloat), this.styleFloating(this.shouldFloat), this.adapter.shakeLabel(this.shouldShake)), this.helperText && (this.helperText.isPersistent() || !this.helperText.isValidation() || !this.valid) && this.helperText.showToScreenReader();
    }, t.prototype.setTransformOrigin = function(n) {
      if (!(this.isDisabled() || this.adapter.hasOutline())) {
        var r = n.touches, i = r ? r[0] : n, a = i.target.getBoundingClientRect(), o = i.clientX - a.left;
        this.adapter.setLineRippleTransformOrigin(o);
      }
    }, t.prototype.handleInput = function() {
      this.autoCompleteFocus(), this.setcharacterCounter(this.getValue().length);
    }, t.prototype.autoCompleteFocus = function() {
      this.receivedUserInput || this.activateFocus();
    }, t.prototype.deactivateFocus = function() {
      this.isFocused = !1, this.adapter.deactivateLineRipple();
      var n = this.isValid();
      this.styleValidity(n), this.styleFocused(this.isFocused), this.adapter.hasLabel() && (this.notchOutline(this.shouldFloat), this.adapter.floatLabel(this.shouldFloat), this.styleFloating(this.shouldFloat), this.adapter.shakeLabel(this.shouldShake)), this.shouldFloat || (this.receivedUserInput = !1);
    }, t.prototype.getValue = function() {
      return this.getNativeInput().value;
    }, t.prototype.setValue = function(n) {
      if (this.getValue() !== n && (this.getNativeInput().value = n), this.setcharacterCounter(n.length), this.validateOnValueChange) {
        var r = this.isValid();
        this.styleValidity(r);
      }
      this.adapter.hasLabel() && (this.notchOutline(this.shouldFloat), this.adapter.floatLabel(this.shouldFloat), this.styleFloating(this.shouldFloat), this.validateOnValueChange && this.adapter.shakeLabel(this.shouldShake));
    }, t.prototype.isValid = function() {
      return this.useNativeValidation ? this.isNativeInputValid() : this.valid;
    }, t.prototype.setValid = function(n) {
      this.valid = n, this.styleValidity(n);
      var r = !n && !this.isFocused && !!this.getValue();
      this.adapter.hasLabel() && this.adapter.shakeLabel(r);
    }, t.prototype.setValidateOnValueChange = function(n) {
      this.validateOnValueChange = n;
    }, t.prototype.getValidateOnValueChange = function() {
      return this.validateOnValueChange;
    }, t.prototype.setUseNativeValidation = function(n) {
      this.useNativeValidation = n;
    }, t.prototype.isDisabled = function() {
      return this.getNativeInput().disabled;
    }, t.prototype.setDisabled = function(n) {
      this.getNativeInput().disabled = n, this.styleDisabled(n);
    }, t.prototype.setHelperTextContent = function(n) {
      this.helperText && this.helperText.setContent(n);
    }, t.prototype.setLeadingIconAriaLabel = function(n) {
      this.leadingIcon && this.leadingIcon.setAriaLabel(n);
    }, t.prototype.setLeadingIconContent = function(n) {
      this.leadingIcon && this.leadingIcon.setContent(n);
    }, t.prototype.setTrailingIconAriaLabel = function(n) {
      this.trailingIcon && this.trailingIcon.setAriaLabel(n);
    }, t.prototype.setTrailingIconContent = function(n) {
      this.trailingIcon && this.trailingIcon.setContent(n);
    }, t.prototype.setcharacterCounter = function(n) {
      if (this.characterCounter) {
        var r = this.getNativeInput().maxLength;
        if (r === -1)
          throw new Error("MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.");
        this.characterCounter.setCounterValue(n, r);
      }
    }, t.prototype.isBadInput = function() {
      return this.getNativeInput().validity.badInput || !1;
    }, t.prototype.isNativeInputValid = function() {
      return this.getNativeInput().validity.valid;
    }, t.prototype.styleValidity = function(n) {
      var r = t.cssClasses.INVALID;
      if (n ? this.adapter.removeClass(r) : this.adapter.addClass(r), this.helperText) {
        this.helperText.setValidity(n);
        var i = this.helperText.isValidation();
        if (!i)
          return;
        var a = this.helperText.isVisible(), o = this.helperText.getId();
        a && o ? this.adapter.setInputAttr(Pb.ARIA_DESCRIBEDBY, o) : this.adapter.removeInputAttr(Pb.ARIA_DESCRIBEDBY);
      }
    }, t.prototype.styleFocused = function(n) {
      var r = t.cssClasses.FOCUSED;
      n ? this.adapter.addClass(r) : this.adapter.removeClass(r);
    }, t.prototype.styleDisabled = function(n) {
      var r = t.cssClasses, i = r.DISABLED, a = r.INVALID;
      n ? (this.adapter.addClass(i), this.adapter.removeClass(a)) : this.adapter.removeClass(i), this.leadingIcon && this.leadingIcon.setDisabled(n), this.trailingIcon && this.trailingIcon.setDisabled(n);
    }, t.prototype.styleFloating = function(n) {
      var r = t.cssClasses.LABEL_FLOATING;
      n ? this.adapter.addClass(r) : this.adapter.removeClass(r);
    }, t.prototype.getNativeInput = function() {
      var n = this.adapter ? this.adapter.getNativeInput() : null;
      return n || {
        disabled: !1,
        maxLength: -1,
        required: !1,
        type: "input",
        validity: {
          badInput: !1,
          valid: !0
        },
        value: ""
      };
    }, t;
  }(hh)
);
function ni(e) {
  return Object.entries(e).filter(([t, n]) => t !== "" && n).map(([t]) => t).join(" ");
}
function D1(e, t, n, r = { bubbles: !0 }, i = !1) {
  if (typeof Event > "u")
    throw new Error("Event not defined.");
  if (!e)
    throw new Error("Tried to dipatch event without element.");
  const a = new CustomEvent(t, Object.assign(Object.assign({}, r), { detail: n }));
  if (e == null || e.dispatchEvent(a), i && t.startsWith("SMUI")) {
    const o = new CustomEvent(t.replace(/^SMUI/g, () => "MDC"), Object.assign(Object.assign({}, r), { detail: n }));
    e == null || e.dispatchEvent(o), o.defaultPrevented && a.preventDefault();
  }
  return a;
}
function Dv(e, t) {
  let n = Object.getOwnPropertyNames(e);
  const r = {};
  for (let i = 0; i < n.length; i++) {
    const a = n[i], o = a.indexOf("$");
    o !== -1 && t.indexOf(a.substring(0, o + 1)) !== -1 || t.indexOf(a) === -1 && (r[a] = e[a]);
  }
  return r;
}
const ZI = /^[a-z]+(?::(?:preventDefault|stopPropagation|passive|nonpassive|capture|once|self))+$/, Dre = /^[^$]+(?:\$(?:preventDefault|stopPropagation|passive|nonpassive|capture|once|self))+$/;
function gd(e) {
  let t, n = [];
  e.$on = (i, a) => {
    let o = i, s = () => {
    };
    return t ? s = t(o, a) : n.push([o, a]), o.match(ZI) && console && console.warn('Event modifiers in SMUI now use "$" instead of ":", so that all events can be bound with modifiers. Please update your event binding: ', o), () => {
      s();
    };
  };
  function r(i) {
    const a = e.$$.callbacks[i.type];
    a && a.slice().forEach((o) => o.call(this, i));
  }
  return (i) => {
    const a = [], o = {};
    t = (s, u) => {
      let l = s, c = u, d = !1;
      const f = l.match(ZI), p = l.match(Dre), g = f || p;
      if (l.match(/^SMUI:\w+:/)) {
        const h = l.split(":");
        let y = "";
        for (let x = 0; x < h.length; x++)
          y += x === h.length - 1 ? ":" + h[x] : h[x].split("-").map((S) => S.slice(0, 1).toUpperCase() + S.slice(1)).join("");
        console.warn(`The event ${l.split("$")[0]} has been renamed to ${y.split("$")[0]}.`), l = y;
      }
      if (g) {
        const h = l.split(f ? ":" : "$");
        l = h[0];
        const y = h.slice(1).reduce((x, S) => (x[S] = !0, x), {});
        y.passive && (d = d || {}, d.passive = !0), y.nonpassive && (d = d || {}, d.passive = !1), y.capture && (d = d || {}, d.capture = !0), y.once && (d = d || {}, d.once = !0), y.preventDefault && (c = Ore(c)), y.stopPropagation && (c = Bre(c)), y.stopImmediatePropagation && (c = Rre(c)), y.self && (c = Lre(i, c)), y.trusted && (c = Nre(c));
      }
      const m = QI(i, l, c, d), v = () => {
        m();
        const h = a.indexOf(v);
        h > -1 && a.splice(h, 1);
      };
      return a.push(v), l in o || (o[l] = QI(i, l, r)), v;
    };
    for (let s = 0; s < n.length; s++)
      t(n[s][0], n[s][1]);
    return {
      destroy: () => {
        for (let s = 0; s < a.length; s++)
          a[s]();
        for (let s of Object.entries(o))
          s[1]();
      }
    };
  };
}
function QI(e, t, n, r) {
  return e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r);
}
function Ore(e) {
  return function(t) {
    return t.preventDefault(), e.call(this, t);
  };
}
function Bre(e) {
  return function(t) {
    return t.stopPropagation(), e.call(this, t);
  };
}
function Rre(e) {
  return function(t) {
    return t.stopImmediatePropagation(), e.call(this, t);
  };
}
function Lre(e, t) {
  return function(n) {
    if (n.target === e)
      return t.call(this, n);
  };
}
function Nre(e) {
  return function(t) {
    if (t.isTrusted)
      return e.call(this, t);
  };
}
function no(e, t) {
  let n = Object.getOwnPropertyNames(e);
  const r = {};
  for (let i = 0; i < n.length; i++) {
    const a = n[i];
    a.substring(0, t.length) === t && (r[a.substring(t.length)] = e[a]);
  }
  return r;
}
function Zs(e, t) {
  let n = [];
  if (t)
    for (let r = 0; r < t.length; r++) {
      const i = t[r], a = Array.isArray(i) ? i[0] : i;
      Array.isArray(i) && i.length > 1 ? n.push(a(e, i[1])) : n.push(a(e));
    }
  return {
    update(r) {
      if ((r && r.length || 0) != n.length)
        throw new Error("You must not change the length of an actions array.");
      if (r)
        for (let i = 0; i < r.length; i++) {
          const a = n[i];
          if (a && a.update) {
            const o = r[i];
            Array.isArray(o) && o.length > 1 ? a.update(o[1]) : a.update();
          }
        }
    },
    destroy() {
      for (let r = 0; r < n.length; r++) {
        const i = n[r];
        i && i.destroy && i.destroy();
      }
    }
  };
}
const {
  SvelteComponent: Fre,
  action_destroyer: _m,
  assign: H0,
  binding_callbacks: Mb,
  check_outros: Vre,
  compute_rest_props: JI,
  create_slot: UR,
  detach: Hm,
  element: HR,
  empty: G8,
  exclude_internal_props: Gre,
  get_all_dirty_from_scope: qR,
  get_slot_changes: jR,
  get_spread_update: z8,
  group_outros: zre,
  init: Ure,
  insert: qm,
  is_function: U8,
  noop: $I,
  run_all: H8,
  safe_not_equal: q8,
  set_dynamic_element_data: Ov,
  set_svg_attributes: eP,
  svg_element: Hre,
  transition_in: q0,
  transition_out: j0,
  update_slot_base: KR
} = window.__gradio__svelte__internal, { get_current_component: qre } = window.__gradio__svelte__internal;
function jre(e) {
  let t = (
    /*tag*/
    e[1]
  ), n, r, i = (
    /*tag*/
    e[1] && Eb(e)
  );
  return {
    c() {
      i && i.c(), n = G8();
    },
    m(a, o) {
      i && i.m(a, o), qm(a, n, o), r = !0;
    },
    p(a, o) {
      /*tag*/
      a[1] ? t ? q8(
        t,
        /*tag*/
        a[1]
      ) ? (i.d(1), i = Eb(a), t = /*tag*/
      a[1], i.c(), i.m(n.parentNode, n)) : i.p(a, o) : (i = Eb(a), t = /*tag*/
      a[1], i.c(), i.m(n.parentNode, n)) : t && (i.d(1), i = null, t = /*tag*/
      a[1]);
    },
    i(a) {
      r || (q0(i, a), r = !0);
    },
    o(a) {
      j0(i, a), r = !1;
    },
    d(a) {
      a && Hm(n), i && i.d(a);
    }
  };
}
function Kre(e) {
  let t = (
    /*tag*/
    e[1]
  ), n, r = (
    /*tag*/
    e[1] && Tb(e)
  );
  return {
    c() {
      r && r.c(), n = G8();
    },
    m(i, a) {
      r && r.m(i, a), qm(i, n, a);
    },
    p(i, a) {
      /*tag*/
      i[1] ? t ? q8(
        t,
        /*tag*/
        i[1]
      ) ? (r.d(1), r = Tb(i), t = /*tag*/
      i[1], r.c(), r.m(n.parentNode, n)) : r.p(i, a) : (r = Tb(i), t = /*tag*/
      i[1], r.c(), r.m(n.parentNode, n)) : t && (r.d(1), r = null, t = /*tag*/
      i[1]);
    },
    i: $I,
    o: $I,
    d(i) {
      i && Hm(n), r && r.d(i);
    }
  };
}
function Yre(e) {
  let t, n, r, i, a;
  const o = (
    /*#slots*/
    e[8].default
  ), s = UR(
    o,
    e,
    /*$$scope*/
    e[7],
    null
  );
  let u = [
    /*$$restProps*/
    e[5]
  ], l = {};
  for (let c = 0; c < u.length; c += 1)
    l = H0(l, u[c]);
  return {
    c() {
      t = Hre("svg"), s && s.c(), eP(t, l);
    },
    m(c, d) {
      qm(c, t, d), s && s.m(t, null), e[9](t), r = !0, i || (a = [
        _m(n = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        _m(
          /*forwardEvents*/
          e[4].call(null, t)
        )
      ], i = !0);
    },
    p(c, d) {
      s && s.p && (!r || d & /*$$scope*/
      128) && KR(
        s,
        o,
        c,
        /*$$scope*/
        c[7],
        r ? jR(
          o,
          /*$$scope*/
          c[7],
          d,
          null
        ) : qR(
          /*$$scope*/
          c[7]
        ),
        null
      ), eP(t, l = z8(u, [d & /*$$restProps*/
      32 && /*$$restProps*/
      c[5]])), n && U8(n.update) && d & /*use*/
      1 && n.update.call(
        null,
        /*use*/
        c[0]
      );
    },
    i(c) {
      r || (q0(s, c), r = !0);
    },
    o(c) {
      j0(s, c), r = !1;
    },
    d(c) {
      c && Hm(t), s && s.d(c), e[9](null), i = !1, H8(a);
    }
  };
}
function Eb(e) {
  let t, n, r, i, a;
  const o = (
    /*#slots*/
    e[8].default
  ), s = UR(
    o,
    e,
    /*$$scope*/
    e[7],
    null
  );
  let u = [
    /*$$restProps*/
    e[5]
  ], l = {};
  for (let c = 0; c < u.length; c += 1)
    l = H0(l, u[c]);
  return {
    c() {
      t = HR(
        /*tag*/
        e[1]
      ), s && s.c(), Ov(
        /*tag*/
        e[1]
      )(t, l);
    },
    m(c, d) {
      qm(c, t, d), s && s.m(t, null), e[11](t), r = !0, i || (a = [
        _m(n = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        _m(
          /*forwardEvents*/
          e[4].call(null, t)
        )
      ], i = !0);
    },
    p(c, d) {
      s && s.p && (!r || d & /*$$scope*/
      128) && KR(
        s,
        o,
        c,
        /*$$scope*/
        c[7],
        r ? jR(
          o,
          /*$$scope*/
          c[7],
          d,
          null
        ) : qR(
          /*$$scope*/
          c[7]
        ),
        null
      ), Ov(
        /*tag*/
        c[1]
      )(t, l = z8(u, [d & /*$$restProps*/
      32 && /*$$restProps*/
      c[5]])), n && U8(n.update) && d & /*use*/
      1 && n.update.call(
        null,
        /*use*/
        c[0]
      );
    },
    i(c) {
      r || (q0(s, c), r = !0);
    },
    o(c) {
      j0(s, c), r = !1;
    },
    d(c) {
      c && Hm(t), s && s.d(c), e[11](null), i = !1, H8(a);
    }
  };
}
function Tb(e) {
  let t, n, r, i, a = [
    /*$$restProps*/
    e[5]
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = H0(o, a[s]);
  return {
    c() {
      t = HR(
        /*tag*/
        e[1]
      ), Ov(
        /*tag*/
        e[1]
      )(t, o);
    },
    m(s, u) {
      qm(s, t, u), e[10](t), r || (i = [
        _m(n = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        _m(
          /*forwardEvents*/
          e[4].call(null, t)
        )
      ], r = !0);
    },
    p(s, u) {
      Ov(
        /*tag*/
        s[1]
      )(t, o = z8(a, [u & /*$$restProps*/
      32 && /*$$restProps*/
      s[5]])), n && U8(n.update) && u & /*use*/
      1 && n.update.call(
        null,
        /*use*/
        s[0]
      );
    },
    d(s) {
      s && Hm(t), e[10](null), r = !1, H8(i);
    }
  };
}
function Wre(e) {
  let t, n, r, i;
  const a = [Yre, Kre, jre], o = [];
  function s(u, l) {
    return (
      /*tag*/
      u[1] === "svg" ? 0 : (
        /*selfClosing*/
        u[3] ? 1 : 2
      )
    );
  }
  return t = s(e), n = o[t] = a[t](e), {
    c() {
      n.c(), r = G8();
    },
    m(u, l) {
      o[t].m(u, l), qm(u, r, l), i = !0;
    },
    p(u, [l]) {
      let c = t;
      t = s(u), t === c ? o[t].p(u, l) : (zre(), j0(o[c], 1, 1, () => {
        o[c] = null;
      }), Vre(), n = o[t], n ? n.p(u, l) : (n = o[t] = a[t](u), n.c()), q0(n, 1), n.m(r.parentNode, r));
    },
    i(u) {
      i || (q0(n), i = !0);
    },
    o(u) {
      j0(n), i = !1;
    },
    d(u) {
      u && Hm(r), o[t].d(u);
    }
  };
}
function Xre(e, t, n) {
  let r;
  const i = ["use", "tag", "getElement"];
  let a = JI(t, i), { $$slots: o = {}, $$scope: s } = t, { use: u = [] } = t, { tag: l } = t;
  const c = gd(qre());
  let d;
  function f() {
    return d;
  }
  function p(v) {
    Mb[v ? "unshift" : "push"](() => {
      d = v, n(2, d);
    });
  }
  function g(v) {
    Mb[v ? "unshift" : "push"](() => {
      d = v, n(2, d);
    });
  }
  function m(v) {
    Mb[v ? "unshift" : "push"](() => {
      d = v, n(2, d);
    });
  }
  return e.$$set = (v) => {
    t = H0(H0({}, t), Gre(v)), n(5, a = JI(t, i)), "use" in v && n(0, u = v.use), "tag" in v && n(1, l = v.tag), "$$scope" in v && n(7, s = v.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*tag*/
    2 && n(3, r = [
      "area",
      "base",
      "br",
      "col",
      "embed",
      "hr",
      "img",
      "input",
      "link",
      "meta",
      "param",
      "source",
      "track",
      "wbr"
    ].indexOf(l) > -1);
  }, [
    u,
    l,
    d,
    r,
    c,
    a,
    f,
    s,
    o,
    p,
    g,
    m
  ];
}
class YR extends Fre {
  constructor(t) {
    super(), Ure(this, t, Xre, Wre, q8, { use: 0, tag: 1, getElement: 6 });
  }
  get getElement() {
    return this.$$.ctx[6];
  }
}
const {
  SvelteComponent: Zre,
  component_subscribe: Qre,
  create_slot: Jre,
  get_all_dirty_from_scope: $re,
  get_slot_changes: eie,
  init: tie,
  safe_not_equal: nie,
  set_store_value: rie,
  transition_in: iie,
  transition_out: aie,
  update_slot_base: oie
} = window.__gradio__svelte__internal, { onDestroy: sie, setContext: uie } = window.__gradio__svelte__internal;
function lie(e) {
  let t;
  const n = (
    /*#slots*/
    e[4].default
  ), r = Jre(
    n,
    e,
    /*$$scope*/
    e[3],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, [a]) {
      r && r.p && (!t || a & /*$$scope*/
      8) && oie(
        r,
        n,
        i,
        /*$$scope*/
        i[3],
        t ? eie(
          n,
          /*$$scope*/
          i[3],
          a,
          null
        ) : $re(
          /*$$scope*/
          i[3]
        ),
        null
      );
    },
    i(i) {
      t || (iie(r, i), t = !0);
    },
    o(i) {
      aie(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function cie(e, t, n) {
  let r, { $$slots: i = {}, $$scope: a } = t, { key: o } = t, { value: s } = t;
  const u = nT(s);
  return Qre(e, u, (l) => n(5, r = l)), uie(o, u), sie(() => {
    u.set(void 0);
  }), e.$$set = (l) => {
    "key" in l && n(1, o = l.key), "value" in l && n(2, s = l.value), "$$scope" in l && n(3, a = l.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*value*/
    4 && rie(u, r = s, r);
  }, [u, o, s, a, i];
}
class Bv extends Zre {
  constructor(t) {
    super(), tie(this, t, cie, lie, nie, { key: 1, value: 2 });
  }
}
const { getContext: die } = window.__gradio__svelte__internal, { applyPassive: J2 } = GR, { matches: fie } = gre;
function WR(e, { ripple: t = !0, surface: n = !1, unbounded: r = !1, disabled: i = !1, color: a, active: o, rippleElement: s, eventTarget: u, activeTarget: l, addClass: c = (g) => e.classList.add(g), removeClass: d = (g) => e.classList.remove(g), addStyle: f = (g, m) => e.style.setProperty(g, m), initPromise: p = Promise.resolve() } = {}) {
  let g, m = die("SMUI:addLayoutListener"), v, h = o, y = u, x = l;
  function S() {
    n ? (c("mdc-ripple-surface"), a === "primary" ? (c("smui-ripple-surface--primary"), d("smui-ripple-surface--secondary")) : a === "secondary" ? (d("smui-ripple-surface--primary"), c("smui-ripple-surface--secondary")) : (d("smui-ripple-surface--primary"), d("smui-ripple-surface--secondary"))) : (d("mdc-ripple-surface"), d("smui-ripple-surface--primary"), d("smui-ripple-surface--secondary")), g && h !== o && (h = o, o ? g.activate() : o === !1 && g.deactivate()), t && !g ? (g = new Pre({
      addClass: c,
      browserSupportsCssVars: () => wre(window),
      computeBoundingRect: () => (s || e).getBoundingClientRect(),
      containsEventTarget: (_) => e.contains(_),
      deregisterDocumentInteractionHandler: (_, C) => document.documentElement.removeEventListener(_, C, J2()),
      deregisterInteractionHandler: (_, C) => (u || e).removeEventListener(_, C, J2()),
      deregisterResizeHandler: (_) => window.removeEventListener("resize", _),
      getWindowPageOffset: () => ({
        x: window.pageXOffset,
        y: window.pageYOffset
      }),
      isSurfaceActive: () => o ?? fie(l || e, ":active"),
      isSurfaceDisabled: () => !!i,
      isUnbounded: () => !!r,
      registerDocumentInteractionHandler: (_, C) => document.documentElement.addEventListener(_, C, J2()),
      registerInteractionHandler: (_, C) => (u || e).addEventListener(_, C, J2()),
      registerResizeHandler: (_) => window.addEventListener("resize", _),
      removeClass: d,
      updateCssVariable: f
    }), p.then(() => {
      g && (g.init(), g.setUnbounded(r));
    })) : g && !t && p.then(() => {
      g && (g.destroy(), g = void 0);
    }), g && (y !== u || x !== l) && (y = u, x = l, g.destroy(), requestAnimationFrame(() => {
      g && (g.init(), g.setUnbounded(r));
    })), !t && r && c("mdc-ripple-upgraded--unbounded");
  }
  S(), m && (v = m(b));
  function b() {
    g && g.layout();
  }
  return {
    update(_) {
      ({
        ripple: t,
        surface: n,
        unbounded: r,
        disabled: i,
        color: a,
        active: o,
        rippleElement: s,
        eventTarget: u,
        activeTarget: l,
        addClass: c,
        removeClass: d,
        addStyle: f,
        initPromise: p
      } = Object.assign({ ripple: !0, surface: !1, unbounded: !1, disabled: !1, color: void 0, active: void 0, rippleElement: void 0, eventTarget: void 0, activeTarget: void 0, addClass: (C) => e.classList.add(C), removeClass: (C) => e.classList.remove(C), addStyle: (C, w) => e.style.setProperty(C, w), initPromise: Promise.resolve() }, _)), S();
    },
    destroy() {
      g && (g.destroy(), g = void 0, d("mdc-ripple-surface"), d("smui-ripple-surface--primary"), d("smui-ripple-surface--secondary")), v && v();
    }
  };
}
const {
  SvelteComponent: mie,
  action_destroyer: Rv,
  assign: Lv,
  binding_callbacks: tP,
  check_outros: pie,
  compute_rest_props: nP,
  create_slot: XR,
  detach: j8,
  element: ZR,
  empty: hie,
  exclude_internal_props: gie,
  get_all_dirty_from_scope: QR,
  get_slot_changes: JR,
  get_spread_update: $R,
  group_outros: vie,
  init: yie,
  insert: K8,
  is_function: eL,
  run_all: tL,
  safe_not_equal: bie,
  set_attributes: Nv,
  transition_in: Fv,
  transition_out: Vv,
  update_slot_base: nL
} = window.__gradio__svelte__internal, { onMount: _ie, getContext: xie } = window.__gradio__svelte__internal, { get_current_component: Cie } = window.__gradio__svelte__internal;
function Sie(e) {
  let t, n, r, i, a, o, s, u;
  const l = (
    /*#slots*/
    e[22].default
  ), c = XR(
    l,
    e,
    /*$$scope*/
    e[21],
    null
  );
  let d = [
    {
      class: n = ni({
        [
          /*className*/
          e[3]
        ]: !0,
        "mdc-floating-label": !0,
        "mdc-floating-label--float-above": (
          /*floatAbove*/
          e[0]
        ),
        "mdc-floating-label--required": (
          /*required*/
          e[1]
        ),
        .../*internalClasses*/
        e[8]
      })
    },
    {
      style: r = Object.entries(
        /*internalStyles*/
        e[9]
      ).map(iP).concat([
        /*style*/
        e[4]
      ]).join(" ")
    },
    {
      for: i = /*forId*/
      e[5] || /*inputProps*/
      (e[11] ? (
        /*inputProps*/
        e[11].id
      ) : void 0)
    },
    /*$$restProps*/
    e[12]
  ], f = {};
  for (let p = 0; p < d.length; p += 1)
    f = Lv(f, d[p]);
  return {
    c() {
      t = ZR("label"), c && c.c(), Nv(t, f);
    },
    m(p, g) {
      K8(p, t, g), c && c.m(t, null), e[24](t), o = !0, s || (u = [
        Rv(a = Zs.call(
          null,
          t,
          /*use*/
          e[2]
        )),
        Rv(
          /*forwardEvents*/
          e[10].call(null, t)
        )
      ], s = !0);
    },
    p(p, g) {
      c && c.p && (!o || g & /*$$scope*/
      2097152) && nL(
        c,
        l,
        p,
        /*$$scope*/
        p[21],
        o ? JR(
          l,
          /*$$scope*/
          p[21],
          g,
          null
        ) : QR(
          /*$$scope*/
          p[21]
        ),
        null
      ), Nv(t, f = $R(d, [
        (!o || g & /*className, floatAbove, required, internalClasses*/
        267 && n !== (n = ni({
          [
            /*className*/
            p[3]
          ]: !0,
          "mdc-floating-label": !0,
          "mdc-floating-label--float-above": (
            /*floatAbove*/
            p[0]
          ),
          "mdc-floating-label--required": (
            /*required*/
            p[1]
          ),
          .../*internalClasses*/
          p[8]
        }))) && { class: n },
        (!o || g & /*internalStyles, style*/
        528 && r !== (r = Object.entries(
          /*internalStyles*/
          p[9]
        ).map(iP).concat([
          /*style*/
          p[4]
        ]).join(" "))) && { style: r },
        (!o || g & /*forId*/
        32 && i !== (i = /*forId*/
        p[5] || /*inputProps*/
        (p[11] ? (
          /*inputProps*/
          p[11].id
        ) : void 0))) && { for: i },
        g & /*$$restProps*/
        4096 && /*$$restProps*/
        p[12]
      ])), a && eL(a.update) && g & /*use*/
      4 && a.update.call(
        null,
        /*use*/
        p[2]
      );
    },
    i(p) {
      o || (Fv(c, p), o = !0);
    },
    o(p) {
      Vv(c, p), o = !1;
    },
    d(p) {
      p && j8(t), c && c.d(p), e[24](null), s = !1, tL(u);
    }
  };
}
function Aie(e) {
  let t, n, r, i, a, o, s;
  const u = (
    /*#slots*/
    e[22].default
  ), l = XR(
    u,
    e,
    /*$$scope*/
    e[21],
    null
  );
  let c = [
    {
      class: n = ni({
        [
          /*className*/
          e[3]
        ]: !0,
        "mdc-floating-label": !0,
        "mdc-floating-label--float-above": (
          /*floatAbove*/
          e[0]
        ),
        "mdc-floating-label--required": (
          /*required*/
          e[1]
        ),
        .../*internalClasses*/
        e[8]
      })
    },
    {
      style: r = Object.entries(
        /*internalStyles*/
        e[9]
      ).map(rP).concat([
        /*style*/
        e[4]
      ]).join(" ")
    },
    /*$$restProps*/
    e[12]
  ], d = {};
  for (let f = 0; f < c.length; f += 1)
    d = Lv(d, c[f]);
  return {
    c() {
      t = ZR("span"), l && l.c(), Nv(t, d);
    },
    m(f, p) {
      K8(f, t, p), l && l.m(t, null), e[23](t), a = !0, o || (s = [
        Rv(i = Zs.call(
          null,
          t,
          /*use*/
          e[2]
        )),
        Rv(
          /*forwardEvents*/
          e[10].call(null, t)
        )
      ], o = !0);
    },
    p(f, p) {
      l && l.p && (!a || p & /*$$scope*/
      2097152) && nL(
        l,
        u,
        f,
        /*$$scope*/
        f[21],
        a ? JR(
          u,
          /*$$scope*/
          f[21],
          p,
          null
        ) : QR(
          /*$$scope*/
          f[21]
        ),
        null
      ), Nv(t, d = $R(c, [
        (!a || p & /*className, floatAbove, required, internalClasses*/
        267 && n !== (n = ni({
          [
            /*className*/
            f[3]
          ]: !0,
          "mdc-floating-label": !0,
          "mdc-floating-label--float-above": (
            /*floatAbove*/
            f[0]
          ),
          "mdc-floating-label--required": (
            /*required*/
            f[1]
          ),
          .../*internalClasses*/
          f[8]
        }))) && { class: n },
        (!a || p & /*internalStyles, style*/
        528 && r !== (r = Object.entries(
          /*internalStyles*/
          f[9]
        ).map(rP).concat([
          /*style*/
          f[4]
        ]).join(" "))) && { style: r },
        p & /*$$restProps*/
        4096 && /*$$restProps*/
        f[12]
      ])), i && eL(i.update) && p & /*use*/
      4 && i.update.call(
        null,
        /*use*/
        f[2]
      );
    },
    i(f) {
      a || (Fv(l, f), a = !0);
    },
    o(f) {
      Vv(l, f), a = !1;
    },
    d(f) {
      f && j8(t), l && l.d(f), e[23](null), o = !1, tL(s);
    }
  };
}
function wie(e) {
  let t, n, r, i;
  const a = [Aie, Sie], o = [];
  function s(u, l) {
    return (
      /*wrapped*/
      u[6] ? 0 : 1
    );
  }
  return t = s(e), n = o[t] = a[t](e), {
    c() {
      n.c(), r = hie();
    },
    m(u, l) {
      o[t].m(u, l), K8(u, r, l), i = !0;
    },
    p(u, [l]) {
      let c = t;
      t = s(u), t === c ? o[t].p(u, l) : (vie(), Vv(o[c], 1, 1, () => {
        o[c] = null;
      }), pie(), n = o[t], n ? n.p(u, l) : (n = o[t] = a[t](u), n.c()), Fv(n, 1), n.m(r.parentNode, r));
    },
    i(u) {
      i || (Fv(n), i = !0);
    },
    o(u) {
      Vv(n), i = !1;
    },
    d(u) {
      u && j8(r), o[t].d(u);
    }
  };
}
const rP = ([e, t]) => `${e}: ${t};`, iP = ([e, t]) => `${e}: ${t};`;
function Iie(e, t, n) {
  const r = [
    "use",
    "class",
    "style",
    "for",
    "floatAbove",
    "required",
    "wrapped",
    "shake",
    "float",
    "setRequired",
    "getWidth",
    "getElement"
  ];
  let i = nP(t, r), { $$slots: a = {}, $$scope: o } = t;
  var s;
  const u = gd(Cie());
  let { use: l = [] } = t, { class: c = "" } = t, { style: d = "" } = t, { for: f = void 0 } = t, { floatAbove: p = !1 } = t, { required: g = !1 } = t, { wrapped: m = !1 } = t, v, h, y = {}, x = {}, S = (s = xie("SMUI:generic:input:props")) !== null && s !== void 0 ? s : {}, b = p, _ = g;
  _ie(() => {
    n(18, h = new yre({
      addClass: C,
      removeClass: w,
      getWidth: () => {
        var V, G;
        const H = D(), q = H.cloneNode(!0);
        (V = H.parentNode) === null || V === void 0 || V.appendChild(q), q.classList.add("smui-floating-label--remove-transition"), q.classList.add("smui-floating-label--force-size"), q.classList.remove("mdc-floating-label--float-above");
        const z = q.scrollWidth;
        return (G = H.parentNode) === null || G === void 0 || G.removeChild(q), z;
      },
      registerInteractionHandler: (V, G) => D().addEventListener(V, G),
      deregisterInteractionHandler: (V, G) => D().removeEventListener(V, G)
    }));
    const F = {
      get element() {
        return D();
      },
      addStyle: I,
      removeStyle: M
    };
    return D1(v, "SMUIFloatingLabel:mount", F), h.init(), () => {
      D1(v, "SMUIFloatingLabel:unmount", F), h.destroy();
    };
  });
  function C(F) {
    y[F] || n(8, y[F] = !0, y);
  }
  function w(F) {
    (!(F in y) || y[F]) && n(8, y[F] = !1, y);
  }
  function I(F, V) {
    x[F] != V && (V === "" || V == null ? (delete x[F], n(9, x)) : n(9, x[F] = V, x));
  }
  function M(F) {
    F in x && (delete x[F], n(9, x));
  }
  function E(F) {
    h.shake(F);
  }
  function T(F) {
    n(0, p = F);
  }
  function P(F) {
    n(1, g = F);
  }
  function k() {
    return h.getWidth();
  }
  function D() {
    return v;
  }
  function B(F) {
    tP[F ? "unshift" : "push"](() => {
      v = F, n(7, v);
    });
  }
  function L(F) {
    tP[F ? "unshift" : "push"](() => {
      v = F, n(7, v);
    });
  }
  return e.$$set = (F) => {
    t = Lv(Lv({}, t), gie(F)), n(12, i = nP(t, r)), "use" in F && n(2, l = F.use), "class" in F && n(3, c = F.class), "style" in F && n(4, d = F.style), "for" in F && n(5, f = F.for), "floatAbove" in F && n(0, p = F.floatAbove), "required" in F && n(1, g = F.required), "wrapped" in F && n(6, m = F.wrapped), "$$scope" in F && n(21, o = F.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*instance, previousFloatAbove, floatAbove*/
    786433 && h && b !== p && (n(19, b = p), h.float(p)), e.$$.dirty & /*instance, previousRequired, required*/
    1310722 && h && _ !== g && (n(20, _ = g), h.setRequired(g));
  }, [
    p,
    g,
    l,
    c,
    d,
    f,
    m,
    v,
    y,
    x,
    u,
    S,
    i,
    E,
    T,
    P,
    k,
    D,
    h,
    b,
    _,
    o,
    a,
    B,
    L
  ];
}
class rL extends mie {
  constructor(t) {
    super(), yie(this, t, Iie, wie, bie, {
      use: 2,
      class: 3,
      style: 4,
      for: 5,
      floatAbove: 0,
      required: 1,
      wrapped: 6,
      shake: 13,
      float: 14,
      setRequired: 15,
      getWidth: 16,
      getElement: 17
    });
  }
  get shake() {
    return this.$$.ctx[13];
  }
  get float() {
    return this.$$.ctx[14];
  }
  get setRequired() {
    return this.$$.ctx[15];
  }
  get getWidth() {
    return this.$$.ctx[16];
  }
  get getElement() {
    return this.$$.ctx[17];
  }
}
const {
  SvelteComponent: Pie,
  action_destroyer: aP,
  assign: K_,
  binding_callbacks: Mie,
  compute_rest_props: oP,
  detach: Eie,
  element: Tie,
  exclude_internal_props: kie,
  get_spread_update: Die,
  init: Oie,
  insert: Bie,
  is_function: Rie,
  noop: sP,
  run_all: Lie,
  safe_not_equal: Nie,
  set_attributes: uP
} = window.__gradio__svelte__internal, { onMount: Fie } = window.__gradio__svelte__internal, { get_current_component: Vie } = window.__gradio__svelte__internal;
function Gie(e) {
  let t, n, r, i, a, o, s = [
    {
      class: n = ni({
        [
          /*className*/
          e[1]
        ]: !0,
        "mdc-line-ripple": !0,
        "mdc-line-ripple--active": (
          /*active*/
          e[3]
        ),
        .../*internalClasses*/
        e[5]
      })
    },
    {
      style: r = Object.entries(
        /*internalStyles*/
        e[6]
      ).map(lP).concat([
        /*style*/
        e[2]
      ]).join(" ")
    },
    /*$$restProps*/
    e[8]
  ], u = {};
  for (let l = 0; l < s.length; l += 1)
    u = K_(u, s[l]);
  return {
    c() {
      t = Tie("div"), uP(t, u);
    },
    m(l, c) {
      Bie(l, t, c), e[13](t), a || (o = [
        aP(i = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        aP(
          /*forwardEvents*/
          e[7].call(null, t)
        )
      ], a = !0);
    },
    p(l, [c]) {
      uP(t, u = Die(s, [
        c & /*className, active, internalClasses*/
        42 && n !== (n = ni({
          [
            /*className*/
            l[1]
          ]: !0,
          "mdc-line-ripple": !0,
          "mdc-line-ripple--active": (
            /*active*/
            l[3]
          ),
          .../*internalClasses*/
          l[5]
        })) && { class: n },
        c & /*internalStyles, style*/
        68 && r !== (r = Object.entries(
          /*internalStyles*/
          l[6]
        ).map(lP).concat([
          /*style*/
          l[2]
        ]).join(" ")) && { style: r },
        c & /*$$restProps*/
        256 && /*$$restProps*/
        l[8]
      ])), i && Rie(i.update) && c & /*use*/
      1 && i.update.call(
        null,
        /*use*/
        l[0]
      );
    },
    i: sP,
    o: sP,
    d(l) {
      l && Eie(t), e[13](null), a = !1, Lie(o);
    }
  };
}
const lP = ([e, t]) => `${e}: ${t};`;
function zie(e, t, n) {
  const r = [
    "use",
    "class",
    "style",
    "active",
    "activate",
    "deactivate",
    "setRippleCenter",
    "getElement"
  ];
  let i = oP(t, r);
  const a = gd(Vie());
  let { use: o = [] } = t, { class: s = "" } = t, { style: u = "" } = t, { active: l = !1 } = t, c, d, f = {}, p = {};
  Fie(() => (d = new bre({
    addClass: m,
    removeClass: v,
    hasClass: g,
    setStyle: h,
    registerEventHandler: (C, w) => b().addEventListener(C, w),
    deregisterEventHandler: (C, w) => b().removeEventListener(C, w)
  }), d.init(), () => {
    d.destroy();
  }));
  function g(C) {
    return C in f ? f[C] : b().classList.contains(C);
  }
  function m(C) {
    f[C] || n(5, f[C] = !0, f);
  }
  function v(C) {
    (!(C in f) || f[C]) && n(5, f[C] = !1, f);
  }
  function h(C, w) {
    p[C] != w && (w === "" || w == null ? (delete p[C], n(6, p)) : n(6, p[C] = w, p));
  }
  function y() {
    d.activate();
  }
  function x() {
    d.deactivate();
  }
  function S(C) {
    d.setRippleCenter(C);
  }
  function b() {
    return c;
  }
  function _(C) {
    Mie[C ? "unshift" : "push"](() => {
      c = C, n(4, c);
    });
  }
  return e.$$set = (C) => {
    t = K_(K_({}, t), kie(C)), n(8, i = oP(t, r)), "use" in C && n(0, o = C.use), "class" in C && n(1, s = C.class), "style" in C && n(2, u = C.style), "active" in C && n(3, l = C.active);
  }, [
    o,
    s,
    u,
    l,
    c,
    f,
    p,
    a,
    i,
    y,
    x,
    S,
    b,
    _
  ];
}
class Uie extends Pie {
  constructor(t) {
    super(), Oie(this, t, zie, Gie, Nie, {
      use: 0,
      class: 1,
      style: 2,
      active: 3,
      activate: 9,
      deactivate: 10,
      setRippleCenter: 11,
      getElement: 12
    });
  }
  get activate() {
    return this.$$.ctx[9];
  }
  get deactivate() {
    return this.$$.ctx[10];
  }
  get setRippleCenter() {
    return this.$$.ctx[11];
  }
  get getElement() {
    return this.$$.ctx[12];
  }
}
const {
  SvelteComponent: Hie,
  action_destroyer: cP,
  append: $2,
  assign: Y_,
  attr: d0,
  binding_callbacks: qie,
  check_outros: jie,
  compute_rest_props: dP,
  create_slot: Kie,
  detach: iL,
  element: wg,
  exclude_internal_props: Yie,
  get_all_dirty_from_scope: Wie,
  get_slot_changes: Xie,
  get_spread_update: Zie,
  group_outros: Qie,
  init: Jie,
  insert: aL,
  is_function: $ie,
  listen: fP,
  run_all: eae,
  safe_not_equal: tae,
  set_attributes: mP,
  space: pP,
  transition_in: Ig,
  transition_out: W_,
  update_slot_base: nae
} = window.__gradio__svelte__internal, { onMount: rae } = window.__gradio__svelte__internal, { get_current_component: iae } = window.__gradio__svelte__internal;
function hP(e) {
  let t, n, r;
  const i = (
    /*#slots*/
    e[15].default
  ), a = Kie(
    i,
    e,
    /*$$scope*/
    e[14],
    null
  );
  return {
    c() {
      t = wg("div"), a && a.c(), d0(t, "class", "mdc-notched-outline__notch"), d0(t, "style", n = Object.entries(
        /*notchStyles*/
        e[7]
      ).map(gP).join(" "));
    },
    m(o, s) {
      aL(o, t, s), a && a.m(t, null), r = !0;
    },
    p(o, s) {
      a && a.p && (!r || s & /*$$scope*/
      16384) && nae(
        a,
        i,
        o,
        /*$$scope*/
        o[14],
        r ? Xie(
          i,
          /*$$scope*/
          o[14],
          s,
          null
        ) : Wie(
          /*$$scope*/
          o[14]
        ),
        null
      ), (!r || s & /*notchStyles*/
      128 && n !== (n = Object.entries(
        /*notchStyles*/
        o[7]
      ).map(gP).join(" "))) && d0(t, "style", n);
    },
    i(o) {
      r || (Ig(a, o), r = !0);
    },
    o(o) {
      W_(a, o), r = !1;
    },
    d(o) {
      o && iL(t), a && a.d(o);
    }
  };
}
function aae(e) {
  let t, n, r, i, a, o, s, u, l, c, d = !/*noLabel*/
  e[3] && hP(e), f = [
    {
      class: o = ni({
        [
          /*className*/
          e[1]
        ]: !0,
        "mdc-notched-outline": !0,
        "mdc-notched-outline--notched": (
          /*notched*/
          e[2]
        ),
        "mdc-notched-outline--no-label": (
          /*noLabel*/
          e[3]
        ),
        .../*internalClasses*/
        e[6]
      })
    },
    /*$$restProps*/
    e[10]
  ], p = {};
  for (let g = 0; g < f.length; g += 1)
    p = Y_(p, f[g]);
  return {
    c() {
      t = wg("div"), n = wg("div"), r = pP(), d && d.c(), i = pP(), a = wg("div"), d0(n, "class", "mdc-notched-outline__leading"), d0(a, "class", "mdc-notched-outline__trailing"), mP(t, p);
    },
    m(g, m) {
      aL(g, t, m), $2(t, n), $2(t, r), d && d.m(t, null), $2(t, i), $2(t, a), e[16](t), u = !0, l || (c = [
        cP(s = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        cP(
          /*forwardEvents*/
          e[8].call(null, t)
        ),
        fP(
          t,
          "SMUIFloatingLabel:mount",
          /*handleFloatingLabelMount*/
          e[9]
        ),
        fP(
          t,
          "SMUIFloatingLabel:unmount",
          /*SMUIFloatingLabel_unmount_handler*/
          e[17]
        )
      ], l = !0);
    },
    p(g, [m]) {
      /*noLabel*/
      g[3] ? d && (Qie(), W_(d, 1, 1, () => {
        d = null;
      }), jie()) : d ? (d.p(g, m), m & /*noLabel*/
      8 && Ig(d, 1)) : (d = hP(g), d.c(), Ig(d, 1), d.m(t, i)), mP(t, p = Zie(f, [
        (!u || m & /*className, notched, noLabel, internalClasses*/
        78 && o !== (o = ni({
          [
            /*className*/
            g[1]
          ]: !0,
          "mdc-notched-outline": !0,
          "mdc-notched-outline--notched": (
            /*notched*/
            g[2]
          ),
          "mdc-notched-outline--no-label": (
            /*noLabel*/
            g[3]
          ),
          .../*internalClasses*/
          g[6]
        }))) && { class: o },
        m & /*$$restProps*/
        1024 && /*$$restProps*/
        g[10]
      ])), s && $ie(s.update) && m & /*use*/
      1 && s.update.call(
        null,
        /*use*/
        g[0]
      );
    },
    i(g) {
      u || (Ig(d), u = !0);
    },
    o(g) {
      W_(d), u = !1;
    },
    d(g) {
      g && iL(t), d && d.d(), e[16](null), l = !1, eae(c);
    }
  };
}
const gP = ([e, t]) => `${e}: ${t};`;
function oae(e, t, n) {
  const r = ["use", "class", "notched", "noLabel", "notch", "closeNotch", "getElement"];
  let i = dP(t, r), { $$slots: a = {}, $$scope: o } = t;
  const s = gd(iae());
  let { use: u = [] } = t, { class: l = "" } = t, { notched: c = !1 } = t, { noLabel: d = !1 } = t, f, p, g, m = {}, v = {};
  rae(() => (p = new Cre({
    addClass: y,
    removeClass: x,
    setNotchWidthProperty: (E) => S("width", E + "px"),
    removeNotchWidthProperty: () => b("width")
  }), p.init(), () => {
    p.destroy();
  }));
  function h(E) {
    n(4, g = E.detail);
  }
  function y(E) {
    m[E] || n(6, m[E] = !0, m);
  }
  function x(E) {
    (!(E in m) || m[E]) && n(6, m[E] = !1, m);
  }
  function S(E, T) {
    v[E] != T && (T === "" || T == null ? (delete v[E], n(7, v)) : n(7, v[E] = T, v));
  }
  function b(E) {
    E in v && (delete v[E], n(7, v));
  }
  function _(E) {
    p.notch(E);
  }
  function C() {
    p.closeNotch();
  }
  function w() {
    return f;
  }
  function I(E) {
    qie[E ? "unshift" : "push"](() => {
      f = E, n(5, f);
    });
  }
  const M = () => n(4, g = void 0);
  return e.$$set = (E) => {
    t = Y_(Y_({}, t), Yie(E)), n(10, i = dP(t, r)), "use" in E && n(0, u = E.use), "class" in E && n(1, l = E.class), "notched" in E && n(2, c = E.notched), "noLabel" in E && n(3, d = E.noLabel), "$$scope" in E && n(14, o = E.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*floatingLabel*/
    16 && (g ? (g.addStyle("transition-duration", "0s"), y("mdc-notched-outline--upgraded"), requestAnimationFrame(() => {
      g && g.removeStyle("transition-duration");
    })) : x("mdc-notched-outline--upgraded"));
  }, [
    u,
    l,
    c,
    d,
    g,
    f,
    m,
    v,
    s,
    h,
    i,
    _,
    C,
    w,
    o,
    a,
    I,
    M
  ];
}
class sae extends Hie {
  constructor(t) {
    super(), Jie(this, t, oae, aae, tae, {
      use: 0,
      class: 1,
      notched: 2,
      noLabel: 3,
      notch: 11,
      closeNotch: 12,
      getElement: 13
    });
  }
  get notch() {
    return this.$$.ctx[11];
  }
  get closeNotch() {
    return this.$$.ctx[12];
  }
  get getElement() {
    return this.$$.ctx[13];
  }
}
const {
  SvelteComponent: uae,
  assign: Gv,
  binding_callbacks: lae,
  check_outros: cae,
  compute_rest_props: vP,
  construct_svelte_component: yP,
  create_component: bP,
  create_slot: dae,
  destroy_component: _P,
  detach: fae,
  empty: mae,
  exclude_internal_props: pae,
  get_all_dirty_from_scope: hae,
  get_slot_changes: gae,
  get_spread_object: eg,
  get_spread_update: xP,
  group_outros: vae,
  init: yae,
  insert: bae,
  mount_component: CP,
  safe_not_equal: _ae,
  transition_in: X_,
  transition_out: Z_,
  update_slot_base: xae
} = window.__gradio__svelte__internal, { onDestroy: Cae, getContext: Sae, setContext: Aae } = window.__gradio__svelte__internal, { get_current_component: wae } = window.__gradio__svelte__internal;
function Iae(e) {
  let t;
  const n = (
    /*#slots*/
    e[11].default
  ), r = dae(
    n,
    e,
    /*$$scope*/
    e[13],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a & /*$$scope*/
      8192) && xae(
        r,
        n,
        i,
        /*$$scope*/
        i[13],
        t ? gae(
          n,
          /*$$scope*/
          i[13],
          a,
          null
        ) : hae(
          /*$$scope*/
          i[13]
        ),
        null
      );
    },
    i(i) {
      t || (X_(r, i), t = !0);
    },
    o(i) {
      Z_(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function Pae(e) {
  let t, n, r;
  const i = [
    { tag: (
      /*tag*/
      e[3]
    ) },
    {
      use: [
        /*forwardEvents*/
        e[8],
        .../*use*/
        e[0]
      ]
    },
    {
      class: ni({
        [
          /*className*/
          e[1]
        ]: !0,
        [
          /*smuiClass*/
          e[6]
        ]: !0,
        .../*smuiClassMap*/
        e[5]
      })
    },
    /*props*/
    e[7],
    /*$$restProps*/
    e[9]
  ];
  var a = (
    /*component*/
    e[2]
  );
  function o(s, u) {
    let l = {
      $$slots: { default: [Iae] },
      $$scope: { ctx: s }
    };
    for (let c = 0; c < i.length; c += 1)
      l = Gv(l, i[c]);
    return u !== void 0 && u & /*tag, forwardEvents, use, className, smuiClass, smuiClassMap, props, $$restProps*/
    1003 && (l = Gv(l, xP(i, [
      u & /*tag*/
      8 && { tag: (
        /*tag*/
        s[3]
      ) },
      u & /*forwardEvents, use*/
      257 && {
        use: [
          /*forwardEvents*/
          s[8],
          .../*use*/
          s[0]
        ]
      },
      u & /*className, smuiClass, smuiClassMap*/
      98 && {
        class: ni({
          [
            /*className*/
            s[1]
          ]: !0,
          [
            /*smuiClass*/
            s[6]
          ]: !0,
          .../*smuiClassMap*/
          s[5]
        })
      },
      u & /*props*/
      128 && eg(
        /*props*/
        s[7]
      ),
      u & /*$$restProps*/
      512 && eg(
        /*$$restProps*/
        s[9]
      )
    ]))), { props: l };
  }
  return a && (t = yP(a, o(e)), e[12](t)), {
    c() {
      t && bP(t.$$.fragment), n = mae();
    },
    m(s, u) {
      t && CP(t, s, u), bae(s, n, u), r = !0;
    },
    p(s, [u]) {
      if (u & /*component*/
      4 && a !== (a = /*component*/
      s[2])) {
        if (t) {
          vae();
          const l = t;
          Z_(l.$$.fragment, 1, 0, () => {
            _P(l, 1);
          }), cae();
        }
        a ? (t = yP(a, o(s, u)), s[12](t), bP(t.$$.fragment), X_(t.$$.fragment, 1), CP(t, n.parentNode, n)) : t = null;
      } else if (a) {
        const l = u & /*tag, forwardEvents, use, className, smuiClass, smuiClassMap, props, $$restProps*/
        1003 ? xP(i, [
          u & /*tag*/
          8 && { tag: (
            /*tag*/
            s[3]
          ) },
          u & /*forwardEvents, use*/
          257 && {
            use: [
              /*forwardEvents*/
              s[8],
              .../*use*/
              s[0]
            ]
          },
          u & /*className, smuiClass, smuiClassMap*/
          98 && {
            class: ni({
              [
                /*className*/
                s[1]
              ]: !0,
              [
                /*smuiClass*/
                s[6]
              ]: !0,
              .../*smuiClassMap*/
              s[5]
            })
          },
          u & /*props*/
          128 && eg(
            /*props*/
            s[7]
          ),
          u & /*$$restProps*/
          512 && eg(
            /*$$restProps*/
            s[9]
          )
        ]) : {};
        u & /*$$scope*/
        8192 && (l.$$scope = { dirty: u, ctx: s }), t.$set(l);
      }
    },
    i(s) {
      r || (t && X_(t.$$.fragment, s), r = !0);
    },
    o(s) {
      t && Z_(t.$$.fragment, s), r = !1;
    },
    d(s) {
      s && fae(n), e[12](null), t && _P(t, s);
    }
  };
}
const pl = {
  component: YR,
  tag: "div",
  class: "",
  classMap: {},
  contexts: {},
  props: {}
};
function Mae(e, t, n) {
  const r = ["use", "class", "component", "tag", "getElement"];
  let i = vP(t, r), { $$slots: a = {}, $$scope: o } = t, { use: s = [] } = t, { class: u = "" } = t, l;
  const c = pl.class, d = {}, f = [], p = pl.contexts, g = pl.props;
  let { component: m = pl.component } = t, { tag: v = m === YR ? pl.tag : void 0 } = t;
  Object.entries(pl.classMap).forEach(([S, b]) => {
    const _ = Sae(b);
    _ && "subscribe" in _ && f.push(_.subscribe((C) => {
      n(5, d[S] = C, d);
    }));
  });
  const h = gd(wae());
  for (let S in p)
    p.hasOwnProperty(S) && Aae(S, p[S]);
  Cae(() => {
    for (const S of f)
      S();
  });
  function y() {
    return l.getElement();
  }
  function x(S) {
    lae[S ? "unshift" : "push"](() => {
      l = S, n(4, l);
    });
  }
  return e.$$set = (S) => {
    t = Gv(Gv({}, t), pae(S)), n(9, i = vP(t, r)), "use" in S && n(0, s = S.use), "class" in S && n(1, u = S.class), "component" in S && n(2, m = S.component), "tag" in S && n(3, v = S.tag), "$$scope" in S && n(13, o = S.$$scope);
  }, [
    s,
    u,
    m,
    v,
    l,
    d,
    c,
    g,
    h,
    i,
    y,
    a,
    x,
    o
  ];
}
class Eae extends uae {
  constructor(t) {
    super(), yae(this, t, Mae, Pae, _ae, {
      use: 0,
      class: 1,
      component: 2,
      tag: 3,
      getElement: 10
    });
  }
  get getElement() {
    return this.$$.ctx[10];
  }
}
const SP = Object.assign({}, pl);
function Y8(e) {
  return new Proxy(Eae, {
    construct: function(t, n) {
      return Object.assign(pl, SP, e), new t(...n);
    },
    get: function(t, n) {
      return Object.assign(pl, SP, e), t[n];
    }
  });
}
const Tae = Y8({
  class: "mdc-text-field-helper-line",
  tag: "div"
}), kae = Y8({
  class: "mdc-text-field__affix mdc-text-field__affix--prefix",
  tag: "span"
}), Dae = Y8({
  class: "mdc-text-field__affix mdc-text-field__affix--suffix",
  tag: "span"
}), {
  SvelteComponent: Oae,
  action_destroyer: AP,
  assign: Q_,
  binding_callbacks: Bae,
  bubble: wP,
  compute_rest_props: IP,
  detach: Rae,
  element: Lae,
  exclude_internal_props: Nae,
  get_spread_update: Fae,
  init: Vae,
  insert: Gae,
  is_function: zae,
  listen: tg,
  noop: PP,
  run_all: Uae,
  safe_not_equal: Hae,
  set_attributes: MP
} = window.__gradio__svelte__internal, { onMount: qae } = window.__gradio__svelte__internal, { get_current_component: jae } = window.__gradio__svelte__internal;
function Kae(e) {
  let t, n, r, i, a, o = [
    {
      class: n = ni({
        [
          /*className*/
          e[1]
        ]: !0,
        "mdc-text-field__input": !0
      })
    },
    { type: (
      /*type*/
      e[2]
    ) },
    { placeholder: (
      /*placeholder*/
      e[3]
    ) },
    /*valueProp*/
    e[4],
    /*internalAttrs*/
    e[6],
    /*$$restProps*/
    e[10]
  ], s = {};
  for (let u = 0; u < o.length; u += 1)
    s = Q_(s, o[u]);
  return {
    c() {
      t = Lae("input"), MP(t, s);
    },
    m(u, l) {
      Gae(u, t, l), t.autofocus && t.focus(), e[26](t), i || (a = [
        AP(r = Zs.call(
          null,
          t,
          /*use*/
          e[0]
        )),
        AP(
          /*forwardEvents*/
          e[7].call(null, t)
        ),
        tg(
          t,
          "input",
          /*input_handler*/
          e[27]
        ),
        tg(
          t,
          "change",
          /*changeHandler*/
          e[9]
        ),
        tg(
          t,
          "blur",
          /*blur_handler*/
          e[24]
        ),
        tg(
          t,
          "focus",
          /*focus_handler*/
          e[25]
        )
      ], i = !0);
    },
    p(u, [l]) {
      MP(t, s = Fae(o, [
        l & /*className*/
        2 && n !== (n = ni({
          [
            /*className*/
            u[1]
          ]: !0,
          "mdc-text-field__input": !0
        })) && { class: n },
        l & /*type*/
        4 && { type: (
          /*type*/
          u[2]
        ) },
        l & /*placeholder*/
        8 && { placeholder: (
          /*placeholder*/
          u[3]
        ) },
        l & /*valueProp*/
        16 && /*valueProp*/
        u[4],
        l & /*internalAttrs*/
        64 && /*internalAttrs*/
        u[6],
        l & /*$$restProps*/
        1024 && /*$$restProps*/
        u[10]
      ])), r && zae(r.update) && l & /*use*/
      1 && r.update.call(
        null,
        /*use*/
        u[0]
      );
    },
    i: PP,
    o: PP,
    d(u) {
      u && Rae(t), e[26](null), i = !1, Uae(a);
    }
  };
}
function Yae(e) {
  return e === "" ? Number.NaN : +e;
}
function Wae(e, t, n) {
  const r = [
    "use",
    "class",
    "type",
    "placeholder",
    "value",
    "files",
    "dirty",
    "invalid",
    "updateInvalid",
    "emptyValueNull",
    "emptyValueUndefined",
    "getAttr",
    "addAttr",
    "removeAttr",
    "focus",
    "blur",
    "getElement"
  ];
  let i = IP(t, r);
  const a = gd(jae());
  let o = () => {
  };
  function s(V) {
    return V === o;
  }
  let { use: u = [] } = t, { class: l = "" } = t, { type: c = "text" } = t, { placeholder: d = " " } = t, { value: f = o } = t;
  const p = s(f);
  p && (f = "");
  let { files: g = null } = t, { dirty: m = !1 } = t, { invalid: v = !1 } = t, { updateInvalid: h = !0 } = t, { emptyValueNull: y = f === null } = t;
  p && y && (f = null);
  let { emptyValueUndefined: x = f === void 0 } = t;
  p && x && (f = void 0);
  let S, b = {}, _ = {};
  qae(() => {
    h && n(14, v = S.matches(":invalid"));
  });
  function C(V) {
    if (c === "file") {
      n(12, g = V.currentTarget.files);
      return;
    }
    if (V.currentTarget.value === "" && y) {
      n(11, f = null);
      return;
    }
    if (V.currentTarget.value === "" && x) {
      n(11, f = void 0);
      return;
    }
    switch (c) {
      case "number":
      case "range":
        n(11, f = Yae(V.currentTarget.value));
        break;
      default:
        n(11, f = V.currentTarget.value);
        break;
    }
  }
  function w(V) {
    (c === "file" || c === "range") && C(V), n(13, m = !0), h && n(14, v = S.matches(":invalid"));
  }
  function I(V) {
    var G;
    return V in b ? (G = b[V]) !== null && G !== void 0 ? G : null : k().getAttribute(V);
  }
  function M(V, G) {
    b[V] !== G && n(6, b[V] = G, b);
  }
  function E(V) {
    (!(V in b) || b[V] != null) && n(6, b[V] = void 0, b);
  }
  function T() {
    k().focus();
  }
  function P() {
    k().blur();
  }
  function k() {
    return S;
  }
  function D(V) {
    wP.call(this, e, V);
  }
  function B(V) {
    wP.call(this, e, V);
  }
  function L(V) {
    Bae[V ? "unshift" : "push"](() => {
      S = V, n(5, S);
    });
  }
  const F = (V) => c !== "file" && C(V);
  return e.$$set = (V) => {
    t = Q_(Q_({}, t), Nae(V)), n(10, i = IP(t, r)), "use" in V && n(0, u = V.use), "class" in V && n(1, l = V.class), "type" in V && n(2, c = V.type), "placeholder" in V && n(3, d = V.placeholder), "value" in V && n(11, f = V.value), "files" in V && n(12, g = V.files), "dirty" in V && n(13, m = V.dirty), "invalid" in V && n(14, v = V.invalid), "updateInvalid" in V && n(15, h = V.updateInvalid), "emptyValueNull" in V && n(16, y = V.emptyValueNull), "emptyValueUndefined" in V && n(17, x = V.emptyValueUndefined);
  }, e.$$.update = () => {
    e.$$.dirty & /*type, valueProp, value*/
    2068 && (c === "file" ? (delete _.value, n(4, _), n(2, c), n(11, f)) : n(4, _.value = f ?? "", _));
  }, [
    u,
    l,
    c,
    d,
    _,
    S,
    b,
    a,
    C,
    w,
    i,
    f,
    g,
    m,
    v,
    h,
    y,
    x,
    I,
    M,
    E,
    T,
    P,
    k,
    D,
    B,
    L,
    F
  ];
}
class Xae extends Oae {
  constructor(t) {
    super(), Vae(this, t, Wae, Kae, Hae, {
      use: 0,
      class: 1,
      type: 2,
      placeholder: 3,
      value: 11,
      files: 12,
      dirty: 13,
      invalid: 14,
      updateInvalid: 15,
      emptyValueNull: 16,
      emptyValueUndefined: 17,
      getAttr: 18,
      addAttr: 19,
      removeAttr: 20,
      focus: 21,
      blur: 22,
      getElement: 23
    });
  }
  get getAttr() {
    return this.$$.ctx[18];
  }
  get addAttr() {
    return this.$$.ctx[19];
  }
  get removeAttr() {
    return this.$$.ctx[20];
  }
  get focus() {
    return this.$$.ctx[21];
  }
  get blur() {
    return this.$$.ctx[22];
  }
  get getElement() {
    return this.$$.ctx[23];
  }
}
const {
  SvelteComponent: Zae,
  action_destroyer: EP,
  assign: J_,
  binding_callbacks: Qae,
  bubble: TP,
  compute_rest_props: kP,
  detach: Jae,
  element: $ae,
  exclude_internal_props: eoe,
  get_spread_update: toe,
  init: noe,
  insert: roe,
  is_function: ioe,
  listen: ng,
  noop: DP,
  run_all: aoe,
  safe_not_equal: ooe,
  set_attributes: OP,
  set_input_value: BP
} = window.__gradio__svelte__internal, { onMount: soe } = window.__gradio__svelte__internal, { get_current_component: uoe } = window.__gradio__svelte__internal;
function loe(e) {
  let t, n, r, i, a, o, s = [
    {
      class: n = ni({
        [
          /*className*/
          e[2]
        ]: !0,
        "mdc-text-field__input": !0
      })
    },
    {
      style: r = `${/*resizable*/
      e[4] ? "" : "resize: none; "}${/*style*/
      e[3]}`
    },
    /*internalAttrs*/
    e[6],
    /*$$restProps*/
    e[9]
  ], u = {};
  for (let l = 0; l < s.length; l += 1)
    u = J_(u, s[l]);
  return {
    c() {
      t = $ae("textarea"), OP(t, u);
    },
    m(l, c) {
      roe(l, t, c), t.autofocus && t.focus(), e[21](t), BP(
        t,
        /*value*/
        e[0]
      ), a || (o = [
        EP(i = Zs.call(
          null,
          t,
          /*use*/
          e[1]
        )),
        EP(
          /*forwardEvents*/
          e[7].call(null, t)
        ),
        ng(
          t,
          "change",
          /*changeHandler*/
          e[8]
        ),
        ng(
          t,
          "blur",
          /*blur_handler*/
          e[19]
        ),
        ng(
          t,
          "focus",
          /*focus_handler*/
          e[20]
        ),
        ng(
          t,
          "input",
          /*textarea_input_handler*/
          e[22]
        )
      ], a = !0);
    },
    p(l, [c]) {
      OP(t, u = toe(s, [
        c & /*className*/
        4 && n !== (n = ni({
          [
            /*className*/
            l[2]
          ]: !0,
          "mdc-text-field__input": !0
        })) && { class: n },
        c & /*resizable, style*/
        24 && r !== (r = `${/*resizable*/
        l[4] ? "" : "resize: none; "}${/*style*/
        l[3]}`) && { style: r },
        c & /*internalAttrs*/
        64 && /*internalAttrs*/
        l[6],
        c & /*$$restProps*/
        512 && /*$$restProps*/
        l[9]
      ])), i && ioe(i.update) && c & /*use*/
      2 && i.update.call(
        null,
        /*use*/
        l[1]
      ), c & /*value*/
      1 && BP(
        t,
        /*value*/
        l[0]
      );
    },
    i: DP,
    o: DP,
    d(l) {
      l && Jae(t), e[21](null), a = !1, aoe(o);
    }
  };
}
function coe(e, t, n) {
  const r = [
    "use",
    "class",
    "style",
    "value",
    "dirty",
    "invalid",
    "updateInvalid",
    "resizable",
    "getAttr",
    "addAttr",
    "removeAttr",
    "focus",
    "blur",
    "getElement"
  ];
  let i = kP(t, r);
  const a = gd(uoe());
  let { use: o = [] } = t, { class: s = "" } = t, { style: u = "" } = t, { value: l = "" } = t, { dirty: c = !1 } = t, { invalid: d = !1 } = t, { updateInvalid: f = !0 } = t, { resizable: p = !0 } = t, g, m = {};
  soe(() => {
    f && n(11, d = g.matches(":invalid"));
  });
  function v() {
    n(10, c = !0), f && n(11, d = g.matches(":invalid"));
  }
  function h(E) {
    var T;
    return E in m ? (T = m[E]) !== null && T !== void 0 ? T : null : _().getAttribute(E);
  }
  function y(E, T) {
    m[E] !== T && n(6, m[E] = T, m);
  }
  function x(E) {
    (!(E in m) || m[E] != null) && n(6, m[E] = void 0, m);
  }
  function S() {
    _().focus();
  }
  function b() {
    _().blur();
  }
  function _() {
    return g;
  }
  function C(E) {
    TP.call(this, e, E);
  }
  function w(E) {
    TP.call(this, e, E);
  }
  function I(E) {
    Qae[E ? "unshift" : "push"](() => {
      g = E, n(5, g);
    });
  }
  function M() {
    l = this.value, n(0, l);
  }
  return e.$$set = (E) => {
    t = J_(J_({}, t), eoe(E)), n(9, i = kP(t, r)), "use" in E && n(1, o = E.use), "class" in E && n(2, s = E.class), "style" in E && n(3, u = E.style), "value" in E && n(0, l = E.value), "dirty" in E && n(10, c = E.dirty), "invalid" in E && n(11, d = E.invalid), "updateInvalid" in E && n(12, f = E.updateInvalid), "resizable" in E && n(4, p = E.resizable);
  }, [
    l,
    o,
    s,
    u,
    p,
    g,
    m,
    a,
    v,
    i,
    c,
    d,
    f,
    h,
    y,
    x,
    S,
    b,
    _,
    C,
    w,
    I,
    M
  ];
}
class doe extends Zae {
  constructor(t) {
    super(), noe(this, t, coe, loe, ooe, {
      use: 1,
      class: 2,
      style: 3,
      value: 0,
      dirty: 10,
      invalid: 11,
      updateInvalid: 12,
      resizable: 4,
      getAttr: 13,
      addAttr: 14,
      removeAttr: 15,
      focus: 16,
      blur: 17,
      getElement: 18
    });
  }
  get getAttr() {
    return this.$$.ctx[13];
  }
  get addAttr() {
    return this.$$.ctx[14];
  }
  get removeAttr() {
    return this.$$.ctx[15];
  }
  get focus() {
    return this.$$.ctx[16];
  }
  get blur() {
    return this.$$.ctx[17];
  }
  get getElement() {
    return this.$$.ctx[18];
  }
}
const {
  SvelteComponent: foe,
  action_destroyer: U1,
  add_flush_callback: ef,
  append: ks,
  assign: qs,
  attr: $_,
  bind: tf,
  binding_callbacks: Aa,
  check_outros: yl,
  compute_rest_props: RP,
  compute_slots: moe,
  create_component: wo,
  create_slot: Xa,
  destroy_component: Io,
  detach: $i,
  element: B3,
  empty: W8,
  exclude_internal_props: poe,
  get_all_dirty_from_scope: Za,
  get_slot_changes: Qa,
  get_spread_object: cd,
  get_spread_update: Wl,
  group_outros: bl,
  init: hoe,
  insert: ea,
  is_function: zv,
  listen: hu,
  mount_component: Po,
  run_all: oL,
  safe_not_equal: goe,
  set_attributes: Uv,
  set_data: R3,
  space: Wi,
  text: L3,
  transition_in: Ut,
  transition_out: on,
  update_slot_base: Ja
} = window.__gradio__svelte__internal, { onMount: voe, onDestroy: yoe, getContext: boe, tick: _oe } = window.__gradio__svelte__internal, { get_current_component: xoe } = window.__gradio__svelte__internal, Coe = (e) => ({}), LP = (e) => ({}), Soe = (e) => ({}), NP = (e) => ({}), Aoe = (e) => ({}), FP = (e) => ({}), woe = (e) => ({}), VP = (e) => ({}), Ioe = (e) => ({}), GP = (e) => ({}), Poe = (e) => ({}), zP = (e) => ({}), Moe = (e) => ({}), UP = (e) => ({}), Eoe = (e) => ({}), HP = (e) => ({}), Toe = (e) => ({}), qP = (e) => ({}), koe = (e) => ({}), jP = (e) => ({}), Doe = (e) => ({}), KP = (e) => ({}), Ooe = (e) => ({}), YP = (e) => ({});
function Boe(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g;
  const m = (
    /*#slots*/
    e[56].label
  ), v = Xa(
    m,
    e,
    /*$$scope*/
    e[87],
    GP
  );
  r = new Bv({
    props: {
      key: "SMUI:textfield:icon:leading",
      value: !0,
      $$slots: { default: [Loe] },
      $$scope: { ctx: e }
    }
  });
  const h = (
    /*#slots*/
    e[56].default
  ), y = Xa(
    h,
    e,
    /*$$scope*/
    e[87],
    null
  );
  o = new Bv({
    props: {
      key: "SMUI:textfield:icon:leading",
      value: !1,
      $$slots: { default: [Noe] },
      $$scope: { ctx: e }
    }
  });
  const x = (
    /*#slots*/
    e[56].ripple
  ), S = Xa(
    x,
    e,
    /*$$scope*/
    e[87],
    NP
  );
  let b = [
    {
      class: u = ni({
        [
          /*className*/
          e[9]
        ]: !0,
        "mdc-text-field": !0,
        "mdc-text-field--disabled": (
          /*disabled*/
          e[12]
        ),
        "mdc-text-field--textarea": (
          /*textarea*/
          e[14]
        ),
        "mdc-text-field--filled": (
          /*variant*/
          e[15] === "filled"
        ),
        "mdc-text-field--outlined": (
          /*variant*/
          e[15] === "outlined"
        ),
        "smui-text-field--standard": (
          /*variant*/
          e[15] === "standard" && !/*textarea*/
          e[14]
        ),
        "mdc-text-field--no-label": (
          /*noLabel*/
          e[16] || !/*$$slots*/
          e[47].label
        ),
        "mdc-text-field--with-leading-icon": (
          /*$$slots*/
          e[47].leadingIcon
        ),
        "mdc-text-field--with-trailing-icon": (
          /*$$slots*/
          e[47].trailingIcon
        ),
        "mdc-text-field--invalid": (
          /*invalid*/
          e[1]
        ),
        .../*internalClasses*/
        e[25]
      })
    },
    {
      style: l = Object.entries(
        /*internalStyles*/
        e[26]
      ).map(iM).concat([
        /*style*/
        e[10]
      ]).join(" ")
    },
    Dv(
      /*$$restProps*/
      e[46],
      ["input$", "label$", "ripple$", "outline$", "helperLine$"]
    )
  ], _ = {};
  for (let C = 0; C < b.length; C += 1)
    _ = qs(_, b[C]);
  return {
    c() {
      t = B3("div"), v && v.c(), n = Wi(), wo(r.$$.fragment), i = Wi(), y && y.c(), a = Wi(), wo(o.$$.fragment), s = Wi(), S && S.c(), Uv(t, _);
    },
    m(C, w) {
      ea(C, t, w), v && v.m(t, null), ks(t, n), Po(r, t, null), ks(t, i), y && y.m(t, null), ks(t, a), Po(o, t, null), ks(t, s), S && S.m(t, null), e[82](t), f = !0, p || (g = [
        U1(c = WR.call(null, t, {
          ripple: (
            /*ripple*/
            e[11]
          ),
          unbounded: !1,
          addClass: (
            /*addClass*/
            e[43]
          ),
          removeClass: (
            /*removeClass*/
            e[44]
          ),
          addStyle: (
            /*addStyle*/
            e[45]
          )
        })),
        U1(d = Zs.call(
          null,
          t,
          /*use*/
          e[8]
        )),
        U1(
          /*forwardEvents*/
          e[34].call(null, t)
        ),
        hu(
          t,
          "SMUITextfieldLeadingIcon:mount",
          /*handleLeadingIconMount*/
          e[38]
        ),
        hu(
          t,
          "SMUITextfieldLeadingIcon:unmount",
          /*SMUITextfieldLeadingIcon_unmount_handler_1*/
          e[83]
        ),
        hu(
          t,
          "SMUITextfieldTrailingIcon:mount",
          /*handleTrailingIconMount*/
          e[39]
        ),
        hu(
          t,
          "SMUITextfieldTrailingIcon:unmount",
          /*SMUITextfieldTrailingIcon_unmount_handler_1*/
          e[84]
        )
      ], p = !0);
    },
    p(C, w) {
      v && v.p && (!f || w[2] & /*$$scope*/
      33554432) && Ja(
        v,
        m,
        C,
        /*$$scope*/
        C[87],
        f ? Qa(
          m,
          /*$$scope*/
          C[87],
          w,
          Ioe
        ) : Za(
          /*$$scope*/
          C[87]
        ),
        GP
      );
      const I = {};
      w[2] & /*$$scope*/
      33554432 && (I.$$scope = { dirty: w, ctx: C }), r.$set(I), y && y.p && (!f || w[2] & /*$$scope*/
      33554432) && Ja(
        y,
        h,
        C,
        /*$$scope*/
        C[87],
        f ? Qa(
          h,
          /*$$scope*/
          C[87],
          w,
          null
        ) : Za(
          /*$$scope*/
          C[87]
        ),
        null
      );
      const M = {};
      w[2] & /*$$scope*/
      33554432 && (M.$$scope = { dirty: w, ctx: C }), o.$set(M), S && S.p && (!f || w[2] & /*$$scope*/
      33554432) && Ja(
        S,
        x,
        C,
        /*$$scope*/
        C[87],
        f ? Qa(
          x,
          /*$$scope*/
          C[87],
          w,
          Soe
        ) : Za(
          /*$$scope*/
          C[87]
        ),
        NP
      ), Uv(t, _ = Wl(b, [
        (!f || w[0] & /*className, disabled, textarea, variant, noLabel, invalid, internalClasses*/
        33673730 | w[1] & /*$$slots*/
        65536 && u !== (u = ni({
          [
            /*className*/
            C[9]
          ]: !0,
          "mdc-text-field": !0,
          "mdc-text-field--disabled": (
            /*disabled*/
            C[12]
          ),
          "mdc-text-field--textarea": (
            /*textarea*/
            C[14]
          ),
          "mdc-text-field--filled": (
            /*variant*/
            C[15] === "filled"
          ),
          "mdc-text-field--outlined": (
            /*variant*/
            C[15] === "outlined"
          ),
          "smui-text-field--standard": (
            /*variant*/
            C[15] === "standard" && !/*textarea*/
            C[14]
          ),
          "mdc-text-field--no-label": (
            /*noLabel*/
            C[16] || !/*$$slots*/
            C[47].label
          ),
          "mdc-text-field--with-leading-icon": (
            /*$$slots*/
            C[47].leadingIcon
          ),
          "mdc-text-field--with-trailing-icon": (
            /*$$slots*/
            C[47].trailingIcon
          ),
          "mdc-text-field--invalid": (
            /*invalid*/
            C[1]
          ),
          .../*internalClasses*/
          C[25]
        }))) && { class: u },
        (!f || w[0] & /*internalStyles, style*/
        67109888 && l !== (l = Object.entries(
          /*internalStyles*/
          C[26]
        ).map(iM).concat([
          /*style*/
          C[10]
        ]).join(" "))) && { style: l },
        w[1] & /*$$restProps*/
        32768 && Dv(
          /*$$restProps*/
          C[46],
          ["input$", "label$", "ripple$", "outline$", "helperLine$"]
        )
      ])), c && zv(c.update) && w[0] & /*ripple*/
      2048 && c.update.call(null, {
        ripple: (
          /*ripple*/
          C[11]
        ),
        unbounded: !1,
        addClass: (
          /*addClass*/
          C[43]
        ),
        removeClass: (
          /*removeClass*/
          C[44]
        ),
        addStyle: (
          /*addStyle*/
          C[45]
        )
      }), d && zv(d.update) && w[0] & /*use*/
      256 && d.update.call(
        null,
        /*use*/
        C[8]
      );
    },
    i(C) {
      f || (Ut(v, C), Ut(r.$$.fragment, C), Ut(y, C), Ut(o.$$.fragment, C), Ut(S, C), f = !0);
    },
    o(C) {
      on(v, C), on(r.$$.fragment, C), on(y, C), on(o.$$.fragment, C), on(S, C), f = !1;
    },
    d(C) {
      C && $i(t), v && v.d(C), Io(r), y && y.d(C), Io(o), S && S.d(C), e[82](null), p = !1, oL(g);
    }
  };
}
function Roe(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x = !/*textarea*/
  e[14] && /*variant*/
  e[15] !== "outlined" && WP(e), S = (
    /*textarea*/
    (e[14] || /*variant*/
    e[15] === "outlined") && QP(e)
  );
  i = new Bv({
    props: {
      key: "SMUI:textfield:icon:leading",
      value: !0,
      $$slots: { default: [zoe] },
      $$scope: { ctx: e }
    }
  });
  const b = (
    /*#slots*/
    e[56].default
  ), _ = Xa(
    b,
    e,
    /*$$scope*/
    e[87],
    null
  ), C = [Hoe, Uoe], w = [];
  function I(P, k) {
    return (
      /*textarea*/
      P[14] && typeof /*value*/
      P[0] == "string" ? 0 : 1
    );
  }
  s = I(e), u = w[s] = C[s](e), c = new Bv({
    props: {
      key: "SMUI:textfield:icon:leading",
      value: !1,
      $$slots: { default: [Koe] },
      $$scope: { ctx: e }
    }
  });
  let M = !/*textarea*/
  e[14] && /*variant*/
  e[15] !== "outlined" && /*ripple*/
  e[11] && tM(e), E = [
    {
      class: f = ni({
        [
          /*className*/
          e[9]
        ]: !0,
        "mdc-text-field": !0,
        "mdc-text-field--disabled": (
          /*disabled*/
          e[12]
        ),
        "mdc-text-field--textarea": (
          /*textarea*/
          e[14]
        ),
        "mdc-text-field--filled": (
          /*variant*/
          e[15] === "filled"
        ),
        "mdc-text-field--outlined": (
          /*variant*/
          e[15] === "outlined"
        ),
        "smui-text-field--standard": (
          /*variant*/
          e[15] === "standard" && !/*textarea*/
          e[14]
        ),
        "mdc-text-field--no-label": (
          /*noLabel*/
          e[16] || /*label*/
          e[17] == null && !/*$$slots*/
          e[47].label
        ),
        "mdc-text-field--label-floating": (
          /*focused*/
          e[28] || /*value*/
          e[0] != null && /*value*/
          e[0] !== ""
        ),
        "mdc-text-field--with-leading-icon": (
          /*isUninitializedValue*/
          e[35](
            /*withLeadingIcon*/
            e[22]
          ) ? (
            /*$$slots*/
            e[47].leadingIcon
          ) : (
            /*withLeadingIcon*/
            e[22]
          )
        ),
        "mdc-text-field--with-trailing-icon": (
          /*isUninitializedValue*/
          e[35](
            /*withTrailingIcon*/
            e[23]
          ) ? (
            /*$$slots*/
            e[47].trailingIcon
          ) : (
            /*withTrailingIcon*/
            e[23]
          )
        ),
        "mdc-text-field--with-internal-counter": (
          /*textarea*/
          e[14] && /*$$slots*/
          e[47].internalCounter
        ),
        "mdc-text-field--invalid": (
          /*invalid*/
          e[1]
        ),
        .../*internalClasses*/
        e[25]
      })
    },
    {
      style: p = Object.entries(
        /*internalStyles*/
        e[26]
      ).map(rM).concat([
        /*style*/
        e[10]
      ]).join(" ")
    },
    {
      for: (
        /* suppress a11y warning, since this is wrapped */
        void 0
      )
    },
    Dv(
      /*$$restProps*/
      e[46],
      ["input$", "label$", "ripple$", "outline$", "helperLine$"]
    )
  ], T = {};
  for (let P = 0; P < E.length; P += 1)
    T = qs(T, E[P]);
  return {
    c() {
      t = B3("label"), x && x.c(), n = Wi(), S && S.c(), r = Wi(), wo(i.$$.fragment), a = Wi(), _ && _.c(), o = Wi(), u.c(), l = Wi(), wo(c.$$.fragment), d = Wi(), M && M.c(), Uv(t, T);
    },
    m(P, k) {
      ea(P, t, k), x && x.m(t, null), ks(t, n), S && S.m(t, null), ks(t, r), Po(i, t, null), ks(t, a), _ && _.m(t, null), ks(t, o), w[s].m(t, null), ks(t, l), Po(c, t, null), ks(t, d), M && M.m(t, null), e[78](t), v = !0, h || (y = [
        U1(g = WR.call(null, t, {
          ripple: !/*textarea*/
          e[14] && /*variant*/
          e[15] === "filled",
          unbounded: !1,
          addClass: (
            /*addClass*/
            e[43]
          ),
          removeClass: (
            /*removeClass*/
            e[44]
          ),
          addStyle: (
            /*addStyle*/
            e[45]
          ),
          eventTarget: (
            /*inputElement*/
            e[33]
          ),
          activeTarget: (
            /*inputElement*/
            e[33]
          ),
          initPromise: (
            /*initPromise*/
            e[37]
          )
        })),
        U1(m = Zs.call(
          null,
          t,
          /*use*/
          e[8]
        )),
        U1(
          /*forwardEvents*/
          e[34].call(null, t)
        ),
        hu(
          t,
          "SMUITextfieldLeadingIcon:mount",
          /*handleLeadingIconMount*/
          e[38]
        ),
        hu(
          t,
          "SMUITextfieldLeadingIcon:unmount",
          /*SMUITextfieldLeadingIcon_unmount_handler*/
          e[79]
        ),
        hu(
          t,
          "SMUITextfieldTrailingIcon:mount",
          /*handleTrailingIconMount*/
          e[39]
        ),
        hu(
          t,
          "SMUITextfieldTrailingIcon:unmount",
          /*SMUITextfieldTrailingIcon_unmount_handler*/
          e[80]
        ),
        hu(
          t,
          "SMUITextfieldCharacterCounter:mount",
          /*handleCharacterCounterMount*/
          e[40]
        ),
        hu(
          t,
          "SMUITextfieldCharacterCounter:unmount",
          /*SMUITextfieldCharacterCounter_unmount_handler*/
          e[81]
        )
      ], h = !0);
    },
    p(P, k) {
      !/*textarea*/
      P[14] && /*variant*/
      P[15] !== "outlined" ? x ? (x.p(P, k), k[0] & /*textarea, variant*/
      49152 && Ut(x, 1)) : (x = WP(P), x.c(), Ut(x, 1), x.m(t, n)) : x && (bl(), on(x, 1, 1, () => {
        x = null;
      }), yl()), /*textarea*/
      P[14] || /*variant*/
      P[15] === "outlined" ? S ? (S.p(P, k), k[0] & /*textarea, variant*/
      49152 && Ut(S, 1)) : (S = QP(P), S.c(), Ut(S, 1), S.m(t, r)) : S && (bl(), on(S, 1, 1, () => {
        S = null;
      }), yl());
      const D = {};
      k[2] & /*$$scope*/
      33554432 && (D.$$scope = { dirty: k, ctx: P }), i.$set(D), _ && _.p && (!v || k[2] & /*$$scope*/
      33554432) && Ja(
        _,
        b,
        P,
        /*$$scope*/
        P[87],
        v ? Qa(
          b,
          /*$$scope*/
          P[87],
          k,
          null
        ) : Za(
          /*$$scope*/
          P[87]
        ),
        null
      );
      let B = s;
      s = I(P), s === B ? w[s].p(P, k) : (bl(), on(w[B], 1, 1, () => {
        w[B] = null;
      }), yl(), u = w[s], u ? u.p(P, k) : (u = w[s] = C[s](P), u.c()), Ut(u, 1), u.m(t, l));
      const L = {};
      k[2] & /*$$scope*/
      33554432 && (L.$$scope = { dirty: k, ctx: P }), c.$set(L), !/*textarea*/
      P[14] && /*variant*/
      P[15] !== "outlined" && /*ripple*/
      P[11] ? M ? (M.p(P, k), k[0] & /*textarea, variant, ripple*/
      51200 && Ut(M, 1)) : (M = tM(P), M.c(), Ut(M, 1), M.m(t, null)) : M && (bl(), on(M, 1, 1, () => {
        M = null;
      }), yl()), Uv(t, T = Wl(E, [
        (!v || k[0] & /*className, disabled, textarea, variant, noLabel, label, focused, value, withLeadingIcon, withTrailingIcon, invalid, internalClasses*/
        314823171 | k[1] & /*$$slots*/
        65536 && f !== (f = ni({
          [
            /*className*/
            P[9]
          ]: !0,
          "mdc-text-field": !0,
          "mdc-text-field--disabled": (
            /*disabled*/
            P[12]
          ),
          "mdc-text-field--textarea": (
            /*textarea*/
            P[14]
          ),
          "mdc-text-field--filled": (
            /*variant*/
            P[15] === "filled"
          ),
          "mdc-text-field--outlined": (
            /*variant*/
            P[15] === "outlined"
          ),
          "smui-text-field--standard": (
            /*variant*/
            P[15] === "standard" && !/*textarea*/
            P[14]
          ),
          "mdc-text-field--no-label": (
            /*noLabel*/
            P[16] || /*label*/
            P[17] == null && !/*$$slots*/
            P[47].label
          ),
          "mdc-text-field--label-floating": (
            /*focused*/
            P[28] || /*value*/
            P[0] != null && /*value*/
            P[0] !== ""
          ),
          "mdc-text-field--with-leading-icon": (
            /*isUninitializedValue*/
            P[35](
              /*withLeadingIcon*/
              P[22]
            ) ? (
              /*$$slots*/
              P[47].leadingIcon
            ) : (
              /*withLeadingIcon*/
              P[22]
            )
          ),
          "mdc-text-field--with-trailing-icon": (
            /*isUninitializedValue*/
            P[35](
              /*withTrailingIcon*/
              P[23]
            ) ? (
              /*$$slots*/
              P[47].trailingIcon
            ) : (
              /*withTrailingIcon*/
              P[23]
            )
          ),
          "mdc-text-field--with-internal-counter": (
            /*textarea*/
            P[14] && /*$$slots*/
            P[47].internalCounter
          ),
          "mdc-text-field--invalid": (
            /*invalid*/
            P[1]
          ),
          .../*internalClasses*/
          P[25]
        }))) && { class: f },
        (!v || k[0] & /*internalStyles, style*/
        67109888 && p !== (p = Object.entries(
          /*internalStyles*/
          P[26]
        ).map(rM).concat([
          /*style*/
          P[10]
        ]).join(" "))) && { style: p },
        {
          for: (
            /* suppress a11y warning, since this is wrapped */
            void 0
          )
        },
        k[1] & /*$$restProps*/
        32768 && Dv(
          /*$$restProps*/
          P[46],
          ["input$", "label$", "ripple$", "outline$", "helperLine$"]
        )
      ])), g && zv(g.update) && k[0] & /*textarea, variant*/
      49152 | k[1] & /*inputElement*/
      4 && g.update.call(null, {
        ripple: !/*textarea*/
        P[14] && /*variant*/
        P[15] === "filled",
        unbounded: !1,
        addClass: (
          /*addClass*/
          P[43]
        ),
        removeClass: (
          /*removeClass*/
          P[44]
        ),
        addStyle: (
          /*addStyle*/
          P[45]
        ),
        eventTarget: (
          /*inputElement*/
          P[33]
        ),
        activeTarget: (
          /*inputElement*/
          P[33]
        ),
        initPromise: (
          /*initPromise*/
          P[37]
        )
      }), m && zv(m.update) && k[0] & /*use*/
      256 && m.update.call(
        null,
        /*use*/
        P[8]
      );
    },
    i(P) {
      v || (Ut(x), Ut(S), Ut(i.$$.fragment, P), Ut(_, P), Ut(u), Ut(c.$$.fragment, P), Ut(M), v = !0);
    },
    o(P) {
      on(x), on(S), on(i.$$.fragment, P), on(_, P), on(u), on(c.$$.fragment, P), on(M), v = !1;
    },
    d(P) {
      P && $i(t), x && x.d(), S && S.d(), Io(i), _ && _.d(P), w[s].d(), Io(c), M && M.d(), e[78](null), h = !1, oL(y);
    }
  };
}
function Loe(e) {
  let t;
  const n = (
    /*#slots*/
    e[56].leadingIcon
  ), r = Xa(
    n,
    e,
    /*$$scope*/
    e[87],
    VP
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a[2] & /*$$scope*/
      33554432) && Ja(
        r,
        n,
        i,
        /*$$scope*/
        i[87],
        t ? Qa(
          n,
          /*$$scope*/
          i[87],
          a,
          woe
        ) : Za(
          /*$$scope*/
          i[87]
        ),
        VP
      );
    },
    i(i) {
      t || (Ut(r, i), t = !0);
    },
    o(i) {
      on(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function Noe(e) {
  let t;
  const n = (
    /*#slots*/
    e[56].trailingIcon
  ), r = Xa(
    n,
    e,
    /*$$scope*/
    e[87],
    FP
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a[2] & /*$$scope*/
      33554432) && Ja(
        r,
        n,
        i,
        /*$$scope*/
        i[87],
        t ? Qa(
          n,
          /*$$scope*/
          i[87],
          a,
          Aoe
        ) : Za(
          /*$$scope*/
          i[87]
        ),
        FP
      );
    },
    i(i) {
      t || (Ut(r, i), t = !0);
    },
    o(i) {
      on(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function WP(e) {
  let t, n, r, i = (
    /*variant*/
    e[15] === "filled" && XP()
  ), a = !/*noLabel*/
  e[16] && /*label*/
  (e[17] != null || /*$$slots*/
  e[47].label) && ZP(e);
  return {
    c() {
      i && i.c(), t = Wi(), a && a.c(), n = W8();
    },
    m(o, s) {
      i && i.m(o, s), ea(o, t, s), a && a.m(o, s), ea(o, n, s), r = !0;
    },
    p(o, s) {
      /*variant*/
      o[15] === "filled" ? i || (i = XP(), i.c(), i.m(t.parentNode, t)) : i && (i.d(1), i = null), !/*noLabel*/
      o[16] && /*label*/
      (o[17] != null || /*$$slots*/
      o[47].label) ? a ? (a.p(o, s), s[0] & /*noLabel, label*/
      196608 | s[1] & /*$$slots*/
      65536 && Ut(a, 1)) : (a = ZP(o), a.c(), Ut(a, 1), a.m(n.parentNode, n)) : a && (bl(), on(a, 1, 1, () => {
        a = null;
      }), yl());
    },
    i(o) {
      r || (Ut(a), r = !0);
    },
    o(o) {
      on(a), r = !1;
    },
    d(o) {
      o && ($i(t), $i(n)), i && i.d(o), a && a.d(o);
    }
  };
}
function XP(e) {
  let t;
  return {
    c() {
      t = B3("span"), $_(t, "class", "mdc-text-field__ripple");
    },
    m(n, r) {
      ea(n, t, r);
    },
    d(n) {
      n && $i(t);
    }
  };
}
function ZP(e) {
  let t, n;
  const r = [
    {
      floatAbove: (
        /*focused*/
        e[28] || /*value*/
        e[0] != null && /*value*/
        e[0] !== "" && (typeof /*value*/
        e[0] != "number" || !isNaN(
          /*value*/
          e[0]
        ))
      )
    },
    { required: (
      /*required*/
      e[13]
    ) },
    { wrapped: !0 },
    no(
      /*$$restProps*/
      e[46],
      "label$"
    )
  ];
  let i = {
    $$slots: { default: [Foe] },
    $$scope: { ctx: e }
  };
  for (let a = 0; a < r.length; a += 1)
    i = qs(i, r[a]);
  return t = new rL({ props: i }), e[57](t), {
    c() {
      wo(t.$$.fragment);
    },
    m(a, o) {
      Po(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o[0] & /*focused, value, required*/
      268443649 | o[1] & /*$$restProps*/
      32768 ? Wl(r, [
        o[0] & /*focused, value*/
        268435457 && {
          floatAbove: (
            /*focused*/
            a[28] || /*value*/
            a[0] != null && /*value*/
            a[0] !== "" && (typeof /*value*/
            a[0] != "number" || !isNaN(
              /*value*/
              a[0]
            ))
          )
        },
        o[0] & /*required*/
        8192 && { required: (
          /*required*/
          a[13]
        ) },
        r[2],
        o[1] & /*$$restProps*/
        32768 && cd(no(
          /*$$restProps*/
          a[46],
          "label$"
        ))
      ]) : {};
      o[0] & /*label*/
      131072 | o[2] & /*$$scope*/
      33554432 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
    },
    i(a) {
      n || (Ut(t.$$.fragment, a), n = !0);
    },
    o(a) {
      on(t.$$.fragment, a), n = !1;
    },
    d(a) {
      e[57](null), Io(t, a);
    }
  };
}
function Foe(e) {
  let t = (
    /*label*/
    (e[17] == null ? "" : (
      /*label*/
      e[17]
    )) + ""
  ), n, r;
  const i = (
    /*#slots*/
    e[56].label
  ), a = Xa(
    i,
    e,
    /*$$scope*/
    e[87],
    YP
  );
  return {
    c() {
      n = L3(t), a && a.c();
    },
    m(o, s) {
      ea(o, n, s), a && a.m(o, s), r = !0;
    },
    p(o, s) {
      (!r || s[0] & /*label*/
      131072) && t !== (t = /*label*/
      (o[17] == null ? "" : (
        /*label*/
        o[17]
      )) + "") && R3(n, t), a && a.p && (!r || s[2] & /*$$scope*/
      33554432) && Ja(
        a,
        i,
        o,
        /*$$scope*/
        o[87],
        r ? Qa(
          i,
          /*$$scope*/
          o[87],
          s,
          Ooe
        ) : Za(
          /*$$scope*/
          o[87]
        ),
        YP
      );
    },
    i(o) {
      r || (Ut(a, o), r = !0);
    },
    o(o) {
      on(a, o), r = !1;
    },
    d(o) {
      o && $i(n), a && a.d(o);
    }
  };
}
function QP(e) {
  let t, n;
  const r = [
    {
      noLabel: (
        /*noLabel*/
        e[16] || /*label*/
        e[17] == null && !/*$$slots*/
        e[47].label
      )
    },
    no(
      /*$$restProps*/
      e[46],
      "outline$"
    )
  ];
  let i = {
    $$slots: { default: [Goe] },
    $$scope: { ctx: e }
  };
  for (let a = 0; a < r.length; a += 1)
    i = qs(i, r[a]);
  return t = new sae({ props: i }), e[59](t), {
    c() {
      wo(t.$$.fragment);
    },
    m(a, o) {
      Po(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o[0] & /*noLabel, label*/
      196608 | o[1] & /*$$slots, $$restProps*/
      98304 ? Wl(r, [
        o[0] & /*noLabel, label*/
        196608 | o[1] & /*$$slots*/
        65536 && {
          noLabel: (
            /*noLabel*/
            a[16] || /*label*/
            a[17] == null && !/*$$slots*/
            a[47].label
          )
        },
        o[1] & /*$$restProps*/
        32768 && cd(no(
          /*$$restProps*/
          a[46],
          "outline$"
        ))
      ]) : {};
      o[0] & /*focused, value, required, floatingLabel, label, noLabel*/
      268640289 | o[1] & /*$$restProps, $$slots*/
      98304 | o[2] & /*$$scope*/
      33554432 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
    },
    i(a) {
      n || (Ut(t.$$.fragment, a), n = !0);
    },
    o(a) {
      on(t.$$.fragment, a), n = !1;
    },
    d(a) {
      e[59](null), Io(t, a);
    }
  };
}
function JP(e) {
  let t, n;
  const r = [
    {
      floatAbove: (
        /*focused*/
        e[28] || /*value*/
        e[0] != null && /*value*/
        e[0] !== "" && (typeof /*value*/
        e[0] != "number" || !isNaN(
          /*value*/
          e[0]
        ))
      )
    },
    { required: (
      /*required*/
      e[13]
    ) },
    { wrapped: !0 },
    no(
      /*$$restProps*/
      e[46],
      "label$"
    )
  ];
  let i = {
    $$slots: { default: [Voe] },
    $$scope: { ctx: e }
  };
  for (let a = 0; a < r.length; a += 1)
    i = qs(i, r[a]);
  return t = new rL({ props: i }), e[58](t), {
    c() {
      wo(t.$$.fragment);
    },
    m(a, o) {
      Po(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o[0] & /*focused, value, required*/
      268443649 | o[1] & /*$$restProps*/
      32768 ? Wl(r, [
        o[0] & /*focused, value*/
        268435457 && {
          floatAbove: (
            /*focused*/
            a[28] || /*value*/
            a[0] != null && /*value*/
            a[0] !== "" && (typeof /*value*/
            a[0] != "number" || !isNaN(
              /*value*/
              a[0]
            ))
          )
        },
        o[0] & /*required*/
        8192 && { required: (
          /*required*/
          a[13]
        ) },
        r[2],
        o[1] & /*$$restProps*/
        32768 && cd(no(
          /*$$restProps*/
          a[46],
          "label$"
        ))
      ]) : {};
      o[0] & /*label*/
      131072 | o[2] & /*$$scope*/
      33554432 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
    },
    i(a) {
      n || (Ut(t.$$.fragment, a), n = !0);
    },
    o(a) {
      on(t.$$.fragment, a), n = !1;
    },
    d(a) {
      e[58](null), Io(t, a);
    }
  };
}
function Voe(e) {
  let t = (
    /*label*/
    (e[17] == null ? "" : (
      /*label*/
      e[17]
    )) + ""
  ), n, r;
  const i = (
    /*#slots*/
    e[56].label
  ), a = Xa(
    i,
    e,
    /*$$scope*/
    e[87],
    KP
  );
  return {
    c() {
      n = L3(t), a && a.c();
    },
    m(o, s) {
      ea(o, n, s), a && a.m(o, s), r = !0;
    },
    p(o, s) {
      (!r || s[0] & /*label*/
      131072) && t !== (t = /*label*/
      (o[17] == null ? "" : (
        /*label*/
        o[17]
      )) + "") && R3(n, t), a && a.p && (!r || s[2] & /*$$scope*/
      33554432) && Ja(
        a,
        i,
        o,
        /*$$scope*/
        o[87],
        r ? Qa(
          i,
          /*$$scope*/
          o[87],
          s,
          Doe
        ) : Za(
          /*$$scope*/
          o[87]
        ),
        KP
      );
    },
    i(o) {
      r || (Ut(a, o), r = !0);
    },
    o(o) {
      on(a, o), r = !1;
    },
    d(o) {
      o && $i(n), a && a.d(o);
    }
  };
}
function Goe(e) {
  let t, n, r = !/*noLabel*/
  e[16] && /*label*/
  (e[17] != null || /*$$slots*/
  e[47].label) && JP(e);
  return {
    c() {
      r && r.c(), t = W8();
    },
    m(i, a) {
      r && r.m(i, a), ea(i, t, a), n = !0;
    },
    p(i, a) {
      !/*noLabel*/
      i[16] && /*label*/
      (i[17] != null || /*$$slots*/
      i[47].label) ? r ? (r.p(i, a), a[0] & /*noLabel, label*/
      196608 | a[1] & /*$$slots*/
      65536 && Ut(r, 1)) : (r = JP(i), r.c(), Ut(r, 1), r.m(t.parentNode, t)) : r && (bl(), on(r, 1, 1, () => {
        r = null;
      }), yl());
    },
    i(i) {
      n || (Ut(r), n = !0);
    },
    o(i) {
      on(r), n = !1;
    },
    d(i) {
      i && $i(t), r && r.d(i);
    }
  };
}
function zoe(e) {
  let t;
  const n = (
    /*#slots*/
    e[56].leadingIcon
  ), r = Xa(
    n,
    e,
    /*$$scope*/
    e[87],
    jP
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a[2] & /*$$scope*/
      33554432) && Ja(
        r,
        n,
        i,
        /*$$scope*/
        i[87],
        t ? Qa(
          n,
          /*$$scope*/
          i[87],
          a,
          koe
        ) : Za(
          /*$$scope*/
          i[87]
        ),
        jP
      );
    },
    i(i) {
      t || (Ut(r, i), t = !0);
    },
    o(i) {
      on(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function Uoe(e) {
  let t, n, r, i, a, o, s, u, l, c;
  const d = (
    /*#slots*/
    e[56].prefix
  ), f = Xa(
    d,
    e,
    /*$$scope*/
    e[87],
    HP
  );
  let p = (
    /*prefix*/
    e[20] != null && $P(e)
  );
  const g = [
    { type: (
      /*type*/
      e[18]
    ) },
    { disabled: (
      /*disabled*/
      e[12]
    ) },
    { required: (
      /*required*/
      e[13]
    ) },
    { updateInvalid: (
      /*updateInvalid*/
      e[19]
    ) },
    { "aria-controls": (
      /*helperId*/
      e[27]
    ) },
    { "aria-describedby": (
      /*helperId*/
      e[27]
    ) },
    /*noLabel*/
    e[16] && /*label*/
    e[17] != null ? { placeholder: (
      /*label*/
      e[17]
    ) } : {},
    no(
      /*$$restProps*/
      e[46],
      "input$"
    )
  ];
  function m(C) {
    e[69](C);
  }
  function v(C) {
    e[70](C);
  }
  function h(C) {
    e[71](C);
  }
  function y(C) {
    e[72](C);
  }
  let x = {};
  for (let C = 0; C < g.length; C += 1)
    x = qs(x, g[C]);
  /*value*/
  e[0] !== void 0 && (x.value = /*value*/
  e[0]), /*files*/
  e[3] !== void 0 && (x.files = /*files*/
  e[3]), /*dirty*/
  e[4] !== void 0 && (x.dirty = /*dirty*/
  e[4]), /*invalid*/
  e[1] !== void 0 && (x.invalid = /*invalid*/
  e[1]), r = new Xae({ props: x }), e[68](r), Aa.push(() => tf(r, "value", m)), Aa.push(() => tf(r, "files", v)), Aa.push(() => tf(r, "dirty", h)), Aa.push(() => tf(r, "invalid", y)), r.$on(
    "blur",
    /*blur_handler_2*/
    e[73]
  ), r.$on(
    "focus",
    /*focus_handler_2*/
    e[74]
  ), r.$on(
    "blur",
    /*blur_handler_3*/
    e[75]
  ), r.$on(
    "focus",
    /*focus_handler_3*/
    e[76]
  );
  let S = (
    /*suffix*/
    e[21] != null && eM(e)
  );
  const b = (
    /*#slots*/
    e[56].suffix
  ), _ = Xa(
    b,
    e,
    /*$$scope*/
    e[87],
    UP
  );
  return {
    c() {
      f && f.c(), t = Wi(), p && p.c(), n = Wi(), wo(r.$$.fragment), u = Wi(), S && S.c(), l = Wi(), _ && _.c();
    },
    m(C, w) {
      f && f.m(C, w), ea(C, t, w), p && p.m(C, w), ea(C, n, w), Po(r, C, w), ea(C, u, w), S && S.m(C, w), ea(C, l, w), _ && _.m(C, w), c = !0;
    },
    p(C, w) {
      f && f.p && (!c || w[2] & /*$$scope*/
      33554432) && Ja(
        f,
        d,
        C,
        /*$$scope*/
        C[87],
        c ? Qa(
          d,
          /*$$scope*/
          C[87],
          w,
          Eoe
        ) : Za(
          /*$$scope*/
          C[87]
        ),
        HP
      ), /*prefix*/
      C[20] != null ? p ? (p.p(C, w), w[0] & /*prefix*/
      1048576 && Ut(p, 1)) : (p = $P(C), p.c(), Ut(p, 1), p.m(n.parentNode, n)) : p && (bl(), on(p, 1, 1, () => {
        p = null;
      }), yl());
      const I = w[0] & /*type, disabled, required, updateInvalid, helperId, noLabel, label*/
      135213056 | w[1] & /*$$restProps*/
      32768 ? Wl(g, [
        w[0] & /*type*/
        262144 && { type: (
          /*type*/
          C[18]
        ) },
        w[0] & /*disabled*/
        4096 && { disabled: (
          /*disabled*/
          C[12]
        ) },
        w[0] & /*required*/
        8192 && { required: (
          /*required*/
          C[13]
        ) },
        w[0] & /*updateInvalid*/
        524288 && { updateInvalid: (
          /*updateInvalid*/
          C[19]
        ) },
        w[0] & /*helperId*/
        134217728 && { "aria-controls": (
          /*helperId*/
          C[27]
        ) },
        w[0] & /*helperId*/
        134217728 && { "aria-describedby": (
          /*helperId*/
          C[27]
        ) },
        w[0] & /*noLabel, label*/
        196608 && cd(
          /*noLabel*/
          C[16] && /*label*/
          C[17] != null ? { placeholder: (
            /*label*/
            C[17]
          ) } : {}
        ),
        w[1] & /*$$restProps*/
        32768 && cd(no(
          /*$$restProps*/
          C[46],
          "input$"
        ))
      ]) : {};
      !i && w[0] & /*value*/
      1 && (i = !0, I.value = /*value*/
      C[0], ef(() => i = !1)), !a && w[0] & /*files*/
      8 && (a = !0, I.files = /*files*/
      C[3], ef(() => a = !1)), !o && w[0] & /*dirty*/
      16 && (o = !0, I.dirty = /*dirty*/
      C[4], ef(() => o = !1)), !s && w[0] & /*invalid*/
      2 && (s = !0, I.invalid = /*invalid*/
      C[1], ef(() => s = !1)), r.$set(I), /*suffix*/
      C[21] != null ? S ? (S.p(C, w), w[0] & /*suffix*/
      2097152 && Ut(S, 1)) : (S = eM(C), S.c(), Ut(S, 1), S.m(l.parentNode, l)) : S && (bl(), on(S, 1, 1, () => {
        S = null;
      }), yl()), _ && _.p && (!c || w[2] & /*$$scope*/
      33554432) && Ja(
        _,
        b,
        C,
        /*$$scope*/
        C[87],
        c ? Qa(
          b,
          /*$$scope*/
          C[87],
          w,
          Moe
        ) : Za(
          /*$$scope*/
          C[87]
        ),
        UP
      );
    },
    i(C) {
      c || (Ut(f, C), Ut(p), Ut(r.$$.fragment, C), Ut(S), Ut(_, C), c = !0);
    },
    o(C) {
      on(f, C), on(p), on(r.$$.fragment, C), on(S), on(_, C), c = !1;
    },
    d(C) {
      C && ($i(t), $i(n), $i(u), $i(l)), f && f.d(C), p && p.d(C), e[68](null), Io(r, C), S && S.d(C), _ && _.d(C);
    }
  };
}
function Hoe(e) {
  let t, n, r, i, a, o, s, u;
  const l = [
    { disabled: (
      /*disabled*/
      e[12]
    ) },
    { required: (
      /*required*/
      e[13]
    ) },
    { updateInvalid: (
      /*updateInvalid*/
      e[19]
    ) },
    { "aria-controls": (
      /*helperId*/
      e[27]
    ) },
    { "aria-describedby": (
      /*helperId*/
      e[27]
    ) },
    no(
      /*$$restProps*/
      e[46],
      "input$"
    )
  ];
  function c(v) {
    e[61](v);
  }
  function d(v) {
    e[62](v);
  }
  function f(v) {
    e[63](v);
  }
  let p = {};
  for (let v = 0; v < l.length; v += 1)
    p = qs(p, l[v]);
  /*value*/
  e[0] !== void 0 && (p.value = /*value*/
  e[0]), /*dirty*/
  e[4] !== void 0 && (p.dirty = /*dirty*/
  e[4]), /*invalid*/
  e[1] !== void 0 && (p.invalid = /*invalid*/
  e[1]), n = new doe({ props: p }), e[60](n), Aa.push(() => tf(n, "value", c)), Aa.push(() => tf(n, "dirty", d)), Aa.push(() => tf(n, "invalid", f)), n.$on(
    "blur",
    /*blur_handler*/
    e[64]
  ), n.$on(
    "focus",
    /*focus_handler*/
    e[65]
  ), n.$on(
    "blur",
    /*blur_handler_1*/
    e[66]
  ), n.$on(
    "focus",
    /*focus_handler_1*/
    e[67]
  );
  const g = (
    /*#slots*/
    e[56].internalCounter
  ), m = Xa(
    g,
    e,
    /*$$scope*/
    e[87],
    qP
  );
  return {
    c() {
      t = B3("span"), wo(n.$$.fragment), o = Wi(), m && m.c(), $_(t, "class", s = ni({
        "mdc-text-field__resizer": !("input$resizable" in /*$$restProps*/
        e[46]) || /*$$restProps*/
        e[46].input$resizable
      }));
    },
    m(v, h) {
      ea(v, t, h), Po(n, t, null), ks(t, o), m && m.m(t, null), u = !0;
    },
    p(v, h) {
      const y = h[0] & /*disabled, required, updateInvalid, helperId*/
      134754304 | h[1] & /*$$restProps*/
      32768 ? Wl(l, [
        h[0] & /*disabled*/
        4096 && { disabled: (
          /*disabled*/
          v[12]
        ) },
        h[0] & /*required*/
        8192 && { required: (
          /*required*/
          v[13]
        ) },
        h[0] & /*updateInvalid*/
        524288 && { updateInvalid: (
          /*updateInvalid*/
          v[19]
        ) },
        h[0] & /*helperId*/
        134217728 && { "aria-controls": (
          /*helperId*/
          v[27]
        ) },
        h[0] & /*helperId*/
        134217728 && { "aria-describedby": (
          /*helperId*/
          v[27]
        ) },
        h[1] & /*$$restProps*/
        32768 && cd(no(
          /*$$restProps*/
          v[46],
          "input$"
        ))
      ]) : {};
      !r && h[0] & /*value*/
      1 && (r = !0, y.value = /*value*/
      v[0], ef(() => r = !1)), !i && h[0] & /*dirty*/
      16 && (i = !0, y.dirty = /*dirty*/
      v[4], ef(() => i = !1)), !a && h[0] & /*invalid*/
      2 && (a = !0, y.invalid = /*invalid*/
      v[1], ef(() => a = !1)), n.$set(y), m && m.p && (!u || h[2] & /*$$scope*/
      33554432) && Ja(
        m,
        g,
        v,
        /*$$scope*/
        v[87],
        u ? Qa(
          g,
          /*$$scope*/
          v[87],
          h,
          Toe
        ) : Za(
          /*$$scope*/
          v[87]
        ),
        qP
      ), (!u || h[1] & /*$$restProps*/
      32768 && s !== (s = ni({
        "mdc-text-field__resizer": !("input$resizable" in /*$$restProps*/
        v[46]) || /*$$restProps*/
        v[46].input$resizable
      }))) && $_(t, "class", s);
    },
    i(v) {
      u || (Ut(n.$$.fragment, v), Ut(m, v), u = !0);
    },
    o(v) {
      on(n.$$.fragment, v), on(m, v), u = !1;
    },
    d(v) {
      v && $i(t), e[60](null), Io(n), m && m.d(v);
    }
  };
}
function $P(e) {
  let t, n;
  return t = new kae({
    props: {
      $$slots: { default: [qoe] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      wo(t.$$.fragment);
    },
    m(r, i) {
      Po(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i[0] & /*prefix*/
      1048576 | i[2] & /*$$scope*/
      33554432 && (a.$$scope = { dirty: i, ctx: r }), t.$set(a);
    },
    i(r) {
      n || (Ut(t.$$.fragment, r), n = !0);
    },
    o(r) {
      on(t.$$.fragment, r), n = !1;
    },
    d(r) {
      Io(t, r);
    }
  };
}
function qoe(e) {
  let t;
  return {
    c() {
      t = L3(
        /*prefix*/
        e[20]
      );
    },
    m(n, r) {
      ea(n, t, r);
    },
    p(n, r) {
      r[0] & /*prefix*/
      1048576 && R3(
        t,
        /*prefix*/
        n[20]
      );
    },
    d(n) {
      n && $i(t);
    }
  };
}
function eM(e) {
  let t, n;
  return t = new Dae({
    props: {
      $$slots: { default: [joe] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      wo(t.$$.fragment);
    },
    m(r, i) {
      Po(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i[0] & /*suffix*/
      2097152 | i[2] & /*$$scope*/
      33554432 && (a.$$scope = { dirty: i, ctx: r }), t.$set(a);
    },
    i(r) {
      n || (Ut(t.$$.fragment, r), n = !0);
    },
    o(r) {
      on(t.$$.fragment, r), n = !1;
    },
    d(r) {
      Io(t, r);
    }
  };
}
function joe(e) {
  let t;
  return {
    c() {
      t = L3(
        /*suffix*/
        e[21]
      );
    },
    m(n, r) {
      ea(n, t, r);
    },
    p(n, r) {
      r[0] & /*suffix*/
      2097152 && R3(
        t,
        /*suffix*/
        n[21]
      );
    },
    d(n) {
      n && $i(t);
    }
  };
}
function Koe(e) {
  let t;
  const n = (
    /*#slots*/
    e[56].trailingIcon
  ), r = Xa(
    n,
    e,
    /*$$scope*/
    e[87],
    zP
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a[2] & /*$$scope*/
      33554432) && Ja(
        r,
        n,
        i,
        /*$$scope*/
        i[87],
        t ? Qa(
          n,
          /*$$scope*/
          i[87],
          a,
          Poe
        ) : Za(
          /*$$scope*/
          i[87]
        ),
        zP
      );
    },
    i(i) {
      t || (Ut(r, i), t = !0);
    },
    o(i) {
      on(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function tM(e) {
  let t, n;
  const r = [no(
    /*$$restProps*/
    e[46],
    "ripple$"
  )];
  let i = {};
  for (let a = 0; a < r.length; a += 1)
    i = qs(i, r[a]);
  return t = new Uie({ props: i }), e[77](t), {
    c() {
      wo(t.$$.fragment);
    },
    m(a, o) {
      Po(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o[1] & /*$$restProps*/
      32768 ? Wl(r, [cd(no(
        /*$$restProps*/
        a[46],
        "ripple$"
      ))]) : {};
      t.$set(s);
    },
    i(a) {
      n || (Ut(t.$$.fragment, a), n = !0);
    },
    o(a) {
      on(t.$$.fragment, a), n = !1;
    },
    d(a) {
      e[77](null), Io(t, a);
    }
  };
}
function nM(e) {
  let t, n;
  const r = [no(
    /*$$restProps*/
    e[46],
    "helperLine$"
  )];
  let i = {
    $$slots: { default: [Yoe] },
    $$scope: { ctx: e }
  };
  for (let a = 0; a < r.length; a += 1)
    i = qs(i, r[a]);
  return t = new Tae({ props: i }), t.$on(
    "SMUITextfieldHelperText:id",
    /*handleHelperTextId*/
    e[41]
  ), t.$on(
    "SMUITextfieldHelperText:mount",
    /*handleHelperTextMount*/
    e[42]
  ), t.$on(
    "SMUITextfieldHelperText:unmount",
    /*SMUITextfieldHelperText_unmount_handler*/
    e[85]
  ), t.$on(
    "SMUITextfieldCharacterCounter:mount",
    /*handleCharacterCounterMount*/
    e[40]
  ), t.$on(
    "SMUITextfieldCharacterCounter:unmount",
    /*SMUITextfieldCharacterCounter_unmount_handler_1*/
    e[86]
  ), {
    c() {
      wo(t.$$.fragment);
    },
    m(a, o) {
      Po(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o[1] & /*$$restProps*/
      32768 ? Wl(r, [cd(no(
        /*$$restProps*/
        a[46],
        "helperLine$"
      ))]) : {};
      o[2] & /*$$scope*/
      33554432 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
    },
    i(a) {
      n || (Ut(t.$$.fragment, a), n = !0);
    },
    o(a) {
      on(t.$$.fragment, a), n = !1;
    },
    d(a) {
      Io(t, a);
    }
  };
}
function Yoe(e) {
  let t;
  const n = (
    /*#slots*/
    e[56].helper
  ), r = Xa(
    n,
    e,
    /*$$scope*/
    e[87],
    LP
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a[2] & /*$$scope*/
      33554432) && Ja(
        r,
        n,
        i,
        /*$$scope*/
        i[87],
        t ? Qa(
          n,
          /*$$scope*/
          i[87],
          a,
          Coe
        ) : Za(
          /*$$scope*/
          i[87]
        ),
        LP
      );
    },
    i(i) {
      t || (Ut(r, i), t = !0);
    },
    o(i) {
      on(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function Woe(e) {
  let t, n, r, i, a;
  const o = [Roe, Boe], s = [];
  function u(c, d) {
    return (
      /*valued*/
      c[36] ? 0 : 1
    );
  }
  t = u(e), n = s[t] = o[t](e);
  let l = (
    /*$$slots*/
    e[47].helper && nM(e)
  );
  return {
    c() {
      n.c(), r = Wi(), l && l.c(), i = W8();
    },
    m(c, d) {
      s[t].m(c, d), ea(c, r, d), l && l.m(c, d), ea(c, i, d), a = !0;
    },
    p(c, d) {
      n.p(c, d), /*$$slots*/
      c[47].helper ? l ? (l.p(c, d), d[1] & /*$$slots*/
      65536 && Ut(l, 1)) : (l = nM(c), l.c(), Ut(l, 1), l.m(i.parentNode, i)) : l && (bl(), on(l, 1, 1, () => {
        l = null;
      }), yl());
    },
    i(c) {
      a || (Ut(n), Ut(l), a = !0);
    },
    o(c) {
      on(n), on(l), a = !1;
    },
    d(c) {
      c && ($i(r), $i(i)), s[t].d(c), l && l.d(c);
    }
  };
}
const rM = ([e, t]) => `${e}: ${t};`, iM = ([e, t]) => `${e}: ${t};`;
function Xoe(e, t, n) {
  let r;
  const i = [
    "use",
    "class",
    "style",
    "ripple",
    "disabled",
    "required",
    "textarea",
    "variant",
    "noLabel",
    "label",
    "type",
    "value",
    "files",
    "invalid",
    "updateInvalid",
    "dirty",
    "prefix",
    "suffix",
    "validateOnValueChange",
    "useNativeValidation",
    "withLeadingIcon",
    "withTrailingIcon",
    "input",
    "floatingLabel",
    "lineRipple",
    "notchedOutline",
    "focus",
    "blur",
    "layout",
    "getElement"
  ];
  let a = RP(t, i), { $$slots: o = {}, $$scope: s } = t;
  const u = moe(o), { applyPassive: l } = GR, c = gd(xoe());
  let d = () => {
  };
  function f(ye) {
    return ye === d;
  }
  let { use: p = [] } = t, { class: g = "" } = t, { style: m = "" } = t, { ripple: v = !0 } = t, { disabled: h = !1 } = t, { required: y = !1 } = t, { textarea: x = !1 } = t, { variant: S = x ? "outlined" : "standard" } = t, { noLabel: b = !1 } = t, { label: _ = void 0 } = t, { type: C = "text" } = t, { value: w = a.input$emptyValueUndefined ? void 0 : d } = t, { files: I = d } = t;
  const M = !f(w) || !f(I);
  f(w) && (w = void 0), f(I) && (I = null);
  let { invalid: E = d } = t, { updateInvalid: T = f(E) } = t;
  f(E) && (E = !1);
  let { dirty: P = !1 } = t, { prefix: k = void 0 } = t, { suffix: D = void 0 } = t, { validateOnValueChange: B = T } = t, { useNativeValidation: L = T } = t, { withLeadingIcon: F = d } = t, { withTrailingIcon: V = d } = t, { input: G = void 0 } = t, { floatingLabel: H = void 0 } = t, { lineRipple: q = void 0 } = t, { notchedOutline: z = void 0 } = t, K, Y, Z = {}, X = {}, W, J = !1, $ = boe("SMUI:addLayoutListener"), ee, ce, ae = new Promise((ye) => ce = ye), he, Oe, Ne, Ue, Ze = w;
  $ && (ee = $(rt)), voe(() => {
    if (n(54, Y = new kre(
      {
        // getRootAdapterMethods_
        addClass: we,
        removeClass: Ie,
        hasClass: de,
        registerTextFieldInteractionHandler: (ye, Yn) => st().addEventListener(ye, Yn),
        deregisterTextFieldInteractionHandler: (ye, Yn) => st().removeEventListener(ye, Yn),
        registerValidationAttributeChangeHandler: (ye) => {
          const Yn = (gs) => gs.map((io) => io.attributeName).filter((io) => io), bi = new MutationObserver((gs) => {
            L && ye(Yn(gs));
          }), ro = { attributes: !0 };
          return G && bi.observe(G.getElement(), ro), bi;
        },
        deregisterValidationAttributeChangeHandler: (ye) => {
          ye.disconnect();
        },
        // getInputAdapterMethods_
        getNativeInput: () => {
          var ye;
          return (ye = G == null ? void 0 : G.getElement()) !== null && ye !== void 0 ? ye : null;
        },
        setInputAttr: (ye, Yn) => {
          G == null || G.addAttr(ye, Yn);
        },
        removeInputAttr: (ye) => {
          G == null || G.removeAttr(ye);
        },
        isFocused: () => document.activeElement === (G == null ? void 0 : G.getElement()),
        registerInputInteractionHandler: (ye, Yn) => {
          G == null || G.getElement().addEventListener(ye, Yn, l());
        },
        deregisterInputInteractionHandler: (ye, Yn) => {
          G == null || G.getElement().removeEventListener(ye, Yn, l());
        },
        // getLabelAdapterMethods_
        floatLabel: (ye) => H && H.float(ye),
        getLabelWidth: () => H ? H.getWidth() : 0,
        hasLabel: () => !!H,
        shakeLabel: (ye) => H && H.shake(ye),
        setLabelRequired: (ye) => H && H.setRequired(ye),
        // getLineRippleAdapterMethods_
        activateLineRipple: () => q && q.activate(),
        deactivateLineRipple: () => q && q.deactivate(),
        setLineRippleTransformOrigin: (ye) => q && q.setRippleCenter(ye),
        // getOutlineAdapterMethods_
        closeOutline: () => z && z.closeNotch(),
        hasOutline: () => !!z,
        notchOutline: (ye) => z && z.notch(ye)
      },
      {
        get helperText() {
          return Ne;
        },
        get characterCounter() {
          return Ue;
        },
        get leadingIcon() {
          return he;
        },
        get trailingIcon() {
          return Oe;
        }
      }
    )), M) {
      if (G == null)
        throw new Error("SMUI Textfield must be initialized with either a non-undefined initial value or an Input component.");
      Y.init();
    } else
      _oe().then(() => {
        if (G == null)
          throw new Error("SMUI Textfield must be initialized with either a non-undefined initial value or an Input component.");
        Y.init();
      });
    return ce(), () => {
      Y.destroy();
    };
  }), yoe(() => {
    ee && ee();
  });
  function Se(ye) {
    n(29, he = ye.detail);
  }
  function qe(ye) {
    n(30, Oe = ye.detail);
  }
  function Pe(ye) {
    n(32, Ue = ye.detail);
  }
  function Xe(ye) {
    n(27, W = ye.detail);
  }
  function Ke(ye) {
    n(31, Ne = ye.detail);
  }
  function de(ye) {
    var Yn;
    return ye in Z ? (Yn = Z[ye]) !== null && Yn !== void 0 ? Yn : null : st().classList.contains(ye);
  }
  function we(ye) {
    Z[ye] || n(25, Z[ye] = !0, Z);
  }
  function Ie(ye) {
    (!(ye in Z) || Z[ye]) && n(25, Z[ye] = !1, Z);
  }
  function Ee(ye, Yn) {
    X[ye] != Yn && (Yn === "" || Yn == null ? (delete X[ye], n(26, X)) : n(26, X[ye] = Yn, X));
  }
  function Le() {
    G == null || G.focus();
  }
  function De() {
    G == null || G.blur();
  }
  function rt() {
    if (Y) {
      const ye = Y.shouldFloat;
      Y.notchOutline(ye);
    }
  }
  function st() {
    return K;
  }
  function gt(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      H = ye, n(5, H);
    });
  }
  function ft(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      H = ye, n(5, H);
    });
  }
  function yt(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      z = ye, n(7, z);
    });
  }
  function It(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      G = ye, n(2, G);
    });
  }
  function ge(ye) {
    w = ye, n(0, w);
  }
  function Je(ye) {
    P = ye, n(4, P);
  }
  function Mt(ye) {
    E = ye, n(1, E), n(54, Y), n(19, T);
  }
  const wn = () => n(28, J = !1), tn = () => n(28, J = !0), Te = (ye) => D1(K, "blur", ye), At = (ye) => D1(K, "focus", ye);
  function Gt(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      G = ye, n(2, G);
    });
  }
  function Tt(ye) {
    w = ye, n(0, w);
  }
  function nn(ye) {
    I = ye, n(3, I);
  }
  function Pt(ye) {
    P = ye, n(4, P);
  }
  function Yt(ye) {
    E = ye, n(1, E), n(54, Y), n(19, T);
  }
  const Rn = () => n(28, J = !1), kn = () => n(28, J = !0), Pn = (ye) => D1(K, "blur", ye), Kn = (ye) => D1(K, "focus", ye);
  function br(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      q = ye, n(6, q);
    });
  }
  function ra(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      K = ye, n(24, K);
    });
  }
  const dr = () => n(29, he = void 0), Ln = () => n(30, Oe = void 0), Cr = () => n(32, Ue = void 0);
  function yi(ye) {
    Aa[ye ? "unshift" : "push"](() => {
      K = ye, n(24, K);
    });
  }
  const ri = () => n(29, he = void 0), Hi = () => n(30, Oe = void 0), ia = () => {
    n(27, W = void 0), n(31, Ne = void 0);
  }, Mr = () => n(32, Ue = void 0);
  return e.$$set = (ye) => {
    t = qs(qs({}, t), poe(ye)), n(46, a = RP(t, i)), "use" in ye && n(8, p = ye.use), "class" in ye && n(9, g = ye.class), "style" in ye && n(10, m = ye.style), "ripple" in ye && n(11, v = ye.ripple), "disabled" in ye && n(12, h = ye.disabled), "required" in ye && n(13, y = ye.required), "textarea" in ye && n(14, x = ye.textarea), "variant" in ye && n(15, S = ye.variant), "noLabel" in ye && n(16, b = ye.noLabel), "label" in ye && n(17, _ = ye.label), "type" in ye && n(18, C = ye.type), "value" in ye && n(0, w = ye.value), "files" in ye && n(3, I = ye.files), "invalid" in ye && n(1, E = ye.invalid), "updateInvalid" in ye && n(19, T = ye.updateInvalid), "dirty" in ye && n(4, P = ye.dirty), "prefix" in ye && n(20, k = ye.prefix), "suffix" in ye && n(21, D = ye.suffix), "validateOnValueChange" in ye && n(48, B = ye.validateOnValueChange), "useNativeValidation" in ye && n(49, L = ye.useNativeValidation), "withLeadingIcon" in ye && n(22, F = ye.withLeadingIcon), "withTrailingIcon" in ye && n(23, V = ye.withTrailingIcon), "input" in ye && n(2, G = ye.input), "floatingLabel" in ye && n(5, H = ye.floatingLabel), "lineRipple" in ye && n(6, q = ye.lineRipple), "notchedOutline" in ye && n(7, z = ye.notchedOutline), "$$scope" in ye && n(87, s = ye.$$scope);
  }, e.$$.update = () => {
    if (e.$$.dirty[0] & /*input*/
    4 && n(33, r = G && G.getElement()), e.$$.dirty[0] & /*invalid, updateInvalid*/
    524290 | e.$$.dirty[1] & /*instance*/
    8388608 && Y && Y.isValid() !== !E && (T ? n(1, E = !Y.isValid()) : Y.setValid(!E)), e.$$.dirty[1] & /*instance, validateOnValueChange*/
    8519680 && Y && Y.getValidateOnValueChange() !== B && Y.setValidateOnValueChange(f(B) ? !1 : B), e.$$.dirty[1] & /*instance, useNativeValidation*/
    8650752 && Y && Y.setUseNativeValidation(f(L) ? !0 : L), e.$$.dirty[0] & /*disabled*/
    4096 | e.$$.dirty[1] & /*instance*/
    8388608 && Y && Y.setDisabled(h), e.$$.dirty[0] & /*value*/
    1 | e.$$.dirty[1] & /*instance, previousValue*/
    25165824 && Y && M && Ze !== w) {
      n(55, Ze = w);
      const ye = `${w}`;
      Y.getValue() !== ye && Y.setValue(ye);
    }
  }, [
    w,
    E,
    G,
    I,
    P,
    H,
    q,
    z,
    p,
    g,
    m,
    v,
    h,
    y,
    x,
    S,
    b,
    _,
    C,
    T,
    k,
    D,
    F,
    V,
    K,
    Z,
    X,
    W,
    J,
    he,
    Oe,
    Ne,
    Ue,
    r,
    c,
    f,
    M,
    ae,
    Se,
    qe,
    Pe,
    Xe,
    Ke,
    we,
    Ie,
    Ee,
    a,
    u,
    B,
    L,
    Le,
    De,
    rt,
    st,
    Y,
    Ze,
    o,
    gt,
    ft,
    yt,
    It,
    ge,
    Je,
    Mt,
    wn,
    tn,
    Te,
    At,
    Gt,
    Tt,
    nn,
    Pt,
    Yt,
    Rn,
    kn,
    Pn,
    Kn,
    br,
    ra,
    dr,
    Ln,
    Cr,
    yi,
    ri,
    Hi,
    ia,
    Mr,
    s
  ];
}
class Zoe extends foe {
  constructor(t) {
    super(), hoe(
      this,
      t,
      Xoe,
      Woe,
      goe,
      {
        use: 8,
        class: 9,
        style: 10,
        ripple: 11,
        disabled: 12,
        required: 13,
        textarea: 14,
        variant: 15,
        noLabel: 16,
        label: 17,
        type: 18,
        value: 0,
        files: 3,
        invalid: 1,
        updateInvalid: 19,
        dirty: 4,
        prefix: 20,
        suffix: 21,
        validateOnValueChange: 48,
        useNativeValidation: 49,
        withLeadingIcon: 22,
        withTrailingIcon: 23,
        input: 2,
        floatingLabel: 5,
        lineRipple: 6,
        notchedOutline: 7,
        focus: 50,
        blur: 51,
        layout: 52,
        getElement: 53
      },
      null,
      [-1, -1, -1, -1]
    );
  }
  get focus() {
    return this.$$.ctx[50];
  }
  get blur() {
    return this.$$.ctx[51];
  }
  get layout() {
    return this.$$.ctx[52];
  }
  get getElement() {
    return this.$$.ctx[53];
  }
}
function sL(e) {
  var t, n, r = "";
  if (typeof e == "string" || typeof e == "number") r += e;
  else if (typeof e == "object") if (Array.isArray(e)) {
    var i = e.length;
    for (t = 0; t < i; t++) e[t] && (n = sL(e[t])) && (r && (r += " "), r += n);
  } else for (n in e) e[n] && (r && (r += " "), r += n);
  return r;
}
function Ta() {
  for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = sL(e)) && (r && (r += " "), r += t);
  return r;
}
var Xl = (e) => `k-${e}`, To = (e) => (e = e.replace(/[-|_]+/g, "_").replace(/[A-Z]/g, (t) => `_${t}`).replace(/_+([a-z])/g, (t, n) => `_${n}`).replace(/^_+|_+$/g, ""), Symbol(`K_${e.toUpperCase()}_KEY`));
To("breadcrumb");
var Qoe = To("buttonGroup");
To("collapseWrapper");
var uL = To("checkboxGroup"), lL = To("radioGroup");
To("row");
To("contextmenu");
var cL = To("form"), dL = To("formItem"), fL = To("dropDown");
To("tabs");
To("descriptions");
To("segmented");
const {
  SvelteComponent: Joe,
  assign: e6,
  compute_rest_props: aM,
  detach: $oe,
  element: ese,
  exclude_internal_props: tse,
  get_spread_update: nse,
  init: rse,
  insert: ise,
  listen: kb,
  noop: oM,
  run_all: ase,
  safe_not_equal: ose,
  set_attributes: sM,
  set_style: rg
} = window.__gradio__svelte__internal, { createEventDispatcher: sse } = window.__gradio__svelte__internal;
function use(e) {
  let t, n, r, i = [
    { class: (
      /*cnames*/
      e[3]
    ) },
    { role: (
      /*tag*/
      e[4]
    ) },
    { "aria-hidden": "true" },
    /*$$restProps*/
    e[8],
    /*attrs*/
    e[0]
  ], a = {};
  for (let o = 0; o < i.length; o += 1)
    a = e6(a, i[o]);
  return {
    c() {
      t = ese("span"), sM(t, a), rg(
        t,
        "width",
        /*widthInner*/
        e[2]
      ), rg(
        t,
        "height",
        /*heightInner*/
        e[1]
      );
    },
    m(o, s) {
      ise(o, t, s), n || (r = [
        kb(
          t,
          "mouseenter",
          /*onMouseenter*/
          e[6]
        ),
        kb(
          t,
          "mouseleave",
          /*onMouseleave*/
          e[7]
        ),
        kb(
          t,
          "click",
          /*onClick*/
          e[5]
        )
      ], n = !0);
    },
    p(o, [s]) {
      sM(t, a = nse(i, [
        s & /*cnames*/
        8 && { class: (
          /*cnames*/
          o[3]
        ) },
        s & /*tag*/
        16 && { role: (
          /*tag*/
          o[4]
        ) },
        { "aria-hidden": "true" },
        s & /*$$restProps*/
        256 && /*$$restProps*/
        o[8],
        s & /*attrs*/
        1 && /*attrs*/
        o[0]
      ])), rg(
        t,
        "width",
        /*widthInner*/
        o[2]
      ), rg(
        t,
        "height",
        /*heightInner*/
        o[1]
      );
    },
    i: oM,
    o: oM,
    d(o) {
      o && $oe(t), n = !1, ase(r);
    }
  };
}
function lse(e, t, n) {
  let r, i, a, o;
  const s = ["icon", "btn", "width", "height", "color", "cls", "attrs"];
  let u = aM(t, s), { icon: l = "" } = t, { btn: c = !1 } = t, { width: d = "24px" } = t, { height: f = "24px" } = t, { color: p = "" } = t, { cls: g = "" } = t, { attrs: m = {} } = t;
  const v = sse(), h = (b) => {
    v("click", b);
  }, y = (b) => {
    v("mouseenter", b);
  }, x = (b) => {
    v("mouseleave", b);
  }, S = Xl("icon");
  return e.$$set = (b) => {
    t = e6(e6({}, t), tse(b)), n(8, u = aM(t, s)), "icon" in b && n(9, l = b.icon), "btn" in b && n(10, c = b.btn), "width" in b && n(11, d = b.width), "height" in b && n(12, f = b.height), "color" in b && n(13, p = b.color), "cls" in b && n(14, g = b.cls), "attrs" in b && n(0, m = b.attrs);
  }, e.$$.update = () => {
    e.$$.dirty & /*btn*/
    1024 && n(4, r = c ? "button" : ""), e.$$.dirty & /*color, btn, icon, cls*/
    26112 && n(3, i = Ta(
      `${S}--base`,
      {
        [`${S}--base__dark`]: !p,
        [`${S}--role-button`]: !!c
      },
      `${S}-transition`,
      l,
      p,
      g
    )), e.$$.dirty & /*width*/
    2048 && n(2, a = d ? d === "auto" ? void 0 : d : "24px"), e.$$.dirty & /*height*/
    4096 && n(1, o = f ? f === "auto" ? void 0 : f : "24px");
  }, [
    m,
    o,
    a,
    i,
    r,
    h,
    y,
    x,
    u,
    l,
    c,
    d,
    f,
    p,
    g
  ];
}
let X8 = class extends Joe {
  constructor(t) {
    super(), rse(this, t, lse, use, ose, {
      icon: 9,
      btn: 10,
      width: 11,
      height: 12,
      color: 13,
      cls: 14,
      attrs: 0
    });
  }
};
const {
  SvelteComponent: cse,
  append: Yp,
  assign: dse,
  attr: f0,
  check_outros: fse,
  create_component: mse,
  create_slot: pse,
  destroy_component: hse,
  detach: Z8,
  element: Pg,
  empty: gse,
  get_all_dirty_from_scope: vse,
  get_slot_changes: yse,
  get_spread_update: bse,
  group_outros: _se,
  init: xse,
  insert: Q8,
  listen: Cse,
  mount_component: Sse,
  safe_not_equal: Ase,
  set_attributes: uM,
  set_data: wse,
  space: lM,
  text: Ise,
  transition_in: Wp,
  transition_out: Mg,
  update_slot_base: Pse
} = window.__gradio__svelte__internal, { createEventDispatcher: Mse, getContext: Ese } = window.__gradio__svelte__internal;
function cM(e) {
  let t, n;
  return t = new X8({
    props: {
      icon: "i-carbon:radio-button-checked",
      color: "!text-white",
      width: (
        /*KRadioSize*/
        e[5][
          /*sizeInner*/
          e[4]
        ]
      ),
      height: (
        /*KRadioSize*/
        e[5][
          /*sizeInner*/
          e[4]
        ]
      )
    }
  }), {
    c() {
      mse(t.$$.fragment);
    },
    m(r, i) {
      Sse(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i & /*KRadioSize, sizeInner*/
      48 && (a.width = /*KRadioSize*/
      r[5][
        /*sizeInner*/
        r[4]
      ]), i & /*KRadioSize, sizeInner*/
      48 && (a.height = /*KRadioSize*/
      r[5][
        /*sizeInner*/
        r[4]
      ]), t.$set(a);
    },
    i(r) {
      n || (Wp(t.$$.fragment, r), n = !0);
    },
    o(r) {
      Mg(t.$$.fragment, r), n = !1;
    },
    d(r) {
      hse(t, r);
    }
  };
}
function dM(e) {
  let t, n;
  return {
    c() {
      t = Pg("span"), n = Ise(
        /*label*/
        e[0]
      ), f0(
        t,
        "class",
        /*labelCls*/
        e[6]
      );
    },
    m(r, i) {
      Q8(r, t, i), Yp(t, n);
    },
    p(r, i) {
      i & /*label*/
      1 && wse(
        n,
        /*label*/
        r[0]
      ), i & /*labelCls*/
      64 && f0(
        t,
        "class",
        /*labelCls*/
        r[6]
      );
    },
    d(r) {
      r && Z8(t);
    }
  };
}
function Tse(e) {
  let t, n = (
    /*label*/
    e[0] && dM(e)
  );
  return {
    c() {
      n && n.c(), t = gse();
    },
    m(r, i) {
      n && n.m(r, i), Q8(r, t, i);
    },
    p(r, i) {
      /*label*/
      r[0] ? n ? n.p(r, i) : (n = dM(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && Z8(t), n && n.d(r);
    }
  };
}
function kse(e) {
  let t, n, r, i, a, o, s, u, l = (
    /*valueInner*/
    e[2] && cM(e)
  );
  const c = (
    /*#slots*/
    e[17].default
  ), d = pse(
    c,
    e,
    /*$$scope*/
    e[16],
    null
  ), f = d || Tse(e);
  let p = [
    { class: (
      /*cnames*/
      e[8]
    ) },
    /*attrs*/
    e[1]
  ], g = {};
  for (let m = 0; m < p.length; m += 1)
    g = dse(g, p[m]);
  return {
    c() {
      t = Pg("label"), n = Pg("input"), r = lM(), i = Pg("div"), l && l.c(), a = lM(), f && f.c(), n.value = /*valueInner*/
      e[2], n.disabled = /*isDisabled*/
      e[3], f0(n, "type", "radio"), n.hidden = !0, f0(
        i,
        "class",
        /*radioboxCls*/
        e[7]
      ), uM(t, g);
    },
    m(m, v) {
      Q8(m, t, v), Yp(t, n), Yp(t, r), Yp(t, i), l && l.m(i, null), Yp(t, a), f && f.m(t, null), o = !0, s || (u = Cse(
        n,
        "click",
        /*handleUpdateValue*/
        e[9]
      ), s = !0);
    },
    p(m, [v]) {
      (!o || v & /*valueInner*/
      4) && (n.value = /*valueInner*/
      m[2]), (!o || v & /*isDisabled*/
      8) && (n.disabled = /*isDisabled*/
      m[3]), /*valueInner*/
      m[2] ? l ? (l.p(m, v), v & /*valueInner*/
      4 && Wp(l, 1)) : (l = cM(m), l.c(), Wp(l, 1), l.m(i, null)) : l && (_se(), Mg(l, 1, 1, () => {
        l = null;
      }), fse()), (!o || v & /*radioboxCls*/
      128) && f0(
        i,
        "class",
        /*radioboxCls*/
        m[7]
      ), d ? d.p && (!o || v & /*$$scope*/
      65536) && Pse(
        d,
        c,
        m,
        /*$$scope*/
        m[16],
        o ? yse(
          c,
          /*$$scope*/
          m[16],
          v,
          null
        ) : vse(
          /*$$scope*/
          m[16]
        ),
        null
      ) : f && f.p && (!o || v & /*labelCls, label*/
      65) && f.p(m, o ? v : -1), uM(t, g = bse(p, [
        (!o || v & /*cnames*/
        256) && { class: (
          /*cnames*/
          m[8]
        ) },
        v & /*attrs*/
        2 && /*attrs*/
        m[1]
      ]));
    },
    i(m) {
      o || (Wp(l), Wp(f, m), o = !0);
    },
    o(m) {
      Mg(l), Mg(f, m), o = !1;
    },
    d(m) {
      m && Z8(t), l && l.d(), f && f.d(m), s = !1, u();
    }
  };
}
function Dse(e, t, n) {
  let r, i, a, o, s, { $$slots: u = {}, $$scope: l } = t, { value: c = !1 } = t, { label: d = "" } = t, { uid: f = "" } = t, { size: p = "md" } = t, { disabled: g = !1 } = t, { cls: m = void 0 } = t, { attrs: v = {} } = t;
  const h = Mse(), y = Ese(lL);
  let x = c, S = "";
  var b;
  (function(T) {
    T[T.lg = 16] = "lg", T[T.md = 14] = "md", T[T.sm = 12] = "sm";
  })(b || (b = {}));
  const _ = () => {
    r || x || (C(!x, !0), !y && h("updateValue", !x));
  }, C = (T, P = !1) => {
    n(15, S = "animate-ikun-checking"), setTimeout(
      () => {
        n(15, S = "");
      },
      300
    ), f && y && (n(2, x = T), P && y.updatedValueWhenRadioChange(T, f));
  };
  function w(T) {
    n(3, r = T || g);
  }
  function I(T) {
    n(4, i = T);
  }
  function M() {
    f && y && y.registerRadio(f, { doUpdatedValue: C, setDisabled: w, setSizes: I });
  }
  M();
  const E = Xl("radio");
  return e.$$set = (T) => {
    "value" in T && n(10, c = T.value), "label" in T && n(0, d = T.label), "uid" in T && n(11, f = T.uid), "size" in T && n(12, p = T.size), "disabled" in T && n(13, g = T.disabled), "cls" in T && n(14, m = T.cls), "attrs" in T && n(1, v = T.attrs), "$$scope" in T && n(16, l = T.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*value, valueInner*/
    1028 && c !== x && !y && n(2, x = c), e.$$.dirty & /*disabled*/
    8192 && n(3, r = y && y.disabled || g), e.$$.dirty & /*size*/
    4096 && n(4, i = y && y.size ? y.size : p), e.$$.dirty & /*sizeInner, isDisabled, cls*/
    16408 && n(8, a = Ta(E, `${E}--base`, `${E}--base__dark`, `${E}--${i}`, { "k-cur-disabled": r }, m)), e.$$.dirty & /*valueInner, isDisabled, classChecking*/
    32780 && n(7, o = Ta(
      `${E}--box`,
      {
        [`${E}__selected`]: x && !r,
        [`${E}--box__disabled`]: r
      },
      S
    )), e.$$.dirty & /*valueInner, isDisabled*/
    12 && n(6, s = Ta(`${E}--label`, {
      "text-ikun-main": x && !r
    }));
  }, [
    d,
    v,
    x,
    r,
    i,
    b,
    s,
    o,
    a,
    _,
    c,
    f,
    p,
    g,
    m,
    S,
    l,
    u
  ];
}
let ns = class extends cse {
  constructor(t) {
    super(), xse(this, t, Dse, kse, Ase, {
      value: 10,
      label: 0,
      uid: 11,
      size: 12,
      disabled: 13,
      cls: 14,
      attrs: 1
    });
  }
};
const {
  SvelteComponent: Ose,
  assign: t6,
  compute_rest_props: fM,
  create_slot: Bse,
  detach: Rse,
  element: Lse,
  exclude_internal_props: Nse,
  get_all_dirty_from_scope: Fse,
  get_slot_changes: Vse,
  get_spread_update: Gse,
  init: zse,
  insert: Use,
  safe_not_equal: Hse,
  set_attributes: mM,
  transition_in: qse,
  transition_out: jse,
  update_slot_base: Kse
} = window.__gradio__svelte__internal, {
  createEventDispatcher: Yse,
  setContext: Wse,
  getContext: pM,
  tick: Xse,
  onMount: Zse
} = window.__gradio__svelte__internal;
function Qse(e) {
  let t, n;
  const r = (
    /*#slots*/
    e[13].default
  ), i = Bse(
    r,
    e,
    /*$$scope*/
    e[12],
    null
  );
  let a = [
    { class: (
      /*cnames*/
      e[1]
    ) },
    /*$$restProps*/
    e[2],
    /*attrs*/
    e[0]
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = t6(o, a[s]);
  return {
    c() {
      t = Lse("div"), i && i.c(), mM(t, o);
    },
    m(s, u) {
      Use(s, t, u), i && i.m(t, null), n = !0;
    },
    p(s, [u]) {
      i && i.p && (!n || u & /*$$scope*/
      4096) && Kse(
        i,
        r,
        s,
        /*$$scope*/
        s[12],
        n ? Vse(
          r,
          /*$$scope*/
          s[12],
          u,
          null
        ) : Fse(
          /*$$scope*/
          s[12]
        ),
        null
      ), mM(t, o = Gse(a, [
        (!n || u & /*cnames*/
        2) && { class: (
          /*cnames*/
          s[1]
        ) },
        u & /*$$restProps*/
        4 && /*$$restProps*/
        s[2],
        u & /*attrs*/
        1 && /*attrs*/
        s[0]
      ]));
    },
    i(s) {
      n || (qse(i, s), n = !0);
    },
    o(s) {
      jse(i, s), n = !1;
    },
    d(s) {
      s && Rse(t), i && i.d(s);
    }
  };
}
function Jse(e, t, n) {
  let r, i, a;
  const o = ["value", "size", "disabled", "cls", "attrs"];
  let s = fM(t, o), { $$slots: u = {}, $$scope: l } = t;
  var c = this && this.__awaiter || function(k, D, B, L) {
    function F(V) {
      return V instanceof B ? V : new B(function(G) {
        G(V);
      });
    }
    return new (B || (B = Promise))(function(V, G) {
      function H(K) {
        try {
          z(L.next(K));
        } catch (Y) {
          G(Y);
        }
      }
      function q(K) {
        try {
          z(L.throw(K));
        } catch (Y) {
          G(Y);
        }
      }
      function z(K) {
        K.done ? V(K.value) : F(K.value).then(H, q);
      }
      z((L = L.apply(k, D || [])).next());
    });
  };
  let { value: d = "" } = t, { size: f = "md" } = t, { disabled: p = !1 } = t, { cls: g = void 0 } = t, { attrs: m = {} } = t, v = !1, h = "";
  const y = pM(dL), x = pM(cL);
  let S = "";
  function b(k = !1) {
    S = y.split("&").pop(), n(3, d = x.getValueByPath(S, k ? x.__default_value : x.__value));
  }
  function _(k) {
    n(7, v = k.disabled), n(8, h = k.size);
  }
  Zse(() => {
    y && x && (b(!0), _(x.__dynamicProps), x.__itemCompMap[S] = { update: b, type: "radio" }, x.__propHandleEvtMap.push(_));
  });
  const C = Yse(), w = /* @__PURE__ */ new Map();
  let I = d;
  const M = (k, D) => {
    w.set(k.toString(), D), E(k.toString(), (I || "").toString() === k.toString());
  }, E = (k, D) => {
    const B = w.get(k);
    if (B) {
      const L = B.doUpdatedValue;
      L(D);
    }
  };
  Wse(lL, {
    // Passed to the radio component to register the radio in the context
    registerRadio: M,
    // Passed to the radio component to set the size during initialization
    size: i || f,
    // Passed to the radio component to set the disable during initialization
    disabled: r || p,
    // Passed to the radio component to update the valueInner of radioGroup
    updatedValueWhenRadioChange: (k, D) => c(void 0, void 0, void 0, function* () {
      n(9, I = D), C("updateValue", D), x && (x == null || x.updateField(S, D, !x.__manual_validate), yield Xse(), n(3, d = D));
    })
  });
  const P = Xl("radio-group");
  return e.$$set = (k) => {
    t = t6(t6({}, t), Nse(k)), n(2, s = fM(t, o)), "value" in k && n(3, d = k.value), "size" in k && n(4, f = k.size), "disabled" in k && n(5, p = k.disabled), "cls" in k && n(6, g = k.cls), "attrs" in k && n(0, m = k.attrs), "$$scope" in k && n(12, l = k.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*disabledFrom, disabled*/
    160 && n(10, r = v || p), e.$$.dirty & /*sizeFrom, size*/
    272 && n(11, i = h || f), e.$$.dirty & /*valueInner, value, disabledInnerForm*/
    1544 && I !== d && (r || (E((I || "").toString(), !1), n(9, I = d), E((d || "").toString(), !0))), e.$$.dirty & /*disabledInnerForm*/
    1024 && Array.from(w.values()).forEach((k) => {
      k.setDisabled(r);
    }), e.$$.dirty & /*sizeInnerForm*/
    2048 && Array.from(w.values()).forEach((k) => {
      k.setSizes(i);
    }), e.$$.dirty & /*cls*/
    64 && n(1, a = Ta(P, { [`${P}--base`]: !0 }, g));
  }, [
    m,
    a,
    s,
    d,
    f,
    p,
    g,
    v,
    h,
    I,
    r,
    i,
    l,
    u
  ];
}
let K0 = class extends Ose {
  constructor(t) {
    super(), zse(this, t, Jse, Qse, Hse, {
      value: 3,
      size: 4,
      disabled: 5,
      cls: 6,
      attrs: 0
    });
  }
};
var $a = "top", ds = "bottom", fs = "right", eo = "left", J8 = "auto", gh = [$a, ds, fs, eo], xm = "start", Y0 = "end", $se = "clippingParents", mL = "viewport", wp = "popper", eue = "reference", hM = /* @__PURE__ */ gh.reduce(function(e, t) {
  return e.concat([t + "-" + xm, t + "-" + Y0]);
}, []), pL = /* @__PURE__ */ [].concat(gh, [J8]).reduce(function(e, t) {
  return e.concat([t, t + "-" + xm, t + "-" + Y0]);
}, []), tue = "beforeRead", nue = "read", rue = "afterRead", iue = "beforeMain", aue = "main", oue = "afterMain", sue = "beforeWrite", uue = "write", lue = "afterWrite", cue = [tue, nue, rue, iue, aue, oue, sue, uue, lue];
function Bu(e) {
  return e ? (e.nodeName || "").toLowerCase() : null;
}
function Mo(e) {
  if (e == null)
    return window;
  if (e.toString() !== "[object Window]") {
    var t = e.ownerDocument;
    return t && t.defaultView || window;
  }
  return e;
}
function Ef(e) {
  var t = Mo(e).Element;
  return e instanceof t || e instanceof Element;
}
function ls(e) {
  var t = Mo(e).HTMLElement;
  return e instanceof t || e instanceof HTMLElement;
}
function $8(e) {
  if (typeof ShadowRoot > "u")
    return !1;
  var t = Mo(e).ShadowRoot;
  return e instanceof t || e instanceof ShadowRoot;
}
function due(e) {
  var t = e.state;
  Object.keys(t.elements).forEach(function(n) {
    var r = t.styles[n] || {}, i = t.attributes[n] || {}, a = t.elements[n];
    !ls(a) || !Bu(a) || (Object.assign(a.style, r), Object.keys(i).forEach(function(o) {
      var s = i[o];
      s === !1 ? a.removeAttribute(o) : a.setAttribute(o, s === !0 ? "" : s);
    }));
  });
}
function fue(e) {
  var t = e.state, n = {
    popper: {
      position: t.options.strategy,
      left: "0",
      top: "0",
      margin: "0"
    },
    arrow: {
      position: "absolute"
    },
    reference: {}
  };
  return Object.assign(t.elements.popper.style, n.popper), t.styles = n, t.elements.arrow && Object.assign(t.elements.arrow.style, n.arrow), function() {
    Object.keys(t.elements).forEach(function(r) {
      var i = t.elements[r], a = t.attributes[r] || {}, o = Object.keys(t.styles.hasOwnProperty(r) ? t.styles[r] : n[r]), s = o.reduce(function(u, l) {
        return u[l] = "", u;
      }, {});
      !ls(i) || !Bu(i) || (Object.assign(i.style, s), Object.keys(a).forEach(function(u) {
        i.removeAttribute(u);
      }));
    });
  };
}
const mue = {
  name: "applyStyles",
  enabled: !0,
  phase: "write",
  fn: due,
  effect: fue,
  requires: ["computeStyles"]
};
function Pu(e) {
  return e.split("-")[0];
}
var hf = Math.max, Hv = Math.min, Cm = Math.round;
function n6() {
  var e = navigator.userAgentData;
  return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
    return t.brand + "/" + t.version;
  }).join(" ") : navigator.userAgent;
}
function hL() {
  return !/^((?!chrome|android).)*safari/i.test(n6());
}
function Sm(e, t, n) {
  t === void 0 && (t = !1), n === void 0 && (n = !1);
  var r = e.getBoundingClientRect(), i = 1, a = 1;
  t && ls(e) && (i = e.offsetWidth > 0 && Cm(r.width) / e.offsetWidth || 1, a = e.offsetHeight > 0 && Cm(r.height) / e.offsetHeight || 1);
  var o = Ef(e) ? Mo(e) : window, s = o.visualViewport, u = !hL() && n, l = (r.left + (u && s ? s.offsetLeft : 0)) / i, c = (r.top + (u && s ? s.offsetTop : 0)) / a, d = r.width / i, f = r.height / a;
  return {
    width: d,
    height: f,
    top: c,
    right: l + d,
    bottom: c + f,
    left: l,
    x: l,
    y: c
  };
}
function e7(e) {
  var t = Sm(e), n = e.offsetWidth, r = e.offsetHeight;
  return Math.abs(t.width - n) <= 1 && (n = t.width), Math.abs(t.height - r) <= 1 && (r = t.height), {
    x: e.offsetLeft,
    y: e.offsetTop,
    width: n,
    height: r
  };
}
function gL(e, t) {
  var n = t.getRootNode && t.getRootNode();
  if (e.contains(t))
    return !0;
  if (n && $8(n)) {
    var r = t;
    do {
      if (r && e.isSameNode(r))
        return !0;
      r = r.parentNode || r.host;
    } while (r);
  }
  return !1;
}
function Gl(e) {
  return Mo(e).getComputedStyle(e);
}
function pue(e) {
  return ["table", "td", "th"].indexOf(Bu(e)) >= 0;
}
function vd(e) {
  return ((Ef(e) ? e.ownerDocument : (
    // $FlowFixMe[prop-missing]
    e.document
  )) || window.document).documentElement;
}
function N3(e) {
  return Bu(e) === "html" ? e : (
    // this is a quicker (but less type safe) way to save quite some bytes from the bundle
    // $FlowFixMe[incompatible-return]
    // $FlowFixMe[prop-missing]
    e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
    e.parentNode || // DOM Element detected
    ($8(e) ? e.host : null) || // ShadowRoot detected
    // $FlowFixMe[incompatible-call]: HTMLElement is a Node
    vd(e)
  );
}
function gM(e) {
  return !ls(e) || // https://github.com/popperjs/popper-core/issues/837
  Gl(e).position === "fixed" ? null : e.offsetParent;
}
function hue(e) {
  var t = /firefox/i.test(n6()), n = /Trident/i.test(n6());
  if (n && ls(e)) {
    var r = Gl(e);
    if (r.position === "fixed")
      return null;
  }
  var i = N3(e);
  for ($8(i) && (i = i.host); ls(i) && ["html", "body"].indexOf(Bu(i)) < 0; ) {
    var a = Gl(i);
    if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none")
      return i;
    i = i.parentNode;
  }
  return null;
}
function vh(e) {
  for (var t = Mo(e), n = gM(e); n && pue(n) && Gl(n).position === "static"; )
    n = gM(n);
  return n && (Bu(n) === "html" || Bu(n) === "body" && Gl(n).position === "static") ? t : n || hue(e) || t;
}
function t7(e) {
  return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
}
function m0(e, t, n) {
  return hf(e, Hv(t, n));
}
function gue(e, t, n) {
  var r = m0(e, t, n);
  return r > n ? n : r;
}
function vL() {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0
  };
}
function yL(e) {
  return Object.assign({}, vL(), e);
}
function bL(e, t) {
  return t.reduce(function(n, r) {
    return n[r] = e, n;
  }, {});
}
var vue = function(t, n) {
  return t = typeof t == "function" ? t(Object.assign({}, n.rects, {
    placement: n.placement
  })) : t, yL(typeof t != "number" ? t : bL(t, gh));
};
function yue(e) {
  var t, n = e.state, r = e.name, i = e.options, a = n.elements.arrow, o = n.modifiersData.popperOffsets, s = Pu(n.placement), u = t7(s), l = [eo, fs].indexOf(s) >= 0, c = l ? "height" : "width";
  if (!(!a || !o)) {
    var d = vue(i.padding, n), f = e7(a), p = u === "y" ? $a : eo, g = u === "y" ? ds : fs, m = n.rects.reference[c] + n.rects.reference[u] - o[u] - n.rects.popper[c], v = o[u] - n.rects.reference[u], h = vh(a), y = h ? u === "y" ? h.clientHeight || 0 : h.clientWidth || 0 : 0, x = m / 2 - v / 2, S = d[p], b = y - f[c] - d[g], _ = y / 2 - f[c] / 2 + x, C = m0(S, _, b), w = u;
    n.modifiersData[r] = (t = {}, t[w] = C, t.centerOffset = C - _, t);
  }
}
function bue(e) {
  var t = e.state, n = e.options, r = n.element, i = r === void 0 ? "[data-popper-arrow]" : r;
  i != null && (typeof i == "string" && (i = t.elements.popper.querySelector(i), !i) || gL(t.elements.popper, i) && (t.elements.arrow = i));
}
const _ue = {
  name: "arrow",
  enabled: !0,
  phase: "main",
  fn: yue,
  effect: bue,
  requires: ["popperOffsets"],
  requiresIfExists: ["preventOverflow"]
};
function Am(e) {
  return e.split("-")[1];
}
var xue = {
  top: "auto",
  right: "auto",
  bottom: "auto",
  left: "auto"
};
function Cue(e, t) {
  var n = e.x, r = e.y, i = t.devicePixelRatio || 1;
  return {
    x: Cm(n * i) / i || 0,
    y: Cm(r * i) / i || 0
  };
}
function vM(e) {
  var t, n = e.popper, r = e.popperRect, i = e.placement, a = e.variation, o = e.offsets, s = e.position, u = e.gpuAcceleration, l = e.adaptive, c = e.roundOffsets, d = e.isFixed, f = o.x, p = f === void 0 ? 0 : f, g = o.y, m = g === void 0 ? 0 : g, v = typeof c == "function" ? c({
    x: p,
    y: m
  }) : {
    x: p,
    y: m
  };
  p = v.x, m = v.y;
  var h = o.hasOwnProperty("x"), y = o.hasOwnProperty("y"), x = eo, S = $a, b = window;
  if (l) {
    var _ = vh(n), C = "clientHeight", w = "clientWidth";
    if (_ === Mo(n) && (_ = vd(n), Gl(_).position !== "static" && s === "absolute" && (C = "scrollHeight", w = "scrollWidth")), _ = _, i === $a || (i === eo || i === fs) && a === Y0) {
      S = ds;
      var I = d && _ === b && b.visualViewport ? b.visualViewport.height : (
        // $FlowFixMe[prop-missing]
        _[C]
      );
      m -= I - r.height, m *= u ? 1 : -1;
    }
    if (i === eo || (i === $a || i === ds) && a === Y0) {
      x = fs;
      var M = d && _ === b && b.visualViewport ? b.visualViewport.width : (
        // $FlowFixMe[prop-missing]
        _[w]
      );
      p -= M - r.width, p *= u ? 1 : -1;
    }
  }
  var E = Object.assign({
    position: s
  }, l && xue), T = c === !0 ? Cue({
    x: p,
    y: m
  }, Mo(n)) : {
    x: p,
    y: m
  };
  if (p = T.x, m = T.y, u) {
    var P;
    return Object.assign({}, E, (P = {}, P[S] = y ? "0" : "", P[x] = h ? "0" : "", P.transform = (b.devicePixelRatio || 1) <= 1 ? "translate(" + p + "px, " + m + "px)" : "translate3d(" + p + "px, " + m + "px, 0)", P));
  }
  return Object.assign({}, E, (t = {}, t[S] = y ? m + "px" : "", t[x] = h ? p + "px" : "", t.transform = "", t));
}
function Sue(e) {
  var t = e.state, n = e.options, r = n.gpuAcceleration, i = r === void 0 ? !0 : r, a = n.adaptive, o = a === void 0 ? !0 : a, s = n.roundOffsets, u = s === void 0 ? !0 : s, l = {
    placement: Pu(t.placement),
    variation: Am(t.placement),
    popper: t.elements.popper,
    popperRect: t.rects.popper,
    gpuAcceleration: i,
    isFixed: t.options.strategy === "fixed"
  };
  t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, vM(Object.assign({}, l, {
    offsets: t.modifiersData.popperOffsets,
    position: t.options.strategy,
    adaptive: o,
    roundOffsets: u
  })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, vM(Object.assign({}, l, {
    offsets: t.modifiersData.arrow,
    position: "absolute",
    adaptive: !1,
    roundOffsets: u
  })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
    "data-popper-placement": t.placement
  });
}
const Aue = {
  name: "computeStyles",
  enabled: !0,
  phase: "beforeWrite",
  fn: Sue,
  data: {}
};
var ig = {
  passive: !0
};
function wue(e) {
  var t = e.state, n = e.instance, r = e.options, i = r.scroll, a = i === void 0 ? !0 : i, o = r.resize, s = o === void 0 ? !0 : o, u = Mo(t.elements.popper), l = [].concat(t.scrollParents.reference, t.scrollParents.popper);
  return a && l.forEach(function(c) {
    c.addEventListener("scroll", n.update, ig);
  }), s && u.addEventListener("resize", n.update, ig), function() {
    a && l.forEach(function(c) {
      c.removeEventListener("scroll", n.update, ig);
    }), s && u.removeEventListener("resize", n.update, ig);
  };
}
const Iue = {
  name: "eventListeners",
  enabled: !0,
  phase: "write",
  fn: function() {
  },
  effect: wue,
  data: {}
};
var Pue = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function Eg(e) {
  return e.replace(/left|right|bottom|top/g, function(t) {
    return Pue[t];
  });
}
var Mue = {
  start: "end",
  end: "start"
};
function yM(e) {
  return e.replace(/start|end/g, function(t) {
    return Mue[t];
  });
}
function n7(e) {
  var t = Mo(e), n = t.pageXOffset, r = t.pageYOffset;
  return {
    scrollLeft: n,
    scrollTop: r
  };
}
function r7(e) {
  return Sm(vd(e)).left + n7(e).scrollLeft;
}
function Eue(e, t) {
  var n = Mo(e), r = vd(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, u = 0;
  if (i) {
    a = i.width, o = i.height;
    var l = hL();
    (l || !l && t === "fixed") && (s = i.offsetLeft, u = i.offsetTop);
  }
  return {
    width: a,
    height: o,
    x: s + r7(e),
    y: u
  };
}
function Tue(e) {
  var t, n = vd(e), r = n7(e), i = (t = e.ownerDocument) == null ? void 0 : t.body, a = hf(n.scrollWidth, n.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), o = hf(n.scrollHeight, n.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), s = -r.scrollLeft + r7(e), u = -r.scrollTop;
  return Gl(i || n).direction === "rtl" && (s += hf(n.clientWidth, i ? i.clientWidth : 0) - a), {
    width: a,
    height: o,
    x: s,
    y: u
  };
}
function i7(e) {
  var t = Gl(e), n = t.overflow, r = t.overflowX, i = t.overflowY;
  return /auto|scroll|overlay|hidden/.test(n + i + r);
}
function _L(e) {
  return ["html", "body", "#document"].indexOf(Bu(e)) >= 0 ? e.ownerDocument.body : ls(e) && i7(e) ? e : _L(N3(e));
}
function p0(e, t) {
  var n;
  t === void 0 && (t = []);
  var r = _L(e), i = r === ((n = e.ownerDocument) == null ? void 0 : n.body), a = Mo(r), o = i ? [a].concat(a.visualViewport || [], i7(r) ? r : []) : r, s = t.concat(o);
  return i ? s : (
    // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
    s.concat(p0(N3(o)))
  );
}
function r6(e) {
  return Object.assign({}, e, {
    left: e.x,
    top: e.y,
    right: e.x + e.width,
    bottom: e.y + e.height
  });
}
function kue(e, t) {
  var n = Sm(e, !1, t === "fixed");
  return n.top = n.top + e.clientTop, n.left = n.left + e.clientLeft, n.bottom = n.top + e.clientHeight, n.right = n.left + e.clientWidth, n.width = e.clientWidth, n.height = e.clientHeight, n.x = n.left, n.y = n.top, n;
}
function bM(e, t, n) {
  return t === mL ? r6(Eue(e, n)) : Ef(t) ? kue(t, n) : r6(Tue(vd(e)));
}
function Due(e) {
  var t = p0(N3(e)), n = ["absolute", "fixed"].indexOf(Gl(e).position) >= 0, r = n && ls(e) ? vh(e) : e;
  return Ef(r) ? t.filter(function(i) {
    return Ef(i) && gL(i, r) && Bu(i) !== "body";
  }) : [];
}
function Oue(e, t, n, r) {
  var i = t === "clippingParents" ? Due(e) : [].concat(t), a = [].concat(i, [n]), o = a[0], s = a.reduce(function(u, l) {
    var c = bM(e, l, r);
    return u.top = hf(c.top, u.top), u.right = Hv(c.right, u.right), u.bottom = Hv(c.bottom, u.bottom), u.left = hf(c.left, u.left), u;
  }, bM(e, o, r));
  return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
}
function xL(e) {
  var t = e.reference, n = e.element, r = e.placement, i = r ? Pu(r) : null, a = r ? Am(r) : null, o = t.x + t.width / 2 - n.width / 2, s = t.y + t.height / 2 - n.height / 2, u;
  switch (i) {
    case $a:
      u = {
        x: o,
        y: t.y - n.height
      };
      break;
    case ds:
      u = {
        x: o,
        y: t.y + t.height
      };
      break;
    case fs:
      u = {
        x: t.x + t.width,
        y: s
      };
      break;
    case eo:
      u = {
        x: t.x - n.width,
        y: s
      };
      break;
    default:
      u = {
        x: t.x,
        y: t.y
      };
  }
  var l = i ? t7(i) : null;
  if (l != null) {
    var c = l === "y" ? "height" : "width";
    switch (a) {
      case xm:
        u[l] = u[l] - (t[c] / 2 - n[c] / 2);
        break;
      case Y0:
        u[l] = u[l] + (t[c] / 2 - n[c] / 2);
        break;
    }
  }
  return u;
}
function W0(e, t) {
  t === void 0 && (t = {});
  var n = t, r = n.placement, i = r === void 0 ? e.placement : r, a = n.strategy, o = a === void 0 ? e.strategy : a, s = n.boundary, u = s === void 0 ? $se : s, l = n.rootBoundary, c = l === void 0 ? mL : l, d = n.elementContext, f = d === void 0 ? wp : d, p = n.altBoundary, g = p === void 0 ? !1 : p, m = n.padding, v = m === void 0 ? 0 : m, h = yL(typeof v != "number" ? v : bL(v, gh)), y = f === wp ? eue : wp, x = e.rects.popper, S = e.elements[g ? y : f], b = Oue(Ef(S) ? S : S.contextElement || vd(e.elements.popper), u, c, o), _ = Sm(e.elements.reference), C = xL({
    reference: _,
    element: x,
    strategy: "absolute",
    placement: i
  }), w = r6(Object.assign({}, x, C)), I = f === wp ? w : _, M = {
    top: b.top - I.top + h.top,
    bottom: I.bottom - b.bottom + h.bottom,
    left: b.left - I.left + h.left,
    right: I.right - b.right + h.right
  }, E = e.modifiersData.offset;
  if (f === wp && E) {
    var T = E[i];
    Object.keys(M).forEach(function(P) {
      var k = [fs, ds].indexOf(P) >= 0 ? 1 : -1, D = [$a, ds].indexOf(P) >= 0 ? "y" : "x";
      M[P] += T[D] * k;
    });
  }
  return M;
}
function Bue(e, t) {
  t === void 0 && (t = {});
  var n = t, r = n.placement, i = n.boundary, a = n.rootBoundary, o = n.padding, s = n.flipVariations, u = n.allowedAutoPlacements, l = u === void 0 ? pL : u, c = Am(r), d = c ? s ? hM : hM.filter(function(g) {
    return Am(g) === c;
  }) : gh, f = d.filter(function(g) {
    return l.indexOf(g) >= 0;
  });
  f.length === 0 && (f = d);
  var p = f.reduce(function(g, m) {
    return g[m] = W0(e, {
      placement: m,
      boundary: i,
      rootBoundary: a,
      padding: o
    })[Pu(m)], g;
  }, {});
  return Object.keys(p).sort(function(g, m) {
    return p[g] - p[m];
  });
}
function Rue(e) {
  if (Pu(e) === J8)
    return [];
  var t = Eg(e);
  return [yM(e), t, yM(t)];
}
function Lue(e) {
  var t = e.state, n = e.options, r = e.name;
  if (!t.modifiersData[r]._skip) {
    for (var i = n.mainAxis, a = i === void 0 ? !0 : i, o = n.altAxis, s = o === void 0 ? !0 : o, u = n.fallbackPlacements, l = n.padding, c = n.boundary, d = n.rootBoundary, f = n.altBoundary, p = n.flipVariations, g = p === void 0 ? !0 : p, m = n.allowedAutoPlacements, v = t.options.placement, h = Pu(v), y = h === v, x = u || (y || !g ? [Eg(v)] : Rue(v)), S = [v].concat(x).reduce(function(K, Y) {
      return K.concat(Pu(Y) === J8 ? Bue(t, {
        placement: Y,
        boundary: c,
        rootBoundary: d,
        padding: l,
        flipVariations: g,
        allowedAutoPlacements: m
      }) : Y);
    }, []), b = t.rects.reference, _ = t.rects.popper, C = /* @__PURE__ */ new Map(), w = !0, I = S[0], M = 0; M < S.length; M++) {
      var E = S[M], T = Pu(E), P = Am(E) === xm, k = [$a, ds].indexOf(T) >= 0, D = k ? "width" : "height", B = W0(t, {
        placement: E,
        boundary: c,
        rootBoundary: d,
        altBoundary: f,
        padding: l
      }), L = k ? P ? fs : eo : P ? ds : $a;
      b[D] > _[D] && (L = Eg(L));
      var F = Eg(L), V = [];
      if (a && V.push(B[T] <= 0), s && V.push(B[L] <= 0, B[F] <= 0), V.every(function(K) {
        return K;
      })) {
        I = E, w = !1;
        break;
      }
      C.set(E, V);
    }
    if (w)
      for (var G = g ? 3 : 1, H = function(Y) {
        var Z = S.find(function(X) {
          var W = C.get(X);
          if (W)
            return W.slice(0, Y).every(function(J) {
              return J;
            });
        });
        if (Z)
          return I = Z, "break";
      }, q = G; q > 0; q--) {
        var z = H(q);
        if (z === "break") break;
      }
    t.placement !== I && (t.modifiersData[r]._skip = !0, t.placement = I, t.reset = !0);
  }
}
const Nue = {
  name: "flip",
  enabled: !0,
  phase: "main",
  fn: Lue,
  requiresIfExists: ["offset"],
  data: {
    _skip: !1
  }
};
function _M(e, t, n) {
  return n === void 0 && (n = {
    x: 0,
    y: 0
  }), {
    top: e.top - t.height - n.y,
    right: e.right - t.width + n.x,
    bottom: e.bottom - t.height + n.y,
    left: e.left - t.width - n.x
  };
}
function xM(e) {
  return [$a, fs, ds, eo].some(function(t) {
    return e[t] >= 0;
  });
}
function Fue(e) {
  var t = e.state, n = e.name, r = t.rects.reference, i = t.rects.popper, a = t.modifiersData.preventOverflow, o = W0(t, {
    elementContext: "reference"
  }), s = W0(t, {
    altBoundary: !0
  }), u = _M(o, r), l = _M(s, i, a), c = xM(u), d = xM(l);
  t.modifiersData[n] = {
    referenceClippingOffsets: u,
    popperEscapeOffsets: l,
    isReferenceHidden: c,
    hasPopperEscaped: d
  }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
    "data-popper-reference-hidden": c,
    "data-popper-escaped": d
  });
}
const Vue = {
  name: "hide",
  enabled: !0,
  phase: "main",
  requiresIfExists: ["preventOverflow"],
  fn: Fue
};
function Gue(e, t, n) {
  var r = Pu(e), i = [eo, $a].indexOf(r) >= 0 ? -1 : 1, a = typeof n == "function" ? n(Object.assign({}, t, {
    placement: e
  })) : n, o = a[0], s = a[1];
  return o = o || 0, s = (s || 0) * i, [eo, fs].indexOf(r) >= 0 ? {
    x: s,
    y: o
  } : {
    x: o,
    y: s
  };
}
function zue(e) {
  var t = e.state, n = e.options, r = e.name, i = n.offset, a = i === void 0 ? [0, 0] : i, o = pL.reduce(function(c, d) {
    return c[d] = Gue(d, t.rects, a), c;
  }, {}), s = o[t.placement], u = s.x, l = s.y;
  t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += u, t.modifiersData.popperOffsets.y += l), t.modifiersData[r] = o;
}
const Uue = {
  name: "offset",
  enabled: !0,
  phase: "main",
  requires: ["popperOffsets"],
  fn: zue
};
function Hue(e) {
  var t = e.state, n = e.name;
  t.modifiersData[n] = xL({
    reference: t.rects.reference,
    element: t.rects.popper,
    strategy: "absolute",
    placement: t.placement
  });
}
const que = {
  name: "popperOffsets",
  enabled: !0,
  phase: "read",
  fn: Hue,
  data: {}
};
function jue(e) {
  return e === "x" ? "y" : "x";
}
function Kue(e) {
  var t = e.state, n = e.options, r = e.name, i = n.mainAxis, a = i === void 0 ? !0 : i, o = n.altAxis, s = o === void 0 ? !1 : o, u = n.boundary, l = n.rootBoundary, c = n.altBoundary, d = n.padding, f = n.tether, p = f === void 0 ? !0 : f, g = n.tetherOffset, m = g === void 0 ? 0 : g, v = W0(t, {
    boundary: u,
    rootBoundary: l,
    padding: d,
    altBoundary: c
  }), h = Pu(t.placement), y = Am(t.placement), x = !y, S = t7(h), b = jue(S), _ = t.modifiersData.popperOffsets, C = t.rects.reference, w = t.rects.popper, I = typeof m == "function" ? m(Object.assign({}, t.rects, {
    placement: t.placement
  })) : m, M = typeof I == "number" ? {
    mainAxis: I,
    altAxis: I
  } : Object.assign({
    mainAxis: 0,
    altAxis: 0
  }, I), E = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, T = {
    x: 0,
    y: 0
  };
  if (_) {
    if (a) {
      var P, k = S === "y" ? $a : eo, D = S === "y" ? ds : fs, B = S === "y" ? "height" : "width", L = _[S], F = L + v[k], V = L - v[D], G = p ? -w[B] / 2 : 0, H = y === xm ? C[B] : w[B], q = y === xm ? -w[B] : -C[B], z = t.elements.arrow, K = p && z ? e7(z) : {
        width: 0,
        height: 0
      }, Y = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : vL(), Z = Y[k], X = Y[D], W = m0(0, C[B], K[B]), J = x ? C[B] / 2 - G - W - Z - M.mainAxis : H - W - Z - M.mainAxis, $ = x ? -C[B] / 2 + G + W + X + M.mainAxis : q + W + X + M.mainAxis, ee = t.elements.arrow && vh(t.elements.arrow), ce = ee ? S === "y" ? ee.clientTop || 0 : ee.clientLeft || 0 : 0, ae = (P = E == null ? void 0 : E[S]) != null ? P : 0, he = L + J - ae - ce, Oe = L + $ - ae, Ne = m0(p ? Hv(F, he) : F, L, p ? hf(V, Oe) : V);
      _[S] = Ne, T[S] = Ne - L;
    }
    if (s) {
      var Ue, Ze = S === "x" ? $a : eo, Se = S === "x" ? ds : fs, qe = _[b], Pe = b === "y" ? "height" : "width", Xe = qe + v[Ze], Ke = qe - v[Se], de = [$a, eo].indexOf(h) !== -1, we = (Ue = E == null ? void 0 : E[b]) != null ? Ue : 0, Ie = de ? Xe : qe - C[Pe] - w[Pe] - we + M.altAxis, Ee = de ? qe + C[Pe] + w[Pe] - we - M.altAxis : Ke, Le = p && de ? gue(Ie, qe, Ee) : m0(p ? Ie : Xe, qe, p ? Ee : Ke);
      _[b] = Le, T[b] = Le - qe;
    }
    t.modifiersData[r] = T;
  }
}
const Yue = {
  name: "preventOverflow",
  enabled: !0,
  phase: "main",
  fn: Kue,
  requiresIfExists: ["offset"]
};
function Wue(e) {
  return {
    scrollLeft: e.scrollLeft,
    scrollTop: e.scrollTop
  };
}
function Xue(e) {
  return e === Mo(e) || !ls(e) ? n7(e) : Wue(e);
}
function Zue(e) {
  var t = e.getBoundingClientRect(), n = Cm(t.width) / e.offsetWidth || 1, r = Cm(t.height) / e.offsetHeight || 1;
  return n !== 1 || r !== 1;
}
function Que(e, t, n) {
  n === void 0 && (n = !1);
  var r = ls(t), i = ls(t) && Zue(t), a = vd(t), o = Sm(e, i, n), s = {
    scrollLeft: 0,
    scrollTop: 0
  }, u = {
    x: 0,
    y: 0
  };
  return (r || !r && !n) && ((Bu(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  i7(a)) && (s = Xue(t)), ls(t) ? (u = Sm(t, !0), u.x += t.clientLeft, u.y += t.clientTop) : a && (u.x = r7(a))), {
    x: o.left + s.scrollLeft - u.x,
    y: o.top + s.scrollTop - u.y,
    width: o.width,
    height: o.height
  };
}
function Jue(e) {
  var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
  e.forEach(function(a) {
    t.set(a.name, a);
  });
  function i(a) {
    n.add(a.name);
    var o = [].concat(a.requires || [], a.requiresIfExists || []);
    o.forEach(function(s) {
      if (!n.has(s)) {
        var u = t.get(s);
        u && i(u);
      }
    }), r.push(a);
  }
  return e.forEach(function(a) {
    n.has(a.name) || i(a);
  }), r;
}
function $ue(e) {
  var t = Jue(e);
  return cue.reduce(function(n, r) {
    return n.concat(t.filter(function(i) {
      return i.phase === r;
    }));
  }, []);
}
function ele(e) {
  var t;
  return function() {
    return t || (t = new Promise(function(n) {
      Promise.resolve().then(function() {
        t = void 0, n(e());
      });
    })), t;
  };
}
function tle(e) {
  var t = e.reduce(function(n, r) {
    var i = n[r.name];
    return n[r.name] = i ? Object.assign({}, i, r, {
      options: Object.assign({}, i.options, r.options),
      data: Object.assign({}, i.data, r.data)
    }) : r, n;
  }, {});
  return Object.keys(t).map(function(n) {
    return t[n];
  });
}
var CM = {
  placement: "bottom",
  modifiers: [],
  strategy: "absolute"
};
function SM() {
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
    t[n] = arguments[n];
  return !t.some(function(r) {
    return !(r && typeof r.getBoundingClientRect == "function");
  });
}
function nle(e) {
  e === void 0 && (e = {});
  var t = e, n = t.defaultModifiers, r = n === void 0 ? [] : n, i = t.defaultOptions, a = i === void 0 ? CM : i;
  return function(s, u, l) {
    l === void 0 && (l = a);
    var c = {
      placement: "bottom",
      orderedModifiers: [],
      options: Object.assign({}, CM, a),
      modifiersData: {},
      elements: {
        reference: s,
        popper: u
      },
      attributes: {},
      styles: {}
    }, d = [], f = !1, p = {
      state: c,
      setOptions: function(h) {
        var y = typeof h == "function" ? h(c.options) : h;
        m(), c.options = Object.assign({}, a, c.options, y), c.scrollParents = {
          reference: Ef(s) ? p0(s) : s.contextElement ? p0(s.contextElement) : [],
          popper: p0(u)
        };
        var x = $ue(tle([].concat(r, c.options.modifiers)));
        return c.orderedModifiers = x.filter(function(S) {
          return S.enabled;
        }), g(), p.update();
      },
      // Sync update – it will always be executed, even if not necessary. This
      // is useful for low frequency updates where sync behavior simplifies the
      // logic.
      // For high frequency updates (e.g. `resize` and `scroll` events), always
      // prefer the async Popper#update method
      forceUpdate: function() {
        if (!f) {
          var h = c.elements, y = h.reference, x = h.popper;
          if (SM(y, x)) {
            c.rects = {
              reference: Que(y, vh(x), c.options.strategy === "fixed"),
              popper: e7(x)
            }, c.reset = !1, c.placement = c.options.placement, c.orderedModifiers.forEach(function(M) {
              return c.modifiersData[M.name] = Object.assign({}, M.data);
            });
            for (var S = 0; S < c.orderedModifiers.length; S++) {
              if (c.reset === !0) {
                c.reset = !1, S = -1;
                continue;
              }
              var b = c.orderedModifiers[S], _ = b.fn, C = b.options, w = C === void 0 ? {} : C, I = b.name;
              typeof _ == "function" && (c = _({
                state: c,
                options: w,
                name: I,
                instance: p
              }) || c);
            }
          }
        }
      },
      // Async and optimistically optimized update – it will not be executed if
      // not necessary (debounced to run at most once-per-tick)
      update: ele(function() {
        return new Promise(function(v) {
          p.forceUpdate(), v(c);
        });
      }),
      destroy: function() {
        m(), f = !0;
      }
    };
    if (!SM(s, u))
      return p;
    p.setOptions(l).then(function(v) {
      !f && l.onFirstUpdate && l.onFirstUpdate(v);
    });
    function g() {
      c.orderedModifiers.forEach(function(v) {
        var h = v.name, y = v.options, x = y === void 0 ? {} : y, S = v.effect;
        if (typeof S == "function") {
          var b = S({
            state: c,
            name: h,
            instance: p,
            options: x
          }), _ = function() {
          };
          d.push(b || _);
        }
      });
    }
    function m() {
      d.forEach(function(v) {
        return v();
      }), d = [];
    }
    return p;
  };
}
var rle = [Iue, que, Aue, mue, Uue, Nue, Yue, _ue, Vue], ile = /* @__PURE__ */ nle({
  defaultModifiers: rle
});
const { onDestroy: ale } = window.__gradio__svelte__internal;
function ole(e) {
  let t = null, n, r, i = e;
  const a = () => {
    n !== void 0 && r !== void 0 && (t = ile(n, r, i));
  }, o = () => {
    t !== null && (t.destroy(), t = null);
  }, s = (c) => "subscribe" in c ? (u(c), {}) : (n = c, a(), {
    destroy() {
      o();
    }
  }), u = (c) => {
    const d = c.subscribe((f) => {
      n === void 0 ? (n = f, a()) : (Object.assign(n, f), t == null || t.update());
    });
    ale(d);
  };
  return [s, (c, d) => (r = c, i = { ...e, ...d }, a(), {
    update(f) {
      i = { ...e, ...f }, t == null || t.setOptions(i);
    },
    destroy() {
      o();
    }
  }), () => t];
}
const {
  SvelteComponent: sle,
  action_destroyer: i6,
  add_render_callback: ule,
  append: lle,
  assign: CL,
  attr: ag,
  binding_callbacks: AM,
  check_outros: cle,
  create_in_transition: dle,
  create_out_transition: fle,
  create_slot: SL,
  detach: h0,
  element: a7,
  empty: mle,
  get_all_dirty_from_scope: AL,
  get_slot_changes: wL,
  get_spread_update: ple,
  group_outros: hle,
  init: gle,
  insert: g0,
  listen: H1,
  run_all: IL,
  safe_not_equal: vle,
  set_attributes: a6,
  set_style: wM,
  space: PL,
  toggle_class: qv,
  transition_in: Xp,
  transition_out: Tg,
  update_slot_base: ML
} = window.__gradio__svelte__internal, { createEventDispatcher: yle } = window.__gradio__svelte__internal, ble = (e) => ({}), IM = (e) => ({}), _le = (e) => ({}), PM = (e) => ({});
function MM(e) {
  let t, n, r, i, a, o, s;
  const u = (
    /*#slots*/
    e[27].contentEl
  ), l = SL(
    u,
    e,
    /*$$scope*/
    e[26],
    IM
  );
  let c = (
    /*arrow*/
    e[1] && EM(e)
  ), d = [
    { class: (
      /*cnames*/
      e[7]
    ) },
    { "data-popper-placement": "" },
    { "aria-hidden": "true" },
    /*attrs*/
    e[0]
  ], f = {};
  for (let p = 0; p < d.length; p += 1)
    f = CL(f, d[p]);
  return {
    c() {
      t = a7("div"), l && l.c(), n = PL(), c && c.c(), a6(t, f), qv(t, "svelte-13arsd0", !0);
    },
    m(p, g) {
      g0(p, t, g), l && l.m(t, null), lle(t, n), c && c.m(t, null), a = !0, o || (s = [
        H1(
          t,
          "animationend",
          /*onAnimationEnd*/
          e[14]
        ),
        H1(
          t,
          "mouseenter",
          /*handleMouseenter*/
          e[11]
        ),
        H1(
          t,
          "mouseleave",
          /*handleMouseleave*/
          e[12]
        ),
        i6(
          /*clickOutside*/
          e[13].call(null, t)
        ),
        i6(
          /*popperContent*/
          e[9].call(null, t)
        )
      ], o = !0);
    },
    p(p, g) {
      l && l.p && (!a || g[0] & /*$$scope*/
      67108864) && ML(
        l,
        u,
        p,
        /*$$scope*/
        p[26],
        a ? wL(
          u,
          /*$$scope*/
          p[26],
          g,
          ble
        ) : AL(
          /*$$scope*/
          p[26]
        ),
        IM
      ), /*arrow*/
      p[1] ? c ? c.p(p, g) : (c = EM(p), c.c(), c.m(t, null)) : c && (c.d(1), c = null), a6(t, f = ple(d, [
        (!a || g[0] & /*cnames*/
        128) && { class: (
          /*cnames*/
          p[7]
        ) },
        { "data-popper-placement": "" },
        { "aria-hidden": "true" },
        g[0] & /*attrs*/
        1 && /*attrs*/
        p[0]
      ])), qv(t, "svelte-13arsd0", !0);
    },
    i(p) {
      a || (Xp(l, p), p && ule(() => {
        a && (i && i.end(1), r = dle(t, s9, { duration: 200, start: 0.3, opacity: 0 }), r.start());
      }), a = !0);
    },
    o(p) {
      Tg(l, p), r && r.invalidate(), p && (i = fle(t, s9, { duration: 200, start: 0.3, opacity: 0 })), a = !1;
    },
    d(p) {
      p && h0(t), l && l.d(p), c && c.d(), p && i && i.end(), o = !1, IL(s);
    }
  };
}
function EM(e) {
  let t, n = [
    { "k-popover-arrow": !0 },
    { "data-popper-arrow-bottom": "" },
    { "data-popper-arrow-top": "" },
    { "data-popper-arrow-right": "" },
    { "data-popper-arrow-left": "" }
  ], r = {};
  for (let i = 0; i < n.length; i += 1)
    r = CL(r, n[i]);
  return {
    c() {
      t = a7("div"), a6(t, r), qv(t, "svelte-13arsd0", !0);
    },
    m(i, a) {
      g0(i, t, a), e[29](t);
    },
    p(i, a) {
      qv(t, "svelte-13arsd0", !0);
    },
    d(i) {
      i && h0(t), e[29](null);
    }
  };
}
function xle(e) {
  let t, n, r, i, a, o;
  const s = (
    /*#slots*/
    e[27].triggerEl
  ), u = SL(
    s,
    e,
    /*$$scope*/
    e[26],
    PM
  );
  let l = (
    /*isShow*/
    e[4] && MM(e)
  );
  return {
    c() {
      t = a7("div"), u && u.c(), n = PL(), l && l.c(), r = mle(), ag(t, "aria-hidden", "true"), ag(
        t,
        "class",
        /*triggerCls*/
        e[6]
      ), ag(t, "data-popover-trigger", ""), wM(
        t,
        "width",
        /*width*/
        e[2]
      );
    },
    m(c, d) {
      g0(c, t, d), u && u.m(t, null), e[28](t), g0(c, n, d), l && l.m(c, d), g0(c, r, d), i = !0, a || (o = [
        i6(
          /*popperRef*/
          e[8].call(null, t)
        ),
        H1(
          t,
          "click",
          /*handleClick*/
          e[10]
        ),
        H1(
          t,
          "mouseenter",
          /*handleMouseenter*/
          e[11]
        ),
        H1(
          t,
          "mouseleave",
          /*handleMouseleave*/
          e[12]
        )
      ], a = !0);
    },
    p(c, d) {
      u && u.p && (!i || d[0] & /*$$scope*/
      67108864) && ML(
        u,
        s,
        c,
        /*$$scope*/
        c[26],
        i ? wL(
          s,
          /*$$scope*/
          c[26],
          d,
          _le
        ) : AL(
          /*$$scope*/
          c[26]
        ),
        PM
      ), (!i || d[0] & /*triggerCls*/
      64) && ag(
        t,
        "class",
        /*triggerCls*/
        c[6]
      ), d[0] & /*width*/
      4 && wM(
        t,
        "width",
        /*width*/
        c[2]
      ), /*isShow*/
      c[4] ? l ? (l.p(c, d), d[0] & /*isShow*/
      16 && Xp(l, 1)) : (l = MM(c), l.c(), Xp(l, 1), l.m(r.parentNode, r)) : l && (hle(), Tg(l, 1, 1, () => {
        l = null;
      }), cle());
    },
    i(c) {
      i || (Xp(u, c), Xp(l), i = !0);
    },
    o(c) {
      Tg(u, c), Tg(l), i = !1;
    },
    d(c) {
      c && (h0(t), h0(n), h0(r)), u && u.d(c), e[28](null), l && l.d(c), a = !1, IL(o);
    }
  };
}
function Cle(e, t, n) {
  let r, i, a, o, { $$slots: s = {}, $$scope: u } = t;
  var l = this && this.__awaiter || function(z, K, Y, Z) {
    function X(W) {
      return W instanceof Y ? W : new Y(function(J) {
        J(W);
      });
    }
    return new (Y || (Y = Promise))(function(W, J) {
      function $(ae) {
        try {
          ce(Z.next(ae));
        } catch (he) {
          J(he);
        }
      }
      function ee(ae) {
        try {
          ce(Z.throw(ae));
        } catch (he) {
          J(he);
        }
      }
      function ce(ae) {
        ae.done ? W(ae.value) : X(ae.value).then($, ee);
      }
      ce((Z = Z.apply(z, K || [])).next());
    });
  };
  let { placement: c = "top" } = t, { trigger: d = "hover" } = t, { attrs: f = {} } = t, { disabled: p = !1 } = t, { arrow: g = !0 } = t, { cls: m = void 0 } = t, { clsTrigger: v = void 0 } = t, { width: h = "fit-content" } = t, y = null;
  const x = yle(), [S, b, _] = ole({
    placement: c,
    onFirstUpdate: k,
    modifiers: [
      {
        name: "offset",
        options: { offset: [0, 8] }
      },
      {
        name: "flip",
        options: {
          fallbackPlacements: ["top", "right", "bottom", "left"]
        }
      },
      {
        name: "computeStyles",
        options: {
          gpuAcceleration: !1
          // true by default
        }
      },
      {
        name: "updated",
        enabled: !0,
        phase: "afterWrite",
        fn(z) {
          z.state.placement !== r && (r = z.state.placement, k());
        }
      }
    ],
    strategy: "fixed"
  });
  let C = !1;
  const w = () => {
    d === "manual" && P(!C), d === "click" && P(!0);
  };
  let I = !1;
  const M = () => {
    d === "hover" && (I = !0, P(!0));
  }, E = () => {
    d === "hover" && (I = !1, P(!1));
  };
  function T(z) {
    d === "hover" && (I = !1), P(z);
  }
  function P(z) {
    p && z || setTimeout(
      () => l(this, void 0, void 0, function* () {
        if (I) {
          if (C) return;
          n(4, C = !0), x("change", C);
          return;
        }
        z !== C && (n(4, C = z), x("change", C));
      }),
      d === "hover" ? 200 : 0
    );
  }
  function k() {
    y && y.removeAttribute("data-popper-arrow-top"), y && y.removeAttribute("data-popper-arrow-bottom"), y && y.removeAttribute("data-popper-arrow-left"), y && y.removeAttribute("data-popper-arrow-right"), y && y.setAttribute(`data-popper-arrow-${r}`, "");
  }
  let D = null;
  function B(z) {
    function K(Y) {
      const Z = Y.target, X = z;
      if (Z && X && !X.contains(Z))
        if (D) {
          const W = D.querySelector('[slot="triggerEl"]');
          (!W || !W.contains(Z)) && P(!1);
        } else
          P(!1);
    }
    return d === "click" && window.addEventListener("click", K), {
      destroy: () => {
        d === "click" && window.removeEventListener("click", K);
      }
    };
  }
  function L() {
    x("animateEnd");
  }
  function F() {
    return D;
  }
  function V() {
    const z = _();
    z && z.update();
  }
  function G() {
    k();
  }
  function H(z) {
    AM[z ? "unshift" : "push"](() => {
      D = z, n(5, D);
    });
  }
  function q(z) {
    AM[z ? "unshift" : "push"](() => {
      y = z, n(3, y);
    });
  }
  return e.$$set = (z) => {
    "placement" in z && n(15, c = z.placement), "trigger" in z && n(16, d = z.trigger), "attrs" in z && n(0, f = z.attrs), "disabled" in z && n(17, p = z.disabled), "arrow" in z && n(1, g = z.arrow), "cls" in z && n(18, m = z.cls), "clsTrigger" in z && n(19, v = z.clsTrigger), "width" in z && n(2, h = z.width), "$$scope" in z && n(26, u = z.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty[0] & /*placement*/
    32768 && (r = c), e.$$.dirty[0] & /*prefixCls, placement, cls*/
    33849344 && n(7, a = Ta(`${i}--base`, `${i}--base__${c}`, `${i}--base__${c}__dark`, `${i}--base__dark`, m)), e.$$.dirty[0] & /*clsTrigger*/
    524288 && n(6, o = Ta("flex", v));
  }, n(25, i = Xl("popover")), [
    f,
    g,
    h,
    y,
    C,
    D,
    o,
    a,
    S,
    b,
    w,
    M,
    E,
    B,
    L,
    c,
    d,
    p,
    m,
    v,
    T,
    P,
    F,
    V,
    G,
    i,
    u,
    s,
    H,
    q
  ];
}
let Sle = class extends sle {
  constructor(t) {
    super(), gle(
      this,
      t,
      Cle,
      xle,
      vle,
      {
        placement: 15,
        trigger: 16,
        attrs: 0,
        disabled: 17,
        arrow: 1,
        cls: 18,
        clsTrigger: 19,
        width: 2,
        updateShow: 20,
        doUpdateShow: 21,
        getPopoverContainerRef: 22,
        forceUpdated: 23,
        updatedArrow: 24
      },
      null,
      [-1, -1]
    );
  }
  get updateShow() {
    return this.$$.ctx[20];
  }
  get doUpdateShow() {
    return this.$$.ctx[21];
  }
  get getPopoverContainerRef() {
    return this.$$.ctx[22];
  }
  get forceUpdated() {
    return this.$$.ctx[23];
  }
  get updatedArrow() {
    return this.$$.ctx[24];
  }
};
const nl = {
  css: "",
  trackBackground: "transparent",
  trackRadius: "20px",
  width: "6px",
  height: "6px",
  thumbBackground: "var(--ikun-light-800)",
  thumbRadius: "20px",
  cls: void 0,
  attrs: {}
}, Ale = (e) => {
  const t = {
    "--k-scrollbar--track": e.trackBackground,
    "--k-scrollbar--track__radius": e.trackRadius,
    "--k-scrollbar__w": e.width,
    "--k-scrollbar__h": e.height,
    "--k-scrollbar--thumb": e.thumbBackground,
    "--k-scrollbar--thumb__radius": e.thumbRadius
  };
  let n = e.css;
  return Object.keys(t).forEach((r) => {
    const i = t[r];
    i && (n = `${r}: ${i};${n}`);
  }), n;
}, {
  SvelteComponent: wle,
  assign: o6,
  binding_callbacks: Ile,
  compute_rest_props: TM,
  create_slot: Ple,
  detach: Mle,
  element: Ele,
  exclude_internal_props: Tle,
  get_all_dirty_from_scope: kle,
  get_slot_changes: Dle,
  get_spread_update: Ole,
  init: Ble,
  insert: Rle,
  safe_not_equal: Lle,
  set_attributes: kM,
  transition_in: Nle,
  transition_out: Fle,
  update_slot_base: Vle
} = window.__gradio__svelte__internal;
function Gle(e) {
  let t, n;
  const r = (
    /*#slots*/
    e[15].default
  ), i = Ple(
    r,
    e,
    /*$$scope*/
    e[14],
    null
  );
  let a = [
    { class: (
      /*cnames*/
      e[3]
    ) },
    /*$$restProps*/
    e[4],
    /*attrs*/
    e[0],
    { style: (
      /*style*/
      e[1]
    ) }
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = o6(o, a[s]);
  return {
    c() {
      t = Ele("div"), i && i.c(), kM(t, o);
    },
    m(s, u) {
      Rle(s, t, u), i && i.m(t, null), e[16](t), n = !0;
    },
    p(s, [u]) {
      i && i.p && (!n || u & /*$$scope*/
      16384) && Vle(
        i,
        r,
        s,
        /*$$scope*/
        s[14],
        n ? Dle(
          r,
          /*$$scope*/
          s[14],
          u,
          null
        ) : kle(
          /*$$scope*/
          s[14]
        ),
        null
      ), kM(t, o = Ole(a, [
        (!n || u & /*cnames*/
        8) && { class: (
          /*cnames*/
          s[3]
        ) },
        u & /*$$restProps*/
        16 && /*$$restProps*/
        s[4],
        u & /*attrs*/
        1 && /*attrs*/
        s[0],
        (!n || u & /*style*/
        2) && { style: (
          /*style*/
          s[1]
        ) }
      ]));
    },
    i(s) {
      n || (Nle(i, s), n = !0);
    },
    o(s) {
      Fle(i, s), n = !1;
    },
    d(s) {
      s && Mle(t), i && i.d(s), e[16](null);
    }
  };
}
function zle(e, t, n) {
  let r;
  const i = [
    "css",
    "trackBackground",
    "trackRadius",
    "width",
    "height",
    "thumbBackground",
    "thumbRadius",
    "cls",
    "attrs",
    "getElm"
  ];
  let a = TM(t, i), { $$slots: o = {}, $$scope: s } = t, { css: u = nl.css } = t, { trackBackground: l = nl.trackBackground } = t, { trackRadius: c = nl.trackRadius } = t, { width: d = nl.width } = t, { height: f = nl.height } = t, { thumbBackground: p = nl.thumbBackground } = t, { thumbRadius: g = nl.thumbRadius } = t, { cls: m = nl.cls } = t, { attrs: v = nl.attrs } = t, h = u, y = null;
  function x() {
    return y;
  }
  const S = Xl("scrollbar");
  function b(_) {
    Ile[_ ? "unshift" : "push"](() => {
      y = _, n(2, y);
    });
  }
  return e.$$set = (_) => {
    t = o6(o6({}, t), Tle(_)), n(4, a = TM(t, i)), "css" in _ && n(5, u = _.css), "trackBackground" in _ && n(6, l = _.trackBackground), "trackRadius" in _ && n(7, c = _.trackRadius), "width" in _ && n(8, d = _.width), "height" in _ && n(9, f = _.height), "thumbBackground" in _ && n(10, p = _.thumbBackground), "thumbRadius" in _ && n(11, g = _.thumbRadius), "cls" in _ && n(12, m = _.cls), "attrs" in _ && n(0, v = _.attrs), "$$scope" in _ && n(14, s = _.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*css, trackBackground, trackRadius, width, height, thumbBackground, thumbRadius, cls, attrs*/
    8161 && n(1, h = Ale({
      css: u,
      trackBackground: l,
      trackRadius: c,
      width: d,
      height: f,
      thumbBackground: p,
      thumbRadius: g,
      cls: m,
      attrs: v
    })), e.$$.dirty & /*cls*/
    4096 && n(3, r = Ta(S, m));
  }, [
    v,
    h,
    y,
    r,
    a,
    u,
    l,
    c,
    d,
    f,
    p,
    g,
    m,
    x,
    s,
    o,
    b
  ];
}
let Ule = class extends wle {
  constructor(t) {
    super(), Ble(this, t, zle, Gle, Lle, {
      css: 5,
      trackBackground: 6,
      trackRadius: 7,
      width: 8,
      height: 9,
      thumbBackground: 10,
      thumbRadius: 11,
      cls: 12,
      attrs: 0,
      getElm: 13
    });
  }
  get getElm() {
    return this.$$.ctx[13];
  }
};
const {
  SvelteComponent: Hle,
  assign: s6,
  binding_callbacks: qle,
  compute_rest_props: DM,
  create_component: EL,
  create_slot: TL,
  destroy_component: kL,
  detach: jle,
  element: Kle,
  exclude_internal_props: Yle,
  get_all_dirty_from_scope: DL,
  get_slot_changes: OL,
  get_spread_update: Wle,
  init: Xle,
  insert: Zle,
  mount_component: BL,
  safe_not_equal: Qle,
  set_attributes: OM,
  transition_in: F3,
  transition_out: V3,
  update_slot_base: RL
} = window.__gradio__svelte__internal, { createEventDispatcher: Jle, setContext: BM } = window.__gradio__svelte__internal, $le = (e) => ({}), RM = (e) => ({});
function ece(e) {
  let t, n;
  const r = (
    /*#slots*/
    e[16].default
  ), i = TL(
    r,
    e,
    /*$$scope*/
    e[18],
    null
  );
  let a = [
    { class: (
      /*cnames*/
      e[10]
    ) },
    /*$$restProps*/
    e[12],
    { role: (
      /*role*/
      e[4]
    ) },
    { tabindex: (
      /*tabindex*/
      e[3]
    ) },
    /*attrs*/
    e[7],
    { slot: "triggerEl" }
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = s6(o, a[s]);
  return {
    c() {
      t = Kle("button"), i && i.c(), OM(t, o);
    },
    m(s, u) {
      Zle(s, t, u), i && i.m(t, null), t.autofocus && t.focus(), n = !0;
    },
    p(s, u) {
      i && i.p && (!n || u & /*$$scope*/
      262144) && RL(
        i,
        r,
        s,
        /*$$scope*/
        s[18],
        n ? OL(
          r,
          /*$$scope*/
          s[18],
          u,
          null
        ) : DL(
          /*$$scope*/
          s[18]
        ),
        null
      ), OM(t, o = Wle(a, [
        (!n || u & /*cnames*/
        1024) && { class: (
          /*cnames*/
          s[10]
        ) },
        u & /*$$restProps*/
        4096 && /*$$restProps*/
        s[12],
        (!n || u & /*role*/
        16) && { role: (
          /*role*/
          s[4]
        ) },
        (!n || u & /*tabindex*/
        8) && { tabindex: (
          /*tabindex*/
          s[3]
        ) },
        u & /*attrs*/
        128 && /*attrs*/
        s[7],
        { slot: "triggerEl" }
      ]));
    },
    i(s) {
      n || (F3(i, s), n = !0);
    },
    o(s) {
      V3(i, s), n = !1;
    },
    d(s) {
      s && jle(t), i && i.d(s);
    }
  };
}
function tce(e) {
  let t;
  const n = (
    /*#slots*/
    e[16].dropdown
  ), r = TL(
    n,
    e,
    /*$$scope*/
    e[18],
    RM
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a & /*$$scope*/
      262144) && RL(
        r,
        n,
        i,
        /*$$scope*/
        i[18],
        t ? OL(
          n,
          /*$$scope*/
          i[18],
          a,
          $le
        ) : DL(
          /*$$scope*/
          i[18]
        ),
        RM
      );
    },
    i(i) {
      t || (F3(r, i), t = !0);
    },
    o(i) {
      V3(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function nce(e) {
  let t, n;
  return t = new Ule({
    props: {
      slot: "contentEl",
      cls: (
        /*itmeCls*/
        e[9]
      ),
      css: `max-height: ${/*maxHeight*/
      e[5]}`,
      $$slots: { default: [tce] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      EL(t.$$.fragment);
    },
    m(r, i) {
      BL(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i & /*itmeCls*/
      512 && (a.cls = /*itmeCls*/
      r[9]), i & /*maxHeight*/
      32 && (a.css = `max-height: ${/*maxHeight*/
      r[5]}`), i & /*$$scope*/
      262144 && (a.$$scope = { dirty: i, ctx: r }), t.$set(a);
    },
    i(r) {
      n || (F3(t.$$.fragment, r), n = !0);
    },
    o(r) {
      V3(t.$$.fragment, r), n = !1;
    },
    d(r) {
      kL(t, r);
    }
  };
}
function rce(e) {
  let t, n, r = {
    trigger: (
      /*trigger*/
      e[1]
    ),
    disabled: (
      /*disabled*/
      e[2]
    ),
    clsTrigger: (
      /*cls*/
      e[6]
    ),
    cls: "px-0",
    arrow: !1,
    placement: (
      /*placement*/
      e[0]
    ),
    $$slots: {
      contentEl: [nce],
      triggerEl: [ece]
    },
    $$scope: { ctx: e }
  };
  return t = new Sle({ props: r }), e[17](t), t.$on(
    "change",
    /*onChange*/
    e[11]
  ), {
    c() {
      EL(t.$$.fragment);
    },
    m(i, a) {
      BL(t, i, a), n = !0;
    },
    p(i, [a]) {
      const o = {};
      a & /*trigger*/
      2 && (o.trigger = /*trigger*/
      i[1]), a & /*disabled*/
      4 && (o.disabled = /*disabled*/
      i[2]), a & /*cls*/
      64 && (o.clsTrigger = /*cls*/
      i[6]), a & /*placement*/
      1 && (o.placement = /*placement*/
      i[0]), a & /*$$scope, itmeCls, maxHeight, cnames, $$restProps, role, tabindex, attrs*/
      267960 && (o.$$scope = { dirty: a, ctx: i }), t.$set(o);
    },
    i(i) {
      n || (F3(t.$$.fragment, i), n = !0);
    },
    o(i) {
      V3(t.$$.fragment, i), n = !1;
    },
    d(i) {
      e[17](null), kL(t, i);
    }
  };
}
function ice(e, t, n) {
  let r, i;
  const a = [
    "placement",
    "trigger",
    "disabled",
    "tabindex",
    "role",
    "maxHeight",
    "hideOnClick",
    "cls",
    "attrs",
    "handleOpen",
    "handleClose"
  ];
  let o = DM(t, a), { $$slots: s = {}, $$scope: u } = t, { placement: l = "bottom" } = t, { trigger: c = "hover" } = t, { disabled: d = !1 } = t, { tabindex: f = 0 } = t, { role: p = "menu" } = t, { maxHeight: g = void 0 } = t, { hideOnClick: m = !0 } = t, { cls: v = void 0 } = t, { attrs: h = {} } = t;
  BM(Qoe, { disabled: d });
  let y = [];
  BM(fL, {
    disabledEvt: y,
    commandEvt: C
  });
  let x = null;
  function S() {
    x.updateShow(!0);
  }
  function b() {
    x.updateShow(!1);
  }
  const _ = Jle();
  function C(E) {
    d || (m && b(), _("command", E));
  }
  function w(E) {
    _("change", E.detail);
  }
  const I = Xl("dropdown");
  function M(E) {
    qle[E ? "unshift" : "push"](() => {
      x = E, n(8, x);
    });
  }
  return e.$$set = (E) => {
    t = s6(s6({}, t), Yle(E)), n(12, o = DM(t, a)), "placement" in E && n(0, l = E.placement), "trigger" in E && n(1, c = E.trigger), "disabled" in E && n(2, d = E.disabled), "tabindex" in E && n(3, f = E.tabindex), "role" in E && n(4, p = E.role), "maxHeight" in E && n(5, g = E.maxHeight), "hideOnClick" in E && n(13, m = E.hideOnClick), "cls" in E && n(6, v = E.cls), "attrs" in E && n(7, h = E.attrs), "$$scope" in E && n(18, u = E.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*disabled*/
    4 && y.length && y.forEach((E) => {
      E(d);
    }), e.$$.dirty & /*cls*/
    64 && n(10, r = Ta(I, v));
  }, n(9, i = Ta(`${I}-item-container`)), [
    l,
    c,
    d,
    f,
    p,
    g,
    v,
    h,
    x,
    i,
    r,
    w,
    o,
    m,
    S,
    b,
    s,
    M,
    u
  ];
}
let x1 = class extends Hle {
  constructor(t) {
    super(), Xle(this, t, ice, rce, Qle, {
      placement: 0,
      trigger: 1,
      disabled: 2,
      tabindex: 3,
      role: 4,
      maxHeight: 5,
      hideOnClick: 13,
      cls: 6,
      attrs: 7,
      handleOpen: 14,
      handleClose: 15
    });
  }
  get handleOpen() {
    return this.$$.ctx[14];
  }
  get handleClose() {
    return this.$$.ctx[15];
  }
};
const {
  SvelteComponent: ace,
  assign: u6,
  check_outros: oce,
  compute_rest_props: LM,
  create_slot: sce,
  detach: uce,
  element: lce,
  exclude_internal_props: cce,
  get_all_dirty_from_scope: dce,
  get_slot_changes: fce,
  get_spread_update: mce,
  group_outros: pce,
  init: hce,
  insert: gce,
  listen: vce,
  safe_not_equal: yce,
  set_attributes: NM,
  transition_in: kg,
  transition_out: l6,
  update_slot_base: bce
} = window.__gradio__svelte__internal, { getContext: _ce } = window.__gradio__svelte__internal;
function FM(e) {
  let t;
  const n = (
    /*#slots*/
    e[9].default
  ), r = sce(
    n,
    e,
    /*$$scope*/
    e[8],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a & /*$$scope*/
      256) && bce(
        r,
        n,
        i,
        /*$$scope*/
        i[8],
        t ? fce(
          n,
          /*$$scope*/
          i[8],
          a,
          null
        ) : dce(
          /*$$scope*/
          i[8]
        ),
        null
      );
    },
    i(i) {
      t || (kg(r, i), t = !0);
    },
    o(i) {
      l6(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function xce(e) {
  let t, n, r, i, a = !/*divider*/
  e[0] && FM(e), o = [
    { class: (
      /*cnames*/
      e[2]
    ) },
    { "aria-hidden": "true" },
    { "data-testid": "k_dropdown__item" },
    /*$$restProps*/
    e[4],
    /*attrs*/
    e[1]
  ], s = {};
  for (let u = 0; u < o.length; u += 1)
    s = u6(s, o[u]);
  return {
    c() {
      t = lce("div"), a && a.c(), NM(t, s);
    },
    m(u, l) {
      gce(u, t, l), a && a.m(t, null), n = !0, r || (i = vce(
        t,
        "click",
        /*handleClick*/
        e[3]
      ), r = !0);
    },
    p(u, [l]) {
      /*divider*/
      u[0] ? a && (pce(), l6(a, 1, 1, () => {
        a = null;
      }), oce()) : a ? (a.p(u, l), l & /*divider*/
      1 && kg(a, 1)) : (a = FM(u), a.c(), kg(a, 1), a.m(t, null)), NM(t, s = mce(o, [
        (!n || l & /*cnames*/
        4) && { class: (
          /*cnames*/
          u[2]
        ) },
        { "aria-hidden": "true" },
        { "data-testid": "k_dropdown__item" },
        l & /*$$restProps*/
        16 && /*$$restProps*/
        u[4],
        l & /*attrs*/
        2 && /*attrs*/
        u[1]
      ]));
    },
    i(u) {
      n || (kg(a), n = !0);
    },
    o(u) {
      l6(a), n = !1;
    },
    d(u) {
      u && uce(t), a && a.d(), r = !1, i();
    }
  };
}
function Cce(e, t, n) {
  let r;
  const i = ["disabled", "divider", "command", "cls", "attrs"];
  let a = LM(t, i), { $$slots: o = {}, $$scope: s } = t, { disabled: u = !1 } = t, { divider: l = !1 } = t, { command: c = "" } = t, { cls: d = void 0 } = t, { attrs: f = {} } = t;
  const p = _ce(fL), g = () => {
    u || p && p.commandEvt(c);
  }, m = Xl("dropdown-item");
  return e.$$set = (v) => {
    t = u6(u6({}, t), cce(v)), n(4, a = LM(t, i)), "disabled" in v && n(5, u = v.disabled), "divider" in v && n(0, l = v.divider), "command" in v && n(6, c = v.command), "cls" in v && n(7, d = v.cls), "attrs" in v && n(1, f = v.attrs), "$$scope" in v && n(8, s = v.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*disabled, divider, cls*/
    161 && n(2, r = Ta(
      m,
      {
        [`${m}--base`]: !u && !l,
        [`${m}--base__dark`]: !u && !l,
        [`${m}__disabled`]: u && !l,
        [`${m}__disabled__dark`]: u && !l,
        [`${m}__divider`]: l
      },
      d
    ));
  }, [
    l,
    f,
    r,
    g,
    a,
    u,
    c,
    d,
    s,
    o
  ];
}
class Vs extends ace {
  constructor(t) {
    super(), hce(this, t, Cce, xce, yce, {
      disabled: 5,
      divider: 0,
      command: 6,
      cls: 7,
      attrs: 1
    });
  }
}
const {
  SvelteComponent: Sce,
  add_render_callback: Ace,
  append: I1,
  assign: wce,
  attr: v0,
  check_outros: VM,
  create_component: LL,
  create_in_transition: Ice,
  create_out_transition: Pce,
  create_slot: Mce,
  destroy_component: NL,
  detach: G3,
  element: y0,
  empty: Ece,
  get_all_dirty_from_scope: Tce,
  get_slot_changes: kce,
  get_spread_update: Dce,
  group_outros: GM,
  init: Oce,
  insert: z3,
  listen: Bce,
  mount_component: FL,
  safe_not_equal: Rce,
  set_attributes: zM,
  set_data: Lce,
  set_style: UM,
  space: Db,
  text: Nce,
  transition_in: cl,
  transition_out: Xd,
  update_slot_base: Fce
} = window.__gradio__svelte__internal, { createEventDispatcher: Vce, getContext: Gce } = window.__gradio__svelte__internal;
function HM(e) {
  let t, n, r, i, a;
  return n = new X8({
    props: {
      icon: "i-carbon-checkmark",
      color: (
        /*checkColor*/
        e[1]
      ),
      width: (
        /*KCheckboxSize*/
        e[12][
          /*sizeInner*/
          e[8]
        ]
      ),
      height: (
        /*KCheckboxSize*/
        e[12][
          /*sizeInner*/
          e[8]
        ]
      )
    }
  }), {
    c() {
      t = y0("div"), LL(n.$$.fragment);
    },
    m(o, s) {
      z3(o, t, s), FL(n, t, null), a = !0;
    },
    p(o, s) {
      const u = {};
      s & /*checkColor*/
      2 && (u.color = /*checkColor*/
      o[1]), s & /*sizeInner*/
      256 && (u.width = /*KCheckboxSize*/
      o[12][
        /*sizeInner*/
        o[8]
      ]), s & /*sizeInner*/
      256 && (u.height = /*KCheckboxSize*/
      o[12][
        /*sizeInner*/
        o[8]
      ]), n.$set(u);
    },
    i(o) {
      a || (cl(n.$$.fragment, o), o && Ace(() => {
        a && (i && i.end(1), r = Ice(t, o9, { duration: 200 }), r.start());
      }), a = !0);
    },
    o(o) {
      Xd(n.$$.fragment, o), r && r.invalidate(), o && (i = Pce(t, o9, { duration: 200 })), a = !1;
    },
    d(o) {
      o && G3(t), NL(n), o && i && i.end();
    }
  };
}
function qM(e) {
  let t, n;
  return t = new X8({
    props: {
      icon: "i-carbon-subtract",
      color: (
        /*checkColor*/
        e[1]
      ),
      width: (
        /*KCheckboxSize*/
        e[12][
          /*sizeInner*/
          e[8]
        ]
      ),
      height: (
        /*KCheckboxSize*/
        e[12][
          /*sizeInner*/
          e[8]
        ]
      )
    }
  }), {
    c() {
      LL(t.$$.fragment);
    },
    m(r, i) {
      FL(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i & /*checkColor*/
      2 && (a.color = /*checkColor*/
      r[1]), i & /*sizeInner*/
      256 && (a.width = /*KCheckboxSize*/
      r[12][
        /*sizeInner*/
        r[8]
      ]), i & /*sizeInner*/
      256 && (a.height = /*KCheckboxSize*/
      r[12][
        /*sizeInner*/
        r[8]
      ]), t.$set(a);
    },
    i(r) {
      n || (cl(t.$$.fragment, r), n = !0);
    },
    o(r) {
      Xd(t.$$.fragment, r), n = !1;
    },
    d(r) {
      NL(t, r);
    }
  };
}
function jM(e) {
  let t, n;
  return {
    c() {
      t = y0("span"), n = Nce(
        /*label*/
        e[0]
      ), v0(
        t,
        "class",
        /*labelCls*/
        e[9]
      );
    },
    m(r, i) {
      z3(r, t, i), I1(t, n);
    },
    p(r, i) {
      i & /*label*/
      1 && Lce(
        n,
        /*label*/
        r[0]
      ), i & /*labelCls*/
      512 && v0(
        t,
        "class",
        /*labelCls*/
        r[9]
      );
    },
    d(r) {
      r && G3(t);
    }
  };
}
function zce(e) {
  let t, n = (
    /*label*/
    e[0] && jM(e)
  );
  return {
    c() {
      n && n.c(), t = Ece();
    },
    m(r, i) {
      n && n.m(r, i), z3(r, t, i);
    },
    p(r, i) {
      /*label*/
      r[0] ? n ? n.p(r, i) : (n = jM(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null);
    },
    d(r) {
      r && G3(t), n && n.d(r);
    }
  };
}
function Uce(e) {
  let t, n, r, i, a, o, s, u, l, c = (
    /*valueInner*/
    e[5] && !/*isIndeterminate*/
    e[6] && HM(e)
  ), d = (
    /*isIndeterminate*/
    e[6] && qM(e)
  );
  const f = (
    /*#slots*/
    e[23].default
  ), p = Mce(
    f,
    e,
    /*$$scope*/
    e[22],
    null
  ), g = p || zce(e);
  let m = [
    { class: (
      /*cnames*/
      e[11]
    ) },
    /*attrs*/
    e[4]
  ], v = {};
  for (let h = 0; h < m.length; h += 1)
    v = wce(v, m[h]);
  return {
    c() {
      t = y0("label"), n = y0("input"), r = Db(), i = y0("div"), c && c.c(), a = Db(), d && d.c(), o = Db(), g && g.c(), n.value = /*valueInner*/
      e[5], n.disabled = /*isDisabled*/
      e[7], v0(n, "type", "checkbox"), n.hidden = !0, v0(
        i,
        "class",
        /*boxCls*/
        e[10]
      ), UM(
        i,
        "background-color",
        /*valueInner*/
        e[5] && !/*isIndeterminate*/
        e[6] ? (
          /*bgCheckColor*/
          e[2]
        ) : (
          /*bgUnCheckColor*/
          e[3]
        )
      ), zM(t, v);
    },
    m(h, y) {
      z3(h, t, y), I1(t, n), I1(t, r), I1(t, i), c && c.m(i, null), I1(i, a), d && d.m(i, null), I1(t, o), g && g.m(t, null), s = !0, u || (l = Bce(
        n,
        "change",
        /*handleUpdateValue*/
        e[13]
      ), u = !0);
    },
    p(h, [y]) {
      (!s || y & /*valueInner*/
      32) && (n.value = /*valueInner*/
      h[5]), (!s || y & /*isDisabled*/
      128) && (n.disabled = /*isDisabled*/
      h[7]), /*valueInner*/
      h[5] && !/*isIndeterminate*/
      h[6] ? c ? (c.p(h, y), y & /*valueInner, isIndeterminate*/
      96 && cl(c, 1)) : (c = HM(h), c.c(), cl(c, 1), c.m(i, a)) : c && (GM(), Xd(c, 1, 1, () => {
        c = null;
      }), VM()), /*isIndeterminate*/
      h[6] ? d ? (d.p(h, y), y & /*isIndeterminate*/
      64 && cl(d, 1)) : (d = qM(h), d.c(), cl(d, 1), d.m(i, null)) : d && (GM(), Xd(d, 1, 1, () => {
        d = null;
      }), VM()), (!s || y & /*boxCls*/
      1024) && v0(
        i,
        "class",
        /*boxCls*/
        h[10]
      ), y & /*valueInner, isIndeterminate, bgCheckColor, bgUnCheckColor*/
      108 && UM(
        i,
        "background-color",
        /*valueInner*/
        h[5] && !/*isIndeterminate*/
        h[6] ? (
          /*bgCheckColor*/
          h[2]
        ) : (
          /*bgUnCheckColor*/
          h[3]
        )
      ), p ? p.p && (!s || y & /*$$scope*/
      4194304) && Fce(
        p,
        f,
        h,
        /*$$scope*/
        h[22],
        s ? kce(
          f,
          /*$$scope*/
          h[22],
          y,
          null
        ) : Tce(
          /*$$scope*/
          h[22]
        ),
        null
      ) : g && g.p && (!s || y & /*labelCls, label*/
      513) && g.p(h, s ? y : -1), zM(t, v = Dce(m, [
        (!s || y & /*cnames*/
        2048) && { class: (
          /*cnames*/
          h[11]
        ) },
        y & /*attrs*/
        16 && /*attrs*/
        h[4]
      ]));
    },
    i(h) {
      s || (cl(c), cl(d), cl(g, h), s = !0);
    },
    o(h) {
      Xd(c), Xd(d), Xd(g, h), s = !1;
    },
    d(h) {
      h && G3(t), c && c.d(), d && d.d(), g && g.d(h), u = !1, l();
    }
  };
}
function Hce(e, t, n) {
  let r, i, a, o, s, u, { $$slots: l = {}, $$scope: c } = t, { label: d = "" } = t, { value: f = !1 } = t, { uid: p = "" } = t, { size: g = "md" } = t, { checkColor: m = "text-white" } = t, { bgCheckColor: v = "" } = t, { bgUnCheckColor: h = "" } = t, { disabled: y = !1 } = t, { indeterminate: x = !1 } = t, { cls: S = void 0 } = t, { attrs: b = {} } = t, { canCancel: _ = !1 } = t;
  const C = Vce(), w = Gce(uL);
  let I = f, M = "";
  const E = { lg: "16", md: "14", sm: "12" }, T = () => {
    i || _ && I || (P(!I, !0), n(6, r = !1), !w && C("updateValue", I));
  }, P = (F, V = !1) => {
    n(5, I = F), n(21, M = "animate-ikun-checking"), setTimeout(
      () => {
        n(21, M = "");
      },
      300
    ), p && w && V && w.updatedValueWhenCheckboxChange(F, p);
  };
  function k(F) {
    n(7, i = F || y);
  }
  function D(F) {
    n(8, a = F);
  }
  function B() {
    p && w && w.registerCheckbox(p, {
      // Expose the doUpdatedValue method,
      // and when the `checkbox group` binding value changes,
      // the `checkbox` can be updated synchronously
      doUpdatedValue: P,
      // Expose the setDisabled method.
      // When the disabled value bound to the `checkbox group` changes,
      // the `checkbox` can be disabled synchronously.
      setDisabled: k,
      setSizes: D
    });
  }
  B();
  const L = Xl("checkbox");
  return e.$$set = (F) => {
    "label" in F && n(0, d = F.label), "value" in F && n(14, f = F.value), "uid" in F && n(15, p = F.uid), "size" in F && n(16, g = F.size), "checkColor" in F && n(1, m = F.checkColor), "bgCheckColor" in F && n(2, v = F.bgCheckColor), "bgUnCheckColor" in F && n(3, h = F.bgUnCheckColor), "disabled" in F && n(17, y = F.disabled), "indeterminate" in F && n(18, x = F.indeterminate), "cls" in F && n(19, S = F.cls), "attrs" in F && n(4, b = F.attrs), "canCancel" in F && n(20, _ = F.canCancel), "$$scope" in F && n(22, c = F.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*indeterminate*/
    262144 && n(6, r = x), e.$$.dirty & /*value, valueInner*/
    16416 && f !== I && !w && n(5, I = f), e.$$.dirty & /*disabled*/
    131072 && n(7, i = w && w.disabled || y), e.$$.dirty & /*size*/
    65536 && n(8, a = w && w.size ? w.size : g), e.$$.dirty & /*sizeInner, isDisabled, cls*/
    524672 && n(11, o = Ta(`${L}--base`, `${L}--base__dark`, `${L}--${a}`, { "k-cur-disabled": i }, S)), e.$$.dirty & /*valueInner, isDisabled, isIndeterminate, classChecking*/
    2097376 && n(10, s = Ta(
      `${L}--box`,
      {
        "bg-ikun-main border-ikun-main": I && !i || r,
        [`${L}--box__disabled`]: i
      },
      M
    )), e.$$.dirty & /*valueInner, isDisabled, isIndeterminate*/
    224 && n(9, u = Ta(`${L}--label`, {
      "text-ikun-main": I && !i || r
    }));
  }, [
    d,
    m,
    v,
    h,
    b,
    I,
    r,
    i,
    a,
    u,
    s,
    o,
    E,
    T,
    f,
    p,
    g,
    y,
    x,
    S,
    _,
    M,
    c,
    l
  ];
}
let o7 = class extends Sce {
  constructor(t) {
    super(), Oce(this, t, Hce, Uce, Rce, {
      label: 0,
      value: 14,
      uid: 15,
      size: 16,
      checkColor: 1,
      bgCheckColor: 2,
      bgUnCheckColor: 3,
      disabled: 17,
      indeterminate: 18,
      cls: 19,
      attrs: 4,
      canCancel: 20
    });
  }
};
var qce = Object.create, VL = Object.defineProperty, jce = Object.getOwnPropertyDescriptor, GL = Object.getOwnPropertyNames, Kce = Object.getPrototypeOf, Yce = Object.prototype.hasOwnProperty, zL = (e, t) => function() {
  return t || (0, e[GL(e)[0]])((t = { exports: {} }).exports, t), t.exports;
}, Wce = (e, t, n, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let i of GL(t))
      !Yce.call(e, i) && i !== n && VL(e, i, { get: () => t[i], enumerable: !(r = jce(t, i)) || r.enumerable });
  return e;
}, Xce = (e, t, n) => (n = e != null ? qce(Kce(e)) : {}, Wce(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  VL(n, "default", { value: e, enumerable: !0 }),
  e
)), Zce = zL({
  "../node_modules/.pnpm/ansi-colors@4.1.3/node_modules/ansi-colors/symbols.js"(e, t) {
    var n = typeof process < "u" && process.env.TERM_PROGRAM === "Hyper", r = typeof process < "u" && process.platform === "win32", i = typeof process < "u" && process.platform === "linux", a = {
      ballotDisabled: "☒",
      ballotOff: "☐",
      ballotOn: "☑",
      bullet: "•",
      bulletWhite: "◦",
      fullBlock: "█",
      heart: "❤",
      identicalTo: "≡",
      line: "─",
      mark: "※",
      middot: "·",
      minus: "－",
      multiplication: "×",
      obelus: "÷",
      pencilDownRight: "✎",
      pencilRight: "✏",
      pencilUpRight: "✐",
      percent: "%",
      pilcrow2: "❡",
      pilcrow: "¶",
      plusMinus: "±",
      question: "?",
      section: "§",
      starsOff: "☆",
      starsOn: "★",
      upDownArrow: "↕"
    }, o = Object.assign({}, a, {
      check: "√",
      cross: "×",
      ellipsisLarge: "...",
      ellipsis: "...",
      info: "i",
      questionSmall: "?",
      pointer: ">",
      pointerSmall: "»",
      radioOff: "( )",
      radioOn: "(*)",
      warning: "‼"
    }), s = Object.assign({}, a, {
      ballotCross: "✘",
      check: "✔",
      cross: "✖",
      ellipsisLarge: "⋯",
      ellipsis: "…",
      info: "ℹ",
      questionFull: "？",
      questionSmall: "﹖",
      pointer: i ? "▸" : "❯",
      pointerSmall: i ? "‣" : "›",
      radioOff: "◯",
      radioOn: "◉",
      warning: "⚠"
    });
    t.exports = r && !n ? o : s, Reflect.defineProperty(t.exports, "common", { enumerable: !1, value: a }), Reflect.defineProperty(t.exports, "windows", { enumerable: !1, value: o }), Reflect.defineProperty(t.exports, "other", { enumerable: !1, value: s });
  }
}), Qce = zL({
  "../node_modules/.pnpm/ansi-colors@4.1.3/node_modules/ansi-colors/index.js"(e, t) {
    var n = (o) => o !== null && typeof o == "object" && !Array.isArray(o), r = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g, i = () => typeof process < "u" ? process.env.FORCE_COLOR !== "0" : !1, a = () => {
      const o = {
        enabled: i(),
        visible: !0,
        styles: {},
        keys: {}
      }, s = (d) => {
        let f = d.open = `\x1B[${d.codes[0]}m`, p = d.close = `\x1B[${d.codes[1]}m`, g = d.regex = new RegExp(`\\u001b\\[${d.codes[1]}m`, "g");
        return d.wrap = (m, v) => {
          m.includes(p) && (m = m.replace(g, p + f));
          let h = f + m + p;
          return v ? h.replace(/\r*\n/g, `${p}$&${f}`) : h;
        }, d;
      }, u = (d, f, p) => typeof d == "function" ? d(f) : d.wrap(f, p), l = (d, f) => {
        if (d === "" || d == null)
          return "";
        if (o.enabled === !1)
          return d;
        if (o.visible === !1)
          return "";
        let p = "" + d, g = p.includes(`
`), m = f.length;
        for (m > 0 && f.includes("unstyle") && (f = [.../* @__PURE__ */ new Set(["unstyle", ...f])].reverse()); m-- > 0; )
          p = u(o.styles[f[m]], p, g);
        return p;
      }, c = (d, f, p) => {
        o.styles[d] = s({ name: d, codes: f }), (o.keys[p] || (o.keys[p] = [])).push(d), Reflect.defineProperty(o, d, {
          configurable: !0,
          enumerable: !0,
          set(m) {
            o.alias(d, m);
          },
          get() {
            let m = (v) => l(v, m.stack);
            return Reflect.setPrototypeOf(m, o), m.stack = this.stack ? this.stack.concat(d) : [d], m;
          }
        });
      };
      return c("reset", [0, 0], "modifier"), c("bold", [1, 22], "modifier"), c("dim", [2, 22], "modifier"), c("italic", [3, 23], "modifier"), c("underline", [4, 24], "modifier"), c("inverse", [7, 27], "modifier"), c("hidden", [8, 28], "modifier"), c("strikethrough", [9, 29], "modifier"), c("black", [30, 39], "color"), c("red", [31, 39], "color"), c("green", [32, 39], "color"), c("yellow", [33, 39], "color"), c("blue", [34, 39], "color"), c("magenta", [35, 39], "color"), c("cyan", [36, 39], "color"), c("white", [37, 39], "color"), c("gray", [90, 39], "color"), c("grey", [90, 39], "color"), c("bgBlack", [40, 49], "bg"), c("bgRed", [41, 49], "bg"), c("bgGreen", [42, 49], "bg"), c("bgYellow", [43, 49], "bg"), c("bgBlue", [44, 49], "bg"), c("bgMagenta", [45, 49], "bg"), c("bgCyan", [46, 49], "bg"), c("bgWhite", [47, 49], "bg"), c("blackBright", [90, 39], "bright"), c("redBright", [91, 39], "bright"), c("greenBright", [92, 39], "bright"), c("yellowBright", [93, 39], "bright"), c("blueBright", [94, 39], "bright"), c("magentaBright", [95, 39], "bright"), c("cyanBright", [96, 39], "bright"), c("whiteBright", [97, 39], "bright"), c("bgBlackBright", [100, 49], "bgBright"), c("bgRedBright", [101, 49], "bgBright"), c("bgGreenBright", [102, 49], "bgBright"), c("bgYellowBright", [103, 49], "bgBright"), c("bgBlueBright", [104, 49], "bgBright"), c("bgMagentaBright", [105, 49], "bgBright"), c("bgCyanBright", [106, 49], "bgBright"), c("bgWhiteBright", [107, 49], "bgBright"), o.ansiRegex = r, o.hasColor = o.hasAnsi = (d) => (o.ansiRegex.lastIndex = 0, typeof d == "string" && d !== "" && o.ansiRegex.test(d)), o.alias = (d, f) => {
        let p = typeof f == "string" ? o[f] : f;
        if (typeof p != "function")
          throw new TypeError("Expected alias to be the name of an existing color (string) or a function");
        p.stack || (Reflect.defineProperty(p, "name", { value: d }), o.styles[d] = p, p.stack = [d]), Reflect.defineProperty(o, d, {
          configurable: !0,
          enumerable: !0,
          set(g) {
            o.alias(d, g);
          },
          get() {
            let g = (m) => l(m, g.stack);
            return Reflect.setPrototypeOf(g, o), g.stack = this.stack ? this.stack.concat(p.stack) : p.stack, g;
          }
        });
      }, o.theme = (d) => {
        if (!n(d))
          throw new TypeError("Expected theme to be an object");
        for (let f of Object.keys(d))
          o.alias(f, d[f]);
        return o;
      }, o.alias("unstyle", (d) => typeof d == "string" && d !== "" ? (o.ansiRegex.lastIndex = 0, d.replace(o.ansiRegex, "")) : ""), o.alias("noop", (d) => d), o.none = o.clear = o.noop, o.stripColor = o.unstyle, o.symbols = Zce(), o.define = c, o;
    };
    t.exports = a(), t.exports.create = a;
  }
});
Xce(Qce());
function Jce(e) {
  return JSON.parse(JSON.stringify(e));
}
var $ce = Object.create, UL = Object.defineProperty, ede = Object.getOwnPropertyDescriptor, HL = Object.getOwnPropertyNames, tde = Object.getPrototypeOf, nde = Object.prototype.hasOwnProperty, rde = (e, t) => function() {
  return t || (0, e[HL(e)[0]])((t = { exports: {} }).exports, t), t.exports;
}, ide = (e, t, n, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let i of HL(t))
      !nde.call(e, i) && i !== n && UL(e, i, { get: () => t[i], enumerable: !(r = ede(t, i)) || r.enumerable });
  return e;
}, ade = (e, t, n) => (n = e != null ? $ce(tde(e)) : {}, ide(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  UL(n, "default", { value: e, enumerable: !0 }),
  e
)), ode = rde({
  "../node_modules/.pnpm/hash-sum@2.0.0/node_modules/hash-sum/hash-sum.js"(e, t) {
    function n(u, l) {
      for (; u.length < l; )
        u = "0" + u;
      return u;
    }
    function r(u, l) {
      var c, d, f;
      if (l.length === 0)
        return u;
      for (c = 0, f = l.length; c < f; c++)
        d = l.charCodeAt(c), u = (u << 5) - u + d, u |= 0;
      return u < 0 ? u * -2 : u;
    }
    function i(u, l, c) {
      return Object.keys(l).sort().reduce(d, u);
      function d(f, p) {
        return a(f, l[p], p, c);
      }
    }
    function a(u, l, c, d) {
      var f = r(r(r(u, c), o(l)), typeof l);
      if (l === null)
        return r(f, "null");
      if (l === void 0)
        return r(f, "undefined");
      if (typeof l == "object" || typeof l == "function") {
        if (d.indexOf(l) !== -1)
          return r(f, "[Circular]" + c);
        d.push(l);
        var p = i(f, l, d);
        if (!("valueOf" in l) || typeof l.valueOf != "function")
          return p;
        try {
          return r(p, String(l.valueOf()));
        } catch (g) {
          return r(p, "[valueOf exception]" + (g.stack || g.message));
        }
      }
      return r(f, l.toString());
    }
    function o(u) {
      return Object.prototype.toString.call(u);
    }
    function s(u) {
      return n(a(0, u, "", []).toString(16), 8);
    }
    t.exports = s;
  }
});
ade(ode());
//! moment.js
//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
var qL;
function ht() {
  return qL.apply(null, arguments);
}
function sde(e) {
  qL = e;
}
function js(e) {
  return e instanceof Array || Object.prototype.toString.call(e) === "[object Array]";
}
function gf(e) {
  return e != null && Object.prototype.toString.call(e) === "[object Object]";
}
function Jn(e, t) {
  return Object.prototype.hasOwnProperty.call(e, t);
}
function s7(e) {
  if (Object.getOwnPropertyNames)
    return Object.getOwnPropertyNames(e).length === 0;
  var t;
  for (t in e)
    if (Jn(e, t))
      return !1;
  return !0;
}
function Va(e) {
  return e === void 0;
}
function zl(e) {
  return typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]";
}
function yh(e) {
  return e instanceof Date || Object.prototype.toString.call(e) === "[object Date]";
}
function jL(e, t) {
  var n = [], r, i = e.length;
  for (r = 0; r < i; ++r)
    n.push(t(e[r], r));
  return n;
}
function Xc(e, t) {
  for (var n in t)
    Jn(t, n) && (e[n] = t[n]);
  return Jn(t, "toString") && (e.toString = t.toString), Jn(t, "valueOf") && (e.valueOf = t.valueOf), e;
}
function Vu(e, t, n, r) {
  return pN(e, t, n, r, !0).utc();
}
function ude() {
  return {
    empty: !1,
    unusedTokens: [],
    unusedInput: [],
    overflow: -2,
    charsLeftOver: 0,
    nullInput: !1,
    invalidEra: null,
    invalidMonth: null,
    invalidFormat: !1,
    userInvalidated: !1,
    iso: !1,
    parsedDateParts: [],
    era: null,
    meridiem: null,
    rfc2822: !1,
    weekdayMismatch: !1
  };
}
function An(e) {
  return e._pf == null && (e._pf = ude()), e._pf;
}
var c6;
Array.prototype.some ? c6 = Array.prototype.some : c6 = function(e) {
  var t = Object(this), n = t.length >>> 0, r;
  for (r = 0; r < n; r++)
    if (r in t && e.call(this, t[r], r, t))
      return !0;
  return !1;
};
function u7(e) {
  var t = null, n = !1, r = e._d && !isNaN(e._d.getTime());
  if (r && (t = An(e), n = c6.call(t.parsedDateParts, function(i) {
    return i != null;
  }), r = t.overflow < 0 && !t.empty && !t.invalidEra && !t.invalidMonth && !t.invalidWeekday && !t.weekdayMismatch && !t.nullInput && !t.invalidFormat && !t.userInvalidated && (!t.meridiem || t.meridiem && n), e._strict && (r = r && t.charsLeftOver === 0 && t.unusedTokens.length === 0 && t.bigHour === void 0)), Object.isFrozen == null || !Object.isFrozen(e))
    e._isValid = r;
  else
    return r;
  return e._isValid;
}
function U3(e) {
  var t = Vu(NaN);
  return e != null ? Xc(An(t), e) : An(t).userInvalidated = !0, t;
}
var KM = ht.momentProperties = [], Ob = !1;
function l7(e, t) {
  var n, r, i, a = KM.length;
  if (Va(t._isAMomentObject) || (e._isAMomentObject = t._isAMomentObject), Va(t._i) || (e._i = t._i), Va(t._f) || (e._f = t._f), Va(t._l) || (e._l = t._l), Va(t._strict) || (e._strict = t._strict), Va(t._tzm) || (e._tzm = t._tzm), Va(t._isUTC) || (e._isUTC = t._isUTC), Va(t._offset) || (e._offset = t._offset), Va(t._pf) || (e._pf = An(t)), Va(t._locale) || (e._locale = t._locale), a > 0)
    for (n = 0; n < a; n++)
      r = KM[n], i = t[r], Va(i) || (e[r] = i);
  return e;
}
function bh(e) {
  l7(this, e), this._d = new Date(e._d != null ? e._d.getTime() : NaN), this.isValid() || (this._d = /* @__PURE__ */ new Date(NaN)), Ob === !1 && (Ob = !0, ht.updateOffset(this), Ob = !1);
}
function Ks(e) {
  return e instanceof bh || e != null && e._isAMomentObject != null;
}
function KL(e) {
  ht.suppressDeprecationWarnings === !1 && typeof console < "u" && console.warn && console.warn("Deprecation warning: " + e);
}
function ps(e, t) {
  var n = !0;
  return Xc(function() {
    if (ht.deprecationHandler != null && ht.deprecationHandler(null, e), n) {
      var r = [], i, a, o, s = arguments.length;
      for (a = 0; a < s; a++) {
        if (i = "", typeof arguments[a] == "object") {
          i += `
[` + a + "] ";
          for (o in arguments[0])
            Jn(arguments[0], o) && (i += o + ": " + arguments[0][o] + ", ");
          i = i.slice(0, -2);
        } else
          i = arguments[a];
        r.push(i);
      }
      KL(
        e + `
Arguments: ` + Array.prototype.slice.call(r).join("") + `
` + new Error().stack
      ), n = !1;
    }
    return t.apply(this, arguments);
  }, t);
}
var YM = {};
function YL(e, t) {
  ht.deprecationHandler != null && ht.deprecationHandler(e, t), YM[e] || (KL(t), YM[e] = !0);
}
ht.suppressDeprecationWarnings = !1;
ht.deprecationHandler = null;
function Gu(e) {
  return typeof Function < "u" && e instanceof Function || Object.prototype.toString.call(e) === "[object Function]";
}
function lde(e) {
  var t, n;
  for (n in e)
    Jn(e, n) && (t = e[n], Gu(t) ? this[n] = t : this["_" + n] = t);
  this._config = e, this._dayOfMonthOrdinalParseLenient = new RegExp(
    (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
  );
}
function d6(e, t) {
  var n = Xc({}, e), r;
  for (r in t)
    Jn(t, r) && (gf(e[r]) && gf(t[r]) ? (n[r] = {}, Xc(n[r], e[r]), Xc(n[r], t[r])) : t[r] != null ? n[r] = t[r] : delete n[r]);
  for (r in e)
    Jn(e, r) && !Jn(t, r) && gf(e[r]) && (n[r] = Xc({}, n[r]));
  return n;
}
function c7(e) {
  e != null && this.set(e);
}
var f6;
Object.keys ? f6 = Object.keys : f6 = function(e) {
  var t, n = [];
  for (t in e)
    Jn(e, t) && n.push(t);
  return n;
};
var cde = {
  sameDay: "[Today at] LT",
  nextDay: "[Tomorrow at] LT",
  nextWeek: "dddd [at] LT",
  lastDay: "[Yesterday at] LT",
  lastWeek: "[Last] dddd [at] LT",
  sameElse: "L"
};
function dde(e, t, n) {
  var r = this._calendar[e] || this._calendar.sameElse;
  return Gu(r) ? r.call(t, n) : r;
}
function Ru(e, t, n) {
  var r = "" + Math.abs(e), i = t - r.length, a = e >= 0;
  return (a ? n ? "+" : "" : "-") + Math.pow(10, Math.max(0, i)).toString().substr(1) + r;
}
var d7 = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, og = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, Bb = {}, q1 = {};
function Vt(e, t, n, r) {
  var i = r;
  typeof r == "string" && (i = function() {
    return this[r]();
  }), e && (q1[e] = i), t && (q1[t[0]] = function() {
    return Ru(i.apply(this, arguments), t[1], t[2]);
  }), n && (q1[n] = function() {
    return this.localeData().ordinal(
      i.apply(this, arguments),
      e
    );
  });
}
function fde(e) {
  return e.match(/\[[\s\S]/) ? e.replace(/^\[|\]$/g, "") : e.replace(/\\/g, "");
}
function mde(e) {
  var t = e.match(d7), n, r;
  for (n = 0, r = t.length; n < r; n++)
    q1[t[n]] ? t[n] = q1[t[n]] : t[n] = fde(t[n]);
  return function(i) {
    var a = "", o;
    for (o = 0; o < r; o++)
      a += Gu(t[o]) ? t[o].call(i, e) : t[o];
    return a;
  };
}
function Dg(e, t) {
  return e.isValid() ? (t = WL(t, e.localeData()), Bb[t] = Bb[t] || mde(t), Bb[t](e)) : e.localeData().invalidDate();
}
function WL(e, t) {
  var n = 5;
  function r(i) {
    return t.longDateFormat(i) || i;
  }
  for (og.lastIndex = 0; n >= 0 && og.test(e); )
    e = e.replace(
      og,
      r
    ), og.lastIndex = 0, n -= 1;
  return e;
}
var pde = {
  LTS: "h:mm:ss A",
  LT: "h:mm A",
  L: "MM/DD/YYYY",
  LL: "MMMM D, YYYY",
  LLL: "MMMM D, YYYY h:mm A",
  LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function hde(e) {
  var t = this._longDateFormat[e], n = this._longDateFormat[e.toUpperCase()];
  return t || !n ? t : (this._longDateFormat[e] = n.match(d7).map(function(r) {
    return r === "MMMM" || r === "MM" || r === "DD" || r === "dddd" ? r.slice(1) : r;
  }).join(""), this._longDateFormat[e]);
}
var gde = "Invalid date";
function vde() {
  return this._invalidDate;
}
var yde = "%d", bde = /\d{1,2}/;
function _de(e) {
  return this._ordinal.replace("%d", e);
}
var xde = {
  future: "in %s",
  past: "%s ago",
  s: "a few seconds",
  ss: "%d seconds",
  m: "a minute",
  mm: "%d minutes",
  h: "an hour",
  hh: "%d hours",
  d: "a day",
  dd: "%d days",
  w: "a week",
  ww: "%d weeks",
  M: "a month",
  MM: "%d months",
  y: "a year",
  yy: "%d years"
};
function Cde(e, t, n, r) {
  var i = this._relativeTime[n];
  return Gu(i) ? i(e, t, n, r) : i.replace(/%d/i, e);
}
function Sde(e, t) {
  var n = this._relativeTime[e > 0 ? "future" : "past"];
  return Gu(n) ? n(t) : n.replace(/%s/i, t);
}
var WM = {
  D: "date",
  dates: "date",
  date: "date",
  d: "day",
  days: "day",
  day: "day",
  e: "weekday",
  weekdays: "weekday",
  weekday: "weekday",
  E: "isoWeekday",
  isoweekdays: "isoWeekday",
  isoweekday: "isoWeekday",
  DDD: "dayOfYear",
  dayofyears: "dayOfYear",
  dayofyear: "dayOfYear",
  h: "hour",
  hours: "hour",
  hour: "hour",
  ms: "millisecond",
  milliseconds: "millisecond",
  millisecond: "millisecond",
  m: "minute",
  minutes: "minute",
  minute: "minute",
  M: "month",
  months: "month",
  month: "month",
  Q: "quarter",
  quarters: "quarter",
  quarter: "quarter",
  s: "second",
  seconds: "second",
  second: "second",
  gg: "weekYear",
  weekyears: "weekYear",
  weekyear: "weekYear",
  GG: "isoWeekYear",
  isoweekyears: "isoWeekYear",
  isoweekyear: "isoWeekYear",
  w: "week",
  weeks: "week",
  week: "week",
  W: "isoWeek",
  isoweeks: "isoWeek",
  isoweek: "isoWeek",
  y: "year",
  years: "year",
  year: "year"
};
function hs(e) {
  return typeof e == "string" ? WM[e] || WM[e.toLowerCase()] : void 0;
}
function f7(e) {
  var t = {}, n, r;
  for (r in e)
    Jn(e, r) && (n = hs(r), n && (t[n] = e[r]));
  return t;
}
var Ade = {
  date: 9,
  day: 11,
  weekday: 11,
  isoWeekday: 11,
  dayOfYear: 4,
  hour: 13,
  millisecond: 16,
  minute: 14,
  month: 8,
  quarter: 7,
  second: 15,
  weekYear: 1,
  isoWeekYear: 1,
  week: 5,
  isoWeek: 5,
  year: 1
};
function wde(e) {
  var t = [], n;
  for (n in e)
    Jn(e, n) && t.push({ unit: n, priority: Ade[n] });
  return t.sort(function(r, i) {
    return r.priority - i.priority;
  }), t;
}
var XL = /\d/, ko = /\d\d/, ZL = /\d{3}/, m7 = /\d{4}/, H3 = /[+-]?\d{6}/, Pr = /\d\d?/, QL = /\d\d\d\d?/, JL = /\d\d\d\d\d\d?/, q3 = /\d{1,3}/, p7 = /\d{1,4}/, j3 = /[+-]?\d{1,6}/, jm = /\d+/, K3 = /[+-]?\d+/, Ide = /Z|[+-]\d\d:?\d\d/gi, Y3 = /Z|[+-]\d\d(?::?\d\d)?/gi, Pde = /[+-]?\d+(\.\d{1,3})?/, _h = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, Km = /^[1-9]\d?/, h7 = /^([1-9]\d|\d)/, jv;
jv = {};
function St(e, t, n) {
  jv[e] = Gu(t) ? t : function(r, i) {
    return r && n ? n : t;
  };
}
function Mde(e, t) {
  return Jn(jv, e) ? jv[e](t._strict, t._locale) : new RegExp(Ede(e));
}
function Ede(e) {
  return Tl(
    e.replace("\\", "").replace(
      /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
      function(t, n, r, i, a) {
        return n || r || i || a;
      }
    )
  );
}
function Tl(e) {
  return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function ts(e) {
  return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
}
function Bn(e) {
  var t = +e, n = 0;
  return t !== 0 && isFinite(t) && (n = ts(t)), n;
}
var m6 = {};
function vr(e, t) {
  var n, r = t, i;
  for (typeof e == "string" && (e = [e]), zl(t) && (r = function(a, o) {
    o[t] = Bn(a);
  }), i = e.length, n = 0; n < i; n++)
    m6[e[n]] = r;
}
function xh(e, t) {
  vr(e, function(n, r, i, a) {
    i._w = i._w || {}, t(n, i._w, i, a);
  });
}
function Tde(e, t, n) {
  t != null && Jn(m6, e) && m6[e](t, n._a, n, e);
}
function W3(e) {
  return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0;
}
var ma = 0, _l = 1, vu = 2, wi = 3, Gs = 4, xl = 5, nf = 6, kde = 7, Dde = 8;
Vt("Y", 0, 0, function() {
  var e = this.year();
  return e <= 9999 ? Ru(e, 4) : "+" + e;
});
Vt(0, ["YY", 2], 0, function() {
  return this.year() % 100;
});
Vt(0, ["YYYY", 4], 0, "year");
Vt(0, ["YYYYY", 5], 0, "year");
Vt(0, ["YYYYYY", 6, !0], 0, "year");
St("Y", K3);
St("YY", Pr, ko);
St("YYYY", p7, m7);
St("YYYYY", j3, H3);
St("YYYYYY", j3, H3);
vr(["YYYYY", "YYYYYY"], ma);
vr("YYYY", function(e, t) {
  t[ma] = e.length === 2 ? ht.parseTwoDigitYear(e) : Bn(e);
});
vr("YY", function(e, t) {
  t[ma] = ht.parseTwoDigitYear(e);
});
vr("Y", function(e, t) {
  t[ma] = parseInt(e, 10);
});
function b0(e) {
  return W3(e) ? 366 : 365;
}
ht.parseTwoDigitYear = function(e) {
  return Bn(e) + (Bn(e) > 68 ? 1900 : 2e3);
};
var $L = Ym("FullYear", !0);
function Ode() {
  return W3(this.year());
}
function Ym(e, t) {
  return function(n) {
    return n != null ? (eN(this, e, n), ht.updateOffset(this, t), this) : X0(this, e);
  };
}
function X0(e, t) {
  if (!e.isValid())
    return NaN;
  var n = e._d, r = e._isUTC;
  switch (t) {
    case "Milliseconds":
      return r ? n.getUTCMilliseconds() : n.getMilliseconds();
    case "Seconds":
      return r ? n.getUTCSeconds() : n.getSeconds();
    case "Minutes":
      return r ? n.getUTCMinutes() : n.getMinutes();
    case "Hours":
      return r ? n.getUTCHours() : n.getHours();
    case "Date":
      return r ? n.getUTCDate() : n.getDate();
    case "Day":
      return r ? n.getUTCDay() : n.getDay();
    case "Month":
      return r ? n.getUTCMonth() : n.getMonth();
    case "FullYear":
      return r ? n.getUTCFullYear() : n.getFullYear();
    default:
      return NaN;
  }
}
function eN(e, t, n) {
  var r, i, a, o, s;
  if (!(!e.isValid() || isNaN(n))) {
    switch (r = e._d, i = e._isUTC, t) {
      case "Milliseconds":
        return void (i ? r.setUTCMilliseconds(n) : r.setMilliseconds(n));
      case "Seconds":
        return void (i ? r.setUTCSeconds(n) : r.setSeconds(n));
      case "Minutes":
        return void (i ? r.setUTCMinutes(n) : r.setMinutes(n));
      case "Hours":
        return void (i ? r.setUTCHours(n) : r.setHours(n));
      case "Date":
        return void (i ? r.setUTCDate(n) : r.setDate(n));
      case "FullYear":
        break;
      default:
        return;
    }
    a = n, o = e.month(), s = e.date(), s = s === 29 && o === 1 && !W3(a) ? 28 : s, i ? r.setUTCFullYear(a, o, s) : r.setFullYear(a, o, s);
  }
}
function Bde(e) {
  return e = hs(e), Gu(this[e]) ? this[e]() : this;
}
function Rde(e, t) {
  if (typeof e == "object") {
    e = f7(e);
    var n = wde(e), r, i = n.length;
    for (r = 0; r < i; r++)
      this[n[r].unit](e[n[r].unit]);
  } else if (e = hs(e), Gu(this[e]))
    return this[e](t);
  return this;
}
function Lde(e, t) {
  return (e % t + t) % t;
}
var Qr;
Array.prototype.indexOf ? Qr = Array.prototype.indexOf : Qr = function(e) {
  var t;
  for (t = 0; t < this.length; ++t)
    if (this[t] === e)
      return t;
  return -1;
};
function g7(e, t) {
  if (isNaN(e) || isNaN(t))
    return NaN;
  var n = Lde(t, 12);
  return e += (t - n) / 12, n === 1 ? W3(e) ? 29 : 28 : 31 - n % 7 % 2;
}
Vt("M", ["MM", 2], "Mo", function() {
  return this.month() + 1;
});
Vt("MMM", 0, 0, function(e) {
  return this.localeData().monthsShort(this, e);
});
Vt("MMMM", 0, 0, function(e) {
  return this.localeData().months(this, e);
});
St("M", Pr, Km);
St("MM", Pr, ko);
St("MMM", function(e, t) {
  return t.monthsShortRegex(e);
});
St("MMMM", function(e, t) {
  return t.monthsRegex(e);
});
vr(["M", "MM"], function(e, t) {
  t[_l] = Bn(e) - 1;
});
vr(["MMM", "MMMM"], function(e, t, n, r) {
  var i = n._locale.monthsParse(e, r, n._strict);
  i != null ? t[_l] = i : An(n).invalidMonth = e;
});
var Nde = "January_February_March_April_May_June_July_August_September_October_November_December".split(
  "_"
), tN = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), nN = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, Fde = _h, Vde = _h;
function Gde(e, t) {
  return e ? js(this._months) ? this._months[e.month()] : this._months[(this._months.isFormat || nN).test(t) ? "format" : "standalone"][e.month()] : js(this._months) ? this._months : this._months.standalone;
}
function zde(e, t) {
  return e ? js(this._monthsShort) ? this._monthsShort[e.month()] : this._monthsShort[nN.test(t) ? "format" : "standalone"][e.month()] : js(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone;
}
function Ude(e, t, n) {
  var r, i, a, o = e.toLocaleLowerCase();
  if (!this._monthsParse)
    for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], r = 0; r < 12; ++r)
      a = Vu([2e3, r]), this._shortMonthsParse[r] = this.monthsShort(
        a,
        ""
      ).toLocaleLowerCase(), this._longMonthsParse[r] = this.months(a, "").toLocaleLowerCase();
  return n ? t === "MMM" ? (i = Qr.call(this._shortMonthsParse, o), i !== -1 ? i : null) : (i = Qr.call(this._longMonthsParse, o), i !== -1 ? i : null) : t === "MMM" ? (i = Qr.call(this._shortMonthsParse, o), i !== -1 ? i : (i = Qr.call(this._longMonthsParse, o), i !== -1 ? i : null)) : (i = Qr.call(this._longMonthsParse, o), i !== -1 ? i : (i = Qr.call(this._shortMonthsParse, o), i !== -1 ? i : null));
}
function Hde(e, t, n) {
  var r, i, a;
  if (this._monthsParseExact)
    return Ude.call(this, e, t, n);
  for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), r = 0; r < 12; r++) {
    if (i = Vu([2e3, r]), n && !this._longMonthsParse[r] && (this._longMonthsParse[r] = new RegExp(
      "^" + this.months(i, "").replace(".", "") + "$",
      "i"
    ), this._shortMonthsParse[r] = new RegExp(
      "^" + this.monthsShort(i, "").replace(".", "") + "$",
      "i"
    )), !n && !this._monthsParse[r] && (a = "^" + this.months(i, "") + "|^" + this.monthsShort(i, ""), this._monthsParse[r] = new RegExp(a.replace(".", ""), "i")), n && t === "MMMM" && this._longMonthsParse[r].test(e))
      return r;
    if (n && t === "MMM" && this._shortMonthsParse[r].test(e))
      return r;
    if (!n && this._monthsParse[r].test(e))
      return r;
  }
}
function rN(e, t) {
  if (!e.isValid())
    return e;
  if (typeof t == "string") {
    if (/^\d+$/.test(t))
      t = Bn(t);
    else if (t = e.localeData().monthsParse(t), !zl(t))
      return e;
  }
  var n = t, r = e.date();
  return r = r < 29 ? r : Math.min(r, g7(e.year(), n)), e._isUTC ? e._d.setUTCMonth(n, r) : e._d.setMonth(n, r), e;
}
function iN(e) {
  return e != null ? (rN(this, e), ht.updateOffset(this, !0), this) : X0(this, "Month");
}
function qde() {
  return g7(this.year(), this.month());
}
function jde(e) {
  return this._monthsParseExact ? (Jn(this, "_monthsRegex") || aN.call(this), e ? this._monthsShortStrictRegex : this._monthsShortRegex) : (Jn(this, "_monthsShortRegex") || (this._monthsShortRegex = Fde), this._monthsShortStrictRegex && e ? this._monthsShortStrictRegex : this._monthsShortRegex);
}
function Kde(e) {
  return this._monthsParseExact ? (Jn(this, "_monthsRegex") || aN.call(this), e ? this._monthsStrictRegex : this._monthsRegex) : (Jn(this, "_monthsRegex") || (this._monthsRegex = Vde), this._monthsStrictRegex && e ? this._monthsStrictRegex : this._monthsRegex);
}
function aN() {
  function e(u, l) {
    return l.length - u.length;
  }
  var t = [], n = [], r = [], i, a, o, s;
  for (i = 0; i < 12; i++)
    a = Vu([2e3, i]), o = Tl(this.monthsShort(a, "")), s = Tl(this.months(a, "")), t.push(o), n.push(s), r.push(s), r.push(o);
  t.sort(e), n.sort(e), r.sort(e), this._monthsRegex = new RegExp("^(" + r.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  ), this._monthsShortStrictRegex = new RegExp(
    "^(" + t.join("|") + ")",
    "i"
  );
}
function Yde(e, t, n, r, i, a, o) {
  var s;
  return e < 100 && e >= 0 ? (s = new Date(e + 400, t, n, r, i, a, o), isFinite(s.getFullYear()) && s.setFullYear(e)) : s = new Date(e, t, n, r, i, a, o), s;
}
function Z0(e) {
  var t, n;
  return e < 100 && e >= 0 ? (n = Array.prototype.slice.call(arguments), n[0] = e + 400, t = new Date(Date.UTC.apply(null, n)), isFinite(t.getUTCFullYear()) && t.setUTCFullYear(e)) : t = new Date(Date.UTC.apply(null, arguments)), t;
}
function Kv(e, t, n) {
  var r = 7 + t - n, i = (7 + Z0(e, 0, r).getUTCDay() - t) % 7;
  return -i + r - 1;
}
function oN(e, t, n, r, i) {
  var a = (7 + n - r) % 7, o = Kv(e, r, i), s = 1 + 7 * (t - 1) + a + o, u, l;
  return s <= 0 ? (u = e - 1, l = b0(u) + s) : s > b0(e) ? (u = e + 1, l = s - b0(e)) : (u = e, l = s), {
    year: u,
    dayOfYear: l
  };
}
function Q0(e, t, n) {
  var r = Kv(e.year(), t, n), i = Math.floor((e.dayOfYear() - r - 1) / 7) + 1, a, o;
  return i < 1 ? (o = e.year() - 1, a = i + kl(o, t, n)) : i > kl(e.year(), t, n) ? (a = i - kl(e.year(), t, n), o = e.year() + 1) : (o = e.year(), a = i), {
    week: a,
    year: o
  };
}
function kl(e, t, n) {
  var r = Kv(e, t, n), i = Kv(e + 1, t, n);
  return (b0(e) - r + i) / 7;
}
Vt("w", ["ww", 2], "wo", "week");
Vt("W", ["WW", 2], "Wo", "isoWeek");
St("w", Pr, Km);
St("ww", Pr, ko);
St("W", Pr, Km);
St("WW", Pr, ko);
xh(
  ["w", "ww", "W", "WW"],
  function(e, t, n, r) {
    t[r.substr(0, 1)] = Bn(e);
  }
);
function Wde(e) {
  return Q0(e, this._week.dow, this._week.doy).week;
}
var Xde = {
  dow: 0,
  // Sunday is the first day of the week.
  doy: 6
  // The week that contains Jan 6th is the first week of the year.
};
function Zde() {
  return this._week.dow;
}
function Qde() {
  return this._week.doy;
}
function Jde(e) {
  var t = this.localeData().week(this);
  return e == null ? t : this.add((e - t) * 7, "d");
}
function $de(e) {
  var t = Q0(this, 1, 4).week;
  return e == null ? t : this.add((e - t) * 7, "d");
}
Vt("d", 0, "do", "day");
Vt("dd", 0, 0, function(e) {
  return this.localeData().weekdaysMin(this, e);
});
Vt("ddd", 0, 0, function(e) {
  return this.localeData().weekdaysShort(this, e);
});
Vt("dddd", 0, 0, function(e) {
  return this.localeData().weekdays(this, e);
});
Vt("e", 0, 0, "weekday");
Vt("E", 0, 0, "isoWeekday");
St("d", Pr);
St("e", Pr);
St("E", Pr);
St("dd", function(e, t) {
  return t.weekdaysMinRegex(e);
});
St("ddd", function(e, t) {
  return t.weekdaysShortRegex(e);
});
St("dddd", function(e, t) {
  return t.weekdaysRegex(e);
});
xh(["dd", "ddd", "dddd"], function(e, t, n, r) {
  var i = n._locale.weekdaysParse(e, r, n._strict);
  i != null ? t.d = i : An(n).invalidWeekday = e;
});
xh(["d", "e", "E"], function(e, t, n, r) {
  t[r] = Bn(e);
});
function efe(e, t) {
  return typeof e != "string" ? e : isNaN(e) ? (e = t.weekdaysParse(e), typeof e == "number" ? e : null) : parseInt(e, 10);
}
function tfe(e, t) {
  return typeof e == "string" ? t.weekdaysParse(e) % 7 || 7 : isNaN(e) ? null : e;
}
function v7(e, t) {
  return e.slice(t, 7).concat(e.slice(0, t));
}
var nfe = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), sN = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), rfe = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), ife = _h, afe = _h, ofe = _h;
function sfe(e, t) {
  var n = js(this._weekdays) ? this._weekdays : this._weekdays[e && e !== !0 && this._weekdays.isFormat.test(t) ? "format" : "standalone"];
  return e === !0 ? v7(n, this._week.dow) : e ? n[e.day()] : n;
}
function ufe(e) {
  return e === !0 ? v7(this._weekdaysShort, this._week.dow) : e ? this._weekdaysShort[e.day()] : this._weekdaysShort;
}
function lfe(e) {
  return e === !0 ? v7(this._weekdaysMin, this._week.dow) : e ? this._weekdaysMin[e.day()] : this._weekdaysMin;
}
function cfe(e, t, n) {
  var r, i, a, o = e.toLocaleLowerCase();
  if (!this._weekdaysParse)
    for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], r = 0; r < 7; ++r)
      a = Vu([2e3, 1]).day(r), this._minWeekdaysParse[r] = this.weekdaysMin(
        a,
        ""
      ).toLocaleLowerCase(), this._shortWeekdaysParse[r] = this.weekdaysShort(
        a,
        ""
      ).toLocaleLowerCase(), this._weekdaysParse[r] = this.weekdays(a, "").toLocaleLowerCase();
  return n ? t === "dddd" ? (i = Qr.call(this._weekdaysParse, o), i !== -1 ? i : null) : t === "ddd" ? (i = Qr.call(this._shortWeekdaysParse, o), i !== -1 ? i : null) : (i = Qr.call(this._minWeekdaysParse, o), i !== -1 ? i : null) : t === "dddd" ? (i = Qr.call(this._weekdaysParse, o), i !== -1 || (i = Qr.call(this._shortWeekdaysParse, o), i !== -1) ? i : (i = Qr.call(this._minWeekdaysParse, o), i !== -1 ? i : null)) : t === "ddd" ? (i = Qr.call(this._shortWeekdaysParse, o), i !== -1 || (i = Qr.call(this._weekdaysParse, o), i !== -1) ? i : (i = Qr.call(this._minWeekdaysParse, o), i !== -1 ? i : null)) : (i = Qr.call(this._minWeekdaysParse, o), i !== -1 || (i = Qr.call(this._weekdaysParse, o), i !== -1) ? i : (i = Qr.call(this._shortWeekdaysParse, o), i !== -1 ? i : null));
}
function dfe(e, t, n) {
  var r, i, a;
  if (this._weekdaysParseExact)
    return cfe.call(this, e, t, n);
  for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), r = 0; r < 7; r++) {
    if (i = Vu([2e3, 1]).day(r), n && !this._fullWeekdaysParse[r] && (this._fullWeekdaysParse[r] = new RegExp(
      "^" + this.weekdays(i, "").replace(".", "\\.?") + "$",
      "i"
    ), this._shortWeekdaysParse[r] = new RegExp(
      "^" + this.weekdaysShort(i, "").replace(".", "\\.?") + "$",
      "i"
    ), this._minWeekdaysParse[r] = new RegExp(
      "^" + this.weekdaysMin(i, "").replace(".", "\\.?") + "$",
      "i"
    )), this._weekdaysParse[r] || (a = "^" + this.weekdays(i, "") + "|^" + this.weekdaysShort(i, "") + "|^" + this.weekdaysMin(i, ""), this._weekdaysParse[r] = new RegExp(a.replace(".", ""), "i")), n && t === "dddd" && this._fullWeekdaysParse[r].test(e))
      return r;
    if (n && t === "ddd" && this._shortWeekdaysParse[r].test(e))
      return r;
    if (n && t === "dd" && this._minWeekdaysParse[r].test(e))
      return r;
    if (!n && this._weekdaysParse[r].test(e))
      return r;
  }
}
function ffe(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  var t = X0(this, "Day");
  return e != null ? (e = efe(e, this.localeData()), this.add(e - t, "d")) : t;
}
function mfe(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  var t = (this.day() + 7 - this.localeData()._week.dow) % 7;
  return e == null ? t : this.add(e - t, "d");
}
function pfe(e) {
  if (!this.isValid())
    return e != null ? this : NaN;
  if (e != null) {
    var t = tfe(e, this.localeData());
    return this.day(this.day() % 7 ? t : t - 7);
  } else
    return this.day() || 7;
}
function hfe(e) {
  return this._weekdaysParseExact ? (Jn(this, "_weekdaysRegex") || y7.call(this), e ? this._weekdaysStrictRegex : this._weekdaysRegex) : (Jn(this, "_weekdaysRegex") || (this._weekdaysRegex = ife), this._weekdaysStrictRegex && e ? this._weekdaysStrictRegex : this._weekdaysRegex);
}
function gfe(e) {
  return this._weekdaysParseExact ? (Jn(this, "_weekdaysRegex") || y7.call(this), e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (Jn(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = afe), this._weekdaysShortStrictRegex && e ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex);
}
function vfe(e) {
  return this._weekdaysParseExact ? (Jn(this, "_weekdaysRegex") || y7.call(this), e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (Jn(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = ofe), this._weekdaysMinStrictRegex && e ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex);
}
function y7() {
  function e(c, d) {
    return d.length - c.length;
  }
  var t = [], n = [], r = [], i = [], a, o, s, u, l;
  for (a = 0; a < 7; a++)
    o = Vu([2e3, 1]).day(a), s = Tl(this.weekdaysMin(o, "")), u = Tl(this.weekdaysShort(o, "")), l = Tl(this.weekdays(o, "")), t.push(s), n.push(u), r.push(l), i.push(s), i.push(u), i.push(l);
  t.sort(e), n.sort(e), r.sort(e), i.sort(e), this._weekdaysRegex = new RegExp("^(" + i.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp(
    "^(" + r.join("|") + ")",
    "i"
  ), this._weekdaysShortStrictRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  ), this._weekdaysMinStrictRegex = new RegExp(
    "^(" + t.join("|") + ")",
    "i"
  );
}
function b7() {
  return this.hours() % 12 || 12;
}
function yfe() {
  return this.hours() || 24;
}
Vt("H", ["HH", 2], 0, "hour");
Vt("h", ["hh", 2], 0, b7);
Vt("k", ["kk", 2], 0, yfe);
Vt("hmm", 0, 0, function() {
  return "" + b7.apply(this) + Ru(this.minutes(), 2);
});
Vt("hmmss", 0, 0, function() {
  return "" + b7.apply(this) + Ru(this.minutes(), 2) + Ru(this.seconds(), 2);
});
Vt("Hmm", 0, 0, function() {
  return "" + this.hours() + Ru(this.minutes(), 2);
});
Vt("Hmmss", 0, 0, function() {
  return "" + this.hours() + Ru(this.minutes(), 2) + Ru(this.seconds(), 2);
});
function uN(e, t) {
  Vt(e, 0, 0, function() {
    return this.localeData().meridiem(
      this.hours(),
      this.minutes(),
      t
    );
  });
}
uN("a", !0);
uN("A", !1);
function lN(e, t) {
  return t._meridiemParse;
}
St("a", lN);
St("A", lN);
St("H", Pr, h7);
St("h", Pr, Km);
St("k", Pr, Km);
St("HH", Pr, ko);
St("hh", Pr, ko);
St("kk", Pr, ko);
St("hmm", QL);
St("hmmss", JL);
St("Hmm", QL);
St("Hmmss", JL);
vr(["H", "HH"], wi);
vr(["k", "kk"], function(e, t, n) {
  var r = Bn(e);
  t[wi] = r === 24 ? 0 : r;
});
vr(["a", "A"], function(e, t, n) {
  n._isPm = n._locale.isPM(e), n._meridiem = e;
});
vr(["h", "hh"], function(e, t, n) {
  t[wi] = Bn(e), An(n).bigHour = !0;
});
vr("hmm", function(e, t, n) {
  var r = e.length - 2;
  t[wi] = Bn(e.substr(0, r)), t[Gs] = Bn(e.substr(r)), An(n).bigHour = !0;
});
vr("hmmss", function(e, t, n) {
  var r = e.length - 4, i = e.length - 2;
  t[wi] = Bn(e.substr(0, r)), t[Gs] = Bn(e.substr(r, 2)), t[xl] = Bn(e.substr(i)), An(n).bigHour = !0;
});
vr("Hmm", function(e, t, n) {
  var r = e.length - 2;
  t[wi] = Bn(e.substr(0, r)), t[Gs] = Bn(e.substr(r));
});
vr("Hmmss", function(e, t, n) {
  var r = e.length - 4, i = e.length - 2;
  t[wi] = Bn(e.substr(0, r)), t[Gs] = Bn(e.substr(r, 2)), t[xl] = Bn(e.substr(i));
});
function bfe(e) {
  return (e + "").toLowerCase().charAt(0) === "p";
}
var _fe = /[ap]\.?m?\.?/i, xfe = Ym("Hours", !0);
function Cfe(e, t, n) {
  return e > 11 ? n ? "pm" : "PM" : n ? "am" : "AM";
}
var cN = {
  calendar: cde,
  longDateFormat: pde,
  invalidDate: gde,
  ordinal: yde,
  dayOfMonthOrdinalParse: bde,
  relativeTime: xde,
  months: Nde,
  monthsShort: tN,
  week: Xde,
  weekdays: nfe,
  weekdaysMin: rfe,
  weekdaysShort: sN,
  meridiemParse: _fe
}, Or = {}, Ip = {}, J0;
function Sfe(e, t) {
  var n, r = Math.min(e.length, t.length);
  for (n = 0; n < r; n += 1)
    if (e[n] !== t[n])
      return n;
  return r;
}
function XM(e) {
  return e && e.toLowerCase().replace("_", "-");
}
function Afe(e) {
  for (var t = 0, n, r, i, a; t < e.length; ) {
    for (a = XM(e[t]).split("-"), n = a.length, r = XM(e[t + 1]), r = r ? r.split("-") : null; n > 0; ) {
      if (i = X3(a.slice(0, n).join("-")), i)
        return i;
      if (r && r.length >= n && Sfe(a, r) >= n - 1)
        break;
      n--;
    }
    t++;
  }
  return J0;
}
function wfe(e) {
  return !!(e && e.match("^[^/\\\\]*$"));
}
function X3(e) {
  var t = null, n;
  if (Or[e] === void 0 && typeof module < "u" && module && module.exports && wfe(e))
    try {
      t = J0._abbr, n = require, n("./locale/" + e), nd(t);
    } catch {
      Or[e] = null;
    }
  return Or[e];
}
function nd(e, t) {
  var n;
  return e && (Va(t) ? n = Zl(e) : n = _7(e, t), n ? J0 = n : typeof console < "u" && console.warn && console.warn(
    "Locale " + e + " not found. Did you forget to load it?"
  )), J0._abbr;
}
function _7(e, t) {
  if (t !== null) {
    var n, r = cN;
    if (t.abbr = e, Or[e] != null)
      YL(
        "defineLocaleOverride",
        "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
      ), r = Or[e]._config;
    else if (t.parentLocale != null)
      if (Or[t.parentLocale] != null)
        r = Or[t.parentLocale]._config;
      else if (n = X3(t.parentLocale), n != null)
        r = n._config;
      else
        return Ip[t.parentLocale] || (Ip[t.parentLocale] = []), Ip[t.parentLocale].push({
          name: e,
          config: t
        }), null;
    return Or[e] = new c7(d6(r, t)), Ip[e] && Ip[e].forEach(function(i) {
      _7(i.name, i.config);
    }), nd(e), Or[e];
  } else
    return delete Or[e], null;
}
function Ife(e, t) {
  if (t != null) {
    var n, r, i = cN;
    Or[e] != null && Or[e].parentLocale != null ? Or[e].set(d6(Or[e]._config, t)) : (r = X3(e), r != null && (i = r._config), t = d6(i, t), r == null && (t.abbr = e), n = new c7(t), n.parentLocale = Or[e], Or[e] = n), nd(e);
  } else
    Or[e] != null && (Or[e].parentLocale != null ? (Or[e] = Or[e].parentLocale, e === nd() && nd(e)) : Or[e] != null && delete Or[e]);
  return Or[e];
}
function Zl(e) {
  var t;
  if (e && e._locale && e._locale._abbr && (e = e._locale._abbr), !e)
    return J0;
  if (!js(e)) {
    if (t = X3(e), t)
      return t;
    e = [e];
  }
  return Afe(e);
}
function Pfe() {
  return f6(Or);
}
function x7(e) {
  var t, n = e._a;
  return n && An(e).overflow === -2 && (t = n[_l] < 0 || n[_l] > 11 ? _l : n[vu] < 1 || n[vu] > g7(n[ma], n[_l]) ? vu : n[wi] < 0 || n[wi] > 24 || n[wi] === 24 && (n[Gs] !== 0 || n[xl] !== 0 || n[nf] !== 0) ? wi : n[Gs] < 0 || n[Gs] > 59 ? Gs : n[xl] < 0 || n[xl] > 59 ? xl : n[nf] < 0 || n[nf] > 999 ? nf : -1, An(e)._overflowDayOfYear && (t < ma || t > vu) && (t = vu), An(e)._overflowWeeks && t === -1 && (t = kde), An(e)._overflowWeekday && t === -1 && (t = Dde), An(e).overflow = t), e;
}
var Mfe = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, Efe = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, Tfe = /Z|[+-]\d\d(?::?\d\d)?/, sg = [
  ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
  ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
  ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
  ["GGGG-[W]WW", /\d{4}-W\d\d/, !1],
  ["YYYY-DDD", /\d{4}-\d{3}/],
  ["YYYY-MM", /\d{4}-\d\d/, !1],
  ["YYYYYYMMDD", /[+-]\d{10}/],
  ["YYYYMMDD", /\d{8}/],
  ["GGGG[W]WWE", /\d{4}W\d{3}/],
  ["GGGG[W]WW", /\d{4}W\d{2}/, !1],
  ["YYYYDDD", /\d{7}/],
  ["YYYYMM", /\d{6}/, !1],
  ["YYYY", /\d{4}/, !1]
], Rb = [
  ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
  ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
  ["HH:mm:ss", /\d\d:\d\d:\d\d/],
  ["HH:mm", /\d\d:\d\d/],
  ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
  ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
  ["HHmmss", /\d\d\d\d\d\d/],
  ["HHmm", /\d\d\d\d/],
  ["HH", /\d\d/]
], kfe = /^\/?Date\((-?\d+)/i, Dfe = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, Ofe = {
  UT: 0,
  GMT: 0,
  EDT: -4 * 60,
  EST: -5 * 60,
  CDT: -5 * 60,
  CST: -6 * 60,
  MDT: -6 * 60,
  MST: -7 * 60,
  PDT: -7 * 60,
  PST: -8 * 60
};
function dN(e) {
  var t, n, r = e._i, i = Mfe.exec(r) || Efe.exec(r), a, o, s, u, l = sg.length, c = Rb.length;
  if (i) {
    for (An(e).iso = !0, t = 0, n = l; t < n; t++)
      if (sg[t][1].exec(i[1])) {
        o = sg[t][0], a = sg[t][2] !== !1;
        break;
      }
    if (o == null) {
      e._isValid = !1;
      return;
    }
    if (i[3]) {
      for (t = 0, n = c; t < n; t++)
        if (Rb[t][1].exec(i[3])) {
          s = (i[2] || " ") + Rb[t][0];
          break;
        }
      if (s == null) {
        e._isValid = !1;
        return;
      }
    }
    if (!a && s != null) {
      e._isValid = !1;
      return;
    }
    if (i[4])
      if (Tfe.exec(i[4]))
        u = "Z";
      else {
        e._isValid = !1;
        return;
      }
    e._f = o + (s || "") + (u || ""), S7(e);
  } else
    e._isValid = !1;
}
function Bfe(e, t, n, r, i, a) {
  var o = [
    Rfe(e),
    tN.indexOf(t),
    parseInt(n, 10),
    parseInt(r, 10),
    parseInt(i, 10)
  ];
  return a && o.push(parseInt(a, 10)), o;
}
function Rfe(e) {
  var t = parseInt(e, 10);
  return t <= 49 ? 2e3 + t : t <= 999 ? 1900 + t : t;
}
function Lfe(e) {
  return e.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function Nfe(e, t, n) {
  if (e) {
    var r = sN.indexOf(e), i = new Date(
      t[0],
      t[1],
      t[2]
    ).getDay();
    if (r !== i)
      return An(n).weekdayMismatch = !0, n._isValid = !1, !1;
  }
  return !0;
}
function Ffe(e, t, n) {
  if (e)
    return Ofe[e];
  if (t)
    return 0;
  var r = parseInt(n, 10), i = r % 100, a = (r - i) / 100;
  return a * 60 + i;
}
function fN(e) {
  var t = Dfe.exec(Lfe(e._i)), n;
  if (t) {
    if (n = Bfe(
      t[4],
      t[3],
      t[2],
      t[5],
      t[6],
      t[7]
    ), !Nfe(t[1], n, e))
      return;
    e._a = n, e._tzm = Ffe(t[8], t[9], t[10]), e._d = Z0.apply(null, e._a), e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), An(e).rfc2822 = !0;
  } else
    e._isValid = !1;
}
function Vfe(e) {
  var t = kfe.exec(e._i);
  if (t !== null) {
    e._d = /* @__PURE__ */ new Date(+t[1]);
    return;
  }
  if (dN(e), e._isValid === !1)
    delete e._isValid;
  else
    return;
  if (fN(e), e._isValid === !1)
    delete e._isValid;
  else
    return;
  e._strict ? e._isValid = !1 : ht.createFromInputFallback(e);
}
ht.createFromInputFallback = ps(
  "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
  function(e) {
    e._d = /* @__PURE__ */ new Date(e._i + (e._useUTC ? " UTC" : ""));
  }
);
function P1(e, t, n) {
  return e ?? t ?? n;
}
function Gfe(e) {
  var t = new Date(ht.now());
  return e._useUTC ? [
    t.getUTCFullYear(),
    t.getUTCMonth(),
    t.getUTCDate()
  ] : [t.getFullYear(), t.getMonth(), t.getDate()];
}
function C7(e) {
  var t, n, r = [], i, a, o;
  if (!e._d) {
    for (i = Gfe(e), e._w && e._a[vu] == null && e._a[_l] == null && zfe(e), e._dayOfYear != null && (o = P1(e._a[ma], i[ma]), (e._dayOfYear > b0(o) || e._dayOfYear === 0) && (An(e)._overflowDayOfYear = !0), n = Z0(o, 0, e._dayOfYear), e._a[_l] = n.getUTCMonth(), e._a[vu] = n.getUTCDate()), t = 0; t < 3 && e._a[t] == null; ++t)
      e._a[t] = r[t] = i[t];
    for (; t < 7; t++)
      e._a[t] = r[t] = e._a[t] == null ? t === 2 ? 1 : 0 : e._a[t];
    e._a[wi] === 24 && e._a[Gs] === 0 && e._a[xl] === 0 && e._a[nf] === 0 && (e._nextDay = !0, e._a[wi] = 0), e._d = (e._useUTC ? Z0 : Yde).apply(
      null,
      r
    ), a = e._useUTC ? e._d.getUTCDay() : e._d.getDay(), e._tzm != null && e._d.setUTCMinutes(e._d.getUTCMinutes() - e._tzm), e._nextDay && (e._a[wi] = 24), e._w && typeof e._w.d < "u" && e._w.d !== a && (An(e).weekdayMismatch = !0);
  }
}
function zfe(e) {
  var t, n, r, i, a, o, s, u, l;
  t = e._w, t.GG != null || t.W != null || t.E != null ? (a = 1, o = 4, n = P1(
    t.GG,
    e._a[ma],
    Q0(Ir(), 1, 4).year
  ), r = P1(t.W, 1), i = P1(t.E, 1), (i < 1 || i > 7) && (u = !0)) : (a = e._locale._week.dow, o = e._locale._week.doy, l = Q0(Ir(), a, o), n = P1(t.gg, e._a[ma], l.year), r = P1(t.w, l.week), t.d != null ? (i = t.d, (i < 0 || i > 6) && (u = !0)) : t.e != null ? (i = t.e + a, (t.e < 0 || t.e > 6) && (u = !0)) : i = a), r < 1 || r > kl(n, a, o) ? An(e)._overflowWeeks = !0 : u != null ? An(e)._overflowWeekday = !0 : (s = oN(n, r, i, a, o), e._a[ma] = s.year, e._dayOfYear = s.dayOfYear);
}
ht.ISO_8601 = function() {
};
ht.RFC_2822 = function() {
};
function S7(e) {
  if (e._f === ht.ISO_8601) {
    dN(e);
    return;
  }
  if (e._f === ht.RFC_2822) {
    fN(e);
    return;
  }
  e._a = [], An(e).empty = !0;
  var t = "" + e._i, n, r, i, a, o, s = t.length, u = 0, l, c;
  for (i = WL(e._f, e._locale).match(d7) || [], c = i.length, n = 0; n < c; n++)
    a = i[n], r = (t.match(Mde(a, e)) || [])[0], r && (o = t.substr(0, t.indexOf(r)), o.length > 0 && An(e).unusedInput.push(o), t = t.slice(
      t.indexOf(r) + r.length
    ), u += r.length), q1[a] ? (r ? An(e).empty = !1 : An(e).unusedTokens.push(a), Tde(a, r, e)) : e._strict && !r && An(e).unusedTokens.push(a);
  An(e).charsLeftOver = s - u, t.length > 0 && An(e).unusedInput.push(t), e._a[wi] <= 12 && An(e).bigHour === !0 && e._a[wi] > 0 && (An(e).bigHour = void 0), An(e).parsedDateParts = e._a.slice(0), An(e).meridiem = e._meridiem, e._a[wi] = Ufe(
    e._locale,
    e._a[wi],
    e._meridiem
  ), l = An(e).era, l !== null && (e._a[ma] = e._locale.erasConvertYear(l, e._a[ma])), C7(e), x7(e);
}
function Ufe(e, t, n) {
  var r;
  return n == null ? t : e.meridiemHour != null ? e.meridiemHour(t, n) : (e.isPM != null && (r = e.isPM(n), r && t < 12 && (t += 12), !r && t === 12 && (t = 0)), t);
}
function Hfe(e) {
  var t, n, r, i, a, o, s = !1, u = e._f.length;
  if (u === 0) {
    An(e).invalidFormat = !0, e._d = /* @__PURE__ */ new Date(NaN);
    return;
  }
  for (i = 0; i < u; i++)
    a = 0, o = !1, t = l7({}, e), e._useUTC != null && (t._useUTC = e._useUTC), t._f = e._f[i], S7(t), u7(t) && (o = !0), a += An(t).charsLeftOver, a += An(t).unusedTokens.length * 10, An(t).score = a, s ? a < r && (r = a, n = t) : (r == null || a < r || o) && (r = a, n = t, o && (s = !0));
  Xc(e, n || t);
}
function qfe(e) {
  if (!e._d) {
    var t = f7(e._i), n = t.day === void 0 ? t.date : t.day;
    e._a = jL(
      [t.year, t.month, n, t.hour, t.minute, t.second, t.millisecond],
      function(r) {
        return r && parseInt(r, 10);
      }
    ), C7(e);
  }
}
function jfe(e) {
  var t = new bh(x7(mN(e)));
  return t._nextDay && (t.add(1, "d"), t._nextDay = void 0), t;
}
function mN(e) {
  var t = e._i, n = e._f;
  return e._locale = e._locale || Zl(e._l), t === null || n === void 0 && t === "" ? U3({ nullInput: !0 }) : (typeof t == "string" && (e._i = t = e._locale.preparse(t)), Ks(t) ? new bh(x7(t)) : (yh(t) ? e._d = t : js(n) ? Hfe(e) : n ? S7(e) : Kfe(e), u7(e) || (e._d = null), e));
}
function Kfe(e) {
  var t = e._i;
  Va(t) ? e._d = new Date(ht.now()) : yh(t) ? e._d = new Date(t.valueOf()) : typeof t == "string" ? Vfe(e) : js(t) ? (e._a = jL(t.slice(0), function(n) {
    return parseInt(n, 10);
  }), C7(e)) : gf(t) ? qfe(e) : zl(t) ? e._d = new Date(t) : ht.createFromInputFallback(e);
}
function pN(e, t, n, r, i) {
  var a = {};
  return (t === !0 || t === !1) && (r = t, t = void 0), (n === !0 || n === !1) && (r = n, n = void 0), (gf(e) && s7(e) || js(e) && e.length === 0) && (e = void 0), a._isAMomentObject = !0, a._useUTC = a._isUTC = i, a._l = n, a._i = e, a._f = t, a._strict = r, jfe(a);
}
function Ir(e, t, n, r) {
  return pN(e, t, n, r, !1);
}
var Yfe = ps(
  "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var e = Ir.apply(null, arguments);
    return this.isValid() && e.isValid() ? e < this ? this : e : U3();
  }
), Wfe = ps(
  "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var e = Ir.apply(null, arguments);
    return this.isValid() && e.isValid() ? e > this ? this : e : U3();
  }
);
function hN(e, t) {
  var n, r;
  if (t.length === 1 && js(t[0]) && (t = t[0]), !t.length)
    return Ir();
  for (n = t[0], r = 1; r < t.length; ++r)
    (!t[r].isValid() || t[r][e](n)) && (n = t[r]);
  return n;
}
function Xfe() {
  var e = [].slice.call(arguments, 0);
  return hN("isBefore", e);
}
function Zfe() {
  var e = [].slice.call(arguments, 0);
  return hN("isAfter", e);
}
var Qfe = function() {
  return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
}, Pp = [
  "year",
  "quarter",
  "month",
  "week",
  "day",
  "hour",
  "minute",
  "second",
  "millisecond"
];
function Jfe(e) {
  var t, n = !1, r, i = Pp.length;
  for (t in e)
    if (Jn(e, t) && !(Qr.call(Pp, t) !== -1 && (e[t] == null || !isNaN(e[t]))))
      return !1;
  for (r = 0; r < i; ++r)
    if (e[Pp[r]]) {
      if (n)
        return !1;
      parseFloat(e[Pp[r]]) !== Bn(e[Pp[r]]) && (n = !0);
    }
  return !0;
}
function $fe() {
  return this._isValid;
}
function e1e() {
  return Qs(NaN);
}
function Z3(e) {
  var t = f7(e), n = t.year || 0, r = t.quarter || 0, i = t.month || 0, a = t.week || t.isoWeek || 0, o = t.day || 0, s = t.hour || 0, u = t.minute || 0, l = t.second || 0, c = t.millisecond || 0;
  this._isValid = Jfe(t), this._milliseconds = +c + l * 1e3 + // 1000
  u * 6e4 + // 1000 * 60
  s * 1e3 * 60 * 60, this._days = +o + a * 7, this._months = +i + r * 3 + n * 12, this._data = {}, this._locale = Zl(), this._bubble();
}
function Og(e) {
  return e instanceof Z3;
}
function p6(e) {
  return e < 0 ? Math.round(-1 * e) * -1 : Math.round(e);
}
function t1e(e, t, n) {
  var r = Math.min(e.length, t.length), i = Math.abs(e.length - t.length), a = 0, o;
  for (o = 0; o < r; o++)
    Bn(e[o]) !== Bn(t[o]) && a++;
  return a + i;
}
function gN(e, t) {
  Vt(e, 0, 0, function() {
    var n = this.utcOffset(), r = "+";
    return n < 0 && (n = -n, r = "-"), r + Ru(~~(n / 60), 2) + t + Ru(~~n % 60, 2);
  });
}
gN("Z", ":");
gN("ZZ", "");
St("Z", Y3);
St("ZZ", Y3);
vr(["Z", "ZZ"], function(e, t, n) {
  n._useUTC = !0, n._tzm = A7(Y3, e);
});
var n1e = /([\+\-]|\d\d)/gi;
function A7(e, t) {
  var n = (t || "").match(e), r, i, a;
  return n === null ? null : (r = n[n.length - 1] || [], i = (r + "").match(n1e) || ["-", 0, 0], a = +(i[1] * 60) + Bn(i[2]), a === 0 ? 0 : i[0] === "+" ? a : -a);
}
function w7(e, t) {
  var n, r;
  return t._isUTC ? (n = t.clone(), r = (Ks(e) || yh(e) ? e.valueOf() : Ir(e).valueOf()) - n.valueOf(), n._d.setTime(n._d.valueOf() + r), ht.updateOffset(n, !1), n) : Ir(e).local();
}
function h6(e) {
  return -Math.round(e._d.getTimezoneOffset());
}
ht.updateOffset = function() {
};
function r1e(e, t, n) {
  var r = this._offset || 0, i;
  if (!this.isValid())
    return e != null ? this : NaN;
  if (e != null) {
    if (typeof e == "string") {
      if (e = A7(Y3, e), e === null)
        return this;
    } else Math.abs(e) < 16 && !n && (e = e * 60);
    return !this._isUTC && t && (i = h6(this)), this._offset = e, this._isUTC = !0, i != null && this.add(i, "m"), r !== e && (!t || this._changeInProgress ? bN(
      this,
      Qs(e - r, "m"),
      1,
      !1
    ) : this._changeInProgress || (this._changeInProgress = !0, ht.updateOffset(this, !0), this._changeInProgress = null)), this;
  } else
    return this._isUTC ? r : h6(this);
}
function i1e(e, t) {
  return e != null ? (typeof e != "string" && (e = -e), this.utcOffset(e, t), this) : -this.utcOffset();
}
function a1e(e) {
  return this.utcOffset(0, e);
}
function o1e(e) {
  return this._isUTC && (this.utcOffset(0, e), this._isUTC = !1, e && this.subtract(h6(this), "m")), this;
}
function s1e() {
  if (this._tzm != null)
    this.utcOffset(this._tzm, !1, !0);
  else if (typeof this._i == "string") {
    var e = A7(Ide, this._i);
    e != null ? this.utcOffset(e) : this.utcOffset(0, !0);
  }
  return this;
}
function u1e(e) {
  return this.isValid() ? (e = e ? Ir(e).utcOffset() : 0, (this.utcOffset() - e) % 60 === 0) : !1;
}
function l1e() {
  return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function c1e() {
  if (!Va(this._isDSTShifted))
    return this._isDSTShifted;
  var e = {}, t;
  return l7(e, this), e = mN(e), e._a ? (t = e._isUTC ? Vu(e._a) : Ir(e._a), this._isDSTShifted = this.isValid() && t1e(e._a, t.toArray()) > 0) : this._isDSTShifted = !1, this._isDSTShifted;
}
function d1e() {
  return this.isValid() ? !this._isUTC : !1;
}
function f1e() {
  return this.isValid() ? this._isUTC : !1;
}
function vN() {
  return this.isValid() ? this._isUTC && this._offset === 0 : !1;
}
var m1e = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, p1e = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function Qs(e, t) {
  var n = e, r = null, i, a, o;
  return Og(e) ? n = {
    ms: e._milliseconds,
    d: e._days,
    M: e._months
  } : zl(e) || !isNaN(+e) ? (n = {}, t ? n[t] = +e : n.milliseconds = +e) : (r = m1e.exec(e)) ? (i = r[1] === "-" ? -1 : 1, n = {
    y: 0,
    d: Bn(r[vu]) * i,
    h: Bn(r[wi]) * i,
    m: Bn(r[Gs]) * i,
    s: Bn(r[xl]) * i,
    ms: Bn(p6(r[nf] * 1e3)) * i
    // the millisecond decimal point is included in the match
  }) : (r = p1e.exec(e)) ? (i = r[1] === "-" ? -1 : 1, n = {
    y: zd(r[2], i),
    M: zd(r[3], i),
    w: zd(r[4], i),
    d: zd(r[5], i),
    h: zd(r[6], i),
    m: zd(r[7], i),
    s: zd(r[8], i)
  }) : n == null ? n = {} : typeof n == "object" && ("from" in n || "to" in n) && (o = h1e(
    Ir(n.from),
    Ir(n.to)
  ), n = {}, n.ms = o.milliseconds, n.M = o.months), a = new Z3(n), Og(e) && Jn(e, "_locale") && (a._locale = e._locale), Og(e) && Jn(e, "_isValid") && (a._isValid = e._isValid), a;
}
Qs.fn = Z3.prototype;
Qs.invalid = e1e;
function zd(e, t) {
  var n = e && parseFloat(e.replace(",", "."));
  return (isNaN(n) ? 0 : n) * t;
}
function ZM(e, t) {
  var n = {};
  return n.months = t.month() - e.month() + (t.year() - e.year()) * 12, e.clone().add(n.months, "M").isAfter(t) && --n.months, n.milliseconds = +t - +e.clone().add(n.months, "M"), n;
}
function h1e(e, t) {
  var n;
  return e.isValid() && t.isValid() ? (t = w7(t, e), e.isBefore(t) ? n = ZM(e, t) : (n = ZM(t, e), n.milliseconds = -n.milliseconds, n.months = -n.months), n) : { milliseconds: 0, months: 0 };
}
function yN(e, t) {
  return function(n, r) {
    var i, a;
    return r !== null && !isNaN(+r) && (YL(
      t,
      "moment()." + t + "(period, number) is deprecated. Please use moment()." + t + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
    ), a = n, n = r, r = a), i = Qs(n, r), bN(this, i, e), this;
  };
}
function bN(e, t, n, r) {
  var i = t._milliseconds, a = p6(t._days), o = p6(t._months);
  e.isValid() && (r = r ?? !0, o && rN(e, X0(e, "Month") + o * n), a && eN(e, "Date", X0(e, "Date") + a * n), i && e._d.setTime(e._d.valueOf() + i * n), r && ht.updateOffset(e, a || o));
}
var g1e = yN(1, "add"), v1e = yN(-1, "subtract");
function _N(e) {
  return typeof e == "string" || e instanceof String;
}
function y1e(e) {
  return Ks(e) || yh(e) || _N(e) || zl(e) || _1e(e) || b1e(e) || e === null || e === void 0;
}
function b1e(e) {
  var t = gf(e) && !s7(e), n = !1, r = [
    "years",
    "year",
    "y",
    "months",
    "month",
    "M",
    "days",
    "day",
    "d",
    "dates",
    "date",
    "D",
    "hours",
    "hour",
    "h",
    "minutes",
    "minute",
    "m",
    "seconds",
    "second",
    "s",
    "milliseconds",
    "millisecond",
    "ms"
  ], i, a, o = r.length;
  for (i = 0; i < o; i += 1)
    a = r[i], n = n || Jn(e, a);
  return t && n;
}
function _1e(e) {
  var t = js(e), n = !1;
  return t && (n = e.filter(function(r) {
    return !zl(r) && _N(e);
  }).length === 0), t && n;
}
function x1e(e) {
  var t = gf(e) && !s7(e), n = !1, r = [
    "sameDay",
    "nextDay",
    "lastDay",
    "nextWeek",
    "lastWeek",
    "sameElse"
  ], i, a;
  for (i = 0; i < r.length; i += 1)
    a = r[i], n = n || Jn(e, a);
  return t && n;
}
function C1e(e, t) {
  var n = e.diff(t, "days", !0);
  return n < -6 ? "sameElse" : n < -1 ? "lastWeek" : n < 0 ? "lastDay" : n < 1 ? "sameDay" : n < 2 ? "nextDay" : n < 7 ? "nextWeek" : "sameElse";
}
function S1e(e, t) {
  arguments.length === 1 && (arguments[0] ? y1e(arguments[0]) ? (e = arguments[0], t = void 0) : x1e(arguments[0]) && (t = arguments[0], e = void 0) : (e = void 0, t = void 0));
  var n = e || Ir(), r = w7(n, this).startOf("day"), i = ht.calendarFormat(this, r) || "sameElse", a = t && (Gu(t[i]) ? t[i].call(this, n) : t[i]);
  return this.format(
    a || this.localeData().calendar(i, this, Ir(n))
  );
}
function A1e() {
  return new bh(this);
}
function w1e(e, t) {
  var n = Ks(e) ? e : Ir(e);
  return this.isValid() && n.isValid() ? (t = hs(t) || "millisecond", t === "millisecond" ? this.valueOf() > n.valueOf() : n.valueOf() < this.clone().startOf(t).valueOf()) : !1;
}
function I1e(e, t) {
  var n = Ks(e) ? e : Ir(e);
  return this.isValid() && n.isValid() ? (t = hs(t) || "millisecond", t === "millisecond" ? this.valueOf() < n.valueOf() : this.clone().endOf(t).valueOf() < n.valueOf()) : !1;
}
function P1e(e, t, n, r) {
  var i = Ks(e) ? e : Ir(e), a = Ks(t) ? t : Ir(t);
  return this.isValid() && i.isValid() && a.isValid() ? (r = r || "()", (r[0] === "(" ? this.isAfter(i, n) : !this.isBefore(i, n)) && (r[1] === ")" ? this.isBefore(a, n) : !this.isAfter(a, n))) : !1;
}
function M1e(e, t) {
  var n = Ks(e) ? e : Ir(e), r;
  return this.isValid() && n.isValid() ? (t = hs(t) || "millisecond", t === "millisecond" ? this.valueOf() === n.valueOf() : (r = n.valueOf(), this.clone().startOf(t).valueOf() <= r && r <= this.clone().endOf(t).valueOf())) : !1;
}
function E1e(e, t) {
  return this.isSame(e, t) || this.isAfter(e, t);
}
function T1e(e, t) {
  return this.isSame(e, t) || this.isBefore(e, t);
}
function k1e(e, t, n) {
  var r, i, a;
  if (!this.isValid())
    return NaN;
  if (r = w7(e, this), !r.isValid())
    return NaN;
  switch (i = (r.utcOffset() - this.utcOffset()) * 6e4, t = hs(t), t) {
    case "year":
      a = Bg(this, r) / 12;
      break;
    case "month":
      a = Bg(this, r);
      break;
    case "quarter":
      a = Bg(this, r) / 3;
      break;
    case "second":
      a = (this - r) / 1e3;
      break;
    case "minute":
      a = (this - r) / 6e4;
      break;
    case "hour":
      a = (this - r) / 36e5;
      break;
    case "day":
      a = (this - r - i) / 864e5;
      break;
    case "week":
      a = (this - r - i) / 6048e5;
      break;
    default:
      a = this - r;
  }
  return n ? a : ts(a);
}
function Bg(e, t) {
  if (e.date() < t.date())
    return -Bg(t, e);
  var n = (t.year() - e.year()) * 12 + (t.month() - e.month()), r = e.clone().add(n, "months"), i, a;
  return t - r < 0 ? (i = e.clone().add(n - 1, "months"), a = (t - r) / (r - i)) : (i = e.clone().add(n + 1, "months"), a = (t - r) / (i - r)), -(n + a) || 0;
}
ht.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
ht.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function D1e() {
  return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function O1e(e) {
  if (!this.isValid())
    return null;
  var t = e !== !0, n = t ? this.clone().utc() : this;
  return n.year() < 0 || n.year() > 9999 ? Dg(
    n,
    t ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
  ) : Gu(Date.prototype.toISOString) ? t ? this.toDate().toISOString() : new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", Dg(n, "Z")) : Dg(
    n,
    t ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
  );
}
function B1e() {
  if (!this.isValid())
    return "moment.invalid(/* " + this._i + " */)";
  var e = "moment", t = "", n, r, i, a;
  return this.isLocal() || (e = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone", t = "Z"), n = "[" + e + '("]', r = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", i = "-MM-DD[T]HH:mm:ss.SSS", a = t + '[")]', this.format(n + r + i + a);
}
function R1e(e) {
  e || (e = this.isUtc() ? ht.defaultFormatUtc : ht.defaultFormat);
  var t = Dg(this, e);
  return this.localeData().postformat(t);
}
function L1e(e, t) {
  return this.isValid() && (Ks(e) && e.isValid() || Ir(e).isValid()) ? Qs({ to: this, from: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate();
}
function N1e(e) {
  return this.from(Ir(), e);
}
function F1e(e, t) {
  return this.isValid() && (Ks(e) && e.isValid() || Ir(e).isValid()) ? Qs({ from: this, to: e }).locale(this.locale()).humanize(!t) : this.localeData().invalidDate();
}
function V1e(e) {
  return this.to(Ir(), e);
}
function xN(e) {
  var t;
  return e === void 0 ? this._locale._abbr : (t = Zl(e), t != null && (this._locale = t), this);
}
var CN = ps(
  "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
  function(e) {
    return e === void 0 ? this.localeData() : this.locale(e);
  }
);
function SN() {
  return this._locale;
}
var Yv = 1e3, j1 = 60 * Yv, Wv = 60 * j1, AN = (365 * 400 + 97) * 24 * Wv;
function K1(e, t) {
  return (e % t + t) % t;
}
function wN(e, t, n) {
  return e < 100 && e >= 0 ? new Date(e + 400, t, n) - AN : new Date(e, t, n).valueOf();
}
function IN(e, t, n) {
  return e < 100 && e >= 0 ? Date.UTC(e + 400, t, n) - AN : Date.UTC(e, t, n);
}
function G1e(e) {
  var t, n;
  if (e = hs(e), e === void 0 || e === "millisecond" || !this.isValid())
    return this;
  switch (n = this._isUTC ? IN : wN, e) {
    case "year":
      t = n(this.year(), 0, 1);
      break;
    case "quarter":
      t = n(
        this.year(),
        this.month() - this.month() % 3,
        1
      );
      break;
    case "month":
      t = n(this.year(), this.month(), 1);
      break;
    case "week":
      t = n(
        this.year(),
        this.month(),
        this.date() - this.weekday()
      );
      break;
    case "isoWeek":
      t = n(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1)
      );
      break;
    case "day":
    case "date":
      t = n(this.year(), this.month(), this.date());
      break;
    case "hour":
      t = this._d.valueOf(), t -= K1(
        t + (this._isUTC ? 0 : this.utcOffset() * j1),
        Wv
      );
      break;
    case "minute":
      t = this._d.valueOf(), t -= K1(t, j1);
      break;
    case "second":
      t = this._d.valueOf(), t -= K1(t, Yv);
      break;
  }
  return this._d.setTime(t), ht.updateOffset(this, !0), this;
}
function z1e(e) {
  var t, n;
  if (e = hs(e), e === void 0 || e === "millisecond" || !this.isValid())
    return this;
  switch (n = this._isUTC ? IN : wN, e) {
    case "year":
      t = n(this.year() + 1, 0, 1) - 1;
      break;
    case "quarter":
      t = n(
        this.year(),
        this.month() - this.month() % 3 + 3,
        1
      ) - 1;
      break;
    case "month":
      t = n(this.year(), this.month() + 1, 1) - 1;
      break;
    case "week":
      t = n(
        this.year(),
        this.month(),
        this.date() - this.weekday() + 7
      ) - 1;
      break;
    case "isoWeek":
      t = n(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1) + 7
      ) - 1;
      break;
    case "day":
    case "date":
      t = n(this.year(), this.month(), this.date() + 1) - 1;
      break;
    case "hour":
      t = this._d.valueOf(), t += Wv - K1(
        t + (this._isUTC ? 0 : this.utcOffset() * j1),
        Wv
      ) - 1;
      break;
    case "minute":
      t = this._d.valueOf(), t += j1 - K1(t, j1) - 1;
      break;
    case "second":
      t = this._d.valueOf(), t += Yv - K1(t, Yv) - 1;
      break;
  }
  return this._d.setTime(t), ht.updateOffset(this, !0), this;
}
function U1e() {
  return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function H1e() {
  return Math.floor(this.valueOf() / 1e3);
}
function q1e() {
  return new Date(this.valueOf());
}
function j1e() {
  var e = this;
  return [
    e.year(),
    e.month(),
    e.date(),
    e.hour(),
    e.minute(),
    e.second(),
    e.millisecond()
  ];
}
function K1e() {
  var e = this;
  return {
    years: e.year(),
    months: e.month(),
    date: e.date(),
    hours: e.hours(),
    minutes: e.minutes(),
    seconds: e.seconds(),
    milliseconds: e.milliseconds()
  };
}
function Y1e() {
  return this.isValid() ? this.toISOString() : null;
}
function W1e() {
  return u7(this);
}
function X1e() {
  return Xc({}, An(this));
}
function Z1e() {
  return An(this).overflow;
}
function Q1e() {
  return {
    input: this._i,
    format: this._f,
    locale: this._locale,
    isUTC: this._isUTC,
    strict: this._strict
  };
}
Vt("N", 0, 0, "eraAbbr");
Vt("NN", 0, 0, "eraAbbr");
Vt("NNN", 0, 0, "eraAbbr");
Vt("NNNN", 0, 0, "eraName");
Vt("NNNNN", 0, 0, "eraNarrow");
Vt("y", ["y", 1], "yo", "eraYear");
Vt("y", ["yy", 2], 0, "eraYear");
Vt("y", ["yyy", 3], 0, "eraYear");
Vt("y", ["yyyy", 4], 0, "eraYear");
St("N", I7);
St("NN", I7);
St("NNN", I7);
St("NNNN", ume);
St("NNNNN", lme);
vr(
  ["N", "NN", "NNN", "NNNN", "NNNNN"],
  function(e, t, n, r) {
    var i = n._locale.erasParse(e, r, n._strict);
    i ? An(n).era = i : An(n).invalidEra = e;
  }
);
St("y", jm);
St("yy", jm);
St("yyy", jm);
St("yyyy", jm);
St("yo", cme);
vr(["y", "yy", "yyy", "yyyy"], ma);
vr(["yo"], function(e, t, n, r) {
  var i;
  n._locale._eraYearOrdinalRegex && (i = e.match(n._locale._eraYearOrdinalRegex)), n._locale.eraYearOrdinalParse ? t[ma] = n._locale.eraYearOrdinalParse(e, i) : t[ma] = parseInt(e, 10);
});
function J1e(e, t) {
  var n, r, i, a = this._eras || Zl("en")._eras;
  for (n = 0, r = a.length; n < r; ++n) {
    switch (typeof a[n].since) {
      case "string":
        i = ht(a[n].since).startOf("day"), a[n].since = i.valueOf();
        break;
    }
    switch (typeof a[n].until) {
      case "undefined":
        a[n].until = 1 / 0;
        break;
      case "string":
        i = ht(a[n].until).startOf("day").valueOf(), a[n].until = i.valueOf();
        break;
    }
  }
  return a;
}
function $1e(e, t, n) {
  var r, i, a = this.eras(), o, s, u;
  for (e = e.toUpperCase(), r = 0, i = a.length; r < i; ++r)
    if (o = a[r].name.toUpperCase(), s = a[r].abbr.toUpperCase(), u = a[r].narrow.toUpperCase(), n)
      switch (t) {
        case "N":
        case "NN":
        case "NNN":
          if (s === e)
            return a[r];
          break;
        case "NNNN":
          if (o === e)
            return a[r];
          break;
        case "NNNNN":
          if (u === e)
            return a[r];
          break;
      }
    else if ([o, s, u].indexOf(e) >= 0)
      return a[r];
}
function eme(e, t) {
  var n = e.since <= e.until ? 1 : -1;
  return t === void 0 ? ht(e.since).year() : ht(e.since).year() + (t - e.offset) * n;
}
function tme() {
  var e, t, n, r = this.localeData().eras();
  for (e = 0, t = r.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), r[e].since <= n && n <= r[e].until || r[e].until <= n && n <= r[e].since)
      return r[e].name;
  return "";
}
function nme() {
  var e, t, n, r = this.localeData().eras();
  for (e = 0, t = r.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), r[e].since <= n && n <= r[e].until || r[e].until <= n && n <= r[e].since)
      return r[e].narrow;
  return "";
}
function rme() {
  var e, t, n, r = this.localeData().eras();
  for (e = 0, t = r.length; e < t; ++e)
    if (n = this.clone().startOf("day").valueOf(), r[e].since <= n && n <= r[e].until || r[e].until <= n && n <= r[e].since)
      return r[e].abbr;
  return "";
}
function ime() {
  var e, t, n, r, i = this.localeData().eras();
  for (e = 0, t = i.length; e < t; ++e)
    if (n = i[e].since <= i[e].until ? 1 : -1, r = this.clone().startOf("day").valueOf(), i[e].since <= r && r <= i[e].until || i[e].until <= r && r <= i[e].since)
      return (this.year() - ht(i[e].since).year()) * n + i[e].offset;
  return this.year();
}
function ame(e) {
  return Jn(this, "_erasNameRegex") || P7.call(this), e ? this._erasNameRegex : this._erasRegex;
}
function ome(e) {
  return Jn(this, "_erasAbbrRegex") || P7.call(this), e ? this._erasAbbrRegex : this._erasRegex;
}
function sme(e) {
  return Jn(this, "_erasNarrowRegex") || P7.call(this), e ? this._erasNarrowRegex : this._erasRegex;
}
function I7(e, t) {
  return t.erasAbbrRegex(e);
}
function ume(e, t) {
  return t.erasNameRegex(e);
}
function lme(e, t) {
  return t.erasNarrowRegex(e);
}
function cme(e, t) {
  return t._eraYearOrdinalRegex || jm;
}
function P7() {
  var e = [], t = [], n = [], r = [], i, a, o, s, u, l = this.eras();
  for (i = 0, a = l.length; i < a; ++i)
    o = Tl(l[i].name), s = Tl(l[i].abbr), u = Tl(l[i].narrow), t.push(o), e.push(s), n.push(u), r.push(o), r.push(s), r.push(u);
  this._erasRegex = new RegExp("^(" + r.join("|") + ")", "i"), this._erasNameRegex = new RegExp("^(" + t.join("|") + ")", "i"), this._erasAbbrRegex = new RegExp("^(" + e.join("|") + ")", "i"), this._erasNarrowRegex = new RegExp(
    "^(" + n.join("|") + ")",
    "i"
  );
}
Vt(0, ["gg", 2], 0, function() {
  return this.weekYear() % 100;
});
Vt(0, ["GG", 2], 0, function() {
  return this.isoWeekYear() % 100;
});
function Q3(e, t) {
  Vt(0, [e, e.length], 0, t);
}
Q3("gggg", "weekYear");
Q3("ggggg", "weekYear");
Q3("GGGG", "isoWeekYear");
Q3("GGGGG", "isoWeekYear");
St("G", K3);
St("g", K3);
St("GG", Pr, ko);
St("gg", Pr, ko);
St("GGGG", p7, m7);
St("gggg", p7, m7);
St("GGGGG", j3, H3);
St("ggggg", j3, H3);
xh(
  ["gggg", "ggggg", "GGGG", "GGGGG"],
  function(e, t, n, r) {
    t[r.substr(0, 2)] = Bn(e);
  }
);
xh(["gg", "GG"], function(e, t, n, r) {
  t[r] = ht.parseTwoDigitYear(e);
});
function dme(e) {
  return PN.call(
    this,
    e,
    this.week(),
    this.weekday() + this.localeData()._week.dow,
    this.localeData()._week.dow,
    this.localeData()._week.doy
  );
}
function fme(e) {
  return PN.call(
    this,
    e,
    this.isoWeek(),
    this.isoWeekday(),
    1,
    4
  );
}
function mme() {
  return kl(this.year(), 1, 4);
}
function pme() {
  return kl(this.isoWeekYear(), 1, 4);
}
function hme() {
  var e = this.localeData()._week;
  return kl(this.year(), e.dow, e.doy);
}
function gme() {
  var e = this.localeData()._week;
  return kl(this.weekYear(), e.dow, e.doy);
}
function PN(e, t, n, r, i) {
  var a;
  return e == null ? Q0(this, r, i).year : (a = kl(e, r, i), t > a && (t = a), vme.call(this, e, t, n, r, i));
}
function vme(e, t, n, r, i) {
  var a = oN(e, t, n, r, i), o = Z0(a.year, 0, a.dayOfYear);
  return this.year(o.getUTCFullYear()), this.month(o.getUTCMonth()), this.date(o.getUTCDate()), this;
}
Vt("Q", 0, "Qo", "quarter");
St("Q", XL);
vr("Q", function(e, t) {
  t[_l] = (Bn(e) - 1) * 3;
});
function yme(e) {
  return e == null ? Math.ceil((this.month() + 1) / 3) : this.month((e - 1) * 3 + this.month() % 3);
}
Vt("D", ["DD", 2], "Do", "date");
St("D", Pr, Km);
St("DD", Pr, ko);
St("Do", function(e, t) {
  return e ? t._dayOfMonthOrdinalParse || t._ordinalParse : t._dayOfMonthOrdinalParseLenient;
});
vr(["D", "DD"], vu);
vr("Do", function(e, t) {
  t[vu] = Bn(e.match(Pr)[0]);
});
var MN = Ym("Date", !0);
Vt("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
St("DDD", q3);
St("DDDD", ZL);
vr(["DDD", "DDDD"], function(e, t, n) {
  n._dayOfYear = Bn(e);
});
function bme(e) {
  var t = Math.round(
    (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
  ) + 1;
  return e == null ? t : this.add(e - t, "d");
}
Vt("m", ["mm", 2], 0, "minute");
St("m", Pr, h7);
St("mm", Pr, ko);
vr(["m", "mm"], Gs);
var _me = Ym("Minutes", !1);
Vt("s", ["ss", 2], 0, "second");
St("s", Pr, h7);
St("ss", Pr, ko);
vr(["s", "ss"], xl);
var xme = Ym("Seconds", !1);
Vt("S", 0, 0, function() {
  return ~~(this.millisecond() / 100);
});
Vt(0, ["SS", 2], 0, function() {
  return ~~(this.millisecond() / 10);
});
Vt(0, ["SSS", 3], 0, "millisecond");
Vt(0, ["SSSS", 4], 0, function() {
  return this.millisecond() * 10;
});
Vt(0, ["SSSSS", 5], 0, function() {
  return this.millisecond() * 100;
});
Vt(0, ["SSSSSS", 6], 0, function() {
  return this.millisecond() * 1e3;
});
Vt(0, ["SSSSSSS", 7], 0, function() {
  return this.millisecond() * 1e4;
});
Vt(0, ["SSSSSSSS", 8], 0, function() {
  return this.millisecond() * 1e5;
});
Vt(0, ["SSSSSSSSS", 9], 0, function() {
  return this.millisecond() * 1e6;
});
St("S", q3, XL);
St("SS", q3, ko);
St("SSS", q3, ZL);
var Zc, EN;
for (Zc = "SSSS"; Zc.length <= 9; Zc += "S")
  St(Zc, jm);
function Cme(e, t) {
  t[nf] = Bn(("0." + e) * 1e3);
}
for (Zc = "S"; Zc.length <= 9; Zc += "S")
  vr(Zc, Cme);
EN = Ym("Milliseconds", !1);
Vt("z", 0, 0, "zoneAbbr");
Vt("zz", 0, 0, "zoneName");
function Sme() {
  return this._isUTC ? "UTC" : "";
}
function Ame() {
  return this._isUTC ? "Coordinated Universal Time" : "";
}
var it = bh.prototype;
it.add = g1e;
it.calendar = S1e;
it.clone = A1e;
it.diff = k1e;
it.endOf = z1e;
it.format = R1e;
it.from = L1e;
it.fromNow = N1e;
it.to = F1e;
it.toNow = V1e;
it.get = Bde;
it.invalidAt = Z1e;
it.isAfter = w1e;
it.isBefore = I1e;
it.isBetween = P1e;
it.isSame = M1e;
it.isSameOrAfter = E1e;
it.isSameOrBefore = T1e;
it.isValid = W1e;
it.lang = CN;
it.locale = xN;
it.localeData = SN;
it.max = Wfe;
it.min = Yfe;
it.parsingFlags = X1e;
it.set = Rde;
it.startOf = G1e;
it.subtract = v1e;
it.toArray = j1e;
it.toObject = K1e;
it.toDate = q1e;
it.toISOString = O1e;
it.inspect = B1e;
typeof Symbol < "u" && Symbol.for != null && (it[Symbol.for("nodejs.util.inspect.custom")] = function() {
  return "Moment<" + this.format() + ">";
});
it.toJSON = Y1e;
it.toString = D1e;
it.unix = H1e;
it.valueOf = U1e;
it.creationData = Q1e;
it.eraName = tme;
it.eraNarrow = nme;
it.eraAbbr = rme;
it.eraYear = ime;
it.year = $L;
it.isLeapYear = Ode;
it.weekYear = dme;
it.isoWeekYear = fme;
it.quarter = it.quarters = yme;
it.month = iN;
it.daysInMonth = qde;
it.week = it.weeks = Jde;
it.isoWeek = it.isoWeeks = $de;
it.weeksInYear = hme;
it.weeksInWeekYear = gme;
it.isoWeeksInYear = mme;
it.isoWeeksInISOWeekYear = pme;
it.date = MN;
it.day = it.days = ffe;
it.weekday = mfe;
it.isoWeekday = pfe;
it.dayOfYear = bme;
it.hour = it.hours = xfe;
it.minute = it.minutes = _me;
it.second = it.seconds = xme;
it.millisecond = it.milliseconds = EN;
it.utcOffset = r1e;
it.utc = a1e;
it.local = o1e;
it.parseZone = s1e;
it.hasAlignedHourOffset = u1e;
it.isDST = l1e;
it.isLocal = d1e;
it.isUtcOffset = f1e;
it.isUtc = vN;
it.isUTC = vN;
it.zoneAbbr = Sme;
it.zoneName = Ame;
it.dates = ps(
  "dates accessor is deprecated. Use date instead.",
  MN
);
it.months = ps(
  "months accessor is deprecated. Use month instead",
  iN
);
it.years = ps(
  "years accessor is deprecated. Use year instead",
  $L
);
it.zone = ps(
  "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
  i1e
);
it.isDSTShifted = ps(
  "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
  c1e
);
function wme(e) {
  return Ir(e * 1e3);
}
function Ime() {
  return Ir.apply(null, arguments).parseZone();
}
function TN(e) {
  return e;
}
var $n = c7.prototype;
$n.calendar = dde;
$n.longDateFormat = hde;
$n.invalidDate = vde;
$n.ordinal = _de;
$n.preparse = TN;
$n.postformat = TN;
$n.relativeTime = Cde;
$n.pastFuture = Sde;
$n.set = lde;
$n.eras = J1e;
$n.erasParse = $1e;
$n.erasConvertYear = eme;
$n.erasAbbrRegex = ome;
$n.erasNameRegex = ame;
$n.erasNarrowRegex = sme;
$n.months = Gde;
$n.monthsShort = zde;
$n.monthsParse = Hde;
$n.monthsRegex = Kde;
$n.monthsShortRegex = jde;
$n.week = Wde;
$n.firstDayOfYear = Qde;
$n.firstDayOfWeek = Zde;
$n.weekdays = sfe;
$n.weekdaysMin = lfe;
$n.weekdaysShort = ufe;
$n.weekdaysParse = dfe;
$n.weekdaysRegex = hfe;
$n.weekdaysShortRegex = gfe;
$n.weekdaysMinRegex = vfe;
$n.isPM = bfe;
$n.meridiem = Cfe;
function Xv(e, t, n, r) {
  var i = Zl(), a = Vu().set(r, t);
  return i[n](a, e);
}
function kN(e, t, n) {
  if (zl(e) && (t = e, e = void 0), e = e || "", t != null)
    return Xv(e, t, n, "month");
  var r, i = [];
  for (r = 0; r < 12; r++)
    i[r] = Xv(e, r, n, "month");
  return i;
}
function M7(e, t, n, r) {
  typeof e == "boolean" ? (zl(t) && (n = t, t = void 0), t = t || "") : (t = e, n = t, e = !1, zl(t) && (n = t, t = void 0), t = t || "");
  var i = Zl(), a = e ? i._week.dow : 0, o, s = [];
  if (n != null)
    return Xv(t, (n + a) % 7, r, "day");
  for (o = 0; o < 7; o++)
    s[o] = Xv(t, (o + a) % 7, r, "day");
  return s;
}
function Pme(e, t) {
  return kN(e, t, "months");
}
function Mme(e, t) {
  return kN(e, t, "monthsShort");
}
function Eme(e, t, n) {
  return M7(e, t, n, "weekdays");
}
function Tme(e, t, n) {
  return M7(e, t, n, "weekdaysShort");
}
function kme(e, t, n) {
  return M7(e, t, n, "weekdaysMin");
}
nd("en", {
  eras: [
    {
      since: "0001-01-01",
      until: 1 / 0,
      offset: 1,
      name: "Anno Domini",
      narrow: "AD",
      abbr: "AD"
    },
    {
      since: "0000-12-31",
      until: -1 / 0,
      offset: 1,
      name: "Before Christ",
      narrow: "BC",
      abbr: "BC"
    }
  ],
  dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  ordinal: function(e) {
    var t = e % 10, n = Bn(e % 100 / 10) === 1 ? "th" : t === 1 ? "st" : t === 2 ? "nd" : t === 3 ? "rd" : "th";
    return e + n;
  }
});
ht.lang = ps(
  "moment.lang is deprecated. Use moment.locale instead.",
  nd
);
ht.langData = ps(
  "moment.langData is deprecated. Use moment.localeData instead.",
  Zl
);
var rl = Math.abs;
function Dme() {
  var e = this._data;
  return this._milliseconds = rl(this._milliseconds), this._days = rl(this._days), this._months = rl(this._months), e.milliseconds = rl(e.milliseconds), e.seconds = rl(e.seconds), e.minutes = rl(e.minutes), e.hours = rl(e.hours), e.months = rl(e.months), e.years = rl(e.years), this;
}
function DN(e, t, n, r) {
  var i = Qs(t, n);
  return e._milliseconds += r * i._milliseconds, e._days += r * i._days, e._months += r * i._months, e._bubble();
}
function Ome(e, t) {
  return DN(this, e, t, 1);
}
function Bme(e, t) {
  return DN(this, e, t, -1);
}
function QM(e) {
  return e < 0 ? Math.floor(e) : Math.ceil(e);
}
function Rme() {
  var e = this._milliseconds, t = this._days, n = this._months, r = this._data, i, a, o, s, u;
  return e >= 0 && t >= 0 && n >= 0 || e <= 0 && t <= 0 && n <= 0 || (e += QM(g6(n) + t) * 864e5, t = 0, n = 0), r.milliseconds = e % 1e3, i = ts(e / 1e3), r.seconds = i % 60, a = ts(i / 60), r.minutes = a % 60, o = ts(a / 60), r.hours = o % 24, t += ts(o / 24), u = ts(ON(t)), n += u, t -= QM(g6(u)), s = ts(n / 12), n %= 12, r.days = t, r.months = n, r.years = s, this;
}
function ON(e) {
  return e * 4800 / 146097;
}
function g6(e) {
  return e * 146097 / 4800;
}
function Lme(e) {
  if (!this.isValid())
    return NaN;
  var t, n, r = this._milliseconds;
  if (e = hs(e), e === "month" || e === "quarter" || e === "year")
    switch (t = this._days + r / 864e5, n = this._months + ON(t), e) {
      case "month":
        return n;
      case "quarter":
        return n / 3;
      case "year":
        return n / 12;
    }
  else
    switch (t = this._days + Math.round(g6(this._months)), e) {
      case "week":
        return t / 7 + r / 6048e5;
      case "day":
        return t + r / 864e5;
      case "hour":
        return t * 24 + r / 36e5;
      case "minute":
        return t * 1440 + r / 6e4;
      case "second":
        return t * 86400 + r / 1e3;
      case "millisecond":
        return Math.floor(t * 864e5) + r;
      default:
        throw new Error("Unknown unit " + e);
    }
}
function Ql(e) {
  return function() {
    return this.as(e);
  };
}
var BN = Ql("ms"), Nme = Ql("s"), Fme = Ql("m"), Vme = Ql("h"), Gme = Ql("d"), zme = Ql("w"), Ume = Ql("M"), Hme = Ql("Q"), qme = Ql("y"), jme = BN;
function Kme() {
  return Qs(this);
}
function Yme(e) {
  return e = hs(e), this.isValid() ? this[e + "s"]() : NaN;
}
function Gf(e) {
  return function() {
    return this.isValid() ? this._data[e] : NaN;
  };
}
var Wme = Gf("milliseconds"), Xme = Gf("seconds"), Zme = Gf("minutes"), Qme = Gf("hours"), Jme = Gf("days"), $me = Gf("months"), epe = Gf("years");
function tpe() {
  return ts(this.days() / 7);
}
var dl = Math.round, O1 = {
  ss: 44,
  // a few seconds to seconds
  s: 45,
  // seconds to minute
  m: 45,
  // minutes to hour
  h: 22,
  // hours to day
  d: 26,
  // days to month/week
  w: null,
  // weeks to month
  M: 11
  // months to year
};
function npe(e, t, n, r, i) {
  return i.relativeTime(t || 1, !!n, e, r);
}
function rpe(e, t, n, r) {
  var i = Qs(e).abs(), a = dl(i.as("s")), o = dl(i.as("m")), s = dl(i.as("h")), u = dl(i.as("d")), l = dl(i.as("M")), c = dl(i.as("w")), d = dl(i.as("y")), f = a <= n.ss && ["s", a] || a < n.s && ["ss", a] || o <= 1 && ["m"] || o < n.m && ["mm", o] || s <= 1 && ["h"] || s < n.h && ["hh", s] || u <= 1 && ["d"] || u < n.d && ["dd", u];
  return n.w != null && (f = f || c <= 1 && ["w"] || c < n.w && ["ww", c]), f = f || l <= 1 && ["M"] || l < n.M && ["MM", l] || d <= 1 && ["y"] || ["yy", d], f[2] = t, f[3] = +e > 0, f[4] = r, npe.apply(null, f);
}
function ipe(e) {
  return e === void 0 ? dl : typeof e == "function" ? (dl = e, !0) : !1;
}
function ape(e, t) {
  return O1[e] === void 0 ? !1 : t === void 0 ? O1[e] : (O1[e] = t, e === "s" && (O1.ss = t - 1), !0);
}
function ope(e, t) {
  if (!this.isValid())
    return this.localeData().invalidDate();
  var n = !1, r = O1, i, a;
  return typeof e == "object" && (t = e, e = !1), typeof e == "boolean" && (n = e), typeof t == "object" && (r = Object.assign({}, O1, t), t.s != null && t.ss == null && (r.ss = t.s - 1)), i = this.localeData(), a = rpe(this, !n, r, i), n && (a = i.pastFuture(+this, a)), i.postformat(a);
}
var Lb = Math.abs;
function C1(e) {
  return (e > 0) - (e < 0) || +e;
}
function J3() {
  if (!this.isValid())
    return this.localeData().invalidDate();
  var e = Lb(this._milliseconds) / 1e3, t = Lb(this._days), n = Lb(this._months), r, i, a, o, s = this.asSeconds(), u, l, c, d;
  return s ? (r = ts(e / 60), i = ts(r / 60), e %= 60, r %= 60, a = ts(n / 12), n %= 12, o = e ? e.toFixed(3).replace(/\.?0+$/, "") : "", u = s < 0 ? "-" : "", l = C1(this._months) !== C1(s) ? "-" : "", c = C1(this._days) !== C1(s) ? "-" : "", d = C1(this._milliseconds) !== C1(s) ? "-" : "", u + "P" + (a ? l + a + "Y" : "") + (n ? l + n + "M" : "") + (t ? c + t + "D" : "") + (i || r || e ? "T" : "") + (i ? d + i + "H" : "") + (r ? d + r + "M" : "") + (e ? d + o + "S" : "")) : "P0D";
}
var Un = Z3.prototype;
Un.isValid = $fe;
Un.abs = Dme;
Un.add = Ome;
Un.subtract = Bme;
Un.as = Lme;
Un.asMilliseconds = BN;
Un.asSeconds = Nme;
Un.asMinutes = Fme;
Un.asHours = Vme;
Un.asDays = Gme;
Un.asWeeks = zme;
Un.asMonths = Ume;
Un.asQuarters = Hme;
Un.asYears = qme;
Un.valueOf = jme;
Un._bubble = Rme;
Un.clone = Kme;
Un.get = Yme;
Un.milliseconds = Wme;
Un.seconds = Xme;
Un.minutes = Zme;
Un.hours = Qme;
Un.days = Jme;
Un.weeks = tpe;
Un.months = $me;
Un.years = epe;
Un.humanize = ope;
Un.toISOString = J3;
Un.toString = J3;
Un.toJSON = J3;
Un.locale = xN;
Un.localeData = SN;
Un.toIsoString = ps(
  "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
  J3
);
Un.lang = CN;
Vt("X", 0, 0, "unix");
Vt("x", 0, 0, "valueOf");
St("x", K3);
St("X", Pde);
vr("X", function(e, t, n) {
  n._d = new Date(parseFloat(e) * 1e3);
});
vr("x", function(e, t, n) {
  n._d = new Date(Bn(e));
});
//! moment.js
ht.version = "2.30.1";
sde(Ir);
ht.fn = it;
ht.min = Xfe;
ht.max = Zfe;
ht.now = Qfe;
ht.utc = Vu;
ht.unix = wme;
ht.months = Pme;
ht.isDate = yh;
ht.locale = nd;
ht.invalid = U3;
ht.duration = Qs;
ht.isMoment = Ks;
ht.weekdays = Eme;
ht.parseZone = Ime;
ht.localeData = Zl;
ht.isDuration = Og;
ht.monthsShort = Mme;
ht.weekdaysMin = kme;
ht.defineLocale = _7;
ht.updateLocale = Ife;
ht.locales = Pfe;
ht.weekdaysShort = Tme;
ht.normalizeUnits = hs;
ht.relativeTimeRounding = ipe;
ht.relativeTimeThreshold = ape;
ht.calendarFormat = C1e;
ht.prototype = it;
ht.HTML5_FMT = {
  DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
  // <input type="datetime-local" />
  DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
  // <input type="datetime-local" step="1" />
  DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
  // <input type="datetime-local" step="0.001" />
  DATE: "YYYY-MM-DD",
  // <input type="date" />
  TIME: "HH:mm",
  // <input type="time" />
  TIME_SECONDS: "HH:mm:ss",
  // <input type="time" step="1" />
  TIME_MS: "HH:mm:ss.SSS",
  // <input type="time" step="0.001" />
  WEEK: "GGGG-[W]WW",
  // <input type="week" />
  MONTH: "YYYY-MM"
  // <input type="month" />
};
const {
  SvelteComponent: spe,
  assign: v6,
  compute_rest_props: JM,
  create_slot: upe,
  detach: lpe,
  element: cpe,
  exclude_internal_props: dpe,
  get_all_dirty_from_scope: fpe,
  get_slot_changes: mpe,
  get_spread_update: ppe,
  init: hpe,
  insert: gpe,
  safe_not_equal: vpe,
  set_attributes: $M,
  transition_in: ype,
  transition_out: bpe,
  update_slot_base: _pe
} = window.__gradio__svelte__internal, {
  createEventDispatcher: xpe,
  getContext: eE,
  onMount: Cpe,
  setContext: Spe,
  tick: Ape
} = window.__gradio__svelte__internal;
function wpe(e) {
  let t, n;
  const r = (
    /*#slots*/
    e[13].default
  ), i = upe(
    r,
    e,
    /*$$scope*/
    e[12],
    null
  );
  let a = [
    { class: (
      /*cnames*/
      e[1]
    ) },
    /*$$restProps*/
    e[2],
    /*attrs*/
    e[0]
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = v6(o, a[s]);
  return {
    c() {
      t = cpe("div"), i && i.c(), $M(t, o);
    },
    m(s, u) {
      gpe(s, t, u), i && i.m(t, null), n = !0;
    },
    p(s, [u]) {
      i && i.p && (!n || u & /*$$scope*/
      4096) && _pe(
        i,
        r,
        s,
        /*$$scope*/
        s[12],
        n ? mpe(
          r,
          /*$$scope*/
          s[12],
          u,
          null
        ) : fpe(
          /*$$scope*/
          s[12]
        ),
        null
      ), $M(t, o = ppe(a, [
        (!n || u & /*cnames*/
        2) && { class: (
          /*cnames*/
          s[1]
        ) },
        u & /*$$restProps*/
        4 && /*$$restProps*/
        s[2],
        u & /*attrs*/
        1 && /*attrs*/
        s[0]
      ]));
    },
    i(s) {
      n || (ype(i, s), n = !0);
    },
    o(s) {
      bpe(i, s), n = !1;
    },
    d(s) {
      s && lpe(t), i && i.d(s);
    }
  };
}
function Ipe(e, t, n) {
  let r, i, a;
  const o = ["value", "size", "disabled", "cls", "attrs"];
  let s = JM(t, o), { $$slots: u = {}, $$scope: l } = t;
  var c = this && this.__awaiter || function(k, D, B, L) {
    function F(V) {
      return V instanceof B ? V : new B(function(G) {
        G(V);
      });
    }
    return new (B || (B = Promise))(function(V, G) {
      function H(K) {
        try {
          z(L.next(K));
        } catch (Y) {
          G(Y);
        }
      }
      function q(K) {
        try {
          z(L.throw(K));
        } catch (Y) {
          G(Y);
        }
      }
      function z(K) {
        K.done ? V(K.value) : F(K.value).then(H, q);
      }
      z((L = L.apply(k, D || [])).next());
    });
  };
  let { value: d = [] } = t, { size: f = "md" } = t, { disabled: p = !1 } = t, { cls: g = void 0 } = t, { attrs: m = {} } = t, v = !1, h = "";
  const y = eE(dL), x = eE(cL);
  let S = "";
  function b(k = !1) {
    S = y.split("&").pop(), n(3, d = x.getValueByPath(S, k ? x.__default_value : x.__value));
  }
  function _(k) {
    n(7, v = k.disabled), n(8, h = k.size);
  }
  Cpe(() => {
    y && x && (b(!0), _(x.__dynamicProps), x.__itemCompMap[S] = {
      update: b,
      type: "checkbox"
    }, x.__propHandleEvtMap.push(_));
  });
  const C = xpe(), w = /* @__PURE__ */ new Map();
  let I = d;
  const M = (k, D) => {
    w.set(k.toString(), D), E(k.toString());
  }, E = (k) => {
    const D = w.get(k);
    if (D) {
      const B = D.doUpdatedValue;
      let L = (d || []).some((F) => F.toString() === k);
      B(L);
    }
  };
  Spe(uL, {
    // Passed to the checkbox component to register the checkbox in the context
    registerCheckbox: M,
    // Passed to the checkbox component to set the size during initialization
    size: i || f,
    // Passed to the checkbox component to set the disable during initialization
    disabled: r || p,
    // Passed to the checkbox component to update the valueInner of checkboxGroup
    updatedValueWhenCheckboxChange: (k, D) => c(void 0, void 0, void 0, function* () {
      let B = Jce(d || []);
      k ? (B.push(D), B = [.../* @__PURE__ */ new Set([...B])]) : B = B.filter((L) => L !== D), n(9, I = d), C("updateValue", B), x && (x == null || x.updateField(S, B, !x.__manual_validate), yield Ape(), n(3, d = B));
    })
  });
  const P = Xl("checkbox-group");
  return e.$$set = (k) => {
    t = v6(v6({}, t), dpe(k)), n(2, s = JM(t, o)), "value" in k && n(3, d = k.value), "size" in k && n(4, f = k.size), "disabled" in k && n(5, p = k.disabled), "cls" in k && n(6, g = k.cls), "attrs" in k && n(0, m = k.attrs), "$$scope" in k && n(12, l = k.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty & /*disabledFrom, disabled*/
    160 && n(10, r = v || p), e.$$.dirty & /*sizeFrom, size*/
    272 && n(11, i = h || f), e.$$.dirty & /*valueInner, value, disabledInnerForm*/
    1544 && I !== d && (r || ((I || []).forEach((k) => {
      E(k.toString());
    }), (d || []).forEach((k) => {
      E(k.toString());
    }), n(9, I = d))), e.$$.dirty & /*disabledInnerForm*/
    1024 && Array.from(w.values()).forEach((k) => {
      k.setDisabled(r);
    }), e.$$.dirty & /*sizeInnerForm*/
    2048 && Array.from(w.values()).forEach((k) => {
      k.setSizes(i);
    }), e.$$.dirty & /*cls*/
    64 && n(1, a = Ta(P, { [`${P}--base`]: !0 }, g));
  }, [
    m,
    a,
    s,
    d,
    f,
    p,
    g,
    v,
    h,
    I,
    r,
    i,
    l,
    u
  ];
}
class tE extends spe {
  constructor(t) {
    super(), hpe(this, t, Ipe, wpe, vpe, {
      value: 3,
      size: 4,
      disabled: 5,
      cls: 6,
      attrs: 0
    });
  }
}
const E7 = "-";
function Ppe(e) {
  const t = Epe(e), {
    conflictingClassGroups: n,
    conflictingClassGroupModifiers: r
  } = e;
  function i(o) {
    const s = o.split(E7);
    return s[0] === "" && s.length !== 1 && s.shift(), RN(s, t) || Mpe(o);
  }
  function a(o, s) {
    const u = n[o] || [];
    return s && r[o] ? [...u, ...r[o]] : u;
  }
  return {
    getClassGroupId: i,
    getConflictingClassGroupIds: a
  };
}
function RN(e, t) {
  var o;
  if (e.length === 0)
    return t.classGroupId;
  const n = e[0], r = t.nextPart.get(n), i = r ? RN(e.slice(1), r) : void 0;
  if (i)
    return i;
  if (t.validators.length === 0)
    return;
  const a = e.join(E7);
  return (o = t.validators.find(({
    validator: s
  }) => s(a))) == null ? void 0 : o.classGroupId;
}
const nE = /^\[(.+)\]$/;
function Mpe(e) {
  if (nE.test(e)) {
    const t = nE.exec(e)[1], n = t == null ? void 0 : t.substring(0, t.indexOf(":"));
    if (n)
      return "arbitrary.." + n;
  }
}
function Epe(e) {
  const {
    theme: t,
    prefix: n
  } = e, r = {
    nextPart: /* @__PURE__ */ new Map(),
    validators: []
  };
  return kpe(Object.entries(e.classGroups), n).forEach(([a, o]) => {
    y6(o, r, a, t);
  }), r;
}
function y6(e, t, n, r) {
  e.forEach((i) => {
    if (typeof i == "string") {
      const a = i === "" ? t : rE(t, i);
      a.classGroupId = n;
      return;
    }
    if (typeof i == "function") {
      if (Tpe(i)) {
        y6(i(r), t, n, r);
        return;
      }
      t.validators.push({
        validator: i,
        classGroupId: n
      });
      return;
    }
    Object.entries(i).forEach(([a, o]) => {
      y6(o, rE(t, a), n, r);
    });
  });
}
function rE(e, t) {
  let n = e;
  return t.split(E7).forEach((r) => {
    n.nextPart.has(r) || n.nextPart.set(r, {
      nextPart: /* @__PURE__ */ new Map(),
      validators: []
    }), n = n.nextPart.get(r);
  }), n;
}
function Tpe(e) {
  return e.isThemeGetter;
}
function kpe(e, t) {
  return t ? e.map(([n, r]) => {
    const i = r.map((a) => typeof a == "string" ? t + a : typeof a == "object" ? Object.fromEntries(Object.entries(a).map(([o, s]) => [t + o, s])) : a);
    return [n, i];
  }) : e;
}
function Dpe(e) {
  if (e < 1)
    return {
      get: () => {
      },
      set: () => {
      }
    };
  let t = 0, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
  function i(a, o) {
    n.set(a, o), t++, t > e && (t = 0, r = n, n = /* @__PURE__ */ new Map());
  }
  return {
    get(a) {
      let o = n.get(a);
      if (o !== void 0)
        return o;
      if ((o = r.get(a)) !== void 0)
        return i(a, o), o;
    },
    set(a, o) {
      n.has(a) ? n.set(a, o) : i(a, o);
    }
  };
}
const LN = "!";
function Ope(e) {
  const {
    separator: t,
    experimentalParseClassName: n
  } = e, r = t.length === 1, i = t[0], a = t.length;
  function o(s) {
    const u = [];
    let l = 0, c = 0, d;
    for (let v = 0; v < s.length; v++) {
      let h = s[v];
      if (l === 0) {
        if (h === i && (r || s.slice(v, v + a) === t)) {
          u.push(s.slice(c, v)), c = v + a;
          continue;
        }
        if (h === "/") {
          d = v;
          continue;
        }
      }
      h === "[" ? l++ : h === "]" && l--;
    }
    const f = u.length === 0 ? s : s.substring(c), p = f.startsWith(LN), g = p ? f.substring(1) : f, m = d && d > c ? d - c : void 0;
    return {
      modifiers: u,
      hasImportantModifier: p,
      baseClassName: g,
      maybePostfixModifierPosition: m
    };
  }
  return n ? function(u) {
    return n({
      className: u,
      parseClassName: o
    });
  } : o;
}
function Bpe(e) {
  if (e.length <= 1)
    return e;
  const t = [];
  let n = [];
  return e.forEach((r) => {
    r[0] === "[" ? (t.push(...n.sort(), r), n = []) : n.push(r);
  }), t.push(...n.sort()), t;
}
function Rpe(e) {
  return {
    cache: Dpe(e.cacheSize),
    parseClassName: Ope(e),
    ...Ppe(e)
  };
}
const Lpe = /\s+/;
function Npe(e, t) {
  const {
    parseClassName: n,
    getClassGroupId: r,
    getConflictingClassGroupIds: i
  } = t, a = /* @__PURE__ */ new Set();
  return e.trim().split(Lpe).map((o) => {
    const {
      modifiers: s,
      hasImportantModifier: u,
      baseClassName: l,
      maybePostfixModifierPosition: c
    } = n(o);
    let d = !!c, f = r(d ? l.substring(0, c) : l);
    if (!f) {
      if (!d)
        return {
          isTailwindClass: !1,
          originalClassName: o
        };
      if (f = r(l), !f)
        return {
          isTailwindClass: !1,
          originalClassName: o
        };
      d = !1;
    }
    const p = Bpe(s).join(":");
    return {
      isTailwindClass: !0,
      modifierId: u ? p + LN : p,
      classGroupId: f,
      originalClassName: o,
      hasPostfixModifier: d
    };
  }).reverse().filter((o) => {
    if (!o.isTailwindClass)
      return !0;
    const {
      modifierId: s,
      classGroupId: u,
      hasPostfixModifier: l
    } = o, c = s + u;
    return a.has(c) ? !1 : (a.add(c), i(u, l).forEach((d) => a.add(s + d)), !0);
  }).reverse().map((o) => o.originalClassName).join(" ");
}
function NN() {
  let e = 0, t, n, r = "";
  for (; e < arguments.length; )
    (t = arguments[e++]) && (n = FN(t)) && (r && (r += " "), r += n);
  return r;
}
function FN(e) {
  if (typeof e == "string")
    return e;
  let t, n = "";
  for (let r = 0; r < e.length; r++)
    e[r] && (t = FN(e[r])) && (n && (n += " "), n += t);
  return n;
}
function Fpe(e, ...t) {
  let n, r, i, a = o;
  function o(u) {
    const l = t.reduce((c, d) => d(c), e());
    return n = Rpe(l), r = n.cache.get, i = n.cache.set, a = s, s(u);
  }
  function s(u) {
    const l = r(u);
    if (l)
      return l;
    const c = Npe(u, n);
    return i(u, c), c;
  }
  return function() {
    return a(NN.apply(null, arguments));
  };
}
function Sr(e) {
  const t = (n) => n[e] || [];
  return t.isThemeGetter = !0, t;
}
const VN = /^\[(?:([a-z-]+):)?(.+)\]$/i, Vpe = /^\d+\/\d+$/, Gpe = /* @__PURE__ */ new Set(["px", "full", "screen"]), zpe = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Upe = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Hpe = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, qpe = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, jpe = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
function il(e) {
  return rf(e) || Gpe.has(e) || Vpe.test(e);
}
function Ac(e) {
  return Wm(e, "length", $pe);
}
function rf(e) {
  return !!e && !Number.isNaN(Number(e));
}
function ug(e) {
  return Wm(e, "number", rf);
}
function Mp(e) {
  return !!e && Number.isInteger(Number(e));
}
function Kpe(e) {
  return e.endsWith("%") && rf(e.slice(0, -1));
}
function Cn(e) {
  return VN.test(e);
}
function wc(e) {
  return zpe.test(e);
}
const Ype = /* @__PURE__ */ new Set(["length", "size", "percentage"]);
function Wpe(e) {
  return Wm(e, Ype, GN);
}
function Xpe(e) {
  return Wm(e, "position", GN);
}
const Zpe = /* @__PURE__ */ new Set(["image", "url"]);
function Qpe(e) {
  return Wm(e, Zpe, t0e);
}
function Jpe(e) {
  return Wm(e, "", e0e);
}
function Ep() {
  return !0;
}
function Wm(e, t, n) {
  const r = VN.exec(e);
  return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
}
function $pe(e) {
  return Upe.test(e) && !Hpe.test(e);
}
function GN() {
  return !1;
}
function e0e(e) {
  return qpe.test(e);
}
function t0e(e) {
  return jpe.test(e);
}
function n0e() {
  const e = Sr("colors"), t = Sr("spacing"), n = Sr("blur"), r = Sr("brightness"), i = Sr("borderColor"), a = Sr("borderRadius"), o = Sr("borderSpacing"), s = Sr("borderWidth"), u = Sr("contrast"), l = Sr("grayscale"), c = Sr("hueRotate"), d = Sr("invert"), f = Sr("gap"), p = Sr("gradientColorStops"), g = Sr("gradientColorStopPositions"), m = Sr("inset"), v = Sr("margin"), h = Sr("opacity"), y = Sr("padding"), x = Sr("saturate"), S = Sr("scale"), b = Sr("sepia"), _ = Sr("skew"), C = Sr("space"), w = Sr("translate"), I = () => ["auto", "contain", "none"], M = () => ["auto", "hidden", "clip", "visible", "scroll"], E = () => ["auto", Cn, t], T = () => [Cn, t], P = () => ["", il, Ac], k = () => ["auto", rf, Cn], D = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], B = () => ["solid", "dashed", "dotted", "double", "none"], L = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], F = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], V = () => ["", "0", Cn], G = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], H = () => [rf, ug], q = () => [rf, Cn];
  return {
    cacheSize: 500,
    separator: ":",
    theme: {
      colors: [Ep],
      spacing: [il, Ac],
      blur: ["none", "", wc, Cn],
      brightness: H(),
      borderColor: [e],
      borderRadius: ["none", "", "full", wc, Cn],
      borderSpacing: T(),
      borderWidth: P(),
      contrast: H(),
      grayscale: V(),
      hueRotate: q(),
      invert: V(),
      gap: T(),
      gradientColorStops: [e],
      gradientColorStopPositions: [Kpe, Ac],
      inset: E(),
      margin: E(),
      opacity: H(),
      padding: T(),
      saturate: H(),
      scale: H(),
      sepia: V(),
      skew: q(),
      space: T(),
      translate: T()
    },
    classGroups: {
      // Layout
      /**
       * Aspect Ratio
       * @see https://tailwindcss.com/docs/aspect-ratio
       */
      aspect: [{
        aspect: ["auto", "square", "video", Cn]
      }],
      /**
       * Container
       * @see https://tailwindcss.com/docs/container
       */
      container: ["container"],
      /**
       * Columns
       * @see https://tailwindcss.com/docs/columns
       */
      columns: [{
        columns: [wc]
      }],
      /**
       * Break After
       * @see https://tailwindcss.com/docs/break-after
       */
      "break-after": [{
        "break-after": G()
      }],
      /**
       * Break Before
       * @see https://tailwindcss.com/docs/break-before
       */
      "break-before": [{
        "break-before": G()
      }],
      /**
       * Break Inside
       * @see https://tailwindcss.com/docs/break-inside
       */
      "break-inside": [{
        "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
      }],
      /**
       * Box Decoration Break
       * @see https://tailwindcss.com/docs/box-decoration-break
       */
      "box-decoration": [{
        "box-decoration": ["slice", "clone"]
      }],
      /**
       * Box Sizing
       * @see https://tailwindcss.com/docs/box-sizing
       */
      box: [{
        box: ["border", "content"]
      }],
      /**
       * Display
       * @see https://tailwindcss.com/docs/display
       */
      display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
      /**
       * Floats
       * @see https://tailwindcss.com/docs/float
       */
      float: [{
        float: ["right", "left", "none", "start", "end"]
      }],
      /**
       * Clear
       * @see https://tailwindcss.com/docs/clear
       */
      clear: [{
        clear: ["left", "right", "both", "none", "start", "end"]
      }],
      /**
       * Isolation
       * @see https://tailwindcss.com/docs/isolation
       */
      isolation: ["isolate", "isolation-auto"],
      /**
       * Object Fit
       * @see https://tailwindcss.com/docs/object-fit
       */
      "object-fit": [{
        object: ["contain", "cover", "fill", "none", "scale-down"]
      }],
      /**
       * Object Position
       * @see https://tailwindcss.com/docs/object-position
       */
      "object-position": [{
        object: [...D(), Cn]
      }],
      /**
       * Overflow
       * @see https://tailwindcss.com/docs/overflow
       */
      overflow: [{
        overflow: M()
      }],
      /**
       * Overflow X
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-x": [{
        "overflow-x": M()
      }],
      /**
       * Overflow Y
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-y": [{
        "overflow-y": M()
      }],
      /**
       * Overscroll Behavior
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      overscroll: [{
        overscroll: I()
      }],
      /**
       * Overscroll Behavior X
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-x": [{
        "overscroll-x": I()
      }],
      /**
       * Overscroll Behavior Y
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-y": [{
        "overscroll-y": I()
      }],
      /**
       * Position
       * @see https://tailwindcss.com/docs/position
       */
      position: ["static", "fixed", "absolute", "relative", "sticky"],
      /**
       * Top / Right / Bottom / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      inset: [{
        inset: [m]
      }],
      /**
       * Right / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-x": [{
        "inset-x": [m]
      }],
      /**
       * Top / Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-y": [{
        "inset-y": [m]
      }],
      /**
       * Start
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      start: [{
        start: [m]
      }],
      /**
       * End
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      end: [{
        end: [m]
      }],
      /**
       * Top
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      top: [{
        top: [m]
      }],
      /**
       * Right
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      right: [{
        right: [m]
      }],
      /**
       * Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      bottom: [{
        bottom: [m]
      }],
      /**
       * Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      left: [{
        left: [m]
      }],
      /**
       * Visibility
       * @see https://tailwindcss.com/docs/visibility
       */
      visibility: ["visible", "invisible", "collapse"],
      /**
       * Z-Index
       * @see https://tailwindcss.com/docs/z-index
       */
      z: [{
        z: ["auto", Mp, Cn]
      }],
      // Flexbox and Grid
      /**
       * Flex Basis
       * @see https://tailwindcss.com/docs/flex-basis
       */
      basis: [{
        basis: E()
      }],
      /**
       * Flex Direction
       * @see https://tailwindcss.com/docs/flex-direction
       */
      "flex-direction": [{
        flex: ["row", "row-reverse", "col", "col-reverse"]
      }],
      /**
       * Flex Wrap
       * @see https://tailwindcss.com/docs/flex-wrap
       */
      "flex-wrap": [{
        flex: ["wrap", "wrap-reverse", "nowrap"]
      }],
      /**
       * Flex
       * @see https://tailwindcss.com/docs/flex
       */
      flex: [{
        flex: ["1", "auto", "initial", "none", Cn]
      }],
      /**
       * Flex Grow
       * @see https://tailwindcss.com/docs/flex-grow
       */
      grow: [{
        grow: V()
      }],
      /**
       * Flex Shrink
       * @see https://tailwindcss.com/docs/flex-shrink
       */
      shrink: [{
        shrink: V()
      }],
      /**
       * Order
       * @see https://tailwindcss.com/docs/order
       */
      order: [{
        order: ["first", "last", "none", Mp, Cn]
      }],
      /**
       * Grid Template Columns
       * @see https://tailwindcss.com/docs/grid-template-columns
       */
      "grid-cols": [{
        "grid-cols": [Ep]
      }],
      /**
       * Grid Column Start / End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start-end": [{
        col: ["auto", {
          span: ["full", Mp, Cn]
        }, Cn]
      }],
      /**
       * Grid Column Start
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start": [{
        "col-start": k()
      }],
      /**
       * Grid Column End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-end": [{
        "col-end": k()
      }],
      /**
       * Grid Template Rows
       * @see https://tailwindcss.com/docs/grid-template-rows
       */
      "grid-rows": [{
        "grid-rows": [Ep]
      }],
      /**
       * Grid Row Start / End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start-end": [{
        row: ["auto", {
          span: [Mp, Cn]
        }, Cn]
      }],
      /**
       * Grid Row Start
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start": [{
        "row-start": k()
      }],
      /**
       * Grid Row End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-end": [{
        "row-end": k()
      }],
      /**
       * Grid Auto Flow
       * @see https://tailwindcss.com/docs/grid-auto-flow
       */
      "grid-flow": [{
        "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
      }],
      /**
       * Grid Auto Columns
       * @see https://tailwindcss.com/docs/grid-auto-columns
       */
      "auto-cols": [{
        "auto-cols": ["auto", "min", "max", "fr", Cn]
      }],
      /**
       * Grid Auto Rows
       * @see https://tailwindcss.com/docs/grid-auto-rows
       */
      "auto-rows": [{
        "auto-rows": ["auto", "min", "max", "fr", Cn]
      }],
      /**
       * Gap
       * @see https://tailwindcss.com/docs/gap
       */
      gap: [{
        gap: [f]
      }],
      /**
       * Gap X
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-x": [{
        "gap-x": [f]
      }],
      /**
       * Gap Y
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-y": [{
        "gap-y": [f]
      }],
      /**
       * Justify Content
       * @see https://tailwindcss.com/docs/justify-content
       */
      "justify-content": [{
        justify: ["normal", ...F()]
      }],
      /**
       * Justify Items
       * @see https://tailwindcss.com/docs/justify-items
       */
      "justify-items": [{
        "justify-items": ["start", "end", "center", "stretch"]
      }],
      /**
       * Justify Self
       * @see https://tailwindcss.com/docs/justify-self
       */
      "justify-self": [{
        "justify-self": ["auto", "start", "end", "center", "stretch"]
      }],
      /**
       * Align Content
       * @see https://tailwindcss.com/docs/align-content
       */
      "align-content": [{
        content: ["normal", ...F(), "baseline"]
      }],
      /**
       * Align Items
       * @see https://tailwindcss.com/docs/align-items
       */
      "align-items": [{
        items: ["start", "end", "center", "baseline", "stretch"]
      }],
      /**
       * Align Self
       * @see https://tailwindcss.com/docs/align-self
       */
      "align-self": [{
        self: ["auto", "start", "end", "center", "stretch", "baseline"]
      }],
      /**
       * Place Content
       * @see https://tailwindcss.com/docs/place-content
       */
      "place-content": [{
        "place-content": [...F(), "baseline"]
      }],
      /**
       * Place Items
       * @see https://tailwindcss.com/docs/place-items
       */
      "place-items": [{
        "place-items": ["start", "end", "center", "baseline", "stretch"]
      }],
      /**
       * Place Self
       * @see https://tailwindcss.com/docs/place-self
       */
      "place-self": [{
        "place-self": ["auto", "start", "end", "center", "stretch"]
      }],
      // Spacing
      /**
       * Padding
       * @see https://tailwindcss.com/docs/padding
       */
      p: [{
        p: [y]
      }],
      /**
       * Padding X
       * @see https://tailwindcss.com/docs/padding
       */
      px: [{
        px: [y]
      }],
      /**
       * Padding Y
       * @see https://tailwindcss.com/docs/padding
       */
      py: [{
        py: [y]
      }],
      /**
       * Padding Start
       * @see https://tailwindcss.com/docs/padding
       */
      ps: [{
        ps: [y]
      }],
      /**
       * Padding End
       * @see https://tailwindcss.com/docs/padding
       */
      pe: [{
        pe: [y]
      }],
      /**
       * Padding Top
       * @see https://tailwindcss.com/docs/padding
       */
      pt: [{
        pt: [y]
      }],
      /**
       * Padding Right
       * @see https://tailwindcss.com/docs/padding
       */
      pr: [{
        pr: [y]
      }],
      /**
       * Padding Bottom
       * @see https://tailwindcss.com/docs/padding
       */
      pb: [{
        pb: [y]
      }],
      /**
       * Padding Left
       * @see https://tailwindcss.com/docs/padding
       */
      pl: [{
        pl: [y]
      }],
      /**
       * Margin
       * @see https://tailwindcss.com/docs/margin
       */
      m: [{
        m: [v]
      }],
      /**
       * Margin X
       * @see https://tailwindcss.com/docs/margin
       */
      mx: [{
        mx: [v]
      }],
      /**
       * Margin Y
       * @see https://tailwindcss.com/docs/margin
       */
      my: [{
        my: [v]
      }],
      /**
       * Margin Start
       * @see https://tailwindcss.com/docs/margin
       */
      ms: [{
        ms: [v]
      }],
      /**
       * Margin End
       * @see https://tailwindcss.com/docs/margin
       */
      me: [{
        me: [v]
      }],
      /**
       * Margin Top
       * @see https://tailwindcss.com/docs/margin
       */
      mt: [{
        mt: [v]
      }],
      /**
       * Margin Right
       * @see https://tailwindcss.com/docs/margin
       */
      mr: [{
        mr: [v]
      }],
      /**
       * Margin Bottom
       * @see https://tailwindcss.com/docs/margin
       */
      mb: [{
        mb: [v]
      }],
      /**
       * Margin Left
       * @see https://tailwindcss.com/docs/margin
       */
      ml: [{
        ml: [v]
      }],
      /**
       * Space Between X
       * @see https://tailwindcss.com/docs/space
       */
      "space-x": [{
        "space-x": [C]
      }],
      /**
       * Space Between X Reverse
       * @see https://tailwindcss.com/docs/space
       */
      "space-x-reverse": ["space-x-reverse"],
      /**
       * Space Between Y
       * @see https://tailwindcss.com/docs/space
       */
      "space-y": [{
        "space-y": [C]
      }],
      /**
       * Space Between Y Reverse
       * @see https://tailwindcss.com/docs/space
       */
      "space-y-reverse": ["space-y-reverse"],
      // Sizing
      /**
       * Width
       * @see https://tailwindcss.com/docs/width
       */
      w: [{
        w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", Cn, t]
      }],
      /**
       * Min-Width
       * @see https://tailwindcss.com/docs/min-width
       */
      "min-w": [{
        "min-w": [Cn, t, "min", "max", "fit"]
      }],
      /**
       * Max-Width
       * @see https://tailwindcss.com/docs/max-width
       */
      "max-w": [{
        "max-w": [Cn, t, "none", "full", "min", "max", "fit", "prose", {
          screen: [wc]
        }, wc]
      }],
      /**
       * Height
       * @see https://tailwindcss.com/docs/height
       */
      h: [{
        h: [Cn, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
      }],
      /**
       * Min-Height
       * @see https://tailwindcss.com/docs/min-height
       */
      "min-h": [{
        "min-h": [Cn, t, "min", "max", "fit", "svh", "lvh", "dvh"]
      }],
      /**
       * Max-Height
       * @see https://tailwindcss.com/docs/max-height
       */
      "max-h": [{
        "max-h": [Cn, t, "min", "max", "fit", "svh", "lvh", "dvh"]
      }],
      /**
       * Size
       * @see https://tailwindcss.com/docs/size
       */
      size: [{
        size: [Cn, t, "auto", "min", "max", "fit"]
      }],
      // Typography
      /**
       * Font Size
       * @see https://tailwindcss.com/docs/font-size
       */
      "font-size": [{
        text: ["base", wc, Ac]
      }],
      /**
       * Font Smoothing
       * @see https://tailwindcss.com/docs/font-smoothing
       */
      "font-smoothing": ["antialiased", "subpixel-antialiased"],
      /**
       * Font Style
       * @see https://tailwindcss.com/docs/font-style
       */
      "font-style": ["italic", "not-italic"],
      /**
       * Font Weight
       * @see https://tailwindcss.com/docs/font-weight
       */
      "font-weight": [{
        font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", ug]
      }],
      /**
       * Font Family
       * @see https://tailwindcss.com/docs/font-family
       */
      "font-family": [{
        font: [Ep]
      }],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-normal": ["normal-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-ordinal": ["ordinal"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-slashed-zero": ["slashed-zero"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-figure": ["lining-nums", "oldstyle-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-spacing": ["proportional-nums", "tabular-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-fraction": ["diagonal-fractions", "stacked-fractons"],
      /**
       * Letter Spacing
       * @see https://tailwindcss.com/docs/letter-spacing
       */
      tracking: [{
        tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", Cn]
      }],
      /**
       * Line Clamp
       * @see https://tailwindcss.com/docs/line-clamp
       */
      "line-clamp": [{
        "line-clamp": ["none", rf, ug]
      }],
      /**
       * Line Height
       * @see https://tailwindcss.com/docs/line-height
       */
      leading: [{
        leading: ["none", "tight", "snug", "normal", "relaxed", "loose", il, Cn]
      }],
      /**
       * List Style Image
       * @see https://tailwindcss.com/docs/list-style-image
       */
      "list-image": [{
        "list-image": ["none", Cn]
      }],
      /**
       * List Style Type
       * @see https://tailwindcss.com/docs/list-style-type
       */
      "list-style-type": [{
        list: ["none", "disc", "decimal", Cn]
      }],
      /**
       * List Style Position
       * @see https://tailwindcss.com/docs/list-style-position
       */
      "list-style-position": [{
        list: ["inside", "outside"]
      }],
      /**
       * Placeholder Color
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://tailwindcss.com/docs/placeholder-color
       */
      "placeholder-color": [{
        placeholder: [e]
      }],
      /**
       * Placeholder Opacity
       * @see https://tailwindcss.com/docs/placeholder-opacity
       */
      "placeholder-opacity": [{
        "placeholder-opacity": [h]
      }],
      /**
       * Text Alignment
       * @see https://tailwindcss.com/docs/text-align
       */
      "text-alignment": [{
        text: ["left", "center", "right", "justify", "start", "end"]
      }],
      /**
       * Text Color
       * @see https://tailwindcss.com/docs/text-color
       */
      "text-color": [{
        text: [e]
      }],
      /**
       * Text Opacity
       * @see https://tailwindcss.com/docs/text-opacity
       */
      "text-opacity": [{
        "text-opacity": [h]
      }],
      /**
       * Text Decoration
       * @see https://tailwindcss.com/docs/text-decoration
       */
      "text-decoration": ["underline", "overline", "line-through", "no-underline"],
      /**
       * Text Decoration Style
       * @see https://tailwindcss.com/docs/text-decoration-style
       */
      "text-decoration-style": [{
        decoration: [...B(), "wavy"]
      }],
      /**
       * Text Decoration Thickness
       * @see https://tailwindcss.com/docs/text-decoration-thickness
       */
      "text-decoration-thickness": [{
        decoration: ["auto", "from-font", il, Ac]
      }],
      /**
       * Text Underline Offset
       * @see https://tailwindcss.com/docs/text-underline-offset
       */
      "underline-offset": [{
        "underline-offset": ["auto", il, Cn]
      }],
      /**
       * Text Decoration Color
       * @see https://tailwindcss.com/docs/text-decoration-color
       */
      "text-decoration-color": [{
        decoration: [e]
      }],
      /**
       * Text Transform
       * @see https://tailwindcss.com/docs/text-transform
       */
      "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"],
      /**
       * Text Overflow
       * @see https://tailwindcss.com/docs/text-overflow
       */
      "text-overflow": ["truncate", "text-ellipsis", "text-clip"],
      /**
       * Text Wrap
       * @see https://tailwindcss.com/docs/text-wrap
       */
      "text-wrap": [{
        text: ["wrap", "nowrap", "balance", "pretty"]
      }],
      /**
       * Text Indent
       * @see https://tailwindcss.com/docs/text-indent
       */
      indent: [{
        indent: T()
      }],
      /**
       * Vertical Alignment
       * @see https://tailwindcss.com/docs/vertical-align
       */
      "vertical-align": [{
        align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", Cn]
      }],
      /**
       * Whitespace
       * @see https://tailwindcss.com/docs/whitespace
       */
      whitespace: [{
        whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"]
      }],
      /**
       * Word Break
       * @see https://tailwindcss.com/docs/word-break
       */
      break: [{
        break: ["normal", "words", "all", "keep"]
      }],
      /**
       * Hyphens
       * @see https://tailwindcss.com/docs/hyphens
       */
      hyphens: [{
        hyphens: ["none", "manual", "auto"]
      }],
      /**
       * Content
       * @see https://tailwindcss.com/docs/content
       */
      content: [{
        content: ["none", Cn]
      }],
      // Backgrounds
      /**
       * Background Attachment
       * @see https://tailwindcss.com/docs/background-attachment
       */
      "bg-attachment": [{
        bg: ["fixed", "local", "scroll"]
      }],
      /**
       * Background Clip
       * @see https://tailwindcss.com/docs/background-clip
       */
      "bg-clip": [{
        "bg-clip": ["border", "padding", "content", "text"]
      }],
      /**
       * Background Opacity
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://tailwindcss.com/docs/background-opacity
       */
      "bg-opacity": [{
        "bg-opacity": [h]
      }],
      /**
       * Background Origin
       * @see https://tailwindcss.com/docs/background-origin
       */
      "bg-origin": [{
        "bg-origin": ["border", "padding", "content"]
      }],
      /**
       * Background Position
       * @see https://tailwindcss.com/docs/background-position
       */
      "bg-position": [{
        bg: [...D(), Xpe]
      }],
      /**
       * Background Repeat
       * @see https://tailwindcss.com/docs/background-repeat
       */
      "bg-repeat": [{
        bg: ["no-repeat", {
          repeat: ["", "x", "y", "round", "space"]
        }]
      }],
      /**
       * Background Size
       * @see https://tailwindcss.com/docs/background-size
       */
      "bg-size": [{
        bg: ["auto", "cover", "contain", Wpe]
      }],
      /**
       * Background Image
       * @see https://tailwindcss.com/docs/background-image
       */
      "bg-image": [{
        bg: ["none", {
          "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
        }, Qpe]
      }],
      /**
       * Background Color
       * @see https://tailwindcss.com/docs/background-color
       */
      "bg-color": [{
        bg: [e]
      }],
      /**
       * Gradient Color Stops From Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from-pos": [{
        from: [g]
      }],
      /**
       * Gradient Color Stops Via Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via-pos": [{
        via: [g]
      }],
      /**
       * Gradient Color Stops To Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to-pos": [{
        to: [g]
      }],
      /**
       * Gradient Color Stops From
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from": [{
        from: [p]
      }],
      /**
       * Gradient Color Stops Via
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via": [{
        via: [p]
      }],
      /**
       * Gradient Color Stops To
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to": [{
        to: [p]
      }],
      // Borders
      /**
       * Border Radius
       * @see https://tailwindcss.com/docs/border-radius
       */
      rounded: [{
        rounded: [a]
      }],
      /**
       * Border Radius Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-s": [{
        "rounded-s": [a]
      }],
      /**
       * Border Radius End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-e": [{
        "rounded-e": [a]
      }],
      /**
       * Border Radius Top
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-t": [{
        "rounded-t": [a]
      }],
      /**
       * Border Radius Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-r": [{
        "rounded-r": [a]
      }],
      /**
       * Border Radius Bottom
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-b": [{
        "rounded-b": [a]
      }],
      /**
       * Border Radius Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-l": [{
        "rounded-l": [a]
      }],
      /**
       * Border Radius Start Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ss": [{
        "rounded-ss": [a]
      }],
      /**
       * Border Radius Start End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-se": [{
        "rounded-se": [a]
      }],
      /**
       * Border Radius End End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ee": [{
        "rounded-ee": [a]
      }],
      /**
       * Border Radius End Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-es": [{
        "rounded-es": [a]
      }],
      /**
       * Border Radius Top Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tl": [{
        "rounded-tl": [a]
      }],
      /**
       * Border Radius Top Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tr": [{
        "rounded-tr": [a]
      }],
      /**
       * Border Radius Bottom Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-br": [{
        "rounded-br": [a]
      }],
      /**
       * Border Radius Bottom Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-bl": [{
        "rounded-bl": [a]
      }],
      /**
       * Border Width
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w": [{
        border: [s]
      }],
      /**
       * Border Width X
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-x": [{
        "border-x": [s]
      }],
      /**
       * Border Width Y
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-y": [{
        "border-y": [s]
      }],
      /**
       * Border Width Start
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-s": [{
        "border-s": [s]
      }],
      /**
       * Border Width End
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-e": [{
        "border-e": [s]
      }],
      /**
       * Border Width Top
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-t": [{
        "border-t": [s]
      }],
      /**
       * Border Width Right
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-r": [{
        "border-r": [s]
      }],
      /**
       * Border Width Bottom
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-b": [{
        "border-b": [s]
      }],
      /**
       * Border Width Left
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-l": [{
        "border-l": [s]
      }],
      /**
       * Border Opacity
       * @see https://tailwindcss.com/docs/border-opacity
       */
      "border-opacity": [{
        "border-opacity": [h]
      }],
      /**
       * Border Style
       * @see https://tailwindcss.com/docs/border-style
       */
      "border-style": [{
        border: [...B(), "hidden"]
      }],
      /**
       * Divide Width X
       * @see https://tailwindcss.com/docs/divide-width
       */
      "divide-x": [{
        "divide-x": [s]
      }],
      /**
       * Divide Width X Reverse
       * @see https://tailwindcss.com/docs/divide-width
       */
      "divide-x-reverse": ["divide-x-reverse"],
      /**
       * Divide Width Y
       * @see https://tailwindcss.com/docs/divide-width
       */
      "divide-y": [{
        "divide-y": [s]
      }],
      /**
       * Divide Width Y Reverse
       * @see https://tailwindcss.com/docs/divide-width
       */
      "divide-y-reverse": ["divide-y-reverse"],
      /**
       * Divide Opacity
       * @see https://tailwindcss.com/docs/divide-opacity
       */
      "divide-opacity": [{
        "divide-opacity": [h]
      }],
      /**
       * Divide Style
       * @see https://tailwindcss.com/docs/divide-style
       */
      "divide-style": [{
        divide: B()
      }],
      /**
       * Border Color
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color": [{
        border: [i]
      }],
      /**
       * Border Color X
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-x": [{
        "border-x": [i]
      }],
      /**
       * Border Color Y
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-y": [{
        "border-y": [i]
      }],
      /**
       * Border Color Top
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-t": [{
        "border-t": [i]
      }],
      /**
       * Border Color Right
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-r": [{
        "border-r": [i]
      }],
      /**
       * Border Color Bottom
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-b": [{
        "border-b": [i]
      }],
      /**
       * Border Color Left
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-l": [{
        "border-l": [i]
      }],
      /**
       * Divide Color
       * @see https://tailwindcss.com/docs/divide-color
       */
      "divide-color": [{
        divide: [i]
      }],
      /**
       * Outline Style
       * @see https://tailwindcss.com/docs/outline-style
       */
      "outline-style": [{
        outline: ["", ...B()]
      }],
      /**
       * Outline Offset
       * @see https://tailwindcss.com/docs/outline-offset
       */
      "outline-offset": [{
        "outline-offset": [il, Cn]
      }],
      /**
       * Outline Width
       * @see https://tailwindcss.com/docs/outline-width
       */
      "outline-w": [{
        outline: [il, Ac]
      }],
      /**
       * Outline Color
       * @see https://tailwindcss.com/docs/outline-color
       */
      "outline-color": [{
        outline: [e]
      }],
      /**
       * Ring Width
       * @see https://tailwindcss.com/docs/ring-width
       */
      "ring-w": [{
        ring: P()
      }],
      /**
       * Ring Width Inset
       * @see https://tailwindcss.com/docs/ring-width
       */
      "ring-w-inset": ["ring-inset"],
      /**
       * Ring Color
       * @see https://tailwindcss.com/docs/ring-color
       */
      "ring-color": [{
        ring: [e]
      }],
      /**
       * Ring Opacity
       * @see https://tailwindcss.com/docs/ring-opacity
       */
      "ring-opacity": [{
        "ring-opacity": [h]
      }],
      /**
       * Ring Offset Width
       * @see https://tailwindcss.com/docs/ring-offset-width
       */
      "ring-offset-w": [{
        "ring-offset": [il, Ac]
      }],
      /**
       * Ring Offset Color
       * @see https://tailwindcss.com/docs/ring-offset-color
       */
      "ring-offset-color": [{
        "ring-offset": [e]
      }],
      // Effects
      /**
       * Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow
       */
      shadow: [{
        shadow: ["", "inner", "none", wc, Jpe]
      }],
      /**
       * Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow-color
       */
      "shadow-color": [{
        shadow: [Ep]
      }],
      /**
       * Opacity
       * @see https://tailwindcss.com/docs/opacity
       */
      opacity: [{
        opacity: [h]
      }],
      /**
       * Mix Blend Mode
       * @see https://tailwindcss.com/docs/mix-blend-mode
       */
      "mix-blend": [{
        "mix-blend": [...L(), "plus-lighter", "plus-darker"]
      }],
      /**
       * Background Blend Mode
       * @see https://tailwindcss.com/docs/background-blend-mode
       */
      "bg-blend": [{
        "bg-blend": L()
      }],
      // Filters
      /**
       * Filter
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://tailwindcss.com/docs/filter
       */
      filter: [{
        filter: ["", "none"]
      }],
      /**
       * Blur
       * @see https://tailwindcss.com/docs/blur
       */
      blur: [{
        blur: [n]
      }],
      /**
       * Brightness
       * @see https://tailwindcss.com/docs/brightness
       */
      brightness: [{
        brightness: [r]
      }],
      /**
       * Contrast
       * @see https://tailwindcss.com/docs/contrast
       */
      contrast: [{
        contrast: [u]
      }],
      /**
       * Drop Shadow
       * @see https://tailwindcss.com/docs/drop-shadow
       */
      "drop-shadow": [{
        "drop-shadow": ["", "none", wc, Cn]
      }],
      /**
       * Grayscale
       * @see https://tailwindcss.com/docs/grayscale
       */
      grayscale: [{
        grayscale: [l]
      }],
      /**
       * Hue Rotate
       * @see https://tailwindcss.com/docs/hue-rotate
       */
      "hue-rotate": [{
        "hue-rotate": [c]
      }],
      /**
       * Invert
       * @see https://tailwindcss.com/docs/invert
       */
      invert: [{
        invert: [d]
      }],
      /**
       * Saturate
       * @see https://tailwindcss.com/docs/saturate
       */
      saturate: [{
        saturate: [x]
      }],
      /**
       * Sepia
       * @see https://tailwindcss.com/docs/sepia
       */
      sepia: [{
        sepia: [b]
      }],
      /**
       * Backdrop Filter
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://tailwindcss.com/docs/backdrop-filter
       */
      "backdrop-filter": [{
        "backdrop-filter": ["", "none"]
      }],
      /**
       * Backdrop Blur
       * @see https://tailwindcss.com/docs/backdrop-blur
       */
      "backdrop-blur": [{
        "backdrop-blur": [n]
      }],
      /**
       * Backdrop Brightness
       * @see https://tailwindcss.com/docs/backdrop-brightness
       */
      "backdrop-brightness": [{
        "backdrop-brightness": [r]
      }],
      /**
       * Backdrop Contrast
       * @see https://tailwindcss.com/docs/backdrop-contrast
       */
      "backdrop-contrast": [{
        "backdrop-contrast": [u]
      }],
      /**
       * Backdrop Grayscale
       * @see https://tailwindcss.com/docs/backdrop-grayscale
       */
      "backdrop-grayscale": [{
        "backdrop-grayscale": [l]
      }],
      /**
       * Backdrop Hue Rotate
       * @see https://tailwindcss.com/docs/backdrop-hue-rotate
       */
      "backdrop-hue-rotate": [{
        "backdrop-hue-rotate": [c]
      }],
      /**
       * Backdrop Invert
       * @see https://tailwindcss.com/docs/backdrop-invert
       */
      "backdrop-invert": [{
        "backdrop-invert": [d]
      }],
      /**
       * Backdrop Opacity
       * @see https://tailwindcss.com/docs/backdrop-opacity
       */
      "backdrop-opacity": [{
        "backdrop-opacity": [h]
      }],
      /**
       * Backdrop Saturate
       * @see https://tailwindcss.com/docs/backdrop-saturate
       */
      "backdrop-saturate": [{
        "backdrop-saturate": [x]
      }],
      /**
       * Backdrop Sepia
       * @see https://tailwindcss.com/docs/backdrop-sepia
       */
      "backdrop-sepia": [{
        "backdrop-sepia": [b]
      }],
      // Tables
      /**
       * Border Collapse
       * @see https://tailwindcss.com/docs/border-collapse
       */
      "border-collapse": [{
        border: ["collapse", "separate"]
      }],
      /**
       * Border Spacing
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing": [{
        "border-spacing": [o]
      }],
      /**
       * Border Spacing X
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-x": [{
        "border-spacing-x": [o]
      }],
      /**
       * Border Spacing Y
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-y": [{
        "border-spacing-y": [o]
      }],
      /**
       * Table Layout
       * @see https://tailwindcss.com/docs/table-layout
       */
      "table-layout": [{
        table: ["auto", "fixed"]
      }],
      /**
       * Caption Side
       * @see https://tailwindcss.com/docs/caption-side
       */
      caption: [{
        caption: ["top", "bottom"]
      }],
      // Transitions and Animation
      /**
       * Tranisition Property
       * @see https://tailwindcss.com/docs/transition-property
       */
      transition: [{
        transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", Cn]
      }],
      /**
       * Transition Duration
       * @see https://tailwindcss.com/docs/transition-duration
       */
      duration: [{
        duration: q()
      }],
      /**
       * Transition Timing Function
       * @see https://tailwindcss.com/docs/transition-timing-function
       */
      ease: [{
        ease: ["linear", "in", "out", "in-out", Cn]
      }],
      /**
       * Transition Delay
       * @see https://tailwindcss.com/docs/transition-delay
       */
      delay: [{
        delay: q()
      }],
      /**
       * Animation
       * @see https://tailwindcss.com/docs/animation
       */
      animate: [{
        animate: ["none", "spin", "ping", "pulse", "bounce", Cn]
      }],
      // Transforms
      /**
       * Transform
       * @see https://tailwindcss.com/docs/transform
       */
      transform: [{
        transform: ["", "gpu", "none"]
      }],
      /**
       * Scale
       * @see https://tailwindcss.com/docs/scale
       */
      scale: [{
        scale: [S]
      }],
      /**
       * Scale X
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-x": [{
        "scale-x": [S]
      }],
      /**
       * Scale Y
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-y": [{
        "scale-y": [S]
      }],
      /**
       * Rotate
       * @see https://tailwindcss.com/docs/rotate
       */
      rotate: [{
        rotate: [Mp, Cn]
      }],
      /**
       * Translate X
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-x": [{
        "translate-x": [w]
      }],
      /**
       * Translate Y
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-y": [{
        "translate-y": [w]
      }],
      /**
       * Skew X
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-x": [{
        "skew-x": [_]
      }],
      /**
       * Skew Y
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-y": [{
        "skew-y": [_]
      }],
      /**
       * Transform Origin
       * @see https://tailwindcss.com/docs/transform-origin
       */
      "transform-origin": [{
        origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", Cn]
      }],
      // Interactivity
      /**
       * Accent Color
       * @see https://tailwindcss.com/docs/accent-color
       */
      accent: [{
        accent: ["auto", e]
      }],
      /**
       * Appearance
       * @see https://tailwindcss.com/docs/appearance
       */
      appearance: [{
        appearance: ["none", "auto"]
      }],
      /**
       * Cursor
       * @see https://tailwindcss.com/docs/cursor
       */
      cursor: [{
        cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", Cn]
      }],
      /**
       * Caret Color
       * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
       */
      "caret-color": [{
        caret: [e]
      }],
      /**
       * Pointer Events
       * @see https://tailwindcss.com/docs/pointer-events
       */
      "pointer-events": [{
        "pointer-events": ["none", "auto"]
      }],
      /**
       * Resize
       * @see https://tailwindcss.com/docs/resize
       */
      resize: [{
        resize: ["none", "y", "x", ""]
      }],
      /**
       * Scroll Behavior
       * @see https://tailwindcss.com/docs/scroll-behavior
       */
      "scroll-behavior": [{
        scroll: ["auto", "smooth"]
      }],
      /**
       * Scroll Margin
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-m": [{
        "scroll-m": T()
      }],
      /**
       * Scroll Margin X
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mx": [{
        "scroll-mx": T()
      }],
      /**
       * Scroll Margin Y
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-my": [{
        "scroll-my": T()
      }],
      /**
       * Scroll Margin Start
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ms": [{
        "scroll-ms": T()
      }],
      /**
       * Scroll Margin End
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-me": [{
        "scroll-me": T()
      }],
      /**
       * Scroll Margin Top
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mt": [{
        "scroll-mt": T()
      }],
      /**
       * Scroll Margin Right
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mr": [{
        "scroll-mr": T()
      }],
      /**
       * Scroll Margin Bottom
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mb": [{
        "scroll-mb": T()
      }],
      /**
       * Scroll Margin Left
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ml": [{
        "scroll-ml": T()
      }],
      /**
       * Scroll Padding
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-p": [{
        "scroll-p": T()
      }],
      /**
       * Scroll Padding X
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-px": [{
        "scroll-px": T()
      }],
      /**
       * Scroll Padding Y
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-py": [{
        "scroll-py": T()
      }],
      /**
       * Scroll Padding Start
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-ps": [{
        "scroll-ps": T()
      }],
      /**
       * Scroll Padding End
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pe": [{
        "scroll-pe": T()
      }],
      /**
       * Scroll Padding Top
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pt": [{
        "scroll-pt": T()
      }],
      /**
       * Scroll Padding Right
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pr": [{
        "scroll-pr": T()
      }],
      /**
       * Scroll Padding Bottom
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pb": [{
        "scroll-pb": T()
      }],
      /**
       * Scroll Padding Left
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pl": [{
        "scroll-pl": T()
      }],
      /**
       * Scroll Snap Align
       * @see https://tailwindcss.com/docs/scroll-snap-align
       */
      "snap-align": [{
        snap: ["start", "end", "center", "align-none"]
      }],
      /**
       * Scroll Snap Stop
       * @see https://tailwindcss.com/docs/scroll-snap-stop
       */
      "snap-stop": [{
        snap: ["normal", "always"]
      }],
      /**
       * Scroll Snap Type
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-type": [{
        snap: ["none", "x", "y", "both"]
      }],
      /**
       * Scroll Snap Type Strictness
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-strictness": [{
        snap: ["mandatory", "proximity"]
      }],
      /**
       * Touch Action
       * @see https://tailwindcss.com/docs/touch-action
       */
      touch: [{
        touch: ["auto", "none", "manipulation"]
      }],
      /**
       * Touch Action X
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-x": [{
        "touch-pan": ["x", "left", "right"]
      }],
      /**
       * Touch Action Y
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-y": [{
        "touch-pan": ["y", "up", "down"]
      }],
      /**
       * Touch Action Pinch Zoom
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-pz": ["touch-pinch-zoom"],
      /**
       * User Select
       * @see https://tailwindcss.com/docs/user-select
       */
      select: [{
        select: ["none", "text", "all", "auto"]
      }],
      /**
       * Will Change
       * @see https://tailwindcss.com/docs/will-change
       */
      "will-change": [{
        "will-change": ["auto", "scroll", "contents", "transform", Cn]
      }],
      // SVG
      /**
       * Fill
       * @see https://tailwindcss.com/docs/fill
       */
      fill: [{
        fill: [e, "none"]
      }],
      /**
       * Stroke Width
       * @see https://tailwindcss.com/docs/stroke-width
       */
      "stroke-w": [{
        stroke: [il, Ac, ug]
      }],
      /**
       * Stroke
       * @see https://tailwindcss.com/docs/stroke
       */
      stroke: [{
        stroke: [e, "none"]
      }],
      // Accessibility
      /**
       * Screen Readers
       * @see https://tailwindcss.com/docs/screen-readers
       */
      sr: ["sr-only", "not-sr-only"],
      /**
       * Forced Color Adjust
       * @see https://tailwindcss.com/docs/forced-color-adjust
       */
      "forced-color-adjust": [{
        "forced-color-adjust": ["auto", "none"]
      }]
    },
    conflictingClassGroups: {
      overflow: ["overflow-x", "overflow-y"],
      overscroll: ["overscroll-x", "overscroll-y"],
      inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
      "inset-x": ["right", "left"],
      "inset-y": ["top", "bottom"],
      flex: ["basis", "grow", "shrink"],
      gap: ["gap-x", "gap-y"],
      p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
      px: ["pr", "pl"],
      py: ["pt", "pb"],
      m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
      mx: ["mr", "ml"],
      my: ["mt", "mb"],
      size: ["w", "h"],
      "font-size": ["leading"],
      "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
      "fvn-ordinal": ["fvn-normal"],
      "fvn-slashed-zero": ["fvn-normal"],
      "fvn-figure": ["fvn-normal"],
      "fvn-spacing": ["fvn-normal"],
      "fvn-fraction": ["fvn-normal"],
      "line-clamp": ["display", "overflow"],
      rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
      "rounded-s": ["rounded-ss", "rounded-es"],
      "rounded-e": ["rounded-se", "rounded-ee"],
      "rounded-t": ["rounded-tl", "rounded-tr"],
      "rounded-r": ["rounded-tr", "rounded-br"],
      "rounded-b": ["rounded-br", "rounded-bl"],
      "rounded-l": ["rounded-tl", "rounded-bl"],
      "border-spacing": ["border-spacing-x", "border-spacing-y"],
      "border-w": ["border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
      "border-w-x": ["border-w-r", "border-w-l"],
      "border-w-y": ["border-w-t", "border-w-b"],
      "border-color": ["border-color-t", "border-color-r", "border-color-b", "border-color-l"],
      "border-color-x": ["border-color-r", "border-color-l"],
      "border-color-y": ["border-color-t", "border-color-b"],
      "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
      "scroll-mx": ["scroll-mr", "scroll-ml"],
      "scroll-my": ["scroll-mt", "scroll-mb"],
      "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
      "scroll-px": ["scroll-pr", "scroll-pl"],
      "scroll-py": ["scroll-pt", "scroll-pb"],
      touch: ["touch-x", "touch-y", "touch-pz"],
      "touch-x": ["touch"],
      "touch-y": ["touch"],
      "touch-pz": ["touch"]
    },
    conflictingClassGroupModifiers: {
      "font-size": ["leading"]
    }
  };
}
const T7 = /* @__PURE__ */ Fpe(n0e), {
  SvelteComponent: r0e,
  action_destroyer: zN,
  add_render_callback: i0e,
  assign: Zv,
  binding_callbacks: iE,
  bubble: du,
  check_outros: UN,
  compute_rest_props: aE,
  create_bidirectional_transition: oE,
  create_slot: HN,
  detach: Ch,
  element: qN,
  empty: k7,
  exclude_internal_props: sE,
  get_all_dirty_from_scope: jN,
  get_slot_changes: KN,
  get_spread_update: YN,
  group_outros: WN,
  init: a0e,
  insert: Sh,
  is_function: XN,
  listen: yu,
  run_all: ZN,
  safe_not_equal: D7,
  set_dynamic_element_data: Qv,
  transition_in: Cl,
  transition_out: Tf,
  update_slot_base: QN
} = window.__gradio__svelte__internal, { createEventDispatcher: o0e, setContext: uE } = window.__gradio__svelte__internal;
function s0e(e) {
  let t = (
    /*tag*/
    e[1]
  ), n, r, i = (
    /*tag*/
    e[1] && Nb(e)
  );
  return {
    c() {
      i && i.c(), n = k7();
    },
    m(a, o) {
      i && i.m(a, o), Sh(a, n, o), r = !0;
    },
    p(a, o) {
      /*tag*/
      a[1] ? t ? D7(
        t,
        /*tag*/
        a[1]
      ) ? (i.d(1), i = Nb(a), t = /*tag*/
      a[1], i.c(), i.m(n.parentNode, n)) : i.p(a, o) : (i = Nb(a), t = /*tag*/
      a[1], i.c(), i.m(n.parentNode, n)) : t && (i.d(1), i = null, t = /*tag*/
      a[1]);
    },
    i(a) {
      r || (Cl(i, a), r = !0);
    },
    o(a) {
      Tf(i, a), r = !1;
    },
    d(a) {
      a && Ch(n), i && i.d(a);
    }
  };
}
function u0e(e) {
  let t = (
    /*tag*/
    e[1]
  ), n, r = !1, i, a = (
    /*tag*/
    e[1] && Fb(e)
  );
  return {
    c() {
      a && a.c(), n = k7();
    },
    m(o, s) {
      a && a.m(o, s), Sh(o, n, s), i = !0;
    },
    p(o, s) {
      /*tag*/
      o[1] ? t ? D7(
        t,
        /*tag*/
        o[1]
      ) ? (a.d(1), a = Fb(o), t = /*tag*/
      o[1], a.c(), r && (r = !1, Cl(a)), a.m(n.parentNode, n)) : (r && (r = !1, Cl(a)), a.p(o, s)) : (a = Fb(o), t = /*tag*/
      o[1], a.c(), Cl(a), a.m(n.parentNode, n)) : t && (r = !0, WN(), Tf(a, 1, 1, () => {
        a = null, t = /*tag*/
        o[1], r = !1;
      }), UN());
    },
    i(o) {
      i || (Cl(a, o), i = !0);
    },
    o(o) {
      Tf(a, o), i = !1;
    },
    d(o) {
      o && Ch(n), a && a.d(o);
    }
  };
}
function Nb(e) {
  let t, n, r, i, a;
  const o = (
    /*#slots*/
    e[15].default
  ), s = HN(
    o,
    e,
    /*$$scope*/
    e[14],
    null
  );
  let u = [
    { role: (
      /*role*/
      e[4]
    ) },
    /*$$restProps*/
    e[9],
    { class: (
      /*divClass*/
      e[8]
    ) }
  ], l = {};
  for (let c = 0; c < u.length; c += 1)
    l = Zv(l, u[c]);
  return {
    c() {
      t = qN(
        /*tag*/
        e[1]
      ), s && s.c(), Qv(
        /*tag*/
        e[1]
      )(t, l);
    },
    m(c, d) {
      Sh(c, t, d), s && s.m(t, null), e[27](t), r = !0, i || (a = [
        zN(n = /*use*/
        e[2].call(
          null,
          t,
          /*options*/
          e[3]
        )),
        yu(
          t,
          "click",
          /*click_handler_1*/
          e[21]
        ),
        yu(
          t,
          "mouseenter",
          /*mouseenter_handler_1*/
          e[22]
        ),
        yu(
          t,
          "mouseleave",
          /*mouseleave_handler_1*/
          e[23]
        ),
        yu(
          t,
          "focusin",
          /*focusin_handler_1*/
          e[24]
        ),
        yu(
          t,
          "focusout",
          /*focusout_handler_1*/
          e[25]
        )
      ], i = !0);
    },
    p(c, d) {
      s && s.p && (!r || d[0] & /*$$scope*/
      16384) && QN(
        s,
        o,
        c,
        /*$$scope*/
        c[14],
        r ? KN(
          o,
          /*$$scope*/
          c[14],
          d,
          null
        ) : jN(
          /*$$scope*/
          c[14]
        ),
        null
      ), Qv(
        /*tag*/
        c[1]
      )(t, l = YN(u, [
        (!r || d[0] & /*role*/
        16) && { role: (
          /*role*/
          c[4]
        ) },
        d[0] & /*$$restProps*/
        512 && /*$$restProps*/
        c[9],
        (!r || d[0] & /*divClass*/
        256) && { class: (
          /*divClass*/
          c[8]
        ) }
      ])), n && XN(n.update) && d[0] & /*options*/
      8 && n.update.call(
        null,
        /*options*/
        c[3]
      );
    },
    i(c) {
      r || (Cl(s, c), r = !0);
    },
    o(c) {
      Tf(s, c), r = !1;
    },
    d(c) {
      c && Ch(t), s && s.d(c), e[27](null), i = !1, ZN(a);
    }
  };
}
function Fb(e) {
  let t, n, r, i, a, o;
  const s = (
    /*#slots*/
    e[15].default
  ), u = HN(
    s,
    e,
    /*$$scope*/
    e[14],
    null
  );
  let l = [
    { role: (
      /*role*/
      e[4]
    ) },
    /*$$restProps*/
    e[9],
    { class: (
      /*divClass*/
      e[8]
    ) }
  ], c = {};
  for (let d = 0; d < l.length; d += 1)
    c = Zv(c, l[d]);
  return {
    c() {
      t = qN(
        /*tag*/
        e[1]
      ), u && u.c(), Qv(
        /*tag*/
        e[1]
      )(t, c);
    },
    m(d, f) {
      Sh(d, t, f), u && u.m(t, null), e[26](t), i = !0, a || (o = [
        zN(n = /*use*/
        e[2].call(
          null,
          t,
          /*options*/
          e[3]
        )),
        yu(
          t,
          "click",
          /*click_handler*/
          e[16]
        ),
        yu(
          t,
          "mouseenter",
          /*mouseenter_handler*/
          e[17]
        ),
        yu(
          t,
          "mouseleave",
          /*mouseleave_handler*/
          e[18]
        ),
        yu(
          t,
          "focusin",
          /*focusin_handler*/
          e[19]
        ),
        yu(
          t,
          "focusout",
          /*focusout_handler*/
          e[20]
        )
      ], a = !0);
    },
    p(d, f) {
      e = d, u && u.p && (!i || f[0] & /*$$scope*/
      16384) && QN(
        u,
        s,
        e,
        /*$$scope*/
        e[14],
        i ? KN(
          s,
          /*$$scope*/
          e[14],
          f,
          null
        ) : jN(
          /*$$scope*/
          e[14]
        ),
        null
      ), Qv(
        /*tag*/
        e[1]
      )(t, c = YN(l, [
        (!i || f[0] & /*role*/
        16) && { role: (
          /*role*/
          e[4]
        ) },
        f[0] & /*$$restProps*/
        512 && /*$$restProps*/
        e[9],
        (!i || f[0] & /*divClass*/
        256) && { class: (
          /*divClass*/
          e[8]
        ) }
      ])), n && XN(n.update) && f[0] & /*options*/
      8 && n.update.call(
        null,
        /*options*/
        e[3]
      );
    },
    i(d) {
      i || (Cl(u, d), d && i0e(() => {
        i && (r || (r = oE(
          t,
          /*transition*/
          e[5],
          /*params*/
          e[6],
          !0
        )), r.run(1));
      }), i = !0);
    },
    o(d) {
      Tf(u, d), d && (r || (r = oE(
        t,
        /*transition*/
        e[5],
        /*params*/
        e[6],
        !1
      )), r.run(0)), i = !1;
    },
    d(d) {
      d && Ch(t), u && u.d(d), e[26](null), d && r && r.end(), a = !1, ZN(o);
    }
  };
}
function l0e(e) {
  let t, n, r, i;
  const a = [u0e, s0e], o = [];
  function s(u, l) {
    return (
      /*transition*/
      u[5] && /*open*/
      u[7] ? 0 : (
        /*open*/
        u[7] ? 1 : -1
      )
    );
  }
  return ~(t = s(e)) && (n = o[t] = a[t](e)), {
    c() {
      n && n.c(), r = k7();
    },
    m(u, l) {
      ~t && o[t].m(u, l), Sh(u, r, l), i = !0;
    },
    p(u, l) {
      let c = t;
      t = s(u), t === c ? ~t && o[t].p(u, l) : (n && (WN(), Tf(o[c], 1, 1, () => {
        o[c] = null;
      }), UN()), ~t ? (n = o[t], n ? n.p(u, l) : (n = o[t] = a[t](u), n.c()), Cl(n, 1), n.m(r.parentNode, r)) : n = null);
    },
    i(u) {
      i || (Cl(n), i = !0);
    },
    o(u) {
      Tf(n), i = !1;
    },
    d(u) {
      u && Ch(r), ~t && o[t].d(u);
    }
  };
}
const c0e = {
  gray: "bg-gray-50 dark:bg-gray-800",
  red: "bg-red-50 dark:bg-gray-800",
  yellow: "bg-yellow-50 dark:bg-gray-800 ",
  green: "bg-green-50 dark:bg-gray-800 ",
  indigo: "bg-indigo-50 dark:bg-gray-800 ",
  purple: "bg-purple-50 dark:bg-gray-800 ",
  pink: "bg-pink-50 dark:bg-gray-800 ",
  blue: "bg-blue-50 dark:bg-gray-800 ",
  light: "bg-gray-50 dark:bg-gray-700",
  dark: "bg-gray-50 dark:bg-gray-800",
  default: "bg-white dark:bg-gray-800",
  dropdown: "bg-white dark:bg-gray-700",
  navbar: "bg-white dark:bg-gray-900",
  navbarUl: "bg-gray-50 dark:bg-gray-800",
  form: "bg-gray-50 dark:bg-gray-700",
  primary: "bg-primary-50 dark:bg-gray-800 ",
  orange: "bg-orange-50 dark:bg-orange-800",
  none: ""
};
function d0e(e, t, n) {
  const r = [
    "tag",
    "color",
    "rounded",
    "border",
    "shadow",
    "node",
    "use",
    "options",
    "role",
    "transition",
    "params",
    "open"
  ];
  let i = aE(t, r), { $$slots: a = {}, $$scope: o } = t;
  const s = () => {
  };
  uE("background", !0);
  let { tag: u = i.href ? "a" : "div" } = t, { color: l = "default" } = t, { rounded: c = !1 } = t, { border: d = !1 } = t, { shadow: f = !1 } = t, { node: p = void 0 } = t, { use: g = s } = t, { options: m = {} } = t, { role: v = void 0 } = t, { transition: h = void 0 } = t, { params: y = {} } = t, { open: x = !0 } = t;
  const S = o0e(), b = {
    gray: "text-gray-800 dark:text-gray-300",
    red: "text-red-800 dark:text-red-400",
    yellow: "text-yellow-800 dark:text-yellow-300",
    green: "text-green-800 dark:text-green-400",
    indigo: "text-indigo-800 dark:text-indigo-400",
    purple: "text-purple-800 dark:text-purple-400",
    pink: "text-pink-800 dark:text-pink-400",
    blue: "text-blue-800 dark:text-blue-400",
    light: "text-gray-700 dark:text-gray-300",
    dark: "text-gray-700 dark:text-gray-300",
    default: "text-gray-500 dark:text-gray-400",
    dropdown: "text-gray-700 dark:text-gray-200",
    navbar: "text-gray-700 dark:text-gray-200",
    navbarUl: "text-gray-700 dark:text-gray-400",
    form: "text-gray-900 dark:text-white",
    primary: "text-primary-800 dark:text-primary-400",
    orange: "text-orange-800 dark:text-orange-400",
    none: ""
  }, _ = {
    gray: "border-gray-300 dark:border-gray-800 divide-gray-300 dark:divide-gray-800",
    red: "border-red-300 dark:border-red-800 divide-red-300 dark:divide-red-800",
    yellow: "border-yellow-300 dark:border-yellow-800 divide-yellow-300 dark:divide-yellow-800",
    green: "border-green-300 dark:border-green-800 divide-green-300 dark:divide-green-800",
    indigo: "border-indigo-300 dark:border-indigo-800 divide-indigo-300 dark:divide-indigo-800",
    purple: "border-purple-300 dark:border-purple-800 divide-purple-300 dark:divide-purple-800",
    pink: "border-pink-300 dark:border-pink-800 divide-pink-300 dark:divide-pink-800",
    blue: "border-blue-300 dark:border-blue-800 divide-blue-300 dark:divide-blue-800",
    light: "border-gray-500 divide-gray-500",
    dark: "border-gray-500 divide-gray-500",
    default: "border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700",
    dropdown: "border-gray-100 dark:border-gray-600 divide-gray-100 dark:divide-gray-600",
    navbar: "border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",
    navbarUl: "border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",
    form: "border-gray-300 dark:border-gray-700 divide-gray-300 dark:divide-gray-700",
    primary: "border-primary-500 dark:border-primary-200  divide-primary-500 dark:divide-primary-200 ",
    orange: "border-orange-300 dark:border-orange-800 divide-orange-300 dark:divide-orange-800",
    none: ""
  };
  let C;
  function w(G) {
    du.call(this, e, G);
  }
  function I(G) {
    du.call(this, e, G);
  }
  function M(G) {
    du.call(this, e, G);
  }
  function E(G) {
    du.call(this, e, G);
  }
  function T(G) {
    du.call(this, e, G);
  }
  function P(G) {
    du.call(this, e, G);
  }
  function k(G) {
    du.call(this, e, G);
  }
  function D(G) {
    du.call(this, e, G);
  }
  function B(G) {
    du.call(this, e, G);
  }
  function L(G) {
    du.call(this, e, G);
  }
  function F(G) {
    iE[G ? "unshift" : "push"](() => {
      p = G, n(0, p);
    });
  }
  function V(G) {
    iE[G ? "unshift" : "push"](() => {
      p = G, n(0, p);
    });
  }
  return e.$$set = (G) => {
    n(32, t = Zv(Zv({}, t), sE(G))), n(9, i = aE(t, r)), "tag" in G && n(1, u = G.tag), "color" in G && n(10, l = G.color), "rounded" in G && n(11, c = G.rounded), "border" in G && n(12, d = G.border), "shadow" in G && n(13, f = G.shadow), "node" in G && n(0, p = G.node), "use" in G && n(2, g = G.use), "options" in G && n(3, m = G.options), "role" in G && n(4, v = G.role), "transition" in G && n(5, h = G.transition), "params" in G && n(6, y = G.params), "open" in G && n(7, x = G.open), "$$scope" in G && n(14, o = G.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty[0] & /*open*/
    128 && S(x ? "open" : "close"), e.$$.dirty[0] & /*open*/
    128 && S("show", x), e.$$.dirty[0] & /*color*/
    1024 && n(10, l = l ?? "default"), e.$$.dirty[0] & /*color*/
    1024 && uE("color", l), n(8, C = T7(c0e[l], b[l], c && "rounded-lg", d && "border", _[l], f && "shadow-md", t.class));
  }, t = sE(t), [
    p,
    u,
    g,
    m,
    v,
    h,
    y,
    x,
    C,
    i,
    l,
    c,
    d,
    f,
    o,
    a,
    w,
    I,
    M,
    E,
    T,
    P,
    k,
    D,
    B,
    L,
    F,
    V
  ];
}
class f0e extends r0e {
  constructor(t) {
    super(), a0e(
      this,
      t,
      d0e,
      l0e,
      D7,
      {
        tag: 1,
        color: 10,
        rounded: 11,
        border: 12,
        shadow: 13,
        node: 0,
        use: 2,
        options: 3,
        role: 4,
        transition: 5,
        params: 6,
        open: 7
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent: m0e,
  assign: $0,
  bubble: Oi,
  check_outros: p0e,
  compute_rest_props: lE,
  create_slot: O7,
  detach: Ah,
  element: B7,
  empty: JN,
  exclude_internal_props: cE,
  get_all_dirty_from_scope: R7,
  get_slot_changes: L7,
  get_spread_update: N7,
  group_outros: h0e,
  init: g0e,
  insert: wh,
  listen: Fi,
  run_all: $N,
  safe_not_equal: eF,
  set_attributes: Jv,
  set_dynamic_element_data: dE,
  transition_in: wm,
  transition_out: Im,
  update_slot_base: F7
} = window.__gradio__svelte__internal, { getContext: v0e } = window.__gradio__svelte__internal;
function y0e(e) {
  let t = (
    /*tag*/
    e[2]
  ), n, r, i = (
    /*tag*/
    e[2] && Vb(e)
  );
  return {
    c() {
      i && i.c(), n = JN();
    },
    m(a, o) {
      i && i.m(a, o), wh(a, n, o), r = !0;
    },
    p(a, o) {
      /*tag*/
      a[2] ? t ? eF(
        t,
        /*tag*/
        a[2]
      ) ? (i.d(1), i = Vb(a), t = /*tag*/
      a[2], i.c(), i.m(n.parentNode, n)) : i.p(a, o) : (i = Vb(a), t = /*tag*/
      a[2], i.c(), i.m(n.parentNode, n)) : t && (i.d(1), i = null, t = /*tag*/
      a[2]);
    },
    i(a) {
      r || (wm(i, a), r = !0);
    },
    o(a) {
      Im(i, a), r = !1;
    },
    d(a) {
      a && Ah(n), i && i.d(a);
    }
  };
}
function b0e(e) {
  let t, n, r, i;
  const a = (
    /*#slots*/
    e[13].default
  ), o = O7(
    a,
    e,
    /*$$scope*/
    e[12],
    null
  );
  let s = [
    { type: (
      /*type*/
      e[1]
    ) },
    /*$$restProps*/
    e[5],
    { disabled: (
      /*disabled*/
      e[3]
    ) },
    { class: (
      /*buttonClass*/
      e[4]
    ) }
  ], u = {};
  for (let l = 0; l < s.length; l += 1)
    u = $0(u, s[l]);
  return {
    c() {
      t = B7("button"), o && o.c(), Jv(t, u);
    },
    m(l, c) {
      wh(l, t, c), o && o.m(t, null), t.autofocus && t.focus(), n = !0, r || (i = [
        Fi(
          t,
          "click",
          /*click_handler_1*/
          e[23]
        ),
        Fi(
          t,
          "change",
          /*change_handler_1*/
          e[24]
        ),
        Fi(
          t,
          "keydown",
          /*keydown_handler_1*/
          e[25]
        ),
        Fi(
          t,
          "keyup",
          /*keyup_handler_1*/
          e[26]
        ),
        Fi(
          t,
          "touchstart",
          /*touchstart_handler_1*/
          e[27],
          { passive: !0 }
        ),
        Fi(
          t,
          "touchend",
          /*touchend_handler_1*/
          e[28]
        ),
        Fi(
          t,
          "touchcancel",
          /*touchcancel_handler_1*/
          e[29]
        ),
        Fi(
          t,
          "mouseenter",
          /*mouseenter_handler_1*/
          e[30]
        ),
        Fi(
          t,
          "mouseleave",
          /*mouseleave_handler_1*/
          e[31]
        )
      ], r = !0);
    },
    p(l, c) {
      o && o.p && (!n || c[0] & /*$$scope*/
      4096) && F7(
        o,
        a,
        l,
        /*$$scope*/
        l[12],
        n ? L7(
          a,
          /*$$scope*/
          l[12],
          c,
          null
        ) : R7(
          /*$$scope*/
          l[12]
        ),
        null
      ), Jv(t, u = N7(s, [
        (!n || c[0] & /*type*/
        2) && { type: (
          /*type*/
          l[1]
        ) },
        c[0] & /*$$restProps*/
        32 && /*$$restProps*/
        l[5],
        (!n || c[0] & /*disabled*/
        8) && { disabled: (
          /*disabled*/
          l[3]
        ) },
        (!n || c[0] & /*buttonClass*/
        16) && { class: (
          /*buttonClass*/
          l[4]
        ) }
      ]));
    },
    i(l) {
      n || (wm(o, l), n = !0);
    },
    o(l) {
      Im(o, l), n = !1;
    },
    d(l) {
      l && Ah(t), o && o.d(l), r = !1, $N(i);
    }
  };
}
function _0e(e) {
  let t, n, r, i;
  const a = (
    /*#slots*/
    e[13].default
  ), o = O7(
    a,
    e,
    /*$$scope*/
    e[12],
    null
  );
  let s = [
    { href: (
      /*href*/
      e[0]
    ) },
    /*$$restProps*/
    e[5],
    { class: (
      /*buttonClass*/
      e[4]
    ) },
    { role: "button" }
  ], u = {};
  for (let l = 0; l < s.length; l += 1)
    u = $0(u, s[l]);
  return {
    c() {
      t = B7("a"), o && o.c(), Jv(t, u);
    },
    m(l, c) {
      wh(l, t, c), o && o.m(t, null), n = !0, r || (i = [
        Fi(
          t,
          "click",
          /*click_handler*/
          e[14]
        ),
        Fi(
          t,
          "change",
          /*change_handler*/
          e[15]
        ),
        Fi(
          t,
          "keydown",
          /*keydown_handler*/
          e[16]
        ),
        Fi(
          t,
          "keyup",
          /*keyup_handler*/
          e[17]
        ),
        Fi(
          t,
          "touchstart",
          /*touchstart_handler*/
          e[18],
          { passive: !0 }
        ),
        Fi(
          t,
          "touchend",
          /*touchend_handler*/
          e[19]
        ),
        Fi(
          t,
          "touchcancel",
          /*touchcancel_handler*/
          e[20]
        ),
        Fi(
          t,
          "mouseenter",
          /*mouseenter_handler*/
          e[21]
        ),
        Fi(
          t,
          "mouseleave",
          /*mouseleave_handler*/
          e[22]
        )
      ], r = !0);
    },
    p(l, c) {
      o && o.p && (!n || c[0] & /*$$scope*/
      4096) && F7(
        o,
        a,
        l,
        /*$$scope*/
        l[12],
        n ? L7(
          a,
          /*$$scope*/
          l[12],
          c,
          null
        ) : R7(
          /*$$scope*/
          l[12]
        ),
        null
      ), Jv(t, u = N7(s, [
        (!n || c[0] & /*href*/
        1) && { href: (
          /*href*/
          l[0]
        ) },
        c[0] & /*$$restProps*/
        32 && /*$$restProps*/
        l[5],
        (!n || c[0] & /*buttonClass*/
        16) && { class: (
          /*buttonClass*/
          l[4]
        ) },
        { role: "button" }
      ]));
    },
    i(l) {
      n || (wm(o, l), n = !0);
    },
    o(l) {
      Im(o, l), n = !1;
    },
    d(l) {
      l && Ah(t), o && o.d(l), r = !1, $N(i);
    }
  };
}
function Vb(e) {
  let t, n;
  const r = (
    /*#slots*/
    e[13].default
  ), i = O7(
    r,
    e,
    /*$$scope*/
    e[12],
    null
  );
  let a = [
    /*$$restProps*/
    e[5],
    { class: (
      /*buttonClass*/
      e[4]
    ) }
  ], o = {};
  for (let s = 0; s < a.length; s += 1)
    o = $0(o, a[s]);
  return {
    c() {
      t = B7(
        /*tag*/
        e[2]
      ), i && i.c(), dE(
        /*tag*/
        e[2]
      )(t, o);
    },
    m(s, u) {
      wh(s, t, u), i && i.m(t, null), n = !0;
    },
    p(s, u) {
      i && i.p && (!n || u[0] & /*$$scope*/
      4096) && F7(
        i,
        r,
        s,
        /*$$scope*/
        s[12],
        n ? L7(
          r,
          /*$$scope*/
          s[12],
          u,
          null
        ) : R7(
          /*$$scope*/
          s[12]
        ),
        null
      ), dE(
        /*tag*/
        s[2]
      )(t, o = N7(a, [
        u[0] & /*$$restProps*/
        32 && /*$$restProps*/
        s[5],
        (!n || u[0] & /*buttonClass*/
        16) && { class: (
          /*buttonClass*/
          s[4]
        ) }
      ]));
    },
    i(s) {
      n || (wm(i, s), n = !0);
    },
    o(s) {
      Im(i, s), n = !1;
    },
    d(s) {
      s && Ah(t), i && i.d(s);
    }
  };
}
function x0e(e) {
  let t, n, r, i;
  const a = [_0e, b0e, y0e], o = [];
  function s(u, l) {
    return (
      /*href*/
      u[0] && !/*disabled*/
      u[3] ? 0 : (
        /*tag*/
        u[2] === "button" ? 1 : 2
      )
    );
  }
  return t = s(e), n = o[t] = a[t](e), {
    c() {
      n.c(), r = JN();
    },
    m(u, l) {
      o[t].m(u, l), wh(u, r, l), i = !0;
    },
    p(u, l) {
      let c = t;
      t = s(u), t === c ? o[t].p(u, l) : (h0e(), Im(o[c], 1, 1, () => {
        o[c] = null;
      }), p0e(), n = o[t], n ? n.p(u, l) : (n = o[t] = a[t](u), n.c()), wm(n, 1), n.m(r.parentNode, r));
    },
    i(u) {
      i || (wm(n), i = !0);
    },
    o(u) {
      Im(n), i = !1;
    },
    d(u) {
      u && Ah(r), o[t].d(u);
    }
  };
}
function C0e(e, t, n) {
  const r = [
    "pill",
    "outline",
    "size",
    "href",
    "type",
    "color",
    "shadow",
    "tag",
    "checked",
    "disabled"
  ];
  let i = lE(t, r), { $$slots: a = {}, $$scope: o } = t;
  const s = v0e("group");
  let { pill: u = !1 } = t, { outline: l = !1 } = t, { size: c = s ? "sm" : "md" } = t, { href: d = void 0 } = t, { type: f = "button" } = t, { color: p = s ? l ? "dark" : "alternative" : "primary" } = t, { shadow: g = !1 } = t, { tag: m = "button" } = t, { checked: v = void 0 } = t, { disabled: h = !1 } = t;
  const y = {
    alternative: "text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400 hover:text-primary-700 focus-within:text-primary-700 dark:focus-within:text-white dark:hover:text-white dark:hover:bg-gray-700",
    blue: "text-white bg-blue-700 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700",
    dark: "text-white bg-gray-800 hover:bg-gray-900 dark:bg-gray-800 dark:hover:bg-gray-700",
    green: "text-white bg-green-700 hover:bg-green-800 dark:bg-green-600 dark:hover:bg-green-700",
    light: "text-gray-900 bg-white border border-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600",
    primary: "text-white bg-primary-700 hover:bg-primary-800 dark:bg-primary-600 dark:hover:bg-primary-700",
    purple: "text-white bg-purple-700 hover:bg-purple-800 dark:bg-purple-600 dark:hover:bg-purple-700",
    red: "text-white bg-red-700 hover:bg-red-800 dark:bg-red-600 dark:hover:bg-red-700",
    yellow: "text-white bg-yellow-400 hover:bg-yellow-500 ",
    none: ""
  }, x = {
    alternative: "text-primary-700 border dark:text-primary-500 bg-gray-100 dark:bg-gray-700 border-gray-300 shadow-gray-300 dark:shadow-gray-800 shadow-inner",
    blue: "text-blue-900 bg-blue-400 dark:bg-blue-500 shadow-blue-700 dark:shadow-blue-800 shadow-inner",
    dark: "text-white bg-gray-500 dark:bg-gray-600 shadow-gray-800 dark:shadow-gray-900 shadow-inner",
    green: "text-green-900 bg-green-400 dark:bg-green-500 shadow-green-700 dark:shadow-green-800 shadow-inner",
    light: "text-gray-900 bg-gray-100 border border-gray-300 dark:bg-gray-500 dark:text-gray-900 dark:border-gray-700 shadow-gray-300 dark:shadow-gray-700 shadow-inner",
    primary: "text-primary-900 bg-primary-400 dark:bg-primary-500 shadow-primary-700 dark:shadow-primary-800 shadow-inner",
    purple: "text-purple-900 bg-purple-400 dark:bg-purple-500 shadow-purple-700 dark:shadow-purple-800 shadow-inner",
    red: "text-red-900 bg-red-400 dark:bg-red-500 shadow-red-700 dark:shadow-red-800 shadow-inner",
    yellow: "text-yellow-900 bg-yellow-300 dark:bg-yellow-400 shadow-yellow-500 dark:shadow-yellow-700 shadow-inner",
    none: ""
  }, S = {
    alternative: "focus-within:ring-gray-200 dark:focus-within:ring-gray-700",
    blue: "focus-within:ring-blue-300 dark:focus-within:ring-blue-800",
    dark: "focus-within:ring-gray-300 dark:focus-within:ring-gray-700",
    green: "focus-within:ring-green-300 dark:focus-within:ring-green-800",
    light: "focus-within:ring-gray-200 dark:focus-within:ring-gray-700",
    primary: "focus-within:ring-primary-300 dark:focus-within:ring-primary-800",
    purple: "focus-within:ring-purple-300 dark:focus-within:ring-purple-900",
    red: "focus-within:ring-red-300 dark:focus-within:ring-red-900",
    yellow: "focus-within:ring-yellow-300 dark:focus-within:ring-yellow-900",
    none: ""
  }, b = {
    alternative: "shadow-gray-500/50 dark:shadow-gray-800/80",
    blue: "shadow-blue-500/50 dark:shadow-blue-800/80",
    dark: "shadow-gray-500/50 dark:shadow-gray-800/80",
    green: "shadow-green-500/50 dark:shadow-green-800/80",
    light: "shadow-gray-500/50 dark:shadow-gray-800/80",
    primary: "shadow-primary-500/50 dark:shadow-primary-800/80",
    purple: "shadow-purple-500/50 dark:shadow-purple-800/80",
    red: "shadow-red-500/50 dark:shadow-red-800/80 ",
    yellow: "shadow-yellow-500/50 dark:shadow-yellow-800/80 ",
    none: ""
  }, _ = {
    alternative: "text-gray-900 dark:text-gray-400 hover:text-white border border-gray-800 hover:bg-gray-900 focus-within:bg-gray-900 focus-within:text-white focus-within:ring-gray-300 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-600 dark:focus-within:ring-gray-800",
    blue: "text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-600",
    dark: "text-gray-900 hover:text-white border border-gray-800 hover:bg-gray-900 focus-within:bg-gray-900 focus-within:text-white dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-600",
    green: "text-green-700 hover:text-white border border-green-700 hover:bg-green-800 dark:border-green-500 dark:text-green-500 dark:hover:text-white dark:hover:bg-green-600",
    light: "text-gray-500 hover:text-gray-900 bg-white border border-gray-200 dark:border-gray-600 dark:hover:text-white dark:text-gray-400 hover:bg-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600",
    primary: "text-primary-700 hover:text-white border border-primary-700 hover:bg-primary-700 dark:border-primary-500 dark:text-primary-500 dark:hover:text-white dark:hover:bg-primary-600",
    purple: "text-purple-700 hover:text-white border border-purple-700 hover:bg-purple-800 dark:border-purple-400 dark:text-purple-400 dark:hover:text-white dark:hover:bg-purple-500",
    red: "text-red-700 hover:text-white border border-red-700 hover:bg-red-800 dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600",
    yellow: "text-yellow-400 hover:text-white border border-yellow-400 hover:bg-yellow-500 dark:border-yellow-300 dark:text-yellow-300 dark:hover:text-white dark:hover:bg-yellow-400",
    none: ""
  }, C = {
    xs: "px-3 py-2 text-xs",
    sm: "px-4 py-2 text-sm",
    md: "px-5 py-2.5 text-sm",
    lg: "px-5 py-3 text-base",
    xl: "px-6 py-3.5 text-base"
  }, w = () => l || p === "alternative" || p === "light";
  let I;
  function M(W) {
    Oi.call(this, e, W);
  }
  function E(W) {
    Oi.call(this, e, W);
  }
  function T(W) {
    Oi.call(this, e, W);
  }
  function P(W) {
    Oi.call(this, e, W);
  }
  function k(W) {
    Oi.call(this, e, W);
  }
  function D(W) {
    Oi.call(this, e, W);
  }
  function B(W) {
    Oi.call(this, e, W);
  }
  function L(W) {
    Oi.call(this, e, W);
  }
  function F(W) {
    Oi.call(this, e, W);
  }
  function V(W) {
    Oi.call(this, e, W);
  }
  function G(W) {
    Oi.call(this, e, W);
  }
  function H(W) {
    Oi.call(this, e, W);
  }
  function q(W) {
    Oi.call(this, e, W);
  }
  function z(W) {
    Oi.call(this, e, W);
  }
  function K(W) {
    Oi.call(this, e, W);
  }
  function Y(W) {
    Oi.call(this, e, W);
  }
  function Z(W) {
    Oi.call(this, e, W);
  }
  function X(W) {
    Oi.call(this, e, W);
  }
  return e.$$set = (W) => {
    n(40, t = $0($0({}, t), cE(W))), n(5, i = lE(t, r)), "pill" in W && n(6, u = W.pill), "outline" in W && n(7, l = W.outline), "size" in W && n(8, c = W.size), "href" in W && n(0, d = W.href), "type" in W && n(1, f = W.type), "color" in W && n(9, p = W.color), "shadow" in W && n(10, g = W.shadow), "tag" in W && n(2, m = W.tag), "checked" in W && n(11, v = W.checked), "disabled" in W && n(3, h = W.disabled), "$$scope" in W && n(12, o = W.$$scope);
  }, e.$$.update = () => {
    n(4, I = T7(
      "text-center font-medium",
      s ? "focus-within:ring-2" : "focus-within:ring-4",
      s && "focus-within:z-10",
      s || "focus-within:outline-none",
      "inline-flex items-center justify-center " + C[c],
      l && v && "border dark:border-gray-900",
      l && v && x[p],
      l && !v && _[p],
      !l && v && x[p],
      !l && !v && y[p],
      p === "alternative" && (s && !v ? "dark:bg-gray-700 dark:text-white dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-600" : "dark:bg-transparent dark:border-gray-600 dark:hover:border-gray-600"),
      l && p === "dark" && (s ? v ? "bg-gray-900 border-gray-800 dark:border-white dark:bg-gray-600" : "dark:text-white border-gray-800 dark:border-white" : "dark:text-gray-400 dark:border-gray-700"),
      S[p],
      w() && s && "[&:not(:first-child)]:-ms-px",
      s ? u && "first:rounded-s-full last:rounded-e-full" || "first:rounded-s-lg last:rounded-e-lg" : u && "rounded-full" || "rounded-lg",
      g && "shadow-lg",
      g && b[p],
      h && "cursor-not-allowed opacity-50",
      t.class
    ));
  }, t = cE(t), [
    d,
    f,
    m,
    h,
    I,
    i,
    u,
    l,
    c,
    p,
    g,
    v,
    o,
    a,
    M,
    E,
    T,
    P,
    k,
    D,
    B,
    L,
    F,
    V,
    G,
    H,
    q,
    z,
    K,
    Y,
    Z,
    X
  ];
}
class $v extends m0e {
  constructor(t) {
    super(), g0e(
      this,
      t,
      C0e,
      x0e,
      eF,
      {
        pill: 6,
        outline: 7,
        size: 8,
        href: 0,
        type: 1,
        color: 9,
        shadow: 10,
        tag: 2,
        checked: 11,
        disabled: 3
      },
      null,
      [-1, -1]
    );
  }
}
const Pm = Math.min, vf = Math.max, e3 = Math.round, lg = Math.floor, dd = (e) => ({
  x: e,
  y: e
}), S0e = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
}, A0e = {
  start: "end",
  end: "start"
};
function b6(e, t, n) {
  return vf(e, Pm(t, n));
}
function Ih(e, t) {
  return typeof e == "function" ? e(t) : e;
}
function kf(e) {
  return e.split("-")[0];
}
function Ph(e) {
  return e.split("-")[1];
}
function tF(e) {
  return e === "x" ? "y" : "x";
}
function V7(e) {
  return e === "y" ? "height" : "width";
}
function Mm(e) {
  return ["top", "bottom"].includes(kf(e)) ? "y" : "x";
}
function G7(e) {
  return tF(Mm(e));
}
function w0e(e, t, n) {
  n === void 0 && (n = !1);
  const r = Ph(e), i = G7(e), a = V7(i);
  let o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
  return t.reference[a] > t.floating[a] && (o = t3(o)), [o, t3(o)];
}
function I0e(e) {
  const t = t3(e);
  return [_6(e), t, _6(t)];
}
function _6(e) {
  return e.replace(/start|end/g, (t) => A0e[t]);
}
function P0e(e, t, n) {
  const r = ["left", "right"], i = ["right", "left"], a = ["top", "bottom"], o = ["bottom", "top"];
  switch (e) {
    case "top":
    case "bottom":
      return n ? t ? i : r : t ? r : i;
    case "left":
    case "right":
      return t ? a : o;
    default:
      return [];
  }
}
function M0e(e, t, n, r) {
  const i = Ph(e);
  let a = P0e(kf(e), n === "start", r);
  return i && (a = a.map((o) => o + "-" + i), t && (a = a.concat(a.map(_6)))), a;
}
function t3(e) {
  return e.replace(/left|right|bottom|top/g, (t) => S0e[t]);
}
function E0e(e) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...e
  };
}
function nF(e) {
  return typeof e != "number" ? E0e(e) : {
    top: e,
    right: e,
    bottom: e,
    left: e
  };
}
function n3(e) {
  const {
    x: t,
    y: n,
    width: r,
    height: i
  } = e;
  return {
    width: r,
    height: i,
    top: n,
    left: t,
    right: t + r,
    bottom: n + i,
    x: t,
    y: n
  };
}
function fE(e, t, n) {
  let {
    reference: r,
    floating: i
  } = e;
  const a = Mm(t), o = G7(t), s = V7(o), u = kf(t), l = a === "y", c = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2;
  let p;
  switch (u) {
    case "top":
      p = {
        x: c,
        y: r.y - i.height
      };
      break;
    case "bottom":
      p = {
        x: c,
        y: r.y + r.height
      };
      break;
    case "right":
      p = {
        x: r.x + r.width,
        y: d
      };
      break;
    case "left":
      p = {
        x: r.x - i.width,
        y: d
      };
      break;
    default:
      p = {
        x: r.x,
        y: r.y
      };
  }
  switch (Ph(t)) {
    case "start":
      p[o] -= f * (n && l ? -1 : 1);
      break;
    case "end":
      p[o] += f * (n && l ? -1 : 1);
      break;
  }
  return p;
}
const T0e = async (e, t, n) => {
  const {
    placement: r = "bottom",
    strategy: i = "absolute",
    middleware: a = [],
    platform: o
  } = n, s = a.filter(Boolean), u = await (o.isRTL == null ? void 0 : o.isRTL(t));
  let l = await o.getElementRects({
    reference: e,
    floating: t,
    strategy: i
  }), {
    x: c,
    y: d
  } = fE(l, r, u), f = r, p = {}, g = 0;
  for (let m = 0; m < s.length; m++) {
    const {
      name: v,
      fn: h
    } = s[m], {
      x: y,
      y: x,
      data: S,
      reset: b
    } = await h({
      x: c,
      y: d,
      initialPlacement: r,
      placement: f,
      strategy: i,
      middlewareData: p,
      rects: l,
      platform: o,
      elements: {
        reference: e,
        floating: t
      }
    });
    c = y ?? c, d = x ?? d, p = {
      ...p,
      [v]: {
        ...p[v],
        ...S
      }
    }, b && g <= 50 && (g++, typeof b == "object" && (b.placement && (f = b.placement), b.rects && (l = b.rects === !0 ? await o.getElementRects({
      reference: e,
      floating: t,
      strategy: i
    }) : b.rects), {
      x: c,
      y: d
    } = fE(l, f, u)), m = -1);
  }
  return {
    x: c,
    y: d,
    placement: f,
    strategy: i,
    middlewareData: p
  };
};
async function rF(e, t) {
  var n;
  t === void 0 && (t = {});
  const {
    x: r,
    y: i,
    platform: a,
    rects: o,
    elements: s,
    strategy: u
  } = e, {
    boundary: l = "clippingAncestors",
    rootBoundary: c = "viewport",
    elementContext: d = "floating",
    altBoundary: f = !1,
    padding: p = 0
  } = Ih(t, e), g = nF(p), v = s[f ? d === "floating" ? "reference" : "floating" : d], h = n3(await a.getClippingRect({
    element: (n = await (a.isElement == null ? void 0 : a.isElement(v))) == null || n ? v : v.contextElement || await (a.getDocumentElement == null ? void 0 : a.getDocumentElement(s.floating)),
    boundary: l,
    rootBoundary: c,
    strategy: u
  })), y = d === "floating" ? {
    x: r,
    y: i,
    width: o.floating.width,
    height: o.floating.height
  } : o.reference, x = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(s.floating)), S = await (a.isElement == null ? void 0 : a.isElement(x)) ? await (a.getScale == null ? void 0 : a.getScale(x)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  }, b = n3(a.convertOffsetParentRelativeRectToViewportRelativeRect ? await a.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements: s,
    rect: y,
    offsetParent: x,
    strategy: u
  }) : y);
  return {
    top: (h.top - b.top + g.top) / S.y,
    bottom: (b.bottom - h.bottom + g.bottom) / S.y,
    left: (h.left - b.left + g.left) / S.x,
    right: (b.right - h.right + g.right) / S.x
  };
}
const k0e = (e) => ({
  name: "arrow",
  options: e,
  async fn(t) {
    const {
      x: n,
      y: r,
      placement: i,
      rects: a,
      platform: o,
      elements: s,
      middlewareData: u
    } = t, {
      element: l,
      padding: c = 0
    } = Ih(e, t) || {};
    if (l == null)
      return {};
    const d = nF(c), f = {
      x: n,
      y: r
    }, p = G7(i), g = V7(p), m = await o.getDimensions(l), v = p === "y", h = v ? "top" : "left", y = v ? "bottom" : "right", x = v ? "clientHeight" : "clientWidth", S = a.reference[g] + a.reference[p] - f[p] - a.floating[g], b = f[p] - a.reference[p], _ = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l));
    let C = _ ? _[x] : 0;
    (!C || !await (o.isElement == null ? void 0 : o.isElement(_))) && (C = s.floating[x] || a.floating[g]);
    const w = S / 2 - b / 2, I = C / 2 - m[g] / 2 - 1, M = Pm(d[h], I), E = Pm(d[y], I), T = M, P = C - m[g] - E, k = C / 2 - m[g] / 2 + w, D = b6(T, k, P), B = !u.arrow && Ph(i) != null && k !== D && a.reference[g] / 2 - (k < T ? M : E) - m[g] / 2 < 0, L = B ? k < T ? k - T : k - P : 0;
    return {
      [p]: f[p] + L,
      data: {
        [p]: D,
        centerOffset: k - D - L,
        ...B && {
          alignmentOffset: L
        }
      },
      reset: B
    };
  }
}), D0e = function(e) {
  return e === void 0 && (e = {}), {
    name: "flip",
    options: e,
    async fn(t) {
      var n, r;
      const {
        placement: i,
        middlewareData: a,
        rects: o,
        initialPlacement: s,
        platform: u,
        elements: l
      } = t, {
        mainAxis: c = !0,
        crossAxis: d = !0,
        fallbackPlacements: f,
        fallbackStrategy: p = "bestFit",
        fallbackAxisSideDirection: g = "none",
        flipAlignment: m = !0,
        ...v
      } = Ih(e, t);
      if ((n = a.arrow) != null && n.alignmentOffset)
        return {};
      const h = kf(i), y = Mm(s), x = kf(s) === s, S = await (u.isRTL == null ? void 0 : u.isRTL(l.floating)), b = f || (x || !m ? [t3(s)] : I0e(s)), _ = g !== "none";
      !f && _ && b.push(...M0e(s, m, g, S));
      const C = [s, ...b], w = await rF(t, v), I = [];
      let M = ((r = a.flip) == null ? void 0 : r.overflows) || [];
      if (c && I.push(w[h]), d) {
        const k = w0e(i, o, S);
        I.push(w[k[0]], w[k[1]]);
      }
      if (M = [...M, {
        placement: i,
        overflows: I
      }], !I.every((k) => k <= 0)) {
        var E, T;
        const k = (((E = a.flip) == null ? void 0 : E.index) || 0) + 1, D = C[k];
        if (D)
          return {
            data: {
              index: k,
              overflows: M
            },
            reset: {
              placement: D
            }
          };
        let B = (T = M.filter((L) => L.overflows[0] <= 0).sort((L, F) => L.overflows[1] - F.overflows[1])[0]) == null ? void 0 : T.placement;
        if (!B)
          switch (p) {
            case "bestFit": {
              var P;
              const L = (P = M.filter((F) => {
                if (_) {
                  const V = Mm(F.placement);
                  return V === y || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  V === "y";
                }
                return !0;
              }).map((F) => [F.placement, F.overflows.filter((V) => V > 0).reduce((V, G) => V + G, 0)]).sort((F, V) => F[1] - V[1])[0]) == null ? void 0 : P[0];
              L && (B = L);
              break;
            }
            case "initialPlacement":
              B = s;
              break;
          }
        if (i !== B)
          return {
            reset: {
              placement: B
            }
          };
      }
      return {};
    }
  };
};
async function O0e(e, t) {
  const {
    placement: n,
    platform: r,
    elements: i
  } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = kf(n), s = Ph(n), u = Mm(n) === "y", l = ["left", "top"].includes(o) ? -1 : 1, c = a && u ? -1 : 1, d = Ih(t, e);
  let {
    mainAxis: f,
    crossAxis: p,
    alignmentAxis: g
  } = typeof d == "number" ? {
    mainAxis: d,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: 0,
    crossAxis: 0,
    alignmentAxis: null,
    ...d
  };
  return s && typeof g == "number" && (p = s === "end" ? g * -1 : g), u ? {
    x: p * c,
    y: f * l
  } : {
    x: f * l,
    y: p * c
  };
}
const B0e = function(e) {
  return e === void 0 && (e = 0), {
    name: "offset",
    options: e,
    async fn(t) {
      var n, r;
      const {
        x: i,
        y: a,
        placement: o,
        middlewareData: s
      } = t, u = await O0e(t, e);
      return o === ((n = s.offset) == null ? void 0 : n.placement) && (r = s.arrow) != null && r.alignmentOffset ? {} : {
        x: i + u.x,
        y: a + u.y,
        data: {
          ...u,
          placement: o
        }
      };
    }
  };
}, R0e = function(e) {
  return e === void 0 && (e = {}), {
    name: "shift",
    options: e,
    async fn(t) {
      const {
        x: n,
        y: r,
        placement: i
      } = t, {
        mainAxis: a = !0,
        crossAxis: o = !1,
        limiter: s = {
          fn: (v) => {
            let {
              x: h,
              y
            } = v;
            return {
              x: h,
              y
            };
          }
        },
        ...u
      } = Ih(e, t), l = {
        x: n,
        y: r
      }, c = await rF(t, u), d = Mm(kf(i)), f = tF(d);
      let p = l[f], g = l[d];
      if (a) {
        const v = f === "y" ? "top" : "left", h = f === "y" ? "bottom" : "right", y = p + c[v], x = p - c[h];
        p = b6(y, p, x);
      }
      if (o) {
        const v = d === "y" ? "top" : "left", h = d === "y" ? "bottom" : "right", y = g + c[v], x = g - c[h];
        g = b6(y, g, x);
      }
      const m = s.fn({
        ...t,
        [f]: p,
        [d]: g
      });
      return {
        ...m,
        data: {
          x: m.x - n,
          y: m.y - r
        }
      };
    }
  };
};
function Xm(e) {
  return iF(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function xo(e) {
  var t;
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function Jl(e) {
  var t;
  return (t = (iF(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function iF(e) {
  return e instanceof Node || e instanceof xo(e).Node;
}
function Lu(e) {
  return e instanceof Element || e instanceof xo(e).Element;
}
function Nu(e) {
  return e instanceof HTMLElement || e instanceof xo(e).HTMLElement;
}
function mE(e) {
  return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof xo(e).ShadowRoot;
}
function Mh(e) {
  const {
    overflow: t,
    overflowX: n,
    overflowY: r,
    display: i
  } = Ys(e);
  return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(i);
}
function L0e(e) {
  return ["table", "td", "th"].includes(Xm(e));
}
function $3(e) {
  return [":popover-open", ":modal"].some((t) => {
    try {
      return e.matches(t);
    } catch {
      return !1;
    }
  });
}
function z7(e) {
  const t = U7(), n = Ys(e);
  return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
}
function N0e(e) {
  let t = fd(e);
  for (; Nu(t) && !Em(t); ) {
    if ($3(t))
      return null;
    if (z7(t))
      return t;
    t = fd(t);
  }
  return null;
}
function U7() {
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function Em(e) {
  return ["html", "body", "#document"].includes(Xm(e));
}
function Ys(e) {
  return xo(e).getComputedStyle(e);
}
function ey(e) {
  return Lu(e) ? {
    scrollLeft: e.scrollLeft,
    scrollTop: e.scrollTop
  } : {
    scrollLeft: e.scrollX,
    scrollTop: e.scrollY
  };
}
function fd(e) {
  if (Xm(e) === "html")
    return e;
  const t = (
    // Step into the shadow DOM of the parent of a slotted node.
    e.assignedSlot || // DOM Element detected.
    e.parentNode || // ShadowRoot detected.
    mE(e) && e.host || // Fallback.
    Jl(e)
  );
  return mE(t) ? t.host : t;
}
function aF(e) {
  const t = fd(e);
  return Em(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : Nu(t) && Mh(t) ? t : aF(t);
}
function eh(e, t, n) {
  var r;
  t === void 0 && (t = []), n === void 0 && (n = !0);
  const i = aF(e), a = i === ((r = e.ownerDocument) == null ? void 0 : r.body), o = xo(i);
  return a ? t.concat(o, o.visualViewport || [], Mh(i) ? i : [], o.frameElement && n ? eh(o.frameElement) : []) : t.concat(i, eh(i, [], n));
}
function oF(e) {
  const t = Ys(e);
  let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
  const i = Nu(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = e3(n) !== a || e3(r) !== o;
  return s && (n = a, r = o), {
    width: n,
    height: r,
    $: s
  };
}
function H7(e) {
  return Lu(e) ? e : e.contextElement;
}
function Y1(e) {
  const t = H7(e);
  if (!Nu(t))
    return dd(1);
  const n = t.getBoundingClientRect(), {
    width: r,
    height: i,
    $: a
  } = oF(t);
  let o = (a ? e3(n.width) : n.width) / r, s = (a ? e3(n.height) : n.height) / i;
  return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
    x: o,
    y: s
  };
}
const F0e = /* @__PURE__ */ dd(0);
function sF(e) {
  const t = xo(e);
  return !U7() || !t.visualViewport ? F0e : {
    x: t.visualViewport.offsetLeft,
    y: t.visualViewport.offsetTop
  };
}
function V0e(e, t, n) {
  return t === void 0 && (t = !1), !n || t && n !== xo(e) ? !1 : t;
}
function Df(e, t, n, r) {
  t === void 0 && (t = !1), n === void 0 && (n = !1);
  const i = e.getBoundingClientRect(), a = H7(e);
  let o = dd(1);
  t && (r ? Lu(r) && (o = Y1(r)) : o = Y1(e));
  const s = V0e(a, n, r) ? sF(a) : dd(0);
  let u = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, c = i.width / o.x, d = i.height / o.y;
  if (a) {
    const f = xo(a), p = r && Lu(r) ? xo(r) : r;
    let g = f, m = g.frameElement;
    for (; m && r && p !== g; ) {
      const v = Y1(m), h = m.getBoundingClientRect(), y = Ys(m), x = h.left + (m.clientLeft + parseFloat(y.paddingLeft)) * v.x, S = h.top + (m.clientTop + parseFloat(y.paddingTop)) * v.y;
      u *= v.x, l *= v.y, c *= v.x, d *= v.y, u += x, l += S, g = xo(m), m = g.frameElement;
    }
  }
  return n3({
    width: c,
    height: d,
    x: u,
    y: l
  });
}
function G0e(e) {
  let {
    elements: t,
    rect: n,
    offsetParent: r,
    strategy: i
  } = e;
  const a = i === "fixed", o = Jl(r), s = t ? $3(t.floating) : !1;
  if (r === o || s && a)
    return n;
  let u = {
    scrollLeft: 0,
    scrollTop: 0
  }, l = dd(1);
  const c = dd(0), d = Nu(r);
  if ((d || !d && !a) && ((Xm(r) !== "body" || Mh(o)) && (u = ey(r)), Nu(r))) {
    const f = Df(r);
    l = Y1(r), c.x = f.x + r.clientLeft, c.y = f.y + r.clientTop;
  }
  return {
    width: n.width * l.x,
    height: n.height * l.y,
    x: n.x * l.x - u.scrollLeft * l.x + c.x,
    y: n.y * l.y - u.scrollTop * l.y + c.y
  };
}
function z0e(e) {
  return Array.from(e.getClientRects());
}
function uF(e) {
  return Df(Jl(e)).left + ey(e).scrollLeft;
}
function U0e(e) {
  const t = Jl(e), n = ey(e), r = e.ownerDocument.body, i = vf(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = vf(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
  let o = -n.scrollLeft + uF(e);
  const s = -n.scrollTop;
  return Ys(r).direction === "rtl" && (o += vf(t.clientWidth, r.clientWidth) - i), {
    width: i,
    height: a,
    x: o,
    y: s
  };
}
function H0e(e, t) {
  const n = xo(e), r = Jl(e), i = n.visualViewport;
  let a = r.clientWidth, o = r.clientHeight, s = 0, u = 0;
  if (i) {
    a = i.width, o = i.height;
    const l = U7();
    (!l || l && t === "fixed") && (s = i.offsetLeft, u = i.offsetTop);
  }
  return {
    width: a,
    height: o,
    x: s,
    y: u
  };
}
function q0e(e, t) {
  const n = Df(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = Nu(e) ? Y1(e) : dd(1), o = e.clientWidth * a.x, s = e.clientHeight * a.y, u = i * a.x, l = r * a.y;
  return {
    width: o,
    height: s,
    x: u,
    y: l
  };
}
function pE(e, t, n) {
  let r;
  if (t === "viewport")
    r = H0e(e, n);
  else if (t === "document")
    r = U0e(Jl(e));
  else if (Lu(t))
    r = q0e(t, n);
  else {
    const i = sF(e);
    r = {
      ...t,
      x: t.x - i.x,
      y: t.y - i.y
    };
  }
  return n3(r);
}
function lF(e, t) {
  const n = fd(e);
  return n === t || !Lu(n) || Em(n) ? !1 : Ys(n).position === "fixed" || lF(n, t);
}
function j0e(e, t) {
  const n = t.get(e);
  if (n)
    return n;
  let r = eh(e, [], !1).filter((s) => Lu(s) && Xm(s) !== "body"), i = null;
  const a = Ys(e).position === "fixed";
  let o = a ? fd(e) : e;
  for (; Lu(o) && !Em(o); ) {
    const s = Ys(o), u = z7(o);
    !u && s.position === "fixed" && (i = null), (a ? !u && !i : !u && s.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || Mh(o) && !u && lF(e, o)) ? r = r.filter((c) => c !== o) : i = s, o = fd(o);
  }
  return t.set(e, r), r;
}
function K0e(e) {
  let {
    element: t,
    boundary: n,
    rootBoundary: r,
    strategy: i
  } = e;
  const o = [...n === "clippingAncestors" ? $3(t) ? [] : j0e(t, this._c) : [].concat(n), r], s = o[0], u = o.reduce((l, c) => {
    const d = pE(t, c, i);
    return l.top = vf(d.top, l.top), l.right = Pm(d.right, l.right), l.bottom = Pm(d.bottom, l.bottom), l.left = vf(d.left, l.left), l;
  }, pE(t, s, i));
  return {
    width: u.right - u.left,
    height: u.bottom - u.top,
    x: u.left,
    y: u.top
  };
}
function Y0e(e) {
  const {
    width: t,
    height: n
  } = oF(e);
  return {
    width: t,
    height: n
  };
}
function W0e(e, t, n) {
  const r = Nu(t), i = Jl(t), a = n === "fixed", o = Df(e, !0, a, t);
  let s = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const u = dd(0);
  if (r || !r && !a)
    if ((Xm(t) !== "body" || Mh(i)) && (s = ey(t)), r) {
      const d = Df(t, !0, a, t);
      u.x = d.x + t.clientLeft, u.y = d.y + t.clientTop;
    } else i && (u.x = uF(i));
  const l = o.left + s.scrollLeft - u.x, c = o.top + s.scrollTop - u.y;
  return {
    x: l,
    y: c,
    width: o.width,
    height: o.height
  };
}
function Gb(e) {
  return Ys(e).position === "static";
}
function hE(e, t) {
  return !Nu(e) || Ys(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
}
function cF(e, t) {
  const n = xo(e);
  if ($3(e))
    return n;
  if (!Nu(e)) {
    let i = fd(e);
    for (; i && !Em(i); ) {
      if (Lu(i) && !Gb(i))
        return i;
      i = fd(i);
    }
    return n;
  }
  let r = hE(e, t);
  for (; r && L0e(r) && Gb(r); )
    r = hE(r, t);
  return r && Em(r) && Gb(r) && !z7(r) ? n : r || N0e(e) || n;
}
const X0e = async function(e) {
  const t = this.getOffsetParent || cF, n = this.getDimensions, r = await n(e.floating);
  return {
    reference: W0e(e.reference, await t(e.floating), e.strategy),
    floating: {
      x: 0,
      y: 0,
      width: r.width,
      height: r.height
    }
  };
};
function Z0e(e) {
  return Ys(e).direction === "rtl";
}
const Q0e = {
  convertOffsetParentRelativeRectToViewportRelativeRect: G0e,
  getDocumentElement: Jl,
  getClippingRect: K0e,
  getOffsetParent: cF,
  getElementRects: X0e,
  getClientRects: z0e,
  getDimensions: Y0e,
  getScale: Y1,
  isElement: Lu,
  isRTL: Z0e
};
function J0e(e, t) {
  let n = null, r;
  const i = Jl(e);
  function a() {
    var s;
    clearTimeout(r), (s = n) == null || s.disconnect(), n = null;
  }
  function o(s, u) {
    s === void 0 && (s = !1), u === void 0 && (u = 1), a();
    const {
      left: l,
      top: c,
      width: d,
      height: f
    } = e.getBoundingClientRect();
    if (s || t(), !d || !f)
      return;
    const p = lg(c), g = lg(i.clientWidth - (l + d)), m = lg(i.clientHeight - (c + f)), v = lg(l), y = {
      rootMargin: -p + "px " + -g + "px " + -m + "px " + -v + "px",
      threshold: vf(0, Pm(1, u)) || 1
    };
    let x = !0;
    function S(b) {
      const _ = b[0].intersectionRatio;
      if (_ !== u) {
        if (!x)
          return o();
        _ ? o(!1, _) : r = setTimeout(() => {
          o(!1, 1e-7);
        }, 1e3);
      }
      x = !1;
    }
    try {
      n = new IntersectionObserver(S, {
        ...y,
        // Handle <iframe>s
        root: i.ownerDocument
      });
    } catch {
      n = new IntersectionObserver(S, y);
    }
    n.observe(e);
  }
  return o(!0), a;
}
function gE(e, t, n, r) {
  r === void 0 && (r = {});
  const {
    ancestorScroll: i = !0,
    ancestorResize: a = !0,
    elementResize: o = typeof ResizeObserver == "function",
    layoutShift: s = typeof IntersectionObserver == "function",
    animationFrame: u = !1
  } = r, l = H7(e), c = i || a ? [...l ? eh(l) : [], ...eh(t)] : [];
  c.forEach((h) => {
    i && h.addEventListener("scroll", n, {
      passive: !0
    }), a && h.addEventListener("resize", n);
  });
  const d = l && s ? J0e(l, n) : null;
  let f = -1, p = null;
  o && (p = new ResizeObserver((h) => {
    let [y] = h;
    y && y.target === l && p && (p.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
      var x;
      (x = p) == null || x.observe(t);
    })), n();
  }), l && !u && p.observe(l), p.observe(t));
  let g, m = u ? Df(e) : null;
  u && v();
  function v() {
    const h = Df(e);
    m && (h.x !== m.x || h.y !== m.y || h.width !== m.width || h.height !== m.height) && n(), m = h, g = requestAnimationFrame(v);
  }
  return n(), () => {
    var h;
    c.forEach((y) => {
      i && y.removeEventListener("scroll", n), a && y.removeEventListener("resize", n);
    }), d == null || d(), (h = p) == null || h.disconnect(), p = null, u && cancelAnimationFrame(g);
  };
}
const $0e = B0e, ehe = R0e, the = D0e, nhe = k0e, rhe = (e, t, n) => {
  const r = /* @__PURE__ */ new Map(), i = {
    platform: Q0e,
    ...n
  }, a = {
    ...i.platform,
    _c: r
  };
  return T0e(e, t, {
    ...i,
    platform: a
  });
}, {
  SvelteComponent: ihe,
  action_destroyer: ahe,
  add_flush_callback: ohe,
  assign: x6,
  attr: vE,
  bind: she,
  binding_callbacks: dF,
  check_outros: uhe,
  compute_rest_props: yE,
  create_component: lhe,
  create_slot: che,
  destroy_component: dhe,
  detach: Tm,
  element: fF,
  empty: mF,
  exclude_internal_props: bE,
  get_all_dirty_from_scope: fhe,
  get_slot_changes: mhe,
  get_spread_object: phe,
  get_spread_update: hhe,
  group_outros: ghe,
  init: vhe,
  insert: km,
  is_function: cg,
  mount_component: yhe,
  noop: bhe,
  safe_not_equal: _he,
  space: pF,
  transition_in: _0,
  transition_out: r3,
  update_slot_base: xhe
} = window.__gradio__svelte__internal, { onMount: Che, createEventDispatcher: She } = window.__gradio__svelte__internal;
function _E(e) {
  let t;
  return {
    c() {
      t = fF("div");
    },
    m(n, r) {
      km(n, t, r), e[23](t);
    },
    p: bhe,
    d(n) {
      n && Tm(t), e[23](null);
    }
  };
}
function xE(e) {
  let t, n, r;
  const i = [
    { use: (
      /*init*/
      e[9]
    ) },
    { options: (
      /*referenceEl*/
      e[3]
    ) },
    { role: "tooltip" },
    {
      tabindex: (
        /*activeContent*/
        e[1] ? -1 : void 0
      )
    },
    /*$$restProps*/
    e[11]
  ];
  function a(s) {
    e[24](s);
  }
  let o = {
    $$slots: { default: [Ahe] },
    $$scope: { ctx: e }
  };
  for (let s = 0; s < i.length; s += 1)
    o = x6(o, i[s]);
  return (
    /*open*/
    e[0] !== void 0 && (o.open = /*open*/
    e[0]), t = new f0e({ props: o }), dF.push(() => she(t, "open", a)), t.$on("focusin", function() {
      cg(Ic(
        /*activeContent*/
        e[1],
        /*showHandler*/
        e[7]
      )) && Ic(
        /*activeContent*/
        e[1],
        /*showHandler*/
        e[7]
      ).apply(this, arguments);
    }), t.$on("focusout", function() {
      cg(Ic(
        /*activeContent*/
        e[1],
        /*hideHandler*/
        e[8]
      )) && Ic(
        /*activeContent*/
        e[1],
        /*hideHandler*/
        e[8]
      ).apply(this, arguments);
    }), t.$on("mouseenter", function() {
      cg(Ic(
        /*activeContent*/
        e[1] && /*hoverable*/
        e[4],
        /*showHandler*/
        e[7]
      )) && Ic(
        /*activeContent*/
        e[1] && /*hoverable*/
        e[4],
        /*showHandler*/
        e[7]
      ).apply(this, arguments);
    }), t.$on("mouseleave", function() {
      cg(Ic(
        /*activeContent*/
        e[1] && /*hoverable*/
        e[4],
        /*hideHandler*/
        e[8]
      )) && Ic(
        /*activeContent*/
        e[1] && /*hoverable*/
        e[4],
        /*hideHandler*/
        e[8]
      ).apply(this, arguments);
    }), {
      c() {
        lhe(t.$$.fragment);
      },
      m(s, u) {
        yhe(t, s, u), r = !0;
      },
      p(s, u) {
        e = s;
        const l = u[0] & /*init, referenceEl, activeContent, $$restProps*/
        2570 ? hhe(i, [
          u[0] & /*init*/
          512 && { use: (
            /*init*/
            e[9]
          ) },
          u[0] & /*referenceEl*/
          8 && { options: (
            /*referenceEl*/
            e[3]
          ) },
          i[2],
          u[0] & /*activeContent*/
          2 && {
            tabindex: (
              /*activeContent*/
              e[1] ? -1 : void 0
            )
          },
          u[0] & /*$$restProps*/
          2048 && phe(
            /*$$restProps*/
            e[11]
          )
        ]) : {};
        u[0] & /*$$scope, arrowClass, arrow*/
        33554500 && (l.$$scope = { dirty: u, ctx: e }), !n && u[0] & /*open*/
        1 && (n = !0, l.open = /*open*/
        e[0], ohe(() => n = !1)), t.$set(l);
      },
      i(s) {
        r || (_0(t.$$.fragment, s), r = !0);
      },
      o(s) {
        r3(t.$$.fragment, s), r = !1;
      },
      d(s) {
        dhe(t, s);
      }
    }
  );
}
function CE(e) {
  let t, n, r;
  return {
    c() {
      t = fF("div"), vE(
        t,
        "class",
        /*arrowClass*/
        e[6]
      );
    },
    m(i, a) {
      km(i, t, a), n || (r = ahe(
        /*initArrow*/
        e[10].call(null, t)
      ), n = !0);
    },
    p(i, a) {
      a[0] & /*arrowClass*/
      64 && vE(
        t,
        "class",
        /*arrowClass*/
        i[6]
      );
    },
    d(i) {
      i && Tm(t), n = !1, r();
    }
  };
}
function Ahe(e) {
  let t, n, r;
  const i = (
    /*#slots*/
    e[22].default
  ), a = che(
    i,
    e,
    /*$$scope*/
    e[25],
    null
  );
  let o = (
    /*arrow*/
    e[2] && CE(e)
  );
  return {
    c() {
      a && a.c(), t = pF(), o && o.c(), n = mF();
    },
    m(s, u) {
      a && a.m(s, u), km(s, t, u), o && o.m(s, u), km(s, n, u), r = !0;
    },
    p(s, u) {
      a && a.p && (!r || u[0] & /*$$scope*/
      33554432) && xhe(
        a,
        i,
        s,
        /*$$scope*/
        s[25],
        r ? mhe(
          i,
          /*$$scope*/
          s[25],
          u,
          null
        ) : fhe(
          /*$$scope*/
          s[25]
        ),
        null
      ), /*arrow*/
      s[2] ? o ? o.p(s, u) : (o = CE(s), o.c(), o.m(n.parentNode, n)) : o && (o.d(1), o = null);
    },
    i(s) {
      r || (_0(a, s), r = !0);
    },
    o(s) {
      r3(a, s), r = !1;
    },
    d(s) {
      s && (Tm(t), Tm(n)), a && a.d(s), o && o.d(s);
    }
  };
}
function whe(e) {
  let t, n, r, i = !/*referenceEl*/
  e[3] && _E(e), a = (
    /*referenceEl*/
    e[3] && xE(e)
  );
  return {
    c() {
      i && i.c(), t = pF(), a && a.c(), n = mF();
    },
    m(o, s) {
      i && i.m(o, s), km(o, t, s), a && a.m(o, s), km(o, n, s), r = !0;
    },
    p(o, s) {
      /*referenceEl*/
      o[3] ? i && (i.d(1), i = null) : i ? i.p(o, s) : (i = _E(o), i.c(), i.m(t.parentNode, t)), /*referenceEl*/
      o[3] ? a ? (a.p(o, s), s[0] & /*referenceEl*/
      8 && _0(a, 1)) : (a = xE(o), a.c(), _0(a, 1), a.m(n.parentNode, n)) : a && (ghe(), r3(a, 1, 1, () => {
        a = null;
      }), uhe());
    },
    i(o) {
      r || (_0(a), r = !0);
    },
    o(o) {
      r3(a), r = !1;
    },
    d(o) {
      o && (Tm(t), Tm(n)), i && i.d(o), a && a.d(o);
    }
  };
}
function Ic(e, t) {
  return e ? t : () => {
  };
}
function Ihe(e, t, n) {
  let r;
  const i = [
    "activeContent",
    "arrow",
    "offset",
    "placement",
    "trigger",
    "triggeredBy",
    "reference",
    "strategy",
    "open",
    "yOnly",
    "middlewares"
  ];
  let a = yE(t, i), { $$slots: o = {}, $$scope: s } = t, { activeContent: u = !1 } = t, { arrow: l = !0 } = t, { offset: c = 8 } = t, { placement: d = "top" } = t, { trigger: f = "hover" } = t, { triggeredBy: p = void 0 } = t, { reference: g = void 0 } = t, { strategy: m = "absolute" } = t, { open: v = !1 } = t, { yOnly: h = !1 } = t, { middlewares: y = [the(), ehe()] } = t;
  const x = She();
  let S, b, _, C, w, I, M = [], E = !1;
  const T = () => (E = !0, setTimeout(() => E = !1, 250)), P = (X) => {
    _ === void 0 && console.error("trigger undefined"), !g && M.includes(X.target) && _ !== X.target && (n(3, _ = X.target), T()), S && X.type === "focusin" && !v && T(), n(0, v = S && X.type === "click" && !E ? !v : !0);
  }, k = (X) => X.matches(":hover"), D = (X) => X.contains(document.activeElement), B = (X) => X != null ? `${X}px` : "", L = (X) => {
    u ? setTimeout(
      () => {
        const W = [_, C, ...M].filter(Boolean);
        X.type === "mouseleave" && W.some(k) || X.type === "focusout" && W.some(D) || n(0, v = !1);
      },
      100
    ) : n(0, v = !1);
  };
  let F;
  const V = {
    left: "right",
    right: "left",
    bottom: "top",
    top: "bottom"
  };
  function G() {
    rhe(_, C, { placement: d, strategy: m, middleware: r }).then(({ x: X, y: W, middlewareData: J, placement: $, strategy: ee }) => {
      C.style.position = ee, C.style.left = h ? "0" : B(X), C.style.top = B(W), J.arrow && w instanceof HTMLDivElement && (n(20, w.style.left = B(J.arrow.x), w), n(20, w.style.top = B(J.arrow.y), w), n(21, F = V[$.split("-")[0]]), n(20, w.style[F] = B(-w.offsetWidth / 2 - (t.border ? 1 : 0)), w));
    });
  }
  function H(X, W) {
    C = X;
    let J = gE(W, C, G);
    return {
      update($) {
        J(), J = gE($, C, G);
      },
      destroy() {
        J();
      }
    };
  }
  Che(() => {
    const X = [
      ["focusin", P, !0],
      ["focusout", L, !0],
      ["click", P, S],
      ["mouseenter", P, b],
      ["mouseleave", L, b]
    ];
    return p ? M = [...document.querySelectorAll(p)] : M = I.previousElementSibling ? [I.previousElementSibling] : [], M.length || console.error("No triggers found."), M.forEach((W) => {
      W.tabIndex < 0 && (W.tabIndex = 0);
      for (const [J, $, ee] of X) ee && W.addEventListener(J, $);
    }), g ? (n(3, _ = document.querySelector(g) ?? document.body), _ === document.body ? console.error(`Popup reference not found: '${g}'`) : (_.addEventListener("focusout", L), b && _.addEventListener("mouseleave", L))) : n(3, _ = M[0]), document.addEventListener("click", q), () => {
      M.forEach((W) => {
        if (W)
          for (const [J, $] of X) W.removeEventListener(J, $);
      }), _ && (_.removeEventListener("focusout", L), _.removeEventListener("mouseleave", L)), document.removeEventListener("click", q);
    };
  });
  function q(X) {
    v && !X.composedPath().includes(C) && !M.some((W) => X.composedPath().includes(W)) && L(X);
  }
  let z;
  function K(X) {
    return n(20, w = X), {
      destroy() {
        n(20, w = null);
      }
    };
  }
  function Y(X) {
    dF[X ? "unshift" : "push"](() => {
      I = X, n(5, I);
    });
  }
  function Z(X) {
    v = X, n(0, v);
  }
  return e.$$set = (X) => {
    n(39, t = x6(x6({}, t), bE(X))), n(11, a = yE(t, i)), "activeContent" in X && n(1, u = X.activeContent), "arrow" in X && n(2, l = X.arrow), "offset" in X && n(12, c = X.offset), "placement" in X && n(13, d = X.placement), "trigger" in X && n(14, f = X.trigger), "triggeredBy" in X && n(15, p = X.triggeredBy), "reference" in X && n(16, g = X.reference), "strategy" in X && n(17, m = X.strategy), "open" in X && n(0, v = X.open), "yOnly" in X && n(18, h = X.yOnly), "middlewares" in X && n(19, y = X.middlewares), "$$scope" in X && n(25, s = X.$$scope);
  }, e.$$.update = () => {
    e.$$.dirty[0] & /*trigger*/
    16384 && (S = f === "click"), e.$$.dirty[0] & /*trigger*/
    16384 && n(4, b = f === "hover"), e.$$.dirty[0] & /*open*/
    1 && x("show", v), e.$$.dirty[0] & /*placement, referenceEl*/
    8200 && d && (n(3, _), n(13, d)), e.$$.dirty[0] & /*middlewares, offset, arrowEl*/
    1576960 && (r = [
      ...y,
      $0e(+c),
      w && nhe({ element: w, padding: 10 })
    ]), n(6, z = NN("absolute pointer-events-none block w-[10px] h-[10px] rotate-45 bg-inherit border-inherit", t.border && F === "bottom" && "border-b border-e", t.border && F === "top" && "border-t border-s ", t.border && F === "right" && "border-t border-e ", t.border && F === "left" && "border-b border-s "));
  }, t = bE(t), [
    v,
    u,
    l,
    _,
    b,
    I,
    z,
    P,
    L,
    H,
    K,
    a,
    c,
    d,
    f,
    p,
    g,
    m,
    h,
    y,
    w,
    F,
    o,
    Y,
    Z,
    s
  ];
}
class Phe extends ihe {
  constructor(t) {
    super(), vhe(
      this,
      t,
      Ihe,
      whe,
      _he,
      {
        activeContent: 1,
        arrow: 2,
        offset: 12,
        placement: 13,
        trigger: 14,
        triggeredBy: 15,
        reference: 16,
        strategy: 17,
        open: 0,
        yOnly: 18,
        middlewares: 19
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent: Mhe,
  assign: C6,
  bubble: Ehe,
  compute_rest_props: SE,
  create_component: The,
  create_slot: khe,
  destroy_component: Dhe,
  exclude_internal_props: AE,
  get_all_dirty_from_scope: Ohe,
  get_slot_changes: Bhe,
  get_spread_object: Rhe,
  get_spread_update: Lhe,
  init: Nhe,
  mount_component: Fhe,
  safe_not_equal: Vhe,
  transition_in: hF,
  transition_out: gF,
  update_slot_base: Ghe
} = window.__gradio__svelte__internal;
function zhe(e) {
  let t;
  const n = (
    /*#slots*/
    e[4].default
  ), r = khe(
    n,
    e,
    /*$$scope*/
    e[6],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, a) {
      r && r.m(i, a), t = !0;
    },
    p(i, a) {
      r && r.p && (!t || a & /*$$scope*/
      64) && Ghe(
        r,
        n,
        i,
        /*$$scope*/
        i[6],
        t ? Bhe(
          n,
          /*$$scope*/
          i[6],
          a,
          null
        ) : Ohe(
          /*$$scope*/
          i[6]
        ),
        null
      );
    },
    i(i) {
      t || (hF(r, i), t = !0);
    },
    o(i) {
      gF(r, i), t = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function Uhe(e) {
  let t, n;
  const r = [
    { rounded: !0 },
    { shadow: !0 },
    /*$$restProps*/
    e[1],
    { class: (
      /*toolTipClass*/
      e[0]
    ) }
  ];
  let i = {
    $$slots: { default: [zhe] },
    $$scope: { ctx: e }
  };
  for (let a = 0; a < r.length; a += 1)
    i = C6(i, r[a]);
  return t = new Phe({ props: i }), t.$on(
    "show",
    /*show_handler*/
    e[5]
  ), {
    c() {
      The(t.$$.fragment);
    },
    m(a, o) {
      Fhe(t, a, o), n = !0;
    },
    p(a, [o]) {
      const s = o & /*$$restProps, toolTipClass*/
      3 ? Lhe(r, [
        r[0],
        r[1],
        o & /*$$restProps*/
        2 && Rhe(
          /*$$restProps*/
          a[1]
        ),
        o & /*toolTipClass*/
        1 && { class: (
          /*toolTipClass*/
          a[0]
        ) }
      ]) : {};
      o & /*$$scope*/
      64 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
    },
    i(a) {
      n || (hF(t.$$.fragment, a), n = !0);
    },
    o(a) {
      gF(t.$$.fragment, a), n = !1;
    },
    d(a) {
      Dhe(t, a);
    }
  };
}
function Hhe(e, t, n) {
  const r = ["type", "defaultClass"];
  let i = SE(t, r), { $$slots: a = {}, $$scope: o } = t, { type: s = "dark" } = t, { defaultClass: u = "py-2 px-3 text-sm font-medium" } = t;
  const l = {
    dark: "bg-gray-900 text-white dark:bg-gray-700",
    light: "border-gray-200 bg-white text-gray-900",
    auto: " bg-white text-gray-900 dark:bg-gray-700 dark:text-white border-gray-200 dark:border-gray-700",
    custom: ""
  };
  let c;
  function d(f) {
    Ehe.call(this, e, f);
  }
  return e.$$set = (f) => {
    n(8, t = C6(C6({}, t), AE(f))), n(1, i = SE(t, r)), "type" in f && n(2, s = f.type), "defaultClass" in f && n(3, u = f.defaultClass), "$$scope" in f && n(6, o = f.$$scope);
  }, e.$$.update = () => {
    i.color ? n(2, s = "custom") : n(1, i.color = "none", i), ["light", "auto"].includes(s) && n(1, i.border = !0, i), n(0, c = T7("tooltip", u, l[s], t.class));
  }, t = AE(t), [c, i, s, u, a, d, o];
}
class vF extends Mhe {
  constructor(t) {
    super(), Nhe(this, t, Hhe, Uhe, Vhe, { type: 2, defaultClass: 3 });
  }
}
const {
  SvelteComponent: qhe,
  add_flush_callback: jhe,
  append: re,
  attr: U,
  bind: Khe,
  binding_callbacks: Rg,
  check_outros: ty,
  create_component: sn,
  destroy_component: un,
  destroy_each: q7,
  detach: _t,
  element: Ve,
  ensure_array_like: Dm,
  flush: Tp,
  group_outros: ny,
  init: Yhe,
  insert: xt,
  listen: jo,
  mount_component: ln,
  noop: rr,
  null_to_empty: Whe,
  run_all: Xhe,
  safe_not_equal: Zhe,
  set_data: yF,
  set_style: et,
  space: ot,
  svg_element: at,
  text: Eh,
  transition_in: Ot,
  transition_out: Ht
} = window.__gradio__svelte__internal;
function wE(e, t, n) {
  const r = e.slice();
  return r[75] = t[n], r;
}
function IE(e, t, n) {
  const r = e.slice();
  return r[75] = t[n], r;
}
function PE(e, t, n) {
  const r = e.slice();
  return r[75] = t[n], r;
}
function ME(e) {
  let t, n, r, i, a, o, s, u, l, c = (
    /*pickLevelText*/
    e[26](
      /*currGranularity*/
      e[10]
    ) + ""
  ), d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W, J, $, ee, ce, ae, he, Oe, Ne, Ue, Ze, Se, qe, Pe, Xe, Ke, de, we, Ie, Ee, Le, De, rt, st, gt, ft, yt, It, ge, Je, Mt, wn, tn, Te, At, Gt, Tt, nn, Pt, Yt, Rn, kn, Pn, Kn, br, ra, dr, Ln, Cr, yi, ri, Hi, ia, Mr, ye, Yn, bi, ro, gs, io, Zm, $l, ao, Do, Th, zf, kh, ec, ga, vs, zu, _i, Dh, Uf, Oh, tc, va, yd, ys, bd, Bh, Hf, Rh, Qm, Lh, nc, qf, Nh, _d, rc, Js, W7, Fh, $s, ry, X7;
  s = new x1({
    props: {
      trigger: "click",
      $$slots: {
        dropdown: [r2e],
        default: [Jhe]
      },
      $$scope: { ctx: e }
    }
  }), s.$on(
    "change",
    /*change_handler*/
    e[34]
  ), s.$on(
    "command",
    /*command_handler*/
    e[35]
  );
  let AF = {
    trigger: "click",
    $$slots: {
      dropdown: [v2e],
      default: [i2e]
    },
    $$scope: { ctx: e }
  };
  K = new x1({ props: AF }), e[44](K), K.$on(
    "change",
    /*change_handler_1*/
    e[45]
  ), K.$on(
    "command",
    /*command_handler_1*/
    e[46]
  ), Oe = new x1({
    props: {
      trigger: "click",
      $$slots: {
        dropdown: [C2e],
        default: [y2e]
      },
      $$scope: { ctx: e }
    }
  }), Oe.$on(
    "change",
    /*change_handler_2*/
    e[47]
  ), Oe.$on(
    "command",
    /*command_handler_2*/
    e[48]
  );
  let wF = {
    trigger: "manual",
    $$slots: {
      dropdown: [D2e],
      default: [S2e]
    },
    $$scope: { ctx: e }
  };
  rt = new x1({ props: wF }), e[56](rt), rt.$on(
    "change",
    /*change_handler_3*/
    e[57]
  ), It = new x1({
    props: {
      trigger: "click",
      $$slots: {
        dropdown: [F2e],
        default: [O2e]
      },
      $$scope: { ctx: e }
    }
  }), It.$on(
    "change",
    /*change_handler_4*/
    e[58]
  ), It.$on(
    "command",
    /*command_handler_3*/
    e[59]
  );
  let IF = {
    trigger: "click",
    $$slots: {
      dropdown: [Y2e],
      default: [V2e]
    },
    $$scope: { ctx: e }
  };
  return Js = new x1({ props: IF }), e[70](Js), {
    c() {
      t = Ve("div"), n = Ve("div"), r = Ve("div"), r.textContent = "Quick Select", i = ot(), a = Ve("div"), o = Ve("div"), sn(s.$$.fragment), u = ot(), l = Ve("div"), d = Eh(c), f = ot(), p = Ve("div"), g = at("svg"), m = at("path"), v = at("path"), h = at("path"), y = at("path"), x = ot(), S = Ve("div"), S.textContent = "Protein", b = ot(), _ = Ve("div"), C = at("svg"), w = at("path"), I = at("path"), M = at("path"), E = at("path"), T = at("path"), P = ot(), k = Ve("div"), k.textContent = "Ligand", D = ot(), B = Ve("div"), L = at("svg"), F = at("path"), V = at("path"), G = ot(), H = Ve("div"), H.textContent = "Solvent", q = ot(), z = Ve("div"), sn(K.$$.fragment), Y = ot(), Z = Ve("div"), Z.textContent = "Expand", X = ot(), W = Ve("div"), J = ot(), $ = Ve("div"), ee = Ve("div"), ee.textContent = "Chem Assist", ce = ot(), ae = Ve("div"), he = Ve("div"), sn(Oe.$$.fragment), Ne = ot(), Ue = Ve("div"), Ue.textContent = "Measure", Ze = ot(), Se = Ve("div"), qe = Ve("div"), Pe = at("svg"), Xe = at("path"), de = at("path"), Ee = at("path"), De = ot(), sn(rt.$$.fragment), st = ot(), gt = Ve("div"), gt.textContent = "Interaction", ft = ot(), yt = Ve("div"), sn(It.$$.fragment), ge = ot(), Je = Ve("div"), Je.textContent = "Label", Mt = ot(), wn = Ve("div"), tn = ot(), Te = Ve("div"), At = Ve("div"), At.textContent = "Style", Gt = ot(), Tt = Ve("div"), nn = Ve("div"), Pt = at("svg"), Yt = at("path"), Rn = at("path"), kn = at("path"), Pn = at("path"), Kn = at("path"), br = ot(), ra = Ve("div"), ra.textContent = "Surface", dr = ot(), Ln = Ve("div"), Cr = at("svg"), yi = at("path"), ri = at("path"), Hi = at("path"), ia = ot(), Mr = Ve("div"), Mr.textContent = "Ribbon", ye = ot(), Yn = Ve("div"), bi = at("svg"), ro = at("path"), gs = ot(), io = Ve("div"), io.textContent = "Line", Zm = ot(), $l = Ve("div"), ao = at("svg"), Do = at("rect"), Th = ot(), zf = Ve("div"), zf.textContent = "Stick", kh = ot(), ec = Ve("div"), ga = at("svg"), vs = at("rect"), zu = at("circle"), _i = at("circle"), Dh = ot(), Uf = Ve("div"), Uf.textContent = "Ball&Stick", Oh = ot(), tc = Ve("div"), va = at("svg"), yd = at("path"), ys = at("circle"), bd = at("path"), Bh = ot(), Hf = Ve("div"), Hf.textContent = "CPK", Rh = ot(), Qm = Ve("div"), Lh = ot(), nc = Ve("div"), qf = Ve("div"), qf.textContent = "3D Control", Nh = ot(), _d = Ve("div"), rc = Ve("div"), sn(Js.$$.fragment), W7 = ot(), Fh = Ve("div"), Fh.textContent = "Hydrogen", U(r, "class", "uni-view-horizontal-toolbar-title row svelte-1mqpry1"), U(l, "class", Whe("uni-view-horizontal-toolbar-subtitle") + " svelte-1mqpry1"), U(o, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(o, "style", ""), U(m, "fill", "#A2A5C4"), U(m, "d", "M10.61 8.936a.6.6 0 0 1 .6-.6h3.543c2.38 0 3.57 1.008 3.57 3.038 0 2.044-1.204 3.066-3.598 3.066h-2.59v3.292a.6.6 0 0 1-.6.6h-.326a.6.6 0 0 1-.6-.6V8.936Zm1.525.702v3.5h2.492c.756 0 1.302-.14 1.652-.42.336-.28.518-.728.518-1.344 0-.616-.182-1.064-.532-1.316-.35-.28-.896-.42-1.638-.42h-2.492Z"), U(v, "stroke", "#A2A5C4"), U(v, "stroke-linecap", "round"), U(v, "stroke-width", "1.3"), U(v, "d", "m9.607 7.14-.283-.826s-.118-1.327.699-2.564 2.184-1.61 2.184-1.61l1.892 4.174"), U(h, "stroke", "#A2A5C4"), U(h, "stroke-width", "1.3"), U(h, "d", "M3.738 8.955C4.556 7.718 5.61 7.32 5.61 7.32l2.053 4.927s.362 1.252-.291 2.241c-.653.99-1.86 2.097-2.05 2.207l-2.188-5.714s-.213-.79.604-2.027Z"), U(y, "stroke", "#A2A5C4"), U(y, "stroke-linecap", "round"), U(y, "stroke-width", "1.3"), U(y, "d", "M9.472 7.146 8.77 6.99s-1.9-.575-3.512.463c-1.181.76-1.812 2.398-1.912 2.64l3.064.786 1.531.393.766.196"), et(g, "margin-left", "5"), U(g, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(g, "xmlns", "http://www.w3.org/2000/svg"), U(g, "width", "1em"), U(g, "height", "1em"), U(g, "fill", "none"), U(g, "viewBox", "0 0 20 20"), U(S, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(p, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(w, "stroke", "#A2A5C4"), U(w, "stroke-linecap", "round"), U(w, "d", "M1.664 8.858h1.273"), U(I, "stroke", "#A2A5C4"), U(I, "stroke-width", "1.3"), U(I, "d", "m3.011 8.697 1.616-2.654a.37.37 0 0 1 .318-.17h3.208a.37.37 0 0 1 .318.17l1.616 2.654c.061.1.061.222 0 .323l-1.616 2.654a.37.37 0 0 1-.318.17H4.945a.37.37 0 0 1-.318-.17L3.011 9.02a.307.307 0 0 1 0-.323Z"), U(M, "stroke", "#A2A5C4"), U(M, "stroke-linecap", "round"), U(M, "stroke-width", "1.3"), U(M, "d", "m9.96 9.246-1.615 2.655a.307.307 0 0 0 0 .322l1.616 2.654m.159-6.13L8.502 6.093a.307.307 0 0 1 0-.322l1.616-2.655a.37.37 0 0 1 .318-.17h3.208a.37.37 0 0 1 .318.17l1.616 2.655c.061.1.061.222 0 .322l-.85 1.413"), U(E, "stroke", "#A2A5C4"), U(E, "stroke-linecap", "round"), U(E, "d", "M14.906 1.661 13.71 3.08"), U(T, "fill", "#A2A5C4"), U(T, "d", "M11.563 9.3a.6.6 0 0 1 .6-.6h.256a.6.6 0 0 1 .6.6v7.773h4.7a.6.6 0 0 1 .6.6v.054a.6.6 0 0 1-.6.6h-5.557a.6.6 0 0 1-.6-.6V9.3Z"), et(C, "margin-left", "5"), U(C, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(C, "xmlns", "http://www.w3.org/2000/svg"), U(C, "width", "1em"), U(C, "height", "1em"), U(C, "fill", "none"), U(C, "viewBox", "0 0 20 20"), U(k, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(_, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(F, "stroke", "#A2A5C4"), U(F, "stroke-linecap", "round"), U(F, "stroke-linejoin", "round"), U(F, "stroke-width", "1.3"), U(F, "d", "M8.636 14.942H2.315a.666.666 0 0 1-.667-.667v0c0-.174.069-.34.19-.465l1.654-1.692a1 1 0 0 1 .714-.3l4.423-.006m-4.848.011 2.474-2.53a1 1 0 0 0 .285-.699V2.665a1 1 0 0 1 1-1h2.192a1 1 0 0 1 1 1v4.503m-.003-2.708H8.633m2.096 2.097H8.633"), U(V, "fill", "#A2A5C4"), U(V, "d", "M14.2 7.975c1.163 0 2.073.238 2.73.742.554.409.915.993 1.09 1.76.079.343-.203.648-.556.648h-.372c-.282 0-.52-.2-.615-.466-.148-.411-.362-.727-.652-.934-.392-.294-.952-.434-1.708-.434-.658 0-1.162.098-1.512.294-.434.224-.644.588-.644 1.092 0 .448.238.798.742 1.064.224.126.798.336 1.736.616 1.344.42 2.226.742 2.618.98.854.518 1.288 1.232 1.288 2.156 0 .896-.35 1.596-1.05 2.114-.7.504-1.68.756-2.94.756-1.218 0-2.17-.252-2.856-.728-.68-.485-1.104-1.196-1.28-2.136-.063-.341.216-.636.563-.636h.35c.299 0 .546.221.625.51.146.526.391.925.736 1.184.406.308 1.022.462 1.862.462.756 0 1.358-.14 1.806-.392.448-.252.672-.602.672-1.05 0-.56-.322-.994-.952-1.316-.224-.112-.882-.336-1.988-.672-1.232-.392-1.988-.658-2.296-.826-.77-.462-1.148-1.134-1.148-2.002 0-.882.364-1.568 1.106-2.072.7-.476 1.582-.714 2.646-.714Z"), et(L, "margin-left", "5"), U(L, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(L, "xmlns", "http://www.w3.org/2000/svg"), U(L, "width", "1em"), U(L, "height", "1em"), U(L, "fill", "none"), U(L, "viewBox", "0 0 20 20"), U(H, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(B, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(Z, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(z, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(a, "class", "row svelte-1mqpry1"), et(n, "margin", "4px 8px"), U(W, "class", "vertical-split svelte-1mqpry1"), U(ee, "class", "uni-view-horizontal-toolbar-title row svelte-1mqpry1"), U(Ue, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(he, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(Xe, "d", "M13.3333 15.4173C13.3333 16.5679 14.2661 17.5007 15.4167 17.5007C16.5673 17.5007 17.5 16.5679 17.5 15.4173C17.5 14.2667 16.5673 13.334 15.4167 13.334C14.2661 13.334 13.3333 14.2667 13.3333 15.4173Z"), U(Xe, "stroke", Ke = /*interactionState*/
      e[14] ? "#6063f0" : "#A2A5C4"), U(Xe, "stroke-width", "1.3"), U(Xe, "stroke-linejoin", "round"), U(de, "d", "M2.4974 4.58333C2.4974 5.73392 3.43015 6.66667 4.58073 6.66667C5.73131 6.66667 6.66406 5.73392 6.66406 4.58333C6.66406 3.43274 5.73131 2.5 4.58073 2.5C3.43015 2.5 2.4974 3.43274 2.4974 4.58333Z"), U(de, "fill", we = /*interactionState*/
      e[14] ? "#6063f0" : "#A2A5C4"), U(de, "stroke", Ie = /*interactionState*/
      e[14] ? "#6063f0" : "#A2A5C4"), U(de, "stroke-width", "1.3"), U(de, "stroke-linejoin", "round"), U(Ee, "d", "M13.3333 15.4173L5.20658 15.4173C3.71179 15.4173 2.5 14.2055 2.5 12.7107C2.5 11.2159 3.71179 10.0041 5.20658 10.0041L14.7899 10.0041C16.2867 10.0041 17.5 8.79078 17.5 7.29407C17.5 5.79732 16.2867 4.58398 14.7899 4.58398L6.66667 4.58398"), U(Ee, "stroke", Le = /*interactionState*/
      e[14] ? "#6063f0" : "#A2A5C4"), U(Ee, "stroke-width", "1.3"), U(Ee, "stroke-linecap", "square"), U(Ee, "stroke-linejoin", "round"), U(Pe, "class", "normal-icon svelte-1mqpry1"), et(Pe, "margin-left", "5"), U(Pe, "width", "1em"), U(Pe, "height", "1em"), U(Pe, "viewBox", "0 0 20 20"), U(Pe, "fill", "none"), U(Pe, "xmlns", "http://www.w3.org/2000/svg"), U(qe, "class", "row svelte-1mqpry1"), U(qe, "style", "flex-shrink: 0; align-items: center; justify-content: center;"), U(gt, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(Se, "class", "uni-view-horizontal-toolbar-item large svelte-1mqpry1"), U(Je, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(yt, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(ae, "class", "row svelte-1mqpry1"), et($, "margin", "4px 8px"), U(wn, "class", "vertical-split svelte-1mqpry1"), U(At, "class", "uni-view-horizontal-toolbar-title row svelte-1mqpry1"), U(Yt, "d", "M3 9.23453C3.58333 8.71301 5.275 7.74819 7.375 8.0611C10 8.45225 11.5 12 17 10"), U(Yt, "stroke", "#A2A5C4"), U(Rn, "d", "M2.5 13.5C3.07971 13.034 6.26087 11.7741 8.34783 12.0537C10.1642 12.2971 11.0591 13.5663 13.5 14.5"), U(Rn, "stroke", "#A2A5C4"), U(kn, "d", "M5 5C6 5.32143 9 7.54286 9 9.85714C9 12.1714 7.6 14.75 7 15.5"), U(kn, "stroke", "#A2A5C4"), U(Pn, "d", "M11.5 5C13.0427 6.44828 15.9684 11.0241 13.5 14.5"), U(Pn, "stroke", "#A2A5C4"), U(Kn, "d", "M2.65 15.4427V4.74213C3.78105 4.88726 6.021 5.14929 7.5 5.14929C9.51352 5.14929 10.5781 5.14911 12.6575 4.62993C13.3376 4.46011 14.253 4.41357 15.1614 4.43067C16.0225 4.44689 16.8331 4.519 17.35 4.57508V15.1497C16.7887 15.0031 16.0056 14.8086 15.2259 14.6486C14.4383 14.487 13.602 14.3493 13 14.3493C12.5298 14.3493 12.0203 14.4647 11.5269 14.6104C11.1005 14.7362 10.6448 14.8979 10.1953 15.0573C10.1203 15.0839 10.0455 15.1104 9.97108 15.1367C8.88952 15.5186 7.8699 15.85 7 15.85C5.58121 15.85 3.61073 15.5859 2.65 15.4427Z"), U(Kn, "stroke", "#A2A5C4"), U(Kn, "stroke-width", "1.3"), U(Kn, "stroke-linejoin", "round"), et(Pt, "margin-left", "5"), U(Pt, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(Pt, "width", "1em"), U(Pt, "height", "1em"), U(Pt, "viewBox", "0 0 20 20"), U(Pt, "fill", "none"), U(Pt, "xmlns", "http://www.w3.org/2000/svg"), U(ra, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(nn, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(yi, "d", "M6.65625 4.99609H5.65909C4.77273 4.99609 3 5.47273 3 7.47942C3 9.4861 4.77273 9.9915 5.65909 9.9915H9.52855H13.398C14.2844 9.9915 16 10.4818 16 12.4885C16 14.4952 14.2844 14.9961 13.398 14.9961"), U(yi, "stroke", "#A2A5C4"), U(yi, "stroke-width", "1.3"), U(yi, "stroke-linecap", "round"), U(yi, "stroke-linejoin", "round"), U(ri, "d", "M11.8167 1.44141L15.5504 4.76029L11.8167 8.07918L11.8167 6.28873L6.59375 6.28873L6.59375 3.23186L11.8167 3.23186L11.8167 1.44141Z"), U(ri, "stroke", "#A2A5C4"), U(ri, "stroke-width", "1.25"), U(ri, "stroke-linecap", "square"), U(ri, "stroke-linejoin", "round"), U(Hi, "d", "M9.22291 12.3613L12.9567 15.6802L9.22291 18.9991L9.22291 17.2086L4 17.2086L4 14.1518L9.22291 14.1518L9.22291 12.3613Z"), U(Hi, "stroke", "#A2A5C4"), U(Hi, "fill", "#A2A5C4"), U(Hi, "stroke-width", "1.25"), U(Hi, "stroke-linecap", "square"), U(Hi, "stroke-linejoin", "round"), et(Cr, "margin-left", "5"), U(Cr, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(Cr, "width", "1em"), U(Cr, "height", "1em"), U(Cr, "viewBox", "0 0 20 20"), U(Cr, "fill", "none"), U(Cr, "xmlns", "http://www.w3.org/2000/svg"), U(Mr, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(Ln, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(ro, "d", "M17.0938 3L3.47534 16.5704"), U(ro, "stroke", "#A2A5C4"), U(ro, "stroke-width", "1.3"), U(ro, "stroke-linecap", "round"), et(bi, "margin-left", "5"), U(bi, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(bi, "width", "1em"), U(bi, "height", "1em"), U(bi, "viewBox", "0 0 20 20"), U(bi, "fill", "none"), U(bi, "xmlns", "http://www.w3.org/2000/svg"), U(io, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(Yn, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(Do, "x", "14.8047"), U(Do, "y", "2.57422"), U(Do, "width", "3"), U(Do, "height", "18"), U(Do, "rx", "1.5"), U(Do, "transform", "rotate(45 14.8047 2.57422)"), U(Do, "stroke", "#A2A5C4"), U(Do, "stroke-width", "1.3"), et(ao, "margin-left", "5"), U(ao, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(ao, "width", "1em"), U(ao, "height", "1em"), U(ao, "viewBox", "0 0 20 20"), U(ao, "fill", "none"), U(ao, "xmlns", "http://www.w3.org/2000/svg"), U(zf, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U($l, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(vs, "x", "13.0625"), U(vs, "y", "5.7793"), U(vs, "width", "1.84088"), U(vs, "height", "5.56186"), U(vs, "transform", "rotate(45 13.0625 5.7793)"), U(vs, "stroke", "#A2A5C4"), U(vs, "stroke-width", "1.3"), U(zu, "cx", "15.5"), U(zu, "cy", "4.5"), U(zu, "r", "2.5"), U(zu, "stroke", "#A2A5C4"), U(zu, "stroke-width", "1.3"), U(_i, "cx", "6.5"), U(_i, "cy", "13.5"), U(_i, "r", "4.5"), U(_i, "stroke", "#A2A5C4"), U(_i, "stroke-width", "1.3"), et(ga, "margin-left", "5"), U(ga, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(ga, "width", "1em"), U(ga, "height", "1em"), U(ga, "viewBox", "0 0 20 20"), U(ga, "fill", "none"), U(ga, "xmlns", "http://www.w3.org/2000/svg"), U(Uf, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(ec, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(yd, "d", "M5.34928 16C2.78076 16 1 13.9853 1 11.5C1 9.01472 2.78076 7 5.34928 7C7.9178 7 10 9.01472 10 11.5C10 13.9853 7.9178 16 5.34928 16Z"), U(yd, "stroke", "#A2A5C4"), U(yd, "stroke-width", "1.3"), U(ys, "cx", "8"), U(ys, "cy", "6"), U(ys, "r", "5"), U(ys, "transform", "rotate(90 8 6)"), U(ys, "fill", "#A2A5C4"), U(ys, "stroke", "#A2A5C4"), U(ys, "stroke-width", "1.3"), U(bd, "d", "M12.866 12C10.5829 12 9 10.2091 9 8C9 5.79086 10.5829 4 12.866 4C15.1492 4 17 5.79086 17 8C17 10.2091 15.1492 12 12.866 12Z"), U(bd, "stroke", "#A2A5C4"), U(bd, "stroke-width", "1.3"), et(va, "margin-left", "5"), U(va, "class", "uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1"), U(va, "width", "1em"), U(va, "height", "1em"), U(va, "viewBox", "0 0 18 17"), U(va, "fill", "none"), U(va, "xmlns", "http://www.w3.org/2000/svg"), U(Hf, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(tc, "class", "uni-view-horizontal-toolbar-item svelte-1mqpry1"), U(Tt, "class", "row svelte-1mqpry1"), et(Te, "margin", "4px 8px"), U(Qm, "class", "vertical-split svelte-1mqpry1"), U(qf, "class", "uni-view-horizontal-toolbar-title row svelte-1mqpry1"), U(Fh, "class", "uni-view-horizontal-toolbar-subtitle svelte-1mqpry1"), U(rc, "class", "uni-view-horizontal-toolbar-item large svelte-1mqpry1"), U(_d, "class", "row svelte-1mqpry1"), et(nc, "margin", "4px 8px"), U(
        t,
        "style",
        /*style*/
        e[9]
      ), U(t, "class", "uni-view-horizontal-toolbar-inner row svelte-1mqpry1");
    },
    m(er, _r) {
      xt(er, t, _r), re(t, n), re(n, r), re(n, i), re(n, a), re(a, o), ln(s, o, null), re(o, u), re(o, l), re(l, d), re(a, f), re(a, p), re(p, g), re(g, m), re(g, v), re(g, h), re(g, y), re(p, x), re(p, S), re(a, b), re(a, _), re(_, C), re(C, w), re(C, I), re(C, M), re(C, E), re(C, T), re(_, P), re(_, k), re(a, D), re(a, B), re(B, L), re(L, F), re(L, V), re(B, G), re(B, H), re(a, q), re(a, z), ln(K, z, null), re(z, Y), re(z, Z), re(t, X), re(t, W), re(t, J), re(t, $), re($, ee), re($, ce), re($, ae), re(ae, he), ln(Oe, he, null), re(he, Ne), re(he, Ue), re(ae, Ze), re(ae, Se), re(Se, qe), re(qe, Pe), re(Pe, Xe), re(Pe, de), re(Pe, Ee), re(qe, De), ln(rt, qe, null), re(Se, st), re(Se, gt), re(ae, ft), re(ae, yt), ln(It, yt, null), re(yt, ge), re(yt, Je), re(t, Mt), re(t, wn), re(t, tn), re(t, Te), re(Te, At), re(Te, Gt), re(Te, Tt), re(Tt, nn), re(nn, Pt), re(Pt, Yt), re(Pt, Rn), re(Pt, kn), re(Pt, Pn), re(Pt, Kn), re(nn, br), re(nn, ra), re(Tt, dr), re(Tt, Ln), re(Ln, Cr), re(Cr, yi), re(Cr, ri), re(Cr, Hi), re(Ln, ia), re(Ln, Mr), re(Tt, ye), re(Tt, Yn), re(Yn, bi), re(bi, ro), re(Yn, gs), re(Yn, io), re(Tt, Zm), re(Tt, $l), re($l, ao), re(ao, Do), re($l, Th), re($l, zf), re(Tt, kh), re(Tt, ec), re(ec, ga), re(ga, vs), re(ga, zu), re(ga, _i), re(ec, Dh), re(ec, Uf), re(Tt, Oh), re(Tt, tc), re(tc, va), re(va, yd), re(va, ys), re(va, bd), re(tc, Bh), re(tc, Hf), re(t, Rh), re(t, Qm), re(t, Lh), re(t, nc), re(nc, qf), re(nc, Nh), re(nc, _d), re(_d, rc), ln(Js, rc, null), re(rc, W7), re(rc, Fh), $s = !0, ry || (X7 = [
        jo(
          g,
          "click",
          /*click_handler*/
          e[36]
        ),
        jo(
          C,
          "click",
          /*click_handler_1*/
          e[37]
        ),
        jo(
          L,
          "click",
          /*click_handler_2*/
          e[38]
        ),
        jo(
          Pe,
          "click",
          /*click_handler_4*/
          e[49]
        ),
        jo(
          Pt,
          "click",
          /*click_handler_8*/
          e[60]
        ),
        jo(
          Cr,
          "click",
          /*click_handler_9*/
          e[61]
        ),
        jo(
          bi,
          "click",
          /*click_handler_10*/
          e[62]
        ),
        jo(
          ao,
          "click",
          /*click_handler_11*/
          e[63]
        ),
        jo(
          ga,
          "click",
          /*click_handler_12*/
          e[64]
        ),
        jo(
          va,
          "click",
          /*click_handler_13*/
          e[65]
        )
      ], ry = !0);
    },
    p(er, _r) {
      const Z7 = {};
      _r[0] & /*pickModeVisible, currGranularity*/
      1028 | _r[2] & /*$$scope*/
      1048576 && (Z7.$$scope = { dirty: _r, ctx: er }), s.$set(Z7), (!$s || _r[0] & /*currGranularity*/
      1024) && c !== (c = /*pickLevelText*/
      er[26](
        /*currGranularity*/
        er[10]
      ) + "") && yF(d, c);
      const Q7 = {};
      _r[0] & /*lightPlugin, surroundingRadius, asWholeResidueState, expandFilter, excludeSelectedAtoms, surroundingVisible, surroundingDropdownRef, ExpandFilter, selectionHistory*/
      2555 | _r[2] & /*$$scope*/
      1048576 && (Q7.$$scope = { dirty: _r, ctx: er }), K.$set(Q7);
      const J7 = {};
      _r[0] & /*measureVisible*/
      4096 | _r[2] & /*$$scope*/
      1048576 && (J7.$$scope = { dirty: _r, ctx: er }), Oe.$set(J7), (!$s || _r[0] & /*interactionState*/
      16384 && Ke !== (Ke = /*interactionState*/
      er[14] ? "#6063f0" : "#A2A5C4")) && U(Xe, "stroke", Ke), (!$s || _r[0] & /*interactionState*/
      16384 && we !== (we = /*interactionState*/
      er[14] ? "#6063f0" : "#A2A5C4")) && U(de, "fill", we), (!$s || _r[0] & /*interactionState*/
      16384 && Ie !== (Ie = /*interactionState*/
      er[14] ? "#6063f0" : "#A2A5C4")) && U(de, "stroke", Ie), (!$s || _r[0] & /*interactionState*/
      16384 && Le !== (Le = /*interactionState*/
      er[14] ? "#6063f0" : "#A2A5C4")) && U(Ee, "stroke", Le);
      const $7 = {};
      _r[0] & /*nonCovalentBondsSetting, electrostaticSetting, lightPlugin, interactionType, interactionDropdownRef, interactionVisible*/
      1015809 | _r[2] & /*$$scope*/
      1048576 && ($7.$$scope = { dirty: _r, ctx: er }), rt.$set($7);
      const e9 = {};
      _r[0] & /*labelVisible*/
      8192 | _r[2] & /*$$scope*/
      1048576 && (e9.$$scope = { dirty: _r, ctx: er }), It.$set(e9);
      const t9 = {};
      _r[0] & /*lightPlugin, isShowPolar, isShowNoPolar, hydrogenDropdownRef*/
      7340033 | _r[2] & /*$$scope*/
      1048576 && (t9.$$scope = { dirty: _r, ctx: er }), Js.$set(t9), (!$s || _r[0] & /*style*/
      512) && U(
        t,
        "style",
        /*style*/
        er[9]
      );
    },
    i(er) {
      $s || (Ot(s.$$.fragment, er), Ot(K.$$.fragment, er), Ot(Oe.$$.fragment, er), Ot(rt.$$.fragment, er), Ot(It.$$.fragment, er), Ot(Js.$$.fragment, er), $s = !0);
    },
    o(er) {
      Ht(s.$$.fragment, er), Ht(K.$$.fragment, er), Ht(Oe.$$.fragment, er), Ht(rt.$$.fragment, er), Ht(It.$$.fragment, er), Ht(Js.$$.fragment, er), $s = !1;
    },
    d(er) {
      er && _t(t), un(s), e[44](null), un(K), un(Oe), e[56](null), un(rt), un(It), e[70](null), un(Js), ry = !1, Xhe(X7);
    }
  };
}
function EE(e) {
  let t, n, r, i, a;
  return {
    c() {
      t = at("svg"), n = at("path"), r = at("circle"), i = at("path"), a = at("path"), U(n, "d", "M20 0H0v20h20V0z"), U(n, "fill", "#fff"), U(n, "fill-opacity", ".01"), U(r, "cx", "10"), U(r, "cy", "10"), U(r, "r", "1.25"), U(r, "fill", "#A2A5C4"), U(i, "d", "M16.908 3.062c1.569 1.569-.26 5.94-4.083 9.763-3.823 3.824-8.194 5.652-9.763 4.083-1.569-1.569.26-5.94 4.083-9.763 3.823-3.824 8.194-5.652 9.763-4.083z"), U(i, "stroke", "#A2A5C4"), U(i, "stroke-width", "1.3"), U(i, "stroke-linecap", "square"), U(i, "stroke-linejoin", "round"), U(a, "d", "M3.117 3.062c-1.569 1.569.259 5.94 4.082 9.763 3.824 3.824 8.195 5.652 9.764 4.083 1.568-1.569-.26-5.94-4.083-9.763C9.056 3.32 4.685 1.493 3.117 3.062z"), U(a, "stroke", "#A2A5C4"), U(a, "stroke-width", "1.3"), U(a, "stroke-linecap", "square"), U(a, "stroke-linejoin", "round"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 20 20"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg"), U(t, "class", "normal-icon svelte-1mqpry1");
    },
    m(o, s) {
      xt(o, t, s), re(t, n), re(t, r), re(t, i), re(t, a);
    },
    d(o) {
      o && _t(t);
    }
  };
}
function TE(e) {
  let t, n, r;
  return {
    c() {
      t = at("svg"), n = at("path"), r = at("path"), U(n, "d", "M17.071 5.596l-6.666-3.704a.833.833 0 0 0-.81 0L2.93 5.596a.833.833 0 0 0-.429.728v7.353c0 .302.164.581.429.728l6.666 3.704c.252.14.558.14.81 0l6.666-3.704M5.5 12.5L10 15"), U(n, "stroke", "#A2A5C4"), U(n, "stroke-width", "1.3"), U(n, "stroke-linecap", "round"), U(r, "stroke", "#A2A5C4"), U(r, "stroke-linecap", "round"), U(r, "stroke-dasharray", "1 2"), U(r, "d", "M17.5 7.5v5"), U(t, "class", "normal-icon svelte-1mqpry1"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 20 20"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(i, a) {
      xt(i, t, a), re(t, n), re(t, r);
    },
    d(i) {
      i && _t(t);
    }
  };
}
function kE(e) {
  let t, n;
  return {
    c() {
      t = at("svg"), n = at("path"), U(n, "d", "M12.9141 8.75032L14.5807 7.50033L18.3307 10.0003V14.167L14.1641 16.667L9.99739 14.167V5.41699L5.41406 2.91699L1.66406 5.41699V10.0003L5.41406 12.5003L7.08073 11.2503"), U(n, "stroke", "#A2A5C4"), U(n, "stroke-width", "1.3"), U(n, "stroke-linecap", "square"), U(n, "stroke-linejoin", "round"), U(t, "class", "normal-icon svelte-1mqpry1"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 20 20"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(r, i) {
      xt(r, t, i), re(t, n);
    },
    d(r) {
      r && _t(t);
    }
  };
}
function DE(e) {
  let t, n, r, i, a, o, s, u;
  return {
    c() {
      t = at("svg"), n = at("path"), r = at("path"), i = at("path"), a = at("path"), o = at("path"), s = at("path"), u = at("path"), U(n, "d", "M20 0H0V20H20V0Z"), U(n, "fill", "white"), U(n, "fill-opacity", "0.01"), U(r, "d", "M17.9167 14.9993C17.9167 15.5583 17.6965 16.0659 17.3382 16.4401C16.959 16.8361 16.425 17.0827 15.8333 17.0827C14.6827 17.0827 13.75 16.1499 13.75 14.9993C13.75 14.1618 14.2442 13.4397 14.957 13.1088C15.2233 12.9851 15.5203 12.916 15.8333 12.916C16.9839 12.916 17.9167 13.8488 17.9167 14.9993Z"), U(r, "stroke", "#A2A5C4"), U(r, "stroke-width", "1.25"), U(r, "stroke-linecap", "round"), U(r, "stroke-linejoin", "round"), U(i, "d", "M6.2526 14.9993C6.2526 15.5583 6.03244 16.0659 5.67415 16.4401C5.2949 16.8361 4.7609 17.0827 4.16927 17.0827C3.01868 17.0827 2.08594 16.1499 2.08594 14.9993C2.08594 14.1618 2.58016 13.4397 3.29288 13.1088C3.55929 12.9851 3.85622 12.916 4.16927 12.916C5.31985 12.916 6.2526 13.8488 6.2526 14.9993Z"), U(i, "stroke", "#A2A5C4"), U(i, "stroke-width", "1.25"), U(i, "stroke-linecap", "round"), U(i, "stroke-linejoin", "round"), U(a, "d", "M12.0807 3.74935C12.0807 4.30835 11.8606 4.81589 11.5023 5.19006C11.123 5.5861 10.589 5.83268 9.9974 5.83268C8.84681 5.83268 7.91406 4.89993 7.91406 3.74935C7.91406 2.91181 8.40827 2.18971 9.12102 1.85877C9.3874 1.73507 9.68435 1.66602 9.9974 1.66602C11.148 1.66602 12.0807 2.59876 12.0807 3.74935Z"), U(a, "stroke", "#A2A5C4"), U(a, "stroke-width", "1.25"), U(a, "stroke-linecap", "round"), U(a, "stroke-linejoin", "round"), U(o, "d", "M9.99996 11V6M9.99996 11L5.625 13.5259L9.99996 11ZM9.99996 11L14.3749 13.5259L9.99996 11Z"), U(o, "stroke", "#A2A5C4"), U(o, "stroke-linecap", "round"), U(o, "stroke-linejoin", "round"), U(o, "stroke-dasharray", "2 2"), U(s, "d", "M9 5.5L4 13M11 5.5L16 13"), U(s, "stroke", "#A2A5C4"), U(s, "stroke-linejoin", "round"), U(u, "d", "M6 15L14 15"), U(u, "stroke", "#A2A5C4"), U(u, "stroke-linejoin", "round"), U(t, "class", "normal-icon svelte-1mqpry1"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 20 20"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(l, c) {
      xt(l, t, c), re(t, n), re(t, r), re(t, i), re(t, a), re(t, o), re(t, s), re(t, u);
    },
    d(l) {
      l && _t(t);
    }
  };
}
function Qhe(e) {
  let t = `Pick ${/*pickLevelText*/
  e[26](
    /*currGranularity*/
    e[10]
  )}`, n;
  return {
    c() {
      n = Eh(t);
    },
    m(r, i) {
      xt(r, n, i);
    },
    p(r, i) {
      i[0] & /*currGranularity*/
      1024 && t !== (t = `Pick ${/*pickLevelText*/
      r[26](
        /*currGranularity*/
        r[10]
      )}`) && yF(n, t);
    },
    d(r) {
      r && _t(n);
    }
  };
}
function Jhe(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p = (
    /*currGranularity*/
    e[10] === Dt.Atom && EE()
  ), g = (
    /*currGranularity*/
    e[10] === Dt.Residue && TE()
  ), m = (
    /*currGranularity*/
    e[10] === Dt.Chain && kE()
  ), v = (
    /*currGranularity*/
    e[10] === Dt.Molecular && DE()
  );
  return s = new vF({
    props: {
      $$slots: { default: [Qhe] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), n = Ve("div"), p && p.c(), r = ot(), g && g.c(), i = ot(), m && m.c(), a = ot(), v && v.c(), o = ot(), sn(s.$$.fragment), u = ot(), l = at("svg"), c = at("path"), U(c, "d", "M6.95641 5.66979L4.15766 2.07713C4.07755 1.97429 3.9233 1.97429 3.84234 2.07713L1.04359 5.66979C0.939613 5.80376 1.03336 6 1.20125 6L6.79875 6C6.96664 6 7.06039 5.80376 6.95641 5.66979Z"), U(c, "fill", "#888BAB"), U(l, "width", "1em"), U(l, "height", "1em"), U(l, "viewBox", "0 0 8 8"), U(l, "fill", "none"), U(l, "xmlns", "http://www.w3.org/2000/svg"), U(l, "style", d = `
                                    transform: ${/*pickModeVisible*/
      e[2] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `), U(t, "class", "row svelte-1mqpry1"), U(t, "style", "flex-shrink: 0; align-items: center; justify-content: center;");
    },
    m(h, y) {
      xt(h, t, y), re(t, n), p && p.m(n, null), re(n, r), g && g.m(n, null), re(n, i), m && m.m(n, null), re(n, a), v && v.m(n, null), re(t, o), ln(s, t, null), re(t, u), re(t, l), re(l, c), f = !0;
    },
    p(h, y) {
      /*currGranularity*/
      h[10] === Dt.Atom ? p || (p = EE(), p.c(), p.m(n, r)) : p && (p.d(1), p = null), /*currGranularity*/
      h[10] === Dt.Residue ? g || (g = TE(), g.c(), g.m(n, i)) : g && (g.d(1), g = null), /*currGranularity*/
      h[10] === Dt.Chain ? m || (m = kE(), m.c(), m.m(n, a)) : m && (m.d(1), m = null), /*currGranularity*/
      h[10] === Dt.Molecular ? v || (v = DE(), v.c(), v.m(n, null)) : v && (v.d(1), v = null);
      const x = {};
      y[0] & /*currGranularity*/
      1024 | y[2] & /*$$scope*/
      1048576 && (x.$$scope = { dirty: y, ctx: h }), s.$set(x), (!f || y[0] & /*pickModeVisible*/
      4 && d !== (d = `
                                    transform: ${/*pickModeVisible*/
      h[2] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `)) && U(l, "style", d);
    },
    i(h) {
      f || (Ot(s.$$.fragment, h), f = !0);
    },
    o(h) {
      Ht(s.$$.fragment, h), f = !1;
    },
    d(h) {
      h && _t(t), p && p.d(), g && g.d(), m && m.d(), v && v.d(), un(s);
    }
  };
}
function $he(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Atom", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function e2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Residue", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function t2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Chain", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function n2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Molecule", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function r2e(e) {
  let t, n, r, i, a, o, s, u, l;
  return n = new Vs({
    props: {
      command: Dt.Atom,
      $$slots: { default: [$he] },
      $$scope: { ctx: e }
    }
  }), i = new Vs({
    props: {
      command: Dt.Residue,
      $$slots: { default: [e2e] },
      $$scope: { ctx: e }
    }
  }), o = new Vs({
    props: {
      command: Dt.Chain,
      $$slots: { default: [t2e] },
      $$scope: { ctx: e }
    }
  }), u = new Vs({
    props: {
      command: Dt.Molecular,
      $$slots: { default: [n2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), sn(i.$$.fragment), a = ot(), sn(o.$$.fragment), s = ot(), sn(u.$$.fragment), U(t, "slot", "dropdown"), U(t, "class", "menu-normal");
    },
    m(c, d) {
      xt(c, t, d), ln(n, t, null), re(t, r), ln(i, t, null), re(t, a), ln(o, t, null), re(t, s), ln(u, t, null), l = !0;
    },
    p(c, d) {
      const f = {};
      d[2] & /*$$scope*/
      1048576 && (f.$$scope = { dirty: d, ctx: c }), n.$set(f);
      const p = {};
      d[2] & /*$$scope*/
      1048576 && (p.$$scope = { dirty: d, ctx: c }), i.$set(p);
      const g = {};
      d[2] & /*$$scope*/
      1048576 && (g.$$scope = { dirty: d, ctx: c }), o.$set(g);
      const m = {};
      d[2] & /*$$scope*/
      1048576 && (m.$$scope = { dirty: d, ctx: c }), u.$set(m);
    },
    i(c) {
      l || (Ot(n.$$.fragment, c), Ot(i.$$.fragment, c), Ot(o.$$.fragment, c), Ot(u.$$.fragment, c), l = !0);
    },
    o(c) {
      Ht(n.$$.fragment, c), Ht(i.$$.fragment, c), Ht(o.$$.fragment, c), Ht(u.$$.fragment, c), l = !1;
    },
    d(c) {
      c && _t(t), un(n), un(i), un(o), un(u);
    }
  };
}
function i2e(e) {
  let t, n, r, i, a;
  return {
    c() {
      t = at("svg"), n = at("path"), r = at("path"), i = at("path"), U(n, "d", "M18.3346 10.0003C18.3346 5.39795 14.6037 1.66699 10.0013 1.66699C5.39893 1.66699 1.66797 5.39795 1.66797 10.0003C1.66797 14.6027 5.39893 18.3337 10.0013 18.3337"), U(n, "stroke", "#A2A5C4"), U(n, "stroke-width", "1.3"), U(n, "stroke-linecap", "round"), U(r, "d", "M10 12C11.1046 12 12 11.1046 12 10C12 8.89543 11.1046 8 10 8C8.89543 8 8 8.89543 8 10C8 11.1046 8.89543 12 10 12Z"), U(r, "fill", "#A2A5C4"), U(r, "stroke", "#A2A5C4"), U(r, "stroke-width", "1.3"), U(r, "stroke-linecap", "round"), U(r, "stroke-linejoin", "round"), U(i, "fill-rule", "evenodd"), U(i, "clip-rule", "evenodd"), U(i, "d", "M13 13L19 14.2L17.2 15.4L19 17.2L17.2 19L15.4 17.2L14.2 19L13 13Z"), U(i, "stroke", "#A2A5C4"), U(i, "stroke-linecap", "round"), U(i, "stroke-linejoin", "round"), U(t, "class", a = "uni-view-horizontal-toolbar-icon " + (/*selectionHistory*/
      e[1] ? "" : "disabled") + " svelte-1mqpry1"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 20 20"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg");
    },
    m(o, s) {
      xt(o, t, s), re(t, n), re(t, r), re(t, i);
    },
    p(o, s) {
      s[0] & /*selectionHistory*/
      2 && a !== (a = "uni-view-horizontal-toolbar-icon " + (/*selectionHistory*/
      o[1] ? "" : "disabled") + " svelte-1mqpry1") && U(t, "class", a);
    },
    d(o) {
      o && _t(t);
    }
  };
}
function a2e(e) {
  let t;
  return {
    c() {
      t = Eh(`Expand Selection by Radius and
                                            Include Full Residue.`);
    },
    m(n, r) {
      xt(n, t, r);
    },
    d(n) {
      n && _t(t);
    }
  };
}
function o2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "All", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function s2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Residues", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function u2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Water", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function l2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Solvent Other Than Water", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function c2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "All Solvent", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function d2e(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m;
  return n = new ns({
    props: {
      uid: (
        /*ExpandFilter*/
        e[8].All
      ),
      $$slots: { default: [o2e] },
      $$scope: { ctx: e }
    }
  }), a = new ns({
    props: {
      uid: (
        /*ExpandFilter*/
        e[8].Residues
      ),
      $$slots: { default: [s2e] },
      $$scope: { ctx: e }
    }
  }), u = new ns({
    props: {
      uid: (
        /*ExpandFilter*/
        e[8].Water
      ),
      $$slots: { default: [u2e] },
      $$scope: { ctx: e }
    }
  }), d = new ns({
    props: {
      uid: (
        /*ExpandFilter*/
        e[8].SolventWithoutWater
      ),
      $$slots: { default: [l2e] },
      $$scope: { ctx: e }
    }
  }), g = new ns({
    props: {
      uid: (
        /*ExpandFilter*/
        e[8].Solvent
      ),
      $$slots: { default: [c2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), i = Ve("div"), sn(a.$$.fragment), o = ot(), s = Ve("div"), sn(u.$$.fragment), l = ot(), c = Ve("div"), sn(d.$$.fragment), f = ot(), p = Ve("div"), sn(g.$$.fragment), U(t, "class", "row svelte-1mqpry1"), et(t, "align-items", "center"), et(t, "justify-content", "start"), et(t, "font-size", "12px"), et(t, "color", "#000", 1), U(i, "class", "row svelte-1mqpry1"), et(i, "align-items", "center"), et(i, "justify-content", "start"), et(i, "font-size", "12px"), U(s, "class", "row svelte-1mqpry1"), et(s, "align-items", "center"), et(s, "justify-content", "start"), et(s, "font-size", "12px"), et(s, "color", "#000", 1), U(c, "class", "row svelte-1mqpry1"), et(c, "align-items", "center"), et(c, "justify-content", "start"), et(c, "font-size", "12px"), et(c, "color", "#000", 1), U(p, "class", "row svelte-1mqpry1"), et(p, "align-items", "center"), et(p, "justify-content", "start"), et(p, "font-size", "12px"), et(p, "color", "#000", 1);
    },
    m(v, h) {
      xt(v, t, h), ln(n, t, null), xt(v, r, h), xt(v, i, h), ln(a, i, null), xt(v, o, h), xt(v, s, h), ln(u, s, null), xt(v, l, h), xt(v, c, h), ln(d, c, null), xt(v, f, h), xt(v, p, h), ln(g, p, null), m = !0;
    },
    p(v, h) {
      const y = {};
      h[0] & /*ExpandFilter*/
      256 && (y.uid = /*ExpandFilter*/
      v[8].All), h[2] & /*$$scope*/
      1048576 && (y.$$scope = { dirty: h, ctx: v }), n.$set(y);
      const x = {};
      h[0] & /*ExpandFilter*/
      256 && (x.uid = /*ExpandFilter*/
      v[8].Residues), h[2] & /*$$scope*/
      1048576 && (x.$$scope = { dirty: h, ctx: v }), a.$set(x);
      const S = {};
      h[0] & /*ExpandFilter*/
      256 && (S.uid = /*ExpandFilter*/
      v[8].Water), h[2] & /*$$scope*/
      1048576 && (S.$$scope = { dirty: h, ctx: v }), u.$set(S);
      const b = {};
      h[0] & /*ExpandFilter*/
      256 && (b.uid = /*ExpandFilter*/
      v[8].SolventWithoutWater), h[2] & /*$$scope*/
      1048576 && (b.$$scope = { dirty: h, ctx: v }), d.$set(b);
      const _ = {};
      h[0] & /*ExpandFilter*/
      256 && (_.uid = /*ExpandFilter*/
      v[8].Solvent), h[2] & /*$$scope*/
      1048576 && (_.$$scope = { dirty: h, ctx: v }), g.$set(_);
    },
    i(v) {
      m || (Ot(n.$$.fragment, v), Ot(a.$$.fragment, v), Ot(u.$$.fragment, v), Ot(d.$$.fragment, v), Ot(g.$$.fragment, v), m = !0);
    },
    o(v) {
      Ht(n.$$.fragment, v), Ht(a.$$.fragment, v), Ht(u.$$.fragment, v), Ht(d.$$.fragment, v), Ht(g.$$.fragment, v), m = !1;
    },
    d(v) {
      v && (_t(t), _t(r), _t(i), _t(o), _t(s), _t(l), _t(c), _t(f), _t(p)), un(n), un(a), un(u), un(d), un(g);
    }
  };
}
function f2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Include full residues", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function m2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Include atoms", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function p2e(e) {
  let t, n, r, i;
  return t = new ns({
    props: {
      uid: 1,
      $$slots: { default: [f2e] },
      $$scope: { ctx: e }
    }
  }), r = new ns({
    props: {
      uid: 0,
      $$slots: { default: [m2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      sn(t.$$.fragment), n = ot(), sn(r.$$.fragment);
    },
    m(a, o) {
      ln(t, a, o), xt(a, n, o), ln(r, a, o), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
      const u = {};
      o[2] & /*$$scope*/
      1048576 && (u.$$scope = { dirty: o, ctx: a }), r.$set(u);
    },
    i(a) {
      i || (Ot(t.$$.fragment, a), Ot(r.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(t.$$.fragment, a), Ht(r.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(n), un(t, a), un(r, a);
    }
  };
}
function h2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Exclude Selected Atoms", et(t, "color", "#000", 1);
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function g2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Confirm", et(t, "color", "#000000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function v2e(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G;
  d = new vF({
    props: {
      $$slots: { default: [a2e] },
      $$scope: { ctx: e }
    }
  });
  function H(z) {
    e[39](z);
  }
  let q = {
    label: "Number with Step",
    type: "number",
    input$step: "1",
    suffix: "Å",
    style: "color: #000000"
  };
  return (
    /*surroundingRadius*/
    e[4] !== void 0 && (q.value = /*surroundingRadius*/
    e[4]), p = new Zoe({ props: q }), Rg.push(() => Khe(p, "value", H)), S = new K0({
      props: {
        value: (
          /*expandFilter*/
          e[5]
        ),
        $$slots: { default: [d2e] },
        $$scope: { ctx: e }
      }
    }), S.$on(
      "updateValue",
      /*updateValue_handler*/
      e[40]
    ), E = new K0({
      props: {
        value: (
          /*asWholeResidueState*/
          e[6]
        ),
        $$slots: { default: [p2e] },
        $$scope: { ctx: e }
      }
    }), E.$on(
      "updateValue",
      /*updateValue_handler_1*/
      e[41]
    ), B = new o7({
      props: {
        value: (
          /*excludeSelectedAtoms*/
          e[7]
        ),
        $$slots: { default: [h2e] },
        $$scope: { ctx: e }
      }
    }), B.$on(
      "updateValue",
      /*updateValue_handler_2*/
      e[42]
    ), V = new $v({
      props: {
        $$slots: { default: [g2e] },
        $$scope: { ctx: e }
      }
    }), V.$on(
      "click",
      /*click_handler_3*/
      e[43]
    ), {
      c() {
        t = Ve("div"), n = Ve("div"), r = Ve("div"), i = Eh(`By Radius
                                        `), a = at("svg"), o = at("path"), s = at("path"), u = at("path"), l = at("path"), c = ot(), sn(d.$$.fragment), f = ot(), sn(p.$$.fragment), m = ot(), v = Ve("div"), h = ot(), y = Ve("div"), y.textContent = "Select Structures", x = ot(), sn(S.$$.fragment), b = ot(), _ = Ve("div"), C = ot(), w = Ve("div"), w.textContent = "Other Settings", I = ot(), M = Ve("div"), sn(E.$$.fragment), T = ot(), P = Ve("div"), k = ot(), D = Ve("div"), sn(B.$$.fragment), L = ot(), F = Ve("div"), sn(V.$$.fragment), U(o, "d", "M14 0H0v14h14V0z"), U(o, "fill", "#fff"), U(o, "fill-opacity", ".01"), U(s, "d", "M6.997 12.833c1.611 0 3.07-.653 4.125-1.709A5.815 5.815 0 0 0 12.831 7c0-1.61-.653-3.069-1.709-4.124a5.815 5.815 0 0 0-4.125-1.709c-1.61 0-3.069.653-4.124 1.709a5.815 5.815 0 0 0-1.709 4.124c0 1.611.653 3.07 1.709 4.125a5.815 5.815 0 0 0 4.124 1.709z"), U(s, "stroke", "#A2A5C4"), U(s, "stroke-width", "1.3"), U(s, "stroke-linejoin", "round"), U(u, "fill-rule", "evenodd"), U(u, "clip-rule", "evenodd"), U(u, "d", "M7.003 3.209a.73.73 0 1 1 0 1.458.73.73 0 0 1 0-1.458z"), U(u, "fill", "#A2A5C4"), U(l, "d", "M7.146 9.917V5.834h-.584M6.125 9.916h2.042"), U(l, "stroke", "#A2A5C4"), U(l, "stroke-linecap", "round"), U(l, "stroke-linejoin", "round"), et(a, "margin-left", "6px"), U(a, "width", "1em"), U(a, "height", "1em"), U(a, "viewBox", "0 0 14 14"), U(a, "fill", "none"), U(a, "xmlns", "http://www.w3.org/2000/svg"), U(r, "class", "row svelte-1mqpry1"), et(r, "color", "#888BAB"), U(v, "class", "horizontal-split svelte-1mqpry1"), et(v, "margin", "8px 0"), et(y, "color", "#888BAB"), et(y, "margin-bottom", "8px"), U(_, "class", "horizontal-split svelte-1mqpry1"), et(_, "margin", "8px 0"), et(w, "color", "#888BAB"), et(w, "margin-bottom", "8px"), U(M, "class", "row svelte-1mqpry1"), et(M, "flex-direction", "column"), et(M, "align-items", "center"), et(M, "justify-content", "space-between"), et(M, "font-size", "12px"), et(M, "color", "#000", 1), U(P, "class", "horizontal-split svelte-1mqpry1"), et(P, "margin", "8px 0"), U(D, "class", "row svelte-1mqpry1"), et(D, "align-items", "center"), et(D, "justify-content", "start"), U(F, "class", "row svelte-1mqpry1"), et(F, "align-items", "center"), et(F, "justify-content", "end"), U(n, "class", "uni-view-horizontal-toolbar-surrounding-container svelte-1mqpry1"), U(t, "slot", "dropdown");
      },
      m(z, K) {
        xt(z, t, K), re(t, n), re(n, r), re(r, i), re(r, a), re(a, o), re(a, s), re(a, u), re(a, l), re(r, c), ln(d, r, null), re(n, f), ln(p, n, null), re(n, m), re(n, v), re(n, h), re(n, y), re(n, x), ln(S, n, null), re(n, b), re(n, _), re(n, C), re(n, w), re(n, I), re(n, M), ln(E, M, null), re(n, T), re(n, P), re(n, k), re(n, D), ln(B, D, null), re(n, L), re(n, F), ln(V, F, null), G = !0;
      },
      p(z, K) {
        const Y = {};
        K[2] & /*$$scope*/
        1048576 && (Y.$$scope = { dirty: K, ctx: z }), d.$set(Y);
        const Z = {};
        !g && K[0] & /*surroundingRadius*/
        16 && (g = !0, Z.value = /*surroundingRadius*/
        z[4], jhe(() => g = !1)), p.$set(Z);
        const X = {};
        K[0] & /*expandFilter*/
        32 && (X.value = /*expandFilter*/
        z[5]), K[0] & /*ExpandFilter*/
        256 | K[2] & /*$$scope*/
        1048576 && (X.$$scope = { dirty: K, ctx: z }), S.$set(X);
        const W = {};
        K[0] & /*asWholeResidueState*/
        64 && (W.value = /*asWholeResidueState*/
        z[6]), K[2] & /*$$scope*/
        1048576 && (W.$$scope = { dirty: K, ctx: z }), E.$set(W);
        const J = {};
        K[0] & /*excludeSelectedAtoms*/
        128 && (J.value = /*excludeSelectedAtoms*/
        z[7]), K[2] & /*$$scope*/
        1048576 && (J.$$scope = { dirty: K, ctx: z }), B.$set(J);
        const $ = {};
        K[2] & /*$$scope*/
        1048576 && ($.$$scope = { dirty: K, ctx: z }), V.$set($);
      },
      i(z) {
        G || (Ot(d.$$.fragment, z), Ot(p.$$.fragment, z), Ot(S.$$.fragment, z), Ot(E.$$.fragment, z), Ot(B.$$.fragment, z), Ot(V.$$.fragment, z), G = !0);
      },
      o(z) {
        Ht(d.$$.fragment, z), Ht(p.$$.fragment, z), Ht(S.$$.fragment, z), Ht(E.$$.fragment, z), Ht(B.$$.fragment, z), Ht(V.$$.fragment, z), G = !1;
      },
      d(z) {
        z && _t(t), un(d), un(p), un(S), un(E), un(B), un(V);
      }
    }
  );
}
function y2e(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f;
  return {
    c() {
      t = Ve("div"), n = at("svg"), r = at("path"), i = at("path"), a = at("path"), o = at("path"), s = at("path"), u = at("path"), l = ot(), c = at("svg"), d = at("path"), U(r, "d", "M20 0H0V20H20V0Z"), U(r, "fill", "white"), U(r, "fill-opacity", "0.01"), U(i, "d", "M16.9165 7.2469C17.6976 6.46585 17.6976 5.19952 16.9165 4.41847L15.5783 3.08023C14.7972 2.29918 13.5309 2.29918 12.7498 3.08023L12.6016 3.22852L11.0391 4.79102L7.91406 7.91602L4.78906 11.041L3.22656 12.6035L3.07828 12.7518C2.29723 13.5329 2.29723 14.7992 3.07828 15.5802L4.41652 16.9185C5.19757 17.6995 6.46389 17.6995 7.24494 16.9185L16.9165 7.2469Z"), U(i, "stroke", "#A2A5C4"), U(i, "stroke-width", "1.3"), U(i, "stroke-linecap", "square"), U(i, "stroke-linejoin", "round"), U(a, "d", "M12.6016 3.22852L3.22656 12.6035"), U(a, "stroke", "#A2A5C4"), U(a, "stroke-width", "1.3"), U(a, "stroke-linecap", "square"), U(a, "stroke-linejoin", "round"), U(o, "d", "M3.75 12.084L4.75 13.084"), U(o, "stroke", "#A2A5C4"), U(o, "stroke-width", "1.3"), U(o, "stroke-linecap", "round"), U(o, "stroke-linejoin", "round"), U(s, "d", "M7.91406 7.91602L9.58073 9.58268"), U(s, "stroke", "#A2A5C4"), U(s, "stroke-width", "1.3"), U(s, "stroke-linecap", "round"), U(s, "stroke-linejoin", "round"), U(u, "d", "M12.0781 3.75L13.0781 4.75"), U(u, "stroke", "#A2A5C4"), U(u, "stroke-width", "1.3"), U(u, "stroke-linecap", "round"), U(u, "stroke-linejoin", "round"), et(n, "margin-left", "5"), U(n, "class", "normal-icon svelte-1mqpry1"), U(n, "width", "1em"), U(n, "height", "1em"), U(n, "viewBox", "0 0 20 20"), U(n, "fill", "none"), U(n, "xmlns", "http://www.w3.org/2000/svg"), U(d, "d", "M6.95641 5.66979L4.15766 2.07713C4.07755 1.97429 3.9233 1.97429 3.84234 2.07713L1.04359 5.66979C0.939613 5.80376 1.03336 6 1.20125 6L6.79875 6C6.96664 6 7.06039 5.80376 6.95641 5.66979Z"), U(d, "fill", "#888BAB"), U(c, "width", "1em"), U(c, "height", "1em"), U(c, "viewBox", "0 0 8 8"), U(c, "fill", "none"), U(c, "xmlns", "http://www.w3.org/2000/svg"), U(c, "style", f = `
                                    transform: ${/*measureVisible*/
      e[12] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `), U(t, "class", "row svelte-1mqpry1"), U(t, "style", "flex-shrink: 0; align-items: center; justify-content: center;");
    },
    m(p, g) {
      xt(p, t, g), re(t, n), re(n, r), re(n, i), re(n, a), re(n, o), re(n, s), re(n, u), re(t, l), re(t, c), re(c, d);
    },
    p(p, g) {
      g[0] & /*measureVisible*/
      4096 && f !== (f = `
                                    transform: ${/*measureVisible*/
      p[12] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `) && U(c, "style", f);
    },
    d(p) {
      p && _t(t);
    }
  };
}
function b2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Distance", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function _2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Angle", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function x2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Dihedral", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function C2e(e) {
  let t, n, r, i, a, o, s;
  return n = new Vs({
    props: {
      command: fe.Distance,
      $$slots: { default: [b2e] },
      $$scope: { ctx: e }
    }
  }), i = new Vs({
    props: {
      command: fe.Angle,
      $$slots: { default: [_2e] },
      $$scope: { ctx: e }
    }
  }), o = new Vs({
    props: {
      command: fe.Dihedral,
      $$slots: { default: [x2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), sn(i.$$.fragment), a = ot(), sn(o.$$.fragment), U(t, "slot", "dropdown"), U(t, "class", "menu-normal");
    },
    m(u, l) {
      xt(u, t, l), ln(n, t, null), re(t, r), ln(i, t, null), re(t, a), ln(o, t, null), s = !0;
    },
    p(u, l) {
      const c = {};
      l[2] & /*$$scope*/
      1048576 && (c.$$scope = { dirty: l, ctx: u }), n.$set(c);
      const d = {};
      l[2] & /*$$scope*/
      1048576 && (d.$$scope = { dirty: l, ctx: u }), i.$set(d);
      const f = {};
      l[2] & /*$$scope*/
      1048576 && (f.$$scope = { dirty: l, ctx: u }), o.$set(f);
    },
    i(u) {
      s || (Ot(n.$$.fragment, u), Ot(i.$$.fragment, u), Ot(o.$$.fragment, u), s = !0);
    },
    o(u) {
      Ht(n.$$.fragment, u), Ht(i.$$.fragment, u), Ht(o.$$.fragment, u), s = !1;
    },
    d(u) {
      u && _t(t), un(n), un(i), un(o);
    }
  };
}
function S2e(e) {
  let t, n, r, i, a;
  return {
    c() {
      t = at("svg"), n = at("path"), U(n, "d", "M6.95641 5.66979L4.15766 2.07713C4.07755 1.97429 3.9233 1.97429 3.84234 2.07713L1.04359 5.66979C0.939613 5.80376 1.03336 6 1.20125 6L6.79875 6C6.96664 6 7.06039 5.80376 6.95641 5.66979Z"), U(n, "fill", "#888BAB"), U(t, "width", "1em"), U(t, "height", "1em"), U(t, "viewBox", "0 0 8 8"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg"), U(t, "style", r = `
                                    transform: ${/*interactionVisible*/
      e[15] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `);
    },
    m(o, s) {
      xt(o, t, s), re(t, n), i || (a = jo(
        t,
        "click",
        /*click_handler_7*/
        e[55]
      ), i = !0);
    },
    p(o, s) {
      s[0] & /*interactionVisible*/
      32768 && r !== (r = `
                                    transform: ${/*interactionVisible*/
      o[15] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `) && U(t, "style", r);
    },
    d(o) {
      o && _t(t), i = !1, a();
    }
  };
}
function A2e(e) {
  let t, n, r = (
    /*item*/
    e[75].label + ""
  ), i, a, o;
  return {
    c() {
      t = Ve("div"), n = Ve("span"), i = Eh(r), a = ot(), o = Ve("div"), U(
        n,
        "style",
        /*item*/
        e[75].disabled ? "color: #b1b4d3;" : ""
      ), U(o, "class", "uni-view-color-block svelte-1mqpry1"), et(
        o,
        "background-color",
        /*item*/
        e[75].color
      ), U(t, "class", "row svelte-1mqpry1"), et(t, "align-items", "center"), et(t, "color", "#000");
    },
    m(s, u) {
      xt(s, t, u), re(t, n), re(n, i), re(t, a), re(t, o);
    },
    p: rr,
    d(s) {
      s && _t(t);
    }
  };
}
function OE(e) {
  let t, n, r, i;
  return n = new o7({
    props: {
      uid: (
        /*item*/
        e[75].value
      ),
      disabled: (
        /*item*/
        e[75].disabled
      ),
      $$slots: { default: [A2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), et(t, "flex", "0 0 50%");
    },
    m(a, o) {
      xt(a, t, o), ln(n, t, null), re(t, r), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), n.$set(s);
    },
    i(a) {
      i || (Ot(n.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(n.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(t), un(n);
    }
  };
}
function w2e(e) {
  let t, n, r = Dm(
    /*NonCovalentBondsOption*/
    e[23]
  ), i = [];
  for (let o = 0; o < r.length; o += 1)
    i[o] = OE(PE(e, r, o));
  const a = (o) => Ht(i[o], 1, 1, () => {
    i[o] = null;
  });
  return {
    c() {
      t = Ve("div");
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      U(t, "class", "row svelte-1mqpry1");
    },
    m(o, s) {
      xt(o, t, s);
      for (let u = 0; u < i.length; u += 1)
        i[u] && i[u].m(t, null);
      n = !0;
    },
    p(o, s) {
      if (s[0] & /*NonCovalentBondsOption*/
      8388608) {
        r = Dm(
          /*NonCovalentBondsOption*/
          o[23]
        );
        let u;
        for (u = 0; u < r.length; u += 1) {
          const l = PE(o, r, u);
          i[u] ? (i[u].p(l, s), Ot(i[u], 1)) : (i[u] = OE(l), i[u].c(), Ot(i[u], 1), i[u].m(t, null));
        }
        for (ny(), u = r.length; u < i.length; u += 1)
          a(u);
        ty();
      }
    },
    i(o) {
      if (!n) {
        for (let s = 0; s < r.length; s += 1)
          Ot(i[s]);
        n = !0;
      }
    },
    o(o) {
      i = i.filter(Boolean);
      for (let s = 0; s < i.length; s += 1)
        Ht(i[s]);
      n = !1;
    },
    d(o) {
      o && _t(t), q7(i, o);
    }
  };
}
function I2e(e) {
  let t, n, r, i;
  return {
    c() {
      t = Ve("div"), n = Ve("span"), n.textContent = `${/*item*/
      e[75].label}`, r = ot(), i = Ve("div"), U(i, "class", "uni-view-color-block svelte-1mqpry1"), et(
        i,
        "background-color",
        /*item*/
        e[75].color
      ), U(t, "class", "row svelte-1mqpry1"), et(t, "align-items", "center"), et(t, "color", "#000");
    },
    m(a, o) {
      xt(a, t, o), re(t, n), re(t, r), re(t, i);
    },
    p: rr,
    d(a) {
      a && _t(t);
    }
  };
}
function BE(e) {
  let t, n, r, i;
  return n = new o7({
    props: {
      uid: (
        /*item*/
        e[75].value
      ),
      $$slots: { default: [I2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), et(t, "flex", "0 0 50%");
    },
    m(a, o) {
      xt(a, t, o), ln(n, t, null), re(t, r), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), n.$set(s);
    },
    i(a) {
      i || (Ot(n.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(n.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(t), un(n);
    }
  };
}
function P2e(e) {
  let t, n, r = Dm(
    /*ElectrostaticOption*/
    e[24]
  ), i = [];
  for (let o = 0; o < r.length; o += 1)
    i[o] = BE(IE(e, r, o));
  const a = (o) => Ht(i[o], 1, 1, () => {
    i[o] = null;
  });
  return {
    c() {
      t = Ve("div");
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      U(t, "class", "row svelte-1mqpry1");
    },
    m(o, s) {
      xt(o, t, s);
      for (let u = 0; u < i.length; u += 1)
        i[u] && i[u].m(t, null);
      n = !0;
    },
    p(o, s) {
      if (s[0] & /*ElectrostaticOption*/
      16777216) {
        r = Dm(
          /*ElectrostaticOption*/
          o[24]
        );
        let u;
        for (u = 0; u < r.length; u += 1) {
          const l = IE(o, r, u);
          i[u] ? (i[u].p(l, s), Ot(i[u], 1)) : (i[u] = BE(l), i[u].c(), Ot(i[u], 1), i[u].m(t, null));
        }
        for (ny(), u = r.length; u < i.length; u += 1)
          a(u);
        ty();
      }
    },
    i(o) {
      if (!n) {
        for (let s = 0; s < r.length; s += 1)
          Ot(i[s]);
        n = !0;
      }
    },
    o(o) {
      i = i.filter(Boolean);
      for (let s = 0; s < i.length; s += 1)
        Ht(i[s]);
      n = !1;
    },
    d(o) {
      o && _t(t), q7(i, o);
    }
  };
}
function M2e(e) {
  let t;
  return {
    c() {
      t = Ve("span"), t.textContent = `${/*item*/
      e[75].label}`, et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function RE(e) {
  let t, n, r, i;
  return n = new ns({
    props: {
      uid: (
        /*item*/
        e[75].value
      ),
      $$slots: { default: [M2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), et(t, "flex", "0 0 50%");
    },
    m(a, o) {
      xt(a, t, o), ln(n, t, null), re(t, r), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), n.$set(s);
    },
    i(a) {
      i || (Ot(n.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(n.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(t), un(n);
    }
  };
}
function E2e(e) {
  let t, n, r = Dm(
    /*InteractionTypeOption*/
    e[25]
  ), i = [];
  for (let o = 0; o < r.length; o += 1)
    i[o] = RE(wE(e, r, o));
  const a = (o) => Ht(i[o], 1, 1, () => {
    i[o] = null;
  });
  return {
    c() {
      t = Ve("div");
      for (let o = 0; o < i.length; o += 1)
        i[o].c();
      U(t, "class", "row svelte-1mqpry1");
    },
    m(o, s) {
      xt(o, t, s);
      for (let u = 0; u < i.length; u += 1)
        i[u] && i[u].m(t, null);
      n = !0;
    },
    p(o, s) {
      if (s[0] & /*InteractionTypeOption*/
      33554432) {
        r = Dm(
          /*InteractionTypeOption*/
          o[25]
        );
        let u;
        for (u = 0; u < r.length; u += 1) {
          const l = wE(o, r, u);
          i[u] ? (i[u].p(l, s), Ot(i[u], 1)) : (i[u] = RE(l), i[u].c(), Ot(i[u], 1), i[u].m(t, null));
        }
        for (ny(), u = r.length; u < i.length; u += 1)
          a(u);
        ty();
      }
    },
    i(o) {
      if (!n) {
        for (let s = 0; s < r.length; s += 1)
          Ot(i[s]);
        n = !0;
      }
    },
    o(o) {
      i = i.filter(Boolean);
      for (let s = 0; s < i.length; s += 1)
        Ht(i[s]);
      n = !1;
    },
    d(o) {
      o && _t(t), q7(i, o);
    }
  };
}
function T2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Cancel", et(t, "color", "#000000"), et(t, "margin-right", "12px");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function k2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Confirm", et(t, "color", "#000000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function D2e(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b;
  return s = new tE({
    props: {
      value: (
        /*nonCovalentBondsSetting*/
        e[16]
      ),
      $$slots: { default: [w2e] },
      $$scope: { ctx: e }
    }
  }), s.$on(
    "updateValue",
    /*updateValue_handler_3*/
    e[50]
  ), d = new tE({
    props: {
      value: (
        /*electrostaticSetting*/
        e[17]
      ),
      $$slots: { default: [P2e] },
      $$scope: { ctx: e }
    }
  }), d.$on(
    "updateValue",
    /*updateValue_handler_4*/
    e[51]
  ), m = new K0({
    props: {
      value: (
        /*interactionType*/
        e[18]
      ),
      $$slots: { default: [E2e] },
      $$scope: { ctx: e }
    }
  }), m.$on(
    "updateValue",
    /*updateValue_handler_5*/
    e[52]
  ), y = new $v({
    props: {
      $$slots: { default: [T2e] },
      $$scope: { ctx: e }
    }
  }), y.$on(
    "click",
    /*click_handler_5*/
    e[53]
  ), S = new $v({
    props: {
      $$slots: { default: [k2e] },
      $$scope: { ctx: e }
    }
  }), S.$on(
    "click",
    /*click_handler_6*/
    e[54]
  ), {
    c() {
      t = Ve("div"), n = Ve("div"), r = Ve("div"), r.textContent = "3D Interaction", i = ot(), a = Ve("div"), a.textContent = "Non-covalent Bonds", o = ot(), sn(s.$$.fragment), u = ot(), l = Ve("div"), l.textContent = "Pi Interactions", c = ot(), sn(d.$$.fragment), f = ot(), p = Ve("div"), p.textContent = "Object of Interaction", g = ot(), sn(m.$$.fragment), v = ot(), h = Ve("div"), sn(y.$$.fragment), x = ot(), sn(S.$$.fragment), U(r, "class", "interaction-title svelte-1mqpry1"), U(a, "class", "checkbox-title svelte-1mqpry1"), U(l, "class", "checkbox-title svelte-1mqpry1"), et(l, "padding-top", "8px"), U(p, "class", "checkbox-title svelte-1mqpry1"), et(p, "padding-top", "8px"), U(h, "class", "row svelte-1mqpry1"), et(h, "justify-content", "end"), U(n, "class", "interaction-setting svelte-1mqpry1"), U(t, "slot", "dropdown");
    },
    m(_, C) {
      xt(_, t, C), re(t, n), re(n, r), re(n, i), re(n, a), re(n, o), ln(s, n, null), re(n, u), re(n, l), re(n, c), ln(d, n, null), re(n, f), re(n, p), re(n, g), ln(m, n, null), re(n, v), re(n, h), ln(y, h, null), re(h, x), ln(S, h, null), b = !0;
    },
    p(_, C) {
      const w = {};
      C[0] & /*nonCovalentBondsSetting*/
      65536 && (w.value = /*nonCovalentBondsSetting*/
      _[16]), C[2] & /*$$scope*/
      1048576 && (w.$$scope = { dirty: C, ctx: _ }), s.$set(w);
      const I = {};
      C[0] & /*electrostaticSetting*/
      131072 && (I.value = /*electrostaticSetting*/
      _[17]), C[2] & /*$$scope*/
      1048576 && (I.$$scope = { dirty: C, ctx: _ }), d.$set(I);
      const M = {};
      C[0] & /*interactionType*/
      262144 && (M.value = /*interactionType*/
      _[18]), C[2] & /*$$scope*/
      1048576 && (M.$$scope = { dirty: C, ctx: _ }), m.$set(M);
      const E = {};
      C[2] & /*$$scope*/
      1048576 && (E.$$scope = { dirty: C, ctx: _ }), y.$set(E);
      const T = {};
      C[2] & /*$$scope*/
      1048576 && (T.$$scope = { dirty: C, ctx: _ }), S.$set(T);
    },
    i(_) {
      b || (Ot(s.$$.fragment, _), Ot(d.$$.fragment, _), Ot(m.$$.fragment, _), Ot(y.$$.fragment, _), Ot(S.$$.fragment, _), b = !0);
    },
    o(_) {
      Ht(s.$$.fragment, _), Ht(d.$$.fragment, _), Ht(m.$$.fragment, _), Ht(y.$$.fragment, _), Ht(S.$$.fragment, _), b = !1;
    },
    d(_) {
      _ && _t(t), un(s), un(d), un(m), un(y), un(S);
    }
  };
}
function O2e(e) {
  let t, n, r, i, a, o, s, u, l;
  return {
    c() {
      t = Ve("div"), n = at("svg"), r = at("path"), i = at("path"), a = at("line"), o = ot(), s = at("svg"), u = at("path"), U(r, "d", "M16 5.5V2.75C16 2.33579 15.6642 2 15.25 2H4.75C4.33579 2 4 2.33579 4 2.75V17L10 13.8977L16 17V15M16 7.5V13"), U(r, "stroke", "#A2A5C4"), U(r, "stroke-width", "1.25"), U(r, "stroke-linecap", "round"), U(r, "stroke-linejoin", "round"), U(i, "d", "M13.5 10H18.5"), U(i, "stroke", "#A2A5C4"), U(i, "stroke-width", "1.25"), U(i, "stroke-linecap", "round"), U(i, "stroke-linejoin", "round"), U(a, "x1", "6.5"), U(a, "y1", "5.5"), U(a, "x2", "13.5"), U(a, "y2", "5.5"), U(a, "stroke", "#A2A5C4"), U(a, "stroke-linecap", "round"), et(n, "margin-left", "5"), U(n, "class", "normal-icon svelte-1mqpry1"), U(n, "width", "1em"), U(n, "height", "1em"), U(n, "viewBox", "0 0 20 20"), U(n, "fill", "none"), U(n, "xmlns", "http://www.w3.org/2000/svg"), U(u, "d", "M6.95641 5.66979L4.15766 2.07713C4.07755 1.97429 3.9233 1.97429 3.84234 2.07713L1.04359 5.66979C0.939613 5.80376 1.03336 6 1.20125 6L6.79875 6C6.96664 6 7.06039 5.80376 6.95641 5.66979Z"), U(u, "fill", "#888BAB"), U(s, "width", "1em"), U(s, "height", "1em"), U(s, "viewBox", "0 0 8 8"), U(s, "fill", "none"), U(s, "xmlns", "http://www.w3.org/2000/svg"), U(s, "style", l = `
                                    transform: ${/*labelVisible*/
      e[13] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `), U(t, "class", "row svelte-1mqpry1"), U(t, "style", "flex-shrink: 0; align-items: center; justify-content: center;");
    },
    m(c, d) {
      xt(c, t, d), re(t, n), re(n, r), re(n, i), re(n, a), re(t, o), re(t, s), re(s, u);
    },
    p(c, d) {
      d[0] & /*labelVisible*/
      8192 && l !== (l = `
                                    transform: ${/*labelVisible*/
      c[13] ? "rotate(0)" : "rotate(180deg)"};
                                    font-size: 8px;
                                    color: #a2a5ca;
                                `) && U(s, "style", l);
    },
    d(c) {
      c && _t(t);
    }
  };
}
function B2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Atom", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function R2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Residue", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function L2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Chain", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function N2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Molecule", U(t, "class", "row svelte-1mqpry1"), U(t, "style", "align-items: center");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function F2e(e) {
  let t, n, r, i, a, o, s, u, l;
  return n = new Vs({
    props: {
      command: Dt.Atom,
      $$slots: { default: [B2e] },
      $$scope: { ctx: e }
    }
  }), i = new Vs({
    props: {
      command: Dt.Residue,
      $$slots: { default: [R2e] },
      $$scope: { ctx: e }
    }
  }), o = new Vs({
    props: {
      command: Dt.Chain,
      $$slots: { default: [L2e] },
      $$scope: { ctx: e }
    }
  }), u = new Vs({
    props: {
      command: Dt.Molecular,
      $$slots: { default: [N2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      t = Ve("div"), sn(n.$$.fragment), r = ot(), sn(i.$$.fragment), a = ot(), sn(o.$$.fragment), s = ot(), sn(u.$$.fragment), U(t, "slot", "dropdown"), U(t, "class", "menu-normal");
    },
    m(c, d) {
      xt(c, t, d), ln(n, t, null), re(t, r), ln(i, t, null), re(t, a), ln(o, t, null), re(t, s), ln(u, t, null), l = !0;
    },
    p(c, d) {
      const f = {};
      d[2] & /*$$scope*/
      1048576 && (f.$$scope = { dirty: d, ctx: c }), n.$set(f);
      const p = {};
      d[2] & /*$$scope*/
      1048576 && (p.$$scope = { dirty: d, ctx: c }), i.$set(p);
      const g = {};
      d[2] & /*$$scope*/
      1048576 && (g.$$scope = { dirty: d, ctx: c }), o.$set(g);
      const m = {};
      d[2] & /*$$scope*/
      1048576 && (m.$$scope = { dirty: d, ctx: c }), u.$set(m);
    },
    i(c) {
      l || (Ot(n.$$.fragment, c), Ot(i.$$.fragment, c), Ot(o.$$.fragment, c), Ot(u.$$.fragment, c), l = !0);
    },
    o(c) {
      Ht(n.$$.fragment, c), Ht(i.$$.fragment, c), Ht(o.$$.fragment, c), Ht(u.$$.fragment, c), l = !1;
    },
    d(c) {
      c && _t(t), un(n), un(i), un(o), un(u);
    }
  };
}
function V2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.innerHTML = '<svg style="margin-left: 5" class="uni-view-horizontal-toolbar-icon uni-view-horizontal-toolbar-dropdown svelte-1mqpry1" width="1em" height="1em" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 6V2H6" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6 18H2V14" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M18 14V18H14" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M14 2H18V6" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 5.25V14.75" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13 5.25V14.75" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7 10H13" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path></svg>';
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function G2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Show All Polar Hydrogen", et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function z2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Hide All Polar Hydrogen", et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function U2e(e) {
  let t, n, r, i;
  return t = new ns({
    props: {
      uid: 1,
      $$slots: { default: [G2e] },
      $$scope: { ctx: e }
    }
  }), r = new ns({
    props: {
      uid: 0,
      $$slots: { default: [z2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      sn(t.$$.fragment), n = ot(), sn(r.$$.fragment);
    },
    m(a, o) {
      ln(t, a, o), xt(a, n, o), ln(r, a, o), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
      const u = {};
      o[2] & /*$$scope*/
      1048576 && (u.$$scope = { dirty: o, ctx: a }), r.$set(u);
    },
    i(a) {
      i || (Ot(t.$$.fragment, a), Ot(r.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(t.$$.fragment, a), Ht(r.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(n), un(t, a), un(r, a);
    }
  };
}
function H2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Show All Non-Polar Hydrogen", et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function q2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Hide All Non-Polar Hydrogen", et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function j2e(e) {
  let t, n, r, i;
  return t = new ns({
    props: {
      uid: 1,
      $$slots: { default: [H2e] },
      $$scope: { ctx: e }
    }
  }), r = new ns({
    props: {
      uid: 0,
      $$slots: { default: [q2e] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      sn(t.$$.fragment), n = ot(), sn(r.$$.fragment);
    },
    m(a, o) {
      ln(t, a, o), xt(a, n, o), ln(r, a, o), i = !0;
    },
    p(a, o) {
      const s = {};
      o[2] & /*$$scope*/
      1048576 && (s.$$scope = { dirty: o, ctx: a }), t.$set(s);
      const u = {};
      o[2] & /*$$scope*/
      1048576 && (u.$$scope = { dirty: o, ctx: a }), r.$set(u);
    },
    i(a) {
      i || (Ot(t.$$.fragment, a), Ot(r.$$.fragment, a), i = !0);
    },
    o(a) {
      Ht(t.$$.fragment, a), Ht(r.$$.fragment, a), i = !1;
    },
    d(a) {
      a && _t(n), un(t, a), un(r, a);
    }
  };
}
function K2e(e) {
  let t;
  return {
    c() {
      t = Ve("div"), t.textContent = "Confirm", et(t, "color", "#000");
    },
    m(n, r) {
      xt(n, t, r);
    },
    p: rr,
    d(n) {
      n && _t(t);
    }
  };
}
function Y2e(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C;
  return p = new K0({
    props: {
      value: (
        /*isShowPolar*/
        e[21]
      ),
      $$slots: { default: [U2e] },
      $$scope: { ctx: e }
    }
  }), p.$on(
    "updateValue",
    /*updateValue_handler_6*/
    e[67]
  ), h = new K0({
    props: {
      value: (
        /*isShowNoPolar*/
        e[22]
      ),
      $$slots: { default: [j2e] },
      $$scope: { ctx: e }
    }
  }), h.$on(
    "updateValue",
    /*updateValue_handler_7*/
    e[68]
  ), S = new $v({
    props: {
      $$slots: { default: [K2e] },
      $$scope: { ctx: e }
    }
  }), S.$on(
    "click",
    /*click_handler_15*/
    e[69]
  ), {
    c() {
      t = Ve("div"), n = Ve("div"), r = Ve("div"), i = Ve("div"), i.textContent = "Hydrogen Display Setting", a = ot(), o = Ve("div"), s = at("svg"), u = at("path"), l = at("path"), c = ot(), d = Ve("div"), d.textContent = "Polar Hydrogen", f = ot(), sn(p.$$.fragment), g = ot(), m = Ve("div"), m.textContent = "Non-polar Hydrogen", v = ot(), sn(h.$$.fragment), y = ot(), x = Ve("div"), sn(S.$$.fragment), et(i, "line-height", "20px"), et(i, "height", "20px"), et(i, "font-weight", "600"), et(i, "color", "#000"), U(u, "d", "M14 0H0v14h14V0z"), U(u, "fill", "#fff"), U(u, "fill-opacity", ".01"), U(l, "d", "M2.336 2.334l9.333 9.333M2.336 11.667l9.333-9.333"), U(l, "stroke", "#A2A5C4"), U(l, "stroke-width", "1.3"), U(l, "stroke-linecap", "round"), U(l, "stroke-linejoin", "round"), U(s, "width", "1em"), U(s, "height", "1em"), U(s, "viewBox", "0 0 14 14"), U(s, "fill", "none"), U(s, "xmlns", "http://www.w3.org/2000/svg"), U(r, "class", "row dropdown-header svelte-1mqpry1"), et(r, "justify-content", "space-between"), et(r, "align-items", "center"), et(r, "margin-top", "4px"), et(r, "margin-bottom", "12px"), et(d, "color", "#888bab"), et(d, "margin-bottom", "8px"), et(m, "color", "#888bab"), et(m, "margin-bottom", "8px"), U(x, "class", "row svelte-1mqpry1"), et(x, "justify-content", "end"), U(n, "class", "uni-view-horizontal-toolbar-surrounding-container svelte-1mqpry1"), et(n, "width", "226px"), U(t, "slot", "dropdown");
    },
    m(w, I) {
      xt(w, t, I), re(t, n), re(n, r), re(r, i), re(r, a), re(r, o), re(o, s), re(s, u), re(s, l), re(n, c), re(n, d), re(n, f), ln(p, n, null), re(n, g), re(n, m), re(n, v), ln(h, n, null), re(n, y), re(n, x), ln(S, x, null), b = !0, _ || (C = jo(
        s,
        "click",
        /*click_handler_14*/
        e[66]
      ), _ = !0);
    },
    p(w, I) {
      const M = {};
      I[0] & /*isShowPolar*/
      2097152 && (M.value = /*isShowPolar*/
      w[21]), I[2] & /*$$scope*/
      1048576 && (M.$$scope = { dirty: I, ctx: w }), p.$set(M);
      const E = {};
      I[0] & /*isShowNoPolar*/
      4194304 && (E.value = /*isShowNoPolar*/
      w[22]), I[2] & /*$$scope*/
      1048576 && (E.$$scope = { dirty: I, ctx: w }), h.$set(E);
      const T = {};
      I[2] & /*$$scope*/
      1048576 && (T.$$scope = { dirty: I, ctx: w }), S.$set(T);
    },
    i(w) {
      b || (Ot(p.$$.fragment, w), Ot(h.$$.fragment, w), Ot(S.$$.fragment, w), b = !0);
    },
    o(w) {
      Ht(p.$$.fragment, w), Ht(h.$$.fragment, w), Ht(S.$$.fragment, w), b = !1;
    },
    d(w) {
      w && _t(t), un(p), un(h), un(S), _ = !1, C();
    }
  };
}
function W2e(e) {
  let t, n, r = (
    /*lightPlugin*/
    e[0].canvas3d && ME(e)
  );
  return {
    c() {
      t = Ve("div"), r && r.c(), U(t, "class", "uni-view-horizontal-toolbar-container svelte-1mqpry1");
    },
    m(i, a) {
      xt(i, t, a), r && r.m(t, null), n = !0;
    },
    p(i, a) {
      /*lightPlugin*/
      i[0].canvas3d ? r ? (r.p(i, a), a[0] & /*lightPlugin*/
      1 && Ot(r, 1)) : (r = ME(i), r.c(), Ot(r, 1), r.m(t, null)) : r && (ny(), Ht(r, 1, 1, () => {
        r = null;
      }), ty());
    },
    i(i) {
      n || (Ot(r), n = !0);
    },
    o(i) {
      Ht(r), n = !1;
    },
    d(i) {
      i && _t(t), r && r.d();
    }
  };
}
function X2e(e, t, n) {
  var r = this && this.__awaiter || function(Te, At, Gt, Tt) {
    function nn(Pt) {
      return Pt instanceof Gt ? Pt : new Gt(function(Yt) {
        Yt(Pt);
      });
    }
    return new (Gt || (Gt = Promise))(function(Pt, Yt) {
      function Rn(Kn) {
        try {
          Pn(Tt.next(Kn));
        } catch (br) {
          Yt(br);
        }
      }
      function kn(Kn) {
        try {
          Pn(Tt.throw(Kn));
        } catch (br) {
          Yt(br);
        }
      }
      function Pn(Kn) {
        Kn.done ? Pt(Kn.value) : nn(Kn.value).then(Rn, kn);
      }
      Pn((Tt = Tt.apply(Te, At || [])).next());
    });
  }, i = this && this.__rest || function(Te, At) {
    var Gt = {};
    for (var Tt in Te) Object.prototype.hasOwnProperty.call(Te, Tt) && At.indexOf(Tt) < 0 && (Gt[Tt] = Te[Tt]);
    if (Te != null && typeof Object.getOwnPropertySymbols == "function") for (var nn = 0, Tt = Object.getOwnPropertySymbols(Te); nn < Tt.length; nn++)
      At.indexOf(Tt[nn]) < 0 && Object.prototype.propertyIsEnumerable.call(Te, Tt[nn]) && (Gt[Tt[nn]] = Te[Tt[nn]]);
    return Gt;
  }, a;
  (function(Te) {
    Te[Te.All = 0] = "All", Te[Te.Residues = 1] = "Residues", Te[Te.Water = 2] = "Water", Te[Te.SolventWithoutWater = 3] = "SolventWithoutWater", Te[Te.Solvent = 4] = "Solvent";
  })(a || (a = {}));
  let { gradio: o } = t, { lightPlugin: s } = t, { isFixedRight: u } = t, { rootWidth: l } = t, { selectionHistory: c } = t;
  const d = [
    {
      label: "Hydrogen Bonds",
      value: $r.HydrogenBonds,
      color: "#FF9C33"
    },
    {
      label: "Weak H-Bonds",
      value: $r.WeakHydrogenBonds,
      color: "#FFE89F"
    },
    {
      label: "Halogen Bonds",
      value: $r.HalogenBonds,
      color: "#5DE8EA"
    },
    {
      label: "Salt Bridge",
      value: $r.SaltBridge,
      color: "#F164F3"
    },
    // { label: 'Metal Bond', value: 'metalBond', color: '#B1B4D3' },
    {
      label: "Aromatic H-Bond",
      value: "arHbond",
      disabled: !0,
      color: "#A68EFF"
    }
  ], f = [
    {
      label: "Pi-Pi Stacking",
      value: $r.PiPiStacking,
      color: "#43B3F9"
    },
    {
      label: "Pi-Cations",
      value: $r.PiCations,
      color: "#33C46D"
    }
  ], p = [
    {
      label: "All",
      value: Yr.All
    },
    {
      label: "Ligand-Receptor",
      value: Yr.LigandReceptor
    },
    {
      label: "Intra-Ligand",
      value: Yr.IntraLigand
    },
    {
      label: "Intra-Receptor",
      value: Yr.IntraReceptor
    }
  ];
  let g = "";
  const m = () => {
    n(9, g = `width: ${l}px; overflowX: ${u ? "scroll" : "hidden"}`);
  };
  let v = !1, h = Dt.Residue;
  const y = (Te) => Te === Dt.Atom ? "Atom" : Te === Dt.Residue ? "Residue" : Te === Dt.Chain ? "Chain" : Te === Dt.Molecular ? "Molecule" : "Residue", x = (Te) => {
    (() => {
      s.managers.selection.structure.clear();
      const Gt = A8(s);
      Object.keys(Gt).forEach((Tt) => {
        var nn;
        const Pt = Gt[Tt], Yt = Te === ei.Solvent ? [...Pt[Te], ...Pt[ei.Water]] : Pt[Te];
        Yt.length && s.managers.selection.structure.add(
          {
            item: {
              ref: Tt,
              elementIds: (nn = Yt.map((Rn) => Rn.elementIds).flat()) !== null && nn !== void 0 ? nn : []
            }
          },
          !1
        );
      });
    })();
  }, S = (Te, At) => {
    if (!c) return;
    const Gt = s.managers.selection.structure.getSelectionCellItems();
    s.managers.representation.setMolecularRepr(Gt, Te, At);
  }, b = (Te, At) => r(void 0, void 0, void 0, function* () {
    yield s.managers.representation.createMeasurement({ items: Te, type: At });
  }), _ = (Te, At) => r(void 0, void 0, void 0, function* () {
    const Gt = (Pt, Yt) => {
      if (Yt !== Dt.Molecular)
        return Yt === Dt.Chain ? `${Pt.chainId}` : Yt === Dt.Residue ? `${Pt.residueName} ${Pt.residueId}` : Yt === Dt.Atom ? `${Pt.atomName} ${Pt.atomId}` : "unknown";
    }, Tt = Te.map((Pt) => {
      var { props: Yt } = Pt, Rn = i(Pt, ["props"]);
      return Object.assign(Object.assign({}, Rn), {
        customText: Gt(Object.assign(Object.assign({}, Yt), { cRef: Rn.ref }), At)
      });
    });
    return yield Promise.all(Tt.map((Pt) => {
      var { customText: Yt } = Pt, Rn = i(Pt, ["customText"]);
      return s.managers.representation.createMeasurement({
        items: [Rn],
        type: fe.Label,
        props: {
          // ...preferencesForTheme.label,
          customText: Yt
        }
      });
    }));
  });
  let C = null, w = !1, I = 3, M = a.All, E = 1, T = !1, P = !1, k = !1, D = !1, B = !1, L = [
    $r.HydrogenBonds,
    $r.HalogenBonds,
    $r.SaltBridge
  ], F = [$r.PiPiStacking, $r.PiCations], V = Yr.LigandReceptor, G, H, q = 1, z = 1;
  const K = (Te) => {
    n(2, v = Te.detail);
  }, Y = (Te) => {
    n(10, h = Te.detail), s.managers.selection.structure.setGranularity(Te.detail);
  }, Z = () => x(ei.Protein), X = () => x(ei.Ligand), W = () => x(ei.Solvent);
  function J(Te) {
    I = Te, n(4, I);
  }
  const $ = (Te) => n(5, M = Te.detail), ee = (Te) => n(6, E = Te.detail), ce = (Te) => n(7, T = Te.detail), ae = () => {
    s.managers.selection.structure.expand({
      radius: I,
      asWholeResidue: E,
      filter: M,
      excludeSelectedAtoms: T
    }), n(3, w = !1), C.handleClose();
  };
  function he(Te) {
    Rg[Te ? "unshift" : "push"](() => {
      C = Te, n(11, C);
    });
  }
  const Oe = (Te) => {
    n(3, w = Te.detail);
  }, Ne = (Te) => {
    n(10, h = Te.detail), s.managers.selection.structure.setGranularity(Te.detail);
  }, Ue = (Te) => {
    n(12, P = Te.detail);
  }, Ze = (Te) => {
    b(s.managers.selection.structure.prev, Te.detail);
  }, Se = async () => {
    if (D) {
      s.managers.cell.traverse((Te, At) => {
        At.type === fe.IntraInteractions && s.managers.cell.remove([{ ref: Te.ref }]);
      }), n(14, D = !1);
      return;
    }
    s.managers.representation.showGlobalInteraction(void 0, "Mol3d Horizontal Toolbar Interaction"), n(14, D = !0);
  }, qe = (Te) => n(16, L = Te.detail), Pe = (Te) => n(17, F = Te.detail), Xe = (Te) => n(18, V = Te.detail), Ke = () => G.handleClose(), de = () => {
    const Te = [...L, ...F];
    s.managers.representation.setInteractionParams(Te, V), G.handleClose();
  }, we = () => {
    B ? G.handleClose() : G.handleOpen();
  };
  function Ie(Te) {
    Rg[Te ? "unshift" : "push"](() => {
      G = Te, n(19, G);
    });
  }
  const Ee = (Te) => {
    n(15, B = Te.detail);
  }, Le = (Te) => {
    n(13, k = Te.detail);
  }, De = (Te) => {
    const { selection: At } = s.managers.selection.structure, Gt = HO(s, Array.from(At).map(([Tt, nn]) => ({ ref: Tt, elementIds: nn })), Te.detail);
    Gt.length > 50 || _(Gt, Te.detail);
  }, rt = async () => {
    var At;
    if (!c) return;
    (At = s.canvas3d) == null || At.controls.setLockCameraState(!0);
    const Te = s.managers.selection.structure.getSelectionCellItems();
    await Promise.all(Te.map((Gt) => s.managers.representation.createOther({
      data: Gt,
      type: fe.Surface
    }))), setTimeout(
      () => {
        var Gt;
        (Gt = s.canvas3d) == null || Gt.controls.setLockCameraState(!1);
      },
      100
    );
  }, st = () => S(fe.Ribbon, !1), gt = () => S(fe.Line, !0), ft = () => S(fe.Stick, !0), yt = () => S(fe.BallAndStick, !0), It = () => S(fe.CPK, !0), ge = () => H.handleClose(), Je = (Te) => n(21, q = Te.detail), Mt = (Te) => n(22, z = Te.detail), wn = () => {
    const Te = s.managers.selection.structure.getSelectionCellItems(!0);
    s.managers.representation.showOrHideHs(q, z, Te), H.handleClose();
  };
  function tn(Te) {
    Rg[Te ? "unshift" : "push"](() => {
      H = Te, n(20, H);
    });
  }
  return e.$$set = (Te) => {
    "gradio" in Te && n(31, o = Te.gradio), "lightPlugin" in Te && n(0, s = Te.lightPlugin), "isFixedRight" in Te && n(32, u = Te.isFixedRight), "rootWidth" in Te && n(33, l = Te.rootWidth), "selectionHistory" in Te && n(1, c = Te.selectionHistory);
  }, e.$$.update = () => {
    e.$$.dirty[1] & /*isFixedRight*/
    2 && m(), e.$$.dirty[1] & /*rootWidth*/
    4 && m(), e.$$.dirty[0] & /*pickModeVisible*/
    4, e.$$.dirty[0] & /*surroundingVisible*/
    8, e.$$.dirty[0] & /*surroundingRadius*/
    16, e.$$.dirty[0] & /*expandFilter*/
    32, e.$$.dirty[0] & /*asWholeResidueState*/
    64, e.$$.dirty[0] & /*excludeSelectedAtoms*/
    128;
  }, [
    s,
    c,
    v,
    w,
    I,
    M,
    E,
    T,
    a,
    g,
    h,
    C,
    P,
    k,
    D,
    B,
    L,
    F,
    V,
    G,
    H,
    q,
    z,
    d,
    f,
    p,
    y,
    x,
    S,
    b,
    _,
    o,
    u,
    l,
    K,
    Y,
    Z,
    X,
    W,
    J,
    $,
    ee,
    ce,
    ae,
    he,
    Oe,
    Ne,
    Ue,
    Ze,
    Se,
    qe,
    Pe,
    Xe,
    Ke,
    de,
    we,
    Ie,
    Ee,
    Le,
    De,
    rt,
    st,
    gt,
    ft,
    yt,
    It,
    ge,
    Je,
    Mt,
    wn,
    tn
  ];
}
class Z2e extends qhe {
  constructor(t) {
    super(), Yhe(
      this,
      t,
      X2e,
      W2e,
      Zhe,
      {
        gradio: 31,
        lightPlugin: 0,
        isFixedRight: 32,
        rootWidth: 33,
        selectionHistory: 1
      },
      null,
      [-1, -1, -1]
    );
  }
  get gradio() {
    return this.$$.ctx[31];
  }
  set gradio(t) {
    this.$$set({ gradio: t }), Tp();
  }
  get lightPlugin() {
    return this.$$.ctx[0];
  }
  set lightPlugin(t) {
    this.$$set({ lightPlugin: t }), Tp();
  }
  get isFixedRight() {
    return this.$$.ctx[32];
  }
  set isFixedRight(t) {
    this.$$set({ isFixedRight: t }), Tp();
  }
  get rootWidth() {
    return this.$$.ctx[33];
  }
  set rootWidth(t) {
    this.$$set({ rootWidth: t }), Tp();
  }
  get selectionHistory() {
    return this.$$.ctx[1];
  }
  set selectionHistory(t) {
    this.$$set({ selectionHistory: t }), Tp();
  }
}
const {
  SvelteComponent: Q2e,
  append: rn,
  attr: Ce,
  detach: J2e,
  element: S1,
  flush: LE,
  init: $2e,
  insert: ege,
  listen: Ud,
  noop: zb,
  run_all: tge,
  safe_not_equal: nge,
  space: al,
  svg_element: Xn
} = window.__gradio__svelte__internal;
function rge(e) {
  let t, n, r, i, a, o, s, u, l, c, d, f, p, g, m, v, h, y, x, S, b, _, C, w, I, M, E, T, P, k, D, B, L, F, V, G, H, q, z, K, Y, Z, X, W, J, $, ee, ce, ae;
  return {
    c() {
      t = S1("div"), n = S1("div"), r = S1("div"), r.textContent = "View", i = al(), a = Xn("svg"), o = Xn("path"), s = al(), u = Xn("svg"), l = Xn("path"), c = al(), d = Xn("svg"), f = Xn("path"), p = Xn("path"), g = Xn("path"), m = Xn("path"), v = Xn("path"), h = Xn("circle"), y = al(), x = S1("div"), S = al(), b = S1("div"), _ = S1("div"), _.textContent = "Show", C = al(), w = Xn("svg"), I = Xn("path"), M = Xn("path"), E = Xn("line"), T = al(), P = Xn("svg"), k = Xn("path"), D = Xn("path"), B = Xn("path"), L = Xn("path"), F = Xn("path"), V = Xn("path"), G = al(), H = Xn("svg"), q = Xn("path"), z = Xn("path"), K = Xn("path"), Y = al(), Z = Xn("svg"), X = Xn("path"), W = Xn("path"), J = Xn("path"), $ = Xn("path"), ee = Xn("path"), Ce(r, "class", "uni-view-vertical-toolbar-subtitle svelte-1mrslai"), Ce(o, "d", "M8.02 3.334l-.012 9.333M3.336 8h9.333"), Ce(o, "stroke", "#A2A5C4"), Ce(o, "stroke-width", "1.3"), Ce(o, "stroke-linecap", "round"), Ce(o, "stroke-linejoin", "round"), Ce(a, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(a, "width", "1em"), Ce(a, "height", "1em"), Ce(a, "viewBox", "0 0 16 16"), Ce(a, "fill", "none"), Ce(a, "xmlns", "http://www.w3.org/2000/svg"), Ce(l, "d", "M3.336 8h9.333"), Ce(l, "stroke", "#A2A5C4"), Ce(l, "stroke-width", "1.3"), Ce(l, "stroke-linecap", "round"), Ce(l, "stroke-linejoin", "round"), Ce(u, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(u, "width", "1em"), Ce(u, "height", "1em"), Ce(u, "viewBox", "0 0 16 16"), Ce(u, "fill", "none"), Ce(u, "xmlns", "http://www.w3.org/2000/svg"), Ce(f, "d", "M8.0026 14.6673C11.6845 14.6673 14.6693 11.6825 14.6693 8.00065C14.6693 4.31875 11.6845 1.33398 8.0026 1.33398C4.32071 1.33398 1.33594 4.31875 1.33594 8.00065C1.33594 11.6825 4.32071 14.6673 8.0026 14.6673Z"), Ce(f, "stroke", "#A2A5C4"), Ce(f, "stroke-width", "1.3"), Ce(f, "stroke-linecap", "round"), Ce(f, "stroke-linejoin", "round"), Ce(p, "d", "M8 12.334V14.6673"), Ce(p, "stroke", "#A2A5C4"), Ce(p, "stroke-width", "1.3"), Ce(p, "stroke-linecap", "round"), Ce(p, "stroke-linejoin", "round"), Ce(g, "d", "M12 8H14.6667"), Ce(g, "stroke", "#A2A5C4"), Ce(g, "stroke-width", "1.3"), Ce(g, "stroke-linecap", "round"), Ce(g, "stroke-linejoin", "round"), Ce(m, "d", "M1.33594 8H3.66927"), Ce(m, "stroke", "#A2A5C4"), Ce(m, "stroke-width", "1.3"), Ce(m, "stroke-linecap", "round"), Ce(m, "stroke-linejoin", "round"), Ce(v, "d", "M8 3.66732V1.33398"), Ce(v, "stroke", "#A2A5C4"), Ce(v, "stroke-width", "1.3"), Ce(v, "stroke-linecap", "round"), Ce(v, "stroke-linejoin", "round"), Ce(h, "cx", "8"), Ce(h, "cy", "8"), Ce(h, "r", "1"), Ce(h, "stroke", "#A2A5C4"), Ce(d, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(d, "width", "1em"), Ce(d, "height", "1em"), Ce(d, "viewBox", "0 0 16 16"), Ce(d, "fill", "none"), Ce(d, "xmlns", "http://www.w3.org/2000/svg"), Ce(n, "class", "uni-view-vertical-toolbar-wrapper svelte-1mrslai"), Ce(x, "class", "uni-view-vertical-toolbar-horizontal-split svelte-1mrslai"), Ce(_, "class", "uni-view-vertical-toolbar-subtitle svelte-1mrslai"), Ce(I, "d", "M16 5.5V2.75C16 2.33579 15.6642 2 15.25 2H4.75C4.33579 2 4 2.33579 4 2.75V17L10 13.8977L16 17V15M16 7.5V13"), Ce(I, "stroke", "#A2A5C4"), Ce(I, "stroke-width", "1.25"), Ce(I, "stroke-linecap", "round"), Ce(I, "stroke-linejoin", "round"), Ce(M, "d", "M13.5 10H18.5"), Ce(M, "stroke", "#A2A5C4"), Ce(M, "stroke-width", "1.25"), Ce(M, "stroke-linecap", "round"), Ce(M, "stroke-linejoin", "round"), Ce(E, "x1", "6.5"), Ce(E, "y1", "5.5"), Ce(E, "x2", "13.5"), Ce(E, "y2", "5.5"), Ce(E, "stroke", "#A2A5C4"), Ce(E, "stroke-linecap", "round"), Ce(w, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(w, "width", "1em"), Ce(w, "height", "1em"), Ce(w, "viewBox", "0 0 20 20"), Ce(w, "fill", "none"), Ce(w, "xmlns", "http://www.w3.org/2000/svg"), Ce(k, "d", "M20 0H0V20H20V0Z"), Ce(k, "fill", "white"), Ce(k, "fillopacity", "0.01"), Ce(D, "d", "M16.9165 7.2469C17.6976 6.46585 17.6976 5.19952 16.9165 4.41847L15.5783 3.08023C14.7972 2.29918 13.5309 2.29918 12.7498 3.08023L12.6016 3.22852L11.0391 4.79102L7.91406 7.91602L4.78906 11.041L3.22656 12.6035L3.07828 12.7518C2.29723 13.5329 2.29723 14.7992 3.07828 15.5802L4.41652 16.9185C5.19757 17.6995 6.46389 17.6995 7.24494 16.9185L16.9165 7.2469Z"), Ce(D, "stroke", "#A2A5C4"), Ce(D, "stroke-width", "1.3"), Ce(D, "stroke-linecap", "square"), Ce(D, "stroke-linejoin", "round"), Ce(B, "d", "M12.6016 3.22852L3.22656 12.6035"), Ce(B, "stroke", "#A2A5C4"), Ce(B, "stroke-width", "1.3"), Ce(B, "stroke-linecap", "square"), Ce(B, "stroke-linejoin", "round"), Ce(L, "d", "M3.75 12.084L4.75 13.084"), Ce(L, "stroke", "#A2A5C4"), Ce(L, "stroke-width", "1.3"), Ce(L, "stroke-linecap", "round"), Ce(L, "stroke-linejoin", "round"), Ce(F, "d", "M7.91406 7.91602L9.58073 9.58268"), Ce(F, "stroke", "#A2A5C4"), Ce(F, "stroke-width", "1.3"), Ce(F, "stroke-linecap", "round"), Ce(F, "stroke-linejoin", "round"), Ce(V, "d", "M12.0781 3.75L13.0781 4.75"), Ce(V, "stroke", "#A2A5C4"), Ce(V, "stroke-width", "1.3"), Ce(V, "stroke-linecap", "round"), Ce(V, "stroke-linejoin", "round"), Ce(P, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(P, "width", "1em"), Ce(P, "height", "1em"), Ce(P, "viewBox", "0 0 20 20"), Ce(P, "fill", "none"), Ce(P, "xmlns", "http://www.w3.org/2000/svg"), Ce(q, "d", "M6.65625 4.99609H5.65909C4.77273 4.99609 3 5.47273 3 7.47942C3 9.4861 4.77273 9.9915 5.65909 9.9915H9.52855H13.398C14.2844 9.9915 16 10.4818 16 12.4885C16 14.4952 14.2844 14.9961 13.398 14.9961"), Ce(q, "stroke", "#A2A5C4"), Ce(q, "stroke-width", "1.3"), Ce(q, "stroke-linecap", "round"), Ce(q, "stroke-linejoin", "round"), Ce(z, "d", "M11.8167 1.44141L15.5504 4.76029L11.8167 8.07918L11.8167 6.28873L6.59375 6.28873L6.59375 3.23186L11.8167 3.23186L11.8167 1.44141Z"), Ce(z, "stroke", "#A2A5C4"), Ce(z, "stroke-width", "1.25"), Ce(z, "stroke-linecap", "square"), Ce(z, "stroke-linejoin", "round"), Ce(K, "d", "M9.22291 12.3613L12.9567 15.6802L9.22291 18.9991L9.22291 17.2086L4 17.2086L4 14.1518L9.22291 14.1518L9.22291 12.3613Z"), Ce(K, "stroke", "#A2A5C4"), Ce(K, "fill", "#A2A5C4"), Ce(K, "stroke-width", "1.25"), Ce(K, "stroke-linecap", "square"), Ce(K, "stroke-linejoin", "round"), Ce(H, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(H, "width", "1em"), Ce(H, "height", "1em"), Ce(H, "viewBox", "0 0 20 20"), Ce(H, "fill", "none"), Ce(H, "xmlns", "http://www.w3.org/2000/svg"), Ce(X, "d", "M3 9.23453C3.58333 8.71301 5.275 7.74819 7.375 8.0611C10 8.45225 11.5 12 17 10"), Ce(X, "stroke", "#A2A5C4"), Ce(W, "d", "M2.5 13.5C3.07971 13.034 6.26087 11.7741 8.34783 12.0537C10.1642 12.2971 11.0591 13.5663 13.5 14.5"), Ce(W, "stroke", "#A2A5C4"), Ce(J, "d", "M5 5C6 5.32143 9 7.54286 9 9.85714C9 12.1714 7.6 14.75 7 15.5"), Ce(J, "stroke", "#A2A5C4"), Ce($, "d", "M11.5 5C13.0427 6.44828 15.9684 11.0241 13.5 14.5"), Ce($, "stroke", "#A2A5C4"), Ce(ee, "d", "M2.65 15.4427V4.74213C3.78105 4.88726 6.021 5.14929 7.5 5.14929C9.51352 5.14929 10.5781 5.14911 12.6575 4.62993C13.3376 4.46011 14.253 4.41357 15.1614 4.43067C16.0225 4.44689 16.8331 4.519 17.35 4.57508V15.1497C16.7887 15.0031 16.0056 14.8086 15.2259 14.6486C14.4383 14.487 13.602 14.3493 13 14.3493C12.5298 14.3493 12.0203 14.4647 11.5269 14.6104C11.1005 14.7362 10.6448 14.8979 10.1953 15.0573C10.1203 15.0839 10.0455 15.1104 9.97108 15.1367C8.88952 15.5186 7.8699 15.85 7 15.85C5.58121 15.85 3.61073 15.5859 2.65 15.4427Z"), Ce(ee, "stroke", "#A2A5C4"), Ce(ee, "stroke-width", "1.3"), Ce(ee, "stroke-linejoin", "round"), Ce(Z, "class", "uni-view-vertical-toolbar-icon svelte-1mrslai"), Ce(Z, "width", "1em"), Ce(Z, "height", "1em"), Ce(Z, "viewBox", "0 0 20 20"), Ce(Z, "fill", "none"), Ce(Z, "xmlns", "http://www.w3.org/2000/svg"), Ce(b, "class", "uni-view-vertical-toolbar-wrapper svelte-1mrslai"), Ce(t, "class", "uni-view-vertical-toolbar-container svelte-1mrslai");
    },
    m(he, Oe) {
      ege(he, t, Oe), rn(t, n), rn(n, r), rn(n, i), rn(n, a), rn(a, o), rn(n, s), rn(n, u), rn(u, l), rn(n, c), rn(n, d), rn(d, f), rn(d, p), rn(d, g), rn(d, m), rn(d, v), rn(d, h), rn(t, y), rn(t, x), rn(t, S), rn(t, b), rn(b, _), rn(b, C), rn(b, w), rn(w, I), rn(w, M), rn(w, E), rn(b, T), rn(b, P), rn(P, k), rn(P, D), rn(P, B), rn(P, L), rn(P, F), rn(P, V), rn(b, G), rn(b, H), rn(H, q), rn(H, z), rn(H, K), rn(b, Y), rn(b, Z), rn(Z, X), rn(Z, W), rn(Z, J), rn(Z, $), rn(Z, ee), ce || (ae = [
        Ud(
          a,
          "click",
          /*click_handler*/
          e[2]
        ),
        Ud(
          u,
          "click",
          /*click_handler_1*/
          e[3]
        ),
        Ud(
          d,
          "click",
          /*click_handler_2*/
          e[4]
        ),
        Ud(
          w,
          "click",
          /*click_handler_3*/
          e[5]
        ),
        Ud(
          P,
          "click",
          /*click_handler_4*/
          e[6]
        ),
        Ud(
          H,
          "click",
          /*click_handler_5*/
          e[7]
        ),
        Ud(
          Z,
          "click",
          /*click_handler_6*/
          e[8]
        )
      ], ce = !0);
    },
    p: zb,
    i: zb,
    o: zb,
    d(he) {
      he && J2e(t), ce = !1, tge(ae);
    }
  };
}
function ige(e, t, n) {
  let { gradio: r } = t, { lightPlugin: i } = t;
  const a = () => i.managers.camera.zoomIn(), o = () => i.managers.camera.zoomOut(), s = () => i.managers.camera.focus(), u = () => i.toggle({ types: [fe.Label] }), l = () => i.toggle({
    types: [
      fe.Distance,
      fe.Angle,
      fe.Dihedral
    ]
  }), c = () => i.toggle({ types: [fe.Ribbon] }), d = () => i.toggle({ types: [fe.Surface] });
  return e.$$set = (f) => {
    "gradio" in f && n(1, r = f.gradio), "lightPlugin" in f && n(0, i = f.lightPlugin);
  }, [
    i,
    r,
    a,
    o,
    s,
    u,
    l,
    c,
    d
  ];
}
class age extends Q2e {
  constructor(t) {
    super(), $2e(this, t, ige, rge, nge, { gradio: 1, lightPlugin: 0 });
  }
  get gradio() {
    return this.$$.ctx[1];
  }
  set gradio(t) {
    this.$$set({ gradio: t }), LE();
  }
  get lightPlugin() {
    return this.$$.ctx[0];
  }
  set lightPlugin(t) {
    this.$$set({ lightPlugin: t }), LE();
  }
}
const {
  SvelteComponent: oge,
  append: Ds,
  attr: Ms,
  check_outros: NE,
  create_component: bF,
  destroy_component: _F,
  detach: xF,
  element: af,
  flush: kp,
  group_outros: FE,
  init: sge,
  insert: CF,
  listen: Ub,
  mount_component: SF,
  noop: uge,
  run_all: lge,
  safe_not_equal: cge,
  set_style: dge,
  space: B1,
  transition_in: Tc,
  transition_out: R1
} = window.__gradio__svelte__internal;
function VE(e) {
  let t, n;
  return t = new Z2e({
    props: {
      gradio: (
        /*gradio*/
        e[0]
      ),
      lightPlugin: (
        /*lightPlugin*/
        e[5]
      ),
      isFixedRight: (
        /*isFixedRight*/
        e[3]
      ),
      rootWidth: (
        /*rootWidth*/
        e[4]
      ),
      selectionHistory: (
        /*selectionHistory*/
        e[6]
      )
    }
  }), {
    c() {
      bF(t.$$.fragment);
    },
    m(r, i) {
      SF(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i & /*gradio*/
      1 && (a.gradio = /*gradio*/
      r[0]), i & /*lightPlugin*/
      32 && (a.lightPlugin = /*lightPlugin*/
      r[5]), i & /*isFixedRight*/
      8 && (a.isFixedRight = /*isFixedRight*/
      r[3]), i & /*rootWidth*/
      16 && (a.rootWidth = /*rootWidth*/
      r[4]), i & /*selectionHistory*/
      64 && (a.selectionHistory = /*selectionHistory*/
      r[6]), t.$set(a);
    },
    i(r) {
      n || (Tc(t.$$.fragment, r), n = !0);
    },
    o(r) {
      R1(t.$$.fragment, r), n = !1;
    },
    d(r) {
      _F(t, r);
    }
  };
}
function GE(e) {
  let t, n;
  return t = new age({
    props: {
      gradio: (
        /*gradio*/
        e[0]
      ),
      lightPlugin: (
        /*lightPlugin*/
        e[5]
      )
    }
  }), {
    c() {
      bF(t.$$.fragment);
    },
    m(r, i) {
      SF(t, r, i), n = !0;
    },
    p(r, i) {
      const a = {};
      i & /*gradio*/
      1 && (a.gradio = /*gradio*/
      r[0]), i & /*lightPlugin*/
      32 && (a.lightPlugin = /*lightPlugin*/
      r[5]), t.$set(a);
    },
    i(r) {
      n || (Tc(t.$$.fragment, r), n = !0);
    },
    o(r) {
      R1(t.$$.fragment, r), n = !1;
    },
    d(r) {
      _F(t, r);
    }
  };
}
function zE(e) {
  let t, n, r, i, a, o, s, u;
  return {
    c() {
      t = af("div"), n = af("button"), n.innerHTML = '<svg width="1em" height="1em" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.02 3.334l-.012 9.333M3.336 8h9.333" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path></svg>', r = B1(), i = af("button"), i.innerHTML = '<svg width="1em" height="1em" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.336 8h9.333" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path></svg>', a = B1(), o = af("button"), o.innerHTML = '<svg width="1em" height="1em" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.0026 14.6673C11.6845 14.6673 14.6693 11.6825 14.6693 8.00065C14.6693 4.31875 11.6845 1.33398 8.0026 1.33398C4.32071 1.33398 1.33594 4.31875 1.33594 8.00065C1.33594 11.6825 4.32071 14.6673 8.0026 14.6673Z" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 12.334V14.6673" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M12 8H14.6667" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.33594 8H3.66927" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8 3.66732V1.33398" stroke="#A2A5C4" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path><circle cx="8" cy="8" r="1" stroke="#A2A5C4"></circle></svg>', Ms(n, "class", "uni-view-toolbar-btn svelte-18rwshu"), Ms(i, "class", "uni-view-toolbar-btn svelte-18rwshu"), Ms(o, "class", "uni-view-toolbar-btn svelte-18rwshu"), Ms(t, "class", "uni-view-toolbar svelte-18rwshu");
    },
    m(l, c) {
      CF(l, t, c), Ds(t, n), Ds(t, r), Ds(t, i), Ds(t, a), Ds(t, o), s || (u = [
        Ub(
          n,
          "click",
          /*click_handler*/
          e[11]
        ),
        Ub(
          i,
          "click",
          /*click_handler_1*/
          e[12]
        ),
        Ub(
          o,
          "click",
          /*click_handler_2*/
          e[13]
        )
      ], s = !0);
    },
    p: uge,
    d(l) {
      l && xF(t), s = !1, lge(u);
    }
  };
}
function fge(e) {
  let t, n, r, i, a, o, s, u, l, c = (
    /*toolbar_visible*/
    e[2] && VE(e)
  ), d = (
    /*toolbar_visible*/
    e[2] && GE(e)
  ), f = !/*toolbar_visible*/
  e[2] && zE(e);
  return {
    c() {
      t = af("div"), n = af("div"), r = B1(), c && c.c(), i = B1(), d && d.c(), a = B1(), f && f.c(), o = B1(), s = af("div"), Ms(n, "id", "uni-view-canvas-" + /*key*/
      e[7]), Ms(n, "class", "uni-view-canvas svelte-18rwshu"), Ms(s, "id", "uni-view-label-" + /*key*/
      e[7]), Ms(s, "class", "uni-view-label svelte-18rwshu"), dge(s, "display", "none"), Ms(t, "class", "uni-view-container svelte-18rwshu"), Ms(t, "style", u = /*height*/
      e[1] !== void 0 ? `height: ${/*height*/
      e[1]}px;` : "");
    },
    m(p, g) {
      CF(p, t, g), Ds(t, n), Ds(t, r), c && c.m(t, null), Ds(t, i), d && d.m(t, null), Ds(t, a), f && f.m(t, null), Ds(t, o), Ds(t, s), l = !0;
    },
    p(p, [g]) {
      /*toolbar_visible*/
      p[2] ? c ? (c.p(p, g), g & /*toolbar_visible*/
      4 && Tc(c, 1)) : (c = VE(p), c.c(), Tc(c, 1), c.m(t, i)) : c && (FE(), R1(c, 1, 1, () => {
        c = null;
      }), NE()), /*toolbar_visible*/
      p[2] ? d ? (d.p(p, g), g & /*toolbar_visible*/
      4 && Tc(d, 1)) : (d = GE(p), d.c(), Tc(d, 1), d.m(t, a)) : d && (FE(), R1(d, 1, 1, () => {
        d = null;
      }), NE()), /*toolbar_visible*/
      p[2] ? f && (f.d(1), f = null) : f ? f.p(p, g) : (f = zE(p), f.c(), f.m(t, o)), (!l || g & /*height*/
      2 && u !== (u = /*height*/
      p[1] !== void 0 ? `height: ${/*height*/
      p[1]}px;` : "")) && Ms(t, "style", u);
    },
    i(p) {
      l || (Tc(c), Tc(d), l = !0);
    },
    o(p) {
      R1(c), R1(d), l = !1;
    },
    d(p) {
      p && xF(t), c && c.d(), d && d.d(), f && f.d();
    }
  };
}
const UE = 625;
function mge(e, t, n) {
  this && this.__awaiter;
  let { gradio: r } = t, { value: i = "" } = t, { height: a } = t, { structures: o = [] } = t, { toolbar_visible: s } = t;
  window.process = {
    env: { NODE_ENV: "production", LANG: "" }
  };
  const u = /* @__PURE__ */ new Map([
    ["ligand-default", "#48e533"],
    ["residue-default", "#dcdde8"],
    ["reference", "#f7aa61"],
    ["green", "#01BE77"],
    ["purple", "#7570b3"],
    ["pink", "#e7298a"],
    ["yellow", "#e6ab02"],
    ["brown", "#a6761d"],
    ["gray", "#666666"],
    ["red", "#E41A1C"],
    ["blue", "#3daf4a"]
  ]);
  let l = new VR();
  const d = (() => {
    function M() {
      return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
    }
    return `${M() + M()}-${M()}-${M()}-${M()}-${M()}${M()}${M()}`;
  })();
  function f() {
    r.dispatch("change");
  }
  let p = "";
  const g = () => {
    const M = document.getElementById(`uni-view-label-${d}`);
    if (M) {
      if (!p) {
        M.style.display = "none";
        return;
      }
      M.innerHTML = p, M.style.display = "block";
    }
  };
  let m = 0;
  const v = () => {
    n(5, l.managers.representation.showPolarHydrogenOnly = !1, l), l.createCanvas(document.getElementById(`uni-view-canvas-${d}`), {
      renderer: {
        ambientIntensity: 0.4,
        backgroundColor: Ae(15922682)
      }
    }), l.managers.selection.event.changed.subscribe(() => {
      const { prev: M } = l.managers.selection.structure;
      n(6, m = M.length);
    }), l.managers.highlight.info.subscribe((M) => {
      if (!M.info) {
        n(10, p = "");
        return;
      }
      if (M.info.type === "Structure") {
        const { granularity: E, atomName: T, atomId: P, altId: k, residueName: D, residueId: B, chainId: L, emConfidence: F, bfactor: V, insertCode: G, ref: H } = M.info, q = l.managers.cell.getMolecularName(H);
        switch (E) {
          case "Atom":
            n(10, p = `${q ? `${q} ` : ""}${T} ${P}${k} ${D} ${B}${G ?? ""} ${L}${V ? `<p />b-factor: ${V}` : ""}${F ? `<p />EM Confidence: ${F}` : ""}`);
            break;
          case "Residue":
            n(10, p = `${q ? `${q} ` : ""}${D} ${B}${G ?? ""} ${L}${V ? `<p />b-factor: ${V}` : ""}`);
            break;
          case "Chain":
            n(10, p = `${q ? `${q} ` : ""}Chain ${L}`);
            break;
          default:
            n(10, p = `${q ? `${q} ` : ""}`);
            break;
        }
        return;
      }
      if (M.info.type === "Interaction") {
        const { interactionType: E, infoA: T, infoB: P } = M.info;
        n(10, p = `${E} ${T.chainId}:${T.residueName}${T.residueId}:${T.atomName} - ${P.chainId}:${P.residueName}${P.residueId}:${P.atomName}`);
        return;
      }
      n(10, p = "");
    }), window.__simple_plugin = l, setTimeout(() => l.refresh(), 50), _();
  };
  let h = !1, y = 0;
  const x = setInterval(
    () => {
      document.getElementById(`uni-view-canvas-${d}`) && !l.canvas3d && (clearInterval(x), new ResizeObserver((E) => {
        n(3, h = E[0].contentRect.width < UE + 18), n(4, y = Math.min(E[0].contentRect.width - 16, UE)), S();
      }).observe(document.getElementById(`uni-view-canvas-${d}`)), v());
    },
    1e3
  ), S = () => {
    setTimeout(
      () => {
        l.refresh({ fixCamera: !0 });
      },
      0
    );
  }, b = (M = "#F2F5FA") => (M.startsWith("#") && (M = M.substr(1)), parseInt(M, 16)), _ = () => {
    l.clear(), l.canvas3d && o.forEach((M) => {
      var E;
      const { format: T, content: P, reprType: k, carbonColor: D, ribbonTheme: B, atomTheme: L } = M;
      if (!mZ.has(k) || !P) return;
      const F = {};
      D && (L === "element-symbol" || !L) && Object.assign(F, {
        Atom: {
          color: {
            name: "element-symbol",
            props: {
              carbonColor: {
                name: "uniform",
                params: {
                  value: Ae(b((E = u.get(D)) !== null && E !== void 0 ? E : D))
                }
              }
            }
          }
        }
      }), L && L !== "element-symbol" && Object.assign(F, { Atom: { color: { name: L } } }), B && Object.assign(F, { Ribbon: { color: { name: B } } }), l.managers.representation.createMolecular({
        format: T,
        data: P,
        reprType: k ?? (T === "pdb" ? fe.Ribbon : fe.BallAndStick),
        theme: F
      });
    });
  }, C = () => l.managers.camera.zoomIn(), w = () => l.managers.camera.zoomOut(), I = () => l.managers.camera.focus();
  return e.$$set = (M) => {
    "gradio" in M && n(0, r = M.gradio), "value" in M && n(8, i = M.value), "height" in M && n(1, a = M.height), "structures" in M && n(9, o = M.structures), "toolbar_visible" in M && n(2, s = M.toolbar_visible);
  }, e.$$.update = () => {
    e.$$.dirty & /*value*/
    256 && i === null && n(8, i = ""), e.$$.dirty & /*value*/
    256 && f(), e.$$.dirty & /*info*/
    1024 && g(), e.$$.dirty & /*isFixedRight*/
    8, e.$$.dirty & /*rootWidth*/
    16, e.$$.dirty & /*height*/
    2 && S(), e.$$.dirty & /*structures*/
    512 && _();
  }, [
    r,
    a,
    s,
    h,
    y,
    l,
    m,
    d,
    i,
    o,
    p,
    C,
    w,
    I
  ];
}
class pge extends oge {
  constructor(t) {
    super(), sge(this, t, mge, fge, cge, {
      gradio: 0,
      value: 8,
      height: 1,
      structures: 9,
      toolbar_visible: 2
    });
  }
  get gradio() {
    return this.$$.ctx[0];
  }
  set gradio(t) {
    this.$$set({ gradio: t }), kp();
  }
  get value() {
    return this.$$.ctx[8];
  }
  set value(t) {
    this.$$set({ value: t }), kp();
  }
  get height() {
    return this.$$.ctx[1];
  }
  set height(t) {
    this.$$set({ height: t }), kp();
  }
  get structures() {
    return this.$$.ctx[9];
  }
  set structures(t) {
    this.$$set({ structures: t }), kp();
  }
  get toolbar_visible() {
    return this.$$.ctx[2];
  }
  set toolbar_visible(t) {
    this.$$set({ toolbar_visible: t }), kp();
  }
}
const {
  SvelteComponent: hge,
  add_flush_callback: gge,
  assign: vge,
  bind: yge,
  binding_callbacks: bge,
  check_outros: HE,
  create_component: j7,
  destroy_component: K7,
  detach: qE,
  empty: _ge,
  flush: qi,
  get_spread_object: xge,
  get_spread_update: Cge,
  group_outros: jE,
  init: Sge,
  insert: KE,
  mount_component: Y7,
  safe_not_equal: Age,
  space: wge,
  transition_in: hl,
  transition_out: of
} = window.__gradio__svelte__internal;
function YE(e) {
  let t, n;
  const r = [
    { autoscroll: (
      /*gradio*/
      e[1].autoscroll
    ) },
    { i18n: (
      /*gradio*/
      e[1].i18n
    ) },
    /*loading_status*/
    e[7]
  ];
  let i = {};
  for (let a = 0; a < r.length; a += 1)
    i = vge(i, r[a]);
  return t = new XV({ props: i }), t.$on(
    "clear_status",
    /*clear_status_handler*/
    e[17]
  ), {
    c() {
      j7(t.$$.fragment);
    },
    m(a, o) {
      Y7(t, a, o), n = !0;
    },
    p(a, o) {
      const s = o & /*gradio, loading_status*/
      130 ? Cge(r, [
        o & /*gradio*/
        2 && { autoscroll: (
          /*gradio*/
          a[1].autoscroll
        ) },
        o & /*gradio*/
        2 && { i18n: (
          /*gradio*/
          a[1].i18n
        ) },
        o & /*loading_status*/
        128 && xge(
          /*loading_status*/
          a[7]
        )
      ]) : {};
      t.$set(s);
    },
    i(a) {
      n || (hl(t.$$.fragment, a), n = !0);
    },
    o(a) {
      of(t.$$.fragment, a), n = !1;
    },
    d(a) {
      K7(t, a);
    }
  };
}
function WE(e) {
  let t, n, r;
  function i(o) {
    e[18](o);
  }
  let a = {
    structures: (
      /*structures*/
      e[9]
    ),
    height: (
      /*height*/
      e[8]
    ),
    gradio: (
      /*gradio*/
      e[1]
    ),
    toolbar_visible: (
      /*toolbar_visible*/
      e[10]
    )
  };
  return (
    /*value*/
    e[0] !== void 0 && (a.value = /*value*/
    e[0]), t = new pge({ props: a }), bge.push(() => yge(t, "value", i)), {
      c() {
        j7(t.$$.fragment);
      },
      m(o, s) {
        Y7(t, o, s), r = !0;
      },
      p(o, s) {
        const u = {};
        s & /*structures*/
        512 && (u.structures = /*structures*/
        o[9]), s & /*height*/
        256 && (u.height = /*height*/
        o[8]), s & /*gradio*/
        2 && (u.gradio = /*gradio*/
        o[1]), s & /*toolbar_visible*/
        1024 && (u.toolbar_visible = /*toolbar_visible*/
        o[10]), !n && s & /*value*/
        1 && (n = !0, u.value = /*value*/
        o[0], gge(() => n = !1)), t.$set(u);
      },
      i(o) {
        r || (hl(t.$$.fragment, o), r = !0);
      },
      o(o) {
        of(t.$$.fragment, o), r = !1;
      },
      d(o) {
        K7(t, o);
      }
    }
  );
}
function Ige(e) {
  let t, n, r, i = (
    /*loading_status*/
    e[7] && YE(e)
  ), a = (
    /*visible*/
    e[4] && WE(e)
  );
  return {
    c() {
      i && i.c(), t = wge(), a && a.c(), n = _ge();
    },
    m(o, s) {
      i && i.m(o, s), KE(o, t, s), a && a.m(o, s), KE(o, n, s), r = !0;
    },
    p(o, s) {
      /*loading_status*/
      o[7] ? i ? (i.p(o, s), s & /*loading_status*/
      128 && hl(i, 1)) : (i = YE(o), i.c(), hl(i, 1), i.m(t.parentNode, t)) : i && (jE(), of(i, 1, 1, () => {
        i = null;
      }), HE()), /*visible*/
      o[4] ? a ? (a.p(o, s), s & /*visible*/
      16 && hl(a, 1)) : (a = WE(o), a.c(), hl(a, 1), a.m(n.parentNode, n)) : a && (jE(), of(a, 1, 1, () => {
        a = null;
      }), HE());
    },
    i(o) {
      r || (hl(i), hl(a), r = !0);
    },
    o(o) {
      of(i), of(a), r = !1;
    },
    d(o) {
      o && (qE(t), qE(n)), i && i.d(o), a && a.d(o);
    }
  };
}
function Pge(e) {
  let t, n;
  return t = new UF({
    props: {
      visible: (
        /*visible*/
        e[4]
      ),
      elem_id: (
        /*elem_id*/
        e[2]
      ),
      elem_classes: (
        /*elem_classes*/
        e[3]
      ),
      scale: (
        /*scale*/
        e[5]
      ),
      min_width: (
        /*min_width*/
        e[6]
      ),
      allow_overflow: !1,
      padding: !0,
      $$slots: { default: [Ige] },
      $$scope: { ctx: e }
    }
  }), {
    c() {
      j7(t.$$.fragment);
    },
    m(r, i) {
      Y7(t, r, i), n = !0;
    },
    p(r, [i]) {
      const a = {};
      i & /*visible*/
      16 && (a.visible = /*visible*/
      r[4]), i & /*elem_id*/
      4 && (a.elem_id = /*elem_id*/
      r[2]), i & /*elem_classes*/
      8 && (a.elem_classes = /*elem_classes*/
      r[3]), i & /*scale*/
      32 && (a.scale = /*scale*/
      r[5]), i & /*min_width*/
      64 && (a.min_width = /*min_width*/
      r[6]), i & /*$$scope, structures, height, gradio, toolbar_visible, value, visible, loading_status*/
      8390547 && (a.$$scope = { dirty: i, ctx: r }), t.$set(a);
    },
    i(r) {
      n || (hl(t.$$.fragment, r), n = !0);
    },
    o(r) {
      of(t.$$.fragment, r), n = !1;
    },
    d(r) {
      K7(t, r);
    }
  };
}
function Mge(e, t, n) {
  this && this.__awaiter;
  let { gradio: r } = t, { label: i = "Textbox" } = t, { elem_id: a = "" } = t, { elem_classes: o = [] } = t, { visible: s = !0 } = t, { value: u = "" } = t, { placeholder: l = "" } = t, { show_label: c } = t, { scale: d = null } = t, { min_width: f = void 0 } = t, { loading_status: p = void 0 } = t, { value_is_output: g = !1 } = t, { interactive: m } = t, { rtl: v = !1 } = t, { height: h = void 0 } = t, { structures: y = [] } = t, { toolbar_visible: x = !1 } = t;
  function S() {
    r.dispatch("change"), g || r.dispatch("input");
  }
  const b = () => r.dispatch("clear_status", p);
  function _(C) {
    u = C, n(0, u);
  }
  return e.$$set = (C) => {
    "gradio" in C && n(1, r = C.gradio), "label" in C && n(11, i = C.label), "elem_id" in C && n(2, a = C.elem_id), "elem_classes" in C && n(3, o = C.elem_classes), "visible" in C && n(4, s = C.visible), "value" in C && n(0, u = C.value), "placeholder" in C && n(12, l = C.placeholder), "show_label" in C && n(13, c = C.show_label), "scale" in C && n(5, d = C.scale), "min_width" in C && n(6, f = C.min_width), "loading_status" in C && n(7, p = C.loading_status), "value_is_output" in C && n(14, g = C.value_is_output), "interactive" in C && n(15, m = C.interactive), "rtl" in C && n(16, v = C.rtl), "height" in C && n(8, h = C.height), "structures" in C && n(9, y = C.structures), "toolbar_visible" in C && n(10, x = C.toolbar_visible);
  }, e.$$.update = () => {
    e.$$.dirty & /*value*/
    1 && u === null && n(0, u = ""), e.$$.dirty & /*value*/
    1 && S();
  }, [
    u,
    r,
    a,
    o,
    s,
    d,
    f,
    p,
    h,
    y,
    x,
    i,
    l,
    c,
    g,
    m,
    v,
    b,
    _
  ];
}
class Lge extends hge {
  constructor(t) {
    super(), Sge(this, t, Mge, Pge, Age, {
      gradio: 1,
      label: 11,
      elem_id: 2,
      elem_classes: 3,
      visible: 4,
      value: 0,
      placeholder: 12,
      show_label: 13,
      scale: 5,
      min_width: 6,
      loading_status: 7,
      value_is_output: 14,
      interactive: 15,
      rtl: 16,
      height: 8,
      structures: 9,
      toolbar_visible: 10
    });
  }
  get gradio() {
    return this.$$.ctx[1];
  }
  set gradio(t) {
    this.$$set({ gradio: t }), qi();
  }
  get label() {
    return this.$$.ctx[11];
  }
  set label(t) {
    this.$$set({ label: t }), qi();
  }
  get elem_id() {
    return this.$$.ctx[2];
  }
  set elem_id(t) {
    this.$$set({ elem_id: t }), qi();
  }
  get elem_classes() {
    return this.$$.ctx[3];
  }
  set elem_classes(t) {
    this.$$set({ elem_classes: t }), qi();
  }
  get visible() {
    return this.$$.ctx[4];
  }
  set visible(t) {
    this.$$set({ visible: t }), qi();
  }
  get value() {
    return this.$$.ctx[0];
  }
  set value(t) {
    this.$$set({ value: t }), qi();
  }
  get placeholder() {
    return this.$$.ctx[12];
  }
  set placeholder(t) {
    this.$$set({ placeholder: t }), qi();
  }
  get show_label() {
    return this.$$.ctx[13];
  }
  set show_label(t) {
    this.$$set({ show_label: t }), qi();
  }
  get scale() {
    return this.$$.ctx[5];
  }
  set scale(t) {
    this.$$set({ scale: t }), qi();
  }
  get min_width() {
    return this.$$.ctx[6];
  }
  set min_width(t) {
    this.$$set({ min_width: t }), qi();
  }
  get loading_status() {
    return this.$$.ctx[7];
  }
  set loading_status(t) {
    this.$$set({ loading_status: t }), qi();
  }
  get value_is_output() {
    return this.$$.ctx[14];
  }
  set value_is_output(t) {
    this.$$set({ value_is_output: t }), qi();
  }
  get interactive() {
    return this.$$.ctx[15];
  }
  set interactive(t) {
    this.$$set({ interactive: t }), qi();
  }
  get rtl() {
    return this.$$.ctx[16];
  }
  set rtl(t) {
    this.$$set({ rtl: t }), qi();
  }
  get height() {
    return this.$$.ctx[8];
  }
  set height(t) {
    this.$$set({ height: t }), qi();
  }
  get structures() {
    return this.$$.ctx[9];
  }
  set structures(t) {
    this.$$set({ structures: t }), qi();
  }
  get toolbar_visible() {
    return this.$$.ctx[10];
  }
  set toolbar_visible(t) {
    this.$$set({ toolbar_visible: t }), qi();
  }
}
export {
  Lge as default
};
