diff --git "a/src/backend/gradio_molecule3d/templates/component/index.js" "b/src/backend/gradio_molecule3d/templates/component/index.js" --- "a/src/backend/gradio_molecule3d/templates/component/index.js" +++ "b/src/backend/gradio_molecule3d/templates/component/index.js" @@ -1,853 +1,411 @@ -const Block_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$l, - assign: assign$1, - create_slot: create_slot$4, - detach: detach$l, - element: element$d, - get_all_dirty_from_scope: get_all_dirty_from_scope$4, - get_slot_changes: get_slot_changes$4, - get_spread_update: get_spread_update$1, - init: init$l, - insert: insert$l, - safe_not_equal: safe_not_equal$m, +var os = Object.defineProperty; +var vn = (n) => { + throw TypeError(n); +}; +var cs = (n, e, t) => e in n ? os(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; +var kt = (n, e, t) => cs(n, typeof e != "symbol" ? e + "" : e, t), ci = (n, e, t) => e.has(n) || vn("Cannot " + t); +var wr = (n, e, t) => (ci(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ui = (n, e, t) => e.has(n) ? vn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), bn = (n, e, t, r) => (ci(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), Zr = (n, e, t) => (ci(n, e, "access private method"), t); +function _mergeNamespaces(n, e) { + for (var t = 0; t < e.length; t++) { + const r = e[t]; + if (typeof r != "string" && !Array.isArray(r)) { + for (const a in r) + if (a !== "default" && !(a in n)) { + const l = Object.getOwnPropertyDescriptor(r, a); + l && Object.defineProperty(n, a, l.get ? l : { + enumerable: !0, + get: () => r[a] + }); + } + } + } + return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" })); +} +const { + SvelteComponent: SvelteComponent$q, + assign: assign$2, + children: children$n, + claim_element: claim_element$f, + create_slot: create_slot$7, + detach: detach$q, + element: element$f, + get_all_dirty_from_scope: get_all_dirty_from_scope$7, + get_slot_changes: get_slot_changes$7, + get_spread_update: get_spread_update$2, + init: init$q, + insert_hydration: insert_hydration$q, + safe_not_equal: safe_not_equal$r, set_dynamic_element_data, - set_style: set_style$6, - toggle_class: toggle_class$b, - transition_in: transition_in$c, - transition_out: transition_out$b, - update_slot_base: update_slot_base$4 + set_style: set_style$9, + toggle_class: toggle_class$c, + transition_in: transition_in$f, + transition_out: transition_out$e, + update_slot_base: update_slot_base$7 } = window.__gradio__svelte__internal; -function create_dynamic_element(t) { - let e, r, n; - const f = ( +function create_dynamic_element(n) { + let e, t, r; + const a = ( /*#slots*/ - t[17].default - ), u = create_slot$4( - f, - t, + n[22].default + ), l = create_slot$7( + a, + n, /*$$scope*/ - t[16], + n[21], null ); - let b = [ + let d = [ { "data-testid": ( /*test_id*/ - t[7] + n[9] ) }, { id: ( /*elem_id*/ - t[2] + n[4] ) }, { - class: r = "block " + /*elem_classes*/ - t[3].join(" ") + " svelte-1t38q2d" + class: t = "block " + /*elem_classes*/ + n[5].join(" ") + " svelte-1ezsyiy" } - ], h = {}; - for (let _ = 0; _ < b.length; _ += 1) - h = assign$1(h, b[_]); + ], o = {}; + for (let u = 0; u < d.length; u += 1) + o = assign$2(o, d[u]); return { c() { - e = element$d( + e = element$f( + /*tag*/ + n[18] + ), l && l.c(), this.h(); + }, + l(u) { + e = claim_element$f( + u, /*tag*/ - t[14] - ), u && u.c(), set_dynamic_element_data( + (n[18] || "null").toUpperCase(), + { + "data-testid": !0, + id: !0, + class: !0 + } + ); + var p = children$n(e); + l && l.l(p), p.forEach(detach$q), this.h(); + }, + h() { + set_dynamic_element_data( /*tag*/ - t[14] - )(e, h), toggle_class$b( + n[18] + )(e, o), toggle_class$c( e, "hidden", /*visible*/ - t[10] === !1 - ), toggle_class$b( + n[12] === !1 + ), toggle_class$c( e, "padded", /*padding*/ - t[6] - ), toggle_class$b( + n[8] + ), toggle_class$c( + e, + "flex", + /*flex*/ + n[17] + ), toggle_class$c( e, "border_focus", /*border_mode*/ - t[5] === "focus" - ), toggle_class$b(e, "hide-container", !/*explicit_call*/ - t[8] && !/*container*/ - t[9]), set_style$6(e, "height", typeof /*height*/ - t[0] == "number" ? ( - /*height*/ - t[0] + "px" - ) : void 0), set_style$6(e, "width", typeof /*width*/ - t[1] == "number" ? `calc(min(${/*width*/ - t[1]}px, 100%))` : void 0), set_style$6( + n[7] === "focus" + ), toggle_class$c( + e, + "border_contrast", + /*border_mode*/ + n[7] === "contrast" + ), toggle_class$c(e, "hide-container", !/*explicit_call*/ + n[10] && !/*container*/ + n[11]), set_style$9( + e, + "height", + /*get_dimension*/ + n[19]( + /*height*/ + n[0] + ) + ), set_style$9( + e, + "min-height", + /*get_dimension*/ + n[19]( + /*min_height*/ + n[1] + ) + ), set_style$9( + e, + "max-height", + /*get_dimension*/ + n[19]( + /*max_height*/ + n[2] + ) + ), set_style$9(e, "width", typeof /*width*/ + n[3] == "number" ? `calc(min(${/*width*/ + n[3]}px, 100%))` : ( + /*get_dimension*/ + n[19]( + /*width*/ + n[3] + ) + )), set_style$9( e, "border-style", /*variant*/ - t[4] - ), set_style$6( + n[6] + ), set_style$9( e, "overflow", /*allow_overflow*/ - t[11] ? "visible" : "hidden" - ), set_style$6( + n[13] ? ( + /*overflow_behavior*/ + n[14] + ) : "hidden" + ), set_style$9( e, "flex-grow", /*scale*/ - t[12] - ), set_style$6(e, "min-width", `calc(min(${/*min_width*/ - t[13]}px, 100%))`), set_style$6(e, "border-width", "var(--block-border-width)"); + n[15] + ), set_style$9(e, "min-width", `calc(min(${/*min_width*/ + n[16]}px, 100%))`), set_style$9(e, "border-width", "var(--block-border-width)"); }, - m(_, E) { - insert$l(_, e, E), u && u.m(e, null), n = !0; + m(u, p) { + insert_hydration$q(u, e, p), l && l.m(e, null), r = !0; }, - p(_, E) { - u && u.p && (!n || E & /*$$scope*/ - 65536) && update_slot_base$4( + p(u, p) { + l && l.p && (!r || p & /*$$scope*/ + 2097152) && update_slot_base$7( + l, + a, u, - f, - _, /*$$scope*/ - _[16], - n ? get_slot_changes$4( - f, + u[21], + r ? get_slot_changes$7( + a, /*$$scope*/ - _[16], - E, + u[21], + p, null - ) : get_all_dirty_from_scope$4( + ) : get_all_dirty_from_scope$7( /*$$scope*/ - _[16] + u[21] ), null ), set_dynamic_element_data( /*tag*/ - _[14] - )(e, h = get_spread_update$1(b, [ - (!n || E & /*test_id*/ - 128) && { "data-testid": ( + u[18] + )(e, o = get_spread_update$2(d, [ + (!r || p & /*test_id*/ + 512) && { "data-testid": ( /*test_id*/ - _[7] + u[9] ) }, - (!n || E & /*elem_id*/ - 4) && { id: ( + (!r || p & /*elem_id*/ + 16) && { id: ( /*elem_id*/ - _[2] + u[4] ) }, - (!n || E & /*elem_classes*/ - 8 && r !== (r = "block " + /*elem_classes*/ - _[3].join(" ") + " svelte-1t38q2d")) && { class: r } - ])), toggle_class$b( + (!r || p & /*elem_classes*/ + 32 && t !== (t = "block " + /*elem_classes*/ + u[5].join(" ") + " svelte-1ezsyiy")) && { class: t } + ])), toggle_class$c( e, "hidden", /*visible*/ - _[10] === !1 - ), toggle_class$b( + u[12] === !1 + ), toggle_class$c( e, "padded", /*padding*/ - _[6] - ), toggle_class$b( + u[8] + ), toggle_class$c( + e, + "flex", + /*flex*/ + u[17] + ), toggle_class$c( e, "border_focus", /*border_mode*/ - _[5] === "focus" - ), toggle_class$b(e, "hide-container", !/*explicit_call*/ - _[8] && !/*container*/ - _[9]), E & /*height*/ - 1 && set_style$6(e, "height", typeof /*height*/ - _[0] == "number" ? ( - /*height*/ - _[0] + "px" - ) : void 0), E & /*width*/ - 2 && set_style$6(e, "width", typeof /*width*/ - _[1] == "number" ? `calc(min(${/*width*/ - _[1]}px, 100%))` : void 0), E & /*variant*/ - 16 && set_style$6( + u[7] === "focus" + ), toggle_class$c( + e, + "border_contrast", + /*border_mode*/ + u[7] === "contrast" + ), toggle_class$c(e, "hide-container", !/*explicit_call*/ + u[10] && !/*container*/ + u[11]), p & /*height*/ + 1 && set_style$9( + e, + "height", + /*get_dimension*/ + u[19]( + /*height*/ + u[0] + ) + ), p & /*min_height*/ + 2 && set_style$9( + e, + "min-height", + /*get_dimension*/ + u[19]( + /*min_height*/ + u[1] + ) + ), p & /*max_height*/ + 4 && set_style$9( + e, + "max-height", + /*get_dimension*/ + u[19]( + /*max_height*/ + u[2] + ) + ), p & /*width*/ + 8 && set_style$9(e, "width", typeof /*width*/ + u[3] == "number" ? `calc(min(${/*width*/ + u[3]}px, 100%))` : ( + /*get_dimension*/ + u[19]( + /*width*/ + u[3] + ) + )), p & /*variant*/ + 64 && set_style$9( e, "border-style", /*variant*/ - _[4] - ), E & /*allow_overflow*/ - 2048 && set_style$6( + u[6] + ), p & /*allow_overflow, overflow_behavior*/ + 24576 && set_style$9( e, "overflow", /*allow_overflow*/ - _[11] ? "visible" : "hidden" - ), E & /*scale*/ - 4096 && set_style$6( + u[13] ? ( + /*overflow_behavior*/ + u[14] + ) : "hidden" + ), p & /*scale*/ + 32768 && set_style$9( e, "flex-grow", /*scale*/ - _[12] - ), E & /*min_width*/ - 8192 && set_style$6(e, "min-width", `calc(min(${/*min_width*/ - _[13]}px, 100%))`); + u[15] + ), p & /*min_width*/ + 65536 && set_style$9(e, "min-width", `calc(min(${/*min_width*/ + u[16]}px, 100%))`); }, - i(_) { - n || (transition_in$c(u, _), n = !0); + i(u) { + r || (transition_in$f(l, u), r = !0); }, - o(_) { - transition_out$b(u, _), n = !1; + o(u) { + transition_out$e(l, u), r = !1; }, - d(_) { - _ && detach$l(e), u && u.d(_); + d(u) { + u && detach$q(e), l && l.d(u); } }; } -function create_fragment$l(t) { - let e, r = ( +function create_fragment$q(n) { + let e, t = ( /*tag*/ - t[14] && create_dynamic_element(t) + n[18] && create_dynamic_element(n) ); return { c() { - r && r.c(); + t && t.c(); }, - m(n, f) { - r && r.m(n, f), e = !0; + l(r) { + t && t.l(r); }, - p(n, [f]) { + m(r, a) { + t && t.m(r, a), e = !0; + }, + p(r, [a]) { /*tag*/ - n[14] && r.p(n, f); + r[18] && t.p(r, a); }, - i(n) { - e || (transition_in$c(r, n), e = !0); + i(r) { + e || (transition_in$f(t, r), e = !0); }, - o(n) { - transition_out$b(r, n), e = !1; + o(r) { + transition_out$e(t, r), e = !1; }, - d(n) { - r && r.d(n); + d(r) { + t && t.d(r); } }; } -function instance$f(t, e, r) { - let { $$slots: n = {}, $$scope: f } = e, { height: u = void 0 } = e, { width: b = void 0 } = e, { elem_id: h = "" } = e, { elem_classes: _ = [] } = e, { variant: E = "solid" } = e, { border_mode: c = "base" } = e, { padding: S = !0 } = e, { type: y = "normal" } = e, { test_id: w = void 0 } = e, { explicit_call: L = !1 } = e, { container: s = !0 } = e, { visible: o = !0 } = e, { allow_overflow: A = !0 } = e, { scale: p = null } = e, { min_width: v = 0 } = e, a = y === "fieldset" ? "fieldset" : "div"; - return t.$$set = (l) => { - "height" in l && r(0, u = l.height), "width" in l && r(1, b = l.width), "elem_id" in l && r(2, h = l.elem_id), "elem_classes" in l && r(3, _ = l.elem_classes), "variant" in l && r(4, E = l.variant), "border_mode" in l && r(5, c = l.border_mode), "padding" in l && r(6, S = l.padding), "type" in l && r(15, y = l.type), "test_id" in l && r(7, w = l.test_id), "explicit_call" in l && r(8, L = l.explicit_call), "container" in l && r(9, s = l.container), "visible" in l && r(10, o = l.visible), "allow_overflow" in l && r(11, A = l.allow_overflow), "scale" in l && r(12, p = l.scale), "min_width" in l && r(13, v = l.min_width), "$$scope" in l && r(16, f = l.$$scope); +function instance$i(n, e, t) { + let { $$slots: r = {}, $$scope: a } = e, { height: l = void 0 } = e, { min_height: d = void 0 } = e, { max_height: o = void 0 } = e, { width: u = void 0 } = e, { elem_id: p = "" } = e, { elem_classes: m = [] } = e, { variant: y = "solid" } = e, { border_mode: w = "base" } = e, { padding: b = !0 } = e, { type: A = "normal" } = e, { test_id: f = void 0 } = e, { explicit_call: s = !1 } = e, { container: h = !0 } = e, { visible: _ = !0 } = e, { allow_overflow: g = !0 } = e, { overflow_behavior: x = "auto" } = e, { scale: c = null } = e, { min_width: v = 0 } = e, { flex: M = !1 } = e, E = A === "fieldset" ? "fieldset" : "div"; + const $ = (k) => { + if (k !== void 0) { + if (typeof k == "number") + return k + "px"; + if (typeof k == "string") + return k; + } + }; + return n.$$set = (k) => { + "height" in k && t(0, l = k.height), "min_height" in k && t(1, d = k.min_height), "max_height" in k && t(2, o = k.max_height), "width" in k && t(3, u = k.width), "elem_id" in k && t(4, p = k.elem_id), "elem_classes" in k && t(5, m = k.elem_classes), "variant" in k && t(6, y = k.variant), "border_mode" in k && t(7, w = k.border_mode), "padding" in k && t(8, b = k.padding), "type" in k && t(20, A = k.type), "test_id" in k && t(9, f = k.test_id), "explicit_call" in k && t(10, s = k.explicit_call), "container" in k && t(11, h = k.container), "visible" in k && t(12, _ = k.visible), "allow_overflow" in k && t(13, g = k.allow_overflow), "overflow_behavior" in k && t(14, x = k.overflow_behavior), "scale" in k && t(15, c = k.scale), "min_width" in k && t(16, v = k.min_width), "flex" in k && t(17, M = k.flex), "$$scope" in k && t(21, a = k.$$scope); }, [ + l, + d, + o, u, + p, + m, + y, + w, b, + f, + s, h, _, - E, + g, + x, c, - S, - w, - L, - s, - o, - A, - p, v, + M, + E, + $, + A, a, - y, - f, - n + r ]; } -class Block extends SvelteComponent$l { +class Block extends SvelteComponent$q { constructor(e) { - super(), init$l(this, e, instance$f, create_fragment$l, safe_not_equal$m, { + super(), init$q(this, e, instance$i, create_fragment$q, safe_not_equal$r, { height: 0, - width: 1, - elem_id: 2, - elem_classes: 3, - variant: 4, - border_mode: 5, - padding: 6, - type: 15, - test_id: 7, - explicit_call: 8, - container: 9, - visible: 10, - allow_overflow: 11, - scale: 12, - min_width: 13 - }); - } -} -const Info_svelte_svelte_type_style_lang = "", BlockTitle_svelte_svelte_type_style_lang = "", BlockLabel_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$k, - append: append$i, - attr: attr$i, - create_component: create_component$8, - destroy_component: destroy_component$8, - detach: detach$k, - element: element$c, - init: init$k, - insert: insert$k, - mount_component: mount_component$8, - safe_not_equal: safe_not_equal$l, - set_data: set_data$7, - space: space$b, - text: text$7, - toggle_class: toggle_class$a, - transition_in: transition_in$b, - transition_out: transition_out$a -} = window.__gradio__svelte__internal; -function create_fragment$k(t) { - let e, r, n, f, u, b; - return n = new /*Icon*/ - t[1]({}), { - c() { - e = element$c("label"), r = element$c("span"), create_component$8(n.$$.fragment), f = space$b(), u = text$7( - /*label*/ - t[0] - ), attr$i(r, "class", "svelte-9gxdi0"), attr$i(e, "for", ""), attr$i(e, "data-testid", "block-label"), attr$i(e, "class", "svelte-9gxdi0"), toggle_class$a(e, "hide", !/*show_label*/ - t[2]), toggle_class$a(e, "sr-only", !/*show_label*/ - t[2]), toggle_class$a( - e, - "float", - /*float*/ - t[4] - ), toggle_class$a( - e, - "hide-label", - /*disable*/ - t[3] - ); - }, - m(h, _) { - insert$k(h, e, _), append$i(e, r), mount_component$8(n, r, null), append$i(e, f), append$i(e, u), b = !0; - }, - p(h, [_]) { - (!b || _ & /*label*/ - 1) && set_data$7( - u, - /*label*/ - h[0] - ), (!b || _ & /*show_label*/ - 4) && toggle_class$a(e, "hide", !/*show_label*/ - h[2]), (!b || _ & /*show_label*/ - 4) && toggle_class$a(e, "sr-only", !/*show_label*/ - h[2]), (!b || _ & /*float*/ - 16) && toggle_class$a( - e, - "float", - /*float*/ - h[4] - ), (!b || _ & /*disable*/ - 8) && toggle_class$a( - e, - "hide-label", - /*disable*/ - h[3] - ); - }, - i(h) { - b || (transition_in$b(n.$$.fragment, h), b = !0); - }, - o(h) { - transition_out$a(n.$$.fragment, h), b = !1; - }, - d(h) { - h && detach$k(e), destroy_component$8(n); - } - }; -} -function instance$e(t, e, r) { - let { label: n = null } = e, { Icon: f } = e, { show_label: u = !0 } = e, { disable: b = !1 } = e, { float: h = !0 } = e; - return t.$$set = (_) => { - "label" in _ && r(0, n = _.label), "Icon" in _ && r(1, f = _.Icon), "show_label" in _ && r(2, u = _.show_label), "disable" in _ && r(3, b = _.disable), "float" in _ && r(4, h = _.float); - }, [n, f, u, b, h]; -} -class BlockLabel extends SvelteComponent$k { - constructor(e) { - super(), init$k(this, e, instance$e, create_fragment$k, safe_not_equal$l, { - label: 0, - Icon: 1, - show_label: 2, - disable: 3, - float: 4 - }); - } -} -const IconButton_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$j, - append: append$h, - attr: attr$h, - bubble: bubble$3, - create_component: create_component$7, - destroy_component: destroy_component$7, - detach: detach$j, - element: element$b, - init: init$j, - insert: insert$j, - listen: listen$4, - mount_component: mount_component$7, - safe_not_equal: safe_not_equal$k, - set_data: set_data$6, - space: space$a, - text: text$6, - toggle_class: toggle_class$9, - transition_in: transition_in$a, - transition_out: transition_out$9 -} = window.__gradio__svelte__internal; -function create_if_block$9(t) { - let e, r; - return { - c() { - e = element$b("span"), r = text$6( - /*label*/ - t[1] - ), attr$h(e, "class", "svelte-xtz2g8"); - }, - m(n, f) { - insert$j(n, e, f), append$h(e, r); - }, - p(n, f) { - f & /*label*/ - 2 && set_data$6( - r, - /*label*/ - n[1] - ); - }, - d(n) { - n && detach$j(e); - } - }; -} -function create_fragment$j(t) { - let e, r, n, f, u, b, h, _ = ( - /*show_label*/ - t[2] && create_if_block$9(t) - ); - return f = new /*Icon*/ - t[0]({}), { - c() { - e = element$b("button"), _ && _.c(), r = space$a(), n = element$b("div"), create_component$7(f.$$.fragment), attr$h(n, "class", "svelte-xtz2g8"), toggle_class$9( - n, - "small", - /*size*/ - t[4] === "small" - ), toggle_class$9( - n, - "large", - /*size*/ - t[4] === "large" - ), attr$h( - e, - "aria-label", - /*label*/ - t[1] - ), attr$h( - e, - "title", - /*label*/ - t[1] - ), attr$h(e, "class", "svelte-xtz2g8"), toggle_class$9( - e, - "pending", - /*pending*/ - t[3] - ), toggle_class$9( - e, - "padded", - /*padded*/ - t[5] - ); - }, - m(E, c) { - insert$j(E, e, c), _ && _.m(e, null), append$h(e, r), append$h(e, n), mount_component$7(f, n, null), u = !0, b || (h = listen$4( - e, - "click", - /*click_handler*/ - t[6] - ), b = !0); - }, - p(E, [c]) { - /*show_label*/ - E[2] ? _ ? _.p(E, c) : (_ = create_if_block$9(E), _.c(), _.m(e, r)) : _ && (_.d(1), _ = null), (!u || c & /*size*/ - 16) && toggle_class$9( - n, - "small", - /*size*/ - E[4] === "small" - ), (!u || c & /*size*/ - 16) && toggle_class$9( - n, - "large", - /*size*/ - E[4] === "large" - ), (!u || c & /*label*/ - 2) && attr$h( - e, - "aria-label", - /*label*/ - E[1] - ), (!u || c & /*label*/ - 2) && attr$h( - e, - "title", - /*label*/ - E[1] - ), (!u || c & /*pending*/ - 8) && toggle_class$9( - e, - "pending", - /*pending*/ - E[3] - ), (!u || c & /*padded*/ - 32) && toggle_class$9( - e, - "padded", - /*padded*/ - E[5] - ); - }, - i(E) { - u || (transition_in$a(f.$$.fragment, E), u = !0); - }, - o(E) { - transition_out$9(f.$$.fragment, E), u = !1; - }, - d(E) { - E && detach$j(e), _ && _.d(), destroy_component$7(f), b = !1, h(); - } - }; -} -function instance$d(t, e, r) { - let { Icon: n } = e, { label: f = "" } = e, { show_label: u = !1 } = e, { pending: b = !1 } = e, { size: h = "small" } = e, { padded: _ = !0 } = e; - function E(c) { - bubble$3.call(this, t, c); - } - return t.$$set = (c) => { - "Icon" in c && r(0, n = c.Icon), "label" in c && r(1, f = c.label), "show_label" in c && r(2, u = c.show_label), "pending" in c && r(3, b = c.pending), "size" in c && r(4, h = c.size), "padded" in c && r(5, _ = c.padded); - }, [n, f, u, b, h, _, E]; -} -class IconButton extends SvelteComponent$j { - constructor(e) { - super(), init$j(this, e, instance$d, create_fragment$j, safe_not_equal$k, { - Icon: 0, - label: 1, - show_label: 2, - pending: 3, - size: 4, - padded: 5 + min_height: 1, + max_height: 2, + width: 3, + elem_id: 4, + elem_classes: 5, + variant: 6, + border_mode: 7, + padding: 8, + type: 20, + test_id: 9, + explicit_call: 10, + container: 11, + visible: 12, + allow_overflow: 13, + overflow_behavior: 14, + scale: 15, + min_width: 16, + flex: 17 }); } } -const Empty_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$i, - append: append$g, - attr: attr$g, - binding_callbacks: binding_callbacks$4, - create_slot: create_slot$3, - detach: detach$i, - element: element$a, - get_all_dirty_from_scope: get_all_dirty_from_scope$3, - get_slot_changes: get_slot_changes$3, - init: init$i, - insert: insert$i, - safe_not_equal: safe_not_equal$j, - toggle_class: toggle_class$8, - transition_in: transition_in$9, - transition_out: transition_out$8, - update_slot_base: update_slot_base$3 -} = window.__gradio__svelte__internal; -function create_fragment$i(t) { - let e, r, n; - const f = ( - /*#slots*/ - t[5].default - ), u = create_slot$3( - f, - t, - /*$$scope*/ - t[4], - null - ); - return { - c() { - e = element$a("div"), r = element$a("div"), u && u.c(), attr$g(r, "class", "icon svelte-3w3rth"), attr$g(e, "class", "empty svelte-3w3rth"), attr$g(e, "aria-label", "Empty value"), toggle_class$8( - e, - "small", - /*size*/ - t[0] === "small" - ), toggle_class$8( - e, - "large", - /*size*/ - t[0] === "large" - ), toggle_class$8( - e, - "unpadded_box", - /*unpadded_box*/ - t[1] - ), toggle_class$8( - e, - "small_parent", - /*parent_height*/ - t[3] - ); - }, - m(b, h) { - insert$i(b, e, h), append$g(e, r), u && u.m(r, null), t[6](e), n = !0; - }, - p(b, [h]) { - u && u.p && (!n || h & /*$$scope*/ - 16) && update_slot_base$3( - u, - f, - b, - /*$$scope*/ - b[4], - n ? get_slot_changes$3( - f, - /*$$scope*/ - b[4], - h, - null - ) : get_all_dirty_from_scope$3( - /*$$scope*/ - b[4] - ), - null - ), (!n || h & /*size*/ - 1) && toggle_class$8( - e, - "small", - /*size*/ - b[0] === "small" - ), (!n || h & /*size*/ - 1) && toggle_class$8( - e, - "large", - /*size*/ - b[0] === "large" - ), (!n || h & /*unpadded_box*/ - 2) && toggle_class$8( - e, - "unpadded_box", - /*unpadded_box*/ - b[1] - ), (!n || h & /*parent_height*/ - 8) && toggle_class$8( - e, - "small_parent", - /*parent_height*/ - b[3] - ); - }, - i(b) { - n || (transition_in$9(u, b), n = !0); - }, - o(b) { - transition_out$8(u, b), n = !1; - }, - d(b) { - b && detach$i(e), u && u.d(b), t[6](null); - } - }; -} -function _optionalChain$1(t) { - let e, r = t[0], n = 1; - for (; n < t.length; ) { - const f = t[n], u = t[n + 1]; - if (n += 2, (f === "optionalAccess" || f === "optionalCall") && r == null) - return; - f === "access" || f === "optionalAccess" ? (e = r, r = u(r)) : (f === "call" || f === "optionalCall") && (r = u((...b) => r.call(e, ...b)), e = void 0); - } - return r; -} -function instance$c(t, e, r) { - let n, { $$slots: f = {}, $$scope: u } = e, { size: b = "small" } = e, { unpadded_box: h = !1 } = e, _; - function E(S) { - if (!S) - return !1; - const { height: y } = S.getBoundingClientRect(), { height: w } = _optionalChain$1([ - S, - "access", - (L) => L.parentElement, - "optionalAccess", - (L) => L.getBoundingClientRect, - "call", - (L) => L() - ]) || { height: y }; - return y > w + 2; - } - function c(S) { - binding_callbacks$4[S ? "unshift" : "push"](() => { - _ = S, r(2, _); - }); - } - return t.$$set = (S) => { - "size" in S && r(0, b = S.size), "unpadded_box" in S && r(1, h = S.unpadded_box), "$$scope" in S && r(4, u = S.$$scope); - }, t.$$.update = () => { - t.$$.dirty & /*el*/ - 4 && r(3, n = E(_)); - }, [b, h, _, n, u, f, c]; -} -class Empty extends SvelteComponent$i { - constructor(e) { - super(), init$i(this, e, instance$c, create_fragment$i, safe_not_equal$j, { size: 0, unpadded_box: 1 }); - } -} -const { - SvelteComponent: SvelteComponent$h, - append: append$f, - attr: attr$f, - detach: detach$h, - init: init$h, - insert: insert$h, - noop: noop$c, - safe_not_equal: safe_not_equal$i, - set_style: set_style$5, - svg_element: svg_element$8 -} = window.__gradio__svelte__internal; -function create_fragment$h(t) { - let e, r, n, f; - return { - c() { - e = svg_element$8("svg"), r = svg_element$8("g"), n = svg_element$8("path"), f = svg_element$8("path"), attr$f(n, "d", "M18,6L6.087,17.913"), set_style$5(n, "fill", "none"), set_style$5(n, "fill-rule", "nonzero"), set_style$5(n, "stroke-width", "2px"), attr$f(r, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$f(f, "d", "M4.364,4.364L19.636,19.636"), set_style$5(f, "fill", "none"), set_style$5(f, "fill-rule", "nonzero"), set_style$5(f, "stroke-width", "2px"), attr$f(e, "width", "100%"), attr$f(e, "height", "100%"), attr$f(e, "viewBox", "0 0 24 24"), attr$f(e, "version", "1.1"), attr$f(e, "xmlns", "http://www.w3.org/2000/svg"), attr$f(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$f(e, "xml:space", "preserve"), attr$f(e, "stroke", "currentColor"), set_style$5(e, "fill-rule", "evenodd"), set_style$5(e, "clip-rule", "evenodd"), set_style$5(e, "stroke-linecap", "round"), set_style$5(e, "stroke-linejoin", "round"); - }, - m(u, b) { - insert$h(u, e, b), append$f(e, r), append$f(r, n), append$f(e, f); - }, - p: noop$c, - i: noop$c, - o: noop$c, - d(u) { - u && detach$h(e); - } - }; -} -class Clear extends SvelteComponent$h { - constructor(e) { - super(), init$h(this, e, null, create_fragment$h, safe_not_equal$i, {}); - } -} -const DropdownArrow_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$g, - append: append$e, - attr: attr$e, - detach: detach$g, - init: init$g, - insert: insert$g, - noop: noop$b, - safe_not_equal: safe_not_equal$h, - svg_element: svg_element$7 -} = window.__gradio__svelte__internal; -function create_fragment$g(t) { - let e, r; - return { - c() { - e = svg_element$7("svg"), r = svg_element$7("path"), attr$e(r, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), attr$e(e, "xmlns", "http://www.w3.org/2000/svg"), attr$e(e, "width", "100%"), attr$e(e, "height", "100%"), attr$e(e, "viewBox", "0 0 24 24"), attr$e(e, "fill", "none"), attr$e(e, "stroke", "currentColor"), attr$e(e, "stroke-width", "1.5"), attr$e(e, "stroke-linecap", "round"), attr$e(e, "stroke-linejoin", "round"), attr$e(e, "class", "feather feather-edit-2"); - }, - m(n, f) { - insert$g(n, e, f), append$e(e, r); - }, - p: noop$b, - i: noop$b, - o: noop$b, - d(n) { - n && detach$g(e); - } - }; -} -class Edit extends SvelteComponent$g { - constructor(e) { - super(), init$g(this, e, null, create_fragment$g, safe_not_equal$h, {}); - } -} -const { - SvelteComponent: SvelteComponent$f, - append: append$d, - attr: attr$d, - detach: detach$f, - init: init$f, - insert: insert$f, - noop: noop$a, - safe_not_equal: safe_not_equal$g, - svg_element: svg_element$6 -} = window.__gradio__svelte__internal; -function create_fragment$f(t) { - let e, r, n; - return { - c() { - e = svg_element$6("svg"), r = svg_element$6("path"), n = svg_element$6("polyline"), attr$d(r, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), attr$d(n, "points", "13 2 13 9 20 9"), attr$d(e, "xmlns", "http://www.w3.org/2000/svg"), attr$d(e, "width", "100%"), attr$d(e, "height", "100%"), attr$d(e, "viewBox", "0 0 24 24"), attr$d(e, "fill", "none"), attr$d(e, "stroke", "currentColor"), attr$d(e, "stroke-width", "1.5"), attr$d(e, "stroke-linecap", "round"), attr$d(e, "stroke-linejoin", "round"), attr$d(e, "class", "feather feather-file"); - }, - m(f, u) { - insert$f(f, e, u), append$d(e, r), append$d(e, n); - }, - p: noop$a, - i: noop$a, - o: noop$a, - d(f) { - f && detach$f(e); - } - }; -} -let File$1 = class extends SvelteComponent$f { - constructor(e) { - super(), init$f(this, e, null, create_fragment$f, safe_not_equal$g, {}); - } -}; -const { - SvelteComponent: SvelteComponent$e, - append: append$c, - attr: attr$c, - detach: detach$e, - init: init$e, - insert: insert$e, - noop: noop$9, - safe_not_equal: safe_not_equal$f, - svg_element: svg_element$5 -} = window.__gradio__svelte__internal; -function create_fragment$e(t) { - let e, r, n; - return { - c() { - e = svg_element$5("svg"), r = svg_element$5("polyline"), n = svg_element$5("path"), attr$c(r, "points", "1 4 1 10 7 10"), attr$c(n, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), attr$c(e, "xmlns", "http://www.w3.org/2000/svg"), attr$c(e, "width", "100%"), attr$c(e, "height", "100%"), attr$c(e, "viewBox", "0 0 24 24"), attr$c(e, "fill", "none"), attr$c(e, "stroke", "currentColor"), attr$c(e, "stroke-width", "2"), attr$c(e, "stroke-linecap", "round"), attr$c(e, "stroke-linejoin", "round"), attr$c(e, "class", "feather feather-rotate-ccw"); - }, - m(f, u) { - insert$e(f, e, u), append$c(e, r), append$c(e, n); - }, - p: noop$9, - i: noop$9, - o: noop$9, - d(f) { - f && detach$e(e); - } - }; -} -class Undo extends SvelteComponent$e { - constructor(e) { - super(), init$e(this, e, null, create_fragment$e, safe_not_equal$f, {}); - } -} -const { - SvelteComponent: SvelteComponent$d, - append: append$b, - attr: attr$b, - detach: detach$d, - init: init$d, - insert: insert$d, - noop: noop$8, - safe_not_equal: safe_not_equal$e, - svg_element: svg_element$4 -} = window.__gradio__svelte__internal; -function create_fragment$d(t) { - let e, r, n, f; - return { - c() { - e = svg_element$4("svg"), r = svg_element$4("path"), n = svg_element$4("polyline"), f = svg_element$4("line"), attr$b(r, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), attr$b(n, "points", "17 8 12 3 7 8"), attr$b(f, "x1", "12"), attr$b(f, "y1", "3"), attr$b(f, "x2", "12"), attr$b(f, "y2", "15"), attr$b(e, "xmlns", "http://www.w3.org/2000/svg"), attr$b(e, "width", "90%"), attr$b(e, "height", "90%"), attr$b(e, "viewBox", "0 0 24 24"), attr$b(e, "fill", "none"), attr$b(e, "stroke", "currentColor"), attr$b(e, "stroke-width", "2"), attr$b(e, "stroke-linecap", "round"), attr$b(e, "stroke-linejoin", "round"), attr$b(e, "class", "feather feather-upload"); - }, - m(u, b) { - insert$d(u, e, b), append$b(e, r), append$b(e, n), append$b(e, f); - }, - p: noop$8, - i: noop$8, - o: noop$8, - d(u) { - u && detach$d(e); - } - }; -} -let Upload$1 = class extends SvelteComponent$d { - constructor(e) { - super(), init$d(this, e, null, create_fragment$d, safe_not_equal$e, {}); - } -}; const color_values = [ { color: "red", primary: 600, secondary: 100 }, { color: "green", primary: 600, secondary: 100 }, @@ -1153,30283 +711,43938 @@ const color_values = [ } }; color_values.reduce( - (t, { color: e, primary: r, secondary: n }) => ({ - ...t, + (n, { color: e, primary: t, secondary: r }) => ({ + ...n, [e]: { - primary: tw_colors[e][r], - secondary: tw_colors[e][n] + primary: tw_colors[e][t], + secondary: tw_colors[e][r] } }), {} ); -const UploadText_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$c, - append: append$a, - attr: attr$a, - create_component: create_component$6, - destroy_component: destroy_component$6, - detach: detach$c, - element: element$9, - init: init$c, - insert: insert$c, - mount_component: mount_component$6, - safe_not_equal: safe_not_equal$d, - set_data: set_data$5, - space: space$9, - text: text$5, - toggle_class: toggle_class$7, - transition_in: transition_in$8, - transition_out: transition_out$7 +const { + SvelteComponent: SvelteComponent$p, + append_hydration: append_hydration$k, + attr: attr$l, + children: children$m, + claim_svg_element: claim_svg_element$a, + detach: detach$p, + init: init$p, + insert_hydration: insert_hydration$p, + noop: noop$g, + safe_not_equal: safe_not_equal$q, + set_style: set_style$8, + svg_element: svg_element$a } = window.__gradio__svelte__internal; -function create_if_block$8(t) { - let e, r, n = ( - /*i18n*/ - t[1]("common.or") + "" - ), f, u, b, h = ( - /*message*/ - (t[2] || /*i18n*/ - t[1]("upload_text.click_to_upload")) + "" - ), _; +function create_fragment$p(n) { + let e, t, r, a; return { c() { - e = element$9("span"), r = text$5("- "), f = text$5(n), u = text$5(" -"), b = space$9(), _ = text$5(h), attr$a(e, "class", "or svelte-kzcjhc"); + e = svg_element$a("svg"), t = svg_element$a("g"), r = svg_element$a("path"), a = svg_element$a("path"), this.h(); + }, + l(l) { + e = claim_svg_element$a(l, "svg", { + width: !0, + height: !0, + viewBox: !0, + version: !0, + xmlns: !0, + "xmlns:xlink": !0, + "xml:space": !0, + stroke: !0, + style: !0 + }); + var d = children$m(e); + t = claim_svg_element$a(d, "g", { transform: !0 }); + var o = children$m(t); + r = claim_svg_element$a(o, "path", { d: !0, style: !0 }), children$m(r).forEach(detach$p), o.forEach(detach$p), a = claim_svg_element$a(d, "path", { d: !0, style: !0 }), children$m(a).forEach(detach$p), d.forEach(detach$p), this.h(); }, - m(E, c) { - insert$c(E, e, c), append$a(e, r), append$a(e, f), append$a(e, u), insert$c(E, b, c), insert$c(E, _, c); + h() { + attr$l(r, "d", "M18,6L6.087,17.913"), set_style$8(r, "fill", "none"), set_style$8(r, "fill-rule", "nonzero"), set_style$8(r, "stroke-width", "2px"), attr$l(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), attr$l(a, "d", "M4.364,4.364L19.636,19.636"), set_style$8(a, "fill", "none"), set_style$8(a, "fill-rule", "nonzero"), set_style$8(a, "stroke-width", "2px"), attr$l(e, "width", "100%"), attr$l(e, "height", "100%"), attr$l(e, "viewBox", "0 0 24 24"), attr$l(e, "version", "1.1"), attr$l(e, "xmlns", "http://www.w3.org/2000/svg"), attr$l(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), attr$l(e, "xml:space", "preserve"), attr$l(e, "stroke", "currentColor"), set_style$8(e, "fill-rule", "evenodd"), set_style$8(e, "clip-rule", "evenodd"), set_style$8(e, "stroke-linecap", "round"), set_style$8(e, "stroke-linejoin", "round"); }, - p(E, c) { - c & /*i18n*/ - 2 && n !== (n = /*i18n*/ - E[1]("common.or") + "") && set_data$5(f, n), c & /*message, i18n*/ - 6 && h !== (h = /*message*/ - (E[2] || /*i18n*/ - E[1]("upload_text.click_to_upload")) + "") && set_data$5(_, h); + m(l, d) { + insert_hydration$p(l, e, d), append_hydration$k(e, t), append_hydration$k(t, r), append_hydration$k(e, a); }, - d(E) { - E && (detach$c(e), detach$c(b), detach$c(_)); + p: noop$g, + i: noop$g, + o: noop$g, + d(l) { + l && detach$p(e); } }; } -function create_fragment$c(t) { - let e, r, n, f, u = ( - /*i18n*/ - t[1]( - /*defs*/ - t[5][ - /*type*/ - t[0] - ] || /*defs*/ - t[5].file - ) + "" - ), b, h, _; - n = new Upload$1({}); - let E = ( - /*mode*/ - t[3] !== "short" && create_if_block$8(t) - ); +class Clear extends SvelteComponent$p { + constructor(e) { + super(), init$p(this, e, null, create_fragment$p, safe_not_equal$q, {}); + } +} +const { + SvelteComponent: SvelteComponent$o, + append_hydration: append_hydration$j, + attr: attr$k, + children: children$l, + claim_svg_element: claim_svg_element$9, + detach: detach$o, + init: init$o, + insert_hydration: insert_hydration$o, + noop: noop$f, + safe_not_equal: safe_not_equal$p, + svg_element: svg_element$9 +} = window.__gradio__svelte__internal; +function create_fragment$o(n) { + let e, t; return { c() { - e = element$9("div"), r = element$9("span"), create_component$6(n.$$.fragment), f = space$9(), b = text$5(u), h = space$9(), E && E.c(), attr$a(r, "class", "icon-wrap svelte-kzcjhc"), toggle_class$7( - r, - "hovered", - /*hovered*/ - t[4] - ), attr$a(e, "class", "wrap svelte-kzcjhc"); - }, - m(c, S) { - insert$c(c, e, S), append$a(e, r), mount_component$6(n, r, null), append$a(e, f), append$a(e, b), append$a(e, h), E && E.m(e, null), _ = !0; - }, - p(c, [S]) { - (!_ || S & /*hovered*/ - 16) && toggle_class$7( - r, - "hovered", - /*hovered*/ - c[4] - ), (!_ || S & /*i18n, type*/ - 3) && u !== (u = /*i18n*/ - c[1]( - /*defs*/ - c[5][ - /*type*/ - c[0] - ] || /*defs*/ - c[5].file - ) + "") && set_data$5(b, u), /*mode*/ - c[3] !== "short" ? E ? E.p(c, S) : (E = create_if_block$8(c), E.c(), E.m(e, null)) : E && (E.d(1), E = null); + e = svg_element$9("svg"), t = svg_element$9("path"), this.h(); + }, + l(r) { + e = claim_svg_element$9(r, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0 + }); + var a = children$l(e); + t = claim_svg_element$9(a, "path", { fill: !0, d: !0 }), children$l(t).forEach(detach$o), a.forEach(detach$o), this.h(); }, - i(c) { - _ || (transition_in$8(n.$$.fragment, c), _ = !0); + h() { + attr$k(t, "fill", "currentColor"), attr$k(t, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), attr$k(e, "xmlns", "http://www.w3.org/2000/svg"), attr$k(e, "width", "100%"), attr$k(e, "height", "100%"), attr$k(e, "viewBox", "0 0 32 32"); }, - o(c) { - transition_out$7(n.$$.fragment, c), _ = !1; + m(r, a) { + insert_hydration$o(r, e, a), append_hydration$j(e, t); }, - d(c) { - c && detach$c(e), destroy_component$6(n), E && E.d(); + p: noop$f, + i: noop$f, + o: noop$f, + d(r) { + r && detach$o(e); } }; } -function instance$b(t, e, r) { - let { type: n = "file" } = e, { i18n: f } = e, { message: u = void 0 } = e, { mode: b = "full" } = e, { hovered: h = !1 } = e; - const _ = { - image: "upload_text.drop_image", - video: "upload_text.drop_video", - audio: "upload_text.drop_audio", - file: "upload_text.drop_file", - csv: "upload_text.drop_csv" - }; - return t.$$set = (E) => { - "type" in E && r(0, n = E.type), "i18n" in E && r(1, f = E.i18n), "message" in E && r(2, u = E.message), "mode" in E && r(3, b = E.mode), "hovered" in E && r(4, h = E.hovered); - }, [n, f, u, b, h, _]; -} -class UploadText extends SvelteComponent$c { +class Download extends SvelteComponent$o { constructor(e) { - super(), init$c(this, e, instance$b, create_fragment$c, safe_not_equal$d, { - type: 0, - i18n: 1, - message: 2, - mode: 3, - hovered: 4 - }); - } -} -const Toolbar_svelte_svelte_type_style_lang = "", prettyBytes = (t) => { - let e = ["B", "KB", "MB", "GB", "PB"], r = 0; - for (; t > 1024; ) - t /= 1024, r++; - let n = e[r]; - return t.toFixed(1) + " " + n; -}, display_file_name = (t) => { - var e; - e = t.orig_name; - const r = 30; - if (e.length > r) { - const n = e.substring(0, r), f = e.lastIndexOf("."); - if (f !== -1) { - const u = e.slice(f); - return `${n}..${u}`; - } - return n; + super(), init$o(this, e, null, create_fragment$o, safe_not_equal$p, {}); } - return e; -}, display_file_size = (t) => { - var e = 0; - if (Array.isArray(t)) - for (var r of t) - r.size !== void 0 && (e += r.size); - else - e = t.size || 0; - return prettyBytes(e); -}, FilePreview_svelte_svelte_type_style_lang = "", { - HtmlTag, - SvelteComponent: SvelteComponent$b, - append: append$9, - attr: attr$9, - destroy_each: destroy_each$3, - detach: detach$b, - element: element$8, - ensure_array_like: ensure_array_like$3, - init: init$b, - insert: insert$b, - listen: listen$3, - noop: noop$7, - safe_not_equal: safe_not_equal$c, - set_data: set_data$4, - set_style: set_style$4, - space: space$8, - text: text$4, - toggle_class: toggle_class$6 -} = window.__gradio__svelte__internal, { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal; -function get_each_context$3(t, e, r) { - const n = t.slice(); - return n[6] = e[r], n[8] = r, n; } -function create_else_block$6(t) { - let e = ( - /*i18n*/ - t[3]("file.uploading") + "" - ), r; +const { + SvelteComponent: SvelteComponent$n, + append_hydration: append_hydration$i, + attr: attr$j, + children: children$k, + claim_svg_element: claim_svg_element$8, + detach: detach$n, + init: init$n, + insert_hydration: insert_hydration$n, + noop: noop$e, + safe_not_equal: safe_not_equal$o, + svg_element: svg_element$8 +} = window.__gradio__svelte__internal; +function create_fragment$n(n) { + let e, t; return { c() { - r = text$4(e); + e = svg_element$8("svg"), t = svg_element$8("path"), this.h(); + }, + l(r) { + e = claim_svg_element$8(r, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var a = children$k(e); + t = claim_svg_element$8(a, "path", { d: !0 }), children$k(t).forEach(detach$n), a.forEach(detach$n), this.h(); }, - m(n, f) { - insert$b(n, r, f); + h() { + attr$j(t, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), attr$j(e, "xmlns", "http://www.w3.org/2000/svg"), attr$j(e, "width", "100%"), attr$j(e, "height", "100%"), attr$j(e, "viewBox", "0 0 24 24"), attr$j(e, "fill", "none"), attr$j(e, "stroke", "currentColor"), attr$j(e, "stroke-width", "1.5"), attr$j(e, "stroke-linecap", "round"), attr$j(e, "stroke-linejoin", "round"), attr$j(e, "class", "feather feather-edit-2"); }, - p(n, f) { - f & /*i18n*/ - 8 && e !== (e = /*i18n*/ - n[3]("file.uploading") + "") && set_data$4(r, e); + m(r, a) { + insert_hydration$n(r, e, a), append_hydration$i(e, t); }, - d(n) { - n && detach$b(r); + p: noop$e, + i: noop$e, + o: noop$e, + d(r) { + r && detach$n(e); } }; } -function create_if_block$7(t) { - let e, r, n = display_file_size( - /*file*/ - t[6] - ) + "", f, u, b; +class Edit extends SvelteComponent$n { + constructor(e) { + super(), init$n(this, e, null, create_fragment$n, safe_not_equal$o, {}); + } +} +const { + SvelteComponent: SvelteComponent$m, + append_hydration: append_hydration$h, + attr: attr$i, + children: children$j, + claim_svg_element: claim_svg_element$7, + detach: detach$m, + init: init$m, + insert_hydration: insert_hydration$m, + noop: noop$d, + safe_not_equal: safe_not_equal$n, + svg_element: svg_element$7 +} = window.__gradio__svelte__internal; +function create_fragment$m(n) { + let e, t, r; return { c() { - e = element$8("a"), r = new HtmlTag(!1), f = text$4(" ⇣"), r.a = f, attr$9(e, "href", u = /*file*/ - t[6].url), attr$9(e, "target", "_blank"), attr$9(e, "download", b = window.__is_colab__ ? null : ( - /*file*/ - t[6].orig_name - )), attr$9(e, "class", "svelte-usqupg"); + e = svg_element$7("svg"), t = svg_element$7("path"), r = svg_element$7("polyline"), this.h(); + }, + l(a) { + e = claim_svg_element$7(a, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var l = children$j(e); + t = claim_svg_element$7(l, "path", { d: !0 }), children$j(t).forEach(detach$m), r = claim_svg_element$7(l, "polyline", { points: !0 }), children$j(r).forEach(detach$m), l.forEach(detach$m), this.h(); }, - m(h, _) { - insert$b(h, e, _), r.m(n, e), append$9(e, f); + h() { + attr$i(t, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), attr$i(r, "points", "13 2 13 9 20 9"), attr$i(e, "xmlns", "http://www.w3.org/2000/svg"), attr$i(e, "width", "100%"), attr$i(e, "height", "100%"), attr$i(e, "viewBox", "0 0 24 24"), attr$i(e, "fill", "none"), attr$i(e, "stroke", "currentColor"), attr$i(e, "stroke-width", "1.5"), attr$i(e, "stroke-linecap", "round"), attr$i(e, "stroke-linejoin", "round"), attr$i(e, "class", "feather feather-file"); }, - p(h, _) { - _ & /*value*/ - 1 && n !== (n = display_file_size( - /*file*/ - h[6] - ) + "") && r.p(n), _ & /*value*/ - 1 && u !== (u = /*file*/ - h[6].url) && attr$9(e, "href", u), _ & /*value*/ - 1 && b !== (b = window.__is_colab__ ? null : ( - /*file*/ - h[6].orig_name - )) && attr$9(e, "download", b); + m(a, l) { + insert_hydration$m(a, e, l), append_hydration$h(e, t), append_hydration$h(e, r); }, - d(h) { - h && detach$b(e); + p: noop$d, + i: noop$d, + o: noop$d, + d(a) { + a && detach$m(e); } }; } -function create_each_block$3(t) { - let e, r, n = display_file_name( - /*file*/ - t[6] - ) + "", f, u, b, h, _, E; - function c(L, s) { - return ( - /*file*/ - L[6].url ? create_if_block$7 : create_else_block$6 - ); +let File$1 = class extends SvelteComponent$m { + constructor(e) { + super(), init$m(this, e, null, create_fragment$m, safe_not_equal$n, {}); } - let S = c(t), y = S(t); - function w() { - return ( - /*click_handler*/ - t[5]( - /*file*/ - t[6], - /*i*/ - t[8] - ) - ); +}; +const { + SvelteComponent: SvelteComponent$l, + append_hydration: append_hydration$g, + attr: attr$h, + children: children$i, + claim_svg_element: claim_svg_element$6, + detach: detach$l, + init: init$l, + insert_hydration: insert_hydration$l, + noop: noop$c, + safe_not_equal: safe_not_equal$m, + svg_element: svg_element$6 +} = window.__gradio__svelte__internal; +function create_fragment$l(n) { + let e, t; + return { + c() { + e = svg_element$6("svg"), t = svg_element$6("path"), this.h(); + }, + l(r) { + e = claim_svg_element$6(r, "svg", { xmlns: !0, viewBox: !0 }); + var a = children$i(e); + t = claim_svg_element$6(a, "path", { fill: !0, d: !0 }), children$i(t).forEach(detach$l), a.forEach(detach$l), this.h(); + }, + h() { + attr$h(t, "fill", "currentColor"), attr$h(t, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a4 4 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), attr$h(e, "xmlns", "http://www.w3.org/2000/svg"), attr$h(e, "viewBox", "0 0 24 24"); + }, + m(r, a) { + insert_hydration$l(r, e, a), append_hydration$g(e, t); + }, + p: noop$c, + i: noop$c, + o: noop$c, + d(r) { + r && detach$l(e); + } + }; +} +class ImagePaste extends SvelteComponent$l { + constructor(e) { + super(), init$l(this, e, null, create_fragment$l, safe_not_equal$m, {}); } +} +const { + SvelteComponent: SvelteComponent$k, + append_hydration: append_hydration$f, + attr: attr$g, + children: children$h, + claim_svg_element: claim_svg_element$5, + detach: detach$k, + init: init$k, + insert_hydration: insert_hydration$k, + noop: noop$b, + safe_not_equal: safe_not_equal$l, + svg_element: svg_element$5 +} = window.__gradio__svelte__internal; +function create_fragment$k(n) { + let e, t, r; return { c() { - e = element$8("tr"), r = element$8("td"), f = text$4(n), u = space$8(), b = element$8("td"), y.c(), h = space$8(), attr$9(r, "class", "svelte-usqupg"), attr$9(b, "class", "download svelte-usqupg"), attr$9(e, "class", "file svelte-usqupg"), toggle_class$6( - e, - "selectable", - /*selectable*/ - t[1] - ); + e = svg_element$5("svg"), t = svg_element$5("polyline"), r = svg_element$5("path"), this.h(); + }, + l(a) { + e = claim_svg_element$5(a, "svg", { + "aria-label": !0, + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var l = children$h(e); + t = claim_svg_element$5(l, "polyline", { points: !0 }), children$h(t).forEach(detach$k), r = claim_svg_element$5(l, "path", { d: !0 }), children$h(r).forEach(detach$k), l.forEach(detach$k), this.h(); }, - m(L, s) { - insert$b(L, e, s), append$9(e, r), append$9(r, f), append$9(e, u), append$9(e, b), y.m(b, null), append$9(e, h), _ || (E = listen$3(e, "click", w), _ = !0); + h() { + attr$g(t, "points", "1 4 1 10 7 10"), attr$g(r, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), attr$g(e, "aria-label", "undo"), attr$g(e, "xmlns", "http://www.w3.org/2000/svg"), attr$g(e, "width", "100%"), attr$g(e, "height", "100%"), attr$g(e, "viewBox", "0 0 24 24"), attr$g(e, "fill", "none"), attr$g(e, "stroke", "currentColor"), attr$g(e, "stroke-width", "1.5"), attr$g(e, "stroke-linecap", "round"), attr$g(e, "stroke-linejoin", "round"), attr$g(e, "class", "feather feather-rotate-ccw"); }, - p(L, s) { - t = L, s & /*value*/ - 1 && n !== (n = display_file_name( - /*file*/ - t[6] - ) + "") && set_data$4(f, n), S === (S = c(t)) && y ? y.p(t, s) : (y.d(1), y = S(t), y && (y.c(), y.m(b, null))), s & /*selectable*/ - 2 && toggle_class$6( - e, - "selectable", - /*selectable*/ - t[1] - ); + m(a, l) { + insert_hydration$k(a, e, l), append_hydration$f(e, t), append_hydration$f(e, r); }, - d(L) { - L && detach$b(e), y.d(), _ = !1, E(); + p: noop$b, + i: noop$b, + o: noop$b, + d(a) { + a && detach$k(e); } }; } -function create_fragment$b(t) { - let e, r, n, f = ensure_array_like$3(Array.isArray( - /*value*/ - t[0] - ) ? ( - /*value*/ - t[0] - ) : [ - /*value*/ - t[0] - ]), u = []; - for (let b = 0; b < f.length; b += 1) - u[b] = create_each_block$3(get_each_context$3(t, f, b)); +class Undo extends SvelteComponent$k { + constructor(e) { + super(), init$k(this, e, null, create_fragment$k, safe_not_equal$l, {}); + } +} +const { + SvelteComponent: SvelteComponent$j, + append_hydration: append_hydration$e, + attr: attr$f, + children: children$g, + claim_svg_element: claim_svg_element$4, + detach: detach$j, + init: init$j, + insert_hydration: insert_hydration$j, + noop: noop$a, + safe_not_equal: safe_not_equal$k, + svg_element: svg_element$4 +} = window.__gradio__svelte__internal; +function create_fragment$j(n) { + let e, t, r, a; return { c() { - e = element$8("div"), r = element$8("table"), n = element$8("tbody"); - for (let b = 0; b < u.length; b += 1) - u[b].c(); - attr$9(n, "class", "svelte-usqupg"), attr$9(r, "class", "file-preview svelte-usqupg"), attr$9(e, "class", "file-preview-holder svelte-usqupg"), set_style$4(e, "max-height", typeof /*height*/ - t[2] === void 0 ? "auto" : ( - /*height*/ - t[2] + "px" - )); + e = svg_element$4("svg"), t = svg_element$4("path"), r = svg_element$4("polyline"), a = svg_element$4("line"), this.h(); + }, + l(l) { + e = claim_svg_element$4(l, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var d = children$g(e); + t = claim_svg_element$4(d, "path", { d: !0 }), children$g(t).forEach(detach$j), r = claim_svg_element$4(d, "polyline", { points: !0 }), children$g(r).forEach(detach$j), a = claim_svg_element$4(d, "line", { x1: !0, y1: !0, x2: !0, y2: !0 }), children$g(a).forEach(detach$j), d.forEach(detach$j), this.h(); }, - m(b, h) { - insert$b(b, e, h), append$9(e, r), append$9(r, n); - for (let _ = 0; _ < u.length; _ += 1) - u[_] && u[_].m(n, null); - }, - p(b, [h]) { - if (h & /*selectable, dispatch, Array, value, window, i18n*/ - 27) { - f = ensure_array_like$3(Array.isArray( - /*value*/ - b[0] - ) ? ( - /*value*/ - b[0] - ) : [ - /*value*/ - b[0] - ]); - let _; - for (_ = 0; _ < f.length; _ += 1) { - const E = get_each_context$3(b, f, _); - u[_] ? u[_].p(E, h) : (u[_] = create_each_block$3(E), u[_].c(), u[_].m(n, null)); - } - for (; _ < u.length; _ += 1) - u[_].d(1); - u.length = f.length; - } - h & /*height*/ - 4 && set_style$4(e, "max-height", typeof /*height*/ - b[2] === void 0 ? "auto" : ( - /*height*/ - b[2] + "px" - )); + h() { + attr$f(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), attr$f(r, "points", "17 8 12 3 7 8"), attr$f(a, "x1", "12"), attr$f(a, "y1", "3"), attr$f(a, "x2", "12"), attr$f(a, "y2", "15"), attr$f(e, "xmlns", "http://www.w3.org/2000/svg"), attr$f(e, "width", "90%"), attr$f(e, "height", "90%"), attr$f(e, "viewBox", "0 0 24 24"), attr$f(e, "fill", "none"), attr$f(e, "stroke", "currentColor"), attr$f(e, "stroke-width", "2"), attr$f(e, "stroke-linecap", "round"), attr$f(e, "stroke-linejoin", "round"), attr$f(e, "class", "feather feather-upload"); }, - i: noop$7, - o: noop$7, - d(b) { - b && detach$b(e), destroy_each$3(u, b); + m(l, d) { + insert_hydration$j(l, e, d), append_hydration$e(e, t), append_hydration$e(e, r), append_hydration$e(e, a); + }, + p: noop$a, + i: noop$a, + o: noop$a, + d(l) { + l && detach$j(e); } }; } -function instance$a(t, e, r) { - const n = createEventDispatcher$4(); - let { value: f } = e, { selectable: u = !1 } = e, { height: b = void 0 } = e, { i18n: h } = e; - const _ = (E, c) => n("select", { value: E.orig_name, index: c }); - return t.$$set = (E) => { - "value" in E && r(0, f = E.value), "selectable" in E && r(1, u = E.selectable), "height" in E && r(2, b = E.height), "i18n" in E && r(3, h = E.i18n); - }, [f, u, b, h, n, _]; +let Upload$1 = class extends SvelteComponent$j { + constructor(e) { + super(), init$j(this, e, null, create_fragment$j, safe_not_equal$k, {}); + } +}; +class SourceLocation { + // The + prefix indicates that these fields aren't writeable + // Lexer holding the input string. + // Start offset, zero-based inclusive. + // End offset, zero-based exclusive. + constructor(e, t, r) { + this.lexer = void 0, this.start = void 0, this.end = void 0, this.lexer = e, this.start = t, this.end = r; + } + /** + * Merges two `SourceLocation`s from location providers, given they are + * provided in order of appearance. + * - Returns the first one's location if only the first is provided. + * - Returns a merged range of the first and the last if both are provided + * and their lexers match. + * - Otherwise, returns null. + */ + static range(e, t) { + return t ? !e || !e.loc || !t.loc || e.loc.lexer !== t.loc.lexer ? null : new SourceLocation(e.loc.lexer, e.loc.start, t.loc.end) : e && e.loc; + } +} +class Token { + // don't expand the token + // used in \noexpand + constructor(e, t) { + this.text = void 0, this.loc = void 0, this.noexpand = void 0, this.treatAsRelax = void 0, this.text = e, this.loc = t; + } + /** + * Given a pair of tokens (this and endToken), compute a `Token` encompassing + * the whole input range enclosed by these two. + */ + range(e, t) { + return new Token(t, SourceLocation.range(this, e)); + } +} +class ParseError { + // Error start position based on passed-in Token or ParseNode. + // Length of affected text based on passed-in Token or ParseNode. + // The underlying error message without any context added. + constructor(e, t) { + this.name = void 0, this.position = void 0, this.length = void 0, this.rawMessage = void 0; + var r = "KaTeX parse error: " + e, a, l, d = t && t.loc; + if (d && d.start <= d.end) { + var o = d.lexer.input; + a = d.start, l = d.end, a === o.length ? r += " at end of input: " : r += " at position " + (a + 1) + ": "; + var u = o.slice(a, l).replace(/[^]/g, "$&̲"), p; + a > 15 ? p = "…" + o.slice(a - 15, a) : p = o.slice(0, a); + var m; + l + 15 < o.length ? m = o.slice(l, l + 15) + "…" : m = o.slice(l), r += p + u + m; + } + var y = new Error(r); + return y.name = "ParseError", y.__proto__ = ParseError.prototype, y.position = a, a != null && l != null && (y.length = l - a), y.rawMessage = e, y; + } +} +ParseError.prototype.__proto__ = Error.prototype; +var contains = function(e, t) { + return e.indexOf(t) !== -1; +}, deflt = function(e, t) { + return e === void 0 ? t : e; +}, uppercase = /([A-Z])/g, hyphenate = function(e) { + return e.replace(uppercase, "-$1").toLowerCase(); +}, ESCAPE_LOOKUP = { + "&": "&", + ">": ">", + "<": "<", + '"': """, + "'": "'" +}, ESCAPE_REGEX = /[&><"']/g; +function escape$2(n) { + return String(n).replace(ESCAPE_REGEX, (e) => ESCAPE_LOOKUP[e]); +} +var getBaseElem = function n(e) { + return e.type === "ordgroup" || e.type === "color" ? e.body.length === 1 ? n(e.body[0]) : e : e.type === "font" ? n(e.body) : e; +}, isCharacterBox = function(e) { + var t = getBaseElem(e); + return t.type === "mathord" || t.type === "textord" || t.type === "atom"; +}, assert = function(e) { + if (!e) + throw new Error("Expected non-null, but got " + String(e)); + return e; +}, protocolFromUrl = function(e) { + var t = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e); + return t ? t[2] !== ":" || !/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1]) ? null : t[1].toLowerCase() : "_relative"; +}, utils = { + contains, + deflt, + escape: escape$2, + hyphenate, + getBaseElem, + isCharacterBox, + protocolFromUrl +}; +class Style { + constructor(e, t, r) { + this.id = void 0, this.size = void 0, this.cramped = void 0, this.id = e, this.size = t, this.cramped = r; + } + /** + * Get the style of a superscript given a base in the current style. + */ + sup() { + return styles[sup[this.id]]; + } + /** + * Get the style of a subscript given a base in the current style. + */ + sub() { + return styles[sub[this.id]]; + } + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ + fracNum() { + return styles[fracNum[this.id]]; + } + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ + fracDen() { + return styles[fracDen[this.id]]; + } + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + cramp() { + return styles[cramp[this.id]]; + } + /** + * Get a text or display version of this style. + */ + text() { + return styles[text$1$1[this.id]]; + } + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + isTight() { + return this.size >= 2; + } } -class FilePreview extends SvelteComponent$b { +var D = 0, Dc = 1, T = 2, Tc = 3, S = 4, Sc = 5, SS = 6, SSc = 7, styles = [new Style(D, 0, !1), new Style(Dc, 0, !0), new Style(T, 1, !1), new Style(Tc, 1, !0), new Style(S, 2, !1), new Style(Sc, 2, !0), new Style(SS, 3, !1), new Style(SSc, 3, !0)], sup = [S, Sc, S, Sc, SS, SSc, SS, SSc], sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc], fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc], fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc], cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc], text$1$1 = [D, Dc, T, Tc, T, Tc, T, Tc], Style$1 = { + DISPLAY: styles[D], + TEXT: styles[T], + SCRIPT: styles[S], + SCRIPTSCRIPT: styles[SS] +}, scriptData = [{ + // Latin characters beyond the Latin-1 characters we have metrics for. + // Needed for Czech, Hungarian and Turkish text, for example. + name: "latin", + blocks: [ + [256, 591], + // Latin Extended-A and Latin Extended-B + [768, 879] + // Combining Diacritical marks + ] +}, { + // The Cyrillic script used by Russian and related languages. + // A Cyrillic subset used to be supported as explicitly defined + // symbols in symbols.js + name: "cyrillic", + blocks: [[1024, 1279]] +}, { + // Armenian + name: "armenian", + blocks: [[1328, 1423]] +}, { + // The Brahmic scripts of South and Southeast Asia + // Devanagari (0900–097F) + // Bengali (0980–09FF) + // Gurmukhi (0A00–0A7F) + // Gujarati (0A80–0AFF) + // Oriya (0B00–0B7F) + // Tamil (0B80–0BFF) + // Telugu (0C00–0C7F) + // Kannada (0C80–0CFF) + // Malayalam (0D00–0D7F) + // Sinhala (0D80–0DFF) + // Thai (0E00–0E7F) + // Lao (0E80–0EFF) + // Tibetan (0F00–0FFF) + // Myanmar (1000–109F) + name: "brahmic", + blocks: [[2304, 4255]] +}, { + name: "georgian", + blocks: [[4256, 4351]] +}, { + // Chinese and Japanese. + // The "k" in cjk is for Korean, but we've separated Korean out + name: "cjk", + blocks: [ + [12288, 12543], + // CJK symbols and punctuation, Hiragana, Katakana + [19968, 40879], + // CJK ideograms + [65280, 65376] + // Fullwidth punctuation + // TODO: add halfwidth Katakana and Romanji glyphs + ] +}, { + // Korean + name: "hangul", + blocks: [[44032, 55215]] +}]; +function scriptFromCodepoint(n) { + for (var e = 0; e < scriptData.length; e++) + for (var t = scriptData[e], r = 0; r < t.blocks.length; r++) { + var a = t.blocks[r]; + if (n >= a[0] && n <= a[1]) + return t.name; + } + return null; +} +var allBlocks = []; +scriptData.forEach((n) => n.blocks.forEach((e) => allBlocks.push(...e))); +function supportedCodepoint(n) { + for (var e = 0; e < allBlocks.length; e += 2) + if (n >= allBlocks[e] && n <= allBlocks[e + 1]) + return !0; + return !1; +} +var hLinePad = 80, sqrtMain = function(e, t) { + return "M95," + (622 + e + t) + ` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l` + e / 2.075 + " -" + e + ` +c5.3,-9.3,12,-14,20,-14 +H400000v` + (40 + e) + `H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M` + (834 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, sqrtSize1 = function(e, t) { + return "M263," + (601 + e + t) + `c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l` + e / 2.084 + " -" + e + ` +c4.7,-7.3,11,-11,19,-11 +H40000v` + (40 + e) + `H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, sqrtSize2 = function(e, t) { + return "M983 " + (10 + e + t) + ` +l` + e / 3.13 + " -" + e + ` +c4,-6.7,10,-10,18,-10 H400000v` + (40 + e) + ` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, sqrtSize3 = function(e, t) { + return "M424," + (2398 + e + t) + ` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l` + e / 4.223 + " -" + e + `c4,-6.7,10,-10,18,-10 H400000 +v` + (40 + e) + `H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M` + (1001 + e) + " " + t + ` +h400000v` + (40 + e) + "h-400000z"; +}, sqrtSize4 = function(e, t) { + return "M473," + (2713 + e + t) + ` +c339.3,-1799.3,509.3,-2700,510,-2702 l` + e / 5.298 + " -" + e + ` +c3.3,-7.3,9.3,-11,18,-11 H400000v` + (40 + e) + `H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "H1017.7z"; +}, phasePath = function(e) { + var t = e / 2; + return "M400000 " + e + " H0 L" + t + " 0 l65 45 L145 " + (e - 80) + " H400000z"; +}, sqrtTall = function(e, t, r) { + var a = r - 54 - t - e; + return "M702 " + (e + t) + "H400000" + (40 + e) + ` +H742v` + a + `l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 ` + t + "H400000v" + (40 + e) + "H742z"; +}, sqrtPath = function(e, t, r) { + t = 1e3 * t; + var a = ""; + switch (e) { + case "sqrtMain": + a = sqrtMain(t, hLinePad); + break; + case "sqrtSize1": + a = sqrtSize1(t, hLinePad); + break; + case "sqrtSize2": + a = sqrtSize2(t, hLinePad); + break; + case "sqrtSize3": + a = sqrtSize3(t, hLinePad); + break; + case "sqrtSize4": + a = sqrtSize4(t, hLinePad); + break; + case "sqrtTall": + a = sqrtTall(t, hLinePad, r); + } + return a; +}, innerPath = function(e, t) { + switch (e) { + case "⎜": + return "M291 0 H417 V" + t + " H291z M291 0 H417 V" + t + " H291z"; + case "∣": + return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z"; + case "∥": + return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z" + ("M367 0 H410 V" + t + " H367z M367 0 H410 V" + t + " H367z"); + case "⎟": + return "M457 0 H583 V" + t + " H457z M457 0 H583 V" + t + " H457z"; + case "⎢": + return "M319 0 H403 V" + t + " H319z M319 0 H403 V" + t + " H319z"; + case "⎥": + return "M263 0 H347 V" + t + " H263z M263 0 H347 V" + t + " H263z"; + case "⎪": + return "M384 0 H504 V" + t + " H384z M384 0 H504 V" + t + " H384z"; + case "⏐": + return "M312 0 H355 V" + t + " H312z M312 0 H355 V" + t + " H312z"; + case "‖": + return "M257 0 H300 V" + t + " H257z M257 0 H300 V" + t + " H257z" + ("M478 0 H521 V" + t + " H478z M478 0 H521 V" + t + " H478z"); + default: + return ""; + } +}, path = { + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: `M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`, + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: `M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`, + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`, + leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, + // overgroup is from the MnSymbol package (public domain) + leftgroup: `M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`, + leftgroupunder: `M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`, + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, + leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`, + leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, + leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`, + leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`, + leftmapsto: `M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`, + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, + longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`, + midbrace: `M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, + midbraceunder: `M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, + oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, + oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`, + oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, + oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, + rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`, + rightbrace: `M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, + rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, + rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`, + rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, + rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`, + rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, + rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, + rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`, + righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, + rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, + rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: `M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, + twoheadrightarrow: `M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`, + // ditto tilde2, tilde3, & tilde4 + tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`, + tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`, + tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`, + // vec is from glyph U+20D7 in font KaTeX Main + vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`, + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, + // ditto widehat2, widehat3, & widehat4 + widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + // widecheck paths are all inverted versions of widehat + widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, + widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + // The next ten paths support reaction arrows from the mhchem package. + // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX + // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main + baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, + // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main + rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, + // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. + // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em + baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, + rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, + shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, + shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` +}, tallDelim = function(e, t) { + switch (e) { + case "lbrack": + return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v` + t + " v1759 h84z"; + case "rbrack": + return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v` + t + " v1759 h84z"; + case "vert": + return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + " v585 h43z"; + case "doublevert": + return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + ` v585 h43z +M367 15 v585 v` + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v` + t + " v585 h43z"; + case "lfloor": + return "M319 602 V0 H403 V602 v" + t + ` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v` + t + " v1715 H319z"; + case "rfloor": + return "M319 602 V0 H403 V602 v" + t + ` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v` + t + " v1715 H319z"; + case "lceil": + return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v602 h84z +M403 1759 V0 H319 V1759 v` + t + " v602 h84z"; + case "rceil": + return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v602 h84z +M347 1759 V0 h-84 V1759 v` + t + " v602 h84z"; + case "lparen": + return `M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,` + (t + 84) + `c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-` + (t + 92) + `c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`; + case "rparen": + return `M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,` + (t + 9) + ` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-` + (t + 144) + `c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`; + default: + throw new Error("Unknown stretchy delimiter."); + } +}; +class DocumentFragment { + // HtmlDomNode + // Never used; needed for satisfying interface. constructor(e) { - super(), init$b(this, e, instance$a, create_fragment$b, safe_not_equal$c, { - value: 0, - selectable: 1, - height: 2, - i18n: 3 - }); + this.children = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.children = e, this.classes = [], this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = {}; + } + hasClass(e) { + return utils.contains(this.classes, e); + } + /** Convert the fragment into a node. */ + toNode() { + for (var e = document.createDocumentFragment(), t = 0; t < this.children.length; t++) + e.appendChild(this.children[t].toNode()); + return e; + } + /** Convert the fragment into HTML markup. */ + toMarkup() { + for (var e = "", t = 0; t < this.children.length; t++) + e += this.children[t].toMarkup(); + return e; + } + /** + * Converts the math node into a string, similar to innerText. Applies to + * MathDomNode's only. + */ + toText() { + var e = (t) => t.toText(); + return this.children.map(e).join(""); } } -var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; -function getDefaultExportFromCjs(t) { - return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; +var fontMetricsData = { + "AMS-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.68889, 0, 0, 0.72222], + 66: [0, 0.68889, 0, 0, 0.66667], + 67: [0, 0.68889, 0, 0, 0.72222], + 68: [0, 0.68889, 0, 0, 0.72222], + 69: [0, 0.68889, 0, 0, 0.66667], + 70: [0, 0.68889, 0, 0, 0.61111], + 71: [0, 0.68889, 0, 0, 0.77778], + 72: [0, 0.68889, 0, 0, 0.77778], + 73: [0, 0.68889, 0, 0, 0.38889], + 74: [0.16667, 0.68889, 0, 0, 0.5], + 75: [0, 0.68889, 0, 0, 0.77778], + 76: [0, 0.68889, 0, 0, 0.66667], + 77: [0, 0.68889, 0, 0, 0.94445], + 78: [0, 0.68889, 0, 0, 0.72222], + 79: [0.16667, 0.68889, 0, 0, 0.77778], + 80: [0, 0.68889, 0, 0, 0.61111], + 81: [0.16667, 0.68889, 0, 0, 0.77778], + 82: [0, 0.68889, 0, 0, 0.72222], + 83: [0, 0.68889, 0, 0, 0.55556], + 84: [0, 0.68889, 0, 0, 0.66667], + 85: [0, 0.68889, 0, 0, 0.72222], + 86: [0, 0.68889, 0, 0, 0.72222], + 87: [0, 0.68889, 0, 0, 1], + 88: [0, 0.68889, 0, 0, 0.72222], + 89: [0, 0.68889, 0, 0, 0.72222], + 90: [0, 0.68889, 0, 0, 0.66667], + 107: [0, 0.68889, 0, 0, 0.55556], + 160: [0, 0, 0, 0, 0.25], + 165: [0, 0.675, 0.025, 0, 0.75], + 174: [0.15559, 0.69224, 0, 0, 0.94666], + 240: [0, 0.68889, 0, 0, 0.55556], + 295: [0, 0.68889, 0, 0, 0.54028], + 710: [0, 0.825, 0, 0, 2.33334], + 732: [0, 0.9, 0, 0, 2.33334], + 770: [0, 0.825, 0, 0, 2.33334], + 771: [0, 0.9, 0, 0, 2.33334], + 989: [0.08167, 0.58167, 0, 0, 0.77778], + 1008: [0, 0.43056, 0.04028, 0, 0.66667], + 8245: [0, 0.54986, 0, 0, 0.275], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8487: [0, 0.68889, 0, 0, 0.72222], + 8498: [0, 0.68889, 0, 0, 0.55556], + 8502: [0, 0.68889, 0, 0, 0.66667], + 8503: [0, 0.68889, 0, 0, 0.44445], + 8504: [0, 0.68889, 0, 0, 0.66667], + 8513: [0, 0.68889, 0, 0, 0.63889], + 8592: [-0.03598, 0.46402, 0, 0, 0.5], + 8594: [-0.03598, 0.46402, 0, 0, 0.5], + 8602: [-0.13313, 0.36687, 0, 0, 1], + 8603: [-0.13313, 0.36687, 0, 0, 1], + 8606: [0.01354, 0.52239, 0, 0, 1], + 8608: [0.01354, 0.52239, 0, 0, 1], + 8610: [0.01354, 0.52239, 0, 0, 1.11111], + 8611: [0.01354, 0.52239, 0, 0, 1.11111], + 8619: [0, 0.54986, 0, 0, 1], + 8620: [0, 0.54986, 0, 0, 1], + 8621: [-0.13313, 0.37788, 0, 0, 1.38889], + 8622: [-0.13313, 0.36687, 0, 0, 1], + 8624: [0, 0.69224, 0, 0, 0.5], + 8625: [0, 0.69224, 0, 0, 0.5], + 8630: [0, 0.43056, 0, 0, 1], + 8631: [0, 0.43056, 0, 0, 1], + 8634: [0.08198, 0.58198, 0, 0, 0.77778], + 8635: [0.08198, 0.58198, 0, 0, 0.77778], + 8638: [0.19444, 0.69224, 0, 0, 0.41667], + 8639: [0.19444, 0.69224, 0, 0, 0.41667], + 8642: [0.19444, 0.69224, 0, 0, 0.41667], + 8643: [0.19444, 0.69224, 0, 0, 0.41667], + 8644: [0.1808, 0.675, 0, 0, 1], + 8646: [0.1808, 0.675, 0, 0, 1], + 8647: [0.1808, 0.675, 0, 0, 1], + 8648: [0.19444, 0.69224, 0, 0, 0.83334], + 8649: [0.1808, 0.675, 0, 0, 1], + 8650: [0.19444, 0.69224, 0, 0, 0.83334], + 8651: [0.01354, 0.52239, 0, 0, 1], + 8652: [0.01354, 0.52239, 0, 0, 1], + 8653: [-0.13313, 0.36687, 0, 0, 1], + 8654: [-0.13313, 0.36687, 0, 0, 1], + 8655: [-0.13313, 0.36687, 0, 0, 1], + 8666: [0.13667, 0.63667, 0, 0, 1], + 8667: [0.13667, 0.63667, 0, 0, 1], + 8669: [-0.13313, 0.37788, 0, 0, 1], + 8672: [-0.064, 0.437, 0, 0, 1.334], + 8674: [-0.064, 0.437, 0, 0, 1.334], + 8705: [0, 0.825, 0, 0, 0.5], + 8708: [0, 0.68889, 0, 0, 0.55556], + 8709: [0.08167, 0.58167, 0, 0, 0.77778], + 8717: [0, 0.43056, 0, 0, 0.42917], + 8722: [-0.03598, 0.46402, 0, 0, 0.5], + 8724: [0.08198, 0.69224, 0, 0, 0.77778], + 8726: [0.08167, 0.58167, 0, 0, 0.77778], + 8733: [0, 0.69224, 0, 0, 0.77778], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8737: [0, 0.69224, 0, 0, 0.72222], + 8738: [0.03517, 0.52239, 0, 0, 0.72222], + 8739: [0.08167, 0.58167, 0, 0, 0.22222], + 8740: [0.25142, 0.74111, 0, 0, 0.27778], + 8741: [0.08167, 0.58167, 0, 0, 0.38889], + 8742: [0.25142, 0.74111, 0, 0, 0.5], + 8756: [0, 0.69224, 0, 0, 0.66667], + 8757: [0, 0.69224, 0, 0, 0.66667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8765: [-0.13313, 0.37788, 0, 0, 0.77778], + 8769: [-0.13313, 0.36687, 0, 0, 0.77778], + 8770: [-0.03625, 0.46375, 0, 0, 0.77778], + 8774: [0.30274, 0.79383, 0, 0, 0.77778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8778: [0.08167, 0.58167, 0, 0, 0.77778], + 8782: [0.06062, 0.54986, 0, 0, 0.77778], + 8783: [0.06062, 0.54986, 0, 0, 0.77778], + 8785: [0.08198, 0.58198, 0, 0, 0.77778], + 8786: [0.08198, 0.58198, 0, 0, 0.77778], + 8787: [0.08198, 0.58198, 0, 0, 0.77778], + 8790: [0, 0.69224, 0, 0, 0.77778], + 8791: [0.22958, 0.72958, 0, 0, 0.77778], + 8796: [0.08198, 0.91667, 0, 0, 0.77778], + 8806: [0.25583, 0.75583, 0, 0, 0.77778], + 8807: [0.25583, 0.75583, 0, 0, 0.77778], + 8808: [0.25142, 0.75726, 0, 0, 0.77778], + 8809: [0.25142, 0.75726, 0, 0, 0.77778], + 8812: [0.25583, 0.75583, 0, 0, 0.5], + 8814: [0.20576, 0.70576, 0, 0, 0.77778], + 8815: [0.20576, 0.70576, 0, 0, 0.77778], + 8816: [0.30274, 0.79383, 0, 0, 0.77778], + 8817: [0.30274, 0.79383, 0, 0, 0.77778], + 8818: [0.22958, 0.72958, 0, 0, 0.77778], + 8819: [0.22958, 0.72958, 0, 0, 0.77778], + 8822: [0.1808, 0.675, 0, 0, 0.77778], + 8823: [0.1808, 0.675, 0, 0, 0.77778], + 8828: [0.13667, 0.63667, 0, 0, 0.77778], + 8829: [0.13667, 0.63667, 0, 0, 0.77778], + 8830: [0.22958, 0.72958, 0, 0, 0.77778], + 8831: [0.22958, 0.72958, 0, 0, 0.77778], + 8832: [0.20576, 0.70576, 0, 0, 0.77778], + 8833: [0.20576, 0.70576, 0, 0, 0.77778], + 8840: [0.30274, 0.79383, 0, 0, 0.77778], + 8841: [0.30274, 0.79383, 0, 0, 0.77778], + 8842: [0.13597, 0.63597, 0, 0, 0.77778], + 8843: [0.13597, 0.63597, 0, 0, 0.77778], + 8847: [0.03517, 0.54986, 0, 0, 0.77778], + 8848: [0.03517, 0.54986, 0, 0, 0.77778], + 8858: [0.08198, 0.58198, 0, 0, 0.77778], + 8859: [0.08198, 0.58198, 0, 0, 0.77778], + 8861: [0.08198, 0.58198, 0, 0, 0.77778], + 8862: [0, 0.675, 0, 0, 0.77778], + 8863: [0, 0.675, 0, 0, 0.77778], + 8864: [0, 0.675, 0, 0, 0.77778], + 8865: [0, 0.675, 0, 0, 0.77778], + 8872: [0, 0.69224, 0, 0, 0.61111], + 8873: [0, 0.69224, 0, 0, 0.72222], + 8874: [0, 0.69224, 0, 0, 0.88889], + 8876: [0, 0.68889, 0, 0, 0.61111], + 8877: [0, 0.68889, 0, 0, 0.61111], + 8878: [0, 0.68889, 0, 0, 0.72222], + 8879: [0, 0.68889, 0, 0, 0.72222], + 8882: [0.03517, 0.54986, 0, 0, 0.77778], + 8883: [0.03517, 0.54986, 0, 0, 0.77778], + 8884: [0.13667, 0.63667, 0, 0, 0.77778], + 8885: [0.13667, 0.63667, 0, 0, 0.77778], + 8888: [0, 0.54986, 0, 0, 1.11111], + 8890: [0.19444, 0.43056, 0, 0, 0.55556], + 8891: [0.19444, 0.69224, 0, 0, 0.61111], + 8892: [0.19444, 0.69224, 0, 0, 0.61111], + 8901: [0, 0.54986, 0, 0, 0.27778], + 8903: [0.08167, 0.58167, 0, 0, 0.77778], + 8905: [0.08167, 0.58167, 0, 0, 0.77778], + 8906: [0.08167, 0.58167, 0, 0, 0.77778], + 8907: [0, 0.69224, 0, 0, 0.77778], + 8908: [0, 0.69224, 0, 0, 0.77778], + 8909: [-0.03598, 0.46402, 0, 0, 0.77778], + 8910: [0, 0.54986, 0, 0, 0.76042], + 8911: [0, 0.54986, 0, 0, 0.76042], + 8912: [0.03517, 0.54986, 0, 0, 0.77778], + 8913: [0.03517, 0.54986, 0, 0, 0.77778], + 8914: [0, 0.54986, 0, 0, 0.66667], + 8915: [0, 0.54986, 0, 0, 0.66667], + 8916: [0, 0.69224, 0, 0, 0.66667], + 8918: [0.0391, 0.5391, 0, 0, 0.77778], + 8919: [0.0391, 0.5391, 0, 0, 0.77778], + 8920: [0.03517, 0.54986, 0, 0, 1.33334], + 8921: [0.03517, 0.54986, 0, 0, 1.33334], + 8922: [0.38569, 0.88569, 0, 0, 0.77778], + 8923: [0.38569, 0.88569, 0, 0, 0.77778], + 8926: [0.13667, 0.63667, 0, 0, 0.77778], + 8927: [0.13667, 0.63667, 0, 0, 0.77778], + 8928: [0.30274, 0.79383, 0, 0, 0.77778], + 8929: [0.30274, 0.79383, 0, 0, 0.77778], + 8934: [0.23222, 0.74111, 0, 0, 0.77778], + 8935: [0.23222, 0.74111, 0, 0, 0.77778], + 8936: [0.23222, 0.74111, 0, 0, 0.77778], + 8937: [0.23222, 0.74111, 0, 0, 0.77778], + 8938: [0.20576, 0.70576, 0, 0, 0.77778], + 8939: [0.20576, 0.70576, 0, 0, 0.77778], + 8940: [0.30274, 0.79383, 0, 0, 0.77778], + 8941: [0.30274, 0.79383, 0, 0, 0.77778], + 8994: [0.19444, 0.69224, 0, 0, 0.77778], + 8995: [0.19444, 0.69224, 0, 0, 0.77778], + 9416: [0.15559, 0.69224, 0, 0, 0.90222], + 9484: [0, 0.69224, 0, 0, 0.5], + 9488: [0, 0.69224, 0, 0, 0.5], + 9492: [0, 0.37788, 0, 0, 0.5], + 9496: [0, 0.37788, 0, 0, 0.5], + 9585: [0.19444, 0.68889, 0, 0, 0.88889], + 9586: [0.19444, 0.74111, 0, 0, 0.88889], + 9632: [0, 0.675, 0, 0, 0.77778], + 9633: [0, 0.675, 0, 0, 0.77778], + 9650: [0, 0.54986, 0, 0, 0.72222], + 9651: [0, 0.54986, 0, 0, 0.72222], + 9654: [0.03517, 0.54986, 0, 0, 0.77778], + 9660: [0, 0.54986, 0, 0, 0.72222], + 9661: [0, 0.54986, 0, 0, 0.72222], + 9664: [0.03517, 0.54986, 0, 0, 0.77778], + 9674: [0.11111, 0.69224, 0, 0, 0.66667], + 9733: [0.19444, 0.69224, 0, 0, 0.94445], + 10003: [0, 0.69224, 0, 0, 0.83334], + 10016: [0, 0.69224, 0, 0, 0.83334], + 10731: [0.11111, 0.69224, 0, 0, 0.66667], + 10846: [0.19444, 0.75583, 0, 0, 0.61111], + 10877: [0.13667, 0.63667, 0, 0, 0.77778], + 10878: [0.13667, 0.63667, 0, 0, 0.77778], + 10885: [0.25583, 0.75583, 0, 0, 0.77778], + 10886: [0.25583, 0.75583, 0, 0, 0.77778], + 10887: [0.13597, 0.63597, 0, 0, 0.77778], + 10888: [0.13597, 0.63597, 0, 0, 0.77778], + 10889: [0.26167, 0.75726, 0, 0, 0.77778], + 10890: [0.26167, 0.75726, 0, 0, 0.77778], + 10891: [0.48256, 0.98256, 0, 0, 0.77778], + 10892: [0.48256, 0.98256, 0, 0, 0.77778], + 10901: [0.13667, 0.63667, 0, 0, 0.77778], + 10902: [0.13667, 0.63667, 0, 0, 0.77778], + 10933: [0.25142, 0.75726, 0, 0, 0.77778], + 10934: [0.25142, 0.75726, 0, 0, 0.77778], + 10935: [0.26167, 0.75726, 0, 0, 0.77778], + 10936: [0.26167, 0.75726, 0, 0, 0.77778], + 10937: [0.26167, 0.75726, 0, 0, 0.77778], + 10938: [0.26167, 0.75726, 0, 0, 0.77778], + 10949: [0.25583, 0.75583, 0, 0, 0.77778], + 10950: [0.25583, 0.75583, 0, 0, 0.77778], + 10955: [0.28481, 0.79383, 0, 0, 0.77778], + 10956: [0.28481, 0.79383, 0, 0, 0.77778], + 57350: [0.08167, 0.58167, 0, 0, 0.22222], + 57351: [0.08167, 0.58167, 0, 0, 0.38889], + 57352: [0.08167, 0.58167, 0, 0, 0.77778], + 57353: [0, 0.43056, 0.04028, 0, 0.66667], + 57356: [0.25142, 0.75726, 0, 0, 0.77778], + 57357: [0.25142, 0.75726, 0, 0, 0.77778], + 57358: [0.41951, 0.91951, 0, 0, 0.77778], + 57359: [0.30274, 0.79383, 0, 0, 0.77778], + 57360: [0.30274, 0.79383, 0, 0, 0.77778], + 57361: [0.41951, 0.91951, 0, 0, 0.77778], + 57366: [0.25142, 0.75726, 0, 0, 0.77778], + 57367: [0.25142, 0.75726, 0, 0, 0.77778], + 57368: [0.25142, 0.75726, 0, 0, 0.77778], + 57369: [0.25142, 0.75726, 0, 0, 0.77778], + 57370: [0.13597, 0.63597, 0, 0, 0.77778], + 57371: [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Caligraphic-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.68333, 0, 0.19445, 0.79847], + 66: [0, 0.68333, 0.03041, 0.13889, 0.65681], + 67: [0, 0.68333, 0.05834, 0.13889, 0.52653], + 68: [0, 0.68333, 0.02778, 0.08334, 0.77139], + 69: [0, 0.68333, 0.08944, 0.11111, 0.52778], + 70: [0, 0.68333, 0.09931, 0.11111, 0.71875], + 71: [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], + 72: [0, 0.68333, 965e-5, 0.11111, 0.84452], + 73: [0, 0.68333, 0.07382, 0, 0.54452], + 74: [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], + 75: [0, 0.68333, 0.01445, 0.05556, 0.76195], + 76: [0, 0.68333, 0, 0.13889, 0.68972], + 77: [0, 0.68333, 0, 0.13889, 1.2009], + 78: [0, 0.68333, 0.14736, 0.08334, 0.82049], + 79: [0, 0.68333, 0.02778, 0.11111, 0.79611], + 80: [0, 0.68333, 0.08222, 0.08334, 0.69556], + 81: [0.09722, 0.68333, 0, 0.11111, 0.81667], + 82: [0, 0.68333, 0, 0.08334, 0.8475], + 83: [0, 0.68333, 0.075, 0.13889, 0.60556], + 84: [0, 0.68333, 0.25417, 0, 0.54464], + 85: [0, 0.68333, 0.09931, 0.08334, 0.62583], + 86: [0, 0.68333, 0.08222, 0, 0.61278], + 87: [0, 0.68333, 0.08222, 0.08334, 0.98778], + 88: [0, 0.68333, 0.14643, 0.13889, 0.7133], + 89: [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], + 90: [0, 0.68333, 0.07944, 0.13889, 0.72473], + 160: [0, 0, 0, 0, 0.25] + }, + "Fraktur-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69141, 0, 0, 0.29574], + 34: [0, 0.69141, 0, 0, 0.21471], + 38: [0, 0.69141, 0, 0, 0.73786], + 39: [0, 0.69141, 0, 0, 0.21201], + 40: [0.24982, 0.74947, 0, 0, 0.38865], + 41: [0.24982, 0.74947, 0, 0, 0.38865], + 42: [0, 0.62119, 0, 0, 0.27764], + 43: [0.08319, 0.58283, 0, 0, 0.75623], + 44: [0, 0.10803, 0, 0, 0.27764], + 45: [0.08319, 0.58283, 0, 0, 0.75623], + 46: [0, 0.10803, 0, 0, 0.27764], + 47: [0.24982, 0.74947, 0, 0, 0.50181], + 48: [0, 0.47534, 0, 0, 0.50181], + 49: [0, 0.47534, 0, 0, 0.50181], + 50: [0, 0.47534, 0, 0, 0.50181], + 51: [0.18906, 0.47534, 0, 0, 0.50181], + 52: [0.18906, 0.47534, 0, 0, 0.50181], + 53: [0.18906, 0.47534, 0, 0, 0.50181], + 54: [0, 0.69141, 0, 0, 0.50181], + 55: [0.18906, 0.47534, 0, 0, 0.50181], + 56: [0, 0.69141, 0, 0, 0.50181], + 57: [0.18906, 0.47534, 0, 0, 0.50181], + 58: [0, 0.47534, 0, 0, 0.21606], + 59: [0.12604, 0.47534, 0, 0, 0.21606], + 61: [-0.13099, 0.36866, 0, 0, 0.75623], + 63: [0, 0.69141, 0, 0, 0.36245], + 65: [0, 0.69141, 0, 0, 0.7176], + 66: [0, 0.69141, 0, 0, 0.88397], + 67: [0, 0.69141, 0, 0, 0.61254], + 68: [0, 0.69141, 0, 0, 0.83158], + 69: [0, 0.69141, 0, 0, 0.66278], + 70: [0.12604, 0.69141, 0, 0, 0.61119], + 71: [0, 0.69141, 0, 0, 0.78539], + 72: [0.06302, 0.69141, 0, 0, 0.7203], + 73: [0, 0.69141, 0, 0, 0.55448], + 74: [0.12604, 0.69141, 0, 0, 0.55231], + 75: [0, 0.69141, 0, 0, 0.66845], + 76: [0, 0.69141, 0, 0, 0.66602], + 77: [0, 0.69141, 0, 0, 1.04953], + 78: [0, 0.69141, 0, 0, 0.83212], + 79: [0, 0.69141, 0, 0, 0.82699], + 80: [0.18906, 0.69141, 0, 0, 0.82753], + 81: [0.03781, 0.69141, 0, 0, 0.82699], + 82: [0, 0.69141, 0, 0, 0.82807], + 83: [0, 0.69141, 0, 0, 0.82861], + 84: [0, 0.69141, 0, 0, 0.66899], + 85: [0, 0.69141, 0, 0, 0.64576], + 86: [0, 0.69141, 0, 0, 0.83131], + 87: [0, 0.69141, 0, 0, 1.04602], + 88: [0, 0.69141, 0, 0, 0.71922], + 89: [0.18906, 0.69141, 0, 0, 0.83293], + 90: [0.12604, 0.69141, 0, 0, 0.60201], + 91: [0.24982, 0.74947, 0, 0, 0.27764], + 93: [0.24982, 0.74947, 0, 0, 0.27764], + 94: [0, 0.69141, 0, 0, 0.49965], + 97: [0, 0.47534, 0, 0, 0.50046], + 98: [0, 0.69141, 0, 0, 0.51315], + 99: [0, 0.47534, 0, 0, 0.38946], + 100: [0, 0.62119, 0, 0, 0.49857], + 101: [0, 0.47534, 0, 0, 0.40053], + 102: [0.18906, 0.69141, 0, 0, 0.32626], + 103: [0.18906, 0.47534, 0, 0, 0.5037], + 104: [0.18906, 0.69141, 0, 0, 0.52126], + 105: [0, 0.69141, 0, 0, 0.27899], + 106: [0, 0.69141, 0, 0, 0.28088], + 107: [0, 0.69141, 0, 0, 0.38946], + 108: [0, 0.69141, 0, 0, 0.27953], + 109: [0, 0.47534, 0, 0, 0.76676], + 110: [0, 0.47534, 0, 0, 0.52666], + 111: [0, 0.47534, 0, 0, 0.48885], + 112: [0.18906, 0.52396, 0, 0, 0.50046], + 113: [0.18906, 0.47534, 0, 0, 0.48912], + 114: [0, 0.47534, 0, 0, 0.38919], + 115: [0, 0.47534, 0, 0, 0.44266], + 116: [0, 0.62119, 0, 0, 0.33301], + 117: [0, 0.47534, 0, 0, 0.5172], + 118: [0, 0.52396, 0, 0, 0.5118], + 119: [0, 0.52396, 0, 0, 0.77351], + 120: [0.18906, 0.47534, 0, 0, 0.38865], + 121: [0.18906, 0.47534, 0, 0, 0.49884], + 122: [0.18906, 0.47534, 0, 0, 0.39054], + 160: [0, 0, 0, 0, 0.25], + 8216: [0, 0.69141, 0, 0, 0.21471], + 8217: [0, 0.69141, 0, 0, 0.21471], + 58112: [0, 0.62119, 0, 0, 0.49749], + 58113: [0, 0.62119, 0, 0, 0.4983], + 58114: [0.18906, 0.69141, 0, 0, 0.33328], + 58115: [0.18906, 0.69141, 0, 0, 0.32923], + 58116: [0.18906, 0.47534, 0, 0, 0.50343], + 58117: [0, 0.69141, 0, 0, 0.33301], + 58118: [0, 0.62119, 0, 0, 0.33409], + 58119: [0, 0.47534, 0, 0, 0.50073] + }, + "Main-Bold": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.35], + 34: [0, 0.69444, 0, 0, 0.60278], + 35: [0.19444, 0.69444, 0, 0, 0.95833], + 36: [0.05556, 0.75, 0, 0, 0.575], + 37: [0.05556, 0.75, 0, 0, 0.95833], + 38: [0, 0.69444, 0, 0, 0.89444], + 39: [0, 0.69444, 0, 0, 0.31944], + 40: [0.25, 0.75, 0, 0, 0.44722], + 41: [0.25, 0.75, 0, 0, 0.44722], + 42: [0, 0.75, 0, 0, 0.575], + 43: [0.13333, 0.63333, 0, 0, 0.89444], + 44: [0.19444, 0.15556, 0, 0, 0.31944], + 45: [0, 0.44444, 0, 0, 0.38333], + 46: [0, 0.15556, 0, 0, 0.31944], + 47: [0.25, 0.75, 0, 0, 0.575], + 48: [0, 0.64444, 0, 0, 0.575], + 49: [0, 0.64444, 0, 0, 0.575], + 50: [0, 0.64444, 0, 0, 0.575], + 51: [0, 0.64444, 0, 0, 0.575], + 52: [0, 0.64444, 0, 0, 0.575], + 53: [0, 0.64444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0, 0.64444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0, 0.64444, 0, 0, 0.575], + 58: [0, 0.44444, 0, 0, 0.31944], + 59: [0.19444, 0.44444, 0, 0, 0.31944], + 60: [0.08556, 0.58556, 0, 0, 0.89444], + 61: [-0.10889, 0.39111, 0, 0, 0.89444], + 62: [0.08556, 0.58556, 0, 0, 0.89444], + 63: [0, 0.69444, 0, 0, 0.54305], + 64: [0, 0.69444, 0, 0, 0.89444], + 65: [0, 0.68611, 0, 0, 0.86944], + 66: [0, 0.68611, 0, 0, 0.81805], + 67: [0, 0.68611, 0, 0, 0.83055], + 68: [0, 0.68611, 0, 0, 0.88194], + 69: [0, 0.68611, 0, 0, 0.75555], + 70: [0, 0.68611, 0, 0, 0.72361], + 71: [0, 0.68611, 0, 0, 0.90416], + 72: [0, 0.68611, 0, 0, 0.9], + 73: [0, 0.68611, 0, 0, 0.43611], + 74: [0, 0.68611, 0, 0, 0.59444], + 75: [0, 0.68611, 0, 0, 0.90138], + 76: [0, 0.68611, 0, 0, 0.69166], + 77: [0, 0.68611, 0, 0, 1.09166], + 78: [0, 0.68611, 0, 0, 0.9], + 79: [0, 0.68611, 0, 0, 0.86388], + 80: [0, 0.68611, 0, 0, 0.78611], + 81: [0.19444, 0.68611, 0, 0, 0.86388], + 82: [0, 0.68611, 0, 0, 0.8625], + 83: [0, 0.68611, 0, 0, 0.63889], + 84: [0, 0.68611, 0, 0, 0.8], + 85: [0, 0.68611, 0, 0, 0.88472], + 86: [0, 0.68611, 0.01597, 0, 0.86944], + 87: [0, 0.68611, 0.01597, 0, 1.18888], + 88: [0, 0.68611, 0, 0, 0.86944], + 89: [0, 0.68611, 0.02875, 0, 0.86944], + 90: [0, 0.68611, 0, 0, 0.70277], + 91: [0.25, 0.75, 0, 0, 0.31944], + 92: [0.25, 0.75, 0, 0, 0.575], + 93: [0.25, 0.75, 0, 0, 0.31944], + 94: [0, 0.69444, 0, 0, 0.575], + 95: [0.31, 0.13444, 0.03194, 0, 0.575], + 97: [0, 0.44444, 0, 0, 0.55902], + 98: [0, 0.69444, 0, 0, 0.63889], + 99: [0, 0.44444, 0, 0, 0.51111], + 100: [0, 0.69444, 0, 0, 0.63889], + 101: [0, 0.44444, 0, 0, 0.52708], + 102: [0, 0.69444, 0.10903, 0, 0.35139], + 103: [0.19444, 0.44444, 0.01597, 0, 0.575], + 104: [0, 0.69444, 0, 0, 0.63889], + 105: [0, 0.69444, 0, 0, 0.31944], + 106: [0.19444, 0.69444, 0, 0, 0.35139], + 107: [0, 0.69444, 0, 0, 0.60694], + 108: [0, 0.69444, 0, 0, 0.31944], + 109: [0, 0.44444, 0, 0, 0.95833], + 110: [0, 0.44444, 0, 0, 0.63889], + 111: [0, 0.44444, 0, 0, 0.575], + 112: [0.19444, 0.44444, 0, 0, 0.63889], + 113: [0.19444, 0.44444, 0, 0, 0.60694], + 114: [0, 0.44444, 0, 0, 0.47361], + 115: [0, 0.44444, 0, 0, 0.45361], + 116: [0, 0.63492, 0, 0, 0.44722], + 117: [0, 0.44444, 0, 0, 0.63889], + 118: [0, 0.44444, 0.01597, 0, 0.60694], + 119: [0, 0.44444, 0.01597, 0, 0.83055], + 120: [0, 0.44444, 0, 0, 0.60694], + 121: [0.19444, 0.44444, 0.01597, 0, 0.60694], + 122: [0, 0.44444, 0, 0, 0.51111], + 123: [0.25, 0.75, 0, 0, 0.575], + 124: [0.25, 0.75, 0, 0, 0.31944], + 125: [0.25, 0.75, 0, 0, 0.575], + 126: [0.35, 0.34444, 0, 0, 0.575], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.86853], + 168: [0, 0.69444, 0, 0, 0.575], + 172: [0, 0.44444, 0, 0, 0.76666], + 176: [0, 0.69444, 0, 0, 0.86944], + 177: [0.13333, 0.63333, 0, 0, 0.89444], + 184: [0.17014, 0, 0, 0, 0.51111], + 198: [0, 0.68611, 0, 0, 1.04166], + 215: [0.13333, 0.63333, 0, 0, 0.89444], + 216: [0.04861, 0.73472, 0, 0, 0.89444], + 223: [0, 0.69444, 0, 0, 0.59722], + 230: [0, 0.44444, 0, 0, 0.83055], + 247: [0.13333, 0.63333, 0, 0, 0.89444], + 248: [0.09722, 0.54167, 0, 0, 0.575], + 305: [0, 0.44444, 0, 0, 0.31944], + 338: [0, 0.68611, 0, 0, 1.16944], + 339: [0, 0.44444, 0, 0, 0.89444], + 567: [0.19444, 0.44444, 0, 0, 0.35139], + 710: [0, 0.69444, 0, 0, 0.575], + 711: [0, 0.63194, 0, 0, 0.575], + 713: [0, 0.59611, 0, 0, 0.575], + 714: [0, 0.69444, 0, 0, 0.575], + 715: [0, 0.69444, 0, 0, 0.575], + 728: [0, 0.69444, 0, 0, 0.575], + 729: [0, 0.69444, 0, 0, 0.31944], + 730: [0, 0.69444, 0, 0, 0.86944], + 732: [0, 0.69444, 0, 0, 0.575], + 733: [0, 0.69444, 0, 0, 0.575], + 915: [0, 0.68611, 0, 0, 0.69166], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0, 0, 0.89444], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0, 0, 0.76666], + 928: [0, 0.68611, 0, 0, 0.9], + 931: [0, 0.68611, 0, 0, 0.83055], + 933: [0, 0.68611, 0, 0, 0.89444], + 934: [0, 0.68611, 0, 0, 0.83055], + 936: [0, 0.68611, 0, 0, 0.89444], + 937: [0, 0.68611, 0, 0, 0.83055], + 8211: [0, 0.44444, 0.03194, 0, 0.575], + 8212: [0, 0.44444, 0.03194, 0, 1.14999], + 8216: [0, 0.69444, 0, 0, 0.31944], + 8217: [0, 0.69444, 0, 0, 0.31944], + 8220: [0, 0.69444, 0, 0, 0.60278], + 8221: [0, 0.69444, 0, 0, 0.60278], + 8224: [0.19444, 0.69444, 0, 0, 0.51111], + 8225: [0.19444, 0.69444, 0, 0, 0.51111], + 8242: [0, 0.55556, 0, 0, 0.34444], + 8407: [0, 0.72444, 0.15486, 0, 0.575], + 8463: [0, 0.69444, 0, 0, 0.66759], + 8465: [0, 0.69444, 0, 0, 0.83055], + 8467: [0, 0.69444, 0, 0, 0.47361], + 8472: [0.19444, 0.44444, 0, 0, 0.74027], + 8476: [0, 0.69444, 0, 0, 0.83055], + 8501: [0, 0.69444, 0, 0, 0.70277], + 8592: [-0.10889, 0.39111, 0, 0, 1.14999], + 8593: [0.19444, 0.69444, 0, 0, 0.575], + 8594: [-0.10889, 0.39111, 0, 0, 1.14999], + 8595: [0.19444, 0.69444, 0, 0, 0.575], + 8596: [-0.10889, 0.39111, 0, 0, 1.14999], + 8597: [0.25, 0.75, 0, 0, 0.575], + 8598: [0.19444, 0.69444, 0, 0, 1.14999], + 8599: [0.19444, 0.69444, 0, 0, 1.14999], + 8600: [0.19444, 0.69444, 0, 0, 1.14999], + 8601: [0.19444, 0.69444, 0, 0, 1.14999], + 8636: [-0.10889, 0.39111, 0, 0, 1.14999], + 8637: [-0.10889, 0.39111, 0, 0, 1.14999], + 8640: [-0.10889, 0.39111, 0, 0, 1.14999], + 8641: [-0.10889, 0.39111, 0, 0, 1.14999], + 8656: [-0.10889, 0.39111, 0, 0, 1.14999], + 8657: [0.19444, 0.69444, 0, 0, 0.70277], + 8658: [-0.10889, 0.39111, 0, 0, 1.14999], + 8659: [0.19444, 0.69444, 0, 0, 0.70277], + 8660: [-0.10889, 0.39111, 0, 0, 1.14999], + 8661: [0.25, 0.75, 0, 0, 0.70277], + 8704: [0, 0.69444, 0, 0, 0.63889], + 8706: [0, 0.69444, 0.06389, 0, 0.62847], + 8707: [0, 0.69444, 0, 0, 0.63889], + 8709: [0.05556, 0.75, 0, 0, 0.575], + 8711: [0, 0.68611, 0, 0, 0.95833], + 8712: [0.08556, 0.58556, 0, 0, 0.76666], + 8715: [0.08556, 0.58556, 0, 0, 0.76666], + 8722: [0.13333, 0.63333, 0, 0, 0.89444], + 8723: [0.13333, 0.63333, 0, 0, 0.89444], + 8725: [0.25, 0.75, 0, 0, 0.575], + 8726: [0.25, 0.75, 0, 0, 0.575], + 8727: [-0.02778, 0.47222, 0, 0, 0.575], + 8728: [-0.02639, 0.47361, 0, 0, 0.575], + 8729: [-0.02639, 0.47361, 0, 0, 0.575], + 8730: [0.18, 0.82, 0, 0, 0.95833], + 8733: [0, 0.44444, 0, 0, 0.89444], + 8734: [0, 0.44444, 0, 0, 1.14999], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.31944], + 8741: [0.25, 0.75, 0, 0, 0.575], + 8743: [0, 0.55556, 0, 0, 0.76666], + 8744: [0, 0.55556, 0, 0, 0.76666], + 8745: [0, 0.55556, 0, 0, 0.76666], + 8746: [0, 0.55556, 0, 0, 0.76666], + 8747: [0.19444, 0.69444, 0.12778, 0, 0.56875], + 8764: [-0.10889, 0.39111, 0, 0, 0.89444], + 8768: [0.19444, 0.69444, 0, 0, 0.31944], + 8771: [222e-5, 0.50222, 0, 0, 0.89444], + 8773: [0.027, 0.638, 0, 0, 0.894], + 8776: [0.02444, 0.52444, 0, 0, 0.89444], + 8781: [222e-5, 0.50222, 0, 0, 0.89444], + 8801: [222e-5, 0.50222, 0, 0, 0.89444], + 8804: [0.19667, 0.69667, 0, 0, 0.89444], + 8805: [0.19667, 0.69667, 0, 0, 0.89444], + 8810: [0.08556, 0.58556, 0, 0, 1.14999], + 8811: [0.08556, 0.58556, 0, 0, 1.14999], + 8826: [0.08556, 0.58556, 0, 0, 0.89444], + 8827: [0.08556, 0.58556, 0, 0, 0.89444], + 8834: [0.08556, 0.58556, 0, 0, 0.89444], + 8835: [0.08556, 0.58556, 0, 0, 0.89444], + 8838: [0.19667, 0.69667, 0, 0, 0.89444], + 8839: [0.19667, 0.69667, 0, 0, 0.89444], + 8846: [0, 0.55556, 0, 0, 0.76666], + 8849: [0.19667, 0.69667, 0, 0, 0.89444], + 8850: [0.19667, 0.69667, 0, 0, 0.89444], + 8851: [0, 0.55556, 0, 0, 0.76666], + 8852: [0, 0.55556, 0, 0, 0.76666], + 8853: [0.13333, 0.63333, 0, 0, 0.89444], + 8854: [0.13333, 0.63333, 0, 0, 0.89444], + 8855: [0.13333, 0.63333, 0, 0, 0.89444], + 8856: [0.13333, 0.63333, 0, 0, 0.89444], + 8857: [0.13333, 0.63333, 0, 0, 0.89444], + 8866: [0, 0.69444, 0, 0, 0.70277], + 8867: [0, 0.69444, 0, 0, 0.70277], + 8868: [0, 0.69444, 0, 0, 0.89444], + 8869: [0, 0.69444, 0, 0, 0.89444], + 8900: [-0.02639, 0.47361, 0, 0, 0.575], + 8901: [-0.02639, 0.47361, 0, 0, 0.31944], + 8902: [-0.02778, 0.47222, 0, 0, 0.575], + 8968: [0.25, 0.75, 0, 0, 0.51111], + 8969: [0.25, 0.75, 0, 0, 0.51111], + 8970: [0.25, 0.75, 0, 0, 0.51111], + 8971: [0.25, 0.75, 0, 0, 0.51111], + 8994: [-0.13889, 0.36111, 0, 0, 1.14999], + 8995: [-0.13889, 0.36111, 0, 0, 1.14999], + 9651: [0.19444, 0.69444, 0, 0, 1.02222], + 9657: [-0.02778, 0.47222, 0, 0, 0.575], + 9661: [0.19444, 0.69444, 0, 0, 1.02222], + 9667: [-0.02778, 0.47222, 0, 0, 0.575], + 9711: [0.19444, 0.69444, 0, 0, 1.14999], + 9824: [0.12963, 0.69444, 0, 0, 0.89444], + 9825: [0.12963, 0.69444, 0, 0, 0.89444], + 9826: [0.12963, 0.69444, 0, 0, 0.89444], + 9827: [0.12963, 0.69444, 0, 0, 0.89444], + 9837: [0, 0.75, 0, 0, 0.44722], + 9838: [0.19444, 0.69444, 0, 0, 0.44722], + 9839: [0.19444, 0.69444, 0, 0, 0.44722], + 10216: [0.25, 0.75, 0, 0, 0.44722], + 10217: [0.25, 0.75, 0, 0, 0.44722], + 10815: [0, 0.68611, 0, 0, 0.9], + 10927: [0.19667, 0.69667, 0, 0, 0.89444], + 10928: [0.19667, 0.69667, 0, 0, 0.89444], + 57376: [0.19444, 0.69444, 0, 0, 0] + }, + "Main-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.11417, 0, 0.38611], + 34: [0, 0.69444, 0.07939, 0, 0.62055], + 35: [0.19444, 0.69444, 0.06833, 0, 0.94444], + 37: [0.05556, 0.75, 0.12861, 0, 0.94444], + 38: [0, 0.69444, 0.08528, 0, 0.88555], + 39: [0, 0.69444, 0.12945, 0, 0.35555], + 40: [0.25, 0.75, 0.15806, 0, 0.47333], + 41: [0.25, 0.75, 0.03306, 0, 0.47333], + 42: [0, 0.75, 0.14333, 0, 0.59111], + 43: [0.10333, 0.60333, 0.03306, 0, 0.88555], + 44: [0.19444, 0.14722, 0, 0, 0.35555], + 45: [0, 0.44444, 0.02611, 0, 0.41444], + 46: [0, 0.14722, 0, 0, 0.35555], + 47: [0.25, 0.75, 0.15806, 0, 0.59111], + 48: [0, 0.64444, 0.13167, 0, 0.59111], + 49: [0, 0.64444, 0.13167, 0, 0.59111], + 50: [0, 0.64444, 0.13167, 0, 0.59111], + 51: [0, 0.64444, 0.13167, 0, 0.59111], + 52: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 53: [0, 0.64444, 0.13167, 0, 0.59111], + 54: [0, 0.64444, 0.13167, 0, 0.59111], + 55: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 56: [0, 0.64444, 0.13167, 0, 0.59111], + 57: [0, 0.64444, 0.13167, 0, 0.59111], + 58: [0, 0.44444, 0.06695, 0, 0.35555], + 59: [0.19444, 0.44444, 0.06695, 0, 0.35555], + 61: [-0.10889, 0.39111, 0.06833, 0, 0.88555], + 63: [0, 0.69444, 0.11472, 0, 0.59111], + 64: [0, 0.69444, 0.09208, 0, 0.88555], + 65: [0, 0.68611, 0, 0, 0.86555], + 66: [0, 0.68611, 0.0992, 0, 0.81666], + 67: [0, 0.68611, 0.14208, 0, 0.82666], + 68: [0, 0.68611, 0.09062, 0, 0.87555], + 69: [0, 0.68611, 0.11431, 0, 0.75666], + 70: [0, 0.68611, 0.12903, 0, 0.72722], + 71: [0, 0.68611, 0.07347, 0, 0.89527], + 72: [0, 0.68611, 0.17208, 0, 0.8961], + 73: [0, 0.68611, 0.15681, 0, 0.47166], + 74: [0, 0.68611, 0.145, 0, 0.61055], + 75: [0, 0.68611, 0.14208, 0, 0.89499], + 76: [0, 0.68611, 0, 0, 0.69777], + 77: [0, 0.68611, 0.17208, 0, 1.07277], + 78: [0, 0.68611, 0.17208, 0, 0.8961], + 79: [0, 0.68611, 0.09062, 0, 0.85499], + 80: [0, 0.68611, 0.0992, 0, 0.78721], + 81: [0.19444, 0.68611, 0.09062, 0, 0.85499], + 82: [0, 0.68611, 0.02559, 0, 0.85944], + 83: [0, 0.68611, 0.11264, 0, 0.64999], + 84: [0, 0.68611, 0.12903, 0, 0.7961], + 85: [0, 0.68611, 0.17208, 0, 0.88083], + 86: [0, 0.68611, 0.18625, 0, 0.86555], + 87: [0, 0.68611, 0.18625, 0, 1.15999], + 88: [0, 0.68611, 0.15681, 0, 0.86555], + 89: [0, 0.68611, 0.19803, 0, 0.86555], + 90: [0, 0.68611, 0.14208, 0, 0.70888], + 91: [0.25, 0.75, 0.1875, 0, 0.35611], + 93: [0.25, 0.75, 0.09972, 0, 0.35611], + 94: [0, 0.69444, 0.06709, 0, 0.59111], + 95: [0.31, 0.13444, 0.09811, 0, 0.59111], + 97: [0, 0.44444, 0.09426, 0, 0.59111], + 98: [0, 0.69444, 0.07861, 0, 0.53222], + 99: [0, 0.44444, 0.05222, 0, 0.53222], + 100: [0, 0.69444, 0.10861, 0, 0.59111], + 101: [0, 0.44444, 0.085, 0, 0.53222], + 102: [0.19444, 0.69444, 0.21778, 0, 0.4], + 103: [0.19444, 0.44444, 0.105, 0, 0.53222], + 104: [0, 0.69444, 0.09426, 0, 0.59111], + 105: [0, 0.69326, 0.11387, 0, 0.35555], + 106: [0.19444, 0.69326, 0.1672, 0, 0.35555], + 107: [0, 0.69444, 0.11111, 0, 0.53222], + 108: [0, 0.69444, 0.10861, 0, 0.29666], + 109: [0, 0.44444, 0.09426, 0, 0.94444], + 110: [0, 0.44444, 0.09426, 0, 0.64999], + 111: [0, 0.44444, 0.07861, 0, 0.59111], + 112: [0.19444, 0.44444, 0.07861, 0, 0.59111], + 113: [0.19444, 0.44444, 0.105, 0, 0.53222], + 114: [0, 0.44444, 0.11111, 0, 0.50167], + 115: [0, 0.44444, 0.08167, 0, 0.48694], + 116: [0, 0.63492, 0.09639, 0, 0.385], + 117: [0, 0.44444, 0.09426, 0, 0.62055], + 118: [0, 0.44444, 0.11111, 0, 0.53222], + 119: [0, 0.44444, 0.11111, 0, 0.76777], + 120: [0, 0.44444, 0.12583, 0, 0.56055], + 121: [0.19444, 0.44444, 0.105, 0, 0.56166], + 122: [0, 0.44444, 0.13889, 0, 0.49055], + 126: [0.35, 0.34444, 0.11472, 0, 0.59111], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0.11473, 0, 0.59111], + 176: [0, 0.69444, 0, 0, 0.94888], + 184: [0.17014, 0, 0, 0, 0.53222], + 198: [0, 0.68611, 0.11431, 0, 1.02277], + 216: [0.04861, 0.73472, 0.09062, 0, 0.88555], + 223: [0.19444, 0.69444, 0.09736, 0, 0.665], + 230: [0, 0.44444, 0.085, 0, 0.82666], + 248: [0.09722, 0.54167, 0.09458, 0, 0.59111], + 305: [0, 0.44444, 0.09426, 0, 0.35555], + 338: [0, 0.68611, 0.11431, 0, 1.14054], + 339: [0, 0.44444, 0.085, 0, 0.82666], + 567: [0.19444, 0.44444, 0.04611, 0, 0.385], + 710: [0, 0.69444, 0.06709, 0, 0.59111], + 711: [0, 0.63194, 0.08271, 0, 0.59111], + 713: [0, 0.59444, 0.10444, 0, 0.59111], + 714: [0, 0.69444, 0.08528, 0, 0.59111], + 715: [0, 0.69444, 0, 0, 0.59111], + 728: [0, 0.69444, 0.10333, 0, 0.59111], + 729: [0, 0.69444, 0.12945, 0, 0.35555], + 730: [0, 0.69444, 0, 0, 0.94888], + 732: [0, 0.69444, 0.11472, 0, 0.59111], + 733: [0, 0.69444, 0.11472, 0, 0.59111], + 915: [0, 0.68611, 0.12903, 0, 0.69777], + 916: [0, 0.68611, 0, 0, 0.94444], + 920: [0, 0.68611, 0.09062, 0, 0.88555], + 923: [0, 0.68611, 0, 0, 0.80666], + 926: [0, 0.68611, 0.15092, 0, 0.76777], + 928: [0, 0.68611, 0.17208, 0, 0.8961], + 931: [0, 0.68611, 0.11431, 0, 0.82666], + 933: [0, 0.68611, 0.10778, 0, 0.88555], + 934: [0, 0.68611, 0.05632, 0, 0.82666], + 936: [0, 0.68611, 0.10778, 0, 0.88555], + 937: [0, 0.68611, 0.0992, 0, 0.82666], + 8211: [0, 0.44444, 0.09811, 0, 0.59111], + 8212: [0, 0.44444, 0.09811, 0, 1.18221], + 8216: [0, 0.69444, 0.12945, 0, 0.35555], + 8217: [0, 0.69444, 0.12945, 0, 0.35555], + 8220: [0, 0.69444, 0.16772, 0, 0.62055], + 8221: [0, 0.69444, 0.07939, 0, 0.62055] + }, + "Main-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.12417, 0, 0.30667], + 34: [0, 0.69444, 0.06961, 0, 0.51444], + 35: [0.19444, 0.69444, 0.06616, 0, 0.81777], + 37: [0.05556, 0.75, 0.13639, 0, 0.81777], + 38: [0, 0.69444, 0.09694, 0, 0.76666], + 39: [0, 0.69444, 0.12417, 0, 0.30667], + 40: [0.25, 0.75, 0.16194, 0, 0.40889], + 41: [0.25, 0.75, 0.03694, 0, 0.40889], + 42: [0, 0.75, 0.14917, 0, 0.51111], + 43: [0.05667, 0.56167, 0.03694, 0, 0.76666], + 44: [0.19444, 0.10556, 0, 0, 0.30667], + 45: [0, 0.43056, 0.02826, 0, 0.35778], + 46: [0, 0.10556, 0, 0, 0.30667], + 47: [0.25, 0.75, 0.16194, 0, 0.51111], + 48: [0, 0.64444, 0.13556, 0, 0.51111], + 49: [0, 0.64444, 0.13556, 0, 0.51111], + 50: [0, 0.64444, 0.13556, 0, 0.51111], + 51: [0, 0.64444, 0.13556, 0, 0.51111], + 52: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 53: [0, 0.64444, 0.13556, 0, 0.51111], + 54: [0, 0.64444, 0.13556, 0, 0.51111], + 55: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 56: [0, 0.64444, 0.13556, 0, 0.51111], + 57: [0, 0.64444, 0.13556, 0, 0.51111], + 58: [0, 0.43056, 0.0582, 0, 0.30667], + 59: [0.19444, 0.43056, 0.0582, 0, 0.30667], + 61: [-0.13313, 0.36687, 0.06616, 0, 0.76666], + 63: [0, 0.69444, 0.1225, 0, 0.51111], + 64: [0, 0.69444, 0.09597, 0, 0.76666], + 65: [0, 0.68333, 0, 0, 0.74333], + 66: [0, 0.68333, 0.10257, 0, 0.70389], + 67: [0, 0.68333, 0.14528, 0, 0.71555], + 68: [0, 0.68333, 0.09403, 0, 0.755], + 69: [0, 0.68333, 0.12028, 0, 0.67833], + 70: [0, 0.68333, 0.13305, 0, 0.65277], + 71: [0, 0.68333, 0.08722, 0, 0.77361], + 72: [0, 0.68333, 0.16389, 0, 0.74333], + 73: [0, 0.68333, 0.15806, 0, 0.38555], + 74: [0, 0.68333, 0.14028, 0, 0.525], + 75: [0, 0.68333, 0.14528, 0, 0.76888], + 76: [0, 0.68333, 0, 0, 0.62722], + 77: [0, 0.68333, 0.16389, 0, 0.89666], + 78: [0, 0.68333, 0.16389, 0, 0.74333], + 79: [0, 0.68333, 0.09403, 0, 0.76666], + 80: [0, 0.68333, 0.10257, 0, 0.67833], + 81: [0.19444, 0.68333, 0.09403, 0, 0.76666], + 82: [0, 0.68333, 0.03868, 0, 0.72944], + 83: [0, 0.68333, 0.11972, 0, 0.56222], + 84: [0, 0.68333, 0.13305, 0, 0.71555], + 85: [0, 0.68333, 0.16389, 0, 0.74333], + 86: [0, 0.68333, 0.18361, 0, 0.74333], + 87: [0, 0.68333, 0.18361, 0, 0.99888], + 88: [0, 0.68333, 0.15806, 0, 0.74333], + 89: [0, 0.68333, 0.19383, 0, 0.74333], + 90: [0, 0.68333, 0.14528, 0, 0.61333], + 91: [0.25, 0.75, 0.1875, 0, 0.30667], + 93: [0.25, 0.75, 0.10528, 0, 0.30667], + 94: [0, 0.69444, 0.06646, 0, 0.51111], + 95: [0.31, 0.12056, 0.09208, 0, 0.51111], + 97: [0, 0.43056, 0.07671, 0, 0.51111], + 98: [0, 0.69444, 0.06312, 0, 0.46], + 99: [0, 0.43056, 0.05653, 0, 0.46], + 100: [0, 0.69444, 0.10333, 0, 0.51111], + 101: [0, 0.43056, 0.07514, 0, 0.46], + 102: [0.19444, 0.69444, 0.21194, 0, 0.30667], + 103: [0.19444, 0.43056, 0.08847, 0, 0.46], + 104: [0, 0.69444, 0.07671, 0, 0.51111], + 105: [0, 0.65536, 0.1019, 0, 0.30667], + 106: [0.19444, 0.65536, 0.14467, 0, 0.30667], + 107: [0, 0.69444, 0.10764, 0, 0.46], + 108: [0, 0.69444, 0.10333, 0, 0.25555], + 109: [0, 0.43056, 0.07671, 0, 0.81777], + 110: [0, 0.43056, 0.07671, 0, 0.56222], + 111: [0, 0.43056, 0.06312, 0, 0.51111], + 112: [0.19444, 0.43056, 0.06312, 0, 0.51111], + 113: [0.19444, 0.43056, 0.08847, 0, 0.46], + 114: [0, 0.43056, 0.10764, 0, 0.42166], + 115: [0, 0.43056, 0.08208, 0, 0.40889], + 116: [0, 0.61508, 0.09486, 0, 0.33222], + 117: [0, 0.43056, 0.07671, 0, 0.53666], + 118: [0, 0.43056, 0.10764, 0, 0.46], + 119: [0, 0.43056, 0.10764, 0, 0.66444], + 120: [0, 0.43056, 0.12042, 0, 0.46389], + 121: [0.19444, 0.43056, 0.08847, 0, 0.48555], + 122: [0, 0.43056, 0.12292, 0, 0.40889], + 126: [0.35, 0.31786, 0.11585, 0, 0.51111], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.66786, 0.10474, 0, 0.51111], + 176: [0, 0.69444, 0, 0, 0.83129], + 184: [0.17014, 0, 0, 0, 0.46], + 198: [0, 0.68333, 0.12028, 0, 0.88277], + 216: [0.04861, 0.73194, 0.09403, 0, 0.76666], + 223: [0.19444, 0.69444, 0.10514, 0, 0.53666], + 230: [0, 0.43056, 0.07514, 0, 0.71555], + 248: [0.09722, 0.52778, 0.09194, 0, 0.51111], + 338: [0, 0.68333, 0.12028, 0, 0.98499], + 339: [0, 0.43056, 0.07514, 0, 0.71555], + 710: [0, 0.69444, 0.06646, 0, 0.51111], + 711: [0, 0.62847, 0.08295, 0, 0.51111], + 713: [0, 0.56167, 0.10333, 0, 0.51111], + 714: [0, 0.69444, 0.09694, 0, 0.51111], + 715: [0, 0.69444, 0, 0, 0.51111], + 728: [0, 0.69444, 0.10806, 0, 0.51111], + 729: [0, 0.66786, 0.11752, 0, 0.30667], + 730: [0, 0.69444, 0, 0, 0.83129], + 732: [0, 0.66786, 0.11585, 0, 0.51111], + 733: [0, 0.69444, 0.1225, 0, 0.51111], + 915: [0, 0.68333, 0.13305, 0, 0.62722], + 916: [0, 0.68333, 0, 0, 0.81777], + 920: [0, 0.68333, 0.09403, 0, 0.76666], + 923: [0, 0.68333, 0, 0, 0.69222], + 926: [0, 0.68333, 0.15294, 0, 0.66444], + 928: [0, 0.68333, 0.16389, 0, 0.74333], + 931: [0, 0.68333, 0.12028, 0, 0.71555], + 933: [0, 0.68333, 0.11111, 0, 0.76666], + 934: [0, 0.68333, 0.05986, 0, 0.71555], + 936: [0, 0.68333, 0.11111, 0, 0.76666], + 937: [0, 0.68333, 0.10257, 0, 0.71555], + 8211: [0, 0.43056, 0.09208, 0, 0.51111], + 8212: [0, 0.43056, 0.09208, 0, 1.02222], + 8216: [0, 0.69444, 0.12417, 0, 0.30667], + 8217: [0, 0.69444, 0.12417, 0, 0.30667], + 8220: [0, 0.69444, 0.1685, 0, 0.51444], + 8221: [0, 0.69444, 0.06961, 0, 0.51444], + 8463: [0, 0.68889, 0, 0, 0.54028] + }, + "Main-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.27778], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.77778], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 44: [0.19444, 0.10556, 0, 0, 0.27778], + 45: [0, 0.43056, 0, 0, 0.33333], + 46: [0, 0.10556, 0, 0, 0.27778], + 47: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.64444, 0, 0, 0.5], + 49: [0, 0.64444, 0, 0, 0.5], + 50: [0, 0.64444, 0, 0, 0.5], + 51: [0, 0.64444, 0, 0, 0.5], + 52: [0, 0.64444, 0, 0, 0.5], + 53: [0, 0.64444, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0, 0.64444, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0, 0.64444, 0, 0, 0.5], + 58: [0, 0.43056, 0, 0, 0.27778], + 59: [0.19444, 0.43056, 0, 0, 0.27778], + 60: [0.0391, 0.5391, 0, 0, 0.77778], + 61: [-0.13313, 0.36687, 0, 0, 0.77778], + 62: [0.0391, 0.5391, 0, 0, 0.77778], + 63: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.77778], + 65: [0, 0.68333, 0, 0, 0.75], + 66: [0, 0.68333, 0, 0, 0.70834], + 67: [0, 0.68333, 0, 0, 0.72222], + 68: [0, 0.68333, 0, 0, 0.76389], + 69: [0, 0.68333, 0, 0, 0.68056], + 70: [0, 0.68333, 0, 0, 0.65278], + 71: [0, 0.68333, 0, 0, 0.78472], + 72: [0, 0.68333, 0, 0, 0.75], + 73: [0, 0.68333, 0, 0, 0.36111], + 74: [0, 0.68333, 0, 0, 0.51389], + 75: [0, 0.68333, 0, 0, 0.77778], + 76: [0, 0.68333, 0, 0, 0.625], + 77: [0, 0.68333, 0, 0, 0.91667], + 78: [0, 0.68333, 0, 0, 0.75], + 79: [0, 0.68333, 0, 0, 0.77778], + 80: [0, 0.68333, 0, 0, 0.68056], + 81: [0.19444, 0.68333, 0, 0, 0.77778], + 82: [0, 0.68333, 0, 0, 0.73611], + 83: [0, 0.68333, 0, 0, 0.55556], + 84: [0, 0.68333, 0, 0, 0.72222], + 85: [0, 0.68333, 0, 0, 0.75], + 86: [0, 0.68333, 0.01389, 0, 0.75], + 87: [0, 0.68333, 0.01389, 0, 1.02778], + 88: [0, 0.68333, 0, 0, 0.75], + 89: [0, 0.68333, 0.025, 0, 0.75], + 90: [0, 0.68333, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.27778], + 92: [0.25, 0.75, 0, 0, 0.5], + 93: [0.25, 0.75, 0, 0, 0.27778], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.31, 0.12056, 0.02778, 0, 0.5], + 97: [0, 0.43056, 0, 0, 0.5], + 98: [0, 0.69444, 0, 0, 0.55556], + 99: [0, 0.43056, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.55556], + 101: [0, 0.43056, 0, 0, 0.44445], + 102: [0, 0.69444, 0.07778, 0, 0.30556], + 103: [0.19444, 0.43056, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.55556], + 105: [0, 0.66786, 0, 0, 0.27778], + 106: [0.19444, 0.66786, 0, 0, 0.30556], + 107: [0, 0.69444, 0, 0, 0.52778], + 108: [0, 0.69444, 0, 0, 0.27778], + 109: [0, 0.43056, 0, 0, 0.83334], + 110: [0, 0.43056, 0, 0, 0.55556], + 111: [0, 0.43056, 0, 0, 0.5], + 112: [0.19444, 0.43056, 0, 0, 0.55556], + 113: [0.19444, 0.43056, 0, 0, 0.52778], + 114: [0, 0.43056, 0, 0, 0.39167], + 115: [0, 0.43056, 0, 0, 0.39445], + 116: [0, 0.61508, 0, 0, 0.38889], + 117: [0, 0.43056, 0, 0, 0.55556], + 118: [0, 0.43056, 0.01389, 0, 0.52778], + 119: [0, 0.43056, 0.01389, 0, 0.72222], + 120: [0, 0.43056, 0, 0, 0.52778], + 121: [0.19444, 0.43056, 0.01389, 0, 0.52778], + 122: [0, 0.43056, 0, 0, 0.44445], + 123: [0.25, 0.75, 0, 0, 0.5], + 124: [0.25, 0.75, 0, 0, 0.27778], + 125: [0.25, 0.75, 0, 0, 0.5], + 126: [0.35, 0.31786, 0, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.76909], + 167: [0.19444, 0.69444, 0, 0, 0.44445], + 168: [0, 0.66786, 0, 0, 0.5], + 172: [0, 0.43056, 0, 0, 0.66667], + 176: [0, 0.69444, 0, 0, 0.75], + 177: [0.08333, 0.58333, 0, 0, 0.77778], + 182: [0.19444, 0.69444, 0, 0, 0.61111], + 184: [0.17014, 0, 0, 0, 0.44445], + 198: [0, 0.68333, 0, 0, 0.90278], + 215: [0.08333, 0.58333, 0, 0, 0.77778], + 216: [0.04861, 0.73194, 0, 0, 0.77778], + 223: [0, 0.69444, 0, 0, 0.5], + 230: [0, 0.43056, 0, 0, 0.72222], + 247: [0.08333, 0.58333, 0, 0, 0.77778], + 248: [0.09722, 0.52778, 0, 0, 0.5], + 305: [0, 0.43056, 0, 0, 0.27778], + 338: [0, 0.68333, 0, 0, 1.01389], + 339: [0, 0.43056, 0, 0, 0.77778], + 567: [0.19444, 0.43056, 0, 0, 0.30556], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.62847, 0, 0, 0.5], + 713: [0, 0.56778, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.66786, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.75], + 732: [0, 0.66786, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.68333, 0, 0, 0.625], + 916: [0, 0.68333, 0, 0, 0.83334], + 920: [0, 0.68333, 0, 0, 0.77778], + 923: [0, 0.68333, 0, 0, 0.69445], + 926: [0, 0.68333, 0, 0, 0.66667], + 928: [0, 0.68333, 0, 0, 0.75], + 931: [0, 0.68333, 0, 0, 0.72222], + 933: [0, 0.68333, 0, 0, 0.77778], + 934: [0, 0.68333, 0, 0, 0.72222], + 936: [0, 0.68333, 0, 0, 0.77778], + 937: [0, 0.68333, 0, 0, 0.72222], + 8211: [0, 0.43056, 0.02778, 0, 0.5], + 8212: [0, 0.43056, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5], + 8224: [0.19444, 0.69444, 0, 0, 0.44445], + 8225: [0.19444, 0.69444, 0, 0, 0.44445], + 8230: [0, 0.123, 0, 0, 1.172], + 8242: [0, 0.55556, 0, 0, 0.275], + 8407: [0, 0.71444, 0.15382, 0, 0.5], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8465: [0, 0.69444, 0, 0, 0.72222], + 8467: [0, 0.69444, 0, 0.11111, 0.41667], + 8472: [0.19444, 0.43056, 0, 0.11111, 0.63646], + 8476: [0, 0.69444, 0, 0, 0.72222], + 8501: [0, 0.69444, 0, 0, 0.61111], + 8592: [-0.13313, 0.36687, 0, 0, 1], + 8593: [0.19444, 0.69444, 0, 0, 0.5], + 8594: [-0.13313, 0.36687, 0, 0, 1], + 8595: [0.19444, 0.69444, 0, 0, 0.5], + 8596: [-0.13313, 0.36687, 0, 0, 1], + 8597: [0.25, 0.75, 0, 0, 0.5], + 8598: [0.19444, 0.69444, 0, 0, 1], + 8599: [0.19444, 0.69444, 0, 0, 1], + 8600: [0.19444, 0.69444, 0, 0, 1], + 8601: [0.19444, 0.69444, 0, 0, 1], + 8614: [0.011, 0.511, 0, 0, 1], + 8617: [0.011, 0.511, 0, 0, 1.126], + 8618: [0.011, 0.511, 0, 0, 1.126], + 8636: [-0.13313, 0.36687, 0, 0, 1], + 8637: [-0.13313, 0.36687, 0, 0, 1], + 8640: [-0.13313, 0.36687, 0, 0, 1], + 8641: [-0.13313, 0.36687, 0, 0, 1], + 8652: [0.011, 0.671, 0, 0, 1], + 8656: [-0.13313, 0.36687, 0, 0, 1], + 8657: [0.19444, 0.69444, 0, 0, 0.61111], + 8658: [-0.13313, 0.36687, 0, 0, 1], + 8659: [0.19444, 0.69444, 0, 0, 0.61111], + 8660: [-0.13313, 0.36687, 0, 0, 1], + 8661: [0.25, 0.75, 0, 0, 0.61111], + 8704: [0, 0.69444, 0, 0, 0.55556], + 8706: [0, 0.69444, 0.05556, 0.08334, 0.5309], + 8707: [0, 0.69444, 0, 0, 0.55556], + 8709: [0.05556, 0.75, 0, 0, 0.5], + 8711: [0, 0.68333, 0, 0, 0.83334], + 8712: [0.0391, 0.5391, 0, 0, 0.66667], + 8715: [0.0391, 0.5391, 0, 0, 0.66667], + 8722: [0.08333, 0.58333, 0, 0, 0.77778], + 8723: [0.08333, 0.58333, 0, 0, 0.77778], + 8725: [0.25, 0.75, 0, 0, 0.5], + 8726: [0.25, 0.75, 0, 0, 0.5], + 8727: [-0.03472, 0.46528, 0, 0, 0.5], + 8728: [-0.05555, 0.44445, 0, 0, 0.5], + 8729: [-0.05555, 0.44445, 0, 0, 0.5], + 8730: [0.2, 0.8, 0, 0, 0.83334], + 8733: [0, 0.43056, 0, 0, 0.77778], + 8734: [0, 0.43056, 0, 0, 1], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.27778], + 8741: [0.25, 0.75, 0, 0, 0.5], + 8743: [0, 0.55556, 0, 0, 0.66667], + 8744: [0, 0.55556, 0, 0, 0.66667], + 8745: [0, 0.55556, 0, 0, 0.66667], + 8746: [0, 0.55556, 0, 0, 0.66667], + 8747: [0.19444, 0.69444, 0.11111, 0, 0.41667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8768: [0.19444, 0.69444, 0, 0, 0.27778], + 8771: [-0.03625, 0.46375, 0, 0, 0.77778], + 8773: [-0.022, 0.589, 0, 0, 0.778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8781: [-0.03625, 0.46375, 0, 0, 0.77778], + 8784: [-0.133, 0.673, 0, 0, 0.778], + 8801: [-0.03625, 0.46375, 0, 0, 0.77778], + 8804: [0.13597, 0.63597, 0, 0, 0.77778], + 8805: [0.13597, 0.63597, 0, 0, 0.77778], + 8810: [0.0391, 0.5391, 0, 0, 1], + 8811: [0.0391, 0.5391, 0, 0, 1], + 8826: [0.0391, 0.5391, 0, 0, 0.77778], + 8827: [0.0391, 0.5391, 0, 0, 0.77778], + 8834: [0.0391, 0.5391, 0, 0, 0.77778], + 8835: [0.0391, 0.5391, 0, 0, 0.77778], + 8838: [0.13597, 0.63597, 0, 0, 0.77778], + 8839: [0.13597, 0.63597, 0, 0, 0.77778], + 8846: [0, 0.55556, 0, 0, 0.66667], + 8849: [0.13597, 0.63597, 0, 0, 0.77778], + 8850: [0.13597, 0.63597, 0, 0, 0.77778], + 8851: [0, 0.55556, 0, 0, 0.66667], + 8852: [0, 0.55556, 0, 0, 0.66667], + 8853: [0.08333, 0.58333, 0, 0, 0.77778], + 8854: [0.08333, 0.58333, 0, 0, 0.77778], + 8855: [0.08333, 0.58333, 0, 0, 0.77778], + 8856: [0.08333, 0.58333, 0, 0, 0.77778], + 8857: [0.08333, 0.58333, 0, 0, 0.77778], + 8866: [0, 0.69444, 0, 0, 0.61111], + 8867: [0, 0.69444, 0, 0, 0.61111], + 8868: [0, 0.69444, 0, 0, 0.77778], + 8869: [0, 0.69444, 0, 0, 0.77778], + 8872: [0.249, 0.75, 0, 0, 0.867], + 8900: [-0.05555, 0.44445, 0, 0, 0.5], + 8901: [-0.05555, 0.44445, 0, 0, 0.27778], + 8902: [-0.03472, 0.46528, 0, 0, 0.5], + 8904: [5e-3, 0.505, 0, 0, 0.9], + 8942: [0.03, 0.903, 0, 0, 0.278], + 8943: [-0.19, 0.313, 0, 0, 1.172], + 8945: [-0.1, 0.823, 0, 0, 1.282], + 8968: [0.25, 0.75, 0, 0, 0.44445], + 8969: [0.25, 0.75, 0, 0, 0.44445], + 8970: [0.25, 0.75, 0, 0, 0.44445], + 8971: [0.25, 0.75, 0, 0, 0.44445], + 8994: [-0.14236, 0.35764, 0, 0, 1], + 8995: [-0.14236, 0.35764, 0, 0, 1], + 9136: [0.244, 0.744, 0, 0, 0.412], + 9137: [0.244, 0.745, 0, 0, 0.412], + 9651: [0.19444, 0.69444, 0, 0, 0.88889], + 9657: [-0.03472, 0.46528, 0, 0, 0.5], + 9661: [0.19444, 0.69444, 0, 0, 0.88889], + 9667: [-0.03472, 0.46528, 0, 0, 0.5], + 9711: [0.19444, 0.69444, 0, 0, 1], + 9824: [0.12963, 0.69444, 0, 0, 0.77778], + 9825: [0.12963, 0.69444, 0, 0, 0.77778], + 9826: [0.12963, 0.69444, 0, 0, 0.77778], + 9827: [0.12963, 0.69444, 0, 0, 0.77778], + 9837: [0, 0.75, 0, 0, 0.38889], + 9838: [0.19444, 0.69444, 0, 0, 0.38889], + 9839: [0.19444, 0.69444, 0, 0, 0.38889], + 10216: [0.25, 0.75, 0, 0, 0.38889], + 10217: [0.25, 0.75, 0, 0, 0.38889], + 10222: [0.244, 0.744, 0, 0, 0.412], + 10223: [0.244, 0.745, 0, 0, 0.412], + 10229: [0.011, 0.511, 0, 0, 1.609], + 10230: [0.011, 0.511, 0, 0, 1.638], + 10231: [0.011, 0.511, 0, 0, 1.859], + 10232: [0.024, 0.525, 0, 0, 1.609], + 10233: [0.024, 0.525, 0, 0, 1.638], + 10234: [0.024, 0.525, 0, 0, 1.858], + 10236: [0.011, 0.511, 0, 0, 1.638], + 10815: [0, 0.68333, 0, 0, 0.75], + 10927: [0.13597, 0.63597, 0, 0, 0.77778], + 10928: [0.13597, 0.63597, 0, 0, 0.77778], + 57376: [0.19444, 0.69444, 0, 0, 0] + }, + "Math-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 48: [0, 0.44444, 0, 0, 0.575], + 49: [0, 0.44444, 0, 0, 0.575], + 50: [0, 0.44444, 0, 0, 0.575], + 51: [0.19444, 0.44444, 0, 0, 0.575], + 52: [0.19444, 0.44444, 0, 0, 0.575], + 53: [0.19444, 0.44444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0.19444, 0.44444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0.19444, 0.44444, 0, 0, 0.575], + 65: [0, 0.68611, 0, 0, 0.86944], + 66: [0, 0.68611, 0.04835, 0, 0.8664], + 67: [0, 0.68611, 0.06979, 0, 0.81694], + 68: [0, 0.68611, 0.03194, 0, 0.93812], + 69: [0, 0.68611, 0.05451, 0, 0.81007], + 70: [0, 0.68611, 0.15972, 0, 0.68889], + 71: [0, 0.68611, 0, 0, 0.88673], + 72: [0, 0.68611, 0.08229, 0, 0.98229], + 73: [0, 0.68611, 0.07778, 0, 0.51111], + 74: [0, 0.68611, 0.10069, 0, 0.63125], + 75: [0, 0.68611, 0.06979, 0, 0.97118], + 76: [0, 0.68611, 0, 0, 0.75555], + 77: [0, 0.68611, 0.11424, 0, 1.14201], + 78: [0, 0.68611, 0.11424, 0, 0.95034], + 79: [0, 0.68611, 0.03194, 0, 0.83666], + 80: [0, 0.68611, 0.15972, 0, 0.72309], + 81: [0.19444, 0.68611, 0, 0, 0.86861], + 82: [0, 0.68611, 421e-5, 0, 0.87235], + 83: [0, 0.68611, 0.05382, 0, 0.69271], + 84: [0, 0.68611, 0.15972, 0, 0.63663], + 85: [0, 0.68611, 0.11424, 0, 0.80027], + 86: [0, 0.68611, 0.25555, 0, 0.67778], + 87: [0, 0.68611, 0.15972, 0, 1.09305], + 88: [0, 0.68611, 0.07778, 0, 0.94722], + 89: [0, 0.68611, 0.25555, 0, 0.67458], + 90: [0, 0.68611, 0.06979, 0, 0.77257], + 97: [0, 0.44444, 0, 0, 0.63287], + 98: [0, 0.69444, 0, 0, 0.52083], + 99: [0, 0.44444, 0, 0, 0.51342], + 100: [0, 0.69444, 0, 0, 0.60972], + 101: [0, 0.44444, 0, 0, 0.55361], + 102: [0.19444, 0.69444, 0.11042, 0, 0.56806], + 103: [0.19444, 0.44444, 0.03704, 0, 0.5449], + 104: [0, 0.69444, 0, 0, 0.66759], + 105: [0, 0.69326, 0, 0, 0.4048], + 106: [0.19444, 0.69326, 0.0622, 0, 0.47083], + 107: [0, 0.69444, 0.01852, 0, 0.6037], + 108: [0, 0.69444, 88e-4, 0, 0.34815], + 109: [0, 0.44444, 0, 0, 1.0324], + 110: [0, 0.44444, 0, 0, 0.71296], + 111: [0, 0.44444, 0, 0, 0.58472], + 112: [0.19444, 0.44444, 0, 0, 0.60092], + 113: [0.19444, 0.44444, 0.03704, 0, 0.54213], + 114: [0, 0.44444, 0.03194, 0, 0.5287], + 115: [0, 0.44444, 0, 0, 0.53125], + 116: [0, 0.63492, 0, 0, 0.41528], + 117: [0, 0.44444, 0, 0, 0.68102], + 118: [0, 0.44444, 0.03704, 0, 0.56666], + 119: [0, 0.44444, 0.02778, 0, 0.83148], + 120: [0, 0.44444, 0, 0, 0.65903], + 121: [0.19444, 0.44444, 0.03704, 0, 0.59028], + 122: [0, 0.44444, 0.04213, 0, 0.55509], + 160: [0, 0, 0, 0, 0.25], + 915: [0, 0.68611, 0.15972, 0, 0.65694], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0.03194, 0, 0.86722], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0.07458, 0, 0.84125], + 928: [0, 0.68611, 0.08229, 0, 0.98229], + 931: [0, 0.68611, 0.05451, 0, 0.88507], + 933: [0, 0.68611, 0.15972, 0, 0.67083], + 934: [0, 0.68611, 0, 0, 0.76666], + 936: [0, 0.68611, 0.11653, 0, 0.71402], + 937: [0, 0.68611, 0.04835, 0, 0.8789], + 945: [0, 0.44444, 0, 0, 0.76064], + 946: [0.19444, 0.69444, 0.03403, 0, 0.65972], + 947: [0.19444, 0.44444, 0.06389, 0, 0.59003], + 948: [0, 0.69444, 0.03819, 0, 0.52222], + 949: [0, 0.44444, 0, 0, 0.52882], + 950: [0.19444, 0.69444, 0.06215, 0, 0.50833], + 951: [0.19444, 0.44444, 0.03704, 0, 0.6], + 952: [0, 0.69444, 0.03194, 0, 0.5618], + 953: [0, 0.44444, 0, 0, 0.41204], + 954: [0, 0.44444, 0, 0, 0.66759], + 955: [0, 0.69444, 0, 0, 0.67083], + 956: [0.19444, 0.44444, 0, 0, 0.70787], + 957: [0, 0.44444, 0.06898, 0, 0.57685], + 958: [0.19444, 0.69444, 0.03021, 0, 0.50833], + 959: [0, 0.44444, 0, 0, 0.58472], + 960: [0, 0.44444, 0.03704, 0, 0.68241], + 961: [0.19444, 0.44444, 0, 0, 0.6118], + 962: [0.09722, 0.44444, 0.07917, 0, 0.42361], + 963: [0, 0.44444, 0.03704, 0, 0.68588], + 964: [0, 0.44444, 0.13472, 0, 0.52083], + 965: [0, 0.44444, 0.03704, 0, 0.63055], + 966: [0.19444, 0.44444, 0, 0, 0.74722], + 967: [0.19444, 0.44444, 0, 0, 0.71805], + 968: [0.19444, 0.69444, 0.03704, 0, 0.75833], + 969: [0, 0.44444, 0.03704, 0, 0.71782], + 977: [0, 0.69444, 0, 0, 0.69155], + 981: [0.19444, 0.69444, 0, 0, 0.7125], + 982: [0, 0.44444, 0.03194, 0, 0.975], + 1009: [0.19444, 0.44444, 0, 0, 0.6118], + 1013: [0, 0.44444, 0, 0, 0.48333], + 57649: [0, 0.44444, 0, 0, 0.39352], + 57911: [0.19444, 0.44444, 0, 0, 0.43889] + }, + "Math-Italic": { + 32: [0, 0, 0, 0, 0.25], + 48: [0, 0.43056, 0, 0, 0.5], + 49: [0, 0.43056, 0, 0, 0.5], + 50: [0, 0.43056, 0, 0, 0.5], + 51: [0.19444, 0.43056, 0, 0, 0.5], + 52: [0.19444, 0.43056, 0, 0, 0.5], + 53: [0.19444, 0.43056, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0.19444, 0.43056, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0.19444, 0.43056, 0, 0, 0.5], + 65: [0, 0.68333, 0, 0.13889, 0.75], + 66: [0, 0.68333, 0.05017, 0.08334, 0.75851], + 67: [0, 0.68333, 0.07153, 0.08334, 0.71472], + 68: [0, 0.68333, 0.02778, 0.05556, 0.82792], + 69: [0, 0.68333, 0.05764, 0.08334, 0.7382], + 70: [0, 0.68333, 0.13889, 0.08334, 0.64306], + 71: [0, 0.68333, 0, 0.08334, 0.78625], + 72: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 73: [0, 0.68333, 0.07847, 0.11111, 0.43958], + 74: [0, 0.68333, 0.09618, 0.16667, 0.55451], + 75: [0, 0.68333, 0.07153, 0.05556, 0.84931], + 76: [0, 0.68333, 0, 0.02778, 0.68056], + 77: [0, 0.68333, 0.10903, 0.08334, 0.97014], + 78: [0, 0.68333, 0.10903, 0.08334, 0.80347], + 79: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 80: [0, 0.68333, 0.13889, 0.08334, 0.64201], + 81: [0.19444, 0.68333, 0, 0.08334, 0.79056], + 82: [0, 0.68333, 773e-5, 0.08334, 0.75929], + 83: [0, 0.68333, 0.05764, 0.08334, 0.6132], + 84: [0, 0.68333, 0.13889, 0.08334, 0.58438], + 85: [0, 0.68333, 0.10903, 0.02778, 0.68278], + 86: [0, 0.68333, 0.22222, 0, 0.58333], + 87: [0, 0.68333, 0.13889, 0, 0.94445], + 88: [0, 0.68333, 0.07847, 0.08334, 0.82847], + 89: [0, 0.68333, 0.22222, 0, 0.58056], + 90: [0, 0.68333, 0.07153, 0.08334, 0.68264], + 97: [0, 0.43056, 0, 0, 0.52859], + 98: [0, 0.69444, 0, 0, 0.42917], + 99: [0, 0.43056, 0, 0.05556, 0.43276], + 100: [0, 0.69444, 0, 0.16667, 0.52049], + 101: [0, 0.43056, 0, 0.05556, 0.46563], + 102: [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + 103: [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + 104: [0, 0.69444, 0, 0, 0.57616], + 105: [0, 0.65952, 0, 0, 0.34451], + 106: [0.19444, 0.65952, 0.05724, 0, 0.41181], + 107: [0, 0.69444, 0.03148, 0, 0.5206], + 108: [0, 0.69444, 0.01968, 0.08334, 0.29838], + 109: [0, 0.43056, 0, 0, 0.87801], + 110: [0, 0.43056, 0, 0, 0.60023], + 111: [0, 0.43056, 0, 0.05556, 0.48472], + 112: [0.19444, 0.43056, 0, 0.08334, 0.50313], + 113: [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + 114: [0, 0.43056, 0.02778, 0.05556, 0.45116], + 115: [0, 0.43056, 0, 0.05556, 0.46875], + 116: [0, 0.61508, 0, 0.08334, 0.36111], + 117: [0, 0.43056, 0, 0.02778, 0.57246], + 118: [0, 0.43056, 0.03588, 0.02778, 0.48472], + 119: [0, 0.43056, 0.02691, 0.08334, 0.71592], + 120: [0, 0.43056, 0, 0.02778, 0.57153], + 121: [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + 122: [0, 0.43056, 0.04398, 0.05556, 0.46505], + 160: [0, 0, 0, 0, 0.25], + 915: [0, 0.68333, 0.13889, 0.08334, 0.61528], + 916: [0, 0.68333, 0, 0.16667, 0.83334], + 920: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 923: [0, 0.68333, 0, 0.16667, 0.69445], + 926: [0, 0.68333, 0.07569, 0.08334, 0.74236], + 928: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 931: [0, 0.68333, 0.05764, 0.08334, 0.77986], + 933: [0, 0.68333, 0.13889, 0.05556, 0.58333], + 934: [0, 0.68333, 0, 0.08334, 0.66667], + 936: [0, 0.68333, 0.11, 0.05556, 0.61222], + 937: [0, 0.68333, 0.05017, 0.08334, 0.7724], + 945: [0, 0.43056, 37e-4, 0.02778, 0.6397], + 946: [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + 947: [0.19444, 0.43056, 0.05556, 0, 0.51773], + 948: [0, 0.69444, 0.03785, 0.05556, 0.44444], + 949: [0, 0.43056, 0, 0.08334, 0.46632], + 950: [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + 951: [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + 952: [0, 0.69444, 0.02778, 0.08334, 0.46944], + 953: [0, 0.43056, 0, 0.05556, 0.35394], + 954: [0, 0.43056, 0, 0, 0.57616], + 955: [0, 0.69444, 0, 0, 0.58334], + 956: [0.19444, 0.43056, 0, 0.02778, 0.60255], + 957: [0, 0.43056, 0.06366, 0.02778, 0.49398], + 958: [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + 959: [0, 0.43056, 0, 0.05556, 0.48472], + 960: [0, 0.43056, 0.03588, 0, 0.57003], + 961: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 962: [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + 963: [0, 0.43056, 0.03588, 0, 0.57141], + 964: [0, 0.43056, 0.1132, 0.02778, 0.43715], + 965: [0, 0.43056, 0.03588, 0.02778, 0.54028], + 966: [0.19444, 0.43056, 0, 0.08334, 0.65417], + 967: [0.19444, 0.43056, 0, 0.05556, 0.62569], + 968: [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + 969: [0, 0.43056, 0.03588, 0, 0.62245], + 977: [0, 0.69444, 0, 0.08334, 0.59144], + 981: [0.19444, 0.69444, 0, 0.08334, 0.59583], + 982: [0, 0.43056, 0.02778, 0, 0.82813], + 1009: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 1013: [0, 0.43056, 0, 0.05556, 0.4059], + 57649: [0, 0.43056, 0, 0.02778, 0.32246], + 57911: [0.19444, 0.43056, 0, 0.08334, 0.38403] + }, + "SansSerif-Bold": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.36667], + 34: [0, 0.69444, 0, 0, 0.55834], + 35: [0.19444, 0.69444, 0, 0, 0.91667], + 36: [0.05556, 0.75, 0, 0, 0.55], + 37: [0.05556, 0.75, 0, 0, 1.02912], + 38: [0, 0.69444, 0, 0, 0.83056], + 39: [0, 0.69444, 0, 0, 0.30556], + 40: [0.25, 0.75, 0, 0, 0.42778], + 41: [0.25, 0.75, 0, 0, 0.42778], + 42: [0, 0.75, 0, 0, 0.55], + 43: [0.11667, 0.61667, 0, 0, 0.85556], + 44: [0.10556, 0.13056, 0, 0, 0.30556], + 45: [0, 0.45833, 0, 0, 0.36667], + 46: [0, 0.13056, 0, 0, 0.30556], + 47: [0.25, 0.75, 0, 0, 0.55], + 48: [0, 0.69444, 0, 0, 0.55], + 49: [0, 0.69444, 0, 0, 0.55], + 50: [0, 0.69444, 0, 0, 0.55], + 51: [0, 0.69444, 0, 0, 0.55], + 52: [0, 0.69444, 0, 0, 0.55], + 53: [0, 0.69444, 0, 0, 0.55], + 54: [0, 0.69444, 0, 0, 0.55], + 55: [0, 0.69444, 0, 0, 0.55], + 56: [0, 0.69444, 0, 0, 0.55], + 57: [0, 0.69444, 0, 0, 0.55], + 58: [0, 0.45833, 0, 0, 0.30556], + 59: [0.10556, 0.45833, 0, 0, 0.30556], + 61: [-0.09375, 0.40625, 0, 0, 0.85556], + 63: [0, 0.69444, 0, 0, 0.51945], + 64: [0, 0.69444, 0, 0, 0.73334], + 65: [0, 0.69444, 0, 0, 0.73334], + 66: [0, 0.69444, 0, 0, 0.73334], + 67: [0, 0.69444, 0, 0, 0.70278], + 68: [0, 0.69444, 0, 0, 0.79445], + 69: [0, 0.69444, 0, 0, 0.64167], + 70: [0, 0.69444, 0, 0, 0.61111], + 71: [0, 0.69444, 0, 0, 0.73334], + 72: [0, 0.69444, 0, 0, 0.79445], + 73: [0, 0.69444, 0, 0, 0.33056], + 74: [0, 0.69444, 0, 0, 0.51945], + 75: [0, 0.69444, 0, 0, 0.76389], + 76: [0, 0.69444, 0, 0, 0.58056], + 77: [0, 0.69444, 0, 0, 0.97778], + 78: [0, 0.69444, 0, 0, 0.79445], + 79: [0, 0.69444, 0, 0, 0.79445], + 80: [0, 0.69444, 0, 0, 0.70278], + 81: [0.10556, 0.69444, 0, 0, 0.79445], + 82: [0, 0.69444, 0, 0, 0.70278], + 83: [0, 0.69444, 0, 0, 0.61111], + 84: [0, 0.69444, 0, 0, 0.73334], + 85: [0, 0.69444, 0, 0, 0.76389], + 86: [0, 0.69444, 0.01528, 0, 0.73334], + 87: [0, 0.69444, 0.01528, 0, 1.03889], + 88: [0, 0.69444, 0, 0, 0.73334], + 89: [0, 0.69444, 0.0275, 0, 0.73334], + 90: [0, 0.69444, 0, 0, 0.67223], + 91: [0.25, 0.75, 0, 0, 0.34306], + 93: [0.25, 0.75, 0, 0, 0.34306], + 94: [0, 0.69444, 0, 0, 0.55], + 95: [0.35, 0.10833, 0.03056, 0, 0.55], + 97: [0, 0.45833, 0, 0, 0.525], + 98: [0, 0.69444, 0, 0, 0.56111], + 99: [0, 0.45833, 0, 0, 0.48889], + 100: [0, 0.69444, 0, 0, 0.56111], + 101: [0, 0.45833, 0, 0, 0.51111], + 102: [0, 0.69444, 0.07639, 0, 0.33611], + 103: [0.19444, 0.45833, 0.01528, 0, 0.55], + 104: [0, 0.69444, 0, 0, 0.56111], + 105: [0, 0.69444, 0, 0, 0.25556], + 106: [0.19444, 0.69444, 0, 0, 0.28611], + 107: [0, 0.69444, 0, 0, 0.53056], + 108: [0, 0.69444, 0, 0, 0.25556], + 109: [0, 0.45833, 0, 0, 0.86667], + 110: [0, 0.45833, 0, 0, 0.56111], + 111: [0, 0.45833, 0, 0, 0.55], + 112: [0.19444, 0.45833, 0, 0, 0.56111], + 113: [0.19444, 0.45833, 0, 0, 0.56111], + 114: [0, 0.45833, 0.01528, 0, 0.37222], + 115: [0, 0.45833, 0, 0, 0.42167], + 116: [0, 0.58929, 0, 0, 0.40417], + 117: [0, 0.45833, 0, 0, 0.56111], + 118: [0, 0.45833, 0.01528, 0, 0.5], + 119: [0, 0.45833, 0.01528, 0, 0.74445], + 120: [0, 0.45833, 0, 0, 0.5], + 121: [0.19444, 0.45833, 0.01528, 0, 0.5], + 122: [0, 0.45833, 0, 0, 0.47639], + 126: [0.35, 0.34444, 0, 0, 0.55], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0, 0, 0.55], + 176: [0, 0.69444, 0, 0, 0.73334], + 180: [0, 0.69444, 0, 0, 0.55], + 184: [0.17014, 0, 0, 0, 0.48889], + 305: [0, 0.45833, 0, 0, 0.25556], + 567: [0.19444, 0.45833, 0, 0, 0.28611], + 710: [0, 0.69444, 0, 0, 0.55], + 711: [0, 0.63542, 0, 0, 0.55], + 713: [0, 0.63778, 0, 0, 0.55], + 728: [0, 0.69444, 0, 0, 0.55], + 729: [0, 0.69444, 0, 0, 0.30556], + 730: [0, 0.69444, 0, 0, 0.73334], + 732: [0, 0.69444, 0, 0, 0.55], + 733: [0, 0.69444, 0, 0, 0.55], + 915: [0, 0.69444, 0, 0, 0.58056], + 916: [0, 0.69444, 0, 0, 0.91667], + 920: [0, 0.69444, 0, 0, 0.85556], + 923: [0, 0.69444, 0, 0, 0.67223], + 926: [0, 0.69444, 0, 0, 0.73334], + 928: [0, 0.69444, 0, 0, 0.79445], + 931: [0, 0.69444, 0, 0, 0.79445], + 933: [0, 0.69444, 0, 0, 0.85556], + 934: [0, 0.69444, 0, 0, 0.79445], + 936: [0, 0.69444, 0, 0, 0.85556], + 937: [0, 0.69444, 0, 0, 0.79445], + 8211: [0, 0.45833, 0.03056, 0, 0.55], + 8212: [0, 0.45833, 0.03056, 0, 1.10001], + 8216: [0, 0.69444, 0, 0, 0.30556], + 8217: [0, 0.69444, 0, 0, 0.30556], + 8220: [0, 0.69444, 0, 0, 0.55834], + 8221: [0, 0.69444, 0, 0, 0.55834] + }, + "SansSerif-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.05733, 0, 0.31945], + 34: [0, 0.69444, 316e-5, 0, 0.5], + 35: [0.19444, 0.69444, 0.05087, 0, 0.83334], + 36: [0.05556, 0.75, 0.11156, 0, 0.5], + 37: [0.05556, 0.75, 0.03126, 0, 0.83334], + 38: [0, 0.69444, 0.03058, 0, 0.75834], + 39: [0, 0.69444, 0.07816, 0, 0.27778], + 40: [0.25, 0.75, 0.13164, 0, 0.38889], + 41: [0.25, 0.75, 0.02536, 0, 0.38889], + 42: [0, 0.75, 0.11775, 0, 0.5], + 43: [0.08333, 0.58333, 0.02536, 0, 0.77778], + 44: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0.01946, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0.13164, 0, 0.5], + 48: [0, 0.65556, 0.11156, 0, 0.5], + 49: [0, 0.65556, 0.11156, 0, 0.5], + 50: [0, 0.65556, 0.11156, 0, 0.5], + 51: [0, 0.65556, 0.11156, 0, 0.5], + 52: [0, 0.65556, 0.11156, 0, 0.5], + 53: [0, 0.65556, 0.11156, 0, 0.5], + 54: [0, 0.65556, 0.11156, 0, 0.5], + 55: [0, 0.65556, 0.11156, 0, 0.5], + 56: [0, 0.65556, 0.11156, 0, 0.5], + 57: [0, 0.65556, 0.11156, 0, 0.5], + 58: [0, 0.44444, 0.02502, 0, 0.27778], + 59: [0.125, 0.44444, 0.02502, 0, 0.27778], + 61: [-0.13, 0.37, 0.05087, 0, 0.77778], + 63: [0, 0.69444, 0.11809, 0, 0.47222], + 64: [0, 0.69444, 0.07555, 0, 0.66667], + 65: [0, 0.69444, 0, 0, 0.66667], + 66: [0, 0.69444, 0.08293, 0, 0.66667], + 67: [0, 0.69444, 0.11983, 0, 0.63889], + 68: [0, 0.69444, 0.07555, 0, 0.72223], + 69: [0, 0.69444, 0.11983, 0, 0.59722], + 70: [0, 0.69444, 0.13372, 0, 0.56945], + 71: [0, 0.69444, 0.11983, 0, 0.66667], + 72: [0, 0.69444, 0.08094, 0, 0.70834], + 73: [0, 0.69444, 0.13372, 0, 0.27778], + 74: [0, 0.69444, 0.08094, 0, 0.47222], + 75: [0, 0.69444, 0.11983, 0, 0.69445], + 76: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0.08094, 0, 0.875], + 78: [0, 0.69444, 0.08094, 0, 0.70834], + 79: [0, 0.69444, 0.07555, 0, 0.73611], + 80: [0, 0.69444, 0.08293, 0, 0.63889], + 81: [0.125, 0.69444, 0.07555, 0, 0.73611], + 82: [0, 0.69444, 0.08293, 0, 0.64584], + 83: [0, 0.69444, 0.09205, 0, 0.55556], + 84: [0, 0.69444, 0.13372, 0, 0.68056], + 85: [0, 0.69444, 0.08094, 0, 0.6875], + 86: [0, 0.69444, 0.1615, 0, 0.66667], + 87: [0, 0.69444, 0.1615, 0, 0.94445], + 88: [0, 0.69444, 0.13372, 0, 0.66667], + 89: [0, 0.69444, 0.17261, 0, 0.66667], + 90: [0, 0.69444, 0.11983, 0, 0.61111], + 91: [0.25, 0.75, 0.15942, 0, 0.28889], + 93: [0.25, 0.75, 0.08719, 0, 0.28889], + 94: [0, 0.69444, 0.0799, 0, 0.5], + 95: [0.35, 0.09444, 0.08616, 0, 0.5], + 97: [0, 0.44444, 981e-5, 0, 0.48056], + 98: [0, 0.69444, 0.03057, 0, 0.51667], + 99: [0, 0.44444, 0.08336, 0, 0.44445], + 100: [0, 0.69444, 0.09483, 0, 0.51667], + 101: [0, 0.44444, 0.06778, 0, 0.44445], + 102: [0, 0.69444, 0.21705, 0, 0.30556], + 103: [0.19444, 0.44444, 0.10836, 0, 0.5], + 104: [0, 0.69444, 0.01778, 0, 0.51667], + 105: [0, 0.67937, 0.09718, 0, 0.23889], + 106: [0.19444, 0.67937, 0.09162, 0, 0.26667], + 107: [0, 0.69444, 0.08336, 0, 0.48889], + 108: [0, 0.69444, 0.09483, 0, 0.23889], + 109: [0, 0.44444, 0.01778, 0, 0.79445], + 110: [0, 0.44444, 0.01778, 0, 0.51667], + 111: [0, 0.44444, 0.06613, 0, 0.5], + 112: [0.19444, 0.44444, 0.0389, 0, 0.51667], + 113: [0.19444, 0.44444, 0.04169, 0, 0.51667], + 114: [0, 0.44444, 0.10836, 0, 0.34167], + 115: [0, 0.44444, 0.0778, 0, 0.38333], + 116: [0, 0.57143, 0.07225, 0, 0.36111], + 117: [0, 0.44444, 0.04169, 0, 0.51667], + 118: [0, 0.44444, 0.10836, 0, 0.46111], + 119: [0, 0.44444, 0.10836, 0, 0.68334], + 120: [0, 0.44444, 0.09169, 0, 0.46111], + 121: [0.19444, 0.44444, 0.10836, 0, 0.46111], + 122: [0, 0.44444, 0.08752, 0, 0.43472], + 126: [0.35, 0.32659, 0.08826, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0.06385, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.73752], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0.04169, 0, 0.23889], + 567: [0.19444, 0.44444, 0.04169, 0, 0.26667], + 710: [0, 0.69444, 0.0799, 0, 0.5], + 711: [0, 0.63194, 0.08432, 0, 0.5], + 713: [0, 0.60889, 0.08776, 0, 0.5], + 714: [0, 0.69444, 0.09205, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0.09483, 0, 0.5], + 729: [0, 0.67937, 0.07774, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.73752], + 732: [0, 0.67659, 0.08826, 0, 0.5], + 733: [0, 0.69444, 0.09205, 0, 0.5], + 915: [0, 0.69444, 0.13372, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0.07555, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0.12816, 0, 0.66667], + 928: [0, 0.69444, 0.08094, 0, 0.70834], + 931: [0, 0.69444, 0.11983, 0, 0.72222], + 933: [0, 0.69444, 0.09031, 0, 0.77778], + 934: [0, 0.69444, 0.04603, 0, 0.72222], + 936: [0, 0.69444, 0.09031, 0, 0.77778], + 937: [0, 0.69444, 0.08293, 0, 0.72222], + 8211: [0, 0.44444, 0.08616, 0, 0.5], + 8212: [0, 0.44444, 0.08616, 0, 1], + 8216: [0, 0.69444, 0.07816, 0, 0.27778], + 8217: [0, 0.69444, 0.07816, 0, 0.27778], + 8220: [0, 0.69444, 0.14205, 0, 0.5], + 8221: [0, 0.69444, 316e-5, 0, 0.5] + }, + "SansSerif-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.31945], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.75834], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 44: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.65556, 0, 0, 0.5], + 49: [0, 0.65556, 0, 0, 0.5], + 50: [0, 0.65556, 0, 0, 0.5], + 51: [0, 0.65556, 0, 0, 0.5], + 52: [0, 0.65556, 0, 0, 0.5], + 53: [0, 0.65556, 0, 0, 0.5], + 54: [0, 0.65556, 0, 0, 0.5], + 55: [0, 0.65556, 0, 0, 0.5], + 56: [0, 0.65556, 0, 0, 0.5], + 57: [0, 0.65556, 0, 0, 0.5], + 58: [0, 0.44444, 0, 0, 0.27778], + 59: [0.125, 0.44444, 0, 0, 0.27778], + 61: [-0.13, 0.37, 0, 0, 0.77778], + 63: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.66667], + 65: [0, 0.69444, 0, 0, 0.66667], + 66: [0, 0.69444, 0, 0, 0.66667], + 67: [0, 0.69444, 0, 0, 0.63889], + 68: [0, 0.69444, 0, 0, 0.72223], + 69: [0, 0.69444, 0, 0, 0.59722], + 70: [0, 0.69444, 0, 0, 0.56945], + 71: [0, 0.69444, 0, 0, 0.66667], + 72: [0, 0.69444, 0, 0, 0.70834], + 73: [0, 0.69444, 0, 0, 0.27778], + 74: [0, 0.69444, 0, 0, 0.47222], + 75: [0, 0.69444, 0, 0, 0.69445], + 76: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0, 0, 0.875], + 78: [0, 0.69444, 0, 0, 0.70834], + 79: [0, 0.69444, 0, 0, 0.73611], + 80: [0, 0.69444, 0, 0, 0.63889], + 81: [0.125, 0.69444, 0, 0, 0.73611], + 82: [0, 0.69444, 0, 0, 0.64584], + 83: [0, 0.69444, 0, 0, 0.55556], + 84: [0, 0.69444, 0, 0, 0.68056], + 85: [0, 0.69444, 0, 0, 0.6875], + 86: [0, 0.69444, 0.01389, 0, 0.66667], + 87: [0, 0.69444, 0.01389, 0, 0.94445], + 88: [0, 0.69444, 0, 0, 0.66667], + 89: [0, 0.69444, 0.025, 0, 0.66667], + 90: [0, 0.69444, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.28889], + 93: [0.25, 0.75, 0, 0, 0.28889], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.35, 0.09444, 0.02778, 0, 0.5], + 97: [0, 0.44444, 0, 0, 0.48056], + 98: [0, 0.69444, 0, 0, 0.51667], + 99: [0, 0.44444, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.51667], + 101: [0, 0.44444, 0, 0, 0.44445], + 102: [0, 0.69444, 0.06944, 0, 0.30556], + 103: [0.19444, 0.44444, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.51667], + 105: [0, 0.67937, 0, 0, 0.23889], + 106: [0.19444, 0.67937, 0, 0, 0.26667], + 107: [0, 0.69444, 0, 0, 0.48889], + 108: [0, 0.69444, 0, 0, 0.23889], + 109: [0, 0.44444, 0, 0, 0.79445], + 110: [0, 0.44444, 0, 0, 0.51667], + 111: [0, 0.44444, 0, 0, 0.5], + 112: [0.19444, 0.44444, 0, 0, 0.51667], + 113: [0.19444, 0.44444, 0, 0, 0.51667], + 114: [0, 0.44444, 0.01389, 0, 0.34167], + 115: [0, 0.44444, 0, 0, 0.38333], + 116: [0, 0.57143, 0, 0, 0.36111], + 117: [0, 0.44444, 0, 0, 0.51667], + 118: [0, 0.44444, 0.01389, 0, 0.46111], + 119: [0, 0.44444, 0.01389, 0, 0.68334], + 120: [0, 0.44444, 0, 0, 0.46111], + 121: [0.19444, 0.44444, 0.01389, 0, 0.46111], + 122: [0, 0.44444, 0, 0, 0.43472], + 126: [0.35, 0.32659, 0, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.66667], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0, 0, 0.23889], + 567: [0.19444, 0.44444, 0, 0, 0.26667], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.63194, 0, 0, 0.5], + 713: [0, 0.60889, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.67937, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.66667], + 732: [0, 0.67659, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.69444, 0, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0, 0, 0.66667], + 928: [0, 0.69444, 0, 0, 0.70834], + 931: [0, 0.69444, 0, 0, 0.72222], + 933: [0, 0.69444, 0, 0, 0.77778], + 934: [0, 0.69444, 0, 0, 0.72222], + 936: [0, 0.69444, 0, 0, 0.77778], + 937: [0, 0.69444, 0, 0, 0.72222], + 8211: [0, 0.44444, 0.02778, 0, 0.5], + 8212: [0, 0.44444, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5] + }, + "Script-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.7, 0.22925, 0, 0.80253], + 66: [0, 0.7, 0.04087, 0, 0.90757], + 67: [0, 0.7, 0.1689, 0, 0.66619], + 68: [0, 0.7, 0.09371, 0, 0.77443], + 69: [0, 0.7, 0.18583, 0, 0.56162], + 70: [0, 0.7, 0.13634, 0, 0.89544], + 71: [0, 0.7, 0.17322, 0, 0.60961], + 72: [0, 0.7, 0.29694, 0, 0.96919], + 73: [0, 0.7, 0.19189, 0, 0.80907], + 74: [0.27778, 0.7, 0.19189, 0, 1.05159], + 75: [0, 0.7, 0.31259, 0, 0.91364], + 76: [0, 0.7, 0.19189, 0, 0.87373], + 77: [0, 0.7, 0.15981, 0, 1.08031], + 78: [0, 0.7, 0.3525, 0, 0.9015], + 79: [0, 0.7, 0.08078, 0, 0.73787], + 80: [0, 0.7, 0.08078, 0, 1.01262], + 81: [0, 0.7, 0.03305, 0, 0.88282], + 82: [0, 0.7, 0.06259, 0, 0.85], + 83: [0, 0.7, 0.19189, 0, 0.86767], + 84: [0, 0.7, 0.29087, 0, 0.74697], + 85: [0, 0.7, 0.25815, 0, 0.79996], + 86: [0, 0.7, 0.27523, 0, 0.62204], + 87: [0, 0.7, 0.27523, 0, 0.80532], + 88: [0, 0.7, 0.26006, 0, 0.94445], + 89: [0, 0.7, 0.2939, 0, 0.70961], + 90: [0, 0.7, 0.24037, 0, 0.8212], + 160: [0, 0, 0, 0, 0.25] + }, + "Size1-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.35001, 0.85, 0, 0, 0.45834], + 41: [0.35001, 0.85, 0, 0, 0.45834], + 47: [0.35001, 0.85, 0, 0, 0.57778], + 91: [0.35001, 0.85, 0, 0, 0.41667], + 92: [0.35001, 0.85, 0, 0, 0.57778], + 93: [0.35001, 0.85, 0, 0, 0.41667], + 123: [0.35001, 0.85, 0, 0, 0.58334], + 125: [0.35001, 0.85, 0, 0, 0.58334], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.72222, 0, 0, 0.55556], + 732: [0, 0.72222, 0, 0, 0.55556], + 770: [0, 0.72222, 0, 0, 0.55556], + 771: [0, 0.72222, 0, 0, 0.55556], + 8214: [-99e-5, 0.601, 0, 0, 0.77778], + 8593: [1e-5, 0.6, 0, 0, 0.66667], + 8595: [1e-5, 0.6, 0, 0, 0.66667], + 8657: [1e-5, 0.6, 0, 0, 0.77778], + 8659: [1e-5, 0.6, 0, 0, 0.77778], + 8719: [0.25001, 0.75, 0, 0, 0.94445], + 8720: [0.25001, 0.75, 0, 0, 0.94445], + 8721: [0.25001, 0.75, 0, 0, 1.05556], + 8730: [0.35001, 0.85, 0, 0, 1], + 8739: [-599e-5, 0.606, 0, 0, 0.33333], + 8741: [-599e-5, 0.606, 0, 0, 0.55556], + 8747: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8748: [0.306, 0.805, 0.19445, 0, 0.47222], + 8749: [0.306, 0.805, 0.19445, 0, 0.47222], + 8750: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8896: [0.25001, 0.75, 0, 0, 0.83334], + 8897: [0.25001, 0.75, 0, 0, 0.83334], + 8898: [0.25001, 0.75, 0, 0, 0.83334], + 8899: [0.25001, 0.75, 0, 0, 0.83334], + 8968: [0.35001, 0.85, 0, 0, 0.47222], + 8969: [0.35001, 0.85, 0, 0, 0.47222], + 8970: [0.35001, 0.85, 0, 0, 0.47222], + 8971: [0.35001, 0.85, 0, 0, 0.47222], + 9168: [-99e-5, 0.601, 0, 0, 0.66667], + 10216: [0.35001, 0.85, 0, 0, 0.47222], + 10217: [0.35001, 0.85, 0, 0, 0.47222], + 10752: [0.25001, 0.75, 0, 0, 1.11111], + 10753: [0.25001, 0.75, 0, 0, 1.11111], + 10754: [0.25001, 0.75, 0, 0, 1.11111], + 10756: [0.25001, 0.75, 0, 0, 0.83334], + 10758: [0.25001, 0.75, 0, 0, 0.83334] + }, + "Size2-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.65002, 1.15, 0, 0, 0.59722], + 41: [0.65002, 1.15, 0, 0, 0.59722], + 47: [0.65002, 1.15, 0, 0, 0.81111], + 91: [0.65002, 1.15, 0, 0, 0.47222], + 92: [0.65002, 1.15, 0, 0, 0.81111], + 93: [0.65002, 1.15, 0, 0, 0.47222], + 123: [0.65002, 1.15, 0, 0, 0.66667], + 125: [0.65002, 1.15, 0, 0, 0.66667], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1], + 732: [0, 0.75, 0, 0, 1], + 770: [0, 0.75, 0, 0, 1], + 771: [0, 0.75, 0, 0, 1], + 8719: [0.55001, 1.05, 0, 0, 1.27778], + 8720: [0.55001, 1.05, 0, 0, 1.27778], + 8721: [0.55001, 1.05, 0, 0, 1.44445], + 8730: [0.65002, 1.15, 0, 0, 1], + 8747: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8748: [0.862, 1.36, 0.44445, 0, 0.55556], + 8749: [0.862, 1.36, 0.44445, 0, 0.55556], + 8750: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8896: [0.55001, 1.05, 0, 0, 1.11111], + 8897: [0.55001, 1.05, 0, 0, 1.11111], + 8898: [0.55001, 1.05, 0, 0, 1.11111], + 8899: [0.55001, 1.05, 0, 0, 1.11111], + 8968: [0.65002, 1.15, 0, 0, 0.52778], + 8969: [0.65002, 1.15, 0, 0, 0.52778], + 8970: [0.65002, 1.15, 0, 0, 0.52778], + 8971: [0.65002, 1.15, 0, 0, 0.52778], + 10216: [0.65002, 1.15, 0, 0, 0.61111], + 10217: [0.65002, 1.15, 0, 0, 0.61111], + 10752: [0.55001, 1.05, 0, 0, 1.51112], + 10753: [0.55001, 1.05, 0, 0, 1.51112], + 10754: [0.55001, 1.05, 0, 0, 1.51112], + 10756: [0.55001, 1.05, 0, 0, 1.11111], + 10758: [0.55001, 1.05, 0, 0, 1.11111] + }, + "Size3-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.95003, 1.45, 0, 0, 0.73611], + 41: [0.95003, 1.45, 0, 0, 0.73611], + 47: [0.95003, 1.45, 0, 0, 1.04445], + 91: [0.95003, 1.45, 0, 0, 0.52778], + 92: [0.95003, 1.45, 0, 0, 1.04445], + 93: [0.95003, 1.45, 0, 0, 0.52778], + 123: [0.95003, 1.45, 0, 0, 0.75], + 125: [0.95003, 1.45, 0, 0, 0.75], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1.44445], + 732: [0, 0.75, 0, 0, 1.44445], + 770: [0, 0.75, 0, 0, 1.44445], + 771: [0, 0.75, 0, 0, 1.44445], + 8730: [0.95003, 1.45, 0, 0, 1], + 8968: [0.95003, 1.45, 0, 0, 0.58334], + 8969: [0.95003, 1.45, 0, 0, 0.58334], + 8970: [0.95003, 1.45, 0, 0, 0.58334], + 8971: [0.95003, 1.45, 0, 0, 0.58334], + 10216: [0.95003, 1.45, 0, 0, 0.75], + 10217: [0.95003, 1.45, 0, 0, 0.75] + }, + "Size4-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [1.25003, 1.75, 0, 0, 0.79167], + 41: [1.25003, 1.75, 0, 0, 0.79167], + 47: [1.25003, 1.75, 0, 0, 1.27778], + 91: [1.25003, 1.75, 0, 0, 0.58334], + 92: [1.25003, 1.75, 0, 0, 1.27778], + 93: [1.25003, 1.75, 0, 0, 0.58334], + 123: [1.25003, 1.75, 0, 0, 0.80556], + 125: [1.25003, 1.75, 0, 0, 0.80556], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.825, 0, 0, 1.8889], + 732: [0, 0.825, 0, 0, 1.8889], + 770: [0, 0.825, 0, 0, 1.8889], + 771: [0, 0.825, 0, 0, 1.8889], + 8730: [1.25003, 1.75, 0, 0, 1], + 8968: [1.25003, 1.75, 0, 0, 0.63889], + 8969: [1.25003, 1.75, 0, 0, 0.63889], + 8970: [1.25003, 1.75, 0, 0, 0.63889], + 8971: [1.25003, 1.75, 0, 0, 0.63889], + 9115: [0.64502, 1.155, 0, 0, 0.875], + 9116: [1e-5, 0.6, 0, 0, 0.875], + 9117: [0.64502, 1.155, 0, 0, 0.875], + 9118: [0.64502, 1.155, 0, 0, 0.875], + 9119: [1e-5, 0.6, 0, 0, 0.875], + 9120: [0.64502, 1.155, 0, 0, 0.875], + 9121: [0.64502, 1.155, 0, 0, 0.66667], + 9122: [-99e-5, 0.601, 0, 0, 0.66667], + 9123: [0.64502, 1.155, 0, 0, 0.66667], + 9124: [0.64502, 1.155, 0, 0, 0.66667], + 9125: [-99e-5, 0.601, 0, 0, 0.66667], + 9126: [0.64502, 1.155, 0, 0, 0.66667], + 9127: [1e-5, 0.9, 0, 0, 0.88889], + 9128: [0.65002, 1.15, 0, 0, 0.88889], + 9129: [0.90001, 0, 0, 0, 0.88889], + 9130: [0, 0.3, 0, 0, 0.88889], + 9131: [1e-5, 0.9, 0, 0, 0.88889], + 9132: [0.65002, 1.15, 0, 0, 0.88889], + 9133: [0.90001, 0, 0, 0, 0.88889], + 9143: [0.88502, 0.915, 0, 0, 1.05556], + 10216: [1.25003, 1.75, 0, 0, 0.80556], + 10217: [1.25003, 1.75, 0, 0, 0.80556], + 57344: [-499e-5, 0.605, 0, 0, 1.05556], + 57345: [-499e-5, 0.605, 0, 0, 1.05556], + 57680: [0, 0.12, 0, 0, 0.45], + 57681: [0, 0.12, 0, 0, 0.45], + 57682: [0, 0.12, 0, 0, 0.45], + 57683: [0, 0.12, 0, 0, 0.45] + }, + "Typewriter-Regular": { + 32: [0, 0, 0, 0, 0.525], + 33: [0, 0.61111, 0, 0, 0.525], + 34: [0, 0.61111, 0, 0, 0.525], + 35: [0, 0.61111, 0, 0, 0.525], + 36: [0.08333, 0.69444, 0, 0, 0.525], + 37: [0.08333, 0.69444, 0, 0, 0.525], + 38: [0, 0.61111, 0, 0, 0.525], + 39: [0, 0.61111, 0, 0, 0.525], + 40: [0.08333, 0.69444, 0, 0, 0.525], + 41: [0.08333, 0.69444, 0, 0, 0.525], + 42: [0, 0.52083, 0, 0, 0.525], + 43: [-0.08056, 0.53055, 0, 0, 0.525], + 44: [0.13889, 0.125, 0, 0, 0.525], + 45: [-0.08056, 0.53055, 0, 0, 0.525], + 46: [0, 0.125, 0, 0, 0.525], + 47: [0.08333, 0.69444, 0, 0, 0.525], + 48: [0, 0.61111, 0, 0, 0.525], + 49: [0, 0.61111, 0, 0, 0.525], + 50: [0, 0.61111, 0, 0, 0.525], + 51: [0, 0.61111, 0, 0, 0.525], + 52: [0, 0.61111, 0, 0, 0.525], + 53: [0, 0.61111, 0, 0, 0.525], + 54: [0, 0.61111, 0, 0, 0.525], + 55: [0, 0.61111, 0, 0, 0.525], + 56: [0, 0.61111, 0, 0, 0.525], + 57: [0, 0.61111, 0, 0, 0.525], + 58: [0, 0.43056, 0, 0, 0.525], + 59: [0.13889, 0.43056, 0, 0, 0.525], + 60: [-0.05556, 0.55556, 0, 0, 0.525], + 61: [-0.19549, 0.41562, 0, 0, 0.525], + 62: [-0.05556, 0.55556, 0, 0, 0.525], + 63: [0, 0.61111, 0, 0, 0.525], + 64: [0, 0.61111, 0, 0, 0.525], + 65: [0, 0.61111, 0, 0, 0.525], + 66: [0, 0.61111, 0, 0, 0.525], + 67: [0, 0.61111, 0, 0, 0.525], + 68: [0, 0.61111, 0, 0, 0.525], + 69: [0, 0.61111, 0, 0, 0.525], + 70: [0, 0.61111, 0, 0, 0.525], + 71: [0, 0.61111, 0, 0, 0.525], + 72: [0, 0.61111, 0, 0, 0.525], + 73: [0, 0.61111, 0, 0, 0.525], + 74: [0, 0.61111, 0, 0, 0.525], + 75: [0, 0.61111, 0, 0, 0.525], + 76: [0, 0.61111, 0, 0, 0.525], + 77: [0, 0.61111, 0, 0, 0.525], + 78: [0, 0.61111, 0, 0, 0.525], + 79: [0, 0.61111, 0, 0, 0.525], + 80: [0, 0.61111, 0, 0, 0.525], + 81: [0.13889, 0.61111, 0, 0, 0.525], + 82: [0, 0.61111, 0, 0, 0.525], + 83: [0, 0.61111, 0, 0, 0.525], + 84: [0, 0.61111, 0, 0, 0.525], + 85: [0, 0.61111, 0, 0, 0.525], + 86: [0, 0.61111, 0, 0, 0.525], + 87: [0, 0.61111, 0, 0, 0.525], + 88: [0, 0.61111, 0, 0, 0.525], + 89: [0, 0.61111, 0, 0, 0.525], + 90: [0, 0.61111, 0, 0, 0.525], + 91: [0.08333, 0.69444, 0, 0, 0.525], + 92: [0.08333, 0.69444, 0, 0, 0.525], + 93: [0.08333, 0.69444, 0, 0, 0.525], + 94: [0, 0.61111, 0, 0, 0.525], + 95: [0.09514, 0, 0, 0, 0.525], + 96: [0, 0.61111, 0, 0, 0.525], + 97: [0, 0.43056, 0, 0, 0.525], + 98: [0, 0.61111, 0, 0, 0.525], + 99: [0, 0.43056, 0, 0, 0.525], + 100: [0, 0.61111, 0, 0, 0.525], + 101: [0, 0.43056, 0, 0, 0.525], + 102: [0, 0.61111, 0, 0, 0.525], + 103: [0.22222, 0.43056, 0, 0, 0.525], + 104: [0, 0.61111, 0, 0, 0.525], + 105: [0, 0.61111, 0, 0, 0.525], + 106: [0.22222, 0.61111, 0, 0, 0.525], + 107: [0, 0.61111, 0, 0, 0.525], + 108: [0, 0.61111, 0, 0, 0.525], + 109: [0, 0.43056, 0, 0, 0.525], + 110: [0, 0.43056, 0, 0, 0.525], + 111: [0, 0.43056, 0, 0, 0.525], + 112: [0.22222, 0.43056, 0, 0, 0.525], + 113: [0.22222, 0.43056, 0, 0, 0.525], + 114: [0, 0.43056, 0, 0, 0.525], + 115: [0, 0.43056, 0, 0, 0.525], + 116: [0, 0.55358, 0, 0, 0.525], + 117: [0, 0.43056, 0, 0, 0.525], + 118: [0, 0.43056, 0, 0, 0.525], + 119: [0, 0.43056, 0, 0, 0.525], + 120: [0, 0.43056, 0, 0, 0.525], + 121: [0.22222, 0.43056, 0, 0, 0.525], + 122: [0, 0.43056, 0, 0, 0.525], + 123: [0.08333, 0.69444, 0, 0, 0.525], + 124: [0.08333, 0.69444, 0, 0, 0.525], + 125: [0.08333, 0.69444, 0, 0, 0.525], + 126: [0, 0.61111, 0, 0, 0.525], + 127: [0, 0.61111, 0, 0, 0.525], + 160: [0, 0, 0, 0, 0.525], + 176: [0, 0.61111, 0, 0, 0.525], + 184: [0.19445, 0, 0, 0, 0.525], + 305: [0, 0.43056, 0, 0, 0.525], + 567: [0.22222, 0.43056, 0, 0, 0.525], + 711: [0, 0.56597, 0, 0, 0.525], + 713: [0, 0.56555, 0, 0, 0.525], + 714: [0, 0.61111, 0, 0, 0.525], + 715: [0, 0.61111, 0, 0, 0.525], + 728: [0, 0.61111, 0, 0, 0.525], + 730: [0, 0.61111, 0, 0, 0.525], + 770: [0, 0.61111, 0, 0, 0.525], + 771: [0, 0.61111, 0, 0, 0.525], + 776: [0, 0.61111, 0, 0, 0.525], + 915: [0, 0.61111, 0, 0, 0.525], + 916: [0, 0.61111, 0, 0, 0.525], + 920: [0, 0.61111, 0, 0, 0.525], + 923: [0, 0.61111, 0, 0, 0.525], + 926: [0, 0.61111, 0, 0, 0.525], + 928: [0, 0.61111, 0, 0, 0.525], + 931: [0, 0.61111, 0, 0, 0.525], + 933: [0, 0.61111, 0, 0, 0.525], + 934: [0, 0.61111, 0, 0, 0.525], + 936: [0, 0.61111, 0, 0, 0.525], + 937: [0, 0.61111, 0, 0, 0.525], + 8216: [0, 0.61111, 0, 0, 0.525], + 8217: [0, 0.61111, 0, 0, 0.525], + 8242: [0, 0.61111, 0, 0, 0.525], + 9251: [0.11111, 0.21944, 0, 0, 0.525] + } +}, extraCharacterMap = { + // Latin-1 + Å: "A", + Ð: "D", + Þ: "o", + å: "a", + ð: "d", + þ: "o", + // Cyrillic + А: "A", + Б: "B", + В: "B", + Г: "F", + Д: "A", + Е: "E", + Ж: "K", + З: "3", + И: "N", + Й: "N", + К: "K", + Л: "N", + М: "M", + Н: "H", + О: "O", + П: "N", + Р: "P", + С: "C", + Т: "T", + У: "y", + Ф: "O", + Х: "X", + Ц: "U", + Ч: "h", + Ш: "W", + Щ: "W", + Ъ: "B", + Ы: "X", + Ь: "B", + Э: "3", + Ю: "X", + Я: "R", + а: "a", + б: "b", + в: "a", + г: "r", + д: "y", + е: "e", + ж: "m", + з: "e", + и: "n", + й: "n", + к: "n", + л: "n", + м: "m", + н: "n", + о: "o", + п: "n", + р: "p", + с: "c", + т: "o", + у: "y", + ф: "b", + х: "x", + ц: "n", + ч: "n", + ш: "w", + щ: "w", + ъ: "a", + ы: "m", + ь: "a", + э: "e", + ю: "m", + я: "r" +}; +function getCharacterMetrics(n, e, t) { + if (!fontMetricsData[e]) + throw new Error("Font metrics not found for font: " + e + "."); + var r = n.charCodeAt(0), a = fontMetricsData[e][r]; + if (!a && n[0] in extraCharacterMap && (r = extraCharacterMap[n[0]].charCodeAt(0), a = fontMetricsData[e][r]), !a && t === "text" && supportedCodepoint(r) && (a = fontMetricsData[e][77]), a) + return { + depth: a[0], + height: a[1], + italic: a[2], + skew: a[3], + width: a[4] + }; } -var _3Dmol$1 = { exports: {} }; -/*! - * 3dmol v2.0.6 - * JavaScript/TypeScript molecular visualization library - * Author: David Koes and contributors - */ -(function(module, exports) { - (function(e, r) { - module.exports = r(); - })(commonjsGlobal, () => ( - /******/ - (() => { - var __webpack_modules__ = { - /***/ - "./node_modules/iobuffer/lib-esm/IOBuffer.js": ( - /*!***************************************************!*\ - !*** ./node_modules/iobuffer/lib-esm/IOBuffer.js ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - IOBuffer: () => ( - /* binding */ - h - ) - /* harmony export */ - }); - var n = r( - /*! ./text */ - "./node_modules/iobuffer/lib-esm/text.browser.js" - ); - const f = 1024 * 8, u = (() => { - const _ = new Uint8Array(4), E = new Uint32Array(_.buffer); - return !((E[0] = 1) & _[0]); - })(), b = { - int8: globalThis.Int8Array, - uint8: globalThis.Uint8Array, - int16: globalThis.Int16Array, - uint16: globalThis.Uint16Array, - int32: globalThis.Int32Array, - uint32: globalThis.Uint32Array, - uint64: globalThis.BigUint64Array, - int64: globalThis.BigInt64Array, - float32: globalThis.Float32Array, - float64: globalThis.Float64Array - }; - class h { - /** - * @param data - The data to construct the IOBuffer with. - * If data is a number, it will be the new buffer's length
- * If data is `undefined`, the buffer will be initialized with a default length of 8Kb
- * If data is an ArrayBuffer, SharedArrayBuffer, an ArrayBufferView (Typed Array), an IOBuffer instance, - * or a Node.js Buffer, a view will be created over the underlying ArrayBuffer. - * @param options - */ - constructor(E = f, c = {}) { - let S = !1; - typeof E == "number" ? E = new ArrayBuffer(E) : (S = !0, this.lastWrittenByte = E.byteLength); - const y = c.offset ? c.offset >>> 0 : 0, w = E.byteLength - y; - let L = y; - (ArrayBuffer.isView(E) || E instanceof h) && (E.byteLength !== E.buffer.byteLength && (L = E.byteOffset + y), E = E.buffer), S ? this.lastWrittenByte = w : this.lastWrittenByte = 0, this.buffer = E, this.length = w, this.byteLength = w, this.byteOffset = L, this.offset = 0, this.littleEndian = !0, this._data = new DataView(this.buffer, L, w), this._mark = 0, this._marks = []; - } - /** - * Checks if the memory allocated to the buffer is sufficient to store more - * bytes after the offset. - * @param byteLength - The needed memory in bytes. - * @returns `true` if there is sufficient space and `false` otherwise. - */ - available(E = 1) { - return this.offset + E <= this.length; - } - /** - * Check if little-endian mode is used for reading and writing multi-byte - * values. - * @returns `true` if little-endian mode is used, `false` otherwise. - */ - isLittleEndian() { - return this.littleEndian; - } - /** - * Set little-endian mode for reading and writing multi-byte values. - */ - setLittleEndian() { - return this.littleEndian = !0, this; - } - /** - * Check if big-endian mode is used for reading and writing multi-byte values. - * @returns `true` if big-endian mode is used, `false` otherwise. - */ - isBigEndian() { - return !this.littleEndian; - } - /** - * Switches to big-endian mode for reading and writing multi-byte values. - */ - setBigEndian() { - return this.littleEndian = !1, this; - } - /** - * Move the pointer n bytes forward. - * @param n - Number of bytes to skip. - */ - skip(E = 1) { - return this.offset += E, this; - } - /** - * Move the pointer n bytes backward. - * @param n - Number of bytes to move back. - */ - back(E = 1) { - return this.offset -= E, this; - } - /** - * Move the pointer to the given offset. - * @param offset - */ - seek(E) { - return this.offset = E, this; - } - /** - * Store the current pointer offset. - * @see {@link IOBuffer#reset} - */ - mark() { - return this._mark = this.offset, this; - } - /** - * Move the pointer back to the last pointer offset set by mark. - * @see {@link IOBuffer#mark} - */ - reset() { - return this.offset = this._mark, this; - } - /** - * Push the current pointer offset to the mark stack. - * @see {@link IOBuffer#popMark} - */ - pushMark() { - return this._marks.push(this.offset), this; - } - /** - * Pop the last pointer offset from the mark stack, and set the current - * pointer offset to the popped value. - * @see {@link IOBuffer#pushMark} - */ - popMark() { - const E = this._marks.pop(); - if (E === void 0) - throw new Error("Mark stack empty"); - return this.seek(E), this; - } - /** - * Move the pointer offset back to 0. - */ - rewind() { - return this.offset = 0, this; - } - /** - * Make sure the buffer has sufficient memory to write a given byteLength at - * the current pointer offset. - * If the buffer's memory is insufficient, this method will create a new - * buffer (a copy) with a length that is twice (byteLength + current offset). - * @param byteLength - */ - ensureAvailable(E = 1) { - if (!this.available(E)) { - const S = (this.offset + E) * 2, y = new Uint8Array(S); - y.set(new Uint8Array(this.buffer)), this.buffer = y.buffer, this.length = this.byteLength = S, this._data = new DataView(this.buffer); - } - return this; - } - /** - * Read a byte and return false if the byte's value is 0, or true otherwise. - * Moves pointer forward by one byte. - */ - readBoolean() { - return this.readUint8() !== 0; - } - /** - * Read a signed 8-bit integer and move pointer forward by 1 byte. - */ - readInt8() { - return this._data.getInt8(this.offset++); - } - /** - * Read an unsigned 8-bit integer and move pointer forward by 1 byte. - */ - readUint8() { - return this._data.getUint8(this.offset++); - } - /** - * Alias for {@link IOBuffer#readUint8}. - */ - readByte() { - return this.readUint8(); - } - /** - * Read `n` bytes and move pointer forward by `n` bytes. - */ - readBytes(E = 1) { - return this.readArray(E, "uint8"); - } - /** - * Creates an array of corresponding to the type `type` and size `size`. - * For example type `uint8` will create a `Uint8Array`. - * @param size - size of the resulting array - * @param type - number type of elements to read - */ - readArray(E, c) { - const S = b[c].BYTES_PER_ELEMENT * E, y = this.byteOffset + this.offset, w = this.buffer.slice(y, y + S); - if (this.littleEndian === u && c !== "uint8" && c !== "int8") { - const s = new Uint8Array(this.buffer.slice(y, y + S)); - s.reverse(); - const o = new b[c](s.buffer); - return this.offset += S, o.reverse(), o; - } - const L = new b[c](w); - return this.offset += S, L; - } - /** - * Read a 16-bit signed integer and move pointer forward by 2 bytes. - */ - readInt16() { - const E = this._data.getInt16(this.offset, this.littleEndian); - return this.offset += 2, E; - } - /** - * Read a 16-bit unsigned integer and move pointer forward by 2 bytes. - */ - readUint16() { - const E = this._data.getUint16(this.offset, this.littleEndian); - return this.offset += 2, E; - } - /** - * Read a 32-bit signed integer and move pointer forward by 4 bytes. - */ - readInt32() { - const E = this._data.getInt32(this.offset, this.littleEndian); - return this.offset += 4, E; - } - /** - * Read a 32-bit unsigned integer and move pointer forward by 4 bytes. - */ - readUint32() { - const E = this._data.getUint32(this.offset, this.littleEndian); - return this.offset += 4, E; - } - /** - * Read a 32-bit floating number and move pointer forward by 4 bytes. - */ - readFloat32() { - const E = this._data.getFloat32(this.offset, this.littleEndian); - return this.offset += 4, E; - } - /** - * Read a 64-bit floating number and move pointer forward by 8 bytes. - */ - readFloat64() { - const E = this._data.getFloat64(this.offset, this.littleEndian); - return this.offset += 8, E; - } - /** - * Read a 64-bit signed integer number and move pointer forward by 8 bytes. - */ - readBigInt64() { - const E = this._data.getBigInt64(this.offset, this.littleEndian); - return this.offset += 8, E; - } - /** - * Read a 64-bit unsigned integer number and move pointer forward by 8 bytes. - */ - readBigUint64() { - const E = this._data.getBigUint64(this.offset, this.littleEndian); - return this.offset += 8, E; - } - /** - * Read a 1-byte ASCII character and move pointer forward by 1 byte. - */ - readChar() { - return String.fromCharCode(this.readInt8()); - } - /** - * Read `n` 1-byte ASCII characters and move pointer forward by `n` bytes. - */ - readChars(E = 1) { - let c = ""; - for (let S = 0; S < E; S++) - c += this.readChar(); - return c; - } - /** - * Read the next `n` bytes, return a UTF-8 decoded string and move pointer - * forward by `n` bytes. - */ - readUtf8(E = 1) { - return (0, n.decode)(this.readBytes(E)); - } - /** - * Read the next `n` bytes, return a string decoded with `encoding` and move pointer - * forward by `n` bytes. - * If no encoding is passed, the function is equivalent to @see {@link IOBuffer#readUtf8} - */ - decodeText(E = 1, c = "utf-8") { - return (0, n.decode)(this.readBytes(E), c); - } - /** - * Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer - * forward by 1 byte. - */ - writeBoolean(E) { - return this.writeUint8(E ? 255 : 0), this; - } - /** - * Write `value` as an 8-bit signed integer and move pointer forward by 1 byte. - */ - writeInt8(E) { - return this.ensureAvailable(1), this._data.setInt8(this.offset++, E), this._updateLastWrittenByte(), this; - } - /** - * Write `value` as an 8-bit unsigned integer and move pointer forward by 1 - * byte. - */ - writeUint8(E) { - return this.ensureAvailable(1), this._data.setUint8(this.offset++, E), this._updateLastWrittenByte(), this; - } - /** - * An alias for {@link IOBuffer#writeUint8}. - */ - writeByte(E) { - return this.writeUint8(E); - } - /** - * Write all elements of `bytes` as uint8 values and move pointer forward by - * `bytes.length` bytes. - */ - writeBytes(E) { - this.ensureAvailable(E.length); - for (let c = 0; c < E.length; c++) - this._data.setUint8(this.offset++, E[c]); - return this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 16-bit signed integer and move pointer forward by 2 - * bytes. - */ - writeInt16(E) { - return this.ensureAvailable(2), this._data.setInt16(this.offset, E, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 16-bit unsigned integer and move pointer forward by 2 - * bytes. - */ - writeUint16(E) { - return this.ensureAvailable(2), this._data.setUint16(this.offset, E, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 32-bit signed integer and move pointer forward by 4 - * bytes. - */ - writeInt32(E) { - return this.ensureAvailable(4), this._data.setInt32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 32-bit unsigned integer and move pointer forward by 4 - * bytes. - */ - writeUint32(E) { - return this.ensureAvailable(4), this._data.setUint32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 32-bit floating number and move pointer forward by 4 - * bytes. - */ - writeFloat32(E) { - return this.ensureAvailable(4), this._data.setFloat32(this.offset, E, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 64-bit floating number and move pointer forward by 8 - * bytes. - */ - writeFloat64(E) { - return this.ensureAvailable(8), this._data.setFloat64(this.offset, E, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 64-bit signed bigint and move pointer forward by 8 - * bytes. - */ - writeBigInt64(E) { - return this.ensureAvailable(8), this._data.setBigInt64(this.offset, E, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this; - } - /** - * Write `value` as a 64-bit unsigned bigint and move pointer forward by 8 - * bytes. - */ - writeBigUint64(E) { - return this.ensureAvailable(8), this._data.setBigUint64(this.offset, E, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this; - } - /** - * Write the charCode of `str`'s first character as an 8-bit unsigned integer - * and move pointer forward by 1 byte. - */ - writeChar(E) { - return this.writeUint8(E.charCodeAt(0)); - } - /** - * Write the charCodes of all `str`'s characters as 8-bit unsigned integers - * and move pointer forward by `str.length` bytes. - */ - writeChars(E) { - for (let c = 0; c < E.length; c++) - this.writeUint8(E.charCodeAt(c)); - return this; - } - /** - * UTF-8 encode and write `str` to the current pointer offset and move pointer - * forward according to the encoded length. - */ - writeUtf8(E) { - return this.writeBytes((0, n.encode)(E)); - } - /** - * Export a Uint8Array view of the internal buffer. - * The view starts at the byte offset and its length - * is calculated to stop at the last written byte or the original length. - */ - toArray() { - return new Uint8Array(this.buffer, this.byteOffset, this.lastWrittenByte); - } - /** - * Update the last written byte offset - * @private - */ - _updateLastWrittenByte() { - this.offset > this.lastWrittenByte && (this.lastWrittenByte = this.offset); - } - } - } - ), - /***/ - "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js": ( - /*!*****************************************************************!*\ - !*** ./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js ***! - \*****************************************************************/ - /***/ - function() { - (function(t) { - if (t.TextEncoder && t.TextDecoder) - return !1; - function e(n = "utf-8") { - if (n !== "utf-8") - throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${n}') is invalid.`); - } - Object.defineProperty(e.prototype, "encoding", { - value: "utf-8" - }), e.prototype.encode = function(n, f = { stream: !1 }) { - if (f.stream) - throw new Error("Failed to encode: the 'stream' option is unsupported."); - let u = 0; - const b = n.length; - let h = 0, _ = Math.max(32, b + (b >> 1) + 7), E = new Uint8Array(_ >> 3 << 3); - for (; u < b; ) { - let c = n.charCodeAt(u++); - if (c >= 55296 && c <= 56319) { - if (u < b) { - const S = n.charCodeAt(u); - (S & 64512) === 56320 && (++u, c = ((c & 1023) << 10) + (S & 1023) + 65536); - } - if (c >= 55296 && c <= 56319) - continue; - } - if (h + 4 > E.length) { - _ += 8, _ *= 1 + u / n.length * 2, _ = _ >> 3 << 3; - const S = new Uint8Array(_); - S.set(E), E = S; - } - if (c & 4294967168) - if (!(c & 4294965248)) - E[h++] = c >> 6 & 31 | 192; - else if (!(c & 4294901760)) - E[h++] = c >> 12 & 15 | 224, E[h++] = c >> 6 & 63 | 128; - else if (!(c & 4292870144)) - E[h++] = c >> 18 & 7 | 240, E[h++] = c >> 12 & 63 | 128, E[h++] = c >> 6 & 63 | 128; - else - continue; - else { - E[h++] = c; - continue; - } - E[h++] = c & 63 | 128; - } - return E.slice(0, h); - }; - function r(n = "utf-8", f = { fatal: !1 }) { - if (n !== "utf-8") - throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${n}') is invalid.`); - if (f.fatal) - throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported."); - } - Object.defineProperty(r.prototype, "encoding", { - value: "utf-8" - }), Object.defineProperty(r.prototype, "fatal", { value: !1 }), Object.defineProperty(r.prototype, "ignoreBOM", { - value: !1 - }), r.prototype.decode = function(n, f = { stream: !1 }) { - if (f.stream) - throw new Error("Failed to decode: the 'stream' option is unsupported."); - const u = new Uint8Array(n); - let b = 0; - const h = u.length, _ = []; - for (; b < h; ) { - const E = u[b++]; - if (E === 0) - break; - if (!(E & 128)) - _.push(E); - else if ((E & 224) === 192) { - const c = u[b++] & 63; - _.push((E & 31) << 6 | c); - } else if ((E & 240) === 224) { - const c = u[b++] & 63, S = u[b++] & 63; - _.push((E & 31) << 12 | c << 6 | S); - } else if ((E & 248) === 240) { - const c = u[b++] & 63, S = u[b++] & 63, y = u[b++] & 63; - let w = (E & 7) << 18 | c << 12 | S << 6 | y; - w > 65535 && (w -= 65536, _.push(w >>> 10 & 1023 | 55296), w = 56320 | w & 1023), _.push(w); - } - } - return String.fromCharCode.apply(null, _); - }, t.TextEncoder = e, t.TextDecoder = r; - })(typeof window < "u" ? window : typeof self < "u" ? self : this); - } - ), - /***/ - "./node_modules/iobuffer/lib-esm/text.browser.js": ( - /*!*******************************************************!*\ - !*** ./node_modules/iobuffer/lib-esm/text.browser.js ***! - \*******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - decode: () => ( - /* binding */ - n - ), - /* harmony export */ - encode: () => ( - /* binding */ - u - ) - /* harmony export */ - }), r( - /*! ./text-encoding-polyfill */ - "./node_modules/iobuffer/lib-esm/text-encoding-polyfill.js" - ); - function n(b, h = "utf8") { - return new TextDecoder(h).decode(b); - } - const f = new TextEncoder(); - function u(b) { - return f.encode(b); - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/data.js": ( - /*!***********************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/data.js ***! - \***********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - nonRecord: () => ( - /* binding */ - f - ), - /* harmony export */ - record: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./types */ - "./node_modules/netcdfjs/lib-esm/types.js" - ); - function f(b, h) { - const _ = (0, n.str2num)(h.type), E = h.size / (0, n.num2bytes)(_), c = new Array(E); - for (let S = 0; S < E; S++) - c[S] = (0, n.readType)(b, _, 1); - return c; - } - function u(b, h, _) { - const E = (0, n.str2num)(h.type), c = h.size ? h.size / (0, n.num2bytes)(E) : 1, S = _.length, y = new Array(S), w = _.recordStep; - if (w) - for (let L = 0; L < S; L++) { - const s = b.offset; - y[L] = (0, n.readType)(b, E, c), b.seek(s + w); - } - else - throw new Error("recordDimension.recordStep is undefined"); - return y; - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/header.js": ( - /*!*************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/header.js ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - header: () => ( - /* binding */ - c - ) - /* harmony export */ - }); - var n = r( - /*! ./types */ - "./node_modules/netcdfjs/lib-esm/types.js" - ), f = r( - /*! ./utils */ - "./node_modules/netcdfjs/lib-esm/utils.js" - ); - const u = 0, b = 10, h = 11, _ = 12, E = 0; - function c(L, s) { - const o = { version: s }, A = { - length: L.readUint32() - }, p = S(L); - Array.isArray(p) || (A.id = p.recordId, A.name = p.recordName, o.dimensions = p.dimensions), o.globalAttributes = y(L); - const v = w(L, A == null ? void 0 : A.id, s); - return Array.isArray(v) || (o.variables = v.variables, A.recordStep = v.recordStep), o.recordDimension = A, o; - } - function S(L) { - const s = {}; - let o, A; - const p = L.readUint32(); - let v; - if (p === u) - return (0, f.notNetcdf)(L.readUint32() !== u, "wrong empty tag for list of dimensions"), []; - { - (0, f.notNetcdf)(p !== b, "wrong tag for list of dimensions"); - const a = L.readUint32(); - v = new Array(a); - for (let l = 0; l < a; l++) { - const g = (0, f.readName)(L), M = L.readUint32(); - M === E && (o = l, A = g), v[l] = { - name: g, - size: M - }; - } - } - return o !== void 0 && (s.recordId = o), A !== void 0 && (s.recordName = A), s.dimensions = v, s; - } - function y(L) { - const s = L.readUint32(); - let o; - if (s === u) - return (0, f.notNetcdf)(L.readUint32() !== u, "wrong empty tag for list of attributes"), []; - { - (0, f.notNetcdf)(s !== _, "wrong tag for list of attributes"); - const A = L.readUint32(); - o = new Array(A); - for (let p = 0; p < A; p++) { - const v = (0, f.readName)(L), a = L.readUint32(); - (0, f.notNetcdf)(a < 1 || a > 6, `non valid type ${a}`); - const l = L.readUint32(), g = (0, n.readType)(L, a, l); - (0, f.padding)(L), o[p] = { - name: v, - type: (0, n.num2str)(a), - value: g - }; - } - } - return o; - } - function w(L, s, o) { - const A = L.readUint32(); - let p = 0, v; - if (A === u) - return (0, f.notNetcdf)(L.readUint32() !== u, "wrong empty tag for list of variables"), []; - { - (0, f.notNetcdf)(A !== h, "wrong tag for list of variables"); - const a = L.readUint32(); - v = new Array(a); - for (let l = 0; l < a; l++) { - const g = (0, f.readName)(L), M = L.readUint32(), C = new Array(M); - for (let z = 0; z < M; z++) - C[z] = L.readUint32(); - const T = y(L), D = L.readUint32(); - (0, f.notNetcdf)(D < 1 && D > 6, `non valid type ${D}`); - const I = L.readUint32(); - let B = L.readUint32(); - o === 2 && ((0, f.notNetcdf)(B > 0, "offsets larger than 4GB not supported"), B = L.readUint32()); - let P = !1; - typeof s < "u" && C[0] === s && (p += I, P = !0), v[l] = { - name: g, - dimensions: C, - attributes: T, - type: (0, n.num2str)(D), - size: I, - offset: B, - record: P - }; - } - } - return { - variables: v, - recordStep: p - }; - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/index.js": ( - /*!************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/index.js ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - NetCDFReader: () => ( - /* reexport safe */ - n.NetCDFReader - ) - /* harmony export */ - }); - var n = r( - /*! ./parser */ - "./node_modules/netcdfjs/lib-esm/parser.js" - ); - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/parser.js": ( - /*!*************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/parser.js ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - NetCDFReader: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! iobuffer */ - "./node_modules/iobuffer/lib-esm/IOBuffer.js" - ), f = r( - /*! ./data */ - "./node_modules/netcdfjs/lib-esm/data.js" - ), u = r( - /*! ./header */ - "./node_modules/netcdfjs/lib-esm/header.js" - ), b = r( - /*! ./toString */ - "./node_modules/netcdfjs/lib-esm/toString.js" - ), h = r( - /*! ./utils */ - "./node_modules/netcdfjs/lib-esm/utils.js" - ); - class _ { - constructor(c) { - this.toString = b.toString; - const S = new n.IOBuffer(c); - S.setBigEndian(), (0, h.notNetcdf)(S.readChars(3) !== "CDF", "should start with CDF"); - const y = S.readByte(); - (0, h.notNetcdf)(y > 2, "unknown version"), this.header = (0, u.header)(S, y), this.buffer = S; - } - /** - * @return - Version for the NetCDF format - */ - get version() { - return this.header.version === 1 ? "classic format" : "64-bit offset format"; - } - /** - * @return {object} - Metadata for the record dimension - * * `length`: Number of elements in the record dimension - * * `id`: Id number in the list of dimensions for the record dimension - * * `name`: String with the name of the record dimension - * * `recordStep`: Number with the record variables step size - */ - get recordDimension() { - return this.header.recordDimension; - } - /** - * @return - Array - List of dimensions with: - * * `name`: String with the name of the dimension - * * `size`: Number with the size of the dimension - */ - get dimensions() { - return this.header.dimensions; - } - /** - * @return - Array - List of global attributes with: - * * `name`: String with the name of the attribute - * * `type`: String with the type of the attribute - * * `value`: A number or string with the value of the attribute - */ - get globalAttributes() { - return this.header.globalAttributes; - } - /** - * Returns the value of an attribute - * @param - AttributeName - * @return - Value of the attributeName or null - */ - getAttribute(c) { - const S = this.globalAttributes.find((y) => y.name === c); - return S ? S.value : null; - } - /** - * Returns the value of a variable as a string - * @param - variableName - * @return - Value of the variable as a string or null - */ - getDataVariableAsString(c) { - const S = this.getDataVariable(c); - return S ? S.join("") : null; - } - get variables() { - return this.header.variables; - } - /** - * Retrieves the data for a given variable - * @param variableName - Name of the variable to search or variable object - * @return The variable values - */ - getDataVariable(c) { - let S; - if (typeof c == "string" ? S = this.header.variables.find((y) => y.name === c) : S = c, S === void 0) - throw new Error("Not a valid NetCDF v3.x file: variable not found"); - return this.buffer.seek(S.offset), S.record ? (0, f.record)(this.buffer, S, this.header.recordDimension) : (0, f.nonRecord)(this.buffer, S); - } - /** - * Check if a dataVariable exists - * @param variableName - Name of the variable to find - * @return boolean - */ - dataVariableExists(c) { - return this.header.variables.find((y) => y.name === c) !== void 0; - } - /** - * Check if an attribute exists - * @param attributeName - Name of the attribute to find - * @return boolean - */ - attributeExists(c) { - return this.globalAttributes.find((y) => y.name === c) !== void 0; - } - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/toString.js": ( - /*!***************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/toString.js ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - toString: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n() { - const f = []; - f.push("DIMENSIONS"); - for (const b of this.dimensions) - f.push(` ${b.name.padEnd(30)} = size: ${b.size}`); - f.push(""), f.push("GLOBAL ATTRIBUTES"); - for (const b of this.globalAttributes) - f.push(` ${b.name.padEnd(30)} = ${b.value}`); - const u = JSON.parse(JSON.stringify(this.variables)); - f.push(""), f.push("VARIABLES:"); - for (const b of u) { - b.value = this.getDataVariable(b); - let h = JSON.stringify(b.value); - h.length > 50 && (h = h.substring(0, 50)), isNaN(b.value.length) || (h += ` (length: ${b.value.length})`), f.push(` ${b.name.padEnd(30)} = ${h}`); - } - return f.join(` -`); - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/types.js": ( - /*!************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/types.js ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - num2bytes: () => ( - /* binding */ - u - ), - /* harmony export */ - num2str: () => ( - /* binding */ - f - ), - /* harmony export */ - readType: () => ( - /* binding */ - _ - ), - /* harmony export */ - str2num: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - const n = { - BYTE: 1, - CHAR: 2, - SHORT: 3, - INT: 4, - FLOAT: 5, - DOUBLE: 6 - }; - function f(c) { - switch (Number(c)) { - case n.BYTE: - return "byte"; - case n.CHAR: - return "char"; - case n.SHORT: - return "short"; - case n.INT: - return "int"; - case n.FLOAT: - return "float"; - case n.DOUBLE: - return "double"; - default: - return "undefined"; - } - } - function u(c) { - switch (Number(c)) { - case n.BYTE: - return 1; - case n.CHAR: - return 1; - case n.SHORT: - return 2; - case n.INT: - return 4; - case n.FLOAT: - return 4; - case n.DOUBLE: - return 8; - default: - return -1; - } - } - function b(c) { - switch (String(c)) { - case "byte": - return n.BYTE; - case "char": - return n.CHAR; - case "short": - return n.SHORT; - case "int": - return n.INT; - case "float": - return n.FLOAT; - case "double": - return n.DOUBLE; - default: - return -1; - } - } - function h(c, S) { - if (c !== 1) { - const y = new Array(c); - for (let w = 0; w < c; w++) - y[w] = S(); - return y; - } else - return S(); - } - function _(c, S, y) { - switch (S) { - case n.BYTE: - return Array.from(c.readBytes(y)); - case n.CHAR: - return E(c.readChars(y)); - case n.SHORT: - return h(y, c.readInt16.bind(c)); - case n.INT: - return h(y, c.readInt32.bind(c)); - case n.FLOAT: - return h(y, c.readFloat32.bind(c)); - case n.DOUBLE: - return h(y, c.readFloat64.bind(c)); - default: - throw new Error(`non valid type ${S}`); - } - } - function E(c) { - return c.charCodeAt(c.length - 1) === 0 ? c.substring(0, c.length - 1) : c; - } - } - ), - /***/ - "./node_modules/netcdfjs/lib-esm/utils.js": ( - /*!************************************************!*\ - !*** ./node_modules/netcdfjs/lib-esm/utils.js ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - notNetcdf: () => ( - /* binding */ - n - ), - /* harmony export */ - padding: () => ( - /* binding */ - f - ), - /* harmony export */ - readName: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - function n(b, h) { - if (b) - throw new TypeError(`Not a valid NetCDF v3.x file: ${h}`); - } - function f(b) { - b.offset % 4 !== 0 && b.skip(4 - b.offset % 4); - } - function u(b) { - const h = b.readUint32(), _ = b.readChars(h); - return f(b), _; - } - } - ), - /***/ - "./src/WebGL/shaders/lib/basic/basic.frag": ( - /*!************************************************!*\ - !*** ./src/WebGL/shaders/lib/basic/basic.frag ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 viewMatrix; -uniform float opacity; -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; -varying vec3 vColor; -//DEFINEFRAGCOLOR -void main() { - gl_FragColor = vec4( vColor, opacity ); - float depth = gl_FragCoord.z / gl_FragCoord.w; - float fogFactor = smoothstep( fogNear, fogFar, depth ); - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); -}`; - } - ), - /***/ - "./src/WebGL/shaders/lib/basic/basic.vert": ( - /*!************************************************!*\ - !*** ./src/WebGL/shaders/lib/basic/basic.vert ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; - -attribute vec3 position; -attribute vec3 color; - -varying vec3 vColor; - -void main() { - - vColor = color; - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix * mvPosition; - -}`; - } - ), - /***/ - "./src/WebGL/shaders/lib/instanced/instanced.frag": ( - /*!********************************************************!*\ - !*** ./src/WebGL/shaders/lib/instanced/instanced.frag ***! - \********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 viewMatrix; -uniform float opacity; - -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; - -varying vec3 vLightFront; -varying vec3 vColor; -//DEFINEFRAGCOLOR - -void main() { - - gl_FragColor = vec4( vec3 ( 1.0 ), opacity ); - - #ifndef WIREFRAME - gl_FragColor.xyz *= vLightFront; - #endif - - gl_FragColor = gl_FragColor * vec4( vColor, opacity ); - float depth = gl_FragCoord.z / gl_FragCoord.w; - - float fogFactor = smoothstep( fogNear, fogFar, depth ); - - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); - -} - - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/instanced/instanced.vert": ( - /*!********************************************************!*\ - !*** ./src/WebGL/shaders/lib/instanced/instanced.vert ***! - \********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; - -attribute vec3 offset; -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; -attribute float radius; - -varying vec3 vColor; -varying vec3 vLightFront; - -void main() { - - vColor = color; - - vec3 objectNormal = normal; - vec3 transformedNormal = normalMatrix * objectNormal; - vec4 mvPosition = modelViewMatrix * vec4( position * radius + offset, 1.0 ); - - vLightFront = vec3( 0.0 ); - - transformedNormal = normalize( transformedNormal ); - - vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 ); - vec3 dirVector = normalize( lDirection.xyz ); - float dotProduct = dot( transformedNormal, dirVector ); - vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) ); - - vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting; - - gl_Position = projectionMatrix * mvPosition; -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambert/lambert.frag": ( - /*!****************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambert/lambert.frag ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 viewMatrix; -uniform float opacity; - -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; - -varying vec3 vLightFront; -varying vec3 vColor; -//DEFINEFRAGCOLOR - -void main() { - - gl_FragColor = vec4( vec3 ( 1.0 ), opacity ); - - #ifndef WIREFRAME - gl_FragColor.xyz *= vLightFront; - #endif - - gl_FragColor = gl_FragColor * vec4( vColor, opacity ); - float depth = gl_FragCoord.z / gl_FragCoord.w; - - float fogFactor = smoothstep( fogNear, fogFar, depth ); - - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); - -}`; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambert/lambert.vert": ( - /*!****************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambert/lambert.vert ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; - -varying vec3 vColor; -varying vec3 vLightFront; - -void main() { - - vColor = color; - - vec3 objectNormal = normal; - vec3 transformedNormal = normalMatrix * objectNormal; - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - - vLightFront = vec3( 0.0 ); - - transformedNormal = normalize( transformedNormal ); - - vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 ); - vec3 dirVector = normalize( lDirection.xyz ); - float dotProduct = dot( transformedNormal, dirVector ); - vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) ); - - vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting; - - gl_Position = projectionMatrix * mvPosition; -}`; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag": ( - /*!****************************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag ***! - \****************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 viewMatrix; -uniform float opacity; - -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; - -varying vec3 vLightFront; -varying vec3 vLightBack; - -varying vec3 vColor; -//DEFINEFRAGCOLOR - -void main() { - - gl_FragColor = vec4( vec3 ( 1.0 ), opacity ); - - #ifndef WIREFRAME - if ( gl_FrontFacing ) - gl_FragColor.xyz *= vLightFront; - else - gl_FragColor.xyz *= vLightBack; - #endif - - gl_FragColor = gl_FragColor * vec4( vColor, opacity ); - float depth = gl_FragCoord.z / gl_FragCoord.w; - - float fogFactor = smoothstep( fogNear, fogFar, depth ); - - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); - -} - - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert": ( - /*!****************************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert ***! - \****************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; - -varying vec3 vColor; -varying vec3 vLightFront; -varying vec3 vLightBack; - -void main() { - - vColor = color; - - vec3 objectNormal = normal; - vec3 transformedNormal = normalMatrix * objectNormal; - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - - vLightFront = vec3( 0.0 ); - vLightBack = vec3( 0.0 ); - - transformedNormal = normalize( transformedNormal ); - - vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 ); - vec3 dirVector = normalize( lDirection.xyz ); - float dotProduct = dot( transformedNormal, dirVector ); - vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) ); - vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) ); - - vLightFront += directionalLightColor[ 0 ] * directionalLightWeighting; - vLightBack += directionalLightColor[ 0 ] * directionalLightWeightingBack; - - gl_Position = projectionMatrix * mvPosition; -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/outline/outline.frag": ( - /*!****************************************************!*\ - !*** ./src/WebGL/shaders/lib/outline/outline.frag ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform float opacity; -uniform vec3 outlineColor; -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; -//DEFINEFRAGCOLOR - -void main() { - gl_FragColor = vec4( outlineColor, 1 ); -} - - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/outline/outline.vert": ( - /*!****************************************************!*\ - !*** ./src/WebGL/shaders/lib/outline/outline.vert ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform float outlineWidth; -uniform float outlinePushback; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; - -void main() { - - vec4 norm = modelViewMatrix*vec4(normalize(normal),0.0); - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - mvPosition.xy += norm.xy*outlineWidth; - gl_Position = projectionMatrix * mvPosition; - mvPosition.z -= outlinePushback; //go backwards in model space - vec4 pushpos = projectionMatrix*mvPosition; //project to get z in projection space, I'm probably missing some simple math to do the same thing.. - gl_Position.z = gl_Position.w*pushpos.z/pushpos.w; -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/screen/screen.frag": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/screen/screen.frag ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform sampler2D colormap; -varying highp vec2 vTexCoords; -uniform vec2 dimensions; -//DEFINEFRAGCOLOR -void main (void) { - gl_FragColor = texture2D(colormap, vTexCoords); -} - `; - } - ), - /***/ - "./src/WebGL/shaders/lib/screen/screen.vert": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/screen/screen.vert ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `attribute vec2 vertexPosition; -varying highp vec2 vTexCoords; -const vec2 scale = vec2(0.5, 0.5); - -void main() { - vTexCoords = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range - gl_Position = vec4(vertexPosition, 0.0, 1.0); -} - `; - } - ), - /***/ - "./src/WebGL/shaders/lib/screenaa/screenaa.frag": ( - /*!******************************************************!*\ - !*** ./src/WebGL/shaders/lib/screenaa/screenaa.frag ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform sampler2D colormap; -varying highp vec2 vTexCoords; -uniform vec2 dimensions; - -// Basic FXAA implementation based on the code on geeks3d.com -#define FXAA_REDUCE_MIN (1.0/ 128.0) -#define FXAA_REDUCE_MUL (1.0 / 8.0) -#define FXAA_SPAN_MAX 8.0 - -vec4 applyFXAA(vec2 fragCoord, sampler2D tex) -{ - vec4 color; - vec2 inverseVP = vec2(1.0 / dimensions.x, 1.0 / dimensions.y); - vec3 rgbNW = texture2D(tex, fragCoord + vec2(-1.0, -1.0) * inverseVP).xyz; - vec3 rgbNE = texture2D(tex, fragCoord + vec2(1.0, -1.0) * inverseVP).xyz; - vec3 rgbSW = texture2D(tex, fragCoord + vec2(-1.0, 1.0) * inverseVP).xyz; - vec3 rgbSE = texture2D(tex, fragCoord + vec2(1.0, 1.0) * inverseVP).xyz; - vec3 rgbM = texture2D(tex, fragCoord * inverseVP).xyz; - vec3 luma = vec3(0.299, 0.587, 0.114); - float lumaNW = dot(rgbNW, luma); - float lumaNE = dot(rgbNE, luma); - float lumaSW = dot(rgbSW, luma); - float lumaSE = dot(rgbSE, luma); - float lumaM = dot(rgbM, luma); - float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); - float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); - - vec2 dir; - dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); - dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); - - float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * - (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); - - float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); - dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), - max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), - dir * rcpDirMin)) * inverseVP; - - vec3 rgbA = 0.5 * ( - texture2D(tex, fragCoord + dir * (1.0 / 3.0 - 0.5)).xyz + - texture2D(tex, fragCoord + dir * (2.0 / 3.0 - 0.5)).xyz); - vec3 rgbB = rgbA * 0.5 + 0.25 * ( - texture2D(tex, fragCoord + dir * -0.5).xyz + - texture2D(tex, fragCoord + dir * 0.5).xyz); - - float lumaB = dot(rgbB, luma); - if ((lumaB < lumaMin) || (lumaB > lumaMax)) - color = vec4(rgbA, 1.0); - else - color = vec4(rgbB, 1.0); - return color; -} -//DEFINEFRAGCOLOR -void main (void) { - gl_FragColor = applyFXAA(vTexCoords, colormap); -} - `; - } - ), - /***/ - "./src/WebGL/shaders/lib/screenaa/screenaa.vert": ( - /*!******************************************************!*\ - !*** ./src/WebGL/shaders/lib/screenaa/screenaa.vert ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `attribute vec2 vertexPosition; -varying highp vec2 vTexCoords; -const vec2 scale = vec2(0.5, 0.5); - -void main() { - vTexCoords = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range - gl_Position = vec4(vertexPosition, 0.0, 1.0); -} - `; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag": ( - /*!******************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag ***! - \******************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` -uniform mat4 viewMatrix; -uniform float opacity; -uniform mat4 projectionMatrix; - -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; -uniform float uDepth; -uniform vec3 directionalLightColor[ 1 ]; - -varying vec3 vColor; -varying vec2 mapping; -varying float rval; -varying vec3 vLight; -varying vec3 center; - -//DEFINEFRAGCOLOR - -void main() { - float lensqr = dot(mapping,mapping); - float rsqr = rval*rval; - if(lensqr > rsqr) - discard; - float z = sqrt(rsqr-lensqr); - vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z); - vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0); - float ndcDepth = clipPos.z / clipPos.w; - gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0; - vec3 norm = normalize(vec3(mapping.x,mapping.y,z)); - float dotProduct = dot( norm, vLight ); - vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) ); - vec3 vLight = directionalLightColor[ 0 ] * directionalLightWeighting; - gl_FragColor = vec4(vLight*vColor, opacity*opacity ); - float fogFactor = smoothstep( fogNear, fogFar, gl_FragDepthEXT/gl_FragCoord.w ); - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); - - -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert": ( - /*!******************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert ***! - \******************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; - -varying vec2 mapping; -varying vec3 vColor; -varying float rval; -varying vec3 vLight; -varying vec3 center; - -void main() { - - vColor = color; - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - center = mvPosition.xyz; - vec4 projPosition = projectionMatrix * mvPosition; - vec4 adjust = projectionMatrix* vec4(normal,0.0); adjust.z = 0.0; adjust.w = 0.0; - vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 ); - vLight = normalize( lDirection.xyz ); - mapping = normal.xy; - rval = abs(normal.x); - gl_Position = projPosition+adjust; - -} -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag": ( - /*!********************************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag ***! - \********************************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform float opacity; -uniform vec3 outlineColor; -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; -uniform mat4 projectionMatrix; -varying vec2 mapping; -varying float rval; -varying vec3 center; - -uniform float outlinePushback; - -//DEFINEFRAGCOLOR - -void main() { - float lensqr = dot(mapping,mapping); - float rsqr = rval*rval; - if(lensqr > rsqr) - discard; - float z = sqrt(rsqr-lensqr); - vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z-outlinePushback); - vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0); - float ndcDepth = clipPos.z / clipPos.w; - gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0; - gl_FragColor = vec4(outlineColor, 1 ); -} - - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert": ( - /*!********************************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert ***! - \********************************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform float outlineWidth; -uniform float outlinePushback; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; - -varying vec2 mapping; -varying float rval; -varying vec3 center; - -void main() { - - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - center = mvPosition.xyz; - vec4 projPosition = projectionMatrix * mvPosition; - vec2 norm = normal.xy + vec2(sign(normal.x)*outlineWidth,sign(normal.y)*outlineWidth); - vec4 adjust = projectionMatrix* vec4(norm,normal.z,0.0); adjust.z = 0.0; adjust.w = 0.0; - mapping = norm.xy; - rval = abs(norm.x); - gl_Position = projPosition+adjust; -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/sprite/sprite.frag": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/sprite/sprite.frag ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform vec3 color; -uniform sampler2D map; -uniform float opacity; - -uniform int fogType; -uniform vec3 fogColor; -uniform float fogDensity; -uniform float fogNear; -uniform float fogFar; -uniform float alphaTest; - -varying vec2 vUV; -//DEFINEFRAGCOLOR - -void main() { - - vec4 texture = texture2D(map, vUV); - - if (texture.a < alphaTest) discard; - - gl_FragColor = vec4(color * texture.xyz, texture.a * opacity); - - if (fogType > 0) { - - float depth = gl_FragCoord.z / gl_FragCoord.w; - float fogFactor = 0.0; - - if (fogType == 1) { - fogFactor = smoothstep(fogNear, fogFar, depth); - } - - else { - const float LOG2 = 1.442695; - float fogFactor = exp2(- fogDensity * fogDensity * depth * depth * LOG2); - fogFactor = 1.0 - clamp(fogFactor, 0.0, 1.0); - } - - gl_FragColor = mix(gl_FragColor, vec4(fogColor, gl_FragColor.w), fogFactor); - - } -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/sprite/sprite.vert": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/sprite/sprite.vert ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform int useScreenCoordinates; -uniform vec3 screenPosition; -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform float rotation; -uniform vec2 scale; -uniform vec2 alignment; -uniform vec2 uvOffset; -uniform vec2 uvScale; - -attribute vec2 position; -attribute vec2 uv; - -varying vec2 vUV; - -void main() { - - vUV = uvOffset + uv * uvScale; - - vec2 alignedPosition = position + alignment; - - vec2 rotatedPosition; - rotatedPosition.x = ( cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y ) * scale.x; - rotatedPosition.y = ( sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y ) * scale.y; - - vec4 finalPosition; - - if(useScreenCoordinates != 0) { - finalPosition = vec4(screenPosition.xy + rotatedPosition, screenPosition.z, 1.0); - } - - else { - finalPosition = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0); finalPosition /= finalPosition.w; - finalPosition.xy += rotatedPosition; - } - - gl_Position = finalPosition; - -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag": ( - /*!************************************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag ***! - \************************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` float dotProduct = dot( norm, vLight ); - vec3 light = vec3( max( dotProduct, 0.0 ) ); - gl_FragColor = vec4(light*color, opacity*opacity ); - float fogFactor = smoothstep( fogNear, fogFar, depth ); - gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor ); -}`; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert": ( - /*!****************************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposter/stickimposter.vert ***! - \****************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; -attribute float radius; - -varying vec3 vColor; -varying vec3 vLight; -varying vec3 cposition; -varying vec3 p1; -varying vec3 p2; -varying float r; - -void main() { - - vColor = color; vColor.z = abs(vColor.z); //z indicates which vertex and so would vary - r = abs(radius); - vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder - vec4 pt = modelViewMatrix*vec4(position, 1.0); - vec4 mvPosition = pt; - p1 = pt.xyz; p2 = to.xyz; - vec3 norm = to.xyz-pt.xyz; - float mult = 1.1; //slop to account for perspective of sphere - if(length(p1) > length(p2)) { //billboard at level of closest point - mvPosition = to; - } - vec3 n = normalize(mvPosition.xyz); -//intersect with the plane defined by the camera looking at the billboard point - if(color.z >= 0.0) { //p1 - if(projectionMatrix[3][3] == 0.0) { //perspective - vec3 pnorm = normalize(p1); - float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n); - mvPosition.xyz = p1+t*pnorm; - } else { //orthographic - mvPosition.xyz = p1; - } - } else { - if(projectionMatrix[3][3] == 0.0) { //perspective - vec3 pnorm = normalize(p2); - float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n); - mvPosition.xyz = p2+t*pnorm; - } else { //orthographic - mvPosition.xyz = p2; - } - mult *= -1.0; - } - vec3 cr = normalize(cross(mvPosition.xyz,norm))*radius; - vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*radius; - mvPosition.xyz += mult*(cr + doublecr).xyz; - cposition = mvPosition.xyz; - gl_Position = projectionMatrix * mvPosition; - vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 ); - vLight = normalize( lDirection.xyz )*directionalLightColor[0]; //not really sure this is right, but color is always white so.. -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert": ( - /*!******************************************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert ***! - \******************************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` - -uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; -uniform mat3 normalMatrix; -uniform vec3 directionalLightColor[ 1 ]; -uniform vec3 directionalLightDirection[ 1 ]; -uniform vec3 outlineColor; -uniform float outlineWidth; -uniform float outlinePushback; - - -attribute vec3 position; -attribute vec3 normal; -attribute vec3 color; -attribute float radius; - -varying vec3 vColor; -varying vec3 vLight; -varying vec3 cposition; -varying vec3 p1; -varying vec3 p2; -varying float r; - -void main() { - - vColor = outlineColor; - float rad = radius+sign(radius)*outlineWidth; - r = abs(rad); - vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder - vec4 pt = modelViewMatrix*vec4(position, 1.0); -//pushback - to.xyz += normalize(to.xyz)*outlinePushback; - pt.xyz += normalize(pt.xyz)*outlinePushback; - - vec4 mvPosition = pt; - p1 = pt.xyz; p2 = to.xyz; - vec3 norm = to.xyz-pt.xyz; - float mult = 1.1; //slop to account for perspective of sphere - if(length(p1) > length(p2)) { //billboard at level of closest point - mvPosition = to; - } - vec3 n = normalize(mvPosition.xyz); -//intersect with the plane defined by the camera looking at the billboard point - if(color.z >= 0.0) { //p1 - vec3 pnorm = normalize(p1); - float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n); - mvPosition.xyz = p1+t*pnorm; - } else { - vec3 pnorm = normalize(p2); - float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n); - mvPosition.xyz = p2+t*pnorm; - mult *= -1.0; - } - vec3 cr = normalize(cross(mvPosition.xyz,norm))*rad; - vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*rad; - mvPosition.xy += mult*(cr + doublecr).xy; - cposition = mvPosition.xyz; - gl_Position = projectionMatrix * mvPosition; - vLight = vec3(1.0,1.0,1.0); -} - -`; - } - ), - /***/ - "./src/WebGL/shaders/lib/volumetric/volumetric.frag": ( - /*!**********************************************************!*\ - !*** ./src/WebGL/shaders/lib/volumetric/volumetric.frag ***! - \**********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = ` -uniform highp sampler3D data; -uniform highp sampler2D colormap; -uniform highp sampler2D depthmap; - - -uniform mat4 textmat; -uniform mat4 projinv; -uniform mat4 projectionMatrix; - -uniform float step; -uniform float subsamples; -uniform float maxdepth; -uniform float transfermin; -uniform float transfermax; -in vec4 mvPosition; -out vec4 color; -void main(void) { - - vec4 pos = mvPosition; - bool seengood = false; - float i = 0.0; - color = vec4(1,1,1,0); - float increment = 1.0/subsamples; - float maxsteps = (maxdepth*subsamples/step); -//there's probably a better way to do this.. -//calculate farthest possible point in model coordinates - vec4 maxpos = vec4(pos.x,pos.y,pos.z-maxdepth,1.0); -// convert to projection - maxpos = projectionMatrix*maxpos; - vec4 startp = projectionMatrix*pos; -// homogonize - maxpos /= maxpos.w; - startp /= startp.w; -//take x,y from start and z from max - maxpos = vec4(startp.x,startp.y,maxpos.z,1.0); -//convert back to model space - maxpos = projinv*maxpos; - maxpos /= maxpos.w; - float incr = step/subsamples; -//get depth from depthmap -//startp is apparently [-1,1] - vec2 tpos = startp.xy/2.0+0.5; - float depth = texture(depthmap, tpos).r; -//compute vector between start and end - vec4 direction = maxpos-pos; - for( i = 0.0; i <= maxsteps; i++) { - vec4 pt = (pos+(i/maxsteps)*direction); - vec4 ppt = projectionMatrix*pt; - float ptdepth = ppt.z/ppt.w; - ptdepth = ((gl_DepthRange.diff * ptdepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0; - if(ptdepth > depth) break; - pt = textmat*pt; -// pt /= pt.w; - if(pt.x >= -0.01 && pt.y >= -0.01 && pt.z >= -0.01 && pt.x <= 1.01 && pt.y <= 1.01 && pt.z <= 1.01) { - seengood = true; - } else if(seengood) { - break; - } - if( pt.x < -0.01 || pt.x > 1.01 || pt.y < -0.01 || pt.y > 1.01 || pt.z < -0.01 || pt.z > 1.01 ){ - color.a = 0.0; - continue; - } - else { - float val = texture(data, pt.zyx).r; - if(isinf(val)) continue; //masked out - float cval = (val-transfermin)/(transfermax-transfermin); //scale to texture 0-1 range - vec4 val_color = texture(colormap, vec2(cval,0.5)); - color.rgb = color.rgb*color.a + (1.0-color.a)*val_color.a*val_color.rgb; - color.a += (1.0 - color.a) * val_color.a; - if(color.a > 0.0) color.rgb /= color.a; -// color = vec4(pt.x, pt.y, pt.z, 1.0); - } -// color = vec4(pt.x, pt.y, pt.z, 0.0) - } -} - - `; - } - ), - /***/ - "./src/WebGL/shaders/lib/volumetric/volumetric.vert": ( - /*!**********************************************************!*\ - !*** ./src/WebGL/shaders/lib/volumetric/volumetric.vert ***! - \**********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform mat4 modelViewMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; - -in vec3 position; -out vec4 mvPosition; -void main() { - - mvPosition = modelViewMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix*mvPosition; -} -`; - } - ), - /***/ - "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag": ( - /*!**************************************************************************!*\ - !*** ./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag ***! - \**************************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - default: () => n - /* harmony export */ - }); - const n = `uniform float opacity; -uniform mat4 projectionMatrix; - -uniform vec3 fogColor; -uniform float fogNear; -uniform float fogFar; - -varying vec3 vLight; -varying vec3 vColor; -varying vec3 cposition; -varying vec3 p1; -varying vec3 p2; -varying float r; - -//DEFINEFRAGCOLOR - -//cylinder-ray intersection testing taken from http://mrl.nyu.edu/~dzorin/cg05/lecture12.pdf -//also useful: http://stackoverflow.com/questions/9595300/cylinder-impostor-in-glsl -//with a bit more care (caps) this could be a general cylinder imposter (see also outline) -void main() { - vec3 color = abs(vColor); - vec3 pos = cposition; - vec3 p = pos; //ray point - vec3 v = vec3(0.0,0.0,-1.0); //ray normal - orthographic - if(projectionMatrix[3][3] == 0.0) v = normalize(pos); //ray normal - perspective - vec3 pa = p1; //cyl start - vec3 va = normalize(p2-p1); //cyl norm - vec3 tmp1 = v-(dot(v,va)*va); - vec3 deltap = p-pa; - float A = dot(tmp1,tmp1); - if(A == 0.0) discard; - vec3 tmp2 = deltap-(dot(deltap,va)*va); - float B = 2.0*dot(tmp1, tmp2); - float C = dot(tmp2,tmp2)-r*r; -//quadratic equation! - float det = (B*B) - (4.0*A*C); - if(det < 0.0) discard; - float sqrtDet = sqrt(det); - float posT = (-B+sqrtDet)/(2.0*A); - float negT = (-B-sqrtDet)/(2.0*A); - float intersectionT = min(posT,negT); - vec3 qi = p+v*intersectionT; - float dotp1 = dot(va,qi-p1); - float dotp2 = dot(va,qi-p2); - vec3 norm; - if( dotp1 < 0.0 || dotp2 > 0.0) { //(p-c)^2 + 2(p-c)vt +v^2+t^2 - r^2 = 0 - vec3 cp; - if( dotp1 < 0.0) { -// if(vColor.x < 0.0 ) discard; //color sign bit indicates if we should cap or not - cp = p1; - } else { -// if(vColor.y < 0.0 ) discard; - cp = p2; - } - vec3 diff = p-cp; - A = dot(v,v); - B = dot(diff,v)*2.0; - C = dot(diff,diff)-r*r; - det = (B*B) - (4.0*C); - if(det < 0.0) discard; - sqrtDet = sqrt(det); - posT = (-B+sqrtDet)/(2.0); - negT = (-B-sqrtDet)/(2.0); - float t = min(posT,negT); - qi = p+v*t; - norm = normalize(qi-cp); - } else { - norm = normalize(qi-(dotp1*va + p1)); - } - vec4 clipPos = projectionMatrix * vec4(qi, 1.0); - float ndcDepth = clipPos.z / clipPos.w; - float depth = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0; - gl_FragDepthEXT = depth;`; - } - ), - /***/ - "./src/GLDraw.ts": ( - /*!***********************!*\ - !*** ./src/GLDraw.ts ***! - \***********************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CAP: () => ( - /* binding */ - f - ), - /* harmony export */ - GLDraw: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), f; - (function(b) { - b[b.NONE = 0] = "NONE", b[b.FLAT = 1] = "FLAT", b[b.ROUND = 2] = "ROUND"; - })(f || (f = {})); - var u; - (function(b) { - function h(s, o, A) { - var p = Math.hypot(s, o), v, a, l, g, M; - p < 1e-4 ? (a = 0, l = 1) : (a = -s / p, l = o / p), o = -a * s + l * o, v = Math.hypot(o, A), v < 1e-4 ? (g = 0, M = 1) : (g = A / v, M = o / v); - var C = new Float32Array(9); - return C[0] = l, C[1] = a, C[2] = 0, C[3] = -a * M, C[4] = l * M, C[5] = g, C[6] = a * g, C[7] = -l * g, C[8] = M, C; - } - class _ { - constructor() { - this.cache = {}; - let o = [], A = 4, p = Math.pow(2, A), v = 2, a = Math.pow(2, v), l = p / a, g; - for (o[0] = new n.Vector3(-1, 0, 0), o[l] = new n.Vector3(0, 0, 1), o[l * 2] = new n.Vector3(1, 0, 0), o[l * 3] = new n.Vector3(0, 0, -1), v = 3; v <= A; v++) { - for (a = Math.pow(2, v - 1), l = p / a, g = 0; g < a - 1; g++) - o[l / 2 + g * l] = o[g * l].clone().add(o[(g + 1) * l]).normalize(); - g = a - 1, o[l / 2 + g * l] = o[g * l].clone().add(o[0]).normalize(); - } - this.basisVectors = o; - } - getVerticesForRadius(o, A, p) { - if (typeof this.cache < "u" && this.cache[o] !== void 0 && this.cache[o][A + p] !== void 0) - return this.cache[o][A + p]; - for (var v = this.basisVectors.length, a = [], l = [], g, M = 0; M < v; M++) - a.push(this.basisVectors[M].clone().multiplyScalar(o)), a.push(this.basisVectors[M].clone().multiplyScalar(o)), g = this.basisVectors[M].clone().normalize(), l.push(g), l.push(g); - var C = [], T = 10, D = v, I = 0, B = Math.PI * 2, P = 0, z = Math.PI, k, N, R = !1, U = !1; - for (N = 0; N <= T; N++) { - R = N === 0 || N === T, U = N === T / 2; - var W = [], G = []; - for (k = 0; k <= D; k++) { - if (U) { - var F = k < D ? 2 * k : 0; - G.push(F + 1), W.push(F); - continue; - } - var V = k / D, J = N / T; - if (!R || k === 0) - if (k < D) { - var X = new n.Vector3(); - X.x = -o * Math.cos(I + V * B) * Math.sin(P + J * z), A == 1 ? X.y = 0 : X.y = o * Math.cos(P + J * z), X.z = o * Math.sin(I + V * B) * Math.sin(P + J * z), Math.abs(X.x) < 1e-5 && (X.x = 0), Math.abs(X.y) < 1e-5 && (X.y = 0), Math.abs(X.z) < 1e-5 && (X.z = 0), A == f.FLAT ? (g = new n.Vector3(0, Math.cos(P + J * z), 0), g.normalize()) : (g = new n.Vector3(X.x, X.y, X.z), g.normalize()), a.push(X), l.push(g), W.push(a.length - 1); - } else - W.push(a.length - D); - else - R && W.push(a.length - 1); - } - U && C.push(G), C.push(W); - } - var oe = { - vertices: a, - normals: l, - verticesRows: C, - w: D, - h: T - }; - return o in this.cache || (this.cache[o] = {}), this.cache[o][A + p] = oe, oe; - } - } - var E = new _(); - function c(s, o, A, p, v, a = 0, l = 0) { - if (!(!o || !A)) { - var g = l || a; - v = v || { r: 0, g: 0, b: 0 }; - var M = h(A.x - o.x, A.y - o.y, A.z - o.z), C = E.getVerticesForRadius(p, l, "to"), T = C.w, D = C.h, I = g ? D * T + 2 : 2 * T, B = s.updateGeoGroup(I), P = C.vertices, z = C.normals, k = C.verticesRows, N = k[D / 2], R = k[D / 2 + 1], U = B.vertices, W, G, F, V, J, X, oe = B.vertexArray, te = B.normalArray, ve = B.colorArray, se = B.faceArray; - for (F = 0; F < T; ++F) { - var le = 2 * F; - V = M[0] * P[le].x + M[3] * P[le].y + M[6] * P[le].z, J = M[1] * P[le].x + M[4] * P[le].y + M[7] * P[le].z, X = M[5] * P[le].y + M[8] * P[le].z, W = 3 * (U + le), G = B.faceidx, oe[W] = V + o.x, oe[W + 1] = J + o.y, oe[W + 2] = X + o.z, oe[W + 3] = V + A.x, oe[W + 4] = J + A.y, oe[W + 5] = X + A.z, te[W] = V, te[W + 3] = V, te[W + 1] = J, te[W + 4] = J, te[W + 2] = X, te[W + 5] = X, ve[W] = v.r, ve[W + 3] = v.r, ve[W + 1] = v.g, ve[W + 4] = v.g, ve[W + 2] = v.b, ve[W + 5] = v.b, se[G] = R[F] + U, se[G + 1] = R[F + 1] + U, se[G + 2] = N[F] + U, se[G + 3] = N[F] + U, se[G + 4] = R[F + 1] + U, se[G + 5] = N[F + 1] + U, B.faceidx += 6; - } - if (g) { - var Ce = l ? 0 : D / 2, be = a ? D + 1 : D / 2 + 1, Le, ae, _e, Ee, Be, Ne, Ge, ke, pe, de, ce, Ae, Oe, We, Ue, Z, j, ee, ge, ye, $e, Re, Y, ue, Se, Fe, he, De, K, ze, Ve, $; - for (J = Ce; J < be; J++) - if (J !== D / 2) { - var xe = J <= D / 2 ? A : o, Me = E.getVerticesForRadius(p, l, "to"), Q = E.getVerticesForRadius(p, a, "from"); - for (xe === A ? (P = Me.vertices, z = Me.normals, k = Me.verticesRows) : xe == o && (P = Q.vertices, z = Q.normals, k = Q.verticesRows), V = 0; V < T; V++) - G = B.faceidx, Le = k[J][V + 1], K = (Le + U) * 3, ae = k[J][V], ze = (ae + U) * 3, _e = k[J + 1][V], Ve = (_e + U) * 3, Ee = k[J + 1][V + 1], $ = (Ee + U) * 3, Be = M[0] * P[Le].x + M[3] * P[Le].y + M[6] * P[Le].z, Ne = M[0] * P[ae].x + M[3] * P[ae].y + M[6] * P[ae].z, Ge = M[0] * P[_e].x + M[3] * P[_e].y + M[6] * P[_e].z, ke = M[0] * P[Ee].x + M[3] * P[Ee].y + M[6] * P[Ee].z, pe = M[1] * P[Le].x + M[4] * P[Le].y + M[7] * P[Le].z, de = M[1] * P[ae].x + M[4] * P[ae].y + M[7] * P[ae].z, ce = M[1] * P[_e].x + M[4] * P[_e].y + M[7] * P[_e].z, Ae = M[1] * P[Ee].x + M[4] * P[Ee].y + M[7] * P[Ee].z, Oe = M[5] * P[Le].y + M[8] * P[Le].z, We = M[5] * P[ae].y + M[8] * P[ae].z, Ue = M[5] * P[_e].y + M[8] * P[_e].z, Z = M[5] * P[Ee].y + M[8] * P[Ee].z, oe[K] = Be + xe.x, oe[ze] = Ne + xe.x, oe[Ve] = Ge + xe.x, oe[$] = ke + xe.x, oe[K + 1] = pe + xe.y, oe[ze + 1] = de + xe.y, oe[Ve + 1] = ce + xe.y, oe[$ + 1] = Ae + xe.y, oe[K + 2] = Oe + xe.z, oe[ze + 2] = We + xe.z, oe[Ve + 2] = Ue + xe.z, oe[$ + 2] = Z + xe.z, ve[K] = v.r, ve[ze] = v.r, ve[Ve] = v.r, ve[$] = v.r, ve[K + 1] = v.g, ve[ze + 1] = v.g, ve[Ve + 1] = v.g, ve[$ + 1] = v.g, ve[K + 2] = v.b, ve[ze + 2] = v.b, ve[Ve + 2] = v.b, ve[$ + 2] = v.b, j = M[0] * z[Le].x + M[3] * z[Le].y + M[6] * z[Le].z, ee = M[0] * z[ae].x + M[3] * z[ae].y + M[6] * z[ae].z, ge = M[0] * z[_e].x + M[3] * z[_e].y + M[6] * z[_e].z, ye = M[0] * z[Ee].x + M[3] * z[Ee].y + M[6] * z[Ee].z, $e = M[1] * z[Le].x + M[4] * z[Le].y + M[7] * z[Le].z, Re = M[1] * z[ae].x + M[4] * z[ae].y + M[7] * z[ae].z, Y = M[1] * z[_e].x + M[4] * z[_e].y + M[7] * z[_e].z, ue = M[1] * z[Ee].x + M[4] * z[Ee].y + M[7] * z[Ee].z, Se = M[5] * z[Le].y + M[8] * z[Le].z, Fe = M[5] * z[ae].y + M[8] * z[ae].z, he = M[5] * z[_e].y + M[8] * z[_e].z, De = M[5] * z[Ee].y + M[8] * z[Ee].z, J === 0 ? (te[K] = j, te[Ve] = ge, te[$] = ye, te[K + 1] = $e, te[Ve + 1] = Y, te[$ + 1] = ue, te[K + 2] = Se, te[Ve + 2] = he, te[$ + 2] = De, se[G] = Le + U, se[G + 1] = _e + U, se[G + 2] = Ee + U, B.faceidx += 3) : J === be - 1 ? (te[K] = j, te[ze] = ee, te[Ve] = ge, te[K + 1] = $e, te[ze + 1] = Re, te[Ve + 1] = Y, te[K + 2] = Se, te[ze + 2] = Fe, te[Ve + 2] = he, se[G] = Le + U, se[G + 1] = ae + U, se[G + 2] = _e + U, B.faceidx += 3) : (te[K] = j, te[ze] = ee, te[$] = ye, te[K + 1] = $e, te[ze + 1] = Re, te[$ + 1] = ue, te[K + 2] = Se, te[ze + 2] = Fe, te[$ + 2] = De, te[ze] = ee, te[Ve] = ge, te[$] = ye, te[ze + 1] = Re, te[Ve + 1] = Y, te[$ + 1] = ue, te[ze + 2] = Fe, te[Ve + 2] = he, te[$ + 2] = De, se[G] = Le + U, se[G + 1] = ae + U, se[G + 2] = Ee + U, se[G + 3] = ae + U, se[G + 4] = _e + U, se[G + 5] = Ee + U, B.faceidx += 6); - } - } - B.vertices += I; - } - } - b.drawCylinder = c; - function S(s, o, A, p, v) { - if (!o || !A) - return; - v = v || { r: 0, g: 0, b: 0 }; - let a = new n.Vector3(A.x - o.x, A.y - o.y, A.z - o.z); - var l = h(a.x, a.y, a.z); - a = a.normalize(); - var g = E.basisVectors.length, M = E.basisVectors, C = g + 2, T = s.updateGeoGroup(C), D = T.vertices, I, B, P, z, k, N, R = T.vertexArray, U = T.normalArray, W = T.colorArray, G = T.faceArray; - for (I = D * 3, R[I] = o.x, R[I + 1] = o.y, R[I + 2] = o.z, U[I] = -a.x, U[I + 1] = -a.y, U[I + 2] = -a.z, W[I] = v.r, W[I + 1] = v.g, W[I + 2] = v.b, R[I + 3] = A.x, R[I + 4] = A.y, R[I + 5] = A.z, U[I + 3] = a.x, U[I + 4] = a.y, U[I + 5] = a.z, W[I + 3] = v.r, W[I + 4] = v.g, W[I + 5] = v.b, I += 6, P = 0; P < g; ++P) { - var F = M[P].clone(); - F.multiplyScalar(p), z = l[0] * F.x + l[3] * F.y + l[6] * F.z, k = l[1] * F.x + l[4] * F.y + l[7] * F.z, N = l[5] * F.y + l[8] * F.z, R[I] = z + o.x, R[I + 1] = k + o.y, R[I + 2] = N + o.z, U[I] = z, U[I + 1] = k, U[I + 2] = N, W[I] = v.r, W[I + 1] = v.g, W[I + 2] = v.b, I += 3; - } - for (T.vertices += g + 2, B = T.faceidx, P = 0; P < g; P++) { - var V = D + 2 + P, J = D + 2 + (P + 1) % g; - G[B] = V, G[B + 1] = J, G[B + 2] = D, B += 3, G[B] = V, G[B + 1] = J, G[B + 2] = D + 1, B += 3; - } - T.faceidx += 6 * g; - } - b.drawCone = S; - class y { - constructor() { - this.cache = /* @__PURE__ */ new Map(); - } - getVerticesForRadius(o, A) { - A = A || 2, this.cache.has(A) || this.cache.set(A, /* @__PURE__ */ new Map()); - let p = this.cache.get(A); - if (p.has(o)) - return p.get(o); - var v = { - vertices: [], - verticesRows: [], - normals: [] - }, a = 16 * A, l = 10 * A; - o < 1 && (a = 10 * A, l = 8 * A); - var g = 0, M = Math.PI * 2, C = 0, T = Math.PI, D, I; - for (I = 0; I <= l; I++) { - let P = []; - for (D = 0; D <= a; D++) { - let z = D / a, k = I / l, N = -o * Math.cos(g + z * M) * Math.sin(C + k * T), R = o * Math.cos(C + k * T), U = o * Math.sin(g + z * M) * Math.sin(C + k * T); - var B = new n.Vector3(N, R, U); - B.normalize(), v.vertices.push({ x: N, y: R, z: U }), v.normals.push(B), P.push(v.vertices.length - 1); - } - v.verticesRows.push(P); - } - return p.set(o, v), v; - } - } - var w = new y(); - function L(s, o, A, p, v) { - var a = w.getVerticesForRadius(A, v), l = a.vertices, g = a.normals, M = s.updateGeoGroup(l.length), C = M.vertices, T = M.vertexArray, D = M.colorArray, I = M.faceArray, B = M.lineArray, P = M.normalArray; - for (let N = 0, R = l.length; N < R; ++N) { - let U = 3 * (C + N), W = l[N]; - T[U] = W.x + o.x, T[U + 1] = W.y + o.y, T[U + 2] = W.z + o.z, D[U] = p.r, D[U + 1] = p.g, D[U + 2] = p.b; - } - M.vertices += l.length; - let z = a.verticesRows, k = z.length - 1; - for (let N = 0; N < k; N++) { - let R = z[N].length - 1; - for (let U = 0; U < R; U++) { - let W = M.faceidx, G = M.lineidx, F = z[N][U + 1] + C, V = F * 3, J = z[N][U] + C, X = J * 3, oe = z[N + 1][U] + C, te = oe * 3, ve = z[N + 1][U + 1] + C, se = ve * 3, le = g[F - C], Ce = g[J - C], be = g[oe - C], Le = g[ve - C]; - Math.abs(l[F - C].y) === A ? (P[V] = le.x, P[te] = be.x, P[se] = Le.x, P[V + 1] = le.y, P[te + 1] = be.y, P[se + 1] = Le.y, P[V + 2] = le.z, P[te + 2] = be.z, P[se + 2] = Le.z, I[W] = F, I[W + 1] = oe, I[W + 2] = ve, B[G] = F, B[G + 1] = oe, B[G + 2] = F, B[G + 3] = ve, B[G + 4] = oe, B[G + 5] = ve, M.faceidx += 3, M.lineidx += 6) : Math.abs(l[oe - C].y) === A ? (P[V] = le.x, P[X] = Ce.x, P[te] = be.x, P[V + 1] = le.y, P[X + 1] = Ce.y, P[te + 1] = be.y, P[V + 2] = le.z, P[X + 2] = Ce.z, P[te + 2] = be.z, I[W] = F, I[W + 1] = J, I[W + 2] = oe, B[G] = F, B[G + 1] = J, B[G + 2] = F, B[G + 3] = oe, B[G + 4] = J, B[G + 5] = oe, M.faceidx += 3, M.lineidx += 6) : (P[V] = le.x, P[X] = Ce.x, P[se] = Le.x, P[V + 1] = le.y, P[X + 1] = Ce.y, P[se + 1] = Le.y, P[V + 2] = le.z, P[X + 2] = Ce.z, P[se + 2] = Le.z, P[X] = Ce.x, P[te] = be.x, P[se] = Le.x, P[X + 1] = Ce.y, P[te + 1] = be.y, P[se + 1] = Le.y, P[X + 2] = Ce.z, P[te + 2] = be.z, P[se + 2] = Le.z, I[W] = F, I[W + 1] = J, I[W + 2] = ve, I[W + 3] = J, I[W + 4] = oe, I[W + 5] = ve, B[G] = F, B[G + 1] = J, B[G + 2] = F, B[G + 3] = ve, B[G + 4] = J, B[G + 5] = oe, B[G + 6] = oe, B[G + 7] = ve, M.faceidx += 6, M.lineidx += 8); - } - } - } - b.drawSphere = L; - })(u || (u = {})); - } - ), - /***/ - "./src/GLModel.ts": ( - /*!************************!*\ - !*** ./src/GLModel.ts ***! - \************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - GLModel: () => ( - /* binding */ - o - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./WebGL/shapes */ - "./src/WebGL/shapes/index.ts" - ), u = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), b = r( - /*! ./colors */ - "./src/colors.ts" - ), h = r( - /*! ./GLDraw */ - "./src/GLDraw.ts" - ), _ = r( - /*! ./glcartoon */ - "./src/glcartoon.ts" - ), E = r( - /*! ./utilities */ - "./src/utilities.ts" - ), c = r( - /*! ./Gradient */ - "./src/Gradient.ts" - ), S = r( - /*! ./parsers */ - "./src/parsers/index.ts" - ), y = r( - /*! netcdfjs */ - "./node_modules/netcdfjs/lib-esm/index.js" - ), w = r( - /*! pako */ - "./node_modules/pako/dist/pako.esm.mjs" - ), L = r( - /*! ./parsers/utils/assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ); - function s(A) { - let p; - return typeof A == "string" ? p = new TextEncoder().encode(A) : p = new Uint8Array(A), (0, w.inflate)(p, { - to: "string" - }); - } - class o { - // class functions - // return true if a and b represent the same style - static sameObj(p, v) { - return p && v ? JSON.stringify(p) == JSON.stringify(v) : p == v; - } - constructor(p, v) { - this.atoms = [], this.frames = [], this.box = null, this.atomdfs = null, this.id = 0, this.hidden = !1, this.molObj = null, this.renderedMolObj = null, this.lastColors = null, this.modelData = {}, this.modelDatas = null, this.idMatrix = new u.Matrix4(), this.dontDuplicateAtoms = !0, this.defaultColor = b.elementColors.defaultColor, this.defaultStickRadius = 0.25, this.options = v || {}, this.ElementColors = this.options.defaultcolors ? this.options.defaultcolors : b.elementColors.defaultColors, this.defaultSphereRadius = this.options.defaultSphereRadius ? this.options.defaultSphereRadius : 1.5, this.defaultCartoonQuality = this.options.cartoonQuality ? this.options.cartoonQuality : 10, this.id = p; - } - // return proper radius for atom given style - /** - * - * @param {AtomSpec} atom - * @param {atomstyle} style - * @return {number} - * - */ - getRadiusFromStyle(p, v) { - var a = this.defaultSphereRadius; - if (typeof v.radius < "u") - a = v.radius; - else if (o.vdwRadii[p.elem]) - a = o.vdwRadii[p.elem]; - else if (p.elem.length > 1) { - let l = p.elem; - l = l[0].toUpperCase() + l[1].toLowerCase(), o.vdwRadii[l] && (a = o.vdwRadii[l]); - } - return typeof v.scale < "u" && (a *= v.scale), a; - } - // cross drawing - /** - * - * @param {AtomSpec} atom - * @param {Record} geos - */ - drawAtomCross(p, v) { - if (p.style.cross) { - var a = p.style.cross; - if (!a.hidden) { - var l = a.linewidth || o.defaultlineWidth; - v[l] || (v[l] = new n.Geometry()); - var g = v[l].updateGeoGroup(6), M = this.getRadiusFromStyle(p, a), C = [ - [M, 0, 0], - [-M, 0, 0], - [0, M, 0], - [0, -M, 0], - [0, 0, M], - [0, 0, -M] - ], T = p.clickable || p.hoverable; - T && p.intersectionShape === void 0 && (p.intersectionShape = { sphere: [], cylinder: [], line: [] }); - for (var D = (0, E.getColorFromStyle)(p, a), I = g.vertexArray, B = g.colorArray, P = 0; P < 6; P++) { - var z = g.vertices * 3; - if (g.vertices++, I[z] = p.x + C[P][0], I[z + 1] = p.y + C[P][1], I[z + 2] = p.z + C[P][2], B[z] = D.r, B[z + 1] = D.g, B[z + 2] = D.b, T) { - var k = new u.Vector3(C[P][0], C[P][1], C[P][2]); - k.multiplyScalar(0.1), k.set(k.x + p.x, k.y + p.y, k.z + p.z), p.intersectionShape.line.push(k); - } - } - } - } - } - getGoodCross(p, v, a, l) { - for (var g = null, M = -1, C = 0, T = p.bonds.length; C < T; C++) - if (p.bonds[C] != v.index) { - let I = p.bonds[C], B = this.atoms[I], z = new u.Vector3(B.x, B.y, B.z).clone(); - z.sub(a); - let k = z.clone(); - k.cross(l); - var D = k.lengthSq(); - if (D > M && (M = D, g = k, M > 0.1)) - return g; - } - return g; - } - //from atom, return a normalized vector v that is orthogonal and along which - //it is appropraite to draw multiple bonds - getSideBondV(p, v, a) { - var l, g, M, C, T, D = new u.Vector3(p.x, p.y, p.z), I = new u.Vector3(v.x, v.y, v.z), B = I.clone(), P = null; - if (B.sub(D), p.bonds.length === 1) - v.bonds.length === 1 ? (P = B.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1) : (l = (a + 1) % v.bonds.length, g = v.bonds[l], M = this.atoms[g], C = new u.Vector3(M.x, M.y, M.z), T = C.clone(), T.sub(D), P = T.clone(), P.cross(B)); - else if (P = this.getGoodCross(p, v, D, B), P.lengthSq() < 0.01) { - var z = this.getGoodCross(v, p, D, B); - z != null && (P = z); - } - return P.lengthSq() < 0.01 && (P = B.clone(), Math.abs(P.x) > 1e-4 ? P.y += 1 : P.x += 1), P.cross(B), P.normalize(), P; - } - addLine(p, v, a, l, g, M) { - p[a] = l.x, p[a + 1] = l.y, p[a + 2] = l.z, v[a] = M.r, v[a + 1] = M.g, v[a + 2] = M.b, p[a + 3] = g.x, p[a + 4] = g.y, p[a + 5] = g.z, v[a + 3] = M.r, v[a + 4] = M.g, v[a + 5] = M.b; - } - // bonds - both atoms must match bond style - // standardize on only drawing for lowest to highest - /** - * - * @param {AtomSpec} - * atom - * @param {AtomSpec[]} atoms - * @param {Record} geos - */ - drawBondLines(p, v, a) { - if (p.style.line) { - var l = p.style.line; - if (!l.hidden) { - var g, M, C, T, D = l.linewidth || o.defaultlineWidth; - a[D] || (a[D] = new n.Geometry()); - for (var I = a[D].updateGeoGroup(6 * p.bonds.length), B = I.vertexArray, P = I.colorArray, z = 0; z < p.bonds.length; z++) { - var k = p.bonds[z], N = v[k]; - if (N.style.line && !(p.index >= N.index)) { - var R = new u.Vector3(p.x, p.y, p.z), U = new u.Vector3(N.x, N.y, N.z), W = R.clone().add(U).multiplyScalar(0.5), G = !1, F = p.clickable || p.hoverable, V = N.clickable || N.hoverable; - (F || V) && (F && (p.intersectionShape === void 0 && (p.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), p.intersectionShape.line.push(R), p.intersectionShape.line.push(W)), V && (N.intersectionShape === void 0 && (N.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), N.intersectionShape.line.push(W), N.intersectionShape.line.push(U))); - var J = (0, E.getColorFromStyle)(p, p.style.line), X = (0, E.getColorFromStyle)(N, N.style.line); - if (p.bondStyles && p.bondStyles[z]) { - var oe = p.bondStyles[z]; - if (!oe.iswire) - continue; - oe.singleBond && (G = !0), typeof oe.color1 < "u" && (J = b.CC.color(oe.color1)), typeof oe.color2 < "u" && (X = b.CC.color(oe.color2)); - } - var te = I.vertices * 3, ve, se; - if (p.bondOrder[z] > 1 && p.bondOrder[z] < 4 && !G) { - var le = this.getSideBondV(p, N, z), Ce = U.clone(); - Ce.sub(R), p.bondOrder[z] == 2 ? (le.multiplyScalar(0.1), g = R.clone(), g.add(le), M = R.clone(), M.sub(le), C = g.clone(), C.add(Ce), T = M.clone(), T.add(Ce), J == X ? (I.vertices += 4, this.addLine(B, P, te, g, C, J), this.addLine(B, P, te + 6, M, T, J)) : (I.vertices += 8, Ce.multiplyScalar(0.5), ve = g.clone(), ve.add(Ce), se = M.clone(), se.add(Ce), this.addLine(B, P, te, g, ve, J), this.addLine(B, P, te + 6, ve, C, X), this.addLine(B, P, te + 12, M, se, J), this.addLine(B, P, te + 18, se, T, X))) : p.bondOrder[z] == 3 && (le.multiplyScalar(0.1), g = R.clone(), g.add(le), M = R.clone(), M.sub(le), C = g.clone(), C.add(Ce), T = M.clone(), T.add(Ce), J == X ? (I.vertices += 6, this.addLine(B, P, te, R, U, J), this.addLine(B, P, te + 6, g, C, J), this.addLine(B, P, te + 12, M, T, J)) : (I.vertices += 12, Ce.multiplyScalar(0.5), ve = g.clone(), ve.add(Ce), se = M.clone(), se.add(Ce), this.addLine(B, P, te, R, W, J), this.addLine(B, P, te + 6, W, U, X), this.addLine(B, P, te + 12, g, ve, J), this.addLine(B, P, te + 18, ve, C, X), this.addLine(B, P, te + 24, M, se, J), this.addLine(B, P, te + 30, se, T, X))); - } else - J == X ? (I.vertices += 2, this.addLine(B, P, te, R, U, J)) : (I.vertices += 4, this.addLine(B, P, te, R, W, J), this.addLine(B, P, te + 6, W, U, X)); - } - } - } - } - } - //sphere drawing - //See also: drawCylinder - /** - * - * @param {AtomSpec} atom - * @param {Geometry} geo - */ - drawAtomSphere(p, v) { - if (p.style.sphere) { - var a = p.style.sphere; - if (!a.hidden) { - var l = (0, E.getColorFromStyle)(p, a), g = this.getRadiusFromStyle(p, a); - if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) { - var M = new u.Vector3(p.x, p.y, p.z); - p.intersectionShape.sphere.push(new f.Sphere(M, g)); - } - h.GLDraw.drawSphere(v, p, g, l); - } - } - } - /** Register atom shaped click handlers */ - drawAtomClickSphere(p) { - if (p.style.clicksphere) { - var v = p.style.clicksphere; - if (!v.hidden) { - var a = this.getRadiusFromStyle(p, v); - if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) { - var l = new u.Vector3(p.x, p.y, p.z); - p.intersectionShape.sphere.push(new f.Sphere(l, a)); - } - } - } - } - drawAtomInstanced(p, v) { - if (p.style.sphere) { - var a = p.style.sphere; - if (!a.hidden) { - var l = this.getRadiusFromStyle(p, a), g = (0, E.getColorFromStyle)(p, a), M = v.updateGeoGroup(1), C = M.vertices, T = C * 3, D = M.vertexArray, I = M.colorArray, B = M.radiusArray; - if (D[T] = p.x, D[T + 1] = p.y, D[T + 2] = p.z, I[T] = g.r, I[T + 1] = g.g, I[T + 2] = g.b, B[C] = l, (p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) { - var P = new u.Vector3(p.x, p.y, p.z); - p.intersectionShape.sphere.push(new f.Sphere(P, l)); - } - M.vertices += 1; - } - } - } - drawSphereImposter(p, v, a, l) { - var g = p.updateGeoGroup(4), M, C = g.vertices, T = C * 3, D = g.vertexArray, I = g.colorArray; - for (M = 0; M < 4; M++) - D[T + 3 * M] = v.x, D[T + 3 * M + 1] = v.y, D[T + 3 * M + 2] = v.z; - var B = g.normalArray; - for (M = 0; M < 4; M++) - I[T + 3 * M] = l.r, I[T + 3 * M + 1] = l.g, I[T + 3 * M + 2] = l.b; - B[T + 0] = -a, B[T + 1] = a, B[T + 2] = 0, B[T + 3] = -a, B[T + 4] = -a, B[T + 5] = 0, B[T + 6] = a, B[T + 7] = -a, B[T + 8] = 0, B[T + 9] = a, B[T + 10] = a, B[T + 11] = 0, g.vertices += 4; - var P = g.faceArray, z = g.faceidx; - P[z + 0] = C, P[z + 1] = C + 1, P[z + 2] = C + 2, P[z + 3] = C + 2, P[z + 4] = C + 3, P[z + 5] = C, g.faceidx += 6; - } - //dkoes - code for sphere imposters - drawAtomImposter(p, v) { - if (p.style.sphere) { - var a = p.style.sphere; - if (!a.hidden) { - var l = this.getRadiusFromStyle(p, a), g = (0, E.getColorFromStyle)(p, a); - if ((p.clickable === !0 || p.hoverable) && p.intersectionShape !== void 0) { - var M = new u.Vector3(p.x, p.y, p.z); - p.intersectionShape.sphere.push(new f.Sphere(M, l)); - } - this.drawSphereImposter(v, p, l, g); - } - } - } - static drawStickImposter(p, v, a, l, g) { - for (var M = p.updateGeoGroup(4), C = M.vertices, T = C * 3, D = M.vertexArray, I = M.colorArray, B = M.radiusArray, P = M.normalArray, z = g.r, k = g.g, N = g.b, R = function(V) { - var J = -V; - return J == 0 && (J = -1e-4), J; - }, U = T, W = 0; W < 4; W++) - D[U] = v.x, P[U] = a.x, I[U] = z, U++, D[U] = v.y, P[U] = a.y, I[U] = k, U++, D[U] = v.z, P[U] = a.z, W < 2 ? I[U] = N : I[U] = R(N), U++; - M.vertices += 4, B[C] = -l, B[C + 1] = l, B[C + 2] = -l, B[C + 3] = l; - var G = M.faceArray, F = M.faceidx; - G[F + 0] = C, G[F + 1] = C + 1, G[F + 2] = C + 2, G[F + 3] = C + 2, G[F + 4] = C + 3, G[F + 5] = C, M.faceidx += 6; - } - // draws cylinders and small spheres (at bond radius) - drawBondSticks(p, v, a) { - if (p.style.stick) { - var l = p.style.stick; - if (!l.hidden) { - var g = l.radius || this.defaultStickRadius, M = l.doubleBondScaling || 0.4, C = l.tripleBondScaling || 0.25, T = g, D = l.singleBonds || !1, I = 0, B = 0, P, z, k, N, R, U, W, G, F, V, J, X = (0, E.getColorFromStyle)(p, l), oe, te, ve; - !p.capDrawn && p.bonds.length < 4 && (I = 2); - var se = h.GLDraw.drawCylinder; - for (a.imposter && (se = o.drawStickImposter), k = 0; k < p.bonds.length; k++) { - var le = p.bonds[k], Ce = v[le]; - if (oe = te = ve = null, p.index < Ce.index) { - var be = Ce.style; - if (!be.stick || be.stick.hidden) - continue; - var Le = (0, E.getColorFromStyle)(Ce, be.stick); - if (T = g, N = D, p.bondStyles && p.bondStyles[k]) { - if (R = p.bondStyles[k], R.iswire) - continue; - R.radius && (T = R.radius), R.singleBond && (N = !0), typeof R.color1 < "u" && (X = b.CC.color(R.color1)), typeof R.color2 < "u" && (Le = b.CC.color(R.color2)); - } - var ae = new u.Vector3(p.x, p.y, p.z), _e = new u.Vector3(Ce.x, Ce.y, Ce.z); - if (p.bondOrder[k] <= 1 || N || p.bondOrder[k] > 3) { - if (p.bondOrder[k] < 1 && (T *= p.bondOrder[k]), !Ce.capDrawn && Ce.bonds.length < 4 && (B = 2), X != Le ? (oe = new u.Vector3().addVectors(ae, _e).multiplyScalar(0.5), se(a, ae, oe, T, X, I, 0), se(a, oe, _e, T, Le, 0, B)) : se(a, ae, _e, T, X, I, B), P = p.clickable || p.hoverable, z = Ce.clickable || Ce.hoverable, P || z) { - if (oe || (oe = new u.Vector3().addVectors(ae, _e).multiplyScalar(0.5)), P) { - var Ee = new f.Cylinder(ae, oe, T), Be = new f.Sphere(ae, T); - p.intersectionShape.cylinder.push(Ee), p.intersectionShape.sphere.push(Be); - } - if (z) { - var Ne = new f.Cylinder(_e, oe, T), Ge = new f.Sphere(_e, T); - Ce.intersectionShape.cylinder.push(Ne), Ce.intersectionShape.sphere.push(Ge); - } - } - } else if (p.bondOrder[k] > 1) { - var ke = 0, pe = 0; - T != g && (ke = 2, pe = 2); - var de = _e.clone(), ce = null; - de.sub(ae); - var Ae, Oe, We, Ue, Z; - ce = this.getSideBondV(p, Ce, k), p.bondOrder[k] == 2 ? (Ae = T * M, ce.multiplyScalar(Ae * 1.5), Oe = ae.clone(), Oe.add(ce), We = ae.clone(), We.sub(ce), Ue = Oe.clone(), Ue.add(de), Z = We.clone(), Z.add(de), X != Le ? (oe = new u.Vector3().addVectors(Oe, Ue).multiplyScalar(0.5), te = new u.Vector3().addVectors(We, Z).multiplyScalar(0.5), se(a, Oe, oe, Ae, X, ke, 0), se(a, oe, Ue, Ae, Le, 0, pe), se(a, We, te, Ae, X, ke, 0), se(a, te, Z, Ae, Le, 0, pe)) : (se(a, Oe, Ue, Ae, X, ke, pe), se(a, We, Z, Ae, X, ke, pe)), P = p.clickable || p.hoverable, z = Ce.clickable || Ce.hoverable, (P || z) && (oe || (oe = new u.Vector3().addVectors(Oe, Ue).multiplyScalar(0.5)), te || (te = new u.Vector3().addVectors(We, Z).multiplyScalar(0.5)), P && (U = new f.Cylinder(Oe, oe, Ae), W = new f.Cylinder(We, te, Ae), p.intersectionShape.cylinder.push(U), p.intersectionShape.cylinder.push(W)), z && (F = new f.Cylinder(Ue, oe, Ae), V = new f.Cylinder(Z, te, Ae), Ce.intersectionShape.cylinder.push(F), Ce.intersectionShape.cylinder.push(V)))) : p.bondOrder[k] == 3 && (Ae = T * C, ce.cross(de), ce.normalize(), ce.multiplyScalar(Ae * 3), Oe = ae.clone(), Oe.add(ce), We = ae.clone(), We.sub(ce), Ue = Oe.clone(), Ue.add(de), Z = We.clone(), Z.add(de), X != Le ? (oe = new u.Vector3().addVectors(Oe, Ue).multiplyScalar(0.5), te = new u.Vector3().addVectors(We, Z).multiplyScalar(0.5), ve = new u.Vector3().addVectors(ae, _e).multiplyScalar(0.5), se(a, Oe, oe, Ae, X, ke, 0), se(a, oe, Ue, Ae, Le, 0, pe), se(a, ae, ve, Ae, X, I, 0), se(a, ve, _e, Ae, Le, 0, B), se(a, We, te, Ae, X, ke, 0), se(a, te, Z, Ae, Le, 0, pe)) : (se(a, Oe, Ue, Ae, X, ke, pe), se(a, ae, _e, Ae, X, I, B), se(a, We, Z, Ae, X, ke, pe)), P = p.clickable || p.hoverable, z = Ce.clickable || Ce.hoverable, (P || z) && (oe || (oe = new u.Vector3().addVectors(Oe, Ue).multiplyScalar(0.5)), te || (te = new u.Vector3().addVectors(We, Z).multiplyScalar(0.5)), ve || (ve = new u.Vector3().addVectors(ae, _e).multiplyScalar(0.5)), P && (U = new f.Cylinder(Oe.clone(), oe.clone(), Ae), W = new f.Cylinder(We.clone(), te.clone(), Ae), G = new f.Cylinder(ae.clone(), ve.clone(), Ae), p.intersectionShape.cylinder.push(U), p.intersectionShape.cylinder.push(W), p.intersectionShape.cylinder.push(G)), z && (F = new f.Cylinder(Ue.clone(), oe.clone(), Ae), V = new f.Cylinder(Z.clone(), te.clone(), Ae), J = new f.Cylinder(_e.clone(), ve.clone(), Ae), Ce.intersectionShape.cylinder.push(F), Ce.intersectionShape.cylinder.push(V), Ce.intersectionShape.cylinder.push(J)))); - } - } - } - var j = !1, ee = 0, ge = !1; - for (k = 0; k < p.bonds.length; k++) - N = D, p.bondStyles && p.bondStyles[k] && (R = p.bondStyles[k], R.singleBond && (N = !0), R.radius && R.radius != g && (ge = !0)), (N || p.bondOrder[k] == 1) && ee++; - ge ? ee > 0 && (j = !0) : ee == 0 && (p.bonds.length > 0 || l.showNonBonded) && (j = !0), j && (T = g, a.imposter ? this.drawSphereImposter(a.sphereGeometry, p, T, X) : h.GLDraw.drawSphere(a, p, T, X)); - } - } - } - // go through all the atoms and regenerate their geometries - // we try to have one geometry for each style since this is much much - // faster - // at some point we should optimize this to avoid unnecessary - // recalculation - /** param {AtomSpec[]} atoms */ - createMolObj(p, v) { - v = v || {}; - var a = new n.Object3D(), l = [], g = {}, M = {}, C = this.drawAtomSphere, T = null, D = null; - v.supportsImposters ? (C = this.drawAtomImposter, T = new n.Geometry(!0), T.imposter = !0, D = new n.Geometry(!0, !0), D.imposter = !0, D.sphereGeometry = new n.Geometry(!0), D.sphereGeometry.imposter = !0, D.drawnCaps = {}) : v.supportsAIA ? (C = this.drawAtomInstanced, T = new n.Geometry(!1, !0, !0), T.instanced = !0, D = new n.Geometry(!0)) : (T = new n.Geometry(!0), D = new n.Geometry(!0)); - var I, B, P, z, k = {}, N = [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY]; - for (I = 0, P = p.length; I < P; I++) { - var R = p[I]; - if (R && R.style) { - (R.clickable || R.hoverable) && R.intersectionShape === void 0 && (R.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), z = { line: void 0, cross: void 0, stick: void 0, sphere: void 0 }; - for (B in z) - R.style[B] ? R.style[B].opacity ? z[B] = parseFloat(R.style[B].opacity) : z[B] = 1 : z[B] = void 0, k[B] ? z[B] != null && k[B] != z[B] && (console.log("Warning: " + B + " opacity is ambiguous"), k[B] = 1) : k[B] = z[B]; - C.call(this, R, T), this.drawAtomClickSphere(R), this.drawAtomCross(R, M), this.drawBondLines(R, p, g), this.drawBondSticks(R, p, D), typeof R.style.cartoon < "u" && !R.style.cartoon.hidden && (R.style.cartoon.color === "spectrum" && typeof R.resi == "number" && !R.hetflag && (R.resi < N[0] && (N[0] = R.resi), R.resi > N[1] && (N[1] = R.resi)), l.push(R)); - } - } - if (l.length > 0 && (0, _.drawCartoon)(a, l, N, this.defaultCartoonQuality), T && T.vertices > 0) { - T.initTypedArrays(); - var U = null, W = null; - T.imposter ? U = new n.SphereImposterMaterial({ - ambient: 0, - vertexColors: !0, - reflectivity: 0 - }) : T.instanced ? (W = new n.Geometry(!0), h.GLDraw.drawSphere(W, { x: 0, y: 0, z: 0 }, 1, new b.Color(0.5, 0.5, 0.5)), W.initTypedArrays(), U = new n.InstancedMaterial({ - sphereMaterial: new n.MeshLambertMaterial({ - ambient: 0, - vertexColors: !0, - reflectivity: 0 - }), - sphere: W - })) : U = new n.MeshLambertMaterial({ - ambient: 0, - vertexColors: !0, - reflectivity: 0 - }), k.sphere < 1 && k.sphere >= 0 && (U.transparent = !0, U.opacity = k.sphere), W = new n.Mesh(T, U), a.add(W); - } - if (D.vertices > 0) { - var G = null, F = null, V = D.sphereGeometry; - (!V || typeof V.vertices > "u" || V.vertices == 0) && (V = null), D.initTypedArrays(), V && V.initTypedArrays(); - var J = { ambient: 0, vertexColors: !0, reflectivity: 0 }; - D.imposter ? (G = new n.StickImposterMaterial(J), F = new n.SphereImposterMaterial(J)) : (G = new n.MeshLambertMaterial(J), F = new n.MeshLambertMaterial(J), G.wireframe && (D.setUpWireframe(), V && V.setUpWireframe())), k.stick < 1 && k.stick >= 0 && (G.transparent = !0, G.opacity = k.stick, F.transparent = !0, F.opacity = k.stick); - var X = new n.Mesh(D, G); - if (a.add(X), V) { - var oe = new n.Mesh(V, F); - a.add(oe); - } - } - var te; - for (I in g) - if (g.hasOwnProperty(I)) { - te = I; - var ve = new n.LineBasicMaterial({ - linewidth: te, - vertexColors: !0 - }); - k.line < 1 && k.line >= 0 && (ve.transparent = !0, ve.opacity = k.line), g[I].initTypedArrays(); - var se = new n.Line(g[I], ve, n.LineStyle.LinePieces); - a.add(se); - } - for (I in M) - if (M.hasOwnProperty(I)) { - te = I; - var le = new n.LineBasicMaterial({ - linewidth: te, - vertexColors: !0 - }); - k.cross < 1 && k.cross >= 0 && (le.transparent = !0, le.opacity = k.cross), M[I].initTypedArrays(); - var Ce = new n.Line(M[I], le, n.LineStyle.LinePieces); - a.add(Ce); - } - if (this.dontDuplicateAtoms && this.modelData.symmetries && this.modelData.symmetries.length > 0) { - var be = new n.Object3D(), Le; - for (Le = 0; Le < this.modelData.symmetries.length; Le++) { - var ae = new n.Object3D(); - ae = a.clone(), ae.matrix.copy(this.modelData.symmetries[Le]), ae.matrixAutoUpdate = !1, be.add(ae); - } - return be; - } - return a; - } - /** - * Return object representing internal state of - * the model appropriate for passing to setInternalState - * - */ - getInternalState() { - return { - atoms: this.atoms, - frames: this.frames - }; - } - /** - * Overwrite the internal model state with the passed state. - * - */ - setInternalState(p) { - this.atoms = p.atoms, this.frames = p.frames, this.molObj = null; - } - /** - * Returns crystallographic information if present. - * - * - */ - getCrystData() { - if (this.modelData.cryst) { - if (!this.modelData.cryst.matrix) { - const p = this.modelData.cryst; - this.modelData.cryst.matrix = (0, u.conversionMatrix3)(p.a, p.b, p.c, p.alpha, p.beta, p.gamma); - } - return this.modelData.cryst; - } else - return null; - } - /** - * Set crystallographic information using three angles and three lengths - * - * @param {number} a - length of unit cell side - * @param {number} b - length of unit cell side - * @param {number} c - length of unit cell side - * @param {number} alpha - unit cell angle in degrees (default 90) - * @param {number} beta - unit cell angle in degrees (default 90) - * @param {number} gamma - unit cell angle in degrees (default 90) - - */ - setCrystData(p, v, a, l, g, M) { - p = p || 1, v = v || 1, a = a || 1, l = l || 90, g = g || 90, M = M || 90; - const C = (0, u.conversionMatrix3)(p, v, a, l, g, M); - this.modelData.cryst = { - a: p, - b: v, - c: a, - alpha: l, - beta: g, - gamma: M, - matrix: C - }; - } - /** - * Set the crystallographic matrix to the given matrix. - * - * This function removes `a`, `b`, `c`, `alpha`, `beta`, `gamma` from - * the crystal data. - * - * @param {Matrix3} matrix - unit cell matrix - */ - setCrystMatrix(p) { - p = p || new u.Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1), this.modelData.cryst = { - matrix: p - }; - } - /** - * Returns list of rotational/translational matrices if there is BIOMT data - * Otherwise returns a list of just the ID matrix - * - * @return {Array} - * - */ - getSymmetries() { - return typeof this.modelData.symmetries > "u" && (this.modelData.symmetries = [this.idMatrix]), this.modelData.symmetries; - } - /** - * Sets symmetries based on specified matrices in list - * - * @param {Array} list - * - */ - setSymmetries(p) { - typeof p > "u" ? this.modelData.symmetries = [this.idMatrix] : this.modelData.symmetries = p; - } - /** - * Returns model id number - * - * @return {number} Model ID - */ - getID() { - return this.id; - } - /** - * Returns model's frames property, a list of atom lists - * - * @return {number} - */ - getNumFrames() { - return this.frames.numFrames != null ? this.frames.numFrames : this.frames.length; - } - adjustCoord(p, v, a, l) { - var g = v - p; - return g < -a ? v + l : g > a ? v - l : v; - } - //go over current atoms in depth first order and ensure that connected - //attoms aren't split across the box - adjustCoordinatesToBox() { - if (this.box && this.atomdfs) - for (var p = this.box[0], v = this.box[1], a = this.box[2], l = p * 0.9, g = v * 0.9, M = a * 0.9, C = 0; C < this.atomdfs.length; C++) - for (var T = this.atomdfs[C], D = 1; D < T.length; D++) { - var I = this.atoms[T[D][0]], B = this.atoms[T[D][1]]; - I.x = this.adjustCoord(B.x, I.x, l, p), I.y = this.adjustCoord(B.y, I.y, g, v), I.z = this.adjustCoord(B.z, I.z, M, a); - } - } - /** - * Sets model's atomlist to specified frame - * Sets to last frame if framenum out of range - * - * @param {number} framenum - model's atoms are set to this index in frames list - * @return {Promise} - */ - setFrame(p, v) { - var a = this.getNumFrames(); - let l = this; - return new Promise(function(g, M) { - if (a == 0 && g(), (p < 0 || p >= a) && (p = a - 1), l.frames.url != null) { - var C = l.frames.url; - (0, E.getbin)(C + "/traj/frame/" + p + "/" + l.frames.path, void 0, "POST", void 0).then(function(T) { - for (var D = new Float32Array(T, 44), I = 0, B = 0; B < l.atoms.length; B++) - l.atoms[B].x = D[I++], l.atoms[B].y = D[I++], l.atoms[B].z = D[I++]; - l.box && l.atomdfs && l.adjustCoordinatesToBox(), g(); - }).catch(M); - } else - l.atoms = l.frames[p], g(); - l.molObj = null, l.modelDatas && p < l.modelDatas.length && (l.modelData = l.modelDatas[p], l.unitCellObjects && v && (v.removeUnitCell(l), v.addUnitCell(l))); - }); - } - /** - * Add atoms as frames of model - * - * @param {AtomSpec[]} atoms - atoms to be added - */ - addFrame(p) { - this.frames.push(p); - } - /** - * If model atoms have dx, dy, dz properties (in some xyz files), vibrate populates the model's frame property based on parameters. - * Model can then be animated - * - * @param {number} numFrames - number of frames to be created, default to 10 - * @param {number} amplitude - amplitude of distortion, default to 1 (full) - * @param {boolean} bothWays - if true, extend both in positive and negative directions by numFrames - * @param {GLViewer} viewer - required if arrowSpec is provided - * @param {ArrowSpec} arrowSpec - specification for drawing animated arrows. If color isn't specified, atom color (sphere, stick, line preference) is used. - *@example - - $3Dmol.download("pdb:4UAA",viewer,{},function(){ - viewer.setStyle({},{stick:{}}); - viewer.vibrate(10, 1); - viewer.animate({loop: "forward",reps: 1}); - - viewer.zoomTo(); - viewer.render(); - }); - */ - vibrate(p = 10, v = 1, a = !1, l, g) { - var M = 0, C = p; - a && (M = -p, C = p), this.frames !== void 0 && this.frames.origIndex !== void 0 ? this.setFrame(this.frames.origIndex) : this.setFrame(0), M < C && (this.frames = []), a && (this.frames.origIndex = p); - for (var T = M; T < C; T++) { - var D = [], I = this.frames.length; - if (T == 0 && !g) { - this.frames.push(this.atoms); - continue; - } - for (var B = 0; B < this.atoms.length; B++) { - var P = (0, E.getAtomProperty)(this.atoms[B], "dx"), z = (0, E.getAtomProperty)(this.atoms[B], "dy"), k = (0, E.getAtomProperty)(this.atoms[B], "dz"), N = new u.Vector3(P, z, k), R = new u.Vector3(this.atoms[B].x, this.atoms[B].y, this.atoms[B].z), U = T * v / p; - N.multiplyScalar(U), R.add(N); - var W = {}; - for (var G in this.atoms[B]) - W[G] = this.atoms[B][G]; - if (W.x = R.x, W.y = R.y, W.z = R.z, D.push(W), l && g) { - var F = (0, E.extend)({}, g), V = new u.Vector3(P, z, k); - if (V.multiplyScalar(v), V.add(R), F.start = R, F.end = V, F.frame = I, !F.color) { - var J = W.style.sphere; - J || (J = W.style.stick), J || (J = W.style.line), F.color = (0, E.getColorFromStyle)(W, J); - } - l.addArrow(F); - } - } - this.frames.push(D); - } - } - // set default style and colors for atoms - setAtomDefaults(p) { - for (let v = 0; v < p.length; v++) { - let a = p[v]; - a && (a.style = a.style || (0, E.deepCopy)(o.defaultAtomStyle), a.color = a.color || this.ElementColors[a.elem] || this.defaultColor, a.model = this.id, (a.clickable || a.hoverable) && (a.intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] })); - } - } - /** add atoms to this model from molecular data string - * - * @param {string|ArrayBuffer} data - atom structure file input data string, for gzipped input use ArrayBuffer - * @param {string} format - input file string format (e.g 'pdb', 'sdf', 'sdf.gz', etc.) - * @param {ParserOptionsSpec} options - format dependent options. Attributes depend on the input format - */ - addMolData(p, v, a = {}) { - var l = o.parseMolData(p, v, a); - this.dontDuplicateAtoms = !a.duplicateAssemblyAtoms; - var g = l.modelData; - if (g && (Array.isArray(g) ? (this.modelData = g[0], a.frames && (this.modelDatas = g)) : this.modelData = g), l.box ? this.box = l.box : this.box = null, this.frames.length == 0) { - for (let C = 0; C < l.length; C++) - l[C].length != 0 && this.frames.push(l[C]); - this.frames[0] && (this.atoms = this.frames[0]); - } else if (a.frames) - for (let C = 0; C < l.length; C++) - this.frames.push(l[C]); - else - for (var M = 0; M < l.length; M++) - this.addAtoms(l[M]); - for (let C = 0; C < this.frames.length; C++) - this.setAtomDefaults(this.frames[C]); - a.vibrate && a.vibrate.frames && a.vibrate.amplitude && this.vibrate(a.vibrate.frames, a.vibrate.amplitude), a.style && this.setStyle({}, a.style); - } - setDontDuplicateAtoms(p) { - this.dontDuplicateAtoms = p; - } - setModelData(p) { - this.modelData = p; - } - //return true if atom value matches property val - propertyMatches(p, v) { - if (p == v) - return !0; - if (typeof v == "string" && typeof p == "number") { - var a = v.match(/(-?\d+)\s*-\s*(-?\d+)/); - if (a) { - var l = parseInt(a[1]), g = parseInt(a[2]); - if (a && p >= l && p <= g) - return !0; - } - } - return !1; - } - // make a deep copy of a selection object and create caches of expensive - // selections. We create a copy so caches are not attached to user - // supplied objects where the user might change them invalidating the cache. - // This does not support arbitrary - // javascript objects, but support enough for eveything that is - // used in selections: number, string, boolean, functions; as well - // as arrays and nested objects with values of the aformentioned - // types. - static deepCopyAndCache(p, v) { - if (typeof p != "object" || p == null || p.__cache_created) - return p; - const a = {}; - for (const l in p) { - const g = p[l]; - if (Array.isArray(g)) { - a[l] = []; - for (let M = 0; M < g.length; M++) - a[l].push(o.deepCopyAndCache(g[M], v)); - } else - typeof g == "object" && l != "properties" && l != "model" ? a[l] = o.deepCopyAndCache(g, v) : a[l] = g; - if (l == "and" || l == "or") { - const M = []; - for (const C of a[l]) { - const T = /* @__PURE__ */ new Set(); - for (const D of v.selectedAtoms(C)) - T.add(D.index); - M.push(T); - } - if (l == "and") { - const C = function(D, I) { - const B = /* @__PURE__ */ new Set(); - for (const P of I) - D.has(P) && B.add(P); - return B; - }; - let T = new Set(M[0]); - for (const D of M.splice(1)) - T = C(T, D); - a[l].__cached_results = T; - } else if (l == "or") { - const C = /* @__PURE__ */ new Set(); - for (const T of M) - for (const D of T) - C.add(D); - a[l].__cached_results = C; - } - } - } - return a.__cache_created = !0, a; - } - /** given a selection specification, return true if atom is selected. - * Does not support context-aware selectors like expand/within/byres. - * - * @param {AtomSpec} atom - * @param {AtomSelectionSpec} sel - * @return {boolean} - */ - atomIsSelected(p, v) { - if (typeof v > "u") - return !0; - var a = !!v.invert, l = !0; - for (var g in v) - if (g == "and" || g == "or" || g == "not") { - if (g == "not") { - if (this.atomIsSelected(p, v[g])) { - l = !1; - break; - } - } else if (v[g].__cached_results === void 0 && (v = o.deepCopyAndCache(v, this)), l = v[g].__cached_results.has(p.index), !l) - break; - } else if (g === "predicate") { - if (!v.predicate(p)) { - l = !1; - break; - } - } else if (g == "properties" && p[g]) { - for (var M in v.properties) - if (!M.startsWith("__cache")) { - if (typeof p.properties[M] > "u") { - l = !1; - break; - } - if (p.properties[M] != v.properties[M]) { - l = !1; - break; - } - } - } else if (v.hasOwnProperty(g) && !o.ignoredKeys.has(g) && !g.startsWith("__cache")) { - if (typeof p[g] > "u") { - l = !1; - break; - } - var C = !1; - if (g === "bonds") { - var T = v[g]; - if (T != p.bonds.length) { - l = !1; - break; - } - } else if (Array.isArray(v[g])) { - var D = v[g], I = p[g]; - for (let B = 0; B < D.length; B++) - if (this.propertyMatches(I, D[B])) { - C = !0; - break; - } - if (!C) { - l = !1; - break; - } - } else { - let B = v[g]; - if (!this.propertyMatches(p[g], B)) { - l = !1; - break; - } - } - } - return a ? !l : l; - } - static squaredDistance(p, v) { - var a = v.x - p.x, l = v.y - p.y, g = v.z - p.z; - return a * a + l * l + g * g; - } - /** returns a list of atoms in the expanded bounding box, but not in the current one - * - * Bounding box: - * - * [ [ xmin, ymin, zmin ], - * [ xmax, ymax, zmax ], - * [ xctr, yctr, zctr ] ] - * - **/ - expandAtomList(p, v) { - if (v <= 0) - return p; - for (var a = (0, E.getExtent)(p, void 0), l = [[], [], []], g = 0; g < 3; g++) - l[0][g] = a[0][g] - v, l[1][g] = a[1][g] + v, l[2][g] = a[2][g]; - var M = []; - for (let I = 0; I < this.atoms.length; I++) { - var C = this.atoms[I].x, T = this.atoms[I].y, D = this.atoms[I].z; - C >= l[0][0] && C <= l[1][0] && T >= l[0][1] && T <= l[1][1] && D >= l[0][2] && D <= l[1][2] && (C >= a[0][0] && C <= a[1][0] && T >= a[0][1] && T <= a[1][1] && D >= a[0][2] && D <= a[1][2] || M.push(this.atoms[I])); - } - return M; - } - static getFloat(p) { - return typeof p == "number" ? p : parseFloat(p); - } - /** return list of atoms selected by sel, this is specific to glmodel - * - * @param {AtomSelectionSpec} sel - * @return {Object[]} - * @example - $3Dmol.download("pdb:4wwy",viewer,{},function(){ - var atoms = viewer.selectedAtoms({chain:'A'}); - for(var i = 0, n = atoms.length; i < n; i++) { - atoms[i].b = 0.0; - } - viewer.setStyle({cartoon:{colorscheme:{prop:'b',gradient: 'roygb',min:0,max:30}}}); - viewer.render(); - }); - */ - selectedAtoms(p, v) { - var a = []; - p = o.deepCopyAndCache(p || {}, this), v || (v = this.atoms); - for (var l = v.length, g = 0; g < l; g++) { - var M = v[g]; - M && this.atomIsSelected(M, p) && a.push(M); - } - if (p.hasOwnProperty("expand")) { - const W = o.getFloat(p.expand); - let G = this.expandAtomList(a, W), F = a.length; - const V = W * W; - for (let J = 0; J < G.length; J++) - for (let X = 0; X < F; X++) { - var C = o.squaredDistance(G[J], a[X]); - C < V && C > 0 && a.push(G[J]); - } - } - if (p.hasOwnProperty("within") && p.within.hasOwnProperty("sel") && p.within.hasOwnProperty("distance")) { - var T = this.selectedAtoms(p.within.sel, this.atoms), D = {}; - const W = o.getFloat(p.within.distance), G = W * W; - for (let F = 0; F < T.length; F++) - for (let V = 0; V < a.length; V++) { - let J = o.squaredDistance(T[F], a[V]); - J < G && J > 0 && (D[V] = 1); - } - var I = []; - if (p.within.invert) - for (let F = 0; F < a.length; F++) - D[F] || I.push(a[F]); - else - for (let F in D) - I.push(a[F]); - a = I; - } - if (p.hasOwnProperty("byres")) { - var B = {}, P = [], z = []; - for (let W = 0; W < a.length; W++) { - let G = a[W]; - var k = G.chain, N = G.resi; - if (B[k] === void 0 && (B[k] = {}), G.hasOwnProperty("resi") && B[k][N] === void 0) { - for (B[k][N] = !0, z.push(G); z.length > 0; ) - if (G = z.pop(), k = G.chain, N = G.resi, P[G.index] === void 0) { - P[G.index] = !0; - for (var R = 0; R < G.bonds.length; R++) { - var U = this.atoms[G.bonds[R]]; - P[U.index] === void 0 && U.hasOwnProperty("resi") && U.chain == k && U.resi == N && (z.push(U), a.push(U)); - } - } - } - } - } - return a; - } - /** Add list of new atoms to model. Adjusts bonds appropriately. - * - * @param {AtomSpec[]} newatoms - * @example - * var atoms = [{elem: 'C', x: 0, y: 0, z: 0, bonds: [1,2], bondOrder: [1,2]}, {elem: 'O', x: -1.5, y: 0, z: 0, bonds: [0]},{elem: 'O', x: 1.5, y: 0, z: 0, bonds: [0], bondOrder: [2]}]; - - viewer.setBackgroundColor(0xffffffff); - var m = viewer.addModel(); - m.addAtoms(atoms); - m.setStyle({},{stick:{}}); - viewer.zoomTo(); - viewer.render(); - */ - addAtoms(p) { - this.molObj = null; - var v = this.atoms.length, a = [], l; - for (l = 0; l < p.length; l++) - typeof p[l].index > "u" && (p[l].index = l), typeof p[l].serial > "u" && (p[l].serial = l), a[p[l].index] = v + l; - for (l = 0; l < p.length; l++) { - var g = p[l], M = a[g.index], C = (0, E.extend)({}, g); - C.index = M, C.bonds = [], C.bondOrder = [], C.model = this.id, C.style = C.style || (0, E.deepCopy)(o.defaultAtomStyle), typeof C.color > "u" && (C.color = this.ElementColors[C.elem] || this.defaultColor); - for (var T = g.bonds ? g.bonds.length : 0, D = 0; D < T; D++) { - var I = a[g.bonds[D]]; - typeof I < "u" && (C.bonds.push(I), C.bondOrder.push(g.bondOrder ? g.bondOrder[D] : 1)); - } - this.atoms.push(C); - } - } - /** Assign bonds based on atomic coordinates. - * This currently uses a primitive distance-based algorithm that does not - * consider valence constraints and will only create single bonds. - */ - assignBonds() { - (0, L.assignBonds)(this.atoms); - } - /** Remove specified atoms from model - * - * @param {AtomSpec[]} badatoms - list of atoms - */ - removeAtoms(p) { - this.molObj = null; - var v = [], a; - for (a = 0; a < p.length; a++) - v[p[a].index] = !0; - var l = []; - for (a = 0; a < this.atoms.length; a++) { - var g = this.atoms[a]; - v[g.index] || l.push(g); - } - this.atoms = [], this.addAtoms(l); - } - /** Set atom style of selected atoms - * - * @param {AtomSelectionSpec} sel - * @param {AtomStyleSpec} style - * @param {boolean} add - if true, add to current style, don't replace - @example - $3Dmol.download("pdb:4UB9",viewer,{},function(){ - viewer.setBackgroundColor(0xffffffff); - - viewer.setStyle({chain:'A'},{line:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'B'},{line:{colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'C'},{cross:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'D'},{cross:{colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'E'},{cross:{radius:2.0,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'F'},{stick:{hidden:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.RWB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'G'},{stick:{radius:0.8,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.ROYGB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.setStyle({chain:'H'},{stick:{singleBonds:true,colorscheme:{prop:'b',gradient: new $3Dmol.Gradient.ROYGB($3Dmol.getPropertyRange(viewer.selectedAtoms(),'b'))}}}); - viewer.render(); - }); - */ - setStyle(p, v, a) { - typeof v > "u" && typeof a > "u" && (v = p, p = {}), p = p, typeof v == "string" && (v = (0, E.specStringToObject)(v)); - var l = !1, g = this, M = function(T) { - var D = g.selectedAtoms(p, T); - for (let I = 0; I < T.length; I++) - T[I] && (T[I].capDrawn = !1); - for (let I = 0; I < D.length; I++) { - l = !0, (D[I].clickable || D[I].hoverable) && (D[I].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }), a || (D[I].style = {}); - for (let B in v) - v.hasOwnProperty(B) && (D[I].style[B] = D[I].style[B] || {}, Object.assign(D[I].style[B], v[B])); - } - }; - if (p.frame !== void 0 && p.frame < this.frames.length) { - let T = p.frame; - T < 0 && (T = this.frames.length + T), M(this.frames[T]); - } else { - M(this.atoms); - for (var C = 0; C < this.frames.length; C++) - this.frames[C] !== this.atoms && M(this.frames[C]); - } - l && (this.molObj = null); - } - /** Set clickable and callback of selected atoms - * - * @param {AtomSelectionSpec} sel - atom selection to apply clickable settings to - * @param {boolean} clickable - whether click-handling is enabled for the selection - * @param {function} callback - function called when an atom in the selection is clicked - - */ - setClickable(p, v, a) { - if (v = !!v, a = (0, E.makeFunction)(a), a === null) { - console.log("Callback is not a function"); - return; - } - var l = this.selectedAtoms(p, this.atoms), g = l.length; - for (let M = 0; M < g; M++) - l[M].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, l[M].clickable = v, a && (l[M].callback = a); - g > 0 && (this.molObj = null); - } - /** Set hoverable and callback of selected atoms - * - * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to - * @param {boolean} hoverable - whether hover-handling is enabled for the selection - * @param {function} hover_callback - function called when an atom in the selection is hovered over - * @param {function} unhover_callback - function called when the mouse moves out of the hover area - */ - setHoverable(p, v, a, l) { - if (v = !!v, a = (0, E.makeFunction)(a), l = (0, E.makeFunction)(l), a === null) { - console.log("Hover_callback is not a function"); - return; - } - if (l === null) { - console.log("Unhover_callback is not a function"); - return; - } - var g = this.selectedAtoms(p, this.atoms), M = g.length; - for (let C = 0; C < M; C++) - g[C].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, g[C].hoverable = v, a && (g[C].hover_callback = a), l && (g[C].unhover_callback = l); - M > 0 && (this.molObj = null); - } - /** enable context menu of selected atoms - * - * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to - * @param {boolean} contextMenuEnabled - whether contextMenu-handling is enabled for the selection - */ - enableContextMenu(p, v) { - v = !!v; - var a, l = this.selectedAtoms(p, this.atoms), g = l.length; - for (a = 0; a < g; a++) - l[a].intersectionShape = { sphere: [], cylinder: [], line: [], triangle: [] }, l[a].contextMenuEnabled = v; - g > 0 && (this.molObj = null); - } - /** given a mapping from element to color, set atom colors - * - * @param {AtomSelectionSpec} sel - * @param {object} colors - */ - setColorByElement(p, v) { - if (!(this.molObj !== null && o.sameObj(v, this.lastColors))) { - this.lastColors = v; - var a = this.selectedAtoms(p, a); - a.length > 0 && (this.molObj = null); - for (var l = 0; l < a.length; l++) { - var g = a[l]; - typeof v[g.elem] < "u" && (g.color = v[g.elem]); - } - } - } - /** - * @param {AtomSelectionSpec} sel - * @param {string} prop - * @param {Gradient|string} scheme - */ - setColorByProperty(p, v, a, l) { - var g, M, C = this.selectedAtoms(p, C); - for (this.lastColors = null, C.length > 0 && (this.molObj = null), typeof a == "string" && typeof c.Gradient.builtinGradients[a] < "u" && (a = new c.Gradient.builtinGradients[a]()), a = a, l || (l = a.range()), l || (l = (0, E.getPropertyRange)(C, v)), g = 0; g < C.length; g++) { - M = C[g]; - var T = (0, E.getAtomProperty)(M, v); - T != null && (M.color = a.valueToHex(parseFloat(M.properties[v]), l)); - } - } - /** - * @deprecated use setStyle and colorfunc attribute - * @param {AtomSelectionSpec} sel - selection object - * @param {function} func - function to be used to set the color - @example - $3Dmol.download("pdb:4UAA",viewer,{},function(){ - viewer.setBackgroundColor(0xffffffff); - var colorAsSnake = function(atom) { - return atom.resi % 2 ? 'white': 'green' - }; - - viewer.setStyle( {}, { cartoon: {colorfunc: colorAsSnake }}); - - viewer.render(); - }); - - */ - setColorByFunction(p, v) { - var a = this.selectedAtoms(p, a); - if (typeof v == "function") { - this.lastColors = null, a.length > 0 && (this.molObj = null); - for (let l = 0; l < a.length; l++) { - let g = a[l]; - g.color = v(g); - } - } - } - /** Convert the model into an object in the format of a ChemDoodle JSON model. - * - * @param {boolean} whether or not to include style information. Defaults to false. - * @return {Object} - */ - toCDObject(p = !1) { - var v = { a: [], b: [] }; - p && (v.s = []); - for (let l = 0; l < this.atoms.length; l++) { - let g = {}, M = this.atoms[l]; - if (g.x = M.x, g.y = M.y, g.z = M.z, M.elem != "C" && (g.l = M.elem), p) { - for (var a = 0; a < v.s.length && JSON.stringify(M.style) !== JSON.stringify(v.s[a]); ) - a++; - a === v.s.length && v.s.push(M.style), a !== 0 && (g.s = a); - } - v.a.push(g); - for (let C = 0; C < M.bonds.length; C++) { - let T = l, D = M.bonds[C]; - if (T >= D) - continue; - let I = { - b: T, - e: D - }, B = M.bondOrder[C]; - B != 1 && (I.o = B), v.b.push(I); - } - } - return v; - } - /** manage the globj for this model in the possed modelGroup - if it has to be regenerated, remove and add - * - * @param {Object3D} group - * @param Object options - */ - globj(p, v) { - (this.molObj === null || v.regen) && (this.molObj = this.createMolObj(this.atoms, v), this.renderedMolObj && (p.remove(this.renderedMolObj), this.renderedMolObj = null), this.renderedMolObj = this.molObj.clone(), this.hidden && (this.renderedMolObj.setVisible(!1), this.molObj.setVisible(!1)), p.add(this.renderedMolObj)); - } - /** return a VRML string representation of the model. Does not include VRML header information - * @return VRML - */ - exportVRML() { - var p = this.createMolObj(this.atoms, { supportsImposters: !1, supportsAIA: !1 }); - return p.vrml(); - } - /** Remove any renderable mol object from scene - * - * @param {Object3D} group - */ - removegl(p) { - this.renderedMolObj && (this.renderedMolObj.geometry !== void 0 && this.renderedMolObj.geometry.dispose(), this.renderedMolObj.material !== void 0 && this.renderedMolObj.material.dispose(), p.remove(this.renderedMolObj), this.renderedMolObj = null), this.molObj = null; - } - /** - * Don't show this model in future renderings. Keep all styles and state - * so it can be efficiencly shown again. - * - * * @see GLModel#show - - * @example - $3Dmol.download("pdb:3ucr",viewer,{},function(){ - viewer.setStyle({},{stick:{}}); - viewer.getModel().hide(); - viewer.render(); - }); - */ - hide() { - this.hidden = !0, this.renderedMolObj && this.renderedMolObj.setVisible(!1), this.molObj && this.molObj.setVisible(!1); - } - /** - * Unhide a hidden model - * @see GLModel#hide - * @example - $3Dmol.download("pdb:3ucr",viewer,{},function(){ - viewer.setStyle({},{stick:{}}); - viewer.getModel().hide(); - viewer.render( ) - viewer.getModel().show() - viewer.render(); - }); - */ - show() { - this.hidden = !1, this.renderedMolObj && this.renderedMolObj.setVisible(!0), this.molObj && this.molObj.setVisible(!0); - } - /** Create labels for atoms that show the value of the passed property. - * - * @param {String} prop - property name - * @param {AtomSelectionSpec} sel - * @param {GLViewer} viewer - * @param {LabelSpec} options - */ - addPropertyLabels(p, v, a, l) { - for (var g = this.selectedAtoms(v, g), M = (0, E.deepCopy)(l), C = 0; C < g.length; C++) { - var T = g[C], D = null; - typeof T[p] < "u" ? D = String(T[p]) : typeof T.properties[p] < "u" && (D = String(T.properties[p])), D != null && (M.position = T, a.addLabel(D, M)); - } - } - /** Create labels for residues of selected atoms. - * Will create a single label at the center of mass of all atoms - * with the same chain,resn, and resi. - * - * @param {AtomSelectionSpec} sel - * @param {GLViewer} viewer - * @param {LabelSpec} options - * @param {boolean} byframe - if true, create labels for every individual frame, not just current; frames must be loaded already - */ - addResLabels(p, v, a, l = !1) { - var g = [], M = function(T, D) { - for (var I = T.selectedAtoms(p, I), B = {}, P = 0; P < I.length; P++) { - var z = I[P], k = z.chain, N = z.resn, R = z.resi, U = N + "" + R; - B[k] || (B[k] = {}), B[k][U] || (B[k][U] = []), B[k][U].push(z); - } - var W = (0, E.deepCopy)(a); - for (let F in B) - if (B.hasOwnProperty(F)) { - var G = B[F]; - for (let V in G) - if (G.hasOwnProperty(V)) { - let J = G[V], X = new u.Vector3(0, 0, 0); - for (let te = 0; te < J.length; te++) { - let ve = J[te]; - X.x += ve.x, X.y += ve.y, X.z += ve.z; - } - X.divideScalar(J.length), W.position = X, W.frame = D; - let oe = v.addLabel(V, W, void 0, !0); - g.push(oe); - } - } - }; - if (l) { - var C = this.getNumFrames(); - let T = this.atoms; - for (let D = 0; D < C; D++) - this.frames[D] && (this.atoms = this.frames[D], M(this, D)); - this.atoms = T; - } else - M(this); - return g; - } - //recurse over the current atoms to establish a depth first order - setupDFS() { - this.atomdfs = []; - var p = this, v = new Int8Array(this.atoms.length); - v.fill(0); - for (var a = function(C, T, D) { - D.push([C, T]); - var I = p.atoms[C]; - v[C] = 1; - for (var B = 0; B < I.bonds.length; B++) { - var P = I.bonds[B]; - p.atoms[P] && !v[P] && a(P, C, D); - } - }, l = 0; l < this.atoms.length; l++) { - var g = this.atoms[l]; - if (g && !v[l]) { - var M = []; - a(l, -1, M), this.atomdfs.push(M); - } - } - } - /** - * Set coordinates from remote trajectory file. - * @param {string} url - contains the url where mdsrv has been hosted - * @param {string} path - contains the path of the file (/filename) - * @return {Promise} - */ - setCoordinatesFromURL(p, v) { - this.frames = []; - var a = this; - return this.box && this.setupDFS(), p.startsWith("http") || (p = "http://" + p), (0, E.get)(p + "/traj/numframes/" + v, function(l) { - if (!isNaN(parseInt(l))) - return a.frames.push(a.atoms), a.frames.numFrames = l, a.frames.url = p, a.frames.path = v, a.setFrame(0); - }); - } - /** - * Set coordinates for the atoms from provided trajectory file. - * @param {string|ArrayBuffer} str - contains the data of the file - * @param {string} format - contains the format of the file (mdcrd, inpcrd, pdb, netcdf, or array). Arrays should be TxNx3 where T is the number of timesteps and N the number of atoms. - @example - let m = viewer.addModel() //create an empty model - m.addAtoms([{x:0,y:0,z:0,elem:'C'},{x:2,y:0,z:0,elem:'C'}]) //provide a list of dictionaries representing the atoms - viewer.setStyle({'sphere':{}}) - m.setCoordinates([[[0.0, 0.0, 0.0], [2.0, 0.0, 0.0]], [[0.0, 0.0, 0.0], [2.8888888359069824, 0.0, 0.0]], [[0.0, 0.0, 0.0], [3.777777671813965, 0.0, 0.0]], [[0.0, 0.0, 0.0], [4.666666507720947, 0.0, 0.0]], [[0.0, 0.0, 0.0], [5.55555534362793, 0.0, 0.0]], [[0.0, 0.0, 0.0], [6.44444465637207, 0.0, 0.0]], [[0.0, 0.0, 0.0], [7.333333492279053, 0.0, 0.0]], [[0.0, 0.0, 0.0], [8.222222328186035, 0.0, 0.0]], [[0.0, 0.0, 0.0], [9.11111068725586, 0.0, 0.0]], [[0.0, 0.0, 0.0], [10.0, 0.0, 0.0]]],'array'); - viewer.animate({loop: "forward",reps: 1}); - viewer.zoomTo(); - viewer.zoom(0.5); - viewer.render(); - */ - setCoordinates(p, v) { - if (v = v || "", !p) - return []; - if (/\.gz$/.test(v)) { - v = v.replace(/\.gz$/, ""); - try { - p = s(p); - } catch (B) { - console.log(B); - } - } - var a = { mdcrd: "", inpcrd: "", pdb: "", netcdf: "", array: "" }; - if (a.hasOwnProperty(v)) { - this.frames = []; - for (var l = this.atoms.length, g = o.parseCrd(p, v), M = 0; M < g.length; ) { - for (var C = [], T = 0; T < l; T++) { - var D = {}; - for (var I in this.atoms[T]) - D[I] = this.atoms[T][I]; - C[T] = D, C[T].x = g[M++], C[T].y = g[M++], C[T].z = g[M++]; - } - this.frames.push(C); - } - return this.atoms = this.frames[0], this.frames; - } - return []; - } - /** - * add atomSpecs to validAtomSelectionSpecs - * @deprecated - * @param {Array} customAtomSpecs - array of strings that can be used as atomSelectionSpecs - * this is to prevent the 'Unknown Selector x' message on the console for the strings passed. - * These messages are no longer generated as, in theory, typescript will catch problems at compile time. - * In practice, there may still be issues at run-time but we don't check for them... - * - * What we should do is use something like https://github.com/woutervh-/typescript-is to do runtime - * type checking, but it currently doesn't work with our types... - */ - addAtomSpecs(p) { - } - static parseCrd(p, v) { - var a = [], l = 0; - if (v == "pdb") - for (var g = p.indexOf(` -ATOM`); g != -1; ) { - for (; p.slice(g, g + 5) == ` -ATOM` || p.slice(g, g + 7) == ` -HETATM`; ) - a[l++] = parseFloat(p.slice(g + 31, g + 39)), a[l++] = parseFloat(p.slice(g + 39, g + 47)), a[l++] = parseFloat(p.slice(g + 47, g + 55)), g = p.indexOf(` -`, g + 54), p.slice(g, g + 4) == ` -TER` && (g = p.indexOf(` -`, g + 5)); - g = p.indexOf(` -ATOM`, g); - } - else if (v == "netcdf") { - var M = new y.NetCDFReader(p); - a = [].concat.apply([], M.getDataVariable("coordinates")); - } else { - if (v == "array" || Array.isArray(p)) - return p.flat(2); - { - let C = p.indexOf(` -`); - v == "inpcrd" && (C = p.indexOf(` -`, C + 1)), p = p.slice(C + 1), a = p.match(/\S+/g).map(parseFloat); - } - } - return a; - } - static parseMolData(p, v = "", a) { - if (!p) - return []; - if (/\.gz$/.test(v)) { - v = v.replace(/\.gz$/, ""); - try { - p = s(p); - } catch (M) { - console.log(M); - } - } - typeof S.Parsers[v] > "u" && (v = v.split(".").pop(), typeof S.Parsers[v] > "u" && (console.log("Unknown format: " + v), p instanceof Uint8Array ? v = "mmtf" : p.match(/^@MOLECULE/gm) ? v = "mol2" : p.match(/^data_/gm) && p.match(/^loop_/gm) ? v = "cif" : p.match(/^HETATM/gm) || p.match(/^ATOM/gm) ? v = "pdb" : p.match(/ITEM: TIMESTEP/gm) ? v = "lammpstrj" : p.match(/^.*\n.*\n.\s*(\d+)\s+(\d+)/gm) ? v = "sdf" : p.match(/^%VERSION\s+VERSION_STAMP/gm) ? v = "prmtop" : v = "xyz", console.log("Best guess: " + v))); - var l = S.Parsers[v], g = l(p, a); - return g; - } - } - o.defaultAtomStyle = { - line: {} - }, o.defaultlineWidth = 1, o.vdwRadii = { - H: 1.2, - He: 1.4, - Li: 1.82, - Be: 1.53, - B: 1.92, - C: 1.7, - N: 1.55, - O: 1.52, - F: 1.47, - Ne: 1.54, - Na: 2.27, - Mg: 1.73, - Al: 1.84, - Si: 2.1, - P: 1.8, - S: 1.8, - Cl: 1.75, - Ar: 1.88, - K: 2.75, - Ca: 2.31, - Ni: 1.63, - Cu: 1.4, - Zn: 1.39, - Ga: 1.87, - Ge: 2.11, - As: 1.85, - Se: 1.9, - Br: 1.85, - Kr: 2.02, - Rb: 3.03, - Sr: 2.49, - Pd: 1.63, - Ag: 1.72, - Cd: 1.58, - In: 1.93, - Sn: 2.17, - Sb: 2.06, - Te: 2.06, - I: 1.98, - Xe: 2.16, - Cs: 3.43, - Ba: 2.68, - Pt: 1.75, - Au: 1.66, - Hg: 1.55, - Tl: 1.96, - Pb: 2.02, - Bi: 2.07, - Po: 1.97, - At: 2.02, - Rn: 2.2, - Fr: 3.48, - Ra: 2.83, - U: 1.86 - }, o.ignoredKeys = /* @__PURE__ */ new Set(["props", "invert", "model", "frame", "byres", "expand", "within", "and", "or", "not"]); - } - ), - /***/ - "./src/GLShape.ts": ( - /*!************************!*\ - !*** ./src/GLShape.ts ***! - \************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - GLShape: () => ( - /* binding */ - y - ), - /* harmony export */ - splitMesh: () => ( - /* binding */ - w - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./WebGL/shapes */ - "./src/WebGL/shapes/index.ts" - ), u = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), b = r( - /*! ./colors */ - "./src/colors.ts" - ), h = r( - /*! ./ProteinSurface4 */ - "./src/ProteinSurface4.ts" - ), _ = r( - /*! ./VolumeData */ - "./src/VolumeData.ts" - ), E = r( - /*! ./GLDraw */ - "./src/GLDraw.ts" - ), c = r( - /*! ./glcartoon */ - "./src/glcartoon.ts" - ), S = r( - /*! ./utilities */ - "./src/utilities.ts" - ); - class y { - static finalizeGeo(s) { - var o = s.updateGeoGroup(0); - o.vertices > 0 && o.truncateArrayBuffers(!0, !0); - } - /* - * - * @param {Geometry} - * geo - * @param {Color | colorlike} color - */ - static updateColor(s, o) { - o = o || b.CC.color(o), s.colorsNeedUpdate = !0; - var A, p, v; - o.constructor !== Array && (A = o.r, p = o.g, v = o.b); - for (let a in s.geometryGroups) { - let l = s.geometryGroups[a], g = l.colorArray; - for (let M = 0, C = l.vertices; M < C; ++M) { - if (o.constructor === Array) { - let T = o[M]; - A = T.r, p = T.g, v = T.b; - } - g[M * 3] = A, g[M * 3 + 1] = p, g[M * 3 + 2] = v; - } - } - } - /* - * @param {GLShape} - * shape - * @param {geometryGroup} - * geoGroup - * @param {ArrowSpec} - * spec - */ - static drawArrow(s, o, A) { - var p = A.start, v = A.end, a = A.radius, l = A.radiusRatio, g = A.mid, M = A.midpos; - if (!(p && v)) - return; - var C = o.updateGeoGroup(51), T = new u.Vector3(v.x, v.y, v.z).sub(p); - if (M) { - let he = T.length(); - M > 0 ? g = M / he : g = (he + M) / he; - } - T.multiplyScalar(g); - var D = new u.Vector3(p.x, p.y, p.z).add(T), I = T.clone().negate(); - let B = new u.Vector3(p.x, p.y, p.z); - s.intersectionShape.cylinder.push(new f.Cylinder(B, D.clone(), a)), s.intersectionShape.sphere.push(new f.Sphere(B, a)); - var P = []; - P[0] = T.clone(), Math.abs(P[0].x) > 1e-4 ? P[0].y += 1 : P[0].x += 1, P[0].cross(T), P[0].normalize(), P[4] = P[0].clone(), P[4].crossVectors(P[0], T), P[4].normalize(), P[8] = P[0].clone().negate(), P[12] = P[4].clone().negate(), P[2] = P[0].clone().add(P[4]).normalize(), P[6] = P[4].clone().add(P[8]).normalize(), P[10] = P[8].clone().add(P[12]).normalize(), P[14] = P[12].clone().add(P[0]).normalize(), P[1] = P[0].clone().add(P[2]).normalize(), P[3] = P[2].clone().add(P[4]).normalize(), P[5] = P[4].clone().add(P[6]).normalize(), P[7] = P[6].clone().add(P[8]).normalize(), P[9] = P[8].clone().add(P[10]).normalize(), P[11] = P[10].clone().add(P[12]).normalize(), P[13] = P[12].clone().add(P[14]).normalize(), P[15] = P[14].clone().add(P[0]).normalize(); - var z = C.vertices, k = C.vertexArray, N = C.faceArray, R = C.normalArray, U = C.lineArray, W, G, F; - for (G = 0, F = P.length; G < F; ++G) { - W = 3 * (z + 3 * G); - var V = P[G].clone().multiplyScalar(a).add(p), J = P[G].clone().multiplyScalar(a).add(D), X = P[G].clone().multiplyScalar(a * l).add(D); - if (k[W] = V.x, k[W + 1] = V.y, k[W + 2] = V.z, k[W + 3] = J.x, k[W + 4] = J.y, k[W + 5] = J.z, k[W + 6] = X.x, k[W + 7] = X.y, k[W + 8] = X.z, G > 0) { - var oe = k[W - 3], te = k[W - 2], ve = k[W - 1], se = new u.Vector3(oe, te, ve), le = new u.Vector3(v.x, v.y, v.z), Ce = D.clone(), be = new u.Vector3(X.x, X.y, X.z); - s.intersectionShape.triangle.push(new f.Triangle(be, le, se)), s.intersectionShape.triangle.push(new f.Triangle(se.clone(), Ce, be.clone())); - } - } - C.vertices += 48, W = C.vertices * 3, k[W] = p.x, k[W + 1] = p.y, k[W + 2] = p.z, k[W + 3] = D.x, k[W + 4] = D.y, k[W + 5] = D.z, k[W + 6] = v.x, k[W + 7] = v.y, k[W + 8] = v.z, C.vertices += 3; - var Le, ae, _e, Ee, Be, Ne, Ge, ke, pe, de, ce, Ae, Oe, We, Ue, Z, j, ee, ge, ye = C.vertices - 3, $e = C.vertices - 2, Re = C.vertices - 1, Y = ye * 3, ue = $e * 3, Se = Re * 3; - for (G = 0, F = P.length - 1; G < F; ++G) { - var Fe = z + 3 * G; - W = Fe * 3, ae = C.faceidx, _e = C.lineidx, Ee = Fe, de = Ee * 3, Be = Fe + 1, ce = Be * 3, Ne = Fe + 2, Ae = Ne * 3, Ge = Fe + 4, Oe = Ge * 3, ke = Fe + 5, We = ke * 3, pe = Fe + 3, Ue = pe * 3, Z = j = P[G], ee = ge = P[G + 1], R[de] = Z.x, R[ce] = j.x, R[Ue] = ge.x, R[de + 1] = Z.y, R[ce + 1] = j.y, R[Ue + 1] = ge.y, R[de + 2] = Z.z, R[ce + 2] = j.z, R[Ue + 2] = ge.z, R[ce] = j.x, R[Oe] = ee.x, R[Ue] = ge.x, R[ce + 1] = j.y, R[Oe + 1] = ee.y, R[Ue + 1] = ge.y, R[ce + 2] = j.z, R[Oe + 2] = ee.z, R[Ue + 2] = ge.z, R[Ae] = j.x, R[We] = ee.x, R[Ae + 1] = j.y, R[We + 1] = ee.y, R[Ae + 2] = j.z, R[We + 2] = ee.z, N[ae] = Ee, N[ae + 1] = Be, N[ae + 2] = pe, N[ae + 3] = Be, N[ae + 4] = Ge, N[ae + 5] = pe, N[ae + 6] = Ee, N[ae + 7] = pe, N[ae + 8] = ye, N[ae + 9] = Ne, N[ae + 10] = $e, N[ae + 11] = ke, N[ae + 12] = Ne, N[ae + 13] = Re, N[ae + 14] = ke, U[_e] = Ee, U[_e + 1] = Be, U[_e + 2] = Ee, U[_e + 3] = pe, U[_e + 4] = Ge, U[_e + 5] = pe, U[_e + 6] = Ee, U[_e + 7] = pe, U[_e + 8] = Ne, U[_e + 9] = Be, U[_e + 10] = Ne, U[_e + 11] = ke, U[_e + 12] = Ge, U[_e + 13] = ke, U[_e + 14] = Ne, U[_e + 15] = Re, U[_e + 16] = Ne, U[_e + 17] = ke, U[_e + 18] = Re, U[_e + 19] = ke, C.faceidx += 15, C.lineidx += 20; - } - Le = [ - z + 45, - z + 46, - z + 1, - z, - z + 47, - z + 2 - ], ae = C.faceidx, _e = C.lineidx, Ee = Le[0], de = Ee * 3, Be = Le[1], ce = Be * 3, Ne = Le[4], Ae = Ne * 3, Ge = Le[2], Oe = Ge * 3, ke = Le[5], We = ke * 3, pe = Le[3], Ue = pe * 3, Z = j = P[15], ee = ge = P[0], R[de] = Z.x, R[ce] = j.x, R[Ue] = ge.x, R[de + 1] = Z.y, R[ce + 1] = j.y, R[Ue + 1] = ge.y, R[de + 2] = Z.z, R[ce + 2] = j.z, R[Ue + 2] = ge.z, R[ce] = j.x, R[Oe] = ee.x, R[Ue] = ge.x, R[ce + 1] = j.y, R[Oe + 1] = ee.y, R[Ue + 1] = ge.y, R[ce + 2] = j.z, R[Oe + 2] = ee.z, R[Ue + 2] = ge.z, R[Ae] = j.x, R[We] = ee.x, R[Ae + 1] = j.y, R[We + 1] = ee.y, R[Ae + 2] = j.z, R[We + 2] = ee.z, T.normalize(), I.normalize(), R[Y] = I.x, R[ue] = R[Se] = T.x, R[Y + 1] = I.y, R[ue + 1] = R[Se + 1] = T.y, R[Y + 2] = I.z, R[ue + 2] = R[Se + 2] = T.z, N[ae] = Ee, N[ae + 1] = Be, N[ae + 2] = pe, N[ae + 3] = Be, N[ae + 4] = Ge, N[ae + 5] = pe, N[ae + 6] = Ee, N[ae + 7] = pe, N[ae + 8] = ye, N[ae + 9] = Ne, N[ae + 10] = $e, N[ae + 11] = ke, N[ae + 12] = Ne, N[ae + 13] = Re, N[ae + 14] = ke, U[_e] = Ee, U[_e + 1] = Be, U[_e + 2] = Ee, U[_e + 3] = pe, U[_e + 4] = Ge, U[_e + 5] = pe, U[_e + 6] = Ee, U[_e + 7] = pe, U[_e + 8] = Ne, U[_e + 9] = Be, U[_e + 10] = Ne, U[_e + 11] = ke, U[_e + 12] = Ge, U[_e + 13] = ke, U[_e + 14] = Ne, U[_e + 15] = Re, U[_e + 16] = Ne, U[_e + 17] = ke, U[_e + 18] = Re, U[_e + 19] = ke, C.faceidx += 15, C.lineidx += 20; - } - // Update a bounding sphere's position and radius - // from list of centroids and new points - /* - * @param {Sphere} - * sphere - * @param {Object} - * components, centroid of all objects in shape - * @param {Array} - * points, flat array of all points in shape - * @param {int} numPoints, number of valid poitns in points - */ - static updateBoundingFromPoints(s, o, A, p) { - s.center.set(0, 0, 0); - let v = 1 / 0, a = 1 / 0, l = 1 / 0, g = -1 / 0, M = -1 / 0, C = -1 / 0; - s.box && (v = s.box.min.x, g = s.box.max.x, a = s.box.min.y, M = s.box.max.y, l = s.box.min.z, C = s.box.max.z); - for (let B = 0, P = p; B < P; B++) { - var T = A[B * 3], D = A[B * 3 + 1], I = A[B * 3 + 2]; - T < v && (v = T), D < a && (a = D), I < l && (l = I), T > g && (g = T), D > M && (M = D), I > C && (C = I); - } - s.center.set((g + v) / 2, (M + a) / 2, (C + l) / 2), s.radius = s.center.distanceTo({ x: g, y: M, z: C }), s.box = { min: { x: v, y: a, z: l }, max: { x: g, y: M, z: C } }; - } - //helper function for adding an appropriately sized mesh - static addCustomGeo(s, o, A, p, v) { - var a = o.addGeoGroup(), l = A.vertexArr, g = A.normalArr, M = A.faceArr; - a.vertices = l.length, a.faceidx = M.length; - var C, T, D, I, B, P, z, k, N, R = a.vertexArray, U = a.colorArray; - for (p.constructor !== Array && (k = p.r, N = p.g, I = p.b), P = 0, z = a.vertices; P < z; ++P) - C = P * 3, T = l[P], R[C] = T.x, R[C + 1] = T.y, R[C + 2] = T.z, p.constructor === Array && (B = p[P], k = B.r, N = B.g, I = B.b), U[C] = k, U[C + 1] = N, U[C + 2] = I; - if (v) - for (P = 0, z = a.faceidx / 3; P < z; ++P) { - C = P * 3, D = M[C], I = M[C + 1], B = M[C + 2]; - var W = new u.Vector3(), G = new u.Vector3(), F = new u.Vector3(); - s.intersectionShape.triangle.push(new f.Triangle(W.copy(l[D]), G.copy(l[I]), F.copy(l[B]))); - } - if (v) { - var V = new u.Vector3(0, 0, 0), J = 0; - for (let te = 0; te < o.geometryGroups.length; te++) - V.add(o.geometryGroups[te].getCentroid()), J++; - V.divideScalar(J), y.updateBoundingFromPoints(s.boundingSphere, { centroid: V }, R, a.vertices); - } - if (a.faceArray = new Uint16Array(M), a.truncateArrayBuffers(!0, !0), g.length < a.vertices) - a.setNormals(); - else { - var X = a.normalArray = new Float32Array(a.vertices * 3), oe; - for (P = 0, z = a.vertices; P < z; ++P) - C = P * 3, oe = g[P], X[C] = oe.x, X[C + 1] = oe.y, X[C + 2] = oe.z; - } - a.setLineIndices(), a.lineidx = a.lineArray.length; - } - /* - * - * @param {$3Dmol.GLShape} - * shape - * @param {ShapeSpec} - * stylespec - * @returns {undefined} - */ - static updateFromStyle(s, o) { - typeof o.color < "u" ? (s.color = o.color || new b.Color(), o.color instanceof b.Color || (s.color = b.CC.color(o.color))) : s.color = b.CC.color(0), s.wireframe = !!o.wireframe, s.opacity = o.alpha ? (0, u.clamp)(o.alpha, 0, 1) : 1, typeof o.opacity < "u" && (s.opacity = (0, u.clamp)(o.opacity, 0, 1)), s.side = o.side !== void 0 ? o.side : n.DoubleSide, s.linewidth = typeof o.linewidth > "u" ? 1 : o.linewidth, s.clickable = !!o.clickable, s.callback = (0, S.makeFunction)(o.callback), s.hoverable = !!o.hoverable, s.hover_callback = (0, S.makeFunction)(o.hover_callback), s.unhover_callback = (0, S.makeFunction)(o.unhover_callback), s.hidden = o.hidden, s.frame = o.frame; - } - /** - * Custom renderable shape - * - * @constructor - * - * @param {ShapeSpec} stylespec - */ - constructor(s) { - this.color = 16777215, this.hidden = !1, this.wireframe = !1, this.opacity = 1, this.linewidth = 1, this.clickable = !1, this.hoverable = !1, this.side = n.DoubleSide, this.stylespec = s || {}, this.boundingSphere = new f.Sphere(), this.intersectionShape = { - sphere: [], - cylinder: [], - line: [], - triangle: [] - }, y.updateFromStyle(this, this.stylespec), this.components = [], this.shapeObj = null, this.renderedShapeObj = null, this.geo = new n.Geometry(!0), this.linegeo = new n.Geometry(!0); - } - /** Update shape with new style specification - * @param {ShapeSpec} newspec - @example - let sphere = viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'}); - sphere.updateStyle({color:'yellow',opacity:0.5}); - viewer.render(); - */ - updateStyle(s) { - for (var o in s) - this.stylespec[o] = s[o]; - if (y.updateFromStyle(this, this.stylespec), s.voldata && s.volscheme) { - (0, S.adjustVolumeStyle)(s); - const A = s.volscheme, p = s.voldata, v = b.CC, a = A.range() || [-1, 1]; - this.geo.setColors(function(l, g, M) { - let C = p.getVal(l, g, M); - return v.color(A.valueToHex(C, a)); - }), delete this.color; - } - } - /** - * Creates a custom shape from supplied vertex and face arrays - * @param {CustomShapeSpec} customSpec - */ - addCustom(s) { - s.vertexArr = s.vertexArr || [], s.faceArr = s.faceArr || [], s.normalArr = s.normalArr || [], y.drawCustom(this, this.geo, s); - } - /** - * Creates a sphere shape - * @param {SphereSpec} sphereSpec - @example - viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'}); - - viewer.render(); - */ - addSphere(s) { - s.center || (s.center = new u.Vector3(0, 0, 0)), s.radius = s.radius ? (0, u.clamp)(s.radius, 0, 1 / 0) : 1.5, s.color = b.CC.color(s.color), this.intersectionShape.sphere.push(new f.Sphere(s.center, s.radius)), E.GLDraw.drawSphere(this.geo, s.center, s.radius, s.color, s.quality), this.components.push({ - centroid: new u.Vector3(s.center.x, s.center.y, s.center.z) - }); - var o = this.geo.updateGeoGroup(0); - y.updateBoundingFromPoints(this.boundingSphere, this.components, o.vertexArray, o.vertices); - } - /** - * Creates a box - * @param {BoxSpec} boxSpec - @example - var shape = viewer.addShape({color:'red'}); - shape.addBox({corner: {x:1,y:2,z:0}, dimensions: {w: 4, h: 2, d: 6}}); - shape.addBox({corner: {x:-5,y:-3,z:0}, - dimensions: { w: {x:1,y:1,z:0}, - h: {x:-1,y:1,z:0}, - d: {x:0,y:0,z:1} }}); - viewer.zoomTo(); - viewer.rotate(30); - viewer.render(); - */ - addBox(s) { - var o = s.dimensions || { w: 1, h: 1, d: 1 }, A; - typeof o.w == "number" ? A = { x: o.w, y: 0, z: 0 } : A = o.w; - var p; - typeof o.h == "number" ? p = { x: 0, y: o.h, z: 0 } : p = o.h; - var v; - typeof o.d == "number" ? v = { x: 0, y: 0, z: o.d } : v = o.d; - var a = s.corner; - a == null && (s.center !== void 0 ? a = { - x: s.center.x - 0.5 * (A.x + p.x + v.x), - y: s.center.y - 0.5 * (A.y + p.y + v.y), - z: s.center.z - 0.5 * (A.z + p.z + v.z) - } : a = { x: 0, y: 0, z: 0 }); - var l = [ - { x: a.x, y: a.y, z: a.z }, - { x: a.x + A.x, y: a.y + A.y, z: a.z + A.z }, - { x: a.x + p.x, y: a.y + p.y, z: a.z + p.z }, - { x: a.x + A.x + p.x, y: a.y + A.y + p.y, z: a.z + A.z + p.z }, - { x: a.x + v.x, y: a.y + v.y, z: a.z + v.z }, - { x: a.x + A.x + v.x, y: a.y + A.y + v.y, z: a.z + A.z + v.z }, - { x: a.x + p.x + v.x, y: a.y + p.y + v.y, z: a.z + p.z + v.z }, - { x: a.x + A.x + p.x + v.x, y: a.y + A.y + p.y + v.y, z: a.z + A.z + p.z + v.z } - ], g = [], M = []; - g.splice(g.length, 0, l[0], l[1], l[2], l[3]), M.splice(M.length, 0, 0, 2, 1, 1, 2, 3); - var C = 4; - g.splice(g.length, 0, l[2], l[3], l[6], l[7]), M.splice(M.length, 0, C + 0, C + 2, C + 1, C + 1, C + 2, C + 3), C += 4, g.splice(g.length, 0, l[4], l[5], l[0], l[1]), M.splice(M.length, 0, C + 0, C + 2, C + 1, C + 1, C + 2, C + 3), C += 4, g.splice(g.length, 0, l[6], l[7], l[4], l[5]), M.splice(M.length, 0, C + 0, C + 2, C + 1, C + 1, C + 2, C + 3), C += 4, g.splice(g.length, 0, l[3], l[1], l[7], l[5]), M.splice(M.length, 0, C + 0, C + 2, C + 1, C + 1, C + 2, C + 3), C += 4, g.splice(g.length, 0, l[2], l[6], l[0], l[4]), M.splice(M.length, 0, C + 0, C + 2, C + 1, C + 1, C + 2, C + 3), C += 4; - var T = (0, S.extend)({}, s); - T.vertexArr = g, T.faceArr = M, T.normalArr = [], y.drawCustom(this, this.geo, T); - var D = new u.Vector3(); - this.components.push({ - centroid: D.addVectors(l[0], l[7]).multiplyScalar(0.5) - }); - var I = this.geo.updateGeoGroup(0); - y.updateBoundingFromPoints(this.boundingSphere, this.components, I.vertexArray, I.vertices); - } - /** - * Creates a cylinder shape - * @param {CylinderSpec} cylinderSpec - @example - viewer.addCylinder({start:{x:0.0,y:0.0,z:0.0}, - end:{x:10.0,y:0.0,z:0.0}, - radius:1.0, - fromCap:1, - toCap:2, - color:'red', - hoverable:true, - clickable:true, - callback:function(){ this.color.setHex(0x00FFFF00);viewer.render( );}, - hover_callback: function(){ viewer.render( );}, - unhover_callback: function(){ this.color.setHex(0xFF000000);viewer.render( );} - }); - viewer.addCylinder({start:{x:0.0,y:2.0,z:0.0}, - end:{x:0.0,y:10.0,z:0.0}, - radius:0.5, - fromCap:false, - toCap:true, - color:'teal'}); - viewer.addCylinder({start:{x:15.0,y:0.0,z:0.0}, - end:{x:20.0,y:0.0,z:0.0}, - radius:1.0, - color:'black', - fromCap:false, - toCap:false}); - viewer.render(); - */ - addCylinder(s) { - var o, A; - s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0), s.end ? (A = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof A.x > "u" && (A.x = 3)) : A = new u.Vector3(0, 0, 0); - var p = s.radius || 0.1, v = b.CC.color(s.color); - this.intersectionShape.cylinder.push(new f.Cylinder(o, A, p)), E.GLDraw.drawCylinder(this.geo, o, A, p, v, s.fromCap, s.toCap); - var a = new u.Vector3(); - this.components.push({ - centroid: a.addVectors(o, A).multiplyScalar(0.5) - }); - var l = this.geo.updateGeoGroup(0); - y.updateBoundingFromPoints(this.boundingSphere, this.components, l.vertexArray, l.vertices); - } - /** - * Creates a dashed cylinder shape - * @param {CylinderSpec} cylinderSpec - */ - addDashedCylinder(s) { - s.dashLength = s.dashLength || 0.25, s.gapLength = s.gapLength || 0.25; - var o; - s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0); - var A; - s.end ? (A = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof A.x > "u" && (A.x = 3)) : A = new u.Vector3(3, 0, 0); - for (var p = s.radius || 0.1, v = b.CC.color(s.color), a = Math.sqrt(Math.pow(o.x - A.x, 2) + Math.pow(o.y - A.y, 2) + Math.pow(o.z - A.z, 2)), l = a / (s.gapLength + s.dashLength), g = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0), M = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), C = new u.Vector3((A.x - o.x) / (a / s.gapLength), (A.y - o.y) / (a / s.gapLength), (A.z - o.z) / (a / s.gapLength)), T = new u.Vector3((A.x - o.x) / (a / s.dashLength), (A.y - o.y) / (a / s.dashLength), (A.z - o.z) / (a / s.dashLength)), D = 0; D < l; D++) - M = new u.Vector3(g.x + T.x, g.y + T.y, g.z + T.z), this.intersectionShape.cylinder.push(new f.Cylinder(g, M, p)), E.GLDraw.drawCylinder(this.geo, g, M, p, v, s.fromCap, s.toCap), g = new u.Vector3(M.x + C.x, M.y + C.y, M.z + C.z); - var I = new u.Vector3(); - this.components.push({ - centroid: I.addVectors(o, A).multiplyScalar(0.5) - }); - var B = this.geo.updateGeoGroup(0); - y.updateBoundingFromPoints(this.boundingSphere, this.components, B.vertexArray, B.vertices); - } - /** - * Creates a curved shape - * @param {CurveSpec} curveSpec - */ - addCurve(s) { - s.points = s.points || [], s.smooth = s.smooth || 10, typeof s.fromCap > "u" && (s.fromCap = 2), typeof s.toCap > "u" && (s.toCap = 2); - var o = (0, c.subdivide_spline)(s.points, s.smooth); - if (o.length < 3) { - console.log("Too few points in addCurve"); - return; - } - var A = s.radius || 0.1, p = b.CC.color(s.color), v = 0, a = o.length - 1, l = o[0].distanceTo(o[1]), g = Math.ceil(2 * A / l); - if (s.toArrow) { - a -= g; - let D = { - start: o[a], - end: o[o.length - 1], - radius: A, - color: p, - mid: 1e-4 - }; - this.addArrow(D); - } - if (s.fromArrow) { - v += g; - let D = { - start: o[v], - end: o[0], - radius: A, - color: p, - mid: 1e-4 - }; - this.addArrow(D); - } - for (var M = Math.ceil(o.length / 2), C = { radius: A, color: p, fromCap: 2, toCap: 2 }, T = v; T < a; T++) - C.start = o[T], C.end = o[T + 1], C.fromCap = 2, C.toCap = 2, T < M ? (C.fromCap = 2, C.toCap = 0) : T > M ? (C.fromCap = 0, C.toCap = 2) : (C.fromCap = 2, C.toCap = 2), this.addCylinder(C); - } - /** - * Creates a line shape - * @param {LineSpec} lineSpec - @example - $3Dmol.download("pdb:2ABJ",viewer,{},function(){ - viewer.addLine({dashed:true,start:{x:0,y:0,z:0},end:{x:100,y:100,z:100}}); - viewer.render(callback); - }); - - */ - addLine(s) { - var o, A; - s.start ? o = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : o = new u.Vector3(0, 0, 0), s.end ? (A = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof A.x > "u" && (A.x = 3)) : A = new u.Vector3(3, 0, 0); - var p = this.geo.updateGeoGroup(2), v = p.vertices, a = v * 3, l = p.vertexArray; - l[a] = o.x, l[a + 1] = o.y, l[a + 2] = o.z, l[a + 3] = A.x, l[a + 4] = A.y, l[a + 5] = A.z, p.vertices += 2; - var g = p.lineArray, M = p.lineidx; - g[M] = v, g[M + 1] = v + 1, p.lineidx += 2; - var C = new u.Vector3(); - this.components.push({ - centroid: C.addVectors(o, A).multiplyScalar(0.5) - }), p = this.geo.updateGeoGroup(0), y.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices); - } - /** - * Creates an arrow shape - * @param {ArrowSpec} arrowSpec - @example - $3Dmol.download("pdb:4DM7",viewer,{},function(){ - viewer.setBackgroundColor(0xffffffff); - viewer.addArrow({ - start: {x:-10.0, y:0.0, z:0.0}, - end: {x:0.0, y:-10.0, z:0.0}, - radius: 1.0, - radiusRadio:1.0, - mid:1.0, - clickable:true, - callback:function(){ - this.color.setHex(0xFF0000FF); - viewer.render( ); - } - }); - viewer.render(); - }); - */ - addArrow(s) { - if (s.start ? s.start = new u.Vector3(s.start.x || 0, s.start.y || 0, s.start.z || 0) : s.start = new u.Vector3(0, 0, 0), s.dir instanceof u.Vector3 && typeof s.length == "number") { - var o = s.dir.clone().multiplyScalar(s.length).add(s.start); - s.end = o; - } else - s.end ? (s.end = new u.Vector3(s.end.x, s.end.y || 0, s.end.z || 0), typeof s.end.x > "u" && (s.end.x = 3)) : s.end = new u.Vector3(3, 0, 0); - s.radius = s.radius || 0.1, s.radiusRatio = s.radiusRatio || 1.618034, s.mid = 0 < s.mid && s.mid < 1 ? s.mid : 0.618034, y.drawArrow(this, this.geo, s); - var A = new u.Vector3(); - this.components.push({ - centroid: A.addVectors(s.start, s.end).multiplyScalar(0.5) - }); - var p = this.geo.updateGeoGroup(0); - y.updateBoundingFromPoints(this.boundingSphere, this.components, p.vertexArray, p.vertices); - } - static distance_from(s, o) { - return Math.sqrt(Math.pow(s.x - o.x, 2) + Math.pow(s.y - o.y, 2) + Math.pow(s.z - o.z, 2)); - } - static inSelectedRegion(s, o, A) { - for (var p = 0; p < o.length; p++) - if (y.distance_from(o[p], s) <= A) - return !0; - return !1; - } - /** - * Create isosurface from voluemetric data. - * @param {VolumeData} data - volumetric input data - * @param {IsoSurfaceSpec} isoSpec - volumetric data shape specification - * @example //the user can specify a selected region for the isosurface - $.get('../test_structs/benzene-homo.cube', function(data){ - var voldata = new $3Dmol.VolumeData(data, "cube"); - viewer.addIsosurface(voldata, {isoval: 0.01, - color: "blue", - alpha: 0.5, - smoothness: 10}); - viewer.addIsosurface(voldata, {isoval: -0.01, - color: "red", - smoothness: 5, - opacity:0.5, - wireframe:true, - clickable:true, - callback: - function() { - this.opacity = 0.0; - viewer.render( ); - }}); - viewer.setStyle({}, {stick:{}}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addIsosurface(s, o, A) { - var p = o.isoval !== void 0 && typeof o.isoval == "number" ? o.isoval : 0, v = !!o.voxel, a = o.smoothness === void 0 ? 1 : o.smoothness, l = s.size.x, g = s.size.y, M = s.size.z, C = new Int16Array(l * g * M), T = s.data, D, I; - for (D = 0, I = C.length; D < I; ++D) - C[D] = -1; - var B = new Uint8Array(l * g * M); - for (D = 0, I = T.length; D < I; ++D) { - var P = p >= 0 ? T[D] - p : p - T[D]; - P > 0 && (B[D] |= y.ISDONE); - } - var z = [], k = []; - h.MarchingCube.march(B, z, k, { - fulltable: !0, - voxel: v, - unitCube: s.unit, - origin: s.origin, - matrix: s.matrix, - nX: l, - nY: g, - nZ: M - }), !v && a > 0 && h.MarchingCube.laplacianSmooth(a, z, k); - var N = [], R = [], U = []; - if (o.selectedRegion && o.coords === void 0 && (o.coords = o.selectedRegion), o.coords !== void 0) { - var W = o.coords[0].x, G = o.coords[0].y, F = o.coords[0].z, V = o.coords[0].x, J = o.coords[0].y, X = o.coords[0].z; - for (let ae = 0; ae < o.coords.length; ae++) - o.coords[ae].x > W ? W = o.coords[ae].x : o.coords[ae].x < V && (V = o.coords[ae].x), o.coords[ae].y > G ? G = o.coords[ae].y : o.coords[ae].y < J && (J = o.coords[ae].y), o.coords[ae].z > F ? F = o.coords[ae].z : o.coords[ae].z < X && (X = o.coords[ae].z); - var oe = 2; - o.radius !== void 0 && (oe = o.radius), o.selectedOffset !== void 0 && (oe = o.selectedOffset), o.seldist !== void 0 && (oe = o.seldist), V -= oe, W += oe, J -= oe, G += oe, X -= oe, F += oe; - for (let ae = 0; ae < z.length; ae++) - z[ae].x > V && z[ae].x < W && z[ae].y > J && z[ae].y < G && z[ae].z > X && z[ae].z < F && y.inSelectedRegion(z[ae], o.coords, oe) ? (N.push(R.length), R.push(z[ae])) : N.push(-1); - for (let ae = 0; ae + 2 < k.length; ae += 3) - N[k[ae]] !== -1 && N[k[ae + 1]] !== -1 && N[k[ae + 2]] !== -1 && (U.push(k[ae] - (k[ae] - N[k[ae]])), U.push(k[ae + 1] - (k[ae + 1] - N[k[ae + 1]])), U.push(k[ae + 2] - (k[ae + 2] - N[k[ae + 2]]))); - z = R, k = U; - } - y.drawCustom(this, this.geo, { - vertexArr: z, - faceArr: k, - normalArr: [], - clickable: o.clickable, - hoverable: o.hoverable - }), this.updateStyle(o); - var te = new u.Vector3(s.origin.x, s.origin.y, s.origin.z), ve = new u.Vector3(s.size.x * s.unit.x, s.size.y * s.unit.y, s.size.z * s.unit.z), se = new u.Vector3(0, 0, 0), le = te.clone(), Ce = te.clone().add(ve); - for (let ae = 0; ae < z.length; ae++) - se.add(z[ae]), le.max(z[ae]), Ce.min(z[ae]); - se.divideScalar(z.length); - var be = se.distanceTo(Ce), Le = se.distanceTo(le); - this.boundingSphere.center = se, this.boundingSphere.radius = Math.max(be, Le), typeof A == "function" && A(); - } - /** - * @deprecated Use addIsosurface instead - * Creates custom shape from volumetric data - * @param {string} data - Volumetric input data - * @param {string} fmt - Input data format (e.g. 'cube' for cube file format) - * @param {IsoSurfaceSpec} isoSpec - Volumetric data shape specification - */ - addVolumetricData(s, o, A) { - s = new _.VolumeData(s, o), this.addIsosurface(s, A); - } - //for internal use, truncate buffers to save memory - finalize() { - return y.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.geo; - } - /* - * Initialize webgl objects for rendering - * @param {$3Dmol.Object3D} group - * - */ - globj(s) { - if (this.renderedShapeObj && (s.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) { - y.finalizeGeo(this.geo), this.geo.initTypedArrays(), this.wireframe && this.geo.setUpWireframe(), typeof this.color < "u" && y.updateColor(this.geo, this.color), this.shapeObj = new n.Object3D(); - var o = null; - this.side == n.DoubleSide ? o = new n.MeshDoubleLambertMaterial({ - wireframe: this.wireframe, - side: this.side, - transparent: this.opacity < 1, - opacity: this.opacity, - wireframeLinewidth: this.linewidth, - vertexColors: n.Coloring.VertexColors - }) : o = new n.MeshLambertMaterial({ - wireframe: this.wireframe, - side: this.side, - transparent: this.opacity < 1, - opacity: this.opacity, - wireframeLinewidth: this.linewidth, - vertexColors: n.Coloring.VertexColors - }); - var A = new n.Mesh(this.geo, o); - this.shapeObj.add(A); - var p = new n.LineBasicMaterial({ - linewidth: this.linewidth, - color: this.color - }), v = new n.Line(this.linegeo, p, n.LineStyle.LinePieces); - this.shapeObj.add(v), this.renderedShapeObj = this.shapeObj.clone(), s.add(this.renderedShapeObj); - } - } - removegl(s) { - this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), s.remove(this.renderedShapeObj), this.renderedShapeObj = null), this.shapeObj = null; - } - get position() { - return this.boundingSphere.center; - } - get x() { - return this.boundingSphere.center.x; - } - get y() { - return this.boundingSphere.center.y; - } - get z() { - return this.boundingSphere.center.z; - } - } - y.ISDONE = 2, y.drawCustom = function(L, s, o) { - var A = o, p = A.vertexArr, v = A.faceArr; - (p.length === 0 || v.length === 0) && console.warn("Error adding custom shape component: No vertices and/or face indices supplied!"); - var a = o.color; - typeof a > "u" && (a = L.color), a = b.CC.color(a); - for (var l = w(A), g = 0, M = l.length; g < M; g++) - y.addCustomGeo(L, s, l[g], l[g].colorArr ? l[g].colorArr : a, o.clickable); - }; - function w(L) { - var s = 64e3; - if (L.vertexArr.length < s) - return [L]; - var o = [{ vertexArr: [], normalArr: [], faceArr: [] }]; - L.colorArr && (o.colorArr = []); - var A = [], p = [], v = 0, a = L.faceArr; - for (let g = 0, M = a.length; g < M; g += 3) { - let C = o[v]; - for (let T = 0; T < 3; T++) { - var l = a[g + T]; - A[l] !== v && (A[l] = v, p[l] = C.vertexArr.length, C.vertexArr.push(L.vertexArr[l]), L.normalArr && L.normalArr[l] && C.normalArr.push(L.normalArr[l]), L.colorArr && L.colorArr[l] && C.colorArr.push(L.colorArr[l])), C.faceArr.push(p[l]); - } - C.vertexArr.length >= s && (o.push({ vertexArr: [], normalArr: [], faceArr: [] }), L.colorArr && (o.colorArr = []), v++); - } - return o; - } - } - ), - /***/ - "./src/GLViewer.ts": ( - /*!*************************!*\ - !*** ./src/GLViewer.ts ***! - \*************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - GLViewer: () => ( - /* binding */ - s - ), - /* harmony export */ - createStereoViewer: () => ( - /* binding */ - p - ), - /* harmony export */ - createViewer: () => ( - /* binding */ - o - ), - /* harmony export */ - createViewerGrid: () => ( - /* binding */ - A - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), u = r( - /*! ./colors */ - "./src/colors.ts" - ), b = r( - /*! ./utilities */ - "./src/utilities.ts" - ), h = r( - /*! ./Gradient */ - "./src/Gradient.ts" - ), _ = r( - /*! ./GLModel */ - "./src/GLModel.ts" - ), E = r( - /*! ./Label */ - "./src/Label.ts" - ), c = r( - /*! ./GLShape */ - "./src/GLShape.ts" - ), S = r( - /*! ./VolumeData */ - "./src/VolumeData.ts" - ), y = r( - /*! ./ProteinSurface4 */ - "./src/ProteinSurface4.ts" - ), w = r( - /*! ./VolumetricRender */ - "./src/VolumetricRender.ts" - ), L = r( - /*! upng-js */ - "./node_modules/upng-js/UPNG.js" - ); - class s { - //reimplement jquery getwidth/height - getRect() { - let a = this.container, l = a.getBoundingClientRect(); - if (l.width == 0 && l.height == 0 && a.style.display === "none") { - let g = a.style.position, M = a.style.visibility; - a.style.display = "block", a.style.visibility = "hidden", a.style.position = "absolute", l = a.getBoundingClientRect(), a.style.display = "none", a.style.visibility = M, a.style.position = g; - } - return l; - } - getWidth() { - return this.getRect().width; - } - getHeight() { - return this.getRect().height; - } - setupRenderer() { - this.renderer = new n.Renderer({ - antialias: this.config.antialias, - preserveDrawingBuffer: !0, - premultipliedAlpha: !1, - id: this.config.id, - row: this.config.row, - col: this.config.col, - rows: this.config.rows, - cols: this.config.cols, - canvas: this.config.canvas, - //cannot initialize with zero size - containerWidth: this.WIDTH || 1, - containerHeight: this.HEIGHT || 1 - }), this.renderer.domElement.style.width = "100%", this.renderer.domElement.style.height = "100%", this.renderer.domElement.style.padding = "0", this.renderer.domElement.style.position = "absolute", this.renderer.domElement.style.top = "0px", this.renderer.domElement.style.left = "0px", this.renderer.domElement.style.zIndex = "0"; - } - initializeScene() { - this.scene = new n.Scene(), this.scene.fog = new n.Fog(this.bgColor, 100, 200), this.modelGroup = new n.Object3D(), this.rotationGroup = new n.Object3D(), this.rotationGroup.useQuaternion = !0, this.rotationGroup.quaternion = new f.Quaternion(0, 0, 0, 1), this.rotationGroup.add(this.modelGroup), this.scene.add(this.rotationGroup); - var a = new n.Light(16777215); - a.position = new f.Vector3(0.2, 0.2, 1).normalize(), a.intensity = 1, this.scene.add(a); - } - initContainer(a) { - this.container = a, this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight(), this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.renderer.setSize(this.WIDTH, this.HEIGHT), this.container.append(this.renderer.domElement), this.glDOM = this.renderer.domElement, this.nomouse || (this.glDOM.addEventListener("mousedown", this._handleMouseDown.bind(this), { passive: !1 }), this.glDOM.addEventListener("touchstart", this._handleMouseDown.bind(this), { passive: !1 }), this.glDOM.addEventListener("wheel", this._handleMouseScroll.bind(this), { passive: !1 }), this.glDOM.addEventListener("mousemove", this._handleMouseMove.bind(this), { passive: !1 }), this.glDOM.addEventListener("touchmove", this._handleMouseMove.bind(this), { passive: !1 }), this.glDOM.addEventListener("contextmenu", this._handleContextMenu.bind(this), { passive: !1 })); - } - decAnim() { - this.animated--, this.animated < 0 && (this.animated = 0); - } - incAnim() { - this.animated++; - } - nextSurfID() { - var a = 0; - for (let g in this.surfaces) - if (this.surfaces.hasOwnProperty(g)) { - var l = parseInt(g); - isNaN(l) || l > a && (a = l); - } - return a + 1; - } - setSlabAndFog() { - let a = this.camera.position.z - this.rotationGroup.position.z; - a < 1 && (a = 1), this.camera.near = a + this.slabNear, this.camera.near < 1 && (this.camera.near = 1), this.camera.far = a + this.slabFar, this.camera.near + 1 > this.camera.far && (this.camera.far = this.camera.near + 1), this.camera.fov = this.fov, this.camera.right = a * Math.tan(Math.PI / 180 * this.fov), this.camera.left = -this.camera.right, this.camera.top = this.camera.right / this.ASPECT, this.camera.bottom = -this.camera.top, this.camera.updateProjectionMatrix(), this.scene.fog.near = this.camera.near + this.fogStart * (this.camera.far - this.camera.near), this.scene.fog.far = this.camera.far, this.config.disableFog && (this.scene.fog.near = this.scene.fog.far); - } - // display scene - //if nolink is set/true, don't propagate changes to linked viewers - show(a) { - if (this.renderer.setViewport(), !!this.scene && (this.setSlabAndFog(), this.renderer.render(this.scene, this.camera), this.viewChangeCallback && this.viewChangeCallback(this._viewer.getView()), !a && this.linkedViewers.length > 0)) - for (var l = this._viewer.getView(), g = 0; g < this.linkedViewers.length; g++) { - var M = this.linkedViewers[g]; - M.setView(l, !0); - } - } - //regenerate the list of clickables - //also updates hoverables - updateClickables() { - this.clickables.splice(0, this.clickables.length), this.hoverables.splice(0, this.hoverables.length), this.contextMenuEnabledAtoms.splice(0, this.contextMenuEnabledAtoms.length); - for (let a = 0, l = this.models.length; a < l; a++) { - let g = this.models[a]; - if (g) { - let M = g.selectedAtoms({ - clickable: !0 - }), C = g.selectedAtoms({ - hoverable: !0 - }), T = g.selectedAtoms({ contextMenuEnabled: !0 }); - for (let D = 0; D < C.length; D++) - this.hoverables.push(C[D]); - for (let D = 0; D < M.length; D++) - this.clickables.push(M[D]); - for (let D = 0; D < T.length; D++) - this.contextMenuEnabledAtoms.push(T[D]); - } - } - for (let a = 0, l = this.shapes.length; a < l; a++) { - let g = this.shapes[a]; - g && g.clickable && this.clickables.push(g), g && g.hoverable && this.hoverables.push(g); - } - } - // Checks for selection intersects on mousedown - handleClickSelection(a, l, g) { - let M = this.targetedObjects(a, l, this.clickables); - if (M.length) { - var C = M[0].clickable; - C.callback !== void 0 && (typeof C.callback != "function" && (C.callback = (0, b.makeFunction)(C.callback)), typeof C.callback == "function" && C.callback(C, this._viewer, g, this.container, M)); - } - } - //return offset of container - canvasOffset() { - let a = this.glDOM, l = a.getBoundingClientRect(), g = a.ownerDocument, M = g.documentElement, C = g.defaultView; - return { - top: l.top + C.pageYOffset - M.clientTop, - left: l.left + C.pageXOffset - M.clientLeft - }; - } - //set current_hover to sel (which can be null), calling appropraite callbacks - setHover(a, l, g) { - this.current_hover != a && (this.current_hover && (typeof this.current_hover.unhover_callback != "function" && (this.current_hover.unhover_callback = (0, b.makeFunction)(this.current_hover.unhover_callback)), this.current_hover.unhover_callback(this.current_hover, this._viewer, l, this.container, g)), this.current_hover = a, a && a.hover_callback !== void 0 && (typeof a.hover_callback != "function" && (a.hover_callback = (0, b.makeFunction)(a.hover_callback)), typeof a.hover_callback == "function" && a.hover_callback(a, this._viewer, l, this.container, g))); - } - //checks for selection intersects on hover - handleHoverSelection(a, l, g) { - if (this.hoverables.length == 0) - return; - let M = this.targetedObjects(a, l, this.hoverables); - if (M.length) { - var C = M[0].clickable; - this.setHover(C, g, M), this.current_hover = C; - } else - this.setHover(null); - } - //sees if the mouse is still on the object that invoked a hover event and if not then the unhover callback is called - handleHoverContinue(a, l) { - let g = this.targetedObjects(a, l, this.hoverables); - (g.length == 0 || g[0] === void 0) && this.setHover(null), g[0] !== void 0 && g[0].clickable !== this.current_hover && this.setHover(null); - } - /** - * Determine if a positioned event is "close enough" to mouseStart to be considered a click. - * With a mouse, the position should be exact, but allow a slight delta for a touch interface. - * @param {Event} event - * @param {{ allowTolerance, tolerance: number }} options - */ - closeEnoughForClick(a, { allowTolerance: l = a.targetTouches, tolerance: g = 5 } = {}) { - const M = this.getX(a), C = this.getY(a); - if (l) { - const T = Math.abs(M - this.mouseStartX), D = Math.abs(C - this.mouseStartY); - return T <= g && D <= g; - } else - return M === this.mouseStartX && C === this.mouseStartY; - } - calcTouchDistance(a) { - var l = a.targetTouches[0].pageX - a.targetTouches[1].pageX, g = a.targetTouches[0].pageY - a.targetTouches[1].pageY; - return Math.hypot(l, g); - } - //check targetTouches as well - getX(a) { - var l = a.pageX; - return l == null && (l = a.pageX), a.targetTouches && a.targetTouches[0] ? l = a.targetTouches[0].pageX : a.changedTouches && a.changedTouches[0] && (l = a.changedTouches[0].pageX), l; - } - getY(a) { - var l = a.pageY; - return l == null && (l = a.pageY), a.targetTouches && a.targetTouches[0] ? l = a.targetTouches[0].pageY : a.changedTouches && a.changedTouches[0] && (l = a.changedTouches[0].pageY), l; - } - //for grid viewers, return true if point is in this viewer - isInViewer(a, l) { - if (this.viewers != null) { - var g = this.WIDTH / this.cols, M = this.HEIGHT / this.rows, C = this.canvasOffset(), T = a - C.left, D = l - C.top, I = this.rows - Math.floor(D / M) - 1, B = Math.floor(T / g); - if (I != this.row || B != this.col) - return !1; - } - return !0; - } - //if the user has specify zoom limits, readjust to fit within them - //also, make sure we don't go past CAMERA_Z - adjustZoomToLimits(a) { - if (this.config.lowerZoomLimit && this.config.lowerZoomLimit > 0) { - let l = this.CAMERA_Z - this.config.lowerZoomLimit; - a > l && (a = l); - } - if (this.config.upperZoomLimit && this.config.upperZoomLimit > 0) { - let l = this.CAMERA_Z - this.config.upperZoomLimit; - a < l && (a = l); - } - return a > this.CAMERA_Z - 1 && (a = this.CAMERA_Z - 1), a; - } - //interpolate between two normalized quaternions (t between 0 and 1) - //https://en.wikipedia.org/wiki/Slerp - static slerp(a, l, g) { - if (g == 1) - return l.clone(); - if (g == 0) - return a.clone(); - let M = a.x * l.x + a.y * l.y + a.z * l.z + a.w * l.w; - if (M > 0.9995) { - let z = new f.Quaternion(a.x + g * (l.x - a.x), a.y + g * (l.y - a.y), a.z + g * (l.z - a.z), a.w + g * (l.w - a.w)); - return z.normalize(), z; - } - M < 0 && (l = l.clone().multiplyScalar(-1), M = -M), M > 1 ? M = 1 : M < -1 && (M = -1); - var C = Math.acos(M), T = C * g, D = l.clone(); - D.sub(a.clone().multiplyScalar(M)), D.normalize(); - var I = Math.cos(T), B = Math.sin(T), P = new f.Quaternion(a.x * I + D.x * B, a.y * I + D.y * B, a.z * I + D.z * B, a.w * I + D.w * B); - return P.normalize(), P; - } - /* @param {Object} element HTML element within which to create viewer - * @param {ViewerSpec} config Object containing optional configuration for the viewer - */ - constructor(a, l = {}) { - this.nomouse = !1, this.glDOM = null, this.models = [], this.surfaces = {}, this.shapes = [], this.labels = [], this.clickables = [], this.hoverables = [], this.contextMenuEnabledAtoms = [], this.current_hover = null, this.hoverDuration = 500, this.viewer_frame = 0, this.viewChangeCallback = null, this.stateChangeCallback = null, this.NEAR = 1, this.FAR = 800, this.CAMERA_Z = 150, this.fov = 20, this.linkedViewers = [], this.renderer = null, this.control_all = !1, this.scene = null, this.rotationGroup = null, this.modelGroup = null, this.fogStart = 0.4, this.slabNear = -50, this.slabFar = 50, this.cq = new f.Quaternion(0, 0, 0, 1), this.dq = new f.Quaternion(0, 0, 0, 1), this.animated = 0, this.animationTimers = /* @__PURE__ */ new Set(), this.isDragging = !1, this.mouseStartX = 0, this.mouseStartY = 0, this.touchDistanceStart = 0, this.touchHold = !1, this.currentModelPos = 0, this.cz = 0, this.cslabNear = 0, this.cslabFar = 0, this.userContextMenuHandler = null, this.config = l, this.callback = this.config.callback, this.defaultcolors = this.config.defaultcolors, this.defaultcolors || (this.defaultcolors = u.elementColors.defaultColors), this.nomouse = this.config.nomouse, this.bgColor = 0, this.config.backgroundColor = this.config.backgroundColor || "#ffffff", typeof this.config.backgroundColor < "u" && (this.bgColor = u.CC.color(this.config.backgroundColor).getHex()), this.config.backgroundAlpha = this.config.backgroundAlpha == null ? 1 : this.config.backgroundAlpha, this.camerax = 0, typeof this.config.camerax < "u" && (this.camerax = parseFloat(this.config.camerax)), this._viewer = this, this.container = a, this.config.hoverDuration != null && (this.hoverDuration = this.config.hoverDuration), this.config.antialias === void 0 && (this.config.antialias = !0), this.config.cartoonQuality === void 0 && (this.config.cartoonQuality = 10), this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight(), this.setupRenderer(), this.row = this.config.row == null ? 0 : this.config.row, this.col = this.config.col == null ? 0 : this.config.col, this.cols = this.config.cols, this.rows = this.config.rows, this.viewers = this.config.viewers, this.control_all = this.config.control_all, this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.camera = new n.Camera(this.fov, this.ASPECT, this.NEAR, this.FAR, this.config.orthographic), this.camera.position = new f.Vector3(this.camerax, 0, this.CAMERA_Z), this.lookingAt = new f.Vector3(), this.camera.lookAt(this.lookingAt), this.raycaster = new n.Raycaster(new f.Vector3(0, 0, 0), new f.Vector3(0, 0, 0)), this.projector = new n.Projector(), this.initializeScene(), this.renderer.setClearColorHex(this.bgColor, this.config.backgroundAlpha), this.scene.fog.color = u.CC.color(this.bgColor), document.body.addEventListener("mouseup", this._handleMouseUp.bind(this)), document.body.addEventListener("touchend", this._handleMouseUp.bind(this)), this.initContainer(this.container), this.config.style && this.setViewStyle(this.config), window.addEventListener("resize", this.resize.bind(this)), typeof window.ResizeObserver < "u" && (this.divwatcher = new window.ResizeObserver(this.resize.bind(this)), this.divwatcher.observe(this.container)); - try { - typeof this.callback == "function" && this.callback(this); - } catch (g) { - console.log("error with glviewer callback: " + g); - } - } - /** - * Return a list of objects that intersect that at the specified viewer position. - * - * @param x - x position in screen coordinates - * @param y - y position in screen coordinates - * @param {Object[]} - list of objects or selection object specifying what object to check for targeting - */ - targetedObjects(a, l, g) { - var M = { - x: a, - y: l, - z: -1 - }; - return Array.isArray(g) || (g = this.selectedAtoms(g)), g.length == 0 ? [] : (this.raycaster.setFromCamera(M, this.camera), this.raycaster.intersectObjects(this.modelGroup, g)); - } - /** Convert model coordinates to screen coordinates. - * @param {object | list} - an object or list of objects with x,y,z attributes (e.g. an atom) - * @return {object | list} - and object or list of {x: screenX, y: screenY} - */ - modelToScreen(a) { - let l = !1; - Array.isArray(a) || (a = [a], l = !0); - let g = this.renderer.getXRatio(), M = this.renderer.getYRatio(), C = this.col, T = this.row, D = C * (this.WIDTH / g), I = (M - T - 1) * (this.HEIGHT / M), B = [], P = this.canvasOffset(); - return a.forEach((z) => { - let k = new f.Vector3(z.x, z.y, z.z); - k.applyMatrix4(this.modelGroup.matrixWorld), this.projector.projectVector(k, this.camera); - let N = this.WIDTH / g * (k.x + 1) / 2 + P.left + D, R = -(this.HEIGHT / M) * (k.y - 1) / 2 + P.top + I; - B.push({ x: N, y: R }); - }), l && (B = B[0]), B; - } - /** - * For a given screen (x,y) displacement return model displacement - * @param{x} x displacement in screen coordinates - * @param{y} y displacement in screen corodinates - * @param{modelz} z coordinate in model coordinates to compute offset for, default is model axis - */ - screenOffsetToModel(a, l, g) { - var M = a / this.WIDTH, C = l / this.HEIGHT, T = g === void 0 ? this.rotationGroup.position.z : g, D = this.rotationGroup.quaternion, I = new f.Vector3(0, 0, T); - return this.projector.projectVector(I, this.camera), I.x += M * 2, I.y -= C * 2, this.projector.unprojectVector(I, this.camera), I.z = 0, I.applyQuaternion(D), I; - } - /** - * Distance from screen coordinate to model coordinate assuming screen point - * is projected to the same depth as model coordinate - * @param{screen} xy screen coordinate - * @param{model} xyz model coordinate - */ - screenToModelDistance(a, l) { - let g = this.canvasOffset(), M = new f.Vector3(l.x, l.y, l.z); - M.applyMatrix4(this.modelGroup.matrixWorld); - let C = M.clone(); - this.projector.projectVector(M, this.camera); - let T = new f.Vector3((a.x - g.left) * 2 / this.WIDTH - 1, (a.y - g.top) * 2 / -this.HEIGHT + 1, M.z); - return this.projector.unprojectVector(T, this.camera), T.distanceTo(C); - } - /** - * Set a callback to call when the view has potentially changed. - * - */ - setViewChangeCallback(a) { - (typeof a == "function" || a == null) && (this.viewChangeCallback = a); - } - /** - * Set a callback to call when the view has potentially changed. - * - */ - setStateChangeCallback(a) { - (typeof a == "function" || a == null) && (this.stateChangeCallback = a); - } - /** - * Return configuration of viewer - */ - getConfig() { - return this.config; - } - /** - * Set the configuration object. Note that some setting may only - * have an effect at viewer creation time. - */ - setConfig(a) { - this.config = a; - } - /** - * Return object representing internal state of - * the viewer appropriate for passing to setInternalState - * - */ - getInternalState() { - var a = { models: [], surfaces: [], shapes: [], labels: [] }; - for (let l = 0; l < this.models.length; l++) - this.models[l] && (a.models[l] = this.models[l].getInternalState()); - return a; - } - /** - * Overwrite internal state of the viewer with passed object - * which should come from getInternalState. - * - */ - setInternalState(a) { - this.clear(); - var l = a.models; - for (let g = 0; g < l.length; g++) - l[g] && (this.models[g] = new _.GLModel(g), this.models[g].setInternalState(l[g])); - this.render(); - } - /** - * Set lower and upper limit stops for zoom. - * - * @param {lower} - limit on zoom in (positive number). Default 0. - * @param {upper} - limit on zoom out (positive number). Default infinite. - * @example - $3Dmol.get("data/set1_122_complex.mol2", function(moldata) { - var m = viewer.addModel(moldata); - viewer.setStyle({stick:{colorscheme:"Jmol"}}); - viewer.setZoomLimits(100,200); - viewer.zoomTo(); - viewer.zoom(10); //will not zoom all the way - viewer.render(); - }); - */ - setZoomLimits(a, l) { - typeof a < "u" && (this.config.lowerZoomLimit = a), l && (this.config.upperZoomLimit = l), this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z), this.show(); - } - /** - * Set camera parameters (distance to the origin and field of view) - * - * @param {parameters} - new camera parameters, with possible fields - * being fov for the field of view, z for the - * distance to the origin, and orthographic (boolean) - * for kind of projection (default false). - * @example - $3Dmol.get("data/set1_122_complex.mol2", function(data) { - var m = viewer.addModel(data); - viewer.setStyle({stick:{}}); - viewer.zoomTo(); - viewer.setCameraParameters({ fov: 10 , z: 300 }); - viewer.render(); - }); - */ - setCameraParameters(a) { - a.fov !== void 0 && (this.fov = a.fov, this.camera.fov = this.fov), a.z !== void 0 && (this.CAMERA_Z = a.z, this.camera.z = this.CAMERA_Z), a.orthographic !== void 0 && (this.camera.ortho = a.orthographic); - } - _handleMouseDown(a) { - if (a.preventDefault(), !this.scene) - return; - var l = this.getX(a), g = this.getY(a); - if (l === void 0) - return; - this.isDragging = !0, this.mouseButton = a.which, this.mouseStartX = l, this.mouseStartY = g, this.touchHold = !0, this.touchDistanceStart = 0, a.targetTouches && a.targetTouches.length == 2 && (this.touchDistanceStart = this.calcTouchDistance(a)), this.cq = this.rotationGroup.quaternion.clone(), this.cz = this.rotationGroup.position.z, this.currentModelPos = this.modelGroup.position.clone(), this.cslabNear = this.slabNear, this.cslabFar = this.slabFar; - let M = this; - setTimeout(function() { - a.targetTouches && M.touchHold == !0 && (M.glDOM = M.renderer.domElement, M.glDOM.dispatchEvent(new Event("contextmenu"))); - }, 1e3); - } - _handleMouseUp(a) { - if (this.touchHold = !1, this.isDragging && this.scene) { - var l = this.getX(a), g = this.getY(a); - if (this.closeEnoughForClick(a) && this.isInViewer(l, g)) { - let M = this.mouseXY(l, g); - this.handleClickSelection(M.x, M.y, a); - } - } - this.isDragging = !1; - } - _handleMouseScroll(a) { - if (a.preventDefault(), !!this.scene) { - var l = this.getX(a), g = this.getY(a); - if (l !== void 0 && !(!this.control_all && !this.isInViewer(l, g))) { - var M = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, C = 1; - if (a.ctrlKey && (C = -1), a.detail) - this.rotationGroup.position.z += C * M * a.detail / 10; - else if (a.wheelDelta) { - let T = a.wheelDelta * 600 / (a.wheelDelta + 600); - this.rotationGroup.position.z -= C * M * T / 400; - } - this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z), this.show(); - } - } - } - /** - * Return image URI of viewer contents (base64 encoded). * - */ - pngURI() { - return this.getCanvas().toDataURL("image/png"); - } - /** - * Return a promise that resolves to an animated PNG image URI of - viewer contents (base64 encoded) for nframes of viewer changes. - * @return {Promise} - */ - apngURI(a) { - let l = this; - return a = a || 1, new Promise(function(g) { - let M = 0, C = l.viewChangeCallback, T = [], D = [], I = Date.now(); - l.viewChangeCallback = function() { - D.push(Date.now() - I), I = Date.now(), T.push(new Promise((B) => { - l.getCanvas().toBlob(function(P) { - P.arrayBuffer().then(B); - }, "image/png"); - })), M += 1, M == a && (l.viewChangeCallback = C, Promise.all(T).then((B) => { - let P = []; - for (let W = 0; W < B.length; W++) { - let G = (0, L.decode)(B[W]); - P.push((0, L.toRGBA8)(G)[0]); - } - let z = l.getCanvas().width, k = l.getCanvas().height, N = (0, L.encode)(P, z, k, 0, D), R = new Blob([N], { type: "image/png" }), U = new FileReader(); - U.onload = function(W) { - g(W.target.result); - }, U.readAsDataURL(R); - })); - }; - }); - } - /** - * Return underlying canvas element. - */ - getCanvas() { - return this.glDOM; - } - /** - * Return renderer element. - */ - getRenderer() { - return this.renderer; - } - /** - * Set the duration of the hover delay - * - * @param {number} - * [hoverDuration] - an optional parameter that denotes - * the duration of the hover delay (in milliseconds) before the hover action is called - * - */ - setHoverDuration(a) { - this.hoverDuration = a; - } - mouseXY(a, l) { - let g = this.canvasOffset(), M = this.renderer.getXRatio(), C = this.renderer.getYRatio(), T = this.col, D = this.row, I = T * (this.WIDTH / M), B = (C - D - 1) * (this.HEIGHT / C), P = (a - g.left - I) / (this.WIDTH / M) * 2 - 1, z = -((l - g.top - B) / (this.HEIGHT / C)) * 2 + 1; - return { x: P, y: z }; - } - _handleMouseMove(a) { - clearTimeout(this.hoverTimeout), a.preventDefault(); - let l = this.getX(a), g = this.getY(a); - if (l === void 0) - return; - let M = this.renderer.getXRatio(), C = this.renderer.getYRatio(), T = this.mouseXY(l, g), D = this; - this.current_hover !== null && this.handleHoverContinue(T.x, T.y); - var I = 0; - if (!(!this.control_all && !this.isInViewer(l, g)) && this.scene && (this.hoverables.length > 0 && (this.hoverTimeout = setTimeout(function() { - D.handleHoverSelection(T.x, T.y, a); - }, this.hoverDuration)), !!this.isDragging)) { - var B = (l - this.mouseStartX) / this.WIDTH, P = (g - this.mouseStartY) / this.HEIGHT; - if (this.touchDistanceStart != 0 && a.targetTouches && a.targetTouches.length == 2) { - var z = this.calcTouchDistance(a); - I = 2, P = (z - this.touchDistanceStart) * 2 / (this.WIDTH + this.HEIGHT); - } else - a.targetTouches && a.targetTouches.length == 3 && (I = 1); - B *= M, P *= C; - var k = Math.hypot(B, P), N; - if (I == 3 || this.mouseButton == 3 && a.ctrlKey) - this.slabNear = this.cslabNear + B * 100, this.slabFar = this.cslabFar - P * 100; - else if (I == 2 || this.mouseButton == 3 || a.shiftKey) - N = (this.CAMERA_Z - this.rotationGroup.position.z) * 0.85, N < 80 && (N = 80), this.rotationGroup.position.z = this.cz + P * N, this.rotationGroup.position.z = this.adjustZoomToLimits(this.rotationGroup.position.z); - else if (I == 1 || this.mouseButton == 2 || a.ctrlKey) { - var R = this.screenOffsetToModel(M * (l - this.mouseStartX), C * (g - this.mouseStartY)); - this.modelGroup.position.addVectors(this.currentModelPos, R); - } else if ((I === 0 || this.mouseButton == 1) && k !== 0) { - var U = Math.sin(k * Math.PI) / k; - this.dq.x = Math.cos(k * Math.PI), this.dq.y = 0, this.dq.z = U * B, this.dq.w = -U * P, this.rotationGroup.quaternion.set(1, 0, 0, 0), this.rotationGroup.quaternion.multiply(this.dq), this.rotationGroup.quaternion.multiply(this.cq); - } - this.show(); - } - } - _handleContextMenu(a) { - a.preventDefault(); - var l = this.getX(a), g = this.getY(a); - if (!(l != this.mouseStartX || g != this.mouseStartY)) { - var T = this.mouseStartX, D = this.mouseStartY, C = this.canvasOffset(); - let I = this.mouseXY(T, D), B = I.x, P = I.y, z = this.targetedObjects(B, P, this.contextMenuEnabledAtoms); - var M = null; - z.length && (M = z[0].clickable); - var C = this.canvasOffset(), T = this.mouseStartX - C.left, D = this.mouseStartY - C.top; - this.userContextMenuHandler && this.userContextMenuHandler(M, T, D, z); - } - } - /** - * Change the viewer's container element - * Also useful if the original container element was removed from the DOM. - * - * @param {Object | string} element - * Either HTML element or string identifier. Defaults to the element used to initialize the viewer. - - */ - setContainer(a) { - let l = (0, b.getElement)(a) || this.container; - return this.initContainer(l), this; - } - /** - * Set the background color (default white) - * - * @param {number} - * hex Hexcode specified background color, or standard color spec - * @param {number} - * a Alpha level (default 1.0) - * - * @example - * - * viewer.setBackgroundColor(0x000000); - - - * - */ - setBackgroundColor(a, l) { - (typeof l > "u" || l < 0 || l > 1) && (l = 1); - var g = u.CC.color(a); - return this.scene.fog.color = g, this.bgColor = g.getHex(), this.renderer.setClearColorHex(g.getHex(), l), this.show(), this; - } - /** - * Set view projection scheme. Either orthographic or perspective. - * Default is perspective. Orthographic can also be enabled on viewer creation - * by setting orthographic to true in the config object. - * - * - * @example - viewer.setViewStyle({style:"outline"}); - $3Dmol.get('data/1fas.pqr', function(data){ - viewer.addModel(data, "pqr"); - $3Dmol.get("data/1fas.cube",function(volumedata){ - viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{}); - }); - viewer.zoomTo(); - - viewer.setProjection("orthographic"); - viewer.render(callback); - }); - * - */ - setProjection(a) { - this.camera.ortho = a === "orthographic", this.setSlabAndFog(); - } - /** - * Set global view styles. - * - * @example - * viewer.setViewStyle({style:"outline"}); - $3Dmol.get('data/1fas.pqr', function(data){ - viewer.addModel(data, "pqr"); - $3Dmol.get("data/1fas.cube",function(volumedata){ - viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{}); - }); - viewer.zoomTo(); - viewer.render(callback); - }); - * - */ - setViewStyle(a) { - if (a.style === "outline") { - var l = {}; - a.color && (l.color = u.CC.color(a.color)), a.width && (l.width = a.width), this.renderer.enableOutline(l); - } else - this.renderer.disableOutline(); - return this; - } - updateSize() { - this.renderer.setSize(this.WIDTH, this.HEIGHT), this.ASPECT = this.renderer.getAspect(this.WIDTH, this.HEIGHT), this.renderer.setSize(this.WIDTH, this.HEIGHT), this.camera.aspect = this.ASPECT, this.camera.updateProjectionMatrix(); - } - /** - * Set viewer width independently of the HTML container. This is probably not what you want. - * - * @param {number} w Width in pixels - */ - setWidth(a) { - return this.WIDTH = a || this.WIDTH, this.updateSize(), this; - } - /** - * Set viewer height independently of the HTML container. This is probably not what you want. - * - * @param {number} h Height in pixels - */ - setHeight(a) { - return this.HEIGHT = a || this.HEIGHT, this.updateSize(), this; - } - /** - * Resize viewer according to containing HTML element's dimensions - * - */ - resize() { - this.WIDTH = this.getWidth(), this.HEIGHT = this.getHeight(); - let a = !1; - if (this.renderer.isLost() && this.WIDTH > 0 && this.HEIGHT > 0 && (this.container.querySelector("canvas").remove(), this.setupRenderer(), this.initContainer(this.container), a = !0), this.WIDTH == 0 || this.HEIGHT == 0 ? this.animated && this._viewer.pauseAnimate() : this.animated && this._viewer.resumeAnimate(), this.updateSize(), a) { - let l = this.renderer.supportedExtensions(); - l.regen = !0, this._viewer.render(null, l); - } else - this.show(); - return this; - } - /** - * Return specified model - * - * @param {number} - * [id=last model id] - Retrieve model with specified id - * @default Returns last model added to viewer or null if there are no models - * @return {GLModel} - * - * @example // Retrieve reference to first GLModel added var m = - * $3Dmol.download("pdb:1UBQ",viewer,{},function(m1){ - $3Dmol.download("pdb:1UBI", viewer,{}, function(m2) { - viewer.zoomTo(); - m1.setStyle({cartoon: {color:'green'}}); - //could use m2 here as well - viewer.getModel().setStyle({cartoon: {color:'blue'}}); - viewer.render(); - }) - }); - */ - getModel(a) { - return a === void 0 ? this.models.length == 0 ? null : this.models[this.models.length - 1] : a instanceof _.GLModel ? a : a in this.models ? this.models[a] : this.models.length == 0 ? null : this.models[this.models.length - 1]; - } - /** - * Continuously rotate a scene around the specified axis. - * - * Call `spin(false)` to stop spinning. - * - * @param {string|boolean|Array} axis - * [axis] - Axis ("x", "y", "z", "vx", "vy", or "vz") to rotate around. - * Default "y". View relative (rather than model relative) axes are prefixed with v. - * @param {number} speed - * [speed] - Speed multiplier for spinning the viewer. 1 is default and a negative - * value reverses the direction of the spin. - * - */ - spin(a, l = 1) { - if (clearInterval(this.spinInterval), typeof a > "u" && (a = "y"), typeof a == "boolean") - if (a) - a = "y"; - else - return; - Array.isArray(a) && (a = { x: a[0], y: a[1], z: a[2] }); - var g = this; - this.spinInterval = setInterval(function() { - !g.getCanvas().isConnected && g.renderer.isLost() && clearInterval(g.spinInterval), g.rotate(1 * l, a); - }, 25); - } - //animate motion between current position and passed position - // can set some parameters to null - //if fixed is true will enforce the request animation, otherwise - //does relative updates - //positions objects have modelggroup position, rotation group position.z, - //and rotationgroup quaternion - //return array includes final position, but not current - //the returned array includes an animate method - animateMotion(a, l, g, M, C, T) { - var D = 20, I = Math.ceil(a / D); - I < 1 && (I = 1), this.incAnim(); - var B = { - mpos: this.modelGroup.position.clone(), - rz: this.rotationGroup.position.z, - rot: this.rotationGroup.quaternion.clone(), - cam: this.lookingAt.clone() - }; - if (l) { - let k = new Array(I); - for (let W = 0; W < I; W++) { - let G = (W + 1) / I, F = { mpos: B.mpos, rz: B.rz, rot: B.rot }; - F.mpos = g.clone().sub(B.mpos).multiplyScalar(G).add(B.mpos), F.rz = B.rz + G * (M - B.rz), F.rot = s.slerp(B.rot, C, G), F.cam = T.clone().sub(B.cam).multiplyScalar(G).add(B.cam), k[W] = F; - } - let N = 0, R = this, U = function() { - var W = k[N]; - N += 1, R.modelGroup.position = W.mpos, R.rotationGroup.position.z = W.rz, R.rotationGroup.quaternion = W.rot, R.camera.lookAt(W.cam), N < k.length ? setTimeout(U, D) : R.decAnim(), R.show(); - }; - setTimeout(U, D); - } else { - var P = {}; - let k = 1 / I; - if (g && (P.mpos = g.clone().sub(B.mpos).multiplyScalar(k)), typeof M < "u" && M != null && (P.rz = k * (M - B.rz)), C) { - var z = s.slerp(B.rot, C, k); - P.rot = B.rot.clone().inverse().multiply(z); - } - T && (P.cam = T.clone().sub(B.cam).multiplyScalar(k)); - let N = 0, R = this, U = function() { - N += 1, P.mpos && R.modelGroup.position.add(P.mpos), P.rz && (R.rotationGroup.position.z += P.rz), P.rot && R.rotationGroup.quaternion.multiply(P.rot), P.cam && (R.lookingAt.add(P.cam), R.camera.lookAt(R.lookingAt)), N < I ? setTimeout(U, D) : R.decAnim(), R.show(); - }; - setTimeout(U, D); - } - } - /** - * Rotate scene by angle degrees around axis - * - * @param {number} - * [angle] - Angle, in degrees, to rotate by. - * @param {string} - * [axis] - Axis ("x", "y", "z", "vx", "vy", or "vz") to rotate around. - * Default "y". View relative (rather than model relative) axes are prefixed with v. - * Axis can also be specified as a vector. - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of the rotation animation. Default 0 (no animation) - * @param {boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation * - * @example $3Dmol.download('cid:4000', viewer, {}, function() { - viewer.setStyle({stick:{}}); - viewer.zoomTo(); - viewer.rotate(90,'y',1); - viewer.render(callback); - }); - - * - */ - rotate(a, l = "y", g = 0, M = !1) { - if (l == "x" ? l = { x: 1, y: 0, z: 0 } : l == "y" ? l = { x: 0, y: 1, z: 0 } : l == "z" && (l = { x: 0, y: 0, z: 1 }), l == "vx" ? l = { vx: 1, vy: 0, vz: 0 } : l == "vy" ? l = { vx: 0, vy: 1, vz: 0 } : l == "vz" && (l = { vx: 0, vy: 0, vz: 1 }), typeof l.vx < "u") { - var C = new f.Vector3(l.vx, l.vy, l.vz); - C.applyQuaternion(this.rotationGroup.quaternion), l = { x: C.x, y: C.y, z: C.z }; - } - var T = function(P) { - var z = Math.sin(P / 2), k = Math.cos(P / 2), N = 0, R = 0, U = 0; - return N = l.x * z, R = l.y * z, U = l.z * z, new f.Quaternion(N, R, U, k).normalize(); - }, D = Math.PI * a / 180, I = T(D); - if (g) { - var B = new f.Quaternion().copy(this.rotationGroup.quaternion).multiply(I); - this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, B, this.lookingAt); - } else - this.rotationGroup.quaternion.multiply(I), this.show(); - return this; - } - surfacesFinished() { - for (var a in this.surfaces) - if (!this.surfaces[a][0].done) - return !1; - return !0; - } - /** Returns an array representing the current viewpoint. - * Translation, zoom, and rotation quaternion. - * @returns {Array.} [ pos.x, pos.y, pos.z, rotationGroup.position.z, q.x, q.y, q.z, q.w ] - * */ - getView() { - if (!this.modelGroup) - return [0, 0, 0, 0, 0, 0, 0, 1]; - var a = this.modelGroup.position, l = this.rotationGroup.quaternion; - return [ - a.x, - a.y, - a.z, - this.rotationGroup.position.z, - l.x, - l.y, - l.z, - l.w - ]; - } - /** Sets the view to the specified translation, zoom, and rotation. - * - * @param {Array.} arg Array formatted identically to the return value of getView */ - setView(a, l) { - return a === void 0 || !(a instanceof Array || a.length !== 8) ? this : !this.modelGroup || !this.rotationGroup ? this : (this.modelGroup.position.x = a[0], this.modelGroup.position.y = a[1], this.modelGroup.position.z = a[2], this.rotationGroup.position.z = a[3], this.rotationGroup.quaternion.x = a[4], this.rotationGroup.quaternion.y = a[5], this.rotationGroup.quaternion.z = a[6], this.rotationGroup.quaternion.w = a[7], typeof a[8] < "u" && (this.rotationGroup.position.x = a[8], this.rotationGroup.position.y = a[9]), this.show(l), this); - } - // apply styles, models, etc in viewer - /** - * Render current state of viewer, after - * adding/removing models, applying styles, etc. - * - */ - render(a, l) { - this.renderer.setViewport(), this.updateClickables(); - var g = this.getView(); - this.stateChangeCallback && this.stateChangeCallback(this.getInternalState()); - var M, C; - for (l || (l = this.renderer.supportedExtensions()), M = 0; M < this.models.length; M++) - this.models[M] && this.models[M].globj(this.modelGroup, l); - for (M = 0; M < this.shapes.length; M++) - this.shapes[M] && (typeof this.shapes[M].frame > "u" || this.viewer_frame < 0 || this.shapes[M].frame < 0 || this.shapes[M].frame == this.viewer_frame ? this.shapes[M].globj(this.modelGroup, l) : this.shapes[M].removegl(this.modelGroup)); - for (M = 0; M < this.labels.length; M++) - this.labels[M] && typeof this.labels[M].frame < "u" && this.labels[M].frame >= 0 && (this.modelGroup.remove(this.labels[M].sprite), (this.viewer_frame < 0 || this.labels[M].frame == this.viewer_frame) && this.modelGroup.add(this.labels[M].sprite)); - for (M in this.surfaces) - if (this.surfaces.hasOwnProperty(M)) { - var T = this.surfaces[M]; - for (C = 0; C < T.length; C++) - if (T.hasOwnProperty(C)) { - var D = T[C].geo; - if (!T[C].finished || l.regen) { - D.verticesNeedUpdate = !0, D.elementsNeedUpdate = !0, D.normalsNeedUpdate = !0, D.colorsNeedUpdate = !0, D.buffersNeedUpdate = !0, D.boundingSphere = null, T[C].done && (T[C].finished = !0), T[C].lastGL && this.modelGroup.remove(T[C].lastGL); - var I = null; - if (T[C].mat instanceof n.LineBasicMaterial ? I = new n.Line(D, T[C].mat) : I = new n.Mesh(D, T[C].mat), T[C].mat.transparent && T[C].mat.opacity == 0 ? I.visible = !1 : I.visible = !0, T[C].symmetries.length > 1 || T[C].symmetries.length == 1 && !T[C].symmetries[C].isIdentity()) { - var B, P = new n.Object3D(); - for (B = 0; B < T[C].symmetries.length; B++) { - var z = I.clone(); - z.matrix = T[C].symmetries[B], z.matrixAutoUpdate = !1, P.add(z); - } - T[C].lastGL = P, this.modelGroup.add(P); - } else - T[C].lastGL = I, this.modelGroup.add(I); - } - } - } - return this.setView(g), typeof a == "function" && a(this), this; - } - /* @param {AtomSelectionSpec|any} sel - * @return list of models specified by sel - */ - getModelList(a) { - let l = []; - if (typeof a > "u" || typeof a.model > "u") - for (let M = 0; M < this.models.length; M++) - this.models[M] && l.push(this.models[M]); - else { - let M = a.model; - Array.isArray(M) || (M = [M]); - for (let C = 0; C < M.length; C++) - if (typeof M[C] == "number") { - var g = M[C]; - g < 0 && (g += this.models.length), l.push(this.models[g]); - } else - l.push(M[C]); - } - return l; - } - /** - * - * @param {AtomSelectionSpec} - * sel - * @return {AtomSpec[]} - */ - getAtomsFromSel(a) { - var l = []; - typeof a > "u" && (a = {}); - var g = this.getModelList(a); - for (let M = 0; M < g.length; M++) - l = l.concat(g[M].selectedAtoms(a)); - return l; - } - /** - * - * @param {AtomSpec} - * atom - * @param {AtomSelectionSpec} - * sel - * @return {boolean} - */ - atomIsSelected(a, l) { - typeof l > "u" && (l = {}); - for (var g = this.getModelList(l), M = 0; M < g.length; M++) - if (g[M].atomIsSelected(a, l)) - return !0; - return !1; - } - /** return list of atoms selected by sel - * - * @param {AtomSelectionSpec} sel - * @return {AtomSpec[]} - */ - selectedAtoms(a) { - return this.getAtomsFromSel(a); - } - /** - * Returns valid values for the specified attribute in the given selection - * @param {string} attribute - * @param {AtomSelectionSpec} sel - * @return {Array.} - * - */ - getUniqueValues(a, l) { - typeof l > "u" && (l = {}); - var g = this.getAtomsFromSel(l), M = {}; - for (var C in g) - if (g[C].hasOwnProperty(a)) { - var T = g[C][a]; - M[T] = !0; - } - return Object.keys(M); - } - /** - * Return pdb output of selected atoms (if atoms from pdb input) - * - * @param {AtomSelectionSpec} sel - Selection specification specifying model and atom properties to select. Default: all atoms in viewer - * @return {string} PDB string of selected atoms - */ - pdbData(a) { - for (var l = this.getAtomsFromSel(a), g = "", M = 0, C = l.length; M < C; ++M) - g += l[M].pdbline + ` -`; - return g; - } - /** - * Zoom current view by a constant factor - * - * @param {number} - * [factor] - Magnification factor. Values greater than 1 - * will zoom in, less than one will zoom out. Default 2. - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of a zoom animation - * @param {Boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation - * @example - $3Dmol.get('data/4csv.pdb', function(data) { - viewer.addModel(data,'pdb'); - viewer.setStyle({cartoon:{},stick:{}}); - viewer.zoomTo() - viewer.zoom(2,1000); - viewer.render(); - }); - - */ - zoom(a = 2, l = 0, g = !1) { - var M = (this.CAMERA_Z - this.rotationGroup.position.z) / a, C = this.CAMERA_Z - M; - return l > 0 ? this.animateMotion(l, g, this.modelGroup.position, this.adjustZoomToLimits(C), this.rotationGroup.quaternion, this.lookingAt) : (this.rotationGroup.position.z = this.adjustZoomToLimits(C), this.show()), this; - } - /** - * Translate current view by x,y screen coordinates - * This pans the camera rather than translating the model. - * - * @param {number} x Relative change in view coordinates of camera - * @param {number} y Relative change in view coordinates of camera - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of a zoom animation - * @param {Boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation * - * @example $3Dmol.get('data/4csv.pdb', function(data) { - viewer.addModel(data,'pdb'); - viewer.setStyle({cartoon:{},stick:{}}); - viewer.zoomTo(); - viewer.translate(200,50); - viewer.rotate(90,'z'); - viewer.render(callback); - }); - */ - translate(a, l, g = 0, M = !1) { - var C = a / this.WIDTH, T = l / this.HEIGHT, D = new f.Vector3(0, 0, -this.CAMERA_Z); - this.projector.projectVector(D, this.camera), D.x -= C, D.y -= T, this.projector.unprojectVector(D, this.camera), D.z = 0; - var I = this.lookingAt.clone().add(D); - return g > 0 ? this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, I) : (this.lookingAt = I, this.camera.lookAt(this.lookingAt), this.show()), this; - } - /** - * Translate current models by x,y screen coordinates - * This translates the models relative to the current view. It does - * not change the center of rotation. - * - * @param {number} x Relative change in x screen coordinate - * @param {number} y Relative change in y screen coordinate - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of a zoom animation - * @param {Boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation * - * @example $3Dmol.get('data/4csv.pdb', function(data) { - viewer.addModel(data,'pdb'); - viewer.setStyle({cartoon:{},stick:{}}); - viewer.zoomTo(); - viewer.translateScene(200,50); - viewer.rotate(90,'z'); // will no longer be around model center - viewer.render(callback); - }); - */ - translateScene(a, l, g = 0, M = !1) { - var C = this.screenOffsetToModel(a, l), T = this.modelGroup.position.clone().add(C); - return g > 0 ? this.animateMotion(g, M, this.modelGroup.position, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = T, this.show()), this; - } - /** - * Adjust slab to fully enclose selection (default everything). - * - * @param {AtomSelectionSpec} sel - * Selection specification specifying model and atom - * properties to select. Default: all atoms in viewer - */ - fitSlab(a) { - a = a || {}; - var l = this.getAtomsFromSel(a), g = (0, b.getExtent)(l), M = g[1][0] - g[0][0], C = g[1][1] - g[0][1], T = g[1][2] - g[0][2], D = Math.hypot(M, C, T); - return D < 5 && (D = 5), this.slabNear = -D / 1.9, this.slabFar = D / 2, this; - } - /** - * Re-center the viewer around the provided selection (unlike zoomTo, does not zoom). - * - * @param {AtomSelectionSpec} - * [sel] - Selection specification specifying model and atom - * properties to select. Default: all atoms in viewer - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of a zoom animation - * @param {Boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation * - * @example // if the user were to pass the animationDuration value to - * // the function like so viewer.zoomTo({resn:'STI'},1000); - * // the program would center on resn 'STI' over the course - * // of 1 second(1000 milleseconds). - * // Reposition to centroid of all atoms of all models in this - * //viewer glviewer.center(); - $3Dmol.get('data/4csv.pdb', function(data) { - viewer.addModel(data,'pdb'); - viewer.setStyle({cartoon:{},stick:{}}); - viewer.center(); - viewer.render(callback); - }); - */ - center(a = {}, l = 0, g = !1) { - var M, C, T = this.getAtomsFromSel(a), D = (0, b.getExtent)(T); - (0, b.isEmptyObject)(a) ? (this.shapes.forEach((G) => { - if (G && G.boundingSphere && G.boundingSphere.center) { - var F = G.boundingSphere.center, V = G.boundingSphere.radius; - V > 0 ? (T.push(new f.Vector3(F.x + V, F.y, F.z)), T.push(new f.Vector3(F.x - V, F.y, F.z)), T.push(new f.Vector3(F.x, F.y + V, F.z)), T.push(new f.Vector3(F.x, F.y - V, F.z)), T.push(new f.Vector3(F.x, F.y, F.z + V)), T.push(new f.Vector3(F.x, F.y, F.z - V))) : T.push(F); - } - }), D = (0, b.getExtent)(T), M = T, C = D) : (M = this.getAtomsFromSel({}), C = (0, b.getExtent)(M)); - var I = new f.Vector3(D[2][0], D[2][1], D[2][2]), B = C[1][0] - C[0][0], P = C[1][1] - C[0][1], z = C[1][2] - C[0][2], k = Math.hypot(B, P, z); - k < 5 && (k = 5), this.slabNear = -k / 1.9, this.slabFar = k / 2, B = D[1][0] - D[0][0], P = D[1][1] - D[0][1], z = D[1][2] - D[0][2], k = Math.hypot(B, P, z), k < 5 && (k = 5); - for (var N = 25, R = 0; R < T.length; R++) - if (T[R]) { - var U = I.distanceToSquared(T[R]); - U > N && (N = U); - } - k = Math.sqrt(N) * 2; - var W = I.clone().multiplyScalar(-1); - return l > 0 ? this.animateMotion(l, g, W, this.rotationGroup.position.z, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = W, this.show()), this; - } - /** - * Zoom to center of atom selection. The slab will be set appropriately for - * the selection, unless an empty selection is provided, in which case there will be no slab. - * - * @param {Object} - * [sel] - Selection specification specifying model and atom - * properties to select. Default: all atoms in viewer - * @param {number} - * [animationDuration] - an optional parameter that denotes - * the duration of a zoom animation - * @param {Boolean} [fixedPath] - if true animation is constrained to - * requested motion, overriding updates that happen during the animation * - * @example - - - $3Dmol.get('data/1fas.pqr', function(data){ - viewer.addModel(data, "pqr"); - $3Dmol.get("data/1fas.cube",function(volumedata){ - viewer.addSurface($3Dmol.SurfaceType.VDW, { - opacity:0.85, - voldata: new $3Dmol.VolumeData(volumedata, "cube"), - volscheme: new $3Dmol.Gradient.Sinebow($3Dmol.getPropertyRange(viewer.selectedAtoms(),'charge')) - },{}); - - viewer.render(); - }); - viewer.zoomTo(); - }); - */ - zoomTo(a = {}, l = 0, g = !1) { - let M = this.getAtomsFromSel(a), C = (0, b.getExtent)(M), T = C; - if ((0, b.isEmptyObject)(a)) { - let F = M && M.length; - if (this.shapes.forEach((V) => { - if (V && V.boundingSphere) { - if (V.boundingSphere.box) { - let oe = V.boundingSphere.box; - M.push(new f.Vector3(oe.min.x, oe.min.y, oe.min.z)), M.push(new f.Vector3(oe.max.x, oe.max.y, oe.max.z)); - } else if (V.boundingSphere.center) { - var J = V.boundingSphere.center, X = V.boundingSphere.radius; - X > 0 ? (M.push(new f.Vector3(J.x + X, J.y, J.z)), M.push(new f.Vector3(J.x - X, J.y, J.z)), M.push(new f.Vector3(J.x, J.y + X, J.z)), M.push(new f.Vector3(J.x, J.y - X, J.z)), M.push(new f.Vector3(J.x, J.y, J.z + X)), M.push(new f.Vector3(J.x, J.y, J.z - X))) : M.push(J); - } - } - }), T = (0, b.getExtent)(M), !F) - for (let V = 0; V < 3; V++) - C[2][V] = (T[0][V] + T[1][V]) / 2; - } else { - let F = this.getAtomsFromSel({}); - T = (0, b.getExtent)(F); - } - var D = new f.Vector3(C[2][0], C[2][1], C[2][2]), I = T[1][0] - T[0][0], B = T[1][1] - T[0][1], P = T[1][2] - T[0][2], z = Math.hypot(I, B, P); - z < 5 && (z = 5), this.slabNear = -z / 1.9, this.slabFar = z / 2, Object.keys(a).length === 0 && (this.slabNear = Math.min(-z * 2, -50), this.slabFar = Math.max(z * 2, 50)); - var k = this.config.minimumZoomToDistance || 5; - I = C[1][0] - C[0][0], B = C[1][1] - C[0][1], P = C[1][2] - C[0][2], z = Math.hypot(I, B, P), z < k && (z = k); - for (var N = k * k, R = 0; R < M.length; R++) - if (M[R]) { - var U = D.distanceToSquared(M[R]); - U > N && (N = U); - } - z = Math.sqrt(N) * 2; - var W = D.clone().multiplyScalar(-1), G = -(z * 0.5 / Math.tan(Math.PI / 180 * this.camera.fov / 2) - this.CAMERA_Z); - return G = this.adjustZoomToLimits(G), l > 0 ? this.animateMotion(l, g, W, G, this.rotationGroup.quaternion, this.lookingAt) : (this.modelGroup.position = W, this.rotationGroup.position.z = G, this.show()), this; - } - /** - * Set slab of view (contents outside of slab are clipped). - * Must call render to update. - * - * @param {number} near near clipping plane distance - * @param {number} far far clipping plane distance - */ - setSlab(a, l) { - this.slabNear = a, this.slabFar = l; - } - /** - * Get slab of view (contents outside of slab are clipped). - * - * @return {Object} - * @property {number} near - near clipping plane distance - * @property {number} far - far clipping plane distance - */ - getSlab() { - return { near: this.slabNear, far: this.slabFar }; - } - /** - * Add label to viewer - * - * @param {string} - * text - Label text - * @param {LabelSpec} - * options - Label style specification - @param {AtomSelection} - * sel - Set position of label to center of this selection - * @param {boolean} noshow - if true, do not immediately display label - when adding multiple labels this is more efficient - * @return {Label} - * - * @example - * $3Dmol.download("pdb:2EJ0",viewer,{},function(){ - - viewer.addLabel("Aromatic", {position: {x:-6.89, y:0.75, z:0.35}, backgroundColor: 0x800080, backgroundOpacity: 0.8}); - viewer.addLabel("Label",{font:'sans-serif',fontSize:18,fontColor:'white',fontOpacity:1,borderThickness:1.0, - borderColor:'red',borderOpacity:0.5,backgroundColor:'black',backgroundOpacity:0.5, - position:{x:50.0,y:0.0,z:0.0},inFront:true,showBackground:true}); - viewer.setStyle({chain:'A'},{cross:{hidden:true}}); - viewer.setStyle({chain:'B'},{cross:{hidden:false, - linewidth:1.0, - colorscheme:'greenCarbon'}}); - viewer.setStyle({chain:'C'},{cross:{hidden:false, - linewidth:1.0, - radius:0.5}}); - viewer.setStyle({chain:'D'},{cross:{hidden:false, - linewidth:10.0}}); - viewer.setStyle({chain:'E'},{cross:{hidden:false, - linewidth:1.0, - color:'black'}}); - - viewer.render(); - - - }); - - */ - addLabel(a, l = {}, g, M = !1) { - if (g) { - var C = (0, b.getExtent)(this.getAtomsFromSel(g)); - l.position = { x: C[2][0], y: C[2][1], z: C[2][2] }; - } - var T = new E.Label(a, l); - return T.setContext(), this.modelGroup.add(T.sprite), this.labels.push(T), M || this.show(), T; - } - /** Add residue labels. This will generate one label per a - * residue within the selected atoms. The label will be at the - * centroid of the atoms and styled according to the passed style. - * The label text will be [resn][resi] - * - * @param {AtomSelectionSpec} sel - * @param {AtomStyleSpec} style - * @param {boolean} byframe - if true, create labels for every individual frame, not just current - * - * @example - $3Dmol.download("mmtf:2ll5",viewer,{},function(){ - viewer.setStyle({stick:{radius:0.15},cartoon:{}}); - viewer.addResLabels({hetflag:false}, {font: 'Arial', fontColor:'black',showBackground:false, screenOffset: {x:0,y:0}}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addResLabels(a, l, g = !1) { - let M = this.labels.length; - return this.applyToModels("addResLabels", a, this, l, g), this.show(), this.labels.slice(M); - } - /** Add property labels. This will generate one label per a selected - * atom at the atom's coordinates with the property value as the label text. - * - * @param {string} prop - property name - * @param {AtomSelectionSpec} sel - * @param {AtomStyleSpec} style - * - * * @example - $3Dmol.download("cid:5291",viewer,{},function(){ - viewer.setStyle({stick: {radius:.2}}); - viewer.addPropertyLabels("index",{not:{elem:'H'}}, {fontColor:'black',font: 'sans-serif', fontSize: 28, showBackground:false,alignment:'center'}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addPropertyLabels(a, l, g) { - return this.applyToModels("addPropertyLabels", a, l, this, g), this.show(), this; - } - /** - * Remove label from viewer - * - * @param {Label} label - $3Dmol label - * - * @example // Remove labels created in - $3Dmol.download("pdb:2EJ0",viewer,{},function(){ - var toremove = viewer.addLabel("Aromatic", {position: {x:-6.89, y:0.75, z:0.35}, backgroundColor: 0x800080, backgroundOpacity: 0.8}); - viewer.addLabel("Label",{font:'sans-serif',fontSize:18,fontColor:'white',fontOpacity:1,borderThickness:1.0, - borderColor:'red',borderOpacity:0.5,backgroundColor:'black',backgroundOpacity:0.5, - position:{x:50.0,y:0.0,z:0.0},inFront:true,showBackground:true}); - viewer.removeLabel(toremove); - viewer.render(); - - - }); - - */ - removeLabel(a) { - for (var l = 0; l < this.labels.length; l++) - if (this.labels[l] == a) { - this.labels.splice(l, 1), a.dispose(), this.modelGroup.remove(a.sprite); - break; - } - return this.show(), this; - } - /** - * Remove all labels from viewer - * - * @example - $3Dmol.download("pdb:1ubq",viewer,{},function(){ - - viewer.addResLabels(); - viewer.setStyle({},{stick:{}}); - viewer.render( ); //show labels - - viewer.removeAllLabels(); - viewer.render(); //hide labels - }); - */ - removeAllLabels() { - for (var a = 0; a < this.labels.length; a++) - this.labels[a] && this.labels[a].sprite && this.modelGroup.remove(this.labels[a].sprite); - return this.labels.splice(0, this.labels.length), this.show(), this; - } - // Modify label style - /** - * Modify existing label's style - * - * @param {Label} label - $3Dmol label - * @param {LabelSpec} - * stylespec - Label style specification - * @return {Label} - */ - setLabelStyle(a, l) { - return this.modelGroup.remove(a.sprite), a.dispose(), a.stylespec = l, a.setContext(), this.modelGroup.add(a.sprite), this.show(), a; - } - // Change label text - /** - * Modify existing label's text - * - * @param {Label} label - $3Dmol label - * @param {String} - * text - Label text - * @return {Label} - */ - setLabelText(a, l) { - return this.modelGroup.remove(a.sprite), a.dispose(), a.text = l, a.setContext(), this.modelGroup.add(a.sprite), this.show(), a; - } - /** - * Add shape object to viewer - * @see {GLShape} - * - * @param {ShapeSpec} shapeSpec - style specification for label - * @return {GLShape} - */ - addShape(a) { - a = a || {}; - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, this.shapes.push(l), l; - } - /** - * Remove shape object from viewer - * - * @param {GLShape} shape - Reference to shape object to remove - */ - removeShape(a) { - if (!a) - return this; - for (a.removegl(this.modelGroup), delete this.shapes[a.shapePosition]; this.shapes.length > 0 && typeof this.shapes[this.shapes.length - 1] > "u"; ) - this.shapes.pop(); - return this; - } - /** - * Remove all shape objects from viewer - */ - removeAllShapes() { - for (var a = 0; a < this.shapes.length; a++) { - var l = this.shapes[a]; - l && l.removegl(this.modelGroup); - } - return this.shapes.splice(0, this.shapes.length), this; - } - //gets the center of the selection - getSelectionCenter(a) { - if (a.hasOwnProperty("x") && a.hasOwnProperty("y") && a.hasOwnProperty("z")) - return a; - var l = this.getAtomsFromSel(a); - if (l.length == 0) - return { x: 0, y: 0, z: 0 }; - var g = (0, b.getExtent)(l); - return { x: g[0][0] + (g[1][0] - g[0][0]) / 2, y: g[0][1] + (g[1][1] - g[0][1]) / 2, z: g[0][2] + (g[1][2] - g[0][2]) / 2 }; - } - /** - * Create and add sphere shape. This method provides a shorthand - * way to create a spherical shape object - * - * @param {SphereShapeSpec} spec - Sphere shape style specification - * @return {GLShape} - @example - - viewer.addSphere({center:{x:0,y:0,z:0},radius:10.0,color:'red'}); - - viewer.render(); - */ - addSphere(a) { - a = a || {}, a.center = this.getSelectionCenter(a.center); - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, l.addSphere(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add box shape. This method provides a shorthand - * way to create a box shape object - * - * @param {BoxSpec} spec - Box shape style specification - * @return {GLShape} - @example - - viewer.addLine({color:'red',start:{x:0,y:0,z:0},end:{x:5,y:0,z:0}}); - viewer.addLine({color:'blue',start:{x:0,y:0,z:0},end:{x:0,y:5,z:0}}); - viewer.addLine({color:'green',start:{x:0,y:0,z:0},end:{x:0,y:0,z:5}}); - - viewer.addBox({center:{x:0,y:0,z:0},dimensions: {w:3,h:4,d:2},color:'magenta'}); - viewer.zoomTo(); - viewer.rotate(45, {x:1,y:1,z:1}); - viewer.render(); - */ - addBox(a = {}) { - a.corner != null && (a.corner = this.getSelectionCenter(a.corner)), a.center != null && (a.center = this.getSelectionCenter(a.center)); - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, l.addBox(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add arrow shape - * - * @param {ArrowSpec} spec - Style specification - * @return {GLShape} - @example - $3Dmol.download("pdb:4DM7",viewer,{},function(){ - - viewer.setBackgroundColor(0xffffffff); - viewer.addArrow({ - start: {x:-10.0, y:0.0, z:0.0}, - end: {x:0.0, y:-10.0, z:0.0}, - radius: 1.0, - radiusRadio:1.0, - mid:1.0, - clickable:true, - callback:function(){ - this.color.setHex(0xFF0000FF); - viewer.render( ); - } - }); - viewer.render(); - }); - */ - addArrow(a = {}) { - a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end); - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, l.addArrow(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add cylinder shape - * - * @param {CylinderSpec} spec - Style specification - * @return {GLShape} - - @example - viewer.setBackgroundColor(0xffffffff); - viewer.addCylinder({start:{x:0.0,y:0.0,z:0.0}, - end:{x:10.0,y:0.0,z:0.0}, - radius:1.0, - fromCap:1, - toCap:2, - color:'red', - hoverable:true, - clickable:true, - callback:function(){ this.color.setHex(0x00FFFF00);viewer.render( );}, - hover_callback: function(){ viewer.render( );}, - unhover_callback: function(){ this.color.setHex(0xFF000000);viewer.render( );} - }); - viewer.addCylinder({start:{x:0.0,y:2.0,z:0.0}, - end:{x:0.0,y:10.0,z:0.0}, - radius:0.5, - fromCap:false, - toCap:true, - color:'teal'}); - viewer.addCylinder({start:{x:15.0,y:0.0,z:0.0}, - end:{x:20.0,y:0.0,z:0.0}, - radius:1.0, - color:'black', - fromCap:false, - toCap:false}); - viewer.render(); - */ - addCylinder(a = {}) { - a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end); - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, a.dashed ? l.addDashedCylinder(a) : l.addCylinder(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add Curve shape - * - * @param {CurveSpec} spec - Style specification - * @return {GLShape} - - @example - viewer.addCurve({points: [{x:0.0,y:0.0,z:0.0}, {x:5.0,y:3.0,z:0.0}, {x:5.0,y:7.0,z:0.0}, {x:0.0,y:10.0,z:0.0}], - radius:0.5, - smooth: 10, - fromArrow:false, - toArrow: true, - color:'orange', - }); - viewer.addCurve({points: [{x:-1,y:0.0,z:0.0}, {x:-5.0,y:5.0,z:0.0}, {x:-2,y:10.0,z:0.0}], - radius:1, - fromArrow:true, - toArrow: false, - color:'purple', - }); - viewer.zoomTo(); - viewer.render(); - */ - addCurve(a = {}) { - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, l.addCurve(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add line shape - * - * @param {LineSpec} spec - Style specification, can specify dashed, dashLength, and gapLength - * @return {GLShape} - @example - $3Dmol.download("pdb:2ABJ",viewer,{},function(){ - - viewer.setViewStyle({style:"outline"}); - viewer.setStyle({chain:'A'},{sphere:{hidden:true}}); - viewer.setStyle({chain:'D'},{sphere:{radius:3.0}}); - viewer.setStyle({chain:'G'},{sphere:{colorscheme:'greenCarbon'}}); - viewer.setStyle({chain:'J'},{sphere:{color:'blue'}}); - viewer.addLine({dashed:true,start:{x:0,y:0,z:0},end:{x:100,y:100,z:100}}); - viewer.render(); - }); - - */ - addLine(a = {}) { - a.start = this.getSelectionCenter(a.start), a.end = this.getSelectionCenter(a.end), a.wireframe = !0; - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, a.dashed ? l = this.addLineDashed(a, l) : l.addLine(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Create and add unit cell visualization. - * - * @param {GLModel|number} model - Model with unit cell information (e.g., pdb derived). If omitted uses most recently added model. - * @param {UnitCellStyleSpec} spec - visualization style - @example - - $3Dmol.get('data/1jpy.cif', function(data) { - let m = viewer.addModel(data); - viewer.addUnitCell(m, {box:{color:'purple'},alabel:'X',blabel:'Y',clabel:'Z',alabelstyle: {fontColor: 'black',backgroundColor:'white',inFront:true,fontSize:40},astyle:{color:'darkred', radius:5,midpos: -10}}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addUnitCell(a, l) { - a = this.getModel(a), l = l || { alabel: "a", blabel: "b", clabel: "c" }, l.box = l.box || {}, l.astyle = l.astyle || { color: "red", radius: 0.1, midpos: -1 }, l.bstyle = l.bstyle || { color: "green", radius: 0.1, midpos: -1 }, l.cstyle = l.cstyle || { color: "blue", radius: 0.1, midpos: -1 }, l.alabelstyle = l.alabelstyle || { fontColor: "red", showBackground: !1, alignment: "center", inFront: !1 }, l.blabelstyle = l.blabelstyle || { fontColor: "green", showBackground: !1, alignment: "center", inFront: !1 }, l.clabelstyle = l.clabelstyle || { fontColor: "blue", showBackground: !1, alignment: "center", inFront: !1 }, a.unitCellObjects && this.removeUnitCell(a), a.unitCellObjects = { shapes: [], labels: [] }; - var g = a.getCrystData(), M = null; - if (g) { - if (g.matrix) - M = g.matrix; - else { - var C = g.a, T = g.b, D = g.c, I = g.alpha, B = g.beta, P = g.gamma; - I = I * Math.PI / 180, B = B * Math.PI / 180, P = P * Math.PI / 180; - var z, k, N; - z = Math.cos(B), k = (Math.cos(I) - Math.cos(B) * Math.cos(P)) / Math.sin(P), N = Math.sqrt(Math.max(0, 1 - z * z - k * k)), M = new f.Matrix3(C, T * Math.cos(P), D * z, 0, T * Math.sin(P), D * k, 0, 0, D * N); - } - var R = [ - new f.Vector3(0, 0, 0), - new f.Vector3(1, 0, 0), - new f.Vector3(0, 1, 0), - new f.Vector3(0, 0, 1), - new f.Vector3(1, 1, 0), - new f.Vector3(0, 1, 1), - new f.Vector3(1, 0, 1), - new f.Vector3(1, 1, 1) - ]; - if (g.matrix4) - for (let W = 0; W < R.length; W++) - g.size && R[W].multiplyVectors(R[W], g.size), R[W] = R[W].applyMatrix4(g.matrix4); - else - for (let W = 0; W < R.length; W++) - R[W] = R[W].applyMatrix3(M); - if (l.box && !l.box.hidden) { - l.box.wireframe = !0; - var U = new c.GLShape(l.box); - U.shapePosition = this.shapes.length, U.addLine({ start: R[0], end: R[1] }), U.addLine({ start: R[0], end: R[2] }), U.addLine({ start: R[1], end: R[4] }), U.addLine({ start: R[2], end: R[4] }), U.addLine({ start: R[0], end: R[3] }), U.addLine({ start: R[3], end: R[5] }), U.addLine({ start: R[2], end: R[5] }), U.addLine({ start: R[1], end: R[6] }), U.addLine({ start: R[4], end: R[7] }), U.addLine({ start: R[6], end: R[7] }), U.addLine({ start: R[3], end: R[6] }), U.addLine({ start: R[5], end: R[7] }), this.shapes.push(U), a.unitCellObjects.shapes.push(U), U.finalize(); - } - if (!l.astyle.hidden) { - l.astyle.start = R[0], l.astyle.end = R[1]; - let W = this.addArrow(l.astyle); - a.unitCellObjects.shapes.push(W); - } - if (!l.bstyle.hidden) { - l.bstyle.start = R[0], l.bstyle.end = R[2]; - let W = this.addArrow(l.bstyle); - a.unitCellObjects.shapes.push(W); - } - if (!l.cstyle.hidden) { - l.cstyle.start = R[0], l.cstyle.end = R[3]; - let W = this.addArrow(l.cstyle); - a.unitCellObjects.shapes.push(W); - } - if (l.alabel) { - l.alabelstyle.position = R[1]; - let W = this.addLabel(l.alabel, l.alabelstyle); - a.unitCellObjects.labels.push(W); - } - if (l.blabel) { - l.blabelstyle.position = R[2]; - let W = this.addLabel(l.blabel, l.blabelstyle); - a.unitCellObjects.labels.push(W); - } - if (l.clabel) { - l.clabelstyle.position = R[3]; - let W = this.addLabel(l.clabel, l.clabelstyle); - a.unitCellObjects.labels.push(W); - } - } - } - /** - * Remove unit cell visualization from model. - * - * @param {GLModel|number} model - Model with unit cell information (e.g., pdb derived). If omitted uses most recently added model. - @example - $3Dmol.get('data/icsd_200866.cif', function(data) { - let m = viewer.addModel(data); - viewer.setStyle({sphere:{}}) - viewer.addUnitCell(); - viewer.zoomTo(); - viewer.removeUnitCell(); - viewer.render(); - }); - */ - removeUnitCell(a) { - if (a = this.getModel(a), a.unitCellObjects) { - let l = this; - a.unitCellObjects.shapes.forEach(function(g) { - l.removeShape(g); - }), a.unitCellObjects.labels.forEach(function(g) { - l.removeLabel(g); - }); - } - delete a.unitCellObjects; - } - /** - * Replicate atoms in model to form a super cell of the specified dimensions. - * Original cell will be centered as much as possible. - * - * @param {integer} A - number of times to replicate cell in X dimension. - * @param {integer} B - number of times to replicate cell in Y dimension. If absent, X value is used. - * @param {integer} C - number of times to replicate cell in Z dimension. If absent, Y value is used. - * @param {GLModel} model - Model with unit cell information (e.g., pdb derived). If omitted uses most recently added model. - * @param {boolean} addBonds - Create bonds between unit cells based on distances. - @example - $3Dmol.get('data/icsd_200866.cif', function(data) { - let m = viewer.addModel(data); - viewer.setStyle({sphere:{scale:.25}}) - viewer.addUnitCell(); - viewer.zoomTo(); - viewer.replicateUnitCell(3,2,1,m); - viewer.render(); - }); - */ - replicateUnitCell(a = 3, l = a, g = l, M, C) { - M = this.getModel(M); - let T = M.getCrystData(); - if (T) { - const D = M.selectedAtoms({}), I = T.matrix; - let B = function(P) { - return P % 2 == 0 ? -P / 2 : Math.ceil(P / 2); - }; - for (let P = 0; P < a; P++) - for (let z = 0; z < l; z++) - for (let k = 0; k < g; k++) { - if (P == 0 && z == 0 && k == 0) - continue; - let N = new f.Vector3(B(P), B(z), B(k)); - N.applyMatrix3(I); - let R = []; - for (let U = 0; U < D.length; U++) { - let W = {}; - for (let G in D[U]) - W[G] = D[U][G]; - W.x += N.x, W.y += N.y, W.z += N.z, R.push(W); - } - M.addAtoms(R); - } - C && M.assignBonds(); - } - } - /** Add dashed line to shape */ - addLineDashed(a, l) { - a.dashLength = a.dashLength || 0.5, a.gapLength = a.gapLength || 0.5; - var g; - a.start ? g = new f.Vector3(a.start.x || 0, a.start.y || 0, a.start.z || 0) : g = new f.Vector3(0, 0, 0); - var M; - a.end ? M = new f.Vector3(a.end.x, a.end.y || 0, a.end.z || 0) : M = new f.Vector3(0, 0, 0); - var C = new f.Vector3(), T = new f.Vector3(), D = new f.Vector3(), I, B, P, z = g.clone(), k = 0; - for (C.subVectors(M, g), I = C.length(), C.normalize(), T = C.clone(), D = C.clone(), T.multiplyScalar(a.dashLength), D.multiplyScalar(a.gapLength), B = T.length(), P = D.length(); k < I; ) { - if (k + B > I) { - a.start = g, a.end = M, l.addLine(a); - break; - } - z.addVectors(g, T), a.start = g, a.end = z, l.addLine(a), g = z.clone(), k += B, z.addVectors(g, D), g = z.clone(), k += P; - } - return l.finalize(), l; - } - /** - * Add custom shape component from user supplied function - * - * @param {CustomSpec} spec - Style specification - * @return {GLShape} - @example - function triangle(viewer) { - var vertices = []; - var normals = []; - var colors = []; - var r = 20; - //triangle - vertices.push(new $3Dmol.Vector3(0,0,0)); - vertices.push(new $3Dmol.Vector3(r,0,0)); - vertices.push(new $3Dmol.Vector3(0,r,0)); - - normals.push(new $3Dmol.Vector3(0,0,1)); - normals.push(new $3Dmol.Vector3(0,0,1)); - normals.push(new $3Dmol.Vector3(0,0,1)); - - colors.push({r:1,g:0,b:0}); - colors.push({r:0,g:1,b:0}); - colors.push({r:0,g:0,b:1}); - - var faces = [ 0,1,2 ]; - - var spec = {vertexArr:vertices, normalArr: normals, faceArr:faces,color:colors}; - viewer.addCustom(spec); - } - triangle(viewer); - viewer.render(); - */ - addCustom(a) { - a = a || {}; - var l = new c.GLShape(a); - return l.shapePosition = this.shapes.length, l.addCustom(a), this.shapes.push(l), l.finalize(), l; - } - /** - * Construct isosurface from volumetric data in gaussian cube format - * @param {String} data - Input file contents - * @param {String} format - Input file format - * @param {VolumetricRendererSpec|IsoSurfaceSpec} spec - Shape style specification - * @return {GLShape} - * - * @example - - - $3Dmol.get('data/bohr.cube', function(data) { - - viewer.addVolumetricData(data, "cube", {isoval: -0.01, color: "red", opacity: 0.95}); - viewer.setStyle({cartoon:{},stick:{}}); - viewer.zoomTo(); - viewer.render(); - }); - - - */ - addVolumetricData(a, l, g = {}) { - var M = new S.VolumeData(a, l); - return g.hasOwnProperty("transferfn") ? this.addVolumetricRender(M, g) : this.addIsosurface(M, g); - } - /** - * Construct isosurface from volumetric data. This is more flexible - * than addVolumetricData, but can not be used with py3Dmol. - * @param {VolumeData} data - volumetric data - * @param {IsoSurfaceSpec} spec - Shape style specification - * @return {GLShape} - * - @example - $3Dmol.get('../test_structs/benzene-homo.cube', function(data){ - var voldata = new $3Dmol.VolumeData(data, "cube"); - viewer.addIsosurface(voldata, {isoval: 0.01, - color: "blue"}); - viewer.addIsosurface(voldata, {isoval: -0.01, - color: "red"}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addIsosurface(a, l = {}, g) { - var M = new c.GLShape(l); - return M.shapePosition = this.shapes.length, M.addIsosurface(a, l, g), this.shapes.push(M), M; - } - /** - * Create volumetric renderer for volumetricData - * @param {VolumeData} data - volumetric data - * @param {VolumetricRenderSpec} spec - specification of volumetric render - * - * @return {GLShape} - * - */ - addVolumetricRender(a, l) { - l = l || {}; - var g = new w.GLVolumetricRender(a, l); - return g.shapePosition = this.shapes.length, this.shapes.push(g), g; - } - /** - * Return true if volumetric rendering is supported (WebGL 2.0 required) - * - * @return {boolean} - */ - hasVolumetricRender() { - return this.renderer.supportsVolumetric(); - } - /** - * Enable/disable fog for content far from the camera - * - * @param {boolean} fog whether to enable or disable the fog - */ - enableFog(a) { - a ? this.scene.fog = new n.Fog(this.bgColor, 100, 200) : (this.config.disableFog = !0, this.show()); - } - /** - * Sets the atomlists of all models in the viewer to specified frame. - * Shapes and labels can also be displayed by frame. - * Sets to last frame if framenum out of range - * - * @param {number} framenum - fame index to use, starts at zero - * @return {Promise} - */ - setFrame(a) { - this.viewer_frame = a; - let l = this; - return new Promise(function(g) { - var M = l.models.map(function(C) { - return C.setFrame(a, l); - }); - Promise.all(M).then(function() { - g(); - }); - }); - } - /** - * Gets the current viewer frame. - * - */ - getFrame() { - return this.viewer_frame; - } - /** - * Returns the number of frames that the model with the most frames in the viewer has - * - * @return {number} - */ - getNumFrames() { - var a = 0; - for (let l = 0; l < this.models.length; l++) - this.models[l].getNumFrames() > a && (a = this.models[l].getNumFrames()); - for (let l = 0; l < this.shapes.length; l++) - this.shapes[l].frame && this.shapes[l].frame >= a && (a = this.shapes[l].frame + 1); - for (let l = 0; l < this.labels.length; l++) - this.labels[l].frame && this.labels[l].frame >= a && (a = this.labels[l].frame + 1); - return a; - } - /** - * Animate all models in viewer from their respective frames - * @param {Object} options - can specify interval (speed of animation), loop (direction - * of looping, 'backward', 'forward' or 'backAndForth'), step interval between frames ('step'), startFrame, and reps (numer of repetitions, 0 indicates infinite loop) - * - */ - animate(a) { - this.incAnim(); - var l = 100, g = "forward", M = 0; - a = a || {}, a.interval && (l = a.interval), a.loop && (g = a.loop), a.reps && (M = a.reps); - var C = this.getNumFrames(), T = this, D = 0; - a.startFrame && (D = a.startFrame % C); - var I = 1; - a.step && (I = a.step, M /= I); - var B = 0, P = C * M, z = /* @__PURE__ */ new Date(), k, N, R = function(U) { - z = /* @__PURE__ */ new Date(), U == "forward" ? T.setFrame(D).then(function() { - D = (D + I) % C, k(); - }) : U == "backward" ? T.setFrame(C - 1 - D).then(function() { - D = (D + I) % C, k(); - }) : T.setFrame(D).then(function() { - D += I, I *= D % (C - 1) == 0 ? -1 : 1, k(); - }); - }; - return k = function() { - if (T.render(), !T.getCanvas().isConnected) - T.stopAnimate(); - else if (++B == P || !T.isAnimated()) - N.cancel(), T.animationTimers.delete(N), T.decAnim(); - else { - var U = l - ((/* @__PURE__ */ new Date()).getTime() - z.getTime()); - U = U > 0 ? U : 0, T.animationTimers.delete(N), N = new b.PausableTimer(R, U, g), T.animationTimers.add(N); - } - }, N = new b.PausableTimer(R, 0, g), this.animationTimers.add(N), this; - } - /** - * Stop animation of all models in viewer - */ - stopAnimate() { - return this.animated = 0, this.animationTimers.forEach(function(a) { - a.cancel(); - }), this.animationTimers = /* @__PURE__ */ new Set(), this; - } - /** - * Pause animation of all models in viewer - */ - pauseAnimate() { - return this.animationTimers.forEach(function(a) { - a.pause(); - }), this; - } - /** - * Resume animation of all models in viewer - */ - resumeAnimate() { - return this.animationTimers.forEach(function(a) { - a.resume(); - }), this; - } - /** - * Return true if viewer is currently being animated, false otherwise - * @return {boolean} - */ - isAnimated() { - return this.animated > 0; - } - /** - * Create and add model to viewer, given molecular data and its format - * - * @param {string} data - Input data - * @param {string} format - Input format ('pdb', 'sdf', 'xyz', 'pqr', or 'mol2') - * @param {ParserOptionsSpec} options - format dependent options. Attributes depend on the input file format. - * @example - - - viewer.setViewStyle({style:"outline"}); - $3Dmol.get('data/1fas.pqr', function(data){ - viewer.addModel(data, "pqr"); - $3Dmol.get("data/1fas.cube",function(volumedata){ - viewer.addSurface($3Dmol.SurfaceType.VDW, {opacity:0.85,voldata: new $3Dmol.VolumeData(volumedata, "cube"), volscheme: new $3Dmol.Gradient.RWB(-10,10)},{}); - - viewer.render(); - }); - viewer.zoomTo(); - }); - * - * @return {GLModel} - */ - addModel(a, l = "", g) { - g && !g.defaultcolors ? (g.defaultcolors = this.defaultcolors, g.cartoonQuality = g.cartoonQuality || this.config.cartoonQuality) : typeof g > "u" && (g = { defaultcolors: this.defaultcolors, cartoonQuality: this.config.cartoonQuality }); - var M = new _.GLModel(this.models.length, g); - return M.addMolData(a, l, g), this.models.push(M), M; - } - /** - * Given multimodel file and its format, add atom data to the viewer as separate models - * and return list of these models - * - * @param {string} data - Input data - * @param {string} format - Input format (see {@link FileFormats}) - * @return {Array} - */ - addModels(a, l, g) { - g = g || {}, g.multimodel = !0, g.frames = !0; - for (var M = _.GLModel.parseMolData(a, l, g), C = 0; C < M.length; C++) { - var T = new _.GLModel(this.models.length, this.defaultcolors); - T.setAtomDefaults(M[C]), T.addFrame(M[C]), T.setFrame(0), M.modelData && T.setModelData(M.modelData[C]), T.setDontDuplicateAtoms(!g.duplicateAssemblyAtoms), this.models.push(T); - } - return this.models; - } - /** - * Create and add model to viewer. Given multimodel file and its format, - * different atomlists are stored in model's frame - * property and model's atoms are set to the 0th frame - * - * @param {string} data - Input data - * @param {string} format - Input format (see {@link FileFormats}) - * @return {GLModel} - * - * @example - $3Dmol.get('../test_structs/multiple2.xyz', function(data){ - viewer.addModelsAsFrames(data, "xyz"); - viewer.animate({loop: "forward",reps: 1}); - viewer.setStyle({stick:{colorscheme:'magentaCarbon'}}); - viewer.zoomTo(); - viewer.render(); - }); - */ - addModelsAsFrames(a, l, g) { - g = g || {}, g.multimodel = !0, g.frames = !0; - var M = new _.GLModel(this.models.length, this.defaultcolors); - return M.addMolData(a, l, g), this.models.push(M), M; - } - /** - * Create and add model to viewer. Given multimodel file and its format, - * all atoms are added to one model - * - * @param {string} data - Input data - * @param {string} format - Input format (see {@link FileFormats}) - * @return {GLModel} - @example - - - $3Dmol.get('../test_structs/multiple.sdf', function(data){ - viewer.addAsOneMolecule(data, "sdf"); - viewer.zoomTo(); - viewer.render(); - }); - */ - addAsOneMolecule(a, l, g) { - g = g || {}, g.multimodel = !0, g.onemol = !0; - var M = new _.GLModel(this.models.length, this.defaultcolors); - return M.addMolData(a, l, g), this.models.push(M), M; - } - /** - * Delete specified model from viewer - * - * @param {GLModel|number} model - */ - removeModel(a) { - if (a = this.getModel(a), !!a) { - for (a.removegl(this.modelGroup), delete this.models[a.getID()]; this.models.length > 0 && typeof this.models[this.models.length - 1] > "u"; ) - this.models.pop(); - return this; - } - } - /** - * Delete all existing models - */ - removeAllModels() { - for (var a = 0; a < this.models.length; a++) { - var l = this.models[a]; - l && l.removegl(this.modelGroup); - } - return this.models.splice(0, this.models.length), this; - } - /** - * Export one or all of the loaded models into ChemDoodle compatible JSON. - * @param {boolean} includeStyles - Whether or not to include style information. - * @param {number} modelID - Optional parameter for which model to export. If left out, export all of them. - * @return {string} - */ - exportJSON(a, l) { - var g = {}; - return l === void 0 ? g.m = this.models.map(function(M) { - return M.toCDObject(a); - }) : g.m = [this.models[l].toCDObject()], JSON.stringify(g); - } - /** return a VRML string representation of the scene. Include VRML header information - * @return VRML - */ - exportVRML() { - var a = this.modelGroup; - this.applyToModels("removegl", this.modelGroup), this.modelGroup = new n.Object3D(), this.render(null, { supportsImposters: !1, supportsAIA: !1, regen: !0 }); - var l = `#VRML V2.0 utf8 -` + this.modelGroup.vrml() + ` -`; - return this.applyToModels("removegl", this.modelGroup), this.modelGroup = a, l; - } - /** - * Create a new model from atoms specified by sel. - * If extract, removes selected atoms from existing models - * - * @param {AtomSelectionSpec} sel - Atom selection specification - * @param {boolean=} extract - If true, remove selected atoms from existing models - * @return {GLModel} - */ - createModelFrom(a, l = !1) { - for (var g = new _.GLModel(this.models.length, this.defaultcolors), M = 0; M < this.models.length; M++) - if (this.models[M]) { - var C = this.models[M].selectedAtoms(a); - g.addAtoms(C), l && this.models[M].removeAtoms(C); - } - return this.models.push(g), g; - } - applyToModels(a, l, g, M, C, T, D) { - for (var I = this.getModelList(l), B = 0; B < I.length; B++) - I[B][a](l, g, M, C, T, D); - } - setStyle(a, l) { - return typeof l > "u" && (l = a, a = {}), this.applyToModels("setStyle", a, l, !1), this; - } - addStyle(a, l) { - return typeof l > "u" && (l = a, a = {}), this.applyToModels("setStyle", a, l, !0), this; - } - /** - * Set click-handling properties to all selected atoms. *Important*: render must be called for this to take effect. - * - * @param {AtomSelectionSpec} sel - atom selection to apply clickable settings to - * @param {boolean} clickable - whether click-handling is enabled for the selection - * @param {function} callback - function called when an atom in the selection is clicked. The function is passed - * the selected (foremost) object, the viewer, the triggering event, the associated container, and a list - * of all intersecting objects with their distances from the viewer. - * - * @example - $3Dmol.download("cid:307900",viewer,{},function(){ - - viewer.setStyle({},{sphere:{}}); - viewer.setClickable({},true,function(atom,viewer,event,container) { - viewer.addLabel(atom.resn+":"+atom.atom,{position: atom, backgroundColor: 'darkgreen', backgroundOpacity: 0.8}); - }); - viewer.render(); - }); - */ - setClickable(a, l, g) { - return this.applyToModels("setClickable", a, l, g), this; - } - /** Set hoverable and callback of selected atoms - * - * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to - * @param {boolean} hoverable - whether hover-handling is enabled for the selection - * @param {function} hover_callback - function called when an atom in the selection is hovered over. The function has the same signature as a click handler. - * @param {function} unhover_callback - function called when the mouse moves out of the hover area - @example - $3Dmol.download("pdb:1ubq",viewer,{},function(){ - - viewer.setHoverable({},true,function(atom,viewer,event,container) { - if(!atom.label) { - atom.label = viewer.addLabel(atom.resn+":"+atom.atom,{position: atom, backgroundColor: 'mintcream', fontColor:'black'}); - } - }, - function(atom) { - if(atom.label) { - viewer.removeLabel(atom.label); - delete atom.label; - } - } - ); - viewer.setStyle({},{stick:{}}); - viewer.render(); - }); - - */ - setHoverable(a, l, g, M) { - return this.applyToModels("setHoverable", a, l, g, M), this; - } - /** enable context menu and callback of selected atoms - * - * @param {AtomSelectionSpec} sel - atom selection to apply hoverable settings to - * @param {boolean} contextMenuEnabled - whether contextMenu-handling is enabled for the selection - - */ - enableContextMenu(a, l) { - return this.applyToModels("enableContextMenu", a, l), this; - } - /** - * If atoms have dx, dy, dz properties (in some xyz files), vibrate populates each model's frame property based on parameters. - * Models can then be animated - * - * @param {number} numFrames - number of frames to be created, default to 10 - * @param {number} amplitude - amplitude of distortion, default to 1 (full) - * @param {boolean} bothWays - if true, extend both in positive and negative directions by numFrames - * @param {ArrowSpec} arrowSpec - specification for drawing animated arrows. If color isn't specified, atom color (sphere, stick, line preference) is used. - */ - vibrate(a, l, g, M) { - return this.applyToModels("vibrate", a, l, g, this, M), this; - } - /** - * @param {AtomSelectionSpec} sel - * @param {string} prop - * @param {Gradient|string} scheme - * @param {object} range - */ - setColorByProperty(a, l, g, M) { - return this.applyToModels("setColorByProperty", a, l, g, M), this; - } - /** - * @param {AtomSelectionSpec} sel - * @param {object} colors - */ - setColorByElement(a, l) { - return this.applyToModels("setColorByElement", a, l), this; - } - /** - * - * @param {AtomSpec[]} atomlist - * @param {Array} - * extent - * @return {Array} - */ - static getAtomsWithin(a, l) { - var g = []; - for (let C = 0; C < a.length; C++) { - var M = a[C]; - typeof M > "u" || M.x < l[0][0] || M.x > l[1][0] || M.y < l[0][1] || M.y > l[1][1] || M.z < l[0][2] || M.z > l[1][2] || g.push(M); - } - return g; - } - // return volume of extent - static volume(a) { - var l = a[1][0] - a[0][0], g = a[1][1] - a[0][1], M = a[1][2] - a[0][2]; - return l * g * M; - } - // volume - /* - * Break up bounding box/atoms into smaller pieces so we can parallelize - * with webworkers and also limit the size of the working memory Returns - * a list of bounding boxes with the corresponding atoms. These extents - * are expanded by 4 angstroms on each side. - */ - /** - * - * @param {Array} - * extent - * @param {AtomSpec[]} atomlist - * @param {AtomSpec[]} atomstoshow - * @return {Array} - */ - carveUpExtent(a, l, g) { - let M = [], C = {}; - for (let z = 0, k = l.length; z < k; z++) - C[l[z].index] = z; - let T = function(z) { - let k = []; - for (let N = 0, R = z.length; N < R; N++) - z[N].index in C && k.push(C[z[N].index]); - return k; - }, D = function(z) { - let k = []; - return k[0] = [z[0][0], z[0][1], z[0][2]], k[1] = [z[1][0], z[1][1], z[1][2]], k; - }, I = function(z) { - if (s.volume(z) < s.maxVolume) - return [z]; - var k = z[1][0] - z[0][0], N = z[1][1] - z[0][1], R = z[1][2] - z[0][2], U; - k > N && k > R ? U = 0 : N > k && N > R ? U = 1 : U = 2; - var W = D(z), G = D(z), F = (z[1][U] - z[0][U]) / 2 + z[0][U]; - W[1][U] = F, G[0][U] = F; - var V = I(W), J = I(G); - return V.concat(J); - }, B = I(a), P = 6; - for (let z = 0, k = B.length; z < k; z++) { - let N = D(B[z]); - N[0][0] -= P, N[0][1] -= P, N[0][2] -= P, N[1][0] += P, N[1][1] += P, N[1][2] += P; - let R = s.getAtomsWithin(l, N), U = s.getAtomsWithin(g, B[z]); - M.push({ - extent: B[z], - atoms: T(R), - toshow: T(U) - }); - } - return M; - } - // create a mesh defined from the passed vertices and faces and material - // Just create a single geometry chunk - broken up whether sync or not - /** - * - * @param {AtomSpec[]} atoms - * @param {{vertices:number,faces:number}} - * VandF - * @param {MeshLambertMaterial} - * mat - * @return {Mesh} - */ - static generateSurfaceMesh(a, l, g) { - var M = new n.Geometry(!0), C = M.updateGeoGroup(0), T = []; - for (let be = 0, Le = a.length; be < Le; be++) { - var D = a[be]; - D && (typeof D.surfaceColor < "u" ? T[be] = D.surfaceColor : D.color && (T[be] = u.CC.color(D.color))); - } - var I = C.vertexArray, B = l.vertices; - for (let be = 0, Le = B.length; be < Le; be++) { - let ae = C.vertices * 3; - I[ae] = B[be].x, I[ae + 1] = B[be].y, I[ae + 2] = B[be].z, C.vertices++; - } - var P = C.colorArray; - if (g.voldata && g.volscheme) { - var z = g.volscheme, k = g.voldata, N = z.range() || [-1, 1]; - for (let be = 0, Le = B.length; be < Le; be++) { - let ae = k.getVal(B[be].x, B[be].y, B[be].z), _e = u.CC.color(z.valueToHex(ae, N)), Ee = be * 3; - P[Ee] = _e.r, P[Ee + 1] = _e.g, P[Ee + 2] = _e.b; - } - } else if (T.length > 0) - for (let be = 0, Le = B.length; be < Le; be++) { - let ae = B[be].atomid, _e = be * 3; - P[_e] = T[ae].r, P[_e + 1] = T[ae].g, P[_e + 2] = T[ae].b; - } - var R = l.faces; - C.faceidx = R.length, M.initTypedArrays(); - var U = C.vertexArray, W = C.normalArray, G, F, V, J; - for (let be = 0, Le = R.length; be < Le; be += 3) { - var X = R[be], oe = R[be + 1], te = R[be + 2], ve = X * 3, se = oe * 3, le = te * 3; - G = new f.Vector3(U[ve], U[ve + 1], U[ve + 2]), F = new f.Vector3(U[se], U[se + 1], U[se + 2]), V = new f.Vector3(U[le], U[le + 1], U[le + 2]), V.subVectors(V, F), G.subVectors(G, F), V.cross(G), J = V, J.normalize(), W[ve] += J.x, W[se] += J.x, W[le] += J.x, W[ve + 1] += J.y, W[se + 1] += J.y, W[le + 1] += J.y, W[ve + 2] += J.z, W[se + 2] += J.z, W[le + 2] += J.z; - } - C.faceArray = new Uint16Array(R); - var Ce = new n.Mesh(M, g); - return Ce; - } - // do same thing as worker in main thread - /** - * - * @param {SurfaceType} - * type - * @param {Array} - * expandedExtent - * @param {AtomSpec[]} - * extendedAtoms - * @param {AtomSpec[]} - * atomsToShow - * @param {AtomSpec[]} atoms - * @param {number} - * vol - * @return {Object} - */ - static generateMeshSyncHelper(a, l, g, M, C, T) { - var D = new y.ProteinSurface(); - return D.initparm(l, a !== 1, T), D.fillvoxels(C, g), D.buildboundary(), (a == y.SurfaceType.SES || a == y.SurfaceType.MS) && (D.fastdistancemap(), D.boundingatom(!1), D.fillvoxelswaals(C, g)), D.marchingcube(a), D.getFacesAndVertices(M); - } - /* - * - * @param {SurfaceStyleSpec} - * style - * @return {MeshLambertMaterial} - */ - static getMatWithStyle(a) { - var l = new n.MeshLambertMaterial(); - l.vertexColors = n.Coloring.VertexColors; - for (var g in a) - g === "color" || g === "map" || a.hasOwnProperty(g) && (l[g] = a[g]); - return a.opacity !== void 0 && (a.opacity === 1 ? l.transparent = !1 : l.transparent = !0), l; - } - /** - * Adds an explicit mesh as a surface object. - * @param {Mesh} - * mesh - * @param {Object} - * style - * @returns {number} surfid - */ - addMesh(a) { - var l = { - geo: a.geometry, - mat: a.material, - done: !0, - finished: !1 - //the rendered finishes surfaces when they are done - }, g = this.nextSurfID(); - return this.surfaces[g] = l, g; - } - //return a shallow copy of list l, e.g., for atoms so we can - //ignore superficial changes (ie surfacecolor, position) that happen - //while we're surface building - static shallowCopy(a) { - var l = []; - let g = a.length; - for (let M = 0; M < g; M++) - l[M] = (0, b.extend)({}, a[M]); - return l; - } - /** - * Add surface representation to atoms - * @param {SurfaceType|string} type - Surface type (VDW, MS, SAS, or SES) - * @param {SurfaceStyleSpec} style - optional style specification for surface material (e.g. for different coloring scheme, etc) - * @param {AtomSelectionSpec} atomsel - Show surface for atoms in this selection - * @param {AtomSelectionSpec} allsel - Use atoms in this selection to calculate surface; may be larger group than 'atomsel' - * @param {AtomSelectionSpec} focus - Optionally begin rendering surface specified atoms - * @param {function} surfacecallback - function to be called after setting the surface - * @return {Promise} promise - Returns a promise that ultimately resovles to the surfid. Returns surfid immediately if surfacecallback is specified. Returned promise has a [surfid, GLViewer, style, atomsel, allsel, focus] fields for immediate access. - */ - addSurface(a, l = {}, g = {}, M, C, T) { - let D = this.nextSurfID(), I = null, B = this, P = y.SurfaceType.VDW; - typeof a == "string" ? s.surfaceTypeMap[a.toUpperCase()] !== void 0 ? P = s.surfaceTypeMap[a] : console.log("Surface type : " + a + " is not recognized") : typeof a == "number" && (P = a); - var z = null, k = null, N = s.shallowCopy(this.getAtomsFromSel(g)); - M ? z = s.shallowCopy(this.getAtomsFromSel(M)) : z = N, (0, b.adjustVolumeStyle)(l); - var R = !1, U; - for (U = 0; U < this.models.length; U++) - if (this.models[U]) { - var W = this.models[U].getSymmetries(); - if (W.length > 1 || W.length == 1 && !W[0].isIdentity()) { - R = !0; - break; - } - } - var G = function(ve, se, le) { - C ? k = s.shallowCopy(B.getAtomsFromSel(C)) : k = le; - var Ce, be = (0, b.getExtent)(le, !0); - if (l.map && l.map.prop) { - var Le = l.map.prop; - let Ae = (0, h.getGradient)(l.map.scheme || l.map.gradient || new h.Gradient.RWB()), Oe = Ae.range(); - Oe || (Oe = (0, b.getPropertyRange)(le, Le)), l.colorscheme = { prop: Le, gradient: Ae }; - } - for (let Ae = 0, Oe = se.length; Ae < Oe; Ae++) - Ce = se[Ae], Ce.surfaceColor = (0, b.getColorFromStyle)(Ce, l); - var ae = s.volume(be), _e = B.carveUpExtent(be, se, le); - if (k && k.length && k.length > 0) { - var Ee = (0, b.getExtent)(k, !0), Be = function(Ae, Oe) { - var We = function(j, ee) { - var ge = j.extent, ye = ge[1][0] - ge[0][0], $e = ge[1][1] - ge[0][1], Re = ge[1][2] - ge[0][2], Y = ye - ee[2][0]; - Y *= Y; - var ue = $e - ee[2][1]; - ue *= ue; - var Se = Re - ee[2][2]; - return Se *= Se, Y + ue + Se; - }, Ue = We(Ae, Ee), Z = We(Oe, Ee); - return Ue - Z; - }; - _e.sort(Be); - } - var Ne = []; - for (let Ae = 0, Oe = se.length; Ae < Oe; Ae++) - Ce = se[Ae], Ne[Ae] = { - x: Ce.x, - y: Ce.y, - z: Ce.z, - serial: Ae, - elem: Ce.elem - }; - var Ge = !!y.syncSurface; - if (Ge) { - var ke = function(Oe) { - return new Promise(function(We) { - for (var Ue = s.generateMeshSyncHelper(P, _e[Oe].extent, _e[Oe].atoms, _e[Oe].toshow, Ne, ae), Z = (0, c.splitMesh)({ vertexArr: Ue.vertices, faceArr: Ue.faces }), j = 0, ee = Z.length; j < ee; j++) { - Ue = { - vertices: Z[j].vertexArr, - faces: Z[j].faceArr - }; - var ge = s.generateSurfaceMesh(se, Ue, I); - (0, b.mergeGeos)(ve.geo, ge); - } - B.render(), We(); - }); - }, pe = []; - for (let Ae = 0; Ae < _e.length; Ae++) - pe.push(ke(Ae)); - return Promise.all(pe).then(function() { - return ve.done = !0, Promise.resolve(D); - }); - } else { - var de = []; - P < 0 && (P = 0); - for (let Ae = 0, Oe = s.numWorkers; Ae < Oe; Ae++) { - var ce = new Worker($3Dmol.SurfaceWorker); - de.push(ce), ce.postMessage({ - type: -1, - atoms: Ne, - volume: ae - }); - } - return new Promise(function(Ae, Oe) { - var We = 0, Ue = function() { - !de || !de.length || de.forEach(function(ge) { - ge && ge.terminate && ge.terminate(); - }); - }, Z = function(ge) { - for (var ye = (0, c.splitMesh)({ - vertexArr: ge.data.vertices, - faceArr: ge.data.faces - }), $e = 0, Re = ye.length; $e < Re; $e++) { - var Y = { - vertices: ye[$e].vertexArr, - faces: ye[$e].faceArr - }, ue = s.generateSurfaceMesh(se, Y, I); - (0, b.mergeGeos)(ve.geo, ue); - } - B.render(), We++, We == _e.length && (ve.done = !0, Ue(), Ae(D)); - }, j = function(ge) { - Ue(), console.log(ge.message + " (" + ge.filename + ":" + ge.lineno + ")"), Oe(ge); - }; - for (let ge = 0; ge < _e.length; ge++) { - var ee = de[ge % de.length]; - ee.onmessage = Z, ee.onerror = j, ee.postMessage({ - type: P, - expandedExtent: _e[ge].extent, - extendedAtoms: _e[ge].atoms, - atomsToShow: _e[ge].toshow - }); - } - }); - } - }; - l = l || {}, I = s.getMatWithStyle(l); - var F = []; - F.style = l, F.atomsel = g, F.allsel = M, F.focus = C; - var V = null; - if (R) { - var J = {}, X = {}; - for (U = 0; U < this.models.length; U++) - J[U] = [], X[U] = []; - for (U = 0; U < z.length; U++) - J[z[U].model].push(z[U]); - for (U = 0; U < N.length; U++) - X[N[U].model].push(N[U]); - var oe = []; - for (U = 0; U < this.models.length; U++) - X[U].length > 0 && (F.push({ - geo: new n.Geometry(!0), - mat: I, - done: !1, - finished: !1, - symmetries: this.models[U].getSymmetries() - // also webgl initialized - }), oe.push(G(F[F.length - 1], J[U], X[U]))); - V = Promise.all(oe); - } else - F.push({ - geo: new n.Geometry(!0), - mat: I, - done: !1, - finished: !1, - symmetries: [new f.Matrix4()] - }), V = G(F[F.length - 1], z, N); - return this.surfaces[D] = F, V.surfid = D, T && typeof T == "function" ? (V.then(function(te) { - T(te); - }), D) : V; - } - /** - * Set the surface material to something else, must render change - * @param {number} surf - Surface ID to apply changes to - * @param {SurfaceStyleSpec} style - new material style specification - @example - $3Dmol.get("data/9002806.cif",function(data){ - viewer.addModel(data); - viewer.setStyle({stick:{}}); - let surf = viewer.addSurface("SAS"); - surf.then(function() { - viewer.setSurfaceMaterialStyle(surf.surfid, {color:'blue',opacity:0.5}); - viewer.render(); - }); - }); - */ - setSurfaceMaterialStyle(a, l) { - if ((0, b.adjustVolumeStyle)(l), this.surfaces[a]) { - var g = this.surfaces[a]; - g.style = l; - for (var M = 0; M < g.length; M++) { - var C = g[M].mat = s.getMatWithStyle(l); - if (g[M].mat.side = n.FrontSide, l.color) { - g[M].mat.color = l.color, g[M].geo.colorsNeedUpdate = !0; - const T = u.CC.color(l.color); - g[M].geo.setColors(function() { - return T; - }); - } else if (C.voldata && C.volscheme) { - const T = C.volscheme, D = C.voldata, I = u.CC, B = T.range() || [-1, 1]; - g[M].geo.setColors(function(P, z, k) { - let N = D.getVal(P, z, k); - return I.color(T.valueToHex(N, B)); - }); - } - g[M].finished = !1; - } - } - return this; - } - /** - * Return surface object - * @param {number} surf - surface id - */ - getSurface(a) { - return this.surfaces[a]; - } - /** - * Remove surface with given ID - * @param {number} surf - surface id - */ - removeSurface(a) { - for (var l = this.surfaces[a], g = 0; g < l.length; g++) - l[g] && l[g].lastGL && (l[g].geo !== void 0 && l[g].geo.dispose(), l[g].mat !== void 0 && l[g].mat.dispose(), this.modelGroup.remove(l[g].lastGL)); - return delete this.surfaces[a], this.show(), this; - } - /** Remove all surfaces. - **/ - removeAllSurfaces() { - for (var a in this.surfaces) - if (this.surfaces.hasOwnProperty(a)) { - for (var l = this.surfaces[a], g = 0; g < l.length; g++) - l[g] && l[g].lastGL && (l[g].geo !== void 0 && l[g].geo.dispose(), l[g].mat !== void 0 && l[g].mat.dispose(), this.modelGroup.remove(l[g].lastGL)); - delete this.surfaces[a]; - } - return this.show(), this; - } - /** return Jmol moveto command to position this scene */ - jmolMoveTo() { - var a = this.modelGroup.position, l = "center { " + -a.x + " " + -a.y + " " + -a.z + " }; ", g = this.rotationGroup.quaternion; - return l += "moveto .5 quaternion { " + g.x + " " + g.y + " " + g.z + " " + g.w + " };", l; - } - /** Clear scene of all objects - * */ - clear() { - return this.removeAllSurfaces(), this.removeAllModels(), this.removeAllLabels(), this.removeAllShapes(), this.show(), this; - } - // props is a list of objects that select certain atoms and enumerate - // properties for those atoms - /** - * Add specified properties to all atoms matching input argument - * @param {Object} props, either array of atom selectors with associated props, or function that takes atom and sets its properties - * @param {AtomSelectionSpec} sel - subset of atoms to work on - model selection must be specified here - @example - $3Dmol.get('../test_structs/b.sdf', function(data){ - viewer.addModel(data,'sdf'); - let props = []; - //make the atom index a property x - for(let i = 0; i < 8; i++) { - props.push({index:i,props:{'x':i}}); - } - viewer.mapAtomProperties(props); - viewer.setStyle({sphere:{colorscheme:{gradient:'roygb',prop:'x',min:0,max:8}}}); - viewer.zoomTo(); - viewer.render(); - }); - */ - mapAtomProperties(a, l) { - l = l || {}; - var g = this.getAtomsFromSel(l); - if (typeof a == "function") - for (let T = 0, D = g.length; T < D; T++) { - let I = g[T]; - a(I); - } - else - for (let T = 0, D = g.length; T < D; T++) { - var M = g[T]; - for (let I = 0, B = a.length; I < B; I++) { - let P = a[I]; - if (P.props) - for (var C in P.props) - P.props.hasOwnProperty(C) && this.atomIsSelected(M, P) && (M.properties || (M.properties = {}), M.properties[C] = P.props[C]); - } - } - return this; - } - /** - * Synchronize this view matrix of this viewer to the passed viewer. - * When the viewpoint of this viewer changes, the other viewer will - * be set to this viewer's view. - * @param {$3Dmol.GLViewer} otherview - */ - linkViewer(a) { - return this.linkedViewers.push(a), this; - } - /** - * Return the z distance between the model and the camera - * @return {number} distance - */ - getPerceivedDistance() { - return this.CAMERA_Z - this.rotationGroup.position.z; - } - /** - * Set the distance between the model and the camera - * Essentially zooming. Useful while stereo rendering. - */ - setPerceivedDistance(a) { - this.rotationGroup.position.z = this.CAMERA_Z - a; - } - /** - * Used for setting an approx value of eyeSeparation. Created for calling by StereoViewer object - * @return {number} camera x position - */ - setAutoEyeSeparation(a, l) { - var g = this.getPerceivedDistance(); - return l || (l = 5), a || this.camera.position.x > 0 ? this.camera.position.x = g * Math.tan(Math.PI / 180 * l) : this.camera.position.x = -g * Math.tan(Math.PI / 180 * l), this.camera.lookAt(new f.Vector3(0, 0, this.rotationGroup.position.z)), this.camera.position.x; - } - /** - * Set the default cartoon quality for newly created models. Default is 5. - * Current models are not affected. - * @number quality, higher results in higher resolution renders - */ - setDefaultCartoonQuality(a) { - this.config.cartoonQuality = a; - } - } - s.numWorkers = 4, s.maxVolume = 64e3, s.surfaceTypeMap = { - VDW: y.SurfaceType.VDW, - MS: y.SurfaceType.MS, - SAS: y.SurfaceType.SAS, - SES: y.SurfaceType.SES - }; - function o(v, a) { - if (v = (0, b.getElement)(v), !!v) { - a = a || {}; - try { - var l = new s(v, a); - return l; - } catch (g) { - throw "error creating viewer: " + g; - } - } - } - function A(v, a = {}, l = {}) { - if (v = (0, b.getElement)(v), !!v) { - var g = [], M = document.createElement("canvas"); - l.rows = a.rows, l.cols = a.cols, l.control_all = a.control_all != null ? a.control_all : !1, v.appendChild(M); - try { - for (var C = 0; C < a.rows; C++) { - for (var T = [], D = 0; D < a.cols; D++) { - l.row = C, l.col = D, l.canvas = M, l.viewers = g, l.control_all = a.control_all; - var I = o(v, (0, b.extend)({}, l)); - T.push(I); - } - g.unshift(T); - } - } catch (B) { - throw "error creating viewer grid: " + B; - } - return g; - } - } - function p(v) { - var a = this; - if (v = (0, b.getElement)(v), !!v) { - var l = A(v, { rows: 1, cols: 2, control_all: !0 }); - this.glviewer1 = l[0][0], this.glviewer2 = l[0][1], this.glviewer1.setAutoEyeSeparation(!1), this.glviewer2.setAutoEyeSeparation(!0), this.glviewer1.linkViewer(this.glviewer2), this.glviewer2.linkViewer(this.glviewer1); - for (var g = Object.getOwnPropertyNames(this.glviewer1.__proto__).filter(function(C) { - return typeof a.glviewer1[C] == "function"; - }), M = 0; M < g.length; M++) - this[g[M]] = /* @__PURE__ */ function(C) { - return function() { - var T = this.glviewer1[C].apply(this.glviewer1, arguments), D = this.glviewer2[C].apply(this.glviewer2, arguments); - return [T, D]; - }; - }(g[M]); - this.setCoordinates = function(C, T, D) { - for (var I = 0; I < C.length; I++) - C[I].setCoordinates(T, D); - }, this.surfacesFinished = function() { - return this.glviewer1.surfacesFinished() && this.glviewer2.surfacesFinished(); - }, this.isAnimated = function() { - return this.glviewer1.isAnimated() || this.glviewer2.isAnimated(); - }, this.render = function(C) { - this.glviewer1.render(), this.glviewer2.render(), C && C(this); - }, this.getCanvas = function() { - return this.glviewer1.getCanvas(); - }; - } - } - } - ), - /***/ - "./src/Gradient.ts": ( - /*!*************************!*\ - !*** ./src/Gradient.ts ***! - \*************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CustomLinear: () => ( - /* binding */ - c - ), - /* harmony export */ - Gradient: () => ( - /* binding */ - y - ), - /* harmony export */ - GradientType: () => ( - /* binding */ - f - ), - /* harmony export */ - ROYGB: () => ( - /* binding */ - _ - ), - /* harmony export */ - RWB: () => ( - /* binding */ - h - ), - /* harmony export */ - Sinebow: () => ( - /* binding */ - E - ), - /* harmony export */ - builtinGradients: () => ( - /* binding */ - S - ), - /* harmony export */ - getGradient: () => ( - /* binding */ - b - ), - /* harmony export */ - normalizeValue: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./colors */ - "./src/colors.ts" - ); - class f { - } - function u(w, L, s) { - return L >= w ? (s < w && (s = w), s > L && (s = L), { lo: w, hi: L, val: s }) : (s > w && (s = w), s < L && (s = L), s = w - s + L, { lo: L, hi: w, val: s }); - } - function b(w) { - if (w instanceof f) - return w; - if (w.gradient !== void 0 && S[w.gradient]) { - let L = w.min === void 0 ? -1 : w.min, s = w.max === void 0 ? 1 : w.max; - return w.mid === void 0 ? w.colors === void 0 ? new S[w.gradient](L, s) : new S[w.gradient](L, s, w.colors) : new S[w.gradient](L, s, w.mid); - } - return w; - } - class h extends f { - constructor(L, s, o) { - super(), this.gradient = "RWB", this.mult = 1, this.mid = o, this.min = L, this.max = s, typeof s > "u" && Array.isArray(L) && L.length >= 2 ? (this.max = L[1], this.min = L[0]) : L && s && !Array.isArray(L) && (this.min = L, this.max = s); - } - //return range used for color mapping, null if none set - range() { - return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null; - } - //map value to hex color, range is provided - valueToHex(L, s) { - var o, A; - if (L = this.mult * L, s ? (o = s[0], A = s[1]) : (o = this.min, A = this.max), L === void 0) - return 16777215; - var p = u(o, A, L); - o = p.lo, A = p.hi, L = p.val; - var v = (A + o) / 2; - s && typeof s[2] < "u" ? v = s[2] : typeof this.mid < "u" ? v = this.mid : v = (o + A) / 2; - var a, l; - return L < v ? (a = Math.floor(255 * Math.sqrt((L - o) / (v - o))), l = 16711680 + 256 * a + a, l) : L > v ? (a = Math.floor(255 * Math.sqrt(1 - (L - v) / (A - v))), l = 65536 * a + 256 * a + 255, l) : 16777215; - } - } - class _ extends f { - constructor(L, s) { - super(), this.gradient = "ROYGB", this.mult = 1, this.min = L, this.max = s, typeof s > "u" && Array.isArray(L) && L.length >= 2 ? (this.max = L[1], this.min = L[0]) : L && s && !Array.isArray(L) && (this.min = L, this.max = s); - } - //map value to hex color, range is provided - valueToHex(L, s) { - var o, A; - if (L = this.mult * L, s ? (o = s[0], A = s[1]) : (o = this.min, A = this.max), typeof L > "u") - return 16777215; - var p = u(o, A, L); - o = p.lo, A = p.hi, L = p.val; - var v = (o + A) / 2, a = (o + v) / 2, l = (v + A) / 2, g, M; - return L < a ? (g = Math.floor(255 * Math.sqrt((L - o) / (a - o))), M = 16711680 + 256 * g + 0, M) : L < v ? (g = Math.floor(255 * Math.sqrt(1 - (L - a) / (v - a))), M = 65536 * g + 65280 + 0, M) : L < l ? (g = Math.floor(255 * Math.sqrt((L - v) / (l - v))), M = 65280 + 1 * g, M) : (g = Math.floor(255 * Math.sqrt(1 - (L - l) / (A - l))), M = 0 + 256 * g + 255, M); - } - //return range used for color mapping, null if none set - range() { - return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null; - } - } - class E extends f { - constructor(L, s) { - super(), this.gradient = "Sinebow", this.mult = 1, this.min = L, this.max = s, typeof s > "u" && Array.isArray(L) && L.length >= 2 && (this.max = L[1], this.min = L[0]), s < L && (this.mult = -1, this.min *= -1, this.max *= -1); - } - //map value to hex color, range is provided - valueToHex(L, s) { - var o, A; - if (L = this.mult * L, s ? (o = s[0], A = s[1]) : (o = this.min, A = this.max), typeof L > "u") - return 16777215; - var p = y.normalizeValue(o, A, L); - o = p.lo, A = p.hi, L = p.val; - var v = (L - o) / (A - o), a = 5 * v / 6 + 0.5, l = Math.sin(Math.PI * a); - l *= l * 255; - var g = Math.sin(Math.PI * (a + 1 / 3)); - g *= g * 255; - var M = Math.sin(Math.PI * (a + 2 / 3)); - return M *= M * 255, 65536 * Math.floor(l) + 256 * Math.floor(M) + 1 * Math.floor(g); - } - //return range used for color mapping, null if none set - range() { - return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null; - } - } - class c extends f { - constructor(L, s, o) { - super(), this.gradient = "linear", this.colors = new Array(); - var A; - if (Array.isArray(L) && L.length >= 2 ? (this.max = L[1], this.min = L[0], A = s) : (this.min = L, this.max = s, A = o), A) - for (let p of A) - this.colors.push(n.CC.color(p)); - else - this.colors.push(n.CC.color(0)); - } - //return range used for color mapping, null if none set - range() { - return typeof this.min < "u" && typeof this.max < "u" ? [this.min, this.max] : null; - } - //map value to hex color, range is provided - valueToHex(L, s) { - var o, A; - if (s ? (o = s[0], A = s[1]) : (o = this.min, A = this.max), L === void 0) - return 16777215; - var p = u(o, A, L); - o = p.lo, A = p.hi, L = p.val; - let v = this.colors.length, a = (A - o) / v, l = Math.min(Math.floor((L - o) / a), v - 1), g = Math.min(l + 1, v - 1), M = (L - o - l * a) / a, C = this.colors[l], T = this.colors[g]; - return new n.Color(C.r + M * (T.r - C.r), C.g + M * (T.g - C.g), C.b + M * (T.b - C.b)).getHex(); - } - } - const S = { - rwb: h, - RWB: h, - roygb: _, - ROYGB: _, - sinebow: E, - linear: c - }; - class y extends f { - valueToHex(L, s) { - return 0; - } - range() { - return null; - } - } - y.RWB = h, y.ROYGB = _, y.Sinebow = E, y.CustomLinear = c, y.builtinGradients = S, y.normalizeValue = u, y.getGradient = b; - } - ), - /***/ - "./src/Label.ts": ( - /*!**********************!*\ - !*** ./src/Label.ts ***! - \**********************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Label: () => ( - /* binding */ - E - ), - /* harmony export */ - LabelCount: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./Gradient */ - "./src/Gradient.ts" - ), u = r( - /*! ./colors */ - "./src/colors.ts" - ); - let b = 0; - function h(c, S, y, w, L, s, o) { - c.beginPath(), c.moveTo(S + s, y), c.lineTo(S + w - s, y), c.quadraticCurveTo(S + w, y, S + w, y + s), c.lineTo(S + w, y + L - s), c.quadraticCurveTo(S + w, y + L, S + w - s, y + L), c.lineTo(S + s, y + L), c.quadraticCurveTo(S, y + L, S, y + L - s), c.lineTo(S, y + s), c.quadraticCurveTo(S, y, S + s, y), c.closePath(), c.fill(), o && c.stroke(); - } - function _(c, S, y) { - var w = y; - return typeof c < "u" && (c instanceof u.Color ? w = c.scaled() : (w = u.CC.color(c), typeof w.scaled < "u" && (w = w.scaled()))), typeof S < "u" && (w.a = parseFloat(S)), w; - } - class E { - constructor(S, y) { - this.id = b++, this.stylespec = y || {}, this.canvas = document.createElement("canvas"), this.canvas.width = 134, this.canvas.height = 35, this.context = this.canvas.getContext("2d"), this.sprite = new n.Sprite(), this.text = S, this.frame = this.stylespec.frame; - } - getStyle() { - return this.stylespec; - } - setContext() { - var S = this.stylespec, y = typeof S.useScreen > "u" ? !1 : S.useScreen, w = S.showBackground; - (w === "0" || w === "false") && (w = !1), typeof w > "u" && (w = !0); - var L = S.font ? S.font : "sans-serif", s = parseInt(S.fontSize) ? parseInt(S.fontSize) : 18, o = _(S.fontColor, S.fontOpacity, { - r: 255, - g: 255, - b: 255, - a: 1 - }), A = S.padding ? S.padding : 4, p = S.borderThickness ? S.borderThickness : 0, v = _(S.backgroundColor, S.backgroundOpacity, { - r: 0, - g: 0, - b: 0, - a: 1 - }), a = _(S.borderColor, S.borderOpacity, v), l = S.position ? S.position : { - x: -10, - y: 1, - z: 1 - }, g = S.inFront !== void 0 ? S.inFront : !0; - (g === "false" || g === "0") && (g = !1); - var M = S.alignment || n.SpriteAlignment.topLeft; - typeof M == "string" && M in n.SpriteAlignment && (M = n.SpriteAlignment[M]); - var C = ""; - S.bold && (C = "bold "), this.context.font = C + s + "px " + L; - var T = this.context.measureText(this.text), D = T.width; - w || (p = 0); - var I = D + 2.5 * p + 2 * A, B = s * 1.25 + 2 * p + 2 * A; - if (S.backgroundImage) { - var P = S.backgroundImage, z = S.backgroundWidth ? S.backgroundWidth : P.width, k = S.backgroundHeight ? S.backgroundHeight : P.height; - z > I && (I = z), k > B && (B = k); - } - if (this.canvas.width = I, this.canvas.height = B, this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), C = "", S.bold && (C = "bold "), this.context.font = C + s + "px " + L, this.context.fillStyle = "rgba(" + v.r + "," + v.g + "," + v.b + "," + v.a + ")", this.context.strokeStyle = "rgba(" + a.r + "," + a.g + "," + a.b + "," + a.a + ")", S.backgroundGradient) { - let R = this.context.createLinearGradient(0, B / 2, I, B / 2), U = f.Gradient.getGradient(S.backgroundGradient), W = U.range(), G = -1, F = 1; - W && (G = W[0], F = W[1]); - let V = F - G; - for (let J = 0; J < 1.01; J += 0.1) { - let X = _(U.valueToHex(G + V * J)), oe = "rgba(" + X.r + "," + X.g + "," + X.b + "," + X.a + ")"; - R.addColorStop(J, oe); - } - this.context.fillStyle = R; - } - this.context.lineWidth = p, w && h(this.context, p, p, I - 2 * p, B - 2 * p, 6, p > 0), S.backgroundImage && this.context.drawImage(P, 0, 0, I, B), this.context.fillStyle = "rgba(" + o.r + "," + o.g + "," + o.b + "," + o.a + ")", this.context.fillText(this.text, p + A, s + p + A, D); - var N = new n.Texture(this.canvas); - N.needsUpdate = !0, this.sprite.material = new n.SpriteMaterial({ - map: N, - useScreenCoordinates: y, - alignment: M, - depthTest: !g, - screenOffset: S.screenOffset || null - }), this.sprite.scale.set(1, 1, 1), this.sprite.position.set(l.x, l.y, l.z); - } - // clean up material and texture - dispose() { - this.sprite.material.map !== void 0 && this.sprite.material.map.dispose(), this.sprite.material !== void 0 && this.sprite.material.dispose(); - } - } - } - ), - /***/ - "./src/ProteinSurface4.ts": ( - /*!********************************!*\ - !*** ./src/ProteinSurface4.ts ***! - \********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MarchingCube: () => ( - /* binding */ - _ - ), - /* harmony export */ - MarchingCubeInitializer: () => ( - /* binding */ - h - ), - /* harmony export */ - PointGrid: () => ( - /* binding */ - E - ), - /* harmony export */ - ProteinSurface: () => ( - /* binding */ - c - ), - /* harmony export */ - SurfaceType: () => ( - /* binding */ - f - ), - /* harmony export */ - setSyncSurface: () => ( - /* binding */ - b - ), - /* harmony export */ - syncSurface: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), f; - (function(S) { - S[S.VDW = 1] = "VDW", S[S.MS = 2] = "MS", S[S.SAS = 3] = "SAS", S[S.SES = 4] = "SES"; - })(f || (f = {})); - var u = !1; - function b(S) { - u = S; - } - (window.navigator.userAgent.indexOf("MSIE ") >= 0 || window.navigator.userAgent.indexOf("Trident/") >= 0) && (u = !0); - class h { - constructor() { - this.ISDONE = 2, this.edgeTable = new Uint32Array([ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2816, - 0, - 0, - 0, - 1792, - 0, - 3328, - 3584, - 3840, - 0, - 0, - 0, - 138, - 0, - 21, - 0, - 134, - 0, - 0, - 0, - 652, - 0, - 2067, - 3865, - 3600, - 0, - 0, - 0, - 42, - 0, - 0, - 0, - 294, - 0, - 0, - 21, - 28, - 0, - 3875, - 1049, - 3360, - 0, - 168, - 162, - 170, - 0, - 645, - 2475, - 2210, - 0, - 687, - 293, - 172, - 4010, - 3747, - 3497, - 3232, - 0, - 0, - 0, - 0, - 0, - 69, - 0, - 900, - 0, - 0, - 0, - 1792, - 138, - 131, - 1608, - 1920, - 0, - 81, - 0, - 2074, - 84, - 85, - 84, - 86, - 0, - 81, - 0, - 3676, - 330, - 1105, - 1881, - 1616, - 0, - 0, - 0, - 42, - 0, - 69, - 0, - 502, - 0, - 0, - 21, - 3580, - 138, - 2035, - 1273, - 1520, - 2816, - 104, - 2337, - 106, - 840, - 581, - 367, - 102, - 2816, - 3695, - 3429, - 3180, - 1898, - 1635, - 1385, - 1120, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3910, - 0, - 0, - 69, - 588, - 42, - 2083, - 41, - 2880, - 0, - 0, - 0, - 1722, - 0, - 2293, - 4095, - 3830, - 0, - 255, - 757, - 764, - 2538, - 2291, - 3065, - 2800, - 0, - 0, - 81, - 338, - 0, - 3925, - 1119, - 3414, - 84, - 855, - 85, - 340, - 2130, - 2899, - 89, - 2384, - 1792, - 712, - 194, - 1162, - 4036, - 3781, - 3535, - 3270, - 708, - 719, - 197, - 204, - 3018, - 2755, - 2505, - 2240, - 0, - 0, - 0, - 0, - 168, - 420, - 168, - 1958, - 162, - 162, - 676, - 2988, - 170, - 163, - 680, - 928, - 3328, - 3096, - 3328, - 3642, - 52, - 53, - 1855, - 1590, - 2340, - 2111, - 2869, - 2620, - 298, - 51, - 825, - 560, - 3584, - 3584, - 3090, - 3482, - 1668, - 1941, - 1183, - 1430, - 146, - 2975, - 2069, - 2460, - 154, - 915, - 153, - 400, - 3840, - 3592, - 3329, - 3082, - 1796, - 1541, - 1295, - 1030, - 2818, - 2575, - 2309, - 2060, - 778, - 515, - 265, - 0 - ]), this.triTable = [ - [], - [], - [], - [], - [], - [], - [], - [11, 9, 8], - [], - [], - [], - [8, 10, 9], - [], - [10, 8, 11], - [9, 11, 10], - [8, 10, 9, 8, 11, 10], - [], - [], - [], - [1, 7, 3], - [], - [4, 2, 0], - [], - [2, 1, 7], - [], - [], - [], - [2, 7, 3, 2, 9, 7], - [], - [1, 4, 11, 1, 0, 4], - [3, 8, 0, 11, 9, 4, 11, 10, 9], - [4, 11, 9, 11, 10, 9], - [], - [], - [], - [5, 3, 1], - [], - [], - [], - [2, 5, 8, 2, 1, 5], - [], - [], - [2, 4, 0], - [3, 2, 4], - [], - [0, 9, 1, 8, 10, 5, 8, 11, 10], - [3, 4, 0, 3, 10, 4], - [5, 8, 10, 8, 11, 10], - [], - [3, 5, 7], - [7, 1, 5], - [1, 7, 3, 1, 5, 7], - [], - [9, 2, 0, 9, 7, 2], - [0, 3, 8, 1, 7, 11, 1, 5, 7], - [11, 1, 7, 1, 5, 7], - [], - [9, 1, 0, 5, 3, 2, 5, 7, 3], - [8, 2, 5, 8, 0, 2], - [2, 5, 3, 5, 7, 3], - [3, 9, 1, 3, 8, 9, 7, 11, 10, 7, 10, 5], - [9, 1, 0, 10, 7, 11, 10, 5, 7], - [3, 8, 0, 7, 10, 5, 7, 11, 10], - [11, 5, 7, 11, 10, 5], - [], - [], - [], - [], - [], - [0, 6, 2], - [], - [7, 2, 9, 7, 9, 8], - [], - [], - [], - [8, 10, 9], - [7, 1, 3], - [7, 1, 0], - [6, 9, 3, 6, 10, 9], - [7, 10, 8, 10, 9, 8], - [], - [6, 0, 4], - [], - [11, 1, 4, 11, 3, 1], - [2, 4, 6], - [2, 0, 4, 2, 4, 6], - [2, 4, 6], - [1, 4, 2, 4, 6, 2], - [], - [6, 0, 4], - [], - [2, 11, 3, 6, 9, 4, 6, 10, 9], - [8, 6, 1, 8, 1, 3], - [10, 0, 6, 0, 4, 6], - [8, 0, 3, 9, 6, 10, 9, 4, 6], - [10, 4, 6, 10, 9, 4], - [], - [], - [], - [5, 3, 1], - [], - [0, 6, 2], - [], - [7, 4, 8, 5, 2, 1, 5, 6, 2], - [], - [], - [2, 4, 0], - [7, 4, 8, 2, 11, 3, 10, 5, 6], - [7, 1, 3], - [5, 6, 10, 0, 9, 1, 8, 7, 4], - [5, 6, 10, 7, 0, 3, 7, 4, 0], - [10, 5, 6, 4, 8, 7], - [9, 11, 8], - [3, 5, 6], - [0, 5, 11, 0, 11, 8], - [6, 3, 5, 3, 1, 5], - [3, 9, 6, 3, 8, 9], - [9, 6, 0, 6, 2, 0], - [0, 3, 8, 2, 5, 6, 2, 1, 5], - [1, 6, 2, 1, 5, 6], - [9, 11, 8], - [1, 0, 9, 6, 10, 5, 11, 3, 2], - [6, 10, 5, 2, 8, 0, 2, 11, 8], - [3, 2, 11, 10, 5, 6], - [10, 5, 6, 9, 3, 8, 9, 1, 3], - [0, 9, 1, 5, 6, 10], - [8, 0, 3, 10, 5, 6], - [10, 5, 6], - [], - [], - [], - [], - [], - [], - [], - [1, 10, 2, 9, 11, 6, 9, 8, 11], - [], - [], - [6, 0, 2], - [3, 6, 9, 3, 2, 6], - [3, 5, 1], - [0, 5, 1, 0, 11, 5], - [0, 3, 5], - [6, 9, 11, 9, 8, 11], - [], - [], - [], - [4, 5, 9, 7, 1, 10, 7, 3, 1], - [], - [11, 6, 7, 2, 4, 5, 2, 0, 4], - [11, 6, 7, 8, 0, 3, 1, 10, 2, 9, 4, 5], - [6, 7, 11, 1, 10, 2, 9, 4, 5], - [], - [4, 1, 0, 4, 5, 1, 6, 7, 3, 6, 3, 2], - [9, 4, 5, 0, 6, 7, 0, 2, 6], - [4, 5, 9, 6, 3, 2, 6, 7, 3], - [6, 7, 11, 5, 3, 8, 5, 1, 3], - [6, 7, 11, 4, 1, 0, 4, 5, 1], - [4, 5, 9, 3, 8, 0, 11, 6, 7], - [9, 4, 5, 7, 11, 6], - [], - [], - [0, 6, 4], - [8, 6, 4, 8, 1, 6], - [], - [0, 10, 2, 0, 9, 10, 4, 8, 11, 4, 11, 6], - [10, 2, 1, 6, 0, 3, 6, 4, 0], - [10, 2, 1, 11, 4, 8, 11, 6, 4], - [4, 2, 6], - [1, 0, 9, 2, 4, 8, 2, 6, 4], - [2, 4, 0, 2, 6, 4], - [8, 2, 4, 2, 6, 4], - [11, 4, 1, 11, 6, 4], - [0, 9, 1, 4, 11, 6, 4, 8, 11], - [3, 6, 0, 6, 4, 0], - [8, 6, 4, 8, 11, 6], - [10, 8, 9], - [6, 3, 9, 6, 7, 3], - [6, 7, 1], - [10, 7, 1, 7, 3, 1], - [7, 11, 6, 8, 10, 2, 8, 9, 10], - [11, 6, 7, 10, 0, 9, 10, 2, 0], - [2, 1, 10, 7, 11, 6, 8, 0, 3], - [1, 10, 2, 6, 7, 11], - [7, 2, 6, 7, 9, 2], - [1, 0, 9, 3, 6, 7, 3, 2, 6], - [7, 0, 6, 0, 2, 6], - [2, 7, 3, 2, 6, 7], - [7, 11, 6, 3, 9, 1, 3, 8, 9], - [9, 1, 0, 11, 6, 7], - [0, 3, 8, 11, 6, 7], - [11, 6, 7], - [], - [], - [], - [], - [5, 3, 7], - [8, 5, 2, 8, 7, 5], - [5, 3, 7], - [1, 10, 2, 5, 8, 7, 5, 9, 8], - [1, 7, 5], - [1, 7, 5], - [9, 2, 7, 9, 7, 5], - [11, 3, 2, 8, 5, 9, 8, 7, 5], - [1, 3, 7, 1, 7, 5], - [0, 7, 1, 7, 5, 1], - [9, 3, 5, 3, 7, 5], - [9, 7, 5, 9, 8, 7], - [8, 10, 11], - [3, 4, 10, 3, 10, 11], - [8, 10, 11], - [5, 9, 4, 1, 11, 3, 1, 10, 11], - [2, 4, 5], - [5, 2, 4, 2, 0, 4], - [0, 3, 8, 5, 9, 4, 10, 2, 1], - [2, 1, 10, 9, 4, 5], - [2, 8, 5, 2, 11, 8], - [3, 2, 11, 1, 4, 5, 1, 0, 4], - [9, 4, 5, 8, 2, 11, 8, 0, 2], - [11, 3, 2, 9, 4, 5], - [8, 5, 3, 5, 1, 3], - [5, 0, 4, 5, 1, 0], - [3, 8, 0, 4, 5, 9], - [9, 4, 5], - [11, 9, 10], - [11, 9, 10], - [1, 11, 4, 1, 10, 11], - [8, 7, 4, 11, 1, 10, 11, 3, 1], - [2, 7, 9, 2, 9, 10], - [4, 8, 7, 0, 10, 2, 0, 9, 10], - [2, 1, 10, 0, 7, 4, 0, 3, 7], - [10, 2, 1, 8, 7, 4], - [1, 7, 4], - [3, 2, 11, 4, 8, 7, 9, 1, 0], - [11, 4, 2, 4, 0, 2], - [2, 11, 3, 7, 4, 8], - [4, 1, 7, 1, 3, 7], - [1, 0, 9, 8, 7, 4], - [3, 4, 0, 3, 7, 4], - [8, 7, 4], - [8, 9, 10, 8, 10, 11], - [3, 9, 11, 9, 10, 11], - [0, 10, 8, 10, 11, 8], - [10, 3, 1, 10, 11, 3], - [2, 8, 10, 8, 9, 10], - [9, 2, 0, 9, 10, 2], - [8, 0, 3, 1, 10, 2], - [10, 2, 1], - [1, 11, 9, 11, 8, 9], - [11, 3, 2, 0, 9, 1], - [11, 0, 2, 11, 8, 0], - [11, 3, 2], - [8, 1, 3, 8, 9, 1], - [9, 1, 0], - [8, 0, 3], - [] - ], this.edgeTable2 = [ - 0, - 265, - 515, - 778, - 2060, - 2309, - 2575, - 2822, - 1030, - 1295, - 1541, - 1804, - 3082, - 3331, - 3593, - 3840, - 400, - 153, - 915, - 666, - 2460, - 2197, - 2975, - 2710, - 1430, - 1183, - 1941, - 1692, - 3482, - 3219, - 3993, - 3728, - 560, - 825, - 51, - 314, - 2620, - 2869, - 2111, - 2358, - 1590, - 1855, - 1077, - 1340, - 3642, - 3891, - 3129, - 3376, - 928, - 681, - 419, - 170, - 2988, - 2725, - 2479, - 2214, - 1958, - 1711, - 1445, - 1196, - 4010, - 3747, - 3497, - 3232, - 2240, - 2505, - 2755, - 3018, - 204, - 453, - 719, - 966, - 3270, - 3535, - 3781, - 4044, - 1226, - 1475, - 1737, - 1984, - 2384, - 2137, - 2899, - 2650, - 348, - 85, - 863, - 598, - 3414, - 3167, - 3925, - 3676, - 1370, - 1107, - 1881, - 1616, - 2800, - 3065, - 2291, - 2554, - 764, - 1013, - 255, - 502, - 3830, - 4095, - 3317, - 3580, - 1786, - 2035, - 1273, - 1520, - 2912, - 2665, - 2403, - 2154, - 876, - 613, - 367, - 102, - 3942, - 3695, - 3429, - 3180, - 1898, - 1635, - 1385, - 1120, - 1120, - 1385, - 1635, - 1898, - 3180, - 3429, - 3695, - 3942, - 102, - 367, - 613, - 876, - 2154, - 2403, - 2665, - 2912, - 1520, - 1273, - 2035, - 1786, - 3580, - 3317, - 4095, - 3830, - 502, - 255, - 1013, - 764, - 2554, - 2291, - 3065, - 2800, - 1616, - 1881, - 1107, - 1370, - 3676, - 3925, - 3167, - 3414, - 598, - 863, - 85, - 348, - 2650, - 2899, - 2137, - 2384, - 1984, - 1737, - 1475, - 1226, - 4044, - 3781, - 3535, - 3270, - 966, - 719, - 453, - 204, - 3018, - 2755, - 2505, - 2240, - 3232, - 3497, - 3747, - 4010, - 1196, - 1445, - 1711, - 1958, - 2214, - 2479, - 2725, - 2988, - 170, - 419, - 681, - 928, - 3376, - 3129, - 3891, - 3642, - 1340, - 1077, - 1855, - 1590, - 2358, - 2111, - 2869, - 2620, - 314, - 51, - 825, - 560, - 3728, - 3993, - 3219, - 3482, - 1692, - 1941, - 1183, - 1430, - 2710, - 2975, - 2197, - 2460, - 666, - 915, - 153, - 400, - 3840, - 3593, - 3331, - 3082, - 1804, - 1541, - 1295, - 1030, - 2822, - 2575, - 2309, - 2060, - 778, - 515, - 265, - 0 - ], this.triTable2 = [ - [], - [8, 3, 0], - [9, 0, 1], - [8, 3, 1, 8, 1, 9], - [11, 2, 3], - [11, 2, 0, 11, 0, 8], - [11, 2, 3, 0, 1, 9], - [2, 1, 11, 1, 9, 11, 11, 9, 8], - [10, 1, 2], - [8, 3, 0, 1, 2, 10], - [9, 0, 2, 9, 2, 10], - [3, 2, 8, 2, 10, 8, 8, 10, 9], - [10, 1, 3, 10, 3, 11], - [1, 0, 10, 0, 8, 10, 10, 8, 11], - [0, 3, 9, 3, 11, 9, 9, 11, 10], - [8, 10, 9, 8, 11, 10], - [8, 4, 7], - [3, 0, 4, 3, 4, 7], - [1, 9, 0, 8, 4, 7], - [9, 4, 1, 4, 7, 1, 1, 7, 3], - [2, 3, 11, 7, 8, 4], - [7, 11, 4, 11, 2, 4, 4, 2, 0], - [3, 11, 2, 4, 7, 8, 9, 0, 1], - [2, 7, 11, 2, 1, 7, 1, 4, 7, 1, 9, 4], - [10, 1, 2, 8, 4, 7], - [2, 10, 1, 0, 4, 7, 0, 7, 3], - [4, 7, 8, 0, 2, 10, 0, 10, 9], - [2, 7, 3, 2, 9, 7, 7, 9, 4, 2, 10, 9], - [8, 4, 7, 11, 10, 1, 11, 1, 3], - [11, 4, 7, 1, 4, 11, 1, 11, 10, 1, 0, 4], - [3, 8, 0, 7, 11, 4, 11, 9, 4, 11, 10, 9], - [7, 11, 4, 4, 11, 9, 11, 10, 9], - [9, 5, 4], - [3, 0, 8, 4, 9, 5], - [5, 4, 0, 5, 0, 1], - [4, 8, 5, 8, 3, 5, 5, 3, 1], - [11, 2, 3, 9, 5, 4], - [9, 5, 4, 8, 11, 2, 8, 2, 0], - [3, 11, 2, 1, 5, 4, 1, 4, 0], - [8, 5, 4, 2, 5, 8, 2, 8, 11, 2, 1, 5], - [2, 10, 1, 9, 5, 4], - [0, 8, 3, 5, 4, 9, 10, 1, 2], - [10, 5, 2, 5, 4, 2, 2, 4, 0], - [3, 4, 8, 3, 2, 4, 2, 5, 4, 2, 10, 5], - [5, 4, 9, 1, 3, 11, 1, 11, 10], - [0, 9, 1, 4, 8, 5, 8, 10, 5, 8, 11, 10], - [3, 4, 0, 3, 10, 4, 4, 10, 5, 3, 11, 10], - [4, 8, 5, 5, 8, 10, 8, 11, 10], - [9, 5, 7, 9, 7, 8], - [0, 9, 3, 9, 5, 3, 3, 5, 7], - [8, 0, 7, 0, 1, 7, 7, 1, 5], - [1, 7, 3, 1, 5, 7], - [11, 2, 3, 8, 9, 5, 8, 5, 7], - [9, 2, 0, 9, 7, 2, 2, 7, 11, 9, 5, 7], - [0, 3, 8, 2, 1, 11, 1, 7, 11, 1, 5, 7], - [2, 1, 11, 11, 1, 7, 1, 5, 7], - [1, 2, 10, 5, 7, 8, 5, 8, 9], - [9, 1, 0, 10, 5, 2, 5, 3, 2, 5, 7, 3], - [5, 2, 10, 8, 2, 5, 8, 5, 7, 8, 0, 2], - [10, 5, 2, 2, 5, 3, 5, 7, 3], - [3, 9, 1, 3, 8, 9, 7, 11, 10, 7, 10, 5], - [9, 1, 0, 10, 7, 11, 10, 5, 7], - [3, 8, 0, 7, 10, 5, 7, 11, 10], - [11, 5, 7, 11, 10, 5], - [11, 7, 6], - [0, 8, 3, 11, 7, 6], - [9, 0, 1, 11, 7, 6], - [7, 6, 11, 3, 1, 9, 3, 9, 8], - [2, 3, 7, 2, 7, 6], - [8, 7, 0, 7, 6, 0, 0, 6, 2], - [1, 9, 0, 3, 7, 6, 3, 6, 2], - [7, 6, 2, 7, 2, 9, 2, 1, 9, 7, 9, 8], - [1, 2, 10, 6, 11, 7], - [2, 10, 1, 7, 6, 11, 8, 3, 0], - [11, 7, 6, 10, 9, 0, 10, 0, 2], - [7, 6, 11, 3, 2, 8, 8, 2, 10, 8, 10, 9], - [6, 10, 7, 10, 1, 7, 7, 1, 3], - [6, 10, 1, 6, 1, 7, 7, 1, 0, 7, 0, 8], - [9, 0, 3, 6, 9, 3, 6, 10, 9, 6, 3, 7], - [6, 10, 7, 7, 10, 8, 10, 9, 8], - [8, 4, 6, 8, 6, 11], - [11, 3, 6, 3, 0, 6, 6, 0, 4], - [0, 1, 9, 4, 6, 11, 4, 11, 8], - [1, 9, 4, 11, 1, 4, 11, 3, 1, 11, 4, 6], - [3, 8, 2, 8, 4, 2, 2, 4, 6], - [2, 0, 4, 2, 4, 6], - [1, 9, 0, 3, 8, 2, 2, 8, 4, 2, 4, 6], - [9, 4, 1, 1, 4, 2, 4, 6, 2], - [10, 1, 2, 11, 8, 4, 11, 4, 6], - [10, 1, 2, 11, 3, 6, 6, 3, 0, 6, 0, 4], - [0, 2, 10, 0, 10, 9, 4, 11, 8, 4, 6, 11], - [2, 11, 3, 6, 9, 4, 6, 10, 9], - [8, 4, 6, 8, 6, 1, 6, 10, 1, 8, 1, 3], - [1, 0, 10, 10, 0, 6, 0, 4, 6], - [8, 0, 3, 9, 6, 10, 9, 4, 6], - [10, 4, 6, 10, 9, 4], - [9, 5, 4, 7, 6, 11], - [4, 9, 5, 3, 0, 8, 11, 7, 6], - [6, 11, 7, 4, 0, 1, 4, 1, 5], - [6, 11, 7, 4, 8, 5, 5, 8, 3, 5, 3, 1], - [4, 9, 5, 6, 2, 3, 6, 3, 7], - [9, 5, 4, 8, 7, 0, 0, 7, 6, 0, 6, 2], - [4, 0, 1, 4, 1, 5, 6, 3, 7, 6, 2, 3], - [7, 4, 8, 5, 2, 1, 5, 6, 2], - [6, 11, 7, 1, 2, 10, 9, 5, 4], - [11, 7, 6, 8, 3, 0, 1, 2, 10, 9, 5, 4], - [11, 7, 6, 10, 5, 2, 2, 5, 4, 2, 4, 0], - [7, 4, 8, 2, 11, 3, 10, 5, 6], - [4, 9, 5, 6, 10, 7, 7, 10, 1, 7, 1, 3], - [5, 6, 10, 0, 9, 1, 8, 7, 4], - [5, 6, 10, 7, 0, 3, 7, 4, 0], - [10, 5, 6, 4, 8, 7], - [5, 6, 9, 6, 11, 9, 9, 11, 8], - [0, 9, 5, 0, 5, 3, 3, 5, 6, 3, 6, 11], - [0, 1, 5, 0, 5, 11, 5, 6, 11, 0, 11, 8], - [11, 3, 6, 6, 3, 5, 3, 1, 5], - [9, 5, 6, 3, 9, 6, 3, 8, 9, 3, 6, 2], - [5, 6, 9, 9, 6, 0, 6, 2, 0], - [0, 3, 8, 2, 5, 6, 2, 1, 5], - [1, 6, 2, 1, 5, 6], - [1, 2, 10, 5, 6, 9, 9, 6, 11, 9, 11, 8], - [1, 0, 9, 6, 10, 5, 11, 3, 2], - [6, 10, 5, 2, 8, 0, 2, 11, 8], - [3, 2, 11, 10, 5, 6], - [10, 5, 6, 9, 3, 8, 9, 1, 3], - [0, 9, 1, 5, 6, 10], - [8, 0, 3, 10, 5, 6], - [10, 5, 6], - [10, 6, 5], - [8, 3, 0, 10, 6, 5], - [0, 1, 9, 5, 10, 6], - [10, 6, 5, 9, 8, 3, 9, 3, 1], - [3, 11, 2, 10, 6, 5], - [6, 5, 10, 2, 0, 8, 2, 8, 11], - [1, 9, 0, 6, 5, 10, 11, 2, 3], - [1, 10, 2, 5, 9, 6, 9, 11, 6, 9, 8, 11], - [1, 2, 6, 1, 6, 5], - [0, 8, 3, 2, 6, 5, 2, 5, 1], - [5, 9, 6, 9, 0, 6, 6, 0, 2], - [9, 6, 5, 3, 6, 9, 3, 9, 8, 3, 2, 6], - [11, 6, 3, 6, 5, 3, 3, 5, 1], - [0, 5, 1, 0, 11, 5, 5, 11, 6, 0, 8, 11], - [0, 5, 9, 0, 3, 5, 3, 6, 5, 3, 11, 6], - [5, 9, 6, 6, 9, 11, 9, 8, 11], - [10, 6, 5, 4, 7, 8], - [5, 10, 6, 7, 3, 0, 7, 0, 4], - [5, 10, 6, 0, 1, 9, 8, 4, 7], - [4, 5, 9, 6, 7, 10, 7, 1, 10, 7, 3, 1], - [7, 8, 4, 2, 3, 11, 10, 6, 5], - [11, 6, 7, 10, 2, 5, 2, 4, 5, 2, 0, 4], - [11, 6, 7, 8, 0, 3, 1, 10, 2, 9, 4, 5], - [6, 7, 11, 1, 10, 2, 9, 4, 5], - [7, 8, 4, 5, 1, 2, 5, 2, 6], - [4, 1, 0, 4, 5, 1, 6, 7, 3, 6, 3, 2], - [9, 4, 5, 8, 0, 7, 0, 6, 7, 0, 2, 6], - [4, 5, 9, 6, 3, 2, 6, 7, 3], - [6, 7, 11, 4, 5, 8, 5, 3, 8, 5, 1, 3], - [6, 7, 11, 4, 1, 0, 4, 5, 1], - [4, 5, 9, 3, 8, 0, 11, 6, 7], - [9, 4, 5, 7, 11, 6], - [10, 6, 4, 10, 4, 9], - [8, 3, 0, 9, 10, 6, 9, 6, 4], - [1, 10, 0, 10, 6, 0, 0, 6, 4], - [8, 6, 4, 8, 1, 6, 6, 1, 10, 8, 3, 1], - [2, 3, 11, 6, 4, 9, 6, 9, 10], - [0, 10, 2, 0, 9, 10, 4, 8, 11, 4, 11, 6], - [10, 2, 1, 11, 6, 3, 6, 0, 3, 6, 4, 0], - [10, 2, 1, 11, 4, 8, 11, 6, 4], - [9, 1, 4, 1, 2, 4, 4, 2, 6], - [1, 0, 9, 3, 2, 8, 2, 4, 8, 2, 6, 4], - [2, 4, 0, 2, 6, 4], - [3, 2, 8, 8, 2, 4, 2, 6, 4], - [1, 4, 9, 11, 4, 1, 11, 1, 3, 11, 6, 4], - [0, 9, 1, 4, 11, 6, 4, 8, 11], - [11, 6, 3, 3, 6, 0, 6, 4, 0], - [8, 6, 4, 8, 11, 6], - [6, 7, 10, 7, 8, 10, 10, 8, 9], - [9, 3, 0, 6, 3, 9, 6, 9, 10, 6, 7, 3], - [6, 1, 10, 6, 7, 1, 7, 0, 1, 7, 8, 0], - [6, 7, 10, 10, 7, 1, 7, 3, 1], - [7, 11, 6, 3, 8, 2, 8, 10, 2, 8, 9, 10], - [11, 6, 7, 10, 0, 9, 10, 2, 0], - [2, 1, 10, 7, 11, 6, 8, 0, 3], - [1, 10, 2, 6, 7, 11], - [7, 2, 6, 7, 9, 2, 2, 9, 1, 7, 8, 9], - [1, 0, 9, 3, 6, 7, 3, 2, 6], - [8, 0, 7, 7, 0, 6, 0, 2, 6], - [2, 7, 3, 2, 6, 7], - [7, 11, 6, 3, 9, 1, 3, 8, 9], - [9, 1, 0, 11, 6, 7], - [0, 3, 8, 11, 6, 7], - [11, 6, 7], - [11, 7, 5, 11, 5, 10], - [3, 0, 8, 7, 5, 10, 7, 10, 11], - [9, 0, 1, 10, 11, 7, 10, 7, 5], - [3, 1, 9, 3, 9, 8, 7, 10, 11, 7, 5, 10], - [10, 2, 5, 2, 3, 5, 5, 3, 7], - [5, 10, 2, 8, 5, 2, 8, 7, 5, 8, 2, 0], - [9, 0, 1, 10, 2, 5, 5, 2, 3, 5, 3, 7], - [1, 10, 2, 5, 8, 7, 5, 9, 8], - [2, 11, 1, 11, 7, 1, 1, 7, 5], - [0, 8, 3, 2, 11, 1, 1, 11, 7, 1, 7, 5], - [9, 0, 2, 9, 2, 7, 2, 11, 7, 9, 7, 5], - [11, 3, 2, 8, 5, 9, 8, 7, 5], - [1, 3, 7, 1, 7, 5], - [8, 7, 0, 0, 7, 1, 7, 5, 1], - [0, 3, 9, 9, 3, 5, 3, 7, 5], - [9, 7, 5, 9, 8, 7], - [4, 5, 8, 5, 10, 8, 8, 10, 11], - [3, 0, 4, 3, 4, 10, 4, 5, 10, 3, 10, 11], - [0, 1, 9, 4, 5, 8, 8, 5, 10, 8, 10, 11], - [5, 9, 4, 1, 11, 3, 1, 10, 11], - [3, 8, 4, 3, 4, 2, 2, 4, 5, 2, 5, 10], - [10, 2, 5, 5, 2, 4, 2, 0, 4], - [0, 3, 8, 5, 9, 4, 10, 2, 1], - [2, 1, 10, 9, 4, 5], - [8, 4, 5, 2, 8, 5, 2, 11, 8, 2, 5, 1], - [3, 2, 11, 1, 4, 5, 1, 0, 4], - [9, 4, 5, 8, 2, 11, 8, 0, 2], - [11, 3, 2, 9, 4, 5], - [4, 5, 8, 8, 5, 3, 5, 1, 3], - [5, 0, 4, 5, 1, 0], - [3, 8, 0, 4, 5, 9], - [9, 4, 5], - [7, 4, 11, 4, 9, 11, 11, 9, 10], - [3, 0, 8, 7, 4, 11, 11, 4, 9, 11, 9, 10], - [11, 7, 4, 1, 11, 4, 1, 10, 11, 1, 4, 0], - [8, 7, 4, 11, 1, 10, 11, 3, 1], - [2, 3, 7, 2, 7, 9, 7, 4, 9, 2, 9, 10], - [4, 8, 7, 0, 10, 2, 0, 9, 10], - [2, 1, 10, 0, 7, 4, 0, 3, 7], - [10, 2, 1, 8, 7, 4], - [2, 11, 7, 2, 7, 1, 1, 7, 4, 1, 4, 9], - [3, 2, 11, 4, 8, 7, 9, 1, 0], - [7, 4, 11, 11, 4, 2, 4, 0, 2], - [2, 11, 3, 7, 4, 8], - [9, 1, 4, 4, 1, 7, 1, 3, 7], - [1, 0, 9, 8, 7, 4], - [3, 4, 0, 3, 7, 4], - [8, 7, 4], - [8, 9, 10, 8, 10, 11], - [0, 9, 3, 3, 9, 11, 9, 10, 11], - [1, 10, 0, 0, 10, 8, 10, 11, 8], - [10, 3, 1, 10, 11, 3], - [3, 8, 2, 2, 8, 10, 8, 9, 10], - [9, 2, 0, 9, 10, 2], - [8, 0, 3, 1, 10, 2], - [10, 2, 1], - [2, 11, 1, 1, 11, 9, 11, 8, 9], - [11, 3, 2, 0, 9, 1], - [11, 0, 2, 11, 8, 0], - [11, 3, 2], - [8, 1, 3, 8, 9, 1], - [9, 1, 0], - [8, 0, 3], - [] - ]; - } - march(y, w, L, s) { - let o = !!s.fulltable, A = s.hasOwnProperty("origin") && s.origin.hasOwnProperty("x") ? s.origin : { x: 0, y: 0, z: 0 }, p = !!s.voxel, v = s.matrix, a = s.nX || 0, l = s.nY || 0, g = s.nZ || 0, M = s.scale || 1, C = null; - s.unitCube ? C = s.unitCube : C = { x: M, y: M, z: M }; - let T = new Int32Array(a * l * g), D, I; - for (D = 0, I = T.length; D < I; ++D) - T[D] = -1; - let B = function(N, R, U, W, G, F) { - let V = { x: 0, y: 0, z: 0 }, J = !!(W & 1 << G), X = !!(W & 1 << F), oe = G; - if (!J && X && (oe = F), oe & 1 && U++, oe & 2 && R++, oe & 4 && N++, v) { - let ve = new n.Vector3(N, R, U); - ve = ve.applyMatrix4(v), V = { x: ve.x, y: ve.y, z: ve.z }; - } else - V.x = A.x + C.x * N, V.y = A.y + C.y * R, V.z = A.z + C.z * U; - let te = (l * N + R) * g + U; - return p ? (w.push(V), w.length - 1) : (T[te] < 0 && (T[te] = w.length, w.push(V)), T[te]); - }, P = new Int32Array(12), z = o ? this.edgeTable2 : this.edgeTable, k = o ? this.triTable2 : this.triTable; - for (D = 0; D < a - 1; ++D) - for (let N = 0; N < l - 1; ++N) - for (let R = 0; R < g - 1; ++R) { - let U = 0; - for (let F = 0; F < 8; ++F) { - let V = (l * (D + ((F & 4) >> 2)) + N + ((F & 2) >> 1)) * g + R + (F & 1), J = !!(y[V] & this.ISDONE); - U |= J << F; - } - if (U === 0 || U === 255) - continue; - let W = z[U]; - if (W === 0) - continue; - let G = k[U]; - W & 1 && (P[0] = B(D, N, R, U, 0, 1)), W & 2 && (P[1] = B(D, N, R, U, 1, 3)), W & 4 && (P[2] = B(D, N, R, U, 3, 2)), W & 8 && (P[3] = B(D, N, R, U, 2, 0)), W & 16 && (P[4] = B(D, N, R, U, 4, 5)), W & 32 && (P[5] = B(D, N, R, U, 5, 7)), W & 64 && (P[6] = B(D, N, R, U, 7, 6)), W & 128 && (P[7] = B(D, N, R, U, 6, 4)), W & 256 && (P[8] = B(D, N, R, U, 0, 4)), W & 512 && (P[9] = B(D, N, R, U, 1, 5)), W & 1024 && (P[10] = B(D, N, R, U, 3, 7)), W & 2048 && (P[11] = B(D, N, R, U, 2, 6)); - for (let F = 0; F < G.length; F += 3) { - let V = P[G[F]], J = P[G[F + 1]], X = P[G[F + 2]]; - p && F >= 3 && (w.push(w[V]), V = w.length - 1, w.push(w[J]), J = w.length - 1, w.push(w[X]), X = w.length - 1), L.push(V), L.push(J), L.push(X); - } - } - } - laplacianSmooth(y, w, L) { - let s = new Array(w.length), o, A, p, v, a; - for (o = 0, A = w.length; o < A; o++) - s[o] = { - x: 0, - y: 0, - z: 0 - }; - let l = new Array(20), g; - for (o = 0; o < 20; o++) - l[o] = new Array(w.length); - for (o = 0, A = w.length; o < A; o++) - l[0][o] = 0; - for (o = 0, A = L.length / 3; o < A; o++) { - let T = o * 3, D = o * 3 + 1, I = o * 3 + 2; - for (g = !0, p = 0, v = l[0][L[T]]; p < v; p++) - if (L[D] == l[p + 1][L[T]]) { - g = !1; - break; - } - for (g && (l[0][L[T]]++, l[l[0][L[T]]][L[T]] = L[D]), g = !0, p = 0, v = l[0][L[T]]; p < v; p++) - if (L[I] == l[p + 1][L[T]]) { - g = !1; - break; - } - for (g && (l[0][L[T]]++, l[l[0][L[T]]][L[T]] = L[I]), g = !0, p = 0, v = l[0][L[D]]; p < v; p++) - if (L[T] == l[p + 1][L[D]]) { - g = !1; - break; - } - for (g && (l[0][L[D]]++, l[l[0][L[D]]][L[D]] = L[T]), g = !0, p = 0, v = l[0][L[D]]; p < v; p++) - if (L[I] == l[p + 1][L[D]]) { - g = !1; - break; - } - for (g && (l[0][L[D]]++, l[l[0][L[D]]][L[D]] = L[I]), g = !0, p = 0; p < l[0][L[I]]; p++) - if (L[T] == l[p + 1][L[I]]) { - g = !1; - break; - } - for (g && (l[0][L[I]]++, l[l[0][L[I]]][L[I]] = L[T]), g = !0, p = 0, v = l[0][L[I]]; p < v; p++) - if (L[D] == l[p + 1][L[I]]) { - g = !1; - break; - } - g && (l[0][L[I]]++, l[l[0][L[I]]][L[I]] = L[D]); - } - let M = 1, C = 0.5; - for (a = 0; a < y; a++) { - for (o = 0, A = w.length; o < A; o++) - if (l[0][o] < 3) - s[o].x = w[o].x, s[o].y = w[o].y, s[o].z = w[o].z; - else if (l[0][o] == 3 || l[0][o] == 4) { - for (s[o].x = 0, s[o].y = 0, s[o].z = 0, p = 0, v = l[0][o]; p < v; p++) - s[o].x += w[l[p + 1][o]].x, s[o].y += w[l[p + 1][o]].y, s[o].z += w[l[p + 1][o]].z; - s[o].x += C * w[o].x, s[o].y += C * w[o].y, s[o].z += C * w[o].z, s[o].x /= C + l[0][o], s[o].y /= C + l[0][o], s[o].z /= C + l[0][o]; - } else { - for (s[o].x = 0, s[o].y = 0, s[o].z = 0, p = 0, v = l[0][o]; p < v; p++) - s[o].x += w[l[p + 1][o]].x, s[o].y += w[l[p + 1][o]].y, s[o].z += w[l[p + 1][o]].z; - s[o].x += M * w[o].x, s[o].y += M * w[o].y, s[o].z += M * w[o].z, s[o].x /= M + l[0][o], s[o].y /= M + l[0][o], s[o].z /= M + l[0][o]; - } - for (o = 0, A = w.length; o < A; o++) - w[o].x = s[o].x, w[o].y = s[o].y, w[o].z = s[o].z; - } - } - } - let _ = new h(); - class E { - constructor(y, w, L) { - this.data = new Int32Array(y * w * L * 3), this.width = w, this.height = L; - } - // set position x,y,z to pt, which has ix,iy,and iz - set(y, w, L, s) { - let o = ((y * this.width + w) * this.height + L) * 3; - this.data[o] = s.ix, this.data[o + 1] = s.iy, this.data[o + 2] = s.iz; - } - // return point at x,y,z - get(y, w, L) { - let s = ((y * this.width + w) * this.height + L) * 3; - return { - ix: this.data[s], - iy: this.data[s + 1], - iz: this.data[s + 2] - }; - } - } - class c { - constructor() { - this.INOUT = 1, this.ISDONE = 2, this.ISBOUND = 4, this.ptranx = 0, this.ptrany = 0, this.ptranz = 0, this.probeRadius = 1.4, this.defaultScaleFactor = 2, this.scaleFactor = this.defaultScaleFactor, this.pHeight = 0, this.pWidth = 0, this.pLength = 0, this.cutRadius = 0, this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, this.pminx = 0, this.pminy = 0, this.pminz = 0, this.pmaxx = 0, this.pmaxy = 0, this.pmaxz = 0, this.depty = {}, this.widxz = {}, this.faces = [], this.verts = [], this.vdwRadii = { - H: 1.2, - Li: 1.82, - Na: 2.27, - K: 2.75, - C: 1.7, - N: 1.55, - O: 1.52, - F: 1.47, - P: 1.8, - S: 1.8, - CL: 1.75, - BR: 1.85, - SE: 1.9, - ZN: 1.39, - CU: 1.4, - NI: 1.63, - X: 2 - }, this.nb = [ - new Int32Array([1, 0, 0]), - new Int32Array([-1, 0, 0]), - new Int32Array([0, 1, 0]), - new Int32Array([0, -1, 0]), - new Int32Array([0, 0, 1]), - new Int32Array([0, 0, -1]), - new Int32Array([1, 1, 0]), - new Int32Array([1, -1, 0]), - new Int32Array([-1, 1, 0]), - new Int32Array([-1, -1, 0]), - new Int32Array([1, 0, 1]), - new Int32Array([1, 0, -1]), - new Int32Array([-1, 0, 1]), - new Int32Array([-1, 0, -1]), - new Int32Array([0, 1, 1]), - new Int32Array([0, 1, -1]), - new Int32Array([0, -1, 1]), - new Int32Array([0, -1, -1]), - new Int32Array([1, 1, 1]), - new Int32Array([1, 1, -1]), - new Int32Array([1, -1, 1]), - new Int32Array([-1, 1, 1]), - new Int32Array([1, -1, -1]), - new Int32Array([-1, -1, 1]), - new Int32Array([-1, 1, -1]), - new Int32Array([-1, -1, -1]) - ], c.MarchingCube || (c.MarchingCube = new h()); - } - getVDWIndex(y) { - return !y.elem || typeof this.vdwRadii[y.elem] > "u" ? "X" : y.elem; - } - getFacesAndVertices(y) { - let w = {}; - for (let o = 0, A = y.length; o < A; o++) - w[y[o]] = !0; - let L = this.verts; - for (let o = 0, A = L.length; o < A; o++) - L[o].x = L[o].x / this.scaleFactor - this.ptranx, L[o].y = L[o].y / this.scaleFactor - this.ptrany, L[o].z = L[o].z / this.scaleFactor - this.ptranz; - let s = []; - for (let o = 0, A = this.faces.length; o < A; o += 3) { - let p = this.faces[o], v = this.faces[o + 1], a = this.faces[o + 2], l = L[p].atomid, g = L[v].atomid, M = L[a].atomid, C = l; - g < C && (C = g), M < C && (C = M), w[C] && p !== v && v !== a && p !== a && (s.push(p), s.push(v), s.push(a)); - } - return this.vpBits = null, this.vpDistance = null, this.vpAtomID = null, { - vertices: L, - faces: s - }; - } - initparm(y, w, L) { - L > 1e6 && (this.scaleFactor = this.defaultScaleFactor / 2); - let s = 1 / this.scaleFactor * 5.5; - this.pminx = y[0][0], this.pmaxx = y[1][0], this.pminy = y[0][1], this.pmaxy = y[1][1], this.pminz = y[0][2], this.pmaxz = y[1][2], w ? (this.pminx -= this.probeRadius + s, this.pminy -= this.probeRadius + s, this.pminz -= this.probeRadius + s, this.pmaxx += this.probeRadius + s, this.pmaxy += this.probeRadius + s, this.pmaxz += this.probeRadius + s) : (this.pminx -= s, this.pminy -= s, this.pminz -= s, this.pmaxx += s, this.pmaxy += s, this.pmaxz += s), this.pminx = Math.floor(this.pminx * this.scaleFactor) / this.scaleFactor, this.pminy = Math.floor(this.pminy * this.scaleFactor) / this.scaleFactor, this.pminz = Math.floor(this.pminz * this.scaleFactor) / this.scaleFactor, this.pmaxx = Math.ceil(this.pmaxx * this.scaleFactor) / this.scaleFactor, this.pmaxy = Math.ceil(this.pmaxy * this.scaleFactor) / this.scaleFactor, this.pmaxz = Math.ceil(this.pmaxz * this.scaleFactor) / this.scaleFactor, this.ptranx = -this.pminx, this.ptrany = -this.pminy, this.ptranz = -this.pminz, this.pLength = Math.ceil(this.scaleFactor * (this.pmaxx - this.pminx)) + 1, this.pWidth = Math.ceil(this.scaleFactor * (this.pmaxy - this.pminy)) + 1, this.pHeight = Math.ceil(this.scaleFactor * (this.pmaxz - this.pminz)) + 1, this.boundingatom(w), this.cutRadius = this.probeRadius * this.scaleFactor, this.vpBits = new Uint8Array(this.pLength * this.pWidth * this.pHeight), this.vpDistance = new Float64Array(this.pLength * this.pWidth * this.pHeight), this.vpAtomID = new Int32Array(this.pLength * this.pWidth * this.pHeight); - } - boundingatom(y) { - let w = {}; - for (const L in this.vdwRadii) { - let s = this.vdwRadii[L]; - y ? w[L] = (s + this.probeRadius) * this.scaleFactor + 0.5 : w[L] = s * this.scaleFactor + 0.5; - let o = w[L] * w[L]; - this.widxz[L] = Math.floor(w[L]) + 1, this.depty[L] = new Int32Array(this.widxz[L] * this.widxz[L]); - let A = 0; - for (let p = 0; p < this.widxz[L]; p++) - for (let v = 0; v < this.widxz[L]; v++) { - let a = p * p + v * v; - if (a > o) - this.depty[L][A] = -1; - else { - let l = Math.sqrt(o - a); - this.depty[L][A] = Math.floor(l); - } - A++; - } - } - } - fillvoxels(y, w) { - for (let L = 0, s = this.vpBits.length; L < s; L++) - this.vpBits[L] = 0, this.vpDistance[L] = -1, this.vpAtomID[L] = -1; - for (let L in w) { - let s = y[w[L]]; - s !== void 0 && this.fillAtom(s, y); - } - for (let L = 0, s = this.vpBits.length; L < s; L++) - this.vpBits[L] & this.INOUT && (this.vpBits[L] |= this.ISDONE); - } - fillAtom(y, w) { - let L = Math.floor(0.5 + this.scaleFactor * (y.x + this.ptranx)), s = Math.floor(0.5 + this.scaleFactor * (y.y + this.ptrany)), o = Math.floor(0.5 + this.scaleFactor * (y.z + this.ptranz)), A = this.getVDWIndex(y), p = 0, v = this.pWidth * this.pHeight; - for (let a = 0, l = this.widxz[A]; a < l; a++) - for (let g = 0; g < l; g++) { - if (this.depty[A][p] != -1) { - for (let M = -1; M < 2; M++) - for (let C = -1; C < 2; C++) - for (let T = -1; T < 2; T++) - if (M !== 0 && C !== 0 && T !== 0) { - let D = M * a, I = T * g; - for (let B = 0; B <= this.depty[A][p]; B++) { - let P = B * C, z = L + D, k = s + P, N = o + I; - if (z < 0 || k < 0 || N < 0 || z >= this.pLength || k >= this.pWidth || N >= this.pHeight) - continue; - let R = z * v + k * this.pHeight + N; - if (!(this.vpBits[R] & this.INOUT)) - this.vpBits[R] |= this.INOUT, this.vpAtomID[R] = y.serial; - else { - let U = w[this.vpAtomID[R]]; - if (U.serial != y.serial) { - let W = L + D - Math.floor(0.5 + this.scaleFactor * (U.x + this.ptranx)), G = s + P - Math.floor(0.5 + this.scaleFactor * (U.y + this.ptrany)), F = o + I - Math.floor(0.5 + this.scaleFactor * (U.z + this.ptranz)); - D * D + P * P + I * I < W * W + G * G + F * F && (this.vpAtomID[R] = y.serial); - } - } - } - } - } - p++; - } - } - fillvoxelswaals(y, w) { - for (let L = 0, s = this.vpBits.length; L < s; L++) - this.vpBits[L] &= ~this.ISDONE; - for (let L in w) { - let s = y[w[L]]; - s !== void 0 && this.fillAtomWaals(s, y); - } - } - fillAtomWaals(y, w) { - let L = 0, s = Math.floor(0.5 + this.scaleFactor * (y.x + this.ptranx)), o = Math.floor(0.5 + this.scaleFactor * (y.y + this.ptrany)), A = Math.floor(0.5 + this.scaleFactor * (y.z + this.ptranz)), p = this.getVDWIndex(y), v = this.pWidth * this.pHeight; - for (let a = 0, l = this.widxz[p]; a < l; a++) - for (let g = 0; g < l; g++) { - if (this.depty[p][L] != -1) { - for (let M = -1; M < 2; M++) - for (let C = -1; C < 2; C++) - for (let T = -1; T < 2; T++) - if (M !== 0 && C !== 0 && T !== 0) { - let D = M * a, I = T * g; - for (let B = 0; B <= this.depty[p][L]; B++) { - let P = B * C, z = s + D, k = o + P, N = A + I; - if (z < 0 || k < 0 || N < 0 || z >= this.pLength || k >= this.pWidth || N >= this.pHeight) - continue; - let R = z * v + k * this.pHeight + N; - if (!(this.vpBits[R] & this.ISDONE)) - this.vpBits[R] |= this.ISDONE, this.vpAtomID[R] = y.serial; - else { - let U = w[this.vpAtomID[R]]; - if (U.serial != y.serial) { - let W = s + D - Math.floor(0.5 + this.scaleFactor * (U.x + this.ptranx)), G = o + P - Math.floor(0.5 + this.scaleFactor * (U.y + this.ptrany)), F = A + I - Math.floor(0.5 + this.scaleFactor * (U.z + this.ptranz)); - D * D + P * P + I * I < W * W + G * G + F * F && (this.vpAtomID[R] = y.serial); - } - } - } - } - } - L++; - } - } - buildboundary() { - let y = this.pWidth * this.pHeight; - for (let w = 0; w < this.pLength; w++) - for (let L = 0; L < this.pHeight; L++) - for (let s = 0; s < this.pWidth; s++) { - let o = w * y + s * this.pHeight + L; - if (this.vpBits[o] & this.INOUT) { - let A = 0; - for (; A < 26; ) { - let p = w + this.nb[A][0], v = L + this.nb[A][2], a = s + this.nb[A][1]; - if (p > -1 && p < this.pLength && a > -1 && a < this.pWidth && v > -1 && v < this.pHeight && !(this.vpBits[p * y + a * this.pHeight + v] & this.INOUT)) { - this.vpBits[o] |= this.ISBOUND; - break; - } else - A++; - } - } - } - } - fastdistancemap() { - let y = new E(this.pLength, this.pWidth, this.pHeight), w = this.pWidth * this.pHeight, L = this.cutRadius * this.cutRadius, s = [], o = [], A; - for (let a = 0; a < this.pLength; a++) - for (let l = 0; l < this.pWidth; l++) - for (let g = 0; g < this.pHeight; g++) - if (A = a * w + l * this.pHeight + g, this.vpBits[A] &= ~this.ISDONE, this.vpBits[A] & this.INOUT && this.vpBits[A] & this.ISBOUND) { - let M = { - ix: a, - iy: l, - iz: g - }; - y.set(a, l, g, M), s.push(M), this.vpDistance[A] = 0, this.vpBits[A] |= this.ISDONE, this.vpBits[A] &= ~this.ISBOUND; - } - do { - o = this.fastoneshell(s, y), s = []; - for (let a = 0, l = o.length; a < l; a++) - A = w * o[a].ix + this.pHeight * o[a].iy + o[a].iz, this.vpBits[A] &= ~this.ISBOUND, this.vpDistance[A] <= 1.0404 * L && s.push({ - ix: o[a].ix, - iy: o[a].iy, - iz: o[a].iz - }); - } while (s.length !== 0); - s = [], o = [], y = null; - let p = this.scaleFactor - 0.5; - p < 0 && (p = 0); - let v = L - 0.5 / (0.1 + p); - for (let a = 0; a < this.pLength; a++) - for (let l = 0; l < this.pWidth; l++) - for (let g = 0; g < this.pHeight; g++) - A = a * w + l * this.pHeight + g, this.vpBits[A] &= ~this.ISBOUND, this.vpBits[A] & this.INOUT && (!(this.vpBits[A] & this.ISDONE) || this.vpBits[A] & this.ISDONE && this.vpDistance[A] >= v) && (this.vpBits[A] |= this.ISBOUND); - } - fastoneshell(y, w) { - let L, s, o, A, p, v, a, l, g, M = []; - if (y.length === 0) - return M; - let C = { - ix: -1, - iy: -1, - iz: -1 - }, T = this.pWidth * this.pHeight; - for (let D = 0, I = y.length; D < I; D++) { - L = y[D].ix, s = y[D].iy, o = y[D].iz, l = w.get(L, s, o); - for (let B = 0; B < 6; B++) - C.ix = L + this.nb[B][0], C.iy = s + this.nb[B][1], C.iz = o + this.nb[B][2], C.ix < this.pLength && C.ix > -1 && C.iy < this.pWidth && C.iy > -1 && C.iz < this.pHeight && C.iz > -1 && (g = C.ix * T + this.pHeight * C.iy + C.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (w.set(C.ix, C.iy, o + this.nb[B][2], l), A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, a < this.vpDistance[g] && (w.set(C.ix, C.iy, C.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - }))))); - } - for (let D = 0, I = y.length; D < I; D++) { - L = y[D].ix, s = y[D].iy, o = y[D].iz, l = w.get(L, s, o); - for (let B = 6; B < 18; B++) - C.ix = L + this.nb[B][0], C.iy = s + this.nb[B][1], C.iz = o + this.nb[B][2], C.ix < this.pLength && C.ix > -1 && C.iy < this.pWidth && C.iy > -1 && C.iz < this.pHeight && C.iz > -1 && (g = C.ix * T + this.pHeight * C.iy + C.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (w.set(C.ix, C.iy, o + this.nb[B][2], l), A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, a < this.vpDistance[g] && (w.set(C.ix, C.iy, C.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - }))))); - } - for (let D = 0, I = y.length; D < I; D++) { - L = y[D].ix, s = y[D].iy, o = y[D].iz, l = w.get(L, s, o); - for (let B = 18; B < 26; B++) - C.ix = L + this.nb[B][0], C.iy = s + this.nb[B][1], C.iz = o + this.nb[B][2], C.ix < this.pLength && C.ix > -1 && C.iy < this.pWidth && C.iy > -1 && C.iz < this.pHeight && C.iz > -1 && (g = C.ix * T + this.pHeight * C.iy + C.iz, this.vpBits[g] & this.INOUT && !(this.vpBits[g] & this.ISDONE) ? (w.set(C.ix, C.iy, o + this.nb[B][2], l), A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, this.vpDistance[g] = a, this.vpBits[g] |= this.ISDONE, this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - })) : this.vpBits[g] & this.INOUT && this.vpBits[g] & this.ISDONE && (A = C.ix - l.ix, p = C.iy - l.iy, v = C.iz - l.iz, a = A * A + p * p + v * v, a < this.vpDistance[g] && (w.set(C.ix, C.iy, C.iz, l), this.vpDistance[g] = a, this.vpBits[g] & this.ISBOUND || (this.vpBits[g] |= this.ISBOUND, M.push({ - ix: C.ix, - iy: C.iy, - iz: C.iz - }))))); - } - return M; - } - marchingcubeinit(y) { - for (let w = 0, L = this.vpBits.length; w < L; w++) - y == 1 ? this.vpBits[w] &= ~this.ISBOUND : y == 4 ? (this.vpBits[w] &= ~this.ISDONE, this.vpBits[w] & this.ISBOUND && (this.vpBits[w] |= this.ISDONE), this.vpBits[w] &= ~this.ISBOUND) : y == 2 ? this.vpBits[w] & this.ISBOUND && this.vpBits[w] & this.ISDONE ? this.vpBits[w] &= ~this.ISBOUND : this.vpBits[w] & this.ISBOUND && !(this.vpBits[w] & this.ISDONE) && (this.vpBits[w] |= this.ISDONE) : y == 3 && (this.vpBits[w] &= ~this.ISBOUND); - } - marchingcube(y) { - this.marchingcubeinit(y), this.verts = [], this.faces = [], c.MarchingCube.march(this.vpBits, this.verts, this.faces, { - smooth: 1, - nX: this.pLength, - nY: this.pWidth, - nZ: this.pHeight - }); - let w = this.pWidth * this.pHeight; - for (let L = 0, s = this.verts.length; L < s; L++) - this.verts[L].atomid = this.vpAtomID[this.verts[L].x * w + this.pHeight * this.verts[L].y + this.verts[L].z]; - c.MarchingCube.laplacianSmooth(1, this.verts, this.faces); - } - } - c.MarchingCube = new h(); - } - ), - /***/ - "./src/VolumeData.ts": ( - /*!***************************!*\ - !*** ./src/VolumeData.ts ***! - \***************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - VolumeData: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ./utilities */ - "./src/utilities.ts" - ), f = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), u = r( - /*! ./parsers/VASP */ - "./src/parsers/VASP.ts" - ), b = r( - /*! ./parsers/CUBE */ - "./src/parsers/CUBE.ts" - ), h = r( - /*! pako */ - "./node_modules/pako/dist/pako.esm.mjs" - ); - class _ { - constructor(c, S, y) { - if (this.unit = { - x: 1, - y: 1, - z: 1 - }, this.origin = { - x: 0, - y: 0, - z: 0 - }, this.size = { - x: 0, - y: 0, - z: 0 - }, this.data = new Float32Array([]), this.matrix = null, this.inversematrix = null, this.isbinary = /* @__PURE__ */ new Set(["ccp4", "CCP4"]), this.getCoordinates = function(A) { - var p = A / (this.size.y * this.size.z), v = A % (this.size.y * this.size.z), a = A % this.size.z; - return p *= this.unit.x, v *= this.unit.y, a *= this.unit.z, p += this.origin.x, v += this.origin.y, a += this.origin.z, { x: p, y: v, z: a }; - }, this.vasp = function(A) { - var p = A.replace(/^\s+/, "").split(/[\n\r]/), v = (0, u.VASP)(A)[0], a = v.length; - if (a == 0) { - console.log("No good formating of CHG or CHGCAR file, not atomic information provided in the file."), this.data = []; - return; - } - var l = 1.889725992, g = 0.036749309, M = parseFloat(p[1]), C; - C = p[2].replace(/^\s+/, "").split(/\s+/); - var T = new f.Vector3(parseFloat(C[0]), parseFloat(C[1]), parseFloat(C[2])).multiplyScalar(M * l); - C = p[3].replace(/^\s+/, "").split(/\s+/); - var D = new f.Vector3(parseFloat(C[0]), parseFloat(C[1]), parseFloat(C[2])).multiplyScalar(M * l); - C = p[4].replace(/^\s+/, "").split(/\s+/); - var I = new f.Vector3(parseFloat(C[0]), parseFloat(C[1]), parseFloat(C[2])).multiplyScalar(M * l), B = T.x * (D.y * I.z - I.y * D.z) - D.x * (T.y * I.z - I.y * T.z) + I.x * (T.y * D.z - D.y * T.z); - B = Math.abs(B) / Math.pow(l, 3); - var P = 1 / B; - p.splice(0, 8 + a + 1); - var z = p[0].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), k = Math.abs(parseFloat(z[0])), N = Math.abs(parseFloat(z[1])), R = Math.abs(parseFloat(z[2])), U = this.origin = new f.Vector3(0, 0, 0); - this.size = { x: k, y: N, z: R }, this.unit = new f.Vector3(T.x, D.y, I.z), T = T.multiplyScalar(1 / (l * k)), D = D.multiplyScalar(1 / (l * N)), I = I.multiplyScalar(1 / (l * R)), (T.y != 0 || T.z != 0 || D.x != 0 || D.z != 0 || I.x != 0 || I.y != 0) && (this.matrix = new f.Matrix4(T.x, D.x, I.x, 0, T.y, D.y, I.y, 0, T.z, D.z, I.z, 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new f.Matrix4().makeTranslation(U.x, U.y, U.z)), this.origin = new f.Vector3(0, 0, 0), this.unit = new f.Vector3(1, 1, 1)), p.splice(0, 1); - var W = p.join(" "); - W = W.replace(/^\s+/, ""); - var G = W.split(/[\s\r]+/); - G.splice(k * N * R + 1); - for (var F = Float32Array.from(G, parseFloat), V = 0; V < F.length; V++) - F[V] = F[V] * P * g; - this.data = F; - }, this.dx = function(A) { - var p = A.split(/[\n\r]+/), v, a = /gridpositions\s+counts\s+(\d+)\s+(\d+)\s+(\d+)/, l = /^origin\s+(\S+)\s+(\S+)\s+(\S+)/, g = /^delta\s+(\S+)\s+(\S+)\s+(\S+)/, M = /data follows/, C = 0; - for (C = 0; C < p.length; C++) { - var T = p[C]; - if (v = a.exec(T)) { - var D = parseInt(v[1]), I = parseInt(v[2]), B = parseInt(v[3]); - this.size = { x: D, y: I, z: B }; - } else if (v = g.exec(T)) { - var P = parseFloat(v[1]); - if ((parseFloat(v[2]) != 0 || parseFloat(v[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), C += 1, T = p[C], v = g.exec(T), v == null) { - console.log("Parse error in dx delta matrix"); - return; - } - var z = parseFloat(v[2]); - if ((parseFloat(v[1]) != 0 || parseFloat(v[3]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), C += 1, T = p[C], v = g.exec(T), v == null) { - console.log("Parse error in dx delta matrix"); - return; - } - var k = parseFloat(v[3]); - (parseFloat(v[1]) != 0 || parseFloat(v[2]) != 0) && console.log("Non-orthogonal delta matrix not currently supported in dx format"), this.unit = new f.Vector3(P, z, k); - } else if (v = l.exec(T)) { - var N = parseFloat(v[1]), R = parseFloat(v[2]), U = parseFloat(v[3]); - this.origin = new f.Vector3(N, R, U); - } else if (v = M.exec(T)) - break; - } - if (C += 1, !this.size || !this.origin || !this.unit || !this.size) { - console.log("Error parsing dx format"); - return; - } - var W = p.splice(C).join(" "), G = W.split(/[\s\r]+/); - this.data = Float32Array.from(G, parseFloat); - }, S = S.toLowerCase(), /\.gz$/.test(S)) { - S = S.replace(/\.gz$/, ""); - try { - this[S] && this.isbinary.has(S) ? (typeof c == "string" && (c = (0, n.base64ToArray)(c)), c = (0, h.inflate)(c)) : c = new TextDecoder("utf-8").decode((0, h.inflate)(c)); - } catch (A) { - console.log(A); - } - } - if (this[S] && (this.isbinary.has(S) && typeof c == "string" && (c = (0, n.base64ToArray)(c)), this[S](c)), y) { - if (y.negate) - for (let A = 0, p = this.data.length; A < p; A++) - this.data[A] = -this.data[A]; - if (y.normalize) { - var w = 0; - for (let A = 0, p = this.data.length; A < p; A++) - w += this.data[A]; - var L = w / this.data.length; - w = 0; - for (let A = 0, p = this.data.length; A < p; A++) { - var s = this.data[A] - L; - w += s * s; - } - var o = w / this.data.length; - for (let A = 0, p = this.data.length; A < p; A++) - this.data[A] = (this.data[A] - L) / o; - } - } - } - /** - * @function $3Dmol.VolumeData.getIndex - * @param {number} x,y,z - the coordinates - * @returns - index into flat array closest to provided coordinate; -1 if invalid - */ - getIndex(c, S, y) { - if (this.matrix) { - this.inversematrix == null && (this.inversematrix = new f.Matrix4().getInverse(this.matrix)); - var w = new f.Vector3(c, S, y); - w = w.applyMatrix4(this.inversematrix), c = w.x, S = w.y, y = w.z; - } else - c -= this.origin.x, S -= this.origin.y, y -= this.origin.z, c /= this.unit.x, S /= this.unit.y, y /= this.unit.z; - return c = Math.round(c), S = Math.round(S), y = Math.round(y), c < 0 || c >= this.size.x || S < 0 || S >= this.size.y || y < 0 || y >= this.size.z ? -1 : c * this.size.y * this.size.z + S * this.size.z + y; - } - /** - * @function $3Dmol.VolumeData.getVal - * @param {number} x,y,z - the coordinates - * @returns - value closest to provided coordinate; zero if coordinate invalid - */ - getVal(c, S, y) { - let w = this.getIndex(c, S, y); - return w < 0 ? 0 : this.data[w]; - } - // parse cube data - cube(c) { - var S = c.split(/\r?\n/); - if (!(S.length < 6)) { - var y = (0, b.CUBE)(c, {}).modelData[0].cryst, w = S[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), L = parseFloat(w[0]), s = Math.abs(L); - this.origin = y.origin, this.size = y.size, this.unit = y.unit, this.matrix = y.matrix4; - var o = 6; - L < 0 && o++; - var A = S.splice(s + o).join(" "); - A = A.replace(/^\s+/, ""); - var p = A.split(/[\s\r]+/); - this.data = Float32Array.from(p, parseFloat); - } - } - //parse cp4 files - ccp4(c) { - var S = {}; - c = new Int8Array(c); - var y = new Int32Array(c.buffer, 0, 56), w = new Float32Array(c.buffer, 0, 56), L = new DataView(c.buffer); - if (S.MAP = String.fromCharCode(L.getUint8(208), L.getUint8(209), L.getUint8(210), L.getUint8(211)), S.MACHST = [L.getUint8(212), L.getUint8(213)], S.MACHST[0] === 17 && S.MACHST[1] === 17) - for (var s = c.byteLength, o = 0; o < s; o += 4) - L.setFloat32(o, L.getFloat32(o), !0); - S.NX = y[0], S.NY = y[1], S.NZ = y[2], S.MODE = y[3], S.NXSTART = y[4], S.NYSTART = y[5], S.NZSTART = y[6], S.MX = y[7], S.MY = y[8], S.MZ = y[9], S.xlen = w[10], S.ylen = w[11], S.zlen = w[12], S.alpha = w[13], S.beta = w[14], S.gamma = w[15], S.MAPC = y[16], S.MAPR = y[17], S.MAPS = y[18], S.DMIN = w[19], S.DMAX = w[20], S.DMEAN = w[21], S.ISPG = y[22], S.NSYMBT = y[23], S.LSKFLG = y[24], S.originX = w[49], S.originY = w[50], S.originZ = w[51], S.ARMS = w[54]; - var A = S, p = [ - A.xlen, - 0, - 0 - ], v = [ - A.ylen * Math.cos(Math.PI / 180 * A.gamma), - A.ylen * Math.sin(Math.PI / 180 * A.gamma), - 0 - ], a = [ - A.zlen * Math.cos(Math.PI / 180 * A.beta), - A.zlen * (Math.cos(Math.PI / 180 * A.alpha) - Math.cos(Math.PI / 180 * A.gamma) * Math.cos(Math.PI / 180 * A.beta)) / Math.sin(Math.PI / 180 * A.gamma), - 0 - ]; - a[2] = Math.sqrt(A.zlen * A.zlen * Math.sin(Math.PI / 180 * A.beta) * Math.sin(Math.PI / 180 * A.beta) - a[1] * a[1]); - var l = [0, p, v, a], g = [0, A.MX, A.MY, A.MZ], M = [0, A.MAPC, A.MAPR, A.MAPS]; - this.matrix = new f.Matrix4(), this.matrix.set(l[M[1]][0] / g[M[1]], l[M[2]][0] / g[M[2]], l[M[3]][0] / g[M[3]], 0, l[M[1]][1] / g[M[1]], l[M[2]][1] / g[M[2]], l[M[3]][1] / g[M[3]], 0, l[M[1]][2] / g[M[1]], l[M[2]][2] / g[M[2]], l[M[3]][2] / g[M[3]], 0, 0, 0, 0, 1), this.matrix = this.matrix.multiplyMatrices(this.matrix, new f.Matrix4().makeTranslation(A.NXSTART + A.originX, A.NYSTART + A.originY, A.NZSTART + A.originZ)), this.origin = new f.Vector3(0, 0, 0), this.unit = new f.Vector3(1, 1, 1), this.size = { x: S.NX, y: S.NY, z: S.NZ }, this.dimensionorder = [S.MAPC, S.MAPR, S.MAPS]; - var C = new Float32Array(c.buffer, 1024 + S.NSYMBT), T = S.NX, D = S.NY, I = S.NZ; - this.data = new Float32Array(T * D * I); - for (let B = 0; B < T; B++) - for (let P = 0; P < D; P++) - for (let z = 0; z < I; z++) - this.data[(B * D + P) * I + z] = C[(z * D + P) * T + B]; - } - } - } - ), - /***/ - "./src/VolumetricRender.ts": ( - /*!*********************************!*\ - !*** ./src/VolumetricRender.ts ***! - \*********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - GLVolumetricRender: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL/shapes */ - "./src/WebGL/shapes/index.ts" - ), f = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), u = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), b = r( - /*! ./colors */ - "./src/colors.ts" - ), h = r( - /*! ./GLShape */ - "./src/GLShape.ts" - ); - class _ { - static interpolateArray(c, S) { - function y(a, l, g) { - return a + (l - a) * g; - } - var w = [], L = (c.length - 1) / (S - 1); - w[0] = c[0]; - for (var s = 1; s < S - 1; s++) { - var o = s * L, A = Math.floor(o), p = Math.ceil(o), v = o - A; - w[s] = y(c[A], c[p], v); - } - return w[S - 1] = c[c.length - 1], w; - } - constructor(c, S) { - this.hidden = !1, this.boundingSphere = new n.Sphere(), this.renderedShapeObj = null, this.shapeObj = null, this.subsamples = 5, this.data = null, this.transferfunctionbuffer = [], this.min = 0, this.max = 0, S = S || {}; - var y = Object.assign([], S.transferfn); - this.subsamples = S.subsamples || 5; - let w = 256; - y.forEach(function(T) { - T.value = parseFloat(T.value); - }), y.sort(function(T, D) { - return T.value - D.value; - }), this.min = y[0].value, y.length == 0 && y.push(y[0]), this.max = y[y.length - 1].value; - var L, s, o, A, p, v, a, l, g, M; - for (let T = 0; T < y.length - 1; T++) - if (o = b.CC.color(y[T].color), A = b.CC.color(y[T + 1].color), g = y[T].opacity, M = y[T + 1].opacity, L = Math.floor((y[T].value - this.min) * w / (this.max - this.min)), s = Math.floor((y[T + 1].value - this.min) * w / (this.max - this.min)), L != s) { - p = _.interpolateArray([o.r * 255, A.r * 255], s - L), v = _.interpolateArray([o.g * 255, A.g * 255], s - L), a = _.interpolateArray([o.b * 255, A.b * 255], s - L), l = _.interpolateArray([g * 255, M * 255], s - L); - for (let D = 0; D < p.length; D++) - this.transferfunctionbuffer.push(p[D]), this.transferfunctionbuffer.push(v[D]), this.transferfunctionbuffer.push(a[D]), this.transferfunctionbuffer.push(l[D]); - } - if (this.transferfunctionbuffer = new Uint8ClampedArray(this.transferfunctionbuffer), c.matrix) { - let T = new f.Vector3(0, 0, 0), D = new f.Vector3(c.size.x, c.size.y, c.size.z), I = new f.Vector3(1, 1, 1); - T.applyMatrix4(c.matrix), D.applyMatrix4(c.matrix), I.applyMatrix4(c.matrix).sub(T), this.extent = [[T.x, T.y, T.z], [D.x, D.y, D.z]]; - for (let k = 1; k < 7; k++) - D.x = k & 1 ? c.size.x : 0, D.y = k & 2 ? c.size.y : 0, D.z = k & 4 ? c.size.z : 0, D.applyMatrix4(c.matrix), this.extent[0][0] = Math.min(this.extent[0][0], D.x), this.extent[0][1] = Math.min(this.extent[0][1], D.y), this.extent[0][2] = Math.min(this.extent[0][2], D.z), this.extent[1][0] = Math.max(this.extent[1][0], D.x), this.extent[1][1] = Math.max(this.extent[1][1], D.y), this.extent[1][2] = Math.max(this.extent[1][2], D.z); - let B = D.x - T.x, P = D.y - T.y, z = D.z - T.z; - this.maxdepth = Math.sqrt(B * B + P * P + z * z), this.minunit = Math.min(Math.min(I.x, I.y), I.z), this.texmatrix = new f.Matrix4().identity().scale({ x: c.size.x, y: c.size.y, z: c.size.z }), this.texmatrix = this.texmatrix.multiplyMatrices(c.matrix, this.texmatrix), this.texmatrix = this.texmatrix.getInverse(this.texmatrix); - } else { - this.texmatrix = new f.Matrix4().identity(); - let T = c.unit.x * c.size.x, D = c.unit.y * c.size.y, I = c.unit.z * c.size.z; - this.texmatrix.makeTranslation(-c.origin.x / T, -c.origin.y / D, -c.origin.z / I), this.texmatrix.scale({ x: 1 / T, y: 1 / D, z: 1 / I }), this.minunit = Math.min(Math.min(c.unit.x, c.unit.y), c.unit.z), this.extent = [ - [c.origin.x, c.origin.y, c.origin.z], - [c.origin.x + T, c.origin.y + D, c.origin.z + I] - ], this.maxdepth = Math.sqrt(T * T + D * D + I * I); - } - var C = new h.GLShape({}); - if (C.addBox({ - corner: { x: this.extent[0][0], y: this.extent[0][1], z: this.extent[0][2] }, - dimensions: { - w: this.extent[1][0] - this.extent[0][0], - h: this.extent[1][1] - this.extent[0][1], - d: this.extent[1][2] - this.extent[0][2] - } - }), this.geo = C.finalize(), this.boundingSphere.center = new f.Vector3((this.extent[0][0] + this.extent[1][0]) / 2, (this.extent[0][1] + this.extent[1][1]) / 2, (this.extent[0][2] + this.extent[1][2]) / 2), this.boundingSphere.radius = this.maxdepth / 2, S.coords !== void 0 && S.seldist !== void 0) { - let T = new Uint8Array(c.data.length), D = S.seldist, I = D * D; - for (let B = 0, P = S.coords.length; B < P; B++) { - let z = S.coords[B], k = z.x - D, N = z.y - D, R = z.z - D, U = z.x + D, W = z.y + D, G = z.z + D; - if (c.getIndex(k, N, R) >= 0 || c.getIndex(U, W, G) >= 0) - for (let F = k; F < U; F += this.minunit) - for (let V = N; V < W; V += this.minunit) - for (let J = R; J < G; J += this.minunit) { - let X = c.getIndex(F, V, J); - X >= 0 && !T[X] && (F - z.x) * (F - z.x) + (V - z.y) * (V - z.y) + (J - z.z) * (J - z.z) < I && (T[X] = 1); - } - } - for (let B = 0, P = c.data.length; B < P; B++) - T[B] == 0 && (c.data[B] = 1 / 0); - } - this.data = c; - } - /** - * Initialize webgl objects for rendering - * @param {Object3D} group - * - */ - globj(c) { - if (this.renderedShapeObj && (c.remove(this.renderedShapeObj), this.renderedShapeObj = null), !this.hidden) { - this.shapeObj = new u.Object3D(); - var S = null, y = new u.Texture(this.data, !0), w = new u.Texture(this.transferfunctionbuffer, !1); - y.needsUpdate = !0, w.needsUpdate = !0, w.flipY = !1, S = new u.VolumetricMaterial({ - transferfn: w, - transfermin: this.min, - transfermax: this.max, - map: y, - extent: this.extent, - maxdepth: this.maxdepth, - texmatrix: this.texmatrix, - unit: this.minunit, - subsamples: this.subsamples - }); - var L = new u.Mesh(this.geo, S); - this.shapeObj.add(L), this.renderedShapeObj = this.shapeObj.clone(), c.add(this.renderedShapeObj); - } - } - removegl(c) { - this.renderedShapeObj && (this.renderedShapeObj.geometry !== void 0 && this.renderedShapeObj.geometry.dispose(), this.renderedShapeObj.material !== void 0 && this.renderedShapeObj.material.dispose(), c.remove(this.renderedShapeObj), this.renderedShapeObj = null), this.shapeObj = null; - } - get position() { - return this.boundingSphere.center; - } - get x() { - return this.boundingSphere.center.x; - } - get y() { - return this.boundingSphere.center.y; - } - get z() { - return this.boundingSphere.center.z; - } - } - } - ), - /***/ - "./src/WebGL/Camera.ts": ( - /*!*****************************!*\ - !*** ./src/WebGL/Camera.ts ***! - \*****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Camera: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./core */ - "./src/WebGL/core/index.ts" - ), f = r( - /*! ./math */ - "./src/WebGL/math/index.ts" - ); - class u extends n.Object3D { - constructor(h = 50, _ = 1, E = 0.1, c = 2e3, S = !1) { - super(), this.projectionMatrix = new f.Matrix4(), this.projectionMatrixInverse = new f.Matrix4(), this.matrixWorldInverse = new f.Matrix4(), this.fov = h, this.aspect = _, this.near = E, this.far = c; - var y = this.position.z; - this.right = y * Math.tan(Math.PI / 180 * h), this.left = -this.right, this.top = this.right / this.aspect, this.bottom = -this.top, this.ortho = !!S, this.updateProjectionMatrix(); - } - lookAt(h) { - this.matrix.lookAt(this.position, h, this.up), this.rotationAutoUpdate && (this.useQuaternion === !1 && this.rotation instanceof f.Vector3 ? this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder) : console.error("Unimplemented math operation.")); - } - updateProjectionMatrix() { - this.ortho ? this.projectionMatrix.makeOrthographic(this.left, this.right, this.top, this.bottom, this.near, this.far) : this.projectionMatrix.makePerspective(this.fov, this.aspect, this.near, this.far), this.projectionMatrixInverse.getInverse(this.projectionMatrix); - } - } - } - ), - /***/ - "./src/WebGL/Fog.ts": ( - /*!**************************!*\ - !*** ./src/WebGL/Fog.ts ***! - \**************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Fog: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../colors */ - "./src/colors.ts" - ); - class f { - constructor(b, h = 1, _ = 1e3) { - this.name = "", this.color = new n.Color(b), this.near = h, this.far = _; - } - clone() { - return new f(this.color.getHex(), this.near, this.far); - } - } - } - ), - /***/ - "./src/WebGL/Renderer.ts": ( - /*!*******************************!*\ - !*** ./src/WebGL/Renderer.ts ***! - \*******************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Renderer: () => ( - /* binding */ - w - ) - /* harmony export */ - }); - var n = r( - /*! ./Camera */ - "./src/WebGL/Camera.ts" - ), f = r( - /*! ./constants/Sides */ - "./src/WebGL/constants/Sides.ts" - ), u = r( - /*! ./constants/TextureConstants */ - "./src/WebGL/constants/TextureConstants.ts" - ), b = r( - /*! ./core */ - "./src/WebGL/core/index.ts" - ), h = r( - /*! ../colors */ - "./src/colors.ts" - ), _ = r( - /*! ./materials */ - "./src/WebGL/materials/index.ts" - ), E = r( - /*! ./math */ - "./src/WebGL/math/index.ts" - ), c = r( - /*! ./objects */ - "./src/WebGL/objects/index.ts" - ), S = r( - /*! ./shaders */ - "./src/WebGL/shaders/index.ts" - ), y = r( - /*! ./SpritePlugin */ - "./src/WebGL/SpritePlugin.ts" - ); - class w { - constructor(s) { - this.context = null, this.devicePixelRatio = 1, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.autoUpdateObjects = !0, this.autoUpdateScene = !0, this.info = { - memory: { - programs: 0, - geometries: 0, - textures: 0 - }, - render: { - calls: 0, - vertices: 0, - faces: 0, - points: 0 - } - }, this._programs = [], this._programs_counter = 0, this._webglversion = 1, this._currentProgram = null, this._currentMaterialId = -1, this._currentGeometryGroupHash = null, this._currentCamera = null, this._geometryGroupCounter = 0, this._oldDoubleSided = -1, this._oldFlipSided = -1, this._oldDepthTest = -1, this._oldDepthWrite = -1, this._oldPolygonOffset = null, this._oldLineWidth = null, this._viewportWidth = 0, this._viewportHeight = 0, this._currentWidth = 0, this._currentHeight = 0, this._enabledAttributes = {}, this._projScreenMatrix = new E.Matrix4(), this._vector3 = new E.Vector3(), this._worldInverse = new E.Matrix4(), this._projInverse = new E.Matrix4(), this._textureMatrix = new E.Matrix4(), this._direction = new E.Vector3(), this._lightsNeedUpdate = !0, this._lights = { - ambient: [0, 0, 0], - directional: { - length: 0, - colors: [], - positions: [] - }, - point: { - length: 0, - colors: [], - positions: [], - distances: [] - }, - spot: { - length: 0, - colors: [], - positions: [], - distances: [], - directions: [], - anglesCos: [], - exponents: [] - }, - hemi: { - length: 0, - skyColors: [], - groundColors: [], - positions: [] - } - }, this.sprites = new y.SpritePlugin(), this._screenshader = null, this._vertexattribpos = null, this._screenQuadVBO = null, this._fb = null, this._targetTexture = null, this._depthTexture = null, s = s || {}, this.row = s.row, this.col = s.col, this.rows = s.rows, this.cols = s.cols, this._canvas = s.canvas !== void 0 ? s.canvas : document.createElement("canvas"), this._precision = s.precision !== void 0 ? s.precision : "highp", this._alpha = s.alpha !== void 0 ? s.alpha : !0, this._premultipliedAlpha = s.premultipliedAlpha !== void 0 ? s.premultipliedAlpha : !0, this._antialias = s.antialias !== void 0 ? s.antialias : !1, this._stencil = s.stencil !== void 0 ? s.stencil : !0, this._preserveDrawingBuffer = s.preserveDrawingBuffer !== void 0 ? s.preserveDrawingBuffer : !1, this._clearColor = s.clearColor !== void 0 ? new h.Color(s.clearColor) : new h.Color(0), this._clearAlpha = s.clearAlpha !== void 0 ? s.clearAlpha : 0, this._outlineMaterial = new _.MeshOutlineMaterial(s.outline), this._outlineSphereImposterMaterial = new _.SphereImposterOutlineMaterial(s.outline), this._outlineStickImposterMaterial = new _.StickImposterOutlineMaterial(s.outline), this._outlineEnabled = !!s.outline, this.domElement = this._canvas, this._canvas.id = s.id, this.initGL(), this.setDefaultGLState(), this.context = this._gl, this.isWebGL1() ? this._extInstanced = this._gl.getExtension("ANGLE_instanced_arrays") : this._extInstanced = { - vertexAttribDivisorANGLE: this._gl.vertexAttribDivisor.bind(this._gl), - drawElementsInstancedANGLE: this._gl.drawElementsInstanced.bind(this._gl) - }, this._extFragDepth = this._gl.getExtension("EXT_frag_depth"), this._extFloatLinear = this._gl.getExtension("OES_texture_float_linear"), this._extColorBufferFloat = this._gl.getExtension("EXT_color_buffer_float"), this.sprites.init(this); - } - // API - supportedExtensions() { - return { - supportsAIA: !!this._extInstanced, - supportsImposters: !!this._extFragDepth || !this.isWebGL1(), - regen: !1 - }; - } - getContext() { - return this._gl; - } - isLost() { - return this._gl.isContextLost(); - } - getPrecision() { - return this._precision; - } - setClearColorHex(s, o) { - this._clearColor.setHex(s), this._clearAlpha = o, this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha); - } - enableOutline(s) { - this._outlineMaterial = new _.MeshOutlineMaterial(s), this._outlineSphereImposterMaterial = new _.SphereImposterOutlineMaterial(s), this._outlineStickImposterMaterial = new _.StickImposterOutlineMaterial(s), this._outlineEnabled = !0; - } - disableOutline() { - this._outlineEnabled = !1; - } - setViewport() { - if (this.rows != null && this.cols != null && this.row != null && this.col != null) { - var s = this._canvas.width / this.cols, o = this._canvas.height / this.rows; - this._viewportWidth = s, this._viewportHeight = o, this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(s * this.col, o * this.row, s, o), this._gl.viewport(s * this.col, o * this.row, s, o); - } - } - setSize(s, o) { - if (this.devicePixelRatio = window.devicePixelRatio !== void 0 ? window.devicePixelRatio : 1, this._antialias && this.devicePixelRatio < 2 && (this.devicePixelRatio *= 2), this.rows != null && this.cols != null && this.row != null && this.col != null) { - var A = s / this.cols, p = o / this.rows; - this._canvas.width = s * this.devicePixelRatio, this._canvas.height = o * this.devicePixelRatio, this._viewportWidth = A * this.devicePixelRatio, this._viewportHeight = p * this.devicePixelRatio, this._canvas.style.width = s + "px", this._canvas.style.height = o + "px", this.setViewport(); - } else - this._viewportWidth = this._canvas.width = s * this.devicePixelRatio, this._viewportHeight = this._canvas.height = o * this.devicePixelRatio, this._canvas.style.width = s + "px", this._canvas.style.height = o + "px", this._gl.viewport(0, 0, this._gl.drawingBufferWidth, this._gl.drawingBufferHeight); - this.initFrameBuffer(); - } - clear(s, o, A) { - var p = 0; - (s === void 0 || s) && (p |= this._gl.COLOR_BUFFER_BIT), (o === void 0 || o) && (p |= this._gl.DEPTH_BUFFER_BIT), (A === void 0 || A) && (p |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(p); - } - clearTarget(s, o, A) { - this.clear(s, o, A); - } - setMaterialFaces(s, o) { - var A = s.side === f.DoubleSide, p = s.side === f.BackSide; - s.imposter || (p = o ? !p : p), this._oldDoubleSided !== A && (A ? this._gl.disable(this._gl.CULL_FACE) : this._gl.enable(this._gl.CULL_FACE), this._oldDoubleSided = A), this._oldFlipSided !== p && (p ? this._gl.frontFace(this._gl.CW) : this._gl.frontFace(this._gl.CCW), this._oldFlipSided = p), this._gl.cullFace(this._gl.BACK); - } - setDepthTest(s) { - this._oldDepthTest !== s && (s ? this._gl.enable(this._gl.DEPTH_TEST) : this._gl.disable(this._gl.DEPTH_TEST), this._oldDepthTest = s); - } - setDepthWrite(s) { - this._oldDepthWrite !== s && (this._gl.depthMask(s), this._oldDepthWrite = s); - } - setBlending(s) { - s ? (this._gl.enable(this._gl.BLEND), this._gl.blendEquationSeparate(this._gl.FUNC_ADD, this._gl.FUNC_ADD), this._gl.blendFuncSeparate(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA)) : this._gl.disable(this._gl.BLEND); - } - // TODO: need to set up shader attributes and uniforms as attributes on - // material object after attaching prgm - // We need to attach appropriate uniform variables to material after shaders - // have been chosen - initMaterial(s, o, A, p) { - s.addEventListener("dispose", this.onMaterialDispose.bind(this)); - var v, a; - if (a = s.shaderID, a) { - var l = S.ShaderLib[a]; - s.vertexShader = l.vertexShader, s.fragmentShader = l.fragmentShader, s.uniforms = S.ShaderUtils.clone(l.uniforms); - } - v = { - wireframe: s.wireframe, - fragdepth: s.imposter, - volumetric: s.volumetric - }, s.program = this.buildProgram(s.fragmentShader, s.vertexShader, s.uniforms, v); - } - renderBuffer(s, o, A, p, v, a) { - if (p.visible) { - var l, g; - if (l = this.setProgram(s, o, A, p, a, this), !!l) { - g = l.attributes; - var M = !1, C = p.wireframe ? 1 : 0, T = v.id * 16777215 + l.id * 2 + C; - T !== this._currentGeometryGroupHash && (this._currentGeometryGroupHash = T, M = !0), M && (this.disableAttributes(), g.position >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglVertexBuffer), this.enableAttribute(g.position), this._gl.vertexAttribPointer(g.position, 3, this._gl.FLOAT, !1, 0, 0)), g.color >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglColorBuffer), this.enableAttribute(g.color), this._gl.vertexAttribPointer(g.color, 3, this._gl.FLOAT, !1, 0, 0)), g.normal >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglNormalBuffer), this.enableAttribute(g.normal), this._gl.vertexAttribPointer(g.normal, 3, this._gl.FLOAT, !1, 0, 0)), g.offset >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglOffsetBuffer), this.enableAttribute(g.offset), this._gl.vertexAttribPointer(g.offset, 3, this._gl.FLOAT, !1, 0, 0)), g.radius >= 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglRadiusBuffer), this.enableAttribute(g.radius), this._gl.vertexAttribPointer(g.radius, 1, this._gl.FLOAT, !1, 0, 0))); - var D, I; - if (a instanceof c.Mesh) { - if (p.shaderID === "instanced") { - var B = p.sphere.geometryGroups[0]; - M && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, B.vertexArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, v.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, B.normalArray, this._gl.STATIC_DRAW), this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, B.faceArray, this._gl.STATIC_DRAW)), D = B.faceidx, this._extInstanced.vertexAttribDivisorANGLE(g.offset, 1), this._extInstanced.vertexAttribDivisorANGLE(g.radius, 1), this._extInstanced.vertexAttribDivisorANGLE(g.color, 1), this._extInstanced.drawElementsInstancedANGLE(this._gl.TRIANGLES, D, this._gl.UNSIGNED_SHORT, 0, v.radiusArray.length), this._extInstanced.vertexAttribDivisorANGLE(g.offset, 0), this._extInstanced.vertexAttribDivisorANGLE(g.radius, 0), this._extInstanced.vertexAttribDivisorANGLE(g.color, 0); - } else - p.wireframe ? (I = v.lineidx, this.setLineWidth(p.wireframeLinewidth), M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglLineBuffer), this._gl.drawElements(this._gl.LINES, I, this._gl.UNSIGNED_SHORT, 0)) : (D = v.faceidx, M && this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, v.__webglFaceBuffer), this._gl.drawElements(this._gl.TRIANGLES, D, this._gl.UNSIGNED_SHORT, 0)); - this.info.render.calls++, this.info.render.vertices += D, this.info.render.faces += D / 3; - } else - a instanceof c.Line && (I = v.vertices, this.setLineWidth(p.linewidth), this._gl.drawArrays(this._gl.LINES, 0, I), this.info.render.calls++); - } - } - } - render(s, o, A) { - if (!(o instanceof n.Camera)) { - console.error("Renderer.render: camera is not an instance of Camera."); - return; - } - var p, v, a, l, g, M = s.__lights, C = s.fog; - this._currentMaterialId = -1, this._lightsNeedUpdate = !0, this.autoUpdateScene && s.updateMatrixWorld(), o.parent === void 0 && o.updateMatrixWorld(), o.matrixWorldInverse.getInverse(o.matrixWorld), this._projScreenMatrix.multiplyMatrices(o.projectionMatrix, o.matrixWorldInverse), this.autoUpdateObjects && this.initWebGLObjects(s), this.info.render.calls = 0, this.info.render.vertices = 0, this.info.render.faces = 0, this.info.render.points = 0, this._currentWidth = this._viewportWidth, this._currentHeight = this._viewportHeight, this.setViewport(), this.setFrameBuffer(), (this.autoClear || A) && (this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha), this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil)), g = s.__webglObjects; - var T = !1; - for (p = 0, v = g.length; p < v; p++) - a = g[p], l = a.object, a.render = !1, l.visible && (this.setupMatrices(l, o), this.unrollBufferMaterial(a), a.render = !0, a.volumetric && (T = !0)); - var D = null; - this.setBlending(!1), this.renderObjects(s.__webglObjects, !0, "opaque", o, M, C, !1, D), this.renderSprites(s, o, !1), this.renderObjects(s.__webglObjects, !0, "blank", o, M, C, !0, D), this.renderObjects(s.__webglObjects, !1, "transparent", o, M, C, !0, D), T && this._fb && (this.reinitFrameBuffer(), this.renderObjects(s.__webglObjects, !1, "volumetric", o, M, C, !0, D)), this.renderFrameBuffertoScreen(), this.setDepthTest(!0), this.setDepthWrite(!0), this.renderSprites(s, o, !0); - } - //reinitialize framebuffer without the depth texture attached so we can read to it - //do not allocate new textures - reinitFrameBuffer() { - this.isWebGL1() || (this._fb = this._gl.createFramebuffer(), this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._fb), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._targetTexture, 0)); - } - //setup framebuffer for drawing into, assumes buffers already allocated - setFrameBuffer() { - if (this.isWebGL1() || !this._fb) - return; - let s = this._viewportWidth, o = this._viewportHeight; - this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, s, o), this._gl.viewport(0, 0, s, o), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, s, o, 0, this._gl.RGBA, this._gl.UNSIGNED_BYTE, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.DEPTH_COMPONENT32F, s, o, 0, this._gl.DEPTH_COMPONENT, this._gl.FLOAT, null), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._fb), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._targetTexture, 0), this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._depthTexture, 0); - } - //allocate buffers for framebuffer, needs to be called with every resize - initFrameBuffer() { - if (this.isWebGL1()) - return; - let s = this._viewportWidth, o = this._viewportHeight; - this._gl.enable(this._gl.SCISSOR_TEST), this._gl.scissor(0, 0, s, o), this._gl.viewport(0, 0, s, o), this._targetTexture = this._gl.createTexture(), this._depthTexture = this._gl.createTexture(), this._fb = this._gl.createFramebuffer(); - var A = S.ShaderLib.screen; - this._screenshader = this.buildProgram(A.fragmentShader, A.vertexShader, A.uniforms, {}), this._vertexattribpos = this._gl.getAttribLocation(this._screenshader, "vertexPosition"); - var p = [ - // First triangle: - 1, - 1, - -1, - 1, - -1, - -1, - // Second triangle: - -1, - -1, - 1, - -1, - 1, - 1 - ]; - this._screenQuadVBO = this._gl.createBuffer(), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(p), this._gl.STATIC_DRAW); - } - renderFrameBuffertoScreen() { - this.isWebGL1() || this._fb === null || (this.setViewport(), this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, null), this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT), this._gl.frontFace(this._gl.CCW), this._gl.cullFace(this._gl.BACK), this._gl.useProgram(this._screenshader), this._currentProgram = this._screenshader, this.setDepthTest(-1), this.setDepthWrite(-1), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._screenQuadVBO), this._gl.enableVertexAttribArray(this._vertexattribpos), this._gl.vertexAttribPointer(this._vertexattribpos, 2, this._gl.FLOAT, !1, 0, 0), this._gl.activeTexture(this._gl.TEXTURE0), this._gl.bindTexture(this._gl.TEXTURE_2D, this._targetTexture), this._gl.drawArrays(this._gl.TRIANGLES, 0, 6)); - } - initWebGLObjects(s) { - if (s.__webglObjects || (s.__webglObjects = [], s.__webglObjectsImmediate = [], s.__webglSprites = [], s.__webglFlares = []), s.__objectsAdded.length) { - for (; s.__objectsAdded.length; ) - this.addObject(s.__objectsAdded[0], s), s.__objectsAdded.splice(0, 1); - this._currentGeometryGroupHash = -1; - } - for (; s.__objectsRemoved.length; ) - this.removeObject(s.__objectsRemoved[0], s), s.__objectsRemoved.splice(0, 1); - for (var o = 0, A = s.__webglObjects.length; o < A; o++) - this.updateObject(s.__webglObjects[o].object); - } - getYRatio() { - return this.rows !== void 0 && this.row !== void 0 ? this.rows : 1; - } - getXRatio() { - return this.cols !== void 0 && this.col !== void 0 ? this.cols : 1; - } - getAspect(s, o) { - (s == null || o == null) && (s = this._canvas.width, o = this._canvas.height); - var A = s / o; - if (this.rows != null && this.cols != null && this.row != null && this.col != null) { - var p = s / this.cols, v = o / this.rows; - A = p / v; - } - return A; - } - setTexture(s, o, A) { - if (s.needsUpdate) { - s.__webglInit || (s.__webglInit = !0, s.addEventListener("dispose", this.onTextureDispose.bind(this)), s.__webglTexture = this._gl.createTexture(), this.info.memory.textures++), this._gl.activeTexture(this._gl.TEXTURE0 + o); - var p = A ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D; - this._gl.bindTexture(p, s.__webglTexture), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, s.flipY), this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, s.premultiplyAlpha), this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, s.unpackAlignment), this._gl.pixelStorei(this._gl.PACK_ALIGNMENT, s.unpackAlignment); - var v = this.paramToGL(s.format), a = this.paramToGL(s.type); - if (A) - this.setTextureParameters(this._gl.TEXTURE_3D, s), this._gl.texImage3D(this._gl.TEXTURE_3D, 0, this._gl.R32F, s.image.size.z, s.image.size.y, s.image.size.x, 0, this._gl.RED, this._gl.FLOAT, s.image.data); - else { - var l = s.image, g = l.width, M = l.height; - typeof g > "u" && (g = l.length, v == this._gl.RGBA && (g /= 4), M = 1), this.setTextureParameters(this._gl.TEXTURE_2D, s), this.isWebGL1() ? this._gl.texImage2D(this._gl.TEXTURE_2D, 0, v, v, a, s.image) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, v, g, M, 0, v, a, s.image); - } - s.needsUpdate = !1, s.onUpdate && s.onUpdate(); - } else - this._gl.activeTexture(this._gl.TEXTURE0 + o), A ? this._gl.bindTexture(this._gl.TEXTURE_3D, s.__webglTexture) : this._gl.bindTexture(this._gl.TEXTURE_2D, s.__webglTexture); - } - supportsVolumetric() { - return !this.isWebGL1(); - } - enableAttribute(s) { - this._enabledAttributes[s] || (this._gl.enableVertexAttribArray(s), this._enabledAttributes[s] = !0); - } - disableAttributes() { - for (let s in this._enabledAttributes) - this._enabledAttributes[s] && (this._gl.disableVertexAttribArray(s), this._enabledAttributes[s] = !1); - } - setPolygonOffset(s, o, A) { - this._oldPolygonOffset !== s && (s ? this._gl.enable(this._gl.POLYGON_OFFSET_FILL) : this._gl.disable(this._gl.POLYGON_OFFSET_FILL)); - } - setLineWidth(s) { - s !== this._oldLineWidth && (this._gl.lineWidth(s), this._oldLineWidth = s); - } - deallocateGeometry(s) { - if (s.__webglInit = void 0, s.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(s.__webglVertexBuffer), s.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(s.__webglColorBuffer), s.geometryGroups !== void 0) - for (var o = 0, A = s.groups; o < A; o++) { - var p = s.geometryGroups[o]; - p.__webglVertexBuffer !== void 0 && this._gl.deleteBuffer(p.__webglVertexBuffer), p.__webglColorBuffer !== void 0 && this._gl.deleteBuffer(p.__webglColorBuffer), p.__webglNormalBuffer !== void 0 && this._gl.deleteBuffer(p.__webglNormalBuffer), p.__webglFaceBuffer !== void 0 && this._gl.deleteBuffer(p.__webglFaceBuffer), p.__webglLineBuffer !== void 0 && this._gl.deleteBuffer(p.__webglLineBuffer); - } - } - deallocateMaterial(s) { - var o = s.program; - if (o !== void 0) { - s.program = void 0; - var A, p, v, a = !1; - for (A = 0, p = this._programs.length; A < p; A++) - if (v = this._programs[A], v.program === o) { - v.usedTimes--, v.usedTimes === 0 && (a = !0); - break; - } - if (a === !0) { - var l = []; - for (A = 0, p = this._programs.length; A < p; A++) - v = this._programs[A], v.program !== o && l.push(v); - this._programs = l, this._gl.deleteProgram(o), this.info.memory.programs--; - } - } - } - deallocateTexture(s) { - if (s.image && s.image.__webglTextureCube) - this._gl.deleteTexture(s.image.__webglTextureCube); - else { - if (!s.__webglInit) - return; - s.__webglInit = !1, this._gl.deleteTexture(s.__webglTexture); - } - } - onGeometryDispose(s) { - var o = s.target; - o.removeEventListener("dispose", this.onGeometryDispose), this.deallocateGeometry(o), this.info.memory.geometries--; - } - onTextureDispose(s) { - var o = s.target; - o.removeEventListener("dispose", this.onTextureDispose), this.deallocateTexture(o), this.info.memory.textures--; - } - onMaterialDispose(s) { - var o = s.target; - o.removeEventListener("dispose", this.onMaterialDispose), this.deallocateMaterial(o); - } - // Compile and return shader - getShader(s, o) { - var A; - return !this.isWebGL1() && !o.startsWith("#version") && (o = o.replace(/gl_FragDepthEXT/g, "gl_FragDepth"), s == "fragment" ? o = o.replace(/varying/g, "in") : o = o.replace(/varying/g, "out"), o = o.replace(/attribute/g, "in"), o = o.replace(/texture2D/g, "texture"), o = o.replace(/\/\/DEFINEFRAGCOLOR/g, "out vec4 glFragColor;"), o = o.replace(/gl_FragColor/g, "glFragColor"), o = `#version 300 es -` + o), s === "fragment" ? A = this._gl.createShader(this._gl.FRAGMENT_SHADER) : s === "vertex" && (A = this._gl.createShader(this._gl.VERTEX_SHADER)), A == null ? null : (this._gl.shaderSource(A, o), this._gl.compileShader(A), this._gl.getShaderParameter(A, this._gl.COMPILE_STATUS) ? A : (console.error(this._gl.getShaderInfoLog(A)), console.error("could not initialize shader"), null)); - } - // Compile appropriate shaders (if necessary) from source code and attach to - // gl program. - buildProgram(s, o, A, p) { - var v, a, l, g, M = []; - M.push(s), M.push(o); - for (v in p) - M.push(v), M.push(p[v]); - for (g = M.join(), v = 0, a = this._programs.length; v < a; v++) { - var C = this._programs[v]; - if (C.code === g) - return C.usedTimes++, C.program; - } - if (this.isWebGL1() && p.volumetric) - throw new Error("Volumetric rendering requires webgl2 which is not supported by your hardware."); - if (l = this._gl.createProgram(), l == null) - return null; - var T = this._precision, D = "precision " + T + " float;", I = [ - p.volumetric ? "#version 300 es" : "", - D - ].join(` -`), B = [ - p.volumetric ? "#version 300 es" : "", - p.fragdepth && this.isWebGL1() ? "#extension GL_EXT_frag_depth: enable" : "", - p.wireframe ? "#define WIREFRAME 1" : "", - D - ].join(` -`), P = this.getShader("fragment", B + s), z = this.getShader("vertex", I + o); - z != null && this._gl.attachShader(l, z), P != null && this._gl.attachShader(l, P), this._gl.linkProgram(l), this._gl.getProgramParameter(l, this._gl.LINK_STATUS) || console.error("Could not initialize shader"), l.uniforms = {}, l.attributes = {}; - var k, N, R; - k = [ - "viewMatrix", - "modelViewMatrix", - "projectionMatrix", - "normalMatrix" - ]; - for (N in A) - k.push(N); - for (R = 0; R < k.length; R++) { - var U = k[R]; - l.uniforms[U] = this._gl.getUniformLocation(l, U); - } - for (k = [ - "position", - "normal", - "color", - "lineDistance", - "offset", - "radius" - ], R = 0; R < k.length; R++) { - var W = k[R]; - l.attributes[W] = this._gl.getAttribLocation(l, W); - } - return l.id = this._programs_counter++, this._programs.push({ - program: l, - code: g, - usedTimes: 1 - }), this.info.memory.programs = this._programs.length, l; - } - setProgram(s, o, A, p, v, a) { - if (p.needsUpdate && (p.program && this.deallocateMaterial(p), this.initMaterial(p, o, A, v), p.needsUpdate = !1), p.program == null) - return null; - var l = !1, g = p.program, M = g.uniforms, C = p.uniforms; - if (g != this._currentProgram && (this._gl.useProgram(g), this._currentProgram = g, l = !0), p.id != this._currentMaterialId && (this._currentMaterialId = p.id, l = !0), s != this._currentCamera && (this._currentCamera = s, l = !0), this._gl.uniformMatrix4fv(M.projectionMatrix, !1, s.projectionMatrix.elements), this._gl.uniformMatrix4fv(M.modelViewMatrix, !1, v._modelViewMatrix.elements), this._gl.uniformMatrix3fv(M.normalMatrix, !1, v._normalMatrix.elements), l) { - if (C.fogColor.value = A.color, C.fogNear.value = A.near, C.fogFar.value = A.far, p.shaderID.startsWith("lambert") || p.shaderID === "instanced" || p.shaderID.endsWith("imposter")) - this._gl.uniformMatrix4fv(M.viewMatrix, !1, s.matrixWorldInverse.elements), this._lightsNeedUpdate && (this.setupLights(g, o), this._lightsNeedUpdate = !1), C.directionalLightColor.value = this._lights.directional.colors, C.directionalLightDirection.value = this._lights.directional.positions; - else if (p.shaderID.endsWith("outline")) - C.outlineColor.value = p.outlineColor, C.outlineWidth.value = p.outlineWidth, C.outlinePushback.value = p.outlinePushback; - else if (p.shaderID === "volumetric") { - v._modelViewMatrix.getScale(this._direction), this._worldInverse.getInverse(v._modelViewMatrix), this._projInverse.getInverse(s.projectionMatrix), this._textureMatrix.multiplyMatrices(v.material.texmatrix, this._worldInverse), this._gl.uniformMatrix4fv(M.textmat, !1, this._textureMatrix.elements), this._gl.uniformMatrix4fv(M.projinv, !1, this._projInverse.elements); - let T = Math.min(Math.min(this._direction.x, this._direction.y), this._direction.z); - C.step.value = v.material.unit * T, C.maxdepth.value = v.material.maxdepth * T, C.transfermax.value = v.material.transfermax, C.transfermin.value = v.material.transfermin, C.subsamples.value = v.material.subsamples, a.setTexture(v.material.transferfn, 4, !1), a.setTexture(v.material.map, 3, !0), this._gl.activeTexture(this._gl.TEXTURE5), this._gl.bindTexture(this._gl.TEXTURE_2D, this._depthTexture); - } - C.opacity.value = p.opacity, this.loadMaterialUniforms(M, C); - } - return g; - } - loadMaterialUniforms(s, o) { - var A, p, v, a; - for (A in o) - s[A] && (p = o[A].type, v = o[A].value, a = s[A], p === "f" ? this._gl.uniform1f(a, v) : p === "i" ? this._gl.uniform1i(a, v) : p === "fv" ? this._gl.uniform3fv(a, v) : p === "c" ? this._gl.uniform3f(a, v.r, v.g, v.b) : p === "f4" && this._gl.uniform4f(a, v[0], v[1], v[2], v[3])); - } - // Objects adding - addObject(s, o) { - var A, p, v, a; - if (!s.__webglInit && (s.__webglInit = !0, s._modelViewMatrix = new E.Matrix4(), s._normalMatrix = new E.Matrix3(), s.geometry !== void 0 && s.geometry.__webglInit === void 0 && (s.geometry.__webglInit = !0, s.geometry.addEventListener("dispose", this.onGeometryDispose.bind(this))), s instanceof c.Mesh || s instanceof c.Line)) - for (v = s.geometry, A = 0, p = v.geometryGroups.length; A < p; A++) - a = v.geometryGroups[A], a.id = this._geometryGroupCounter++, a.__webglVertexBuffer || (s instanceof c.Mesh ? (this.createMeshBuffers(a), v.elementsNeedUpdate = !0, v.normalsNeedUpdate = !0) : s instanceof c.Line && this.createLineBuffers(a), v.verticesNeedUpdate = !0, v.colorsNeedUpdate = !0); - if (!s.__webglActive) { - if (s instanceof c.Mesh || s instanceof c.Line) - for (v = s.geometry, A = 0, p = v.geometryGroups.length; A < p; A++) - a = v.geometryGroups[A], this.addBuffer(o.__webglObjects, a, s); - else - s instanceof c.Sprite && o.__webglSprites.push(s); - s.__webglActive = !0; - } - } - updateObject(s) { - var o = s.geometry, A; - if (s instanceof c.Mesh || s instanceof c.Line) { - for (var p = 0, v = o.geometryGroups.length; p < v; p++) - A = o.geometryGroups[p], (o.verticesNeedUpdate || o.elementsNeedUpdate || o.colorsNeedUpdate || o.normalsNeedUpdate) && this.setBuffers(A, this._gl.STATIC_DRAW); - o.verticesNeedUpdate = !1, o.elementsNeedUpdate = !1, o.normalsNeedUpdate = !1, o.colorsNeedUpdate = !1, o.buffersNeedUpdate = !1; - } - } - removeObject(s, o) { - s instanceof c.Mesh || s instanceof c.Line ? this.removeInstances(o.__webglObjects, s) : s instanceof c.Sprite && this.removeInstancesDirect(o.__webglSprites, s), s.__webglActive = !1; - } - removeInstances(s, o) { - for (var A = s.length - 1; A >= 0; --A) - s[A].object === o && s.splice(A, 1); - } - removeInstancesDirect(s, o) { - for (var A = s.length - 1; A >= 0; --A) - s[A] === o && s.splice(A, 1); - } - unrollBufferMaterial(s) { - var o = s.object, A = o.material; - if (A.volumetric) - s.opaque = null, s.transparent = null, s.volumetric = A; - else if (A.transparent) { - if (s.opaque = null, s.volumetric = null, s.transparent = A, !A.wireframe) { - var p = A.clone(); - p.opacity = 0, s.blank = p; - } - } else - s.opaque = A, s.transparent = null, s.volumetric = null; - } - setBuffers(s, o) { - var A = s.vertexArray, p = s.colorArray; - if (s.__webglOffsetBuffer !== void 0 ? (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglOffsetBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, A, o)) : (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglVertexBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, A, o)), this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglColorBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, p, o), s.normalArray && s.__webglNormalBuffer !== void 0) { - var v = s.normalArray; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglNormalBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, v, o); - } - if (s.radiusArray && s.__webglRadiusBuffer !== void 0 && (this._gl.bindBuffer(this._gl.ARRAY_BUFFER, s.__webglRadiusBuffer), this._gl.bufferData(this._gl.ARRAY_BUFFER, s.radiusArray, o)), s.faceArray && s.__webglFaceBuffer !== void 0) { - var a = s.faceArray; - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, s.__webglFaceBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, a, o); - } - if (s.lineArray && s.__webglLineBuffer !== void 0) { - var l = s.lineArray; - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, s.__webglLineBuffer), this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, l, o); - } - } - // Creates appropriate gl buffers for geometry chunk - // TODO: do we need line buffer for mesh objects? - // Also, can we integrate this with createLineBuffers? - createMeshBuffers(s) { - s.radiusArray && (s.__webglRadiusBuffer = this._gl.createBuffer()), s.useOffset && (s.__webglOffsetBuffer = this._gl.createBuffer()), s.__webglVertexBuffer = this._gl.createBuffer(), s.__webglNormalBuffer = this._gl.createBuffer(), s.__webglColorBuffer = this._gl.createBuffer(), s.__webglFaceBuffer = this._gl.createBuffer(), s.__webglLineBuffer = this._gl.createBuffer(), this.info.memory.geometries++; - } - createLineBuffers(s) { - s.__webglVertexBuffer = this._gl.createBuffer(), s.__webglColorBuffer = this._gl.createBuffer(), this.info.memory.geometries++; - } - addBuffer(s, o, A) { - s.push({ - buffer: o, - object: A, - opaque: null, - transparent: null - }); - } - setupMatrices(s, o) { - s._modelViewMatrix.multiplyMatrices(o.matrixWorldInverse, s.matrixWorld), s._normalMatrix.getInverse(s._modelViewMatrix), s._normalMatrix.transpose(); - } - // Fallback filters for non-power-of-2 textures - filterFallback(s) { - return this._gl.LINEAR; - } - setTextureParameters(s, o) { - s == this._gl.TEXTURE_2D ? (this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this.filterFallback(o.magFilter)), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this.filterFallback(o.minFilter))) : (this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE), this._gl.texParameteri(s, this._gl.TEXTURE_WRAP_R, this._gl.CLAMP_TO_EDGE), this._extColorBufferFloat && this._extFloatLinear ? (this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR)) : (this._gl.texParameteri(s, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST), this._gl.texParameteri(s, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST))); - } - // Map constants to WebGL constants - paramToGL(s) { - return s === u.UnsignedByteType ? this._gl.UNSIGNED_BYTE : s === u.RGBAFormat ? this._gl.RGBA : s === u.NearestFilter ? this._gl.NEAREST : 0; - } - setupLights(s, o) { - var A, p, v, a = 0, l = 0, g = 0, M, C, T = this._lights, D = T.directional.colors, I = T.directional.positions, B = 0, P = 0; - for (A = 0, p = o.length; A < p; A++) - if (v = o[A], M = v.color, C = v.intensity, v instanceof b.Light) { - if (this._direction.getPositionFromMatrix(v.matrixWorld), this._vector3.getPositionFromMatrix(v.target.matrixWorld), this._direction.sub(this._vector3), this._direction.normalize(), this._direction.x === 0 && this._direction.y === 0 && this._direction.z === 0) - continue; - I[P] = this._direction.x, I[P + 1] = this._direction.y, I[P + 2] = this._direction.z, D[P] = M.r * C, D[P + 1] = M.g * C, D[P + 2] = M.b * C, P += 3, B++; - } - T.ambient[0] = a, T.ambient[1] = l, T.ambient[2] = g, T.directional.length = B; - } - initGL() { - try { - if (!(this._gl = this._canvas.getContext("webgl2", { - alpha: this._alpha, - premultipliedAlpha: this._premultipliedAlpha, - antialias: this._antialias, - stencil: this._stencil, - preserveDrawingBuffer: this._preserveDrawingBuffer - })) && !(this._gl = this._canvas.getContext("experimental-webgl", { - alpha: this._alpha, - premultipliedAlpha: this._premultipliedAlpha, - antialias: this._antialias, - stencil: this._stencil, - preserveDrawingBuffer: this._preserveDrawingBuffer - })) && !(this._gl = this._canvas.getContext("webgl", { - alpha: this._alpha, - premultipliedAlpha: this._premultipliedAlpha, - antialias: this._antialias, - stencil: this._stencil, - preserveDrawingBuffer: this._preserveDrawingBuffer - }))) - throw "Error creating WebGL context."; - var s = this._gl.getParameter(this._gl.VERSION); - this._webglversion = parseInt(s[6]); - } catch (o) { - console.error(o); - } - } - isWebGL1() { - return this._webglversion == 1; - } - setDefaultGLState() { - this._gl.clearColor(0, 0, 0, 1), this._gl.clearDepth(1), this._gl.clearStencil(0), this._gl.enable(this._gl.DEPTH_TEST), this._gl.depthFunc(this._gl.LEQUAL), this._gl.frontFace(this._gl.CCW), this._gl.cullFace(this._gl.BACK), this._gl.enable(this._gl.CULL_FACE), this._gl.enable(this._gl.BLEND), this._gl.blendEquation(this._gl.FUNC_ADD), this._gl.blendFunc(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA), this._gl.clearColor(this._clearColor.r, this._clearColor.g, this._clearColor.b, this._clearAlpha); - } - // rendering - renderObjects(s, o, A, p, v, a, l, D) { - var M, C, T, D, I, B, P; - o ? (I = s.length - 1, B = -1, P = -1) : (I = 0, B = s.length, P = 1); - for (var z = I; z !== B; z += P) - if (M = s[z], M.render) { - if (C = M.object, T = M.buffer, D = M[A], !D) - continue; - l && this.setBlending(!0), this.setDepthTest(D.depthTest), this.setDepthWrite(D.depthWrite), this.setPolygonOffset(D.polygonOffset, D.polygonOffsetFactor, D.polygonOffsetUnits); - var k = C._modelViewMatrix.isReflected(); - this.setMaterialFaces(D, k), this.renderBuffer(p, v, a, D, T, C), (this._outlineEnabled || D.outline) && (D.shaderID == "sphereimposter" ? this.renderBuffer(p, v, a, this._outlineSphereImposterMaterial, T, C) : D.shaderID == "stickimposter" ? this.renderBuffer(p, v, a, this._outlineStickImposterMaterial, T, C) : !D.wireframe && D.shaderID !== "basic" && D.opacity !== 0 && this.renderBuffer(p, v, a, this._outlineMaterial, T, C)); - } - } - renderSprites(s, o, A) { - this._currentGeometryGroupHash = -1, this._currentProgram = null, this._currentCamera = null, this._oldDepthWrite = -1, this._oldDepthTest = -1, this._oldDoubleSided = -1, this._currentMaterialId = -1, this._oldFlipSided = -1, this._lightsNeedUpdate = !0, this.sprites.render(s, o, this._currentWidth, this._currentHeight, A), this._currentGeometryGroupHash = -1, this._currentProgram = null, this._currentCamera = null, this._oldDepthWrite = -1, this._oldDepthTest = -1, this._oldDoubleSided = -1, this._currentMaterialId = -1, this._oldFlipSided = -1; - } - } - } - ), - /***/ - "./src/WebGL/SpritePlugin.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/SpritePlugin.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SpritePlugin: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./shaders/index */ - "./src/WebGL/shaders/index.ts" - ); - class f { - constructor() { - this.sprite = { - vertices: null, - faces: null, - vertexBuffer: null, - elementBuffer: null, - program: null, - attributes: {}, - uniforms: null - }; - } - init(h) { - this.gl = h.context, this.renderer = h, this.precision = h.getPrecision(), this.sprite.vertices = new Float32Array(16), this.sprite.faces = new Uint16Array(6); - var _ = 0; - this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = -1, this.sprite.vertices[_++] = 1, this.sprite.vertices[_++] = 0, this.sprite.vertices[_++] = 1, _ = 0, this.sprite.faces[_++] = 0, this.sprite.faces[_++] = 1, this.sprite.faces[_++] = 2, this.sprite.faces[_++] = 0, this.sprite.faces[_++] = 2, this.sprite.faces[_++] = 3, this.sprite.vertexBuffer = this.gl.createBuffer(), this.sprite.elementBuffer = this.gl.createBuffer(), this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.sprite.vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, this.sprite.vertices, this.gl.STATIC_DRAW), this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.elementBuffer), this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.faces, this.gl.STATIC_DRAW), this.sprite.program = this.createProgram( - n.ShaderLib.sprite, - this.precision || 1 - /** added default to single precision */ - ), this.sprite.attributes = {}; - const E = {}; - this.sprite.attributes.position = this.gl.getAttribLocation(this.sprite.program, "position"), this.sprite.attributes.uv = this.gl.getAttribLocation(this.sprite.program, "uv"), E.uvOffset = this.gl.getUniformLocation(this.sprite.program, "uvOffset"), E.uvScale = this.gl.getUniformLocation(this.sprite.program, "uvScale"), E.rotation = this.gl.getUniformLocation(this.sprite.program, "rotation"), E.scale = this.gl.getUniformLocation(this.sprite.program, "scale"), E.alignment = this.gl.getUniformLocation(this.sprite.program, "alignment"), E.color = this.gl.getUniformLocation(this.sprite.program, "color"), E.map = this.gl.getUniformLocation(this.sprite.program, "map"), E.opacity = this.gl.getUniformLocation(this.sprite.program, "opacity"), E.useScreenCoordinates = this.gl.getUniformLocation(this.sprite.program, "useScreenCoordinates"), E.screenPosition = this.gl.getUniformLocation(this.sprite.program, "screenPosition"), E.modelViewMatrix = this.gl.getUniformLocation(this.sprite.program, "modelViewMatrix"), E.projectionMatrix = this.gl.getUniformLocation(this.sprite.program, "projectionMatrix"), E.fogType = this.gl.getUniformLocation(this.sprite.program, "fogType"), E.fogDensity = this.gl.getUniformLocation(this.sprite.program, "fogDensity"), E.fogNear = this.gl.getUniformLocation(this.sprite.program, "fogNear"), E.fogFar = this.gl.getUniformLocation(this.sprite.program, "fogFar"), E.fogColor = this.gl.getUniformLocation(this.sprite.program, "fogColor"), E.alphaTest = this.gl.getUniformLocation(this.sprite.program, "alphaTest"), this.sprite.uniforms = E; - } - render(h, _, E, c, S) { - var y, w, L, s, o, A, p, v, a, l; - if (!this.gl) - throw new Error("WebGLRenderer not initialized"); - let g = []; - (y = h == null ? void 0 : h.__webglSprites) === null || y === void 0 || y.forEach((J) => { - (S && J.material.depthTest == !1 || !S && J.material.depthTest) && g.push(J); - }); - let M = g.length; - if (!M) - return; - const C = this.sprite.attributes, T = this.sprite.uniforms; - if (!T) - throw new Error("Uniforms not defined"); - var D = E * 0.5, I = c * 0.5; - this.gl.useProgram(this.sprite.program), this.gl.enableVertexAttribArray(C.position), this.gl.enableVertexAttribArray(C.uv), this.gl.disable(this.gl.CULL_FACE), this.gl.enable(this.gl.BLEND), this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.sprite.vertexBuffer), this.gl.vertexAttribPointer(C.position, 2, this.gl.FLOAT, !1, 16, 0), this.gl.vertexAttribPointer(C.uv, 2, this.gl.FLOAT, !1, 16, 8), this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.sprite.elementBuffer), this.gl.uniformMatrix4fv(T.projectionMatrix, !1, _.projectionMatrix.elements), this.gl.activeTexture(this.gl.TEXTURE0), this.gl.uniform1i(T.map, 0); - var B = 0, P = 0, z = h.fog; - z ? (this.gl.uniform3f(T.fogColor, z.color.r, z.color.g, z.color.b), this.gl.uniform1f(T.fogNear, z.near), this.gl.uniform1f(T.fogFar, z.far), this.gl.uniform1i(T.fogType, 1), B = 1, P = 1) : (this.gl.uniform1i(T.fogType, 0), B = 0, P = 0); - var k; - let N, R, U, W, G = []; - for (k = 0; k < M; k++) - N = g[k], R = N.material, R && (R.depthTest == !1 && !S || !N.visible || R.opacity === 0 || (R.useScreenCoordinates ? N.z = -N.position.z : (N._modelViewMatrix.multiplyMatrices(_.matrixWorldInverse, N.matrixWorld), N.z = -N._modelViewMatrix.elements[14]))); - for (g.sort(u), k = 0; k < M; k++) - if (N = g[k], R = N.material, !!R && !(!N.visible || R.opacity === 0) && R.map && R.map.image && R.map.image.width) { - this.gl.uniform1f((T == null ? void 0 : T.alphaTest) || null, R.alphaTest); - var F = R.map.image.width, V = R.map.image.height; - G[0] = F * this.renderer.devicePixelRatio / E, G[1] = V * this.renderer.devicePixelRatio / c, R.useScreenCoordinates === !0 ? (this.gl.uniform1i(T.useScreenCoordinates, 1), this.gl.uniform3f(T.screenPosition, (N.position.x * this.renderer.devicePixelRatio - D) / D, (I - N.position.y * this.renderer.devicePixelRatio) / I, Math.max(0, Math.min(1, N.position.z)))) : (this.gl.uniform1i(T.useScreenCoordinates, 0), this.gl.uniformMatrix4fv(T.modelViewMatrix, !1, N._modelViewMatrix.elements)), h.fog && R.fog ? W = P : W = 0, B !== W && (this.gl.uniform1i(T.fogType, W), B = W), U = 1 / (R.scaleByViewport ? c : 1), G[0] *= U * N.scale.x, G[1] *= U * N.scale.y; - let J = (w = R == null ? void 0 : R.alignment) === null || w === void 0 ? void 0 : w.x, X = (L = R == null ? void 0 : R.alignment) === null || L === void 0 ? void 0 : L.y; - R.screenOffset && (J = (J || 0) + 2 * R.screenOffset.x / F, X = (X || 0) + 2 * R.screenOffset.y / V), this.gl.uniform2f(T.uvScale, ((s = R == null ? void 0 : R.uvScale) === null || s === void 0 ? void 0 : s.x) || 1, ((o = R == null ? void 0 : R.uvScale) === null || o === void 0 ? void 0 : o.y) || 1), this.gl.uniform2f(T.uvOffset, ((A = R == null ? void 0 : R.uvOffset) === null || A === void 0 ? void 0 : A.x) || 0, ((p = R == null ? void 0 : R.uvOffset) === null || p === void 0 ? void 0 : p.y) || 0), this.gl.uniform2f(T.alignment, J || 0, X || 0), this.gl.uniform1f(T.opacity, R.opacity), this.gl.uniform3f(T.color, ((v = R == null ? void 0 : R.color) === null || v === void 0 ? void 0 : v.r) || 0, ((a = R == null ? void 0 : R.color) === null || a === void 0 ? void 0 : a.g) || 0, ((l = R == null ? void 0 : R.color) === null || l === void 0 ? void 0 : l.b) || 0), this.gl.uniform1f(T.rotation, N.rotation), this.gl.uniform2fv(T.scale, G), this.renderer.setDepthTest(R.depthTest), this.renderer.setDepthWrite(R.depthWrite), this.renderer.setTexture(R.map, 0), this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0); - } - this.gl.enable(this.gl.CULL_FACE); - } - createProgram(h, _) { - if (!this.gl) - throw new Error("WebGL Rendering context not found"); - var E = this.gl.createProgram(); - if (!E) - throw new Error("Error creating webgl program"); - var c = this.gl.createShader(this.gl.FRAGMENT_SHADER), S = this.gl.createShader(this.gl.VERTEX_SHADER); - if (!c) - throw new Error("Unable to create fragment shader SpritePlugin.createProgram"); - if (!S) - throw new Error("Unable to create vertex shader SpritePlugin.createProgram"); - var y = "precision " + _ + ` float; -`; - if (this.gl.shaderSource(c, y + h.fragmentShader), this.gl.shaderSource(S, y + h.vertexShader), this.gl.compileShader(c), this.gl.compileShader(S), !this.gl.getShaderParameter(c, this.gl.COMPILE_STATUS) || !this.gl.getShaderParameter(S, this.gl.COMPILE_STATUS)) - throw new Error(`Error compiling shader: - ${this.gl.getShaderInfoLog(c)} - ${this.gl.getShaderInfoLog(S)}`); - return this.gl.attachShader(E, c), this.gl.attachShader(E, S), this.gl.linkProgram(E), this.gl.getProgramParameter(E, this.gl.LINK_STATUS) || console.error("Could not initialize shader"), E; - } - } - function u(b, h) { - return b.z !== h.z ? h.z - b.z : h.id - b.id; - } - } - ), - /***/ - "./src/WebGL/constants/Coloring.ts": ( - /*!*****************************************!*\ - !*** ./src/WebGL/constants/Coloring.ts ***! - \*****************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Coloring: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - var n; - (function(f) { - f[f.NoColors = 0] = "NoColors", f[f.FaceColors = 1] = "FaceColors", f[f.VertexColors = 2] = "VertexColors"; - })(n || (n = {})); - } - ), - /***/ - "./src/WebGL/constants/Shading.ts": ( - /*!****************************************!*\ - !*** ./src/WebGL/constants/Shading.ts ***! - \****************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Shading: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - var n; - (function(f) { - f[f.NoShading = 0] = "NoShading", f[f.FlatShading = 1] = "FlatShading", f[f.SmoothShading = 2] = "SmoothShading"; - })(n || (n = {})); - } - ), - /***/ - "./src/WebGL/constants/Sides.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/constants/Sides.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - BackSide: () => ( - /* binding */ - f - ), - /* harmony export */ - DoubleSide: () => ( - /* binding */ - u - ), - /* harmony export */ - FrontSide: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = 0, f = 1, u = 2; - } - ), - /***/ - "./src/WebGL/constants/SpriteAlignment.ts": ( - /*!************************************************!*\ - !*** ./src/WebGL/constants/SpriteAlignment.ts ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SpriteAlignment: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - const f = { - topLeft: new n.Vector2(1, -1), - topCenter: new n.Vector2(0, -1), - topRight: new n.Vector2(-1, -1), - centerLeft: new n.Vector2(1, 0), - center: new n.Vector2(0, 0), - centerRight: new n.Vector2(-1, 0), - bottomLeft: new n.Vector2(1, 1), - bottomCenter: new n.Vector2(0, 1), - bottomRight: new n.Vector2(-1, 1) - }; - } - ), - /***/ - "./src/WebGL/constants/TextureConstants.ts": ( - /*!*************************************************!*\ - !*** ./src/WebGL/constants/TextureConstants.ts ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ClampToEdgeWrapping: () => ( - /* binding */ - n - ), - /* harmony export */ - FloatType: () => ( - /* binding */ - _ - ), - /* harmony export */ - LinearFilter: () => ( - /* binding */ - f - ), - /* harmony export */ - LinearMipMapLinearFilter: () => ( - /* binding */ - b - ), - /* harmony export */ - NearestFilter: () => ( - /* binding */ - u - ), - /* harmony export */ - R32Format: () => ( - /* binding */ - S - ), - /* harmony export */ - RFormat: () => ( - /* binding */ - c - ), - /* harmony export */ - RGBAFormat: () => ( - /* binding */ - E - ), - /* harmony export */ - UnsignedByteType: () => ( - /* binding */ - h - ) - /* harmony export */ - }); - const n = 1001, f = 1006, u = 1007, b = 1008, h = 1009, _ = 1010, E = 1021, c = 1022, S = 1023; - } - ), - /***/ - "./src/WebGL/constants/TextureOperations.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/constants/TextureOperations.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - TextureOperations: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - var n; - (function(f) { - f[f.MultiplyOperation = 0] = "MultiplyOperation", f[f.MixOperation = 1] = "MixOperation", f[f.AddOperation = 2] = "AddOperation"; - })(n || (n = {})); - } - ), - /***/ - "./src/WebGL/constants/index.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/constants/index.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - BackSide: () => ( - /* reexport safe */ - f.BackSide - ), - /* harmony export */ - ClampToEdgeWrapping: () => ( - /* reexport safe */ - h.ClampToEdgeWrapping - ), - /* harmony export */ - Coloring: () => ( - /* reexport safe */ - n.Coloring - ), - /* harmony export */ - DoubleSide: () => ( - /* reexport safe */ - f.DoubleSide - ), - /* harmony export */ - FloatType: () => ( - /* reexport safe */ - h.FloatType - ), - /* harmony export */ - FrontSide: () => ( - /* reexport safe */ - f.FrontSide - ), - /* harmony export */ - LinearFilter: () => ( - /* reexport safe */ - h.LinearFilter - ), - /* harmony export */ - LinearMipMapLinearFilter: () => ( - /* reexport safe */ - h.LinearMipMapLinearFilter - ), - /* harmony export */ - NearestFilter: () => ( - /* reexport safe */ - h.NearestFilter - ), - /* harmony export */ - R32Format: () => ( - /* reexport safe */ - h.R32Format - ), - /* harmony export */ - RFormat: () => ( - /* reexport safe */ - h.RFormat - ), - /* harmony export */ - RGBAFormat: () => ( - /* reexport safe */ - h.RGBAFormat - ), - /* harmony export */ - Shading: () => ( - /* reexport safe */ - u.Shading - ), - /* harmony export */ - SpriteAlignment: () => ( - /* reexport safe */ - b.SpriteAlignment - ), - /* harmony export */ - TextureOperations: () => ( - /* reexport safe */ - _.TextureOperations - ), - /* harmony export */ - UnsignedByteType: () => ( - /* reexport safe */ - h.UnsignedByteType - ) - /* harmony export */ - }); - var n = r( - /*! ./Coloring */ - "./src/WebGL/constants/Coloring.ts" - ), f = r( - /*! ./Sides */ - "./src/WebGL/constants/Sides.ts" - ), u = r( - /*! ./Shading */ - "./src/WebGL/constants/Shading.ts" - ), b = r( - /*! ./SpriteAlignment */ - "./src/WebGL/constants/SpriteAlignment.ts" - ), h = r( - /*! ./TextureConstants */ - "./src/WebGL/constants/TextureConstants.ts" - ), _ = r( - /*! ./TextureOperations */ - "./src/WebGL/constants/TextureOperations.ts" - ); - } - ), - /***/ - "./src/WebGL/core/EventDispatcher.ts": ( - /*!*******************************************!*\ - !*** ./src/WebGL/core/EventDispatcher.ts ***! - \*******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - EventDispatcher: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - class n { - constructor() { - this.listeners = {}; - } - dispatchEvent(u) { - var b = this.listeners[u.type]; - if (b !== void 0) { - u.target = this; - for (var h = 0, _ = b.length; h < _; h++) - b[h].call(this, u); - } - } - removeEventListener(u, b) { - if (!b) - this.listeners[u] = []; - else { - var h = this.listeners[u].indexOf(b); - h !== -1 && this.listeners[u].splice(h, 1); - } - } - addEventListener(u, b) { - this.listeners[u] === void 0 && (this.listeners[u] = []), this.listeners[u].indexOf(b) === -1 && this.listeners[u].push(b); - } - } - } - ), - /***/ - "./src/WebGL/core/Geometry.ts": ( - /*!************************************!*\ - !*** ./src/WebGL/core/Geometry.ts ***! - \************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Geometry: () => ( - /* binding */ - E - ), - /* harmony export */ - GeometryGroup: () => ( - /* binding */ - _ - ), - /* harmony export */ - GeometryIDCount: () => ( - /* binding */ - c - ) - /* harmony export */ - }); - var n = r( - /*! ../materials/LineBasicMaterial */ - "./src/WebGL/materials/LineBasicMaterial.ts" - ), f = r( - /*! ./EventDispatcher */ - "./src/WebGL/core/EventDispatcher.ts" - ), u = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), b = r( - /*! ../../colors */ - "./src/colors.ts" - ); - const h = 65535; - class _ { - constructor(y = 0) { - this.vertexArray = null, this.colorArray = null, this.normalArray = null, this.radiusArray = null, this.faceArray = null, this.lineArray = null, this.vertices = 0, this.faceidx = 0, this.lineidx = 0, this.__inittedArrays = !1, this.id = y; - } - setColors(y) { - var w = this.vertexArray, L = this.colorArray; - if (!w) - throw new Error("vertex array not initialized"); - if (!L) - throw new Error("color array not initialized"); - if (w.length != L.length) { - console.log("Cannot re-color geometry group due to mismatched lengths."); - return; - } - for (var s = 0; s < w.length; s += 3) { - var o = y(w[s], w[s + 1], w[s + 2]); - o instanceof b.Color || (o = b.CC.color(o)), L[s] = o.r, L[s + 1] = o.g, L[s + 2] = o.b; - } - } - getNumVertices() { - return this.vertices; - } - getVertices() { - return this.vertexArray; - } - getCentroid() { - if (!this.vertexArray) - throw new Error("vertex array not initialized"); - for (var y = new u.Vector3(), w, L, s, o, A = 0; A < this.vertices; ++A) - w = A * 3, L = this.vertexArray[w], s = this.vertexArray[w + 1], o = this.vertexArray[w + 2], y.x += L, y.y += s, y.z += o; - return y.divideScalar(this.vertices), y; - } - //setup normals - vertex and face array must exist - setNormals() { - var y = this.faceArray, w = this.vertexArray, L = this.normalArray; - if (!(!this.vertices || !this.faceidx)) { - if (!y) - throw new Error("face array not initialized"); - if (!w) - throw new Error("vertex array not initialized"); - if (!L) - throw new Error("normal array not initialized"); - for (var s, o, A, p, v, a, l, g = 0; g < y.length / 3; ++g) - s = y[g * 3] * 3, o = y[g * 3 + 1] * 3, A = y[g * 3 + 2] * 3, p = new u.Vector3(w[s], w[s + 1], w[s + 2]), v = new u.Vector3(w[o], w[o + 1], w[o + 2]), a = new u.Vector3(w[A], w[A + 1], w[A + 2]), p.subVectors(p, v), a.subVectors(a, v), a.cross(p), l = a, l.normalize(), L[s] += l.x, L[o] += l.x, L[A] += l.x, L[s + 1] += l.y, L[o + 1] += l.y, L[A + 1] += l.y, L[s + 2] += l.z, L[o + 2] += l.z, L[A + 2] += l.z; - } - } - /* sets line index array from face arr - Note - assumes all faces are triangles (i.e. there will - be an extra diagonal for four-sided faces - user should - specify linearr for custom shape generation to show wireframe squares - as rectangles rather than two triangles) */ - setLineIndices() { - if (this.faceidx && !(this.lineArray && this.lineArray.length == this.faceidx * 2 && this.lineidx == this.faceidx * 2)) { - var y = this.faceArray, w = this.lineArray = new Uint16Array(this.faceidx * 2); - if (this.lineidx = this.faceidx * 2, !y) - throw new Error("face array not initialized"); - for (var L = 0; L < this.faceidx / 3; ++L) { - var s = L * 3, o = s * 2, A = y[s], p = y[s + 1], v = y[s + 2]; - w[o] = A, w[o + 1] = p, w[o + 2] = A, w[o + 3] = v, w[o + 4] = p, w[o + 5] = v; - } - } - } - vrml(y, w) { - var L, s, o, A, p, v, a, l, g, M, C, T, D, I, B, P = ""; - P += y + `Shape { -` + y + ` appearance Appearance { -` + y + ` material Material { -` + y + " diffuseColor " + ((L = w == null ? void 0 : w.color) === null || L === void 0 ? void 0 : L.r) + " " + ((s = w == null ? void 0 : w.color) === null || s === void 0 ? void 0 : s.g) + " " + ((o = w == null ? void 0 : w.color) === null || o === void 0 ? void 0 : o.b) + ` -`, w != null && w.transparent && (P += y + " transparency " + (1 - w.opacity) + ` -`), P += y + ` } -`, P += y + ` } -`; - var z = y; - if (y += " ", w instanceof n.LineBasicMaterial) { - P += y + `geometry IndexedLineSet { -` + y + ` colorPerVertex TRUE -` + y + ` coord Coordinate { -` + y + ` point [ -`; - let N, R, U; - for (let W = 0; W < this.vertices; ++W) { - let G = W * 3; - N = (A = this.vertexArray) === null || A === void 0 ? void 0 : A[G], R = (p = this.vertexArray) === null || p === void 0 ? void 0 : p[G + 1], U = (v = this.vertexArray) === null || v === void 0 ? void 0 : v[G + 2], P += y + " " + N + " " + R + " " + U + `, -`; - } - if (P += y + ` ] -`, P += y + ` } -`, this.colorArray) { - P += y + ` color Color { -` + y + ` color [ -`; - for (let W = 0; W < this.vertices; ++W) { - let G = W * 3; - N = this.colorArray[G], R = this.colorArray[G + 1], U = this.colorArray[G + 2], P += y + " " + N + " " + R + " " + U + `, -`; - } - P += y + ` ] -`, P += y + ` } -`; - } - P += y + ` coordIndex [ -`; - for (let W = 0; W < this.vertices; W += 2) - P += y + " " + W + ", " + (W + 1) + `, -1, -`; - P += y + ` ] -`, P += y + `} -`; - } else { - P += y + `geometry IndexedFaceSet { -` + y + ` colorPerVertex TRUE -` + y + ` normalPerVertex TRUE -` + y + ` solid FALSE -`, P += y + ` coord Coordinate { -` + y + ` point [ -`; - let N, R, U; - for (let W = 0; W < this.vertices; ++W) { - let G = W * 3; - N = (a = this.vertexArray) === null || a === void 0 ? void 0 : a[G], R = (l = this.vertexArray) === null || l === void 0 ? void 0 : l[G + 1], U = (g = this.vertexArray) === null || g === void 0 ? void 0 : g[G + 2], P += y + " " + N + " " + R + " " + U + `, -`; - } - P += y + ` ] -`, P += y + ` } -`, P += y + ` normal Normal { -` + y + ` vector [ -`; - for (let W = 0; W < this.vertices; ++W) { - let G = W * 3; - N = (M = this.normalArray) === null || M === void 0 ? void 0 : M[G], R = (C = this.normalArray) === null || C === void 0 ? void 0 : C[G + 1], U = (T = this.normalArray) === null || T === void 0 ? void 0 : T[G + 2], P += y + " " + N + " " + R + " " + U + `, -`; - } - if (P += y + ` ] -`, P += y + ` } -`, this.colorArray) { - P += y + ` color Color { -` + y + ` color [ -`; - for (let W = 0; W < this.vertices; ++W) { - let G = W * 3; - N = this.colorArray[G], R = this.colorArray[G + 1], U = this.colorArray[G + 2], P += y + " " + N + " " + R + " " + U + `, -`; - } - P += y + ` ] -`, P += y + ` } -`; - } - P += y + ` coordIndex [ -`; - for (var k = 0; k < this.faceidx; k += 3) - N = (D = this.faceArray) === null || D === void 0 ? void 0 : D[k], R = (I = this.faceArray) === null || I === void 0 ? void 0 : I[k + 1], U = (B = this.faceArray) === null || B === void 0 ? void 0 : B[k + 2], P += y + " " + N + ", " + R + ", " + U + `, -1, -`; - P += y + ` ] -`, P += y + `} -`; - } - return P += z + "}", P; - } - truncateArrayBuffers(y = !0, w = !1) { - var L = this.vertexArray, s = this.colorArray, o = this.normalArray, A = this.faceArray, p = this.lineArray, v = this.radiusArray; - this.vertexArray = (L == null ? void 0 : L.subarray(0, this.vertices * 3)) || null, this.colorArray = (s == null ? void 0 : s.subarray(0, this.vertices * 3)) || null, y ? (this.normalArray = (o == null ? void 0 : o.subarray(0, this.vertices * 3)) || null, this.faceArray = (A == null ? void 0 : A.subarray(0, this.faceidx)) || null, this.lineidx > 0 ? this.lineArray = (p == null ? void 0 : p.subarray(0, this.lineidx)) || null : this.lineArray = new Uint16Array(0)) : (this.normalArray = new Float32Array(0), this.faceArray = new Uint16Array(0), this.lineArray = new Uint16Array(0)), v && (this.radiusArray = v.subarray(0, this.vertices)), w && (this.normalArray && (this.normalArray = new Float32Array(this.normalArray)), this.faceArray && (this.faceArray = new Uint16Array(this.faceArray)), this.lineArray && (this.lineArray = new Uint16Array(this.lineArray)), this.vertexArray && (this.vertexArray = new Float32Array(this.vertexArray)), this.colorArray && (this.colorArray = new Float32Array(this.colorArray)), this.radiusArray && (this.radiusArray = new Float32Array(this.radiusArray))), this.__inittedArrays = !0; - } - } - class E extends f.EventDispatcher { - constructor(y = !1, w = !1, L = !1) { - super(), this.name = "", this.hasTangents = !1, this.dynamic = !0, this.verticesNeedUpdate = !1, this.elementsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.buffersNeedUpdate = !1, this.imposter = !1, this.instanced = !1, this.geometryGroups = [], this.groups = 0, this.id = c++, this.mesh = y, this.radii = w, this.offset = L; - } - //Get geometry group to accomodate addVertices new vertices - create - // new group if necessary - updateGeoGroup(y = 0) { - var w, L = this.groups > 0 ? this.geometryGroups[this.groups - 1] : null; - return (!L || L.vertices + y > (((w = L == null ? void 0 : L.vertexArray) === null || w === void 0 ? void 0 : w.length) || 0) / 3) && (L = this.addGeoGroup()), L; - } - //return comma separated list of IndexedFace (or Line) sets from geometry groups - vrml(y, w) { - for (var L = "", s = this.geometryGroups.length, o = 0; o < s; o++) { - var A = this.geometryGroups[o]; - L += A.vrml(y, w) + `, -`; - } - return L; - } - addGeoGroup() { - var y = new _(this.geometryGroups.length); - return this.geometryGroups.push(y), this.groups = this.geometryGroups.length, y.vertexArray = new Float32Array(h * 3), y.colorArray = new Float32Array(h * 3), this.mesh && (y.normalArray = new Float32Array(h * 3), y.faceArray = new Uint16Array(h * 6), y.lineArray = new Uint16Array(h * 6)), this.radii && (y.radiusArray = new Float32Array(h)), y.useOffset = this.offset, y; - } - setUpNormals(...y) { - for (var w = 0; w < this.groups; w++) { - var L = this.geometryGroups[w]; - L.setNormals(...y); - } - } - setColors(...y) { - for (var w = this.geometryGroups.length, L = 0; L < w; L++) { - var s = this.geometryGroups[L]; - s.setColors(...y); - } - } - setUpWireframe(...y) { - for (var w = 0; w < this.groups; w++) { - var L = this.geometryGroups[w]; - L.setLineIndices(...y); - } - } - //After vertices, colors, etc are collected in regular or typed arrays, - // create typed arrays from regular arrays if they don't already exist, - initTypedArrays() { - for (var y = 0; y < this.groups; y++) { - var w = this.geometryGroups[y]; - w.__inittedArrays !== !0 && w.truncateArrayBuffers(this.mesh, !1); - } - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - get vertices() { - for (var y = 0, w = 0; w < this.groups; w++) - y += this.geometryGroups[w].vertices; - return y; - } - } - let c = 0; - } - ), - /***/ - "./src/WebGL/core/Object3D.ts": ( - /*!************************************!*\ - !*** ./src/WebGL/core/Object3D.ts ***! - \************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Light: () => ( - /* binding */ - _ - ), - /* harmony export */ - Object3D: () => ( - /* binding */ - b - ), - /* harmony export */ - Object3DIDCount: () => ( - /* binding */ - u - ), - /* harmony export */ - Scene: () => ( - /* binding */ - h - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), f = r( - /*! ../../colors */ - "./src/colors.ts" - ); - let u = 0; - class b { - constructor() { - this.id = u++, this.name = "", this.children = [], this.position = new n.Vector3(), this.rotation = new n.Vector3(), this.matrix = new n.Matrix4(), this.matrixWorld = new n.Matrix4(), this.quaternion = new n.Quaternion(), this.eulerOrder = "XYZ", this.up = new n.Vector3(0, 1, 0), this.scale = new n.Vector3(1, 1, 1), this.matrixAutoUpdate = !0, this.matrixWorldNeedsUpdate = !0, this.rotationAutoUpdate = !0, this.useQuaternion = !1, this.visible = !0; - } - lookAt(c) { - this.matrix.lookAt(c, this.position, this.up), this.rotationAutoUpdate && (this.useQuaternion === !0 ? console.error("Unimplemented math operation.") : this.rotation instanceof n.Vector3 && this.rotation.setEulerFromRotationMatrix(this.matrix, this.eulerOrder)); - } - //add child object - add(c) { - if (c === this) { - console.error("Can't add $3Dmol.Object3D to itself"); - return; - } - c.parent = this, this.children.push(c); - for (var S = this; S.parent !== void 0; ) - S = S.parent; - S !== void 0 && S instanceof h && S.__addObject(c); - } - remove(c) { - var S = this.children.indexOf(c); - if (S !== -1) { - c.parent = void 0, this.children.splice(S, 1); - for (var y = this; y.parent !== void 0; ) - y = y.parent; - y !== void 0 && y instanceof h && y.__removeObject(c); - } - } - //convert to vrml - vrml(c) { - c || (c = " "); - var S = 2 * Math.atan2(this.quaternion.lengthxyz(), this.quaternion.w), y = 0, w = 0, L = 0; - if (S != 0) { - let A = Math.sin(S / 2); - y = this.quaternion.x / A, w = this.quaternion.y / A, L = this.quaternion.z / A; - } - var s = c + `Transform { -` + c + " center " + this.position.x + " " + this.position.y + " " + this.position.z + ` -` + c + " rotation " + y + " " + w + " " + L + " " + S + ` -` + c + ` children [ -`; - this.geometry && (s += this.geometry.vrml(c, this.material)); - for (var o = 0; o < this.children.length; o++) - s += this.children[o].vrml(c + " ") + `, -`; - return s += ` ] -`, s += "}", s; - } - updateMatrix() { - this.matrix.setPosition(this.position), this.useQuaternion === !1 && this.rotation instanceof n.Vector3 ? this.matrix.setRotationFromEuler(this.rotation, this.eulerOrder) : this.matrix.setRotationFromQuaternion(this.quaternion), (this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1) && this.matrix.scale(this.scale), this.matrixWorldNeedsUpdate = !0; - } - updateMatrixWorld(c) { - this.matrixAutoUpdate === !0 && this.updateMatrix(), (this.matrixWorldNeedsUpdate === !0 || c === !0) && (this.parent === void 0 ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1; - for (var S = 0; S < this.children.length; S++) - this.children[S].updateMatrixWorld(!0); - } - clone(c) { - c === void 0 && (c = new b()), c.name = this.name, c.up.copy(this.up), c.position.copy(this.position), c.rotation instanceof n.Vector3 && this.rotation instanceof n.Vector3 ? c.rotation.copy(this.rotation) : c.rotation = this.rotation, c.eulerOrder = this.eulerOrder, c.scale.copy(this.scale), c.rotationAutoUpdate = this.rotationAutoUpdate, c.matrix.copy(this.matrix), c.matrixWorld.copy(this.matrixWorld), c.quaternion.copy(this.quaternion), c.matrixAutoUpdate = this.matrixAutoUpdate, c.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate, c.useQuaternion = this.useQuaternion, c.visible = this.visible; - for (var S = 0; S < this.children.length; S++) { - var y = this.children[S]; - c.add(y.clone()); - } - return c; - } - setVisible(c) { - this.visible = c; - for (var S = 0; S < this.children.length; S++) { - var y = this.children[S]; - y.setVisible(c); - } - } - } - class h extends b { - constructor() { - super(...arguments), this.fog = null, this.overrideMaterial = null, this.matrixAutoUpdate = !1, this.__objects = [], this.__lights = [], this.__objectsAdded = [], this.__objectsRemoved = []; - } - __addObject(c) { - if (c instanceof _) - this.__lights.indexOf(c) === -1 && this.__lights.push(c), c.target && c.target.parent === void 0 && this.add(c.target); - else if (this.__objects.indexOf(c) === -1) { - this.__objects.push(c), this.__objectsAdded.push(c); - var S = this.__objectsRemoved.indexOf(c); - S !== -1 && this.__objectsRemoved.splice(S, 1); - } - for (var y = 0; y < c.children.length; y++) - this.__addObject(c.children[y]); - } - __removeObject(c) { - var S; - if (c instanceof _) - S = this.__lights.indexOf(c), S !== -1 && this.__lights.splice(S, 1); - else if (S = this.__objects.indexOf(c), S !== -1) { - this.__objects.splice(S, 1), this.__objectsRemoved.push(c); - var y = this.__objectsAdded.indexOf(c); - y !== -1 && this.__objectsAdded.splice(S, 1); - } - for (var w = 0; w < c.children.length; w++) - this.__removeObject(c.children[w]); - } - } - class _ extends b { - constructor(c, S = 1) { - super(), this.position = new n.Vector3(0, 1, 0), this.target = new b(), this.castShadow = !1, this.onlyShadow = !1, this.color = new f.Color(c), this.intensity = S; - } - } - } - ), - /***/ - "./src/WebGL/core/Projector.ts": ( - /*!*************************************!*\ - !*** ./src/WebGL/core/Projector.ts ***! - \*************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Projector: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - const f = new n.Matrix4(); - class u { - static unprojectVector(h, _) { - return _.projectionMatrixInverse.getInverse(_.projectionMatrix), f.multiplyMatrices(_.matrixWorld, _.projectionMatrixInverse), h.applyProjection(f); - } - static projectVector(h, _) { - return _.matrixWorldInverse.getInverse(_.matrixWorld), f.multiplyMatrices(_.projectionMatrix, _.matrixWorldInverse), h.applyProjection(f); - } - projectVector(h, _) { - return u.projectVector(h, _); - } - unprojectVector(h, _) { - return u.unprojectVector(h, _); - } - } - } - ), - /***/ - "./src/WebGL/core/Raycaster.ts": ( - /*!*************************************!*\ - !*** ./src/WebGL/core/Raycaster.ts ***! - \*************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Raycaster: () => ( - /* binding */ - h - ), - /* harmony export */ - intersectObject: () => ( - /* binding */ - A - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), f = r( - /*! ../shapes */ - "./src/WebGL/shapes/index.ts" - ); - const u = (p, v) => p.distance - v.distance, b = new n.Matrix4(); - class h { - constructor(v, a, l, g) { - this.precision = 1e-4, this.linePrecision = 0.2, this.ray = new n.Ray(v, a), this.ray.direction.lengthSq() > 0 && this.ray.direction.normalize(), this.near = g || 0, this.far = l || 1 / 0; - } - set(v, a) { - this.ray.set(v, a); - } - setFromCamera(v, a) { - a.ortho ? (this.ray.origin.set(v.x, v.y, (a.near + a.far) / (a.near - a.far)).unproject(a), this.ray.direction.set(0, 0, -1).transformDirection(a.matrixWorld)) : (this.ray.origin.setFromMatrixPosition(a.matrixWorld), this.ray.direction.set(v.x, v.y, v.z), a.projectionMatrixInverse.getInverse(a.projectionMatrix), b.multiplyMatrices(a.matrixWorld, a.projectionMatrixInverse), this.ray.direction.applyProjection(b), this.ray.direction.sub(this.ray.origin).normalize()); - } - intersectObjects(v, a) { - for (var l = [], g = 0, M = a.length; g < M; g++) - A(v, a[g], this, l); - return l.sort(u), l; - } - } - const _ = (p) => Math.min(Math.max(p, -1), 1); - var E = new f.Sphere(), c = new f.Cylinder(), S = new f.Triangle(), y = new n.Vector3(), w = new n.Vector3(), L = new n.Vector3(), s = new n.Vector3(), o = new n.Vector3(); - function A(p, v, a, l) { - if (o.getPositionFromMatrix(p.matrixWorld), v.intersectionShape === void 0) - return l; - var g = v.intersectionShape, M = a.linePrecision; - M *= p.matrixWorld.getMaxScaleOnAxis(); - var C = M * M; - if (v.boundingSphere !== void 0 && v.boundingSphere instanceof f.Sphere && (E.copy(v.boundingSphere), E.applyMatrix4(p.matrixWorld), !a.ray.isIntersectionSphere(E))) - return l; - var T, D, I, B, P, z, k, N, R, U, W, G, F, V; - for (T = 0, D = g.triangle.length; T < D; T++) - if (g.triangle[T] instanceof f.Triangle) { - if (S.copy(g.triangle[T]), S.applyMatrix4(p.matrixWorld), I = S.getNormal(), B = a.ray.direction.dot(I), B >= 0 || (y.subVectors(S.a, a.ray.origin), k = I.dot(y) / B, k < 0)) - continue; - w.copy(a.ray.direction).multiplyScalar(k).add(a.ray.origin), w.sub(S.a), L.copy(S.b).sub(S.a), s.copy(S.c).sub(S.a); - var J = L.dot(s), X = L.lengthSq(), oe = s.lengthSq(); - if (G = (X * w.dot(s) - J * w.dot(L)) / (X * oe - J * J), G < 0 || G > 1 || (W = (w.dot(L) - G * J) / X, W < 0 || W > 1 || W + G > 1)) - continue; - l.push({ clickable: v, distance: k }); - } - for (T = 0, D = g.cylinder.length; T < D; T++) - if (g.cylinder[T] instanceof f.Cylinder) { - if (c.copy(g.cylinder[T]), c.applyMatrix4(p.matrixWorld), y.subVectors(c.c1, a.ray.origin), P = y.dot(c.direction), z = y.dot(a.ray.direction), B = _(a.ray.direction.dot(c.direction)), R = 1 - B * B, R === 0) - continue; - F = (B * z - P) / R, V = (z - B * P) / R, w.copy(c.direction).multiplyScalar(F).add(c.c1), L.copy(a.ray.direction).multiplyScalar(V).add(a.ray.origin), N = s.subVectors(w, L).lengthSq(); - var te = c.radius * c.radius; - if (N <= te) { - if (U = (B * P - z) * (B * P - z) - R * (y.lengthSq() - P * P - te), U <= 0 ? G = k = Math.sqrt(N) : G = k = (z - B * P - Math.sqrt(U)) / R, W = B * G - P, W < 0 || W * W > c.lengthSq() || G < 0) - continue; - l.push({ clickable: v, distance: k }); - } - } - for (T = 0, D = g.line.length; T < D; T += 2) { - w.copy(g.line[T]), w.applyMatrix4(p.matrixWorld), L.copy(g.line[T + 1]), L.applyMatrix4(p.matrixWorld), s.subVectors(L, w); - var ve = s.lengthSq(); - s.normalize(), y.subVectors(w, a.ray.origin); - var se = y.dot(s); - z = y.dot(a.ray.direction), B = _(a.ray.direction.dot(s)), R = 1 - B * B, R !== 0 && (F = (B * z - se) / R, V = (z - B * se) / R, w.add(s.multiplyScalar(F)), L.copy(a.ray.direction).multiplyScalar(V).add(a.ray.origin), N = s.subVectors(L, w).lengthSq(), N < C && F * F < ve && l.push({ clickable: v, distance: V })); - } - for (T = 0, D = g.sphere.length; T < D; T++) - if (g.sphere[T] instanceof f.Sphere && (E.copy(g.sphere[T]), E.applyMatrix4(p.matrixWorld), a.ray.isIntersectionSphere(E))) { - w.subVectors(E.center, a.ray.origin); - var le = w.dot(a.ray.direction); - if (U = le * le - (w.lengthSq() - E.radius * E.radius), le < 0) - return l; - U <= 0 ? k = le : k = le - Math.sqrt(U), l.push({ clickable: v, distance: k }); - } - return l; - } - } - ), - /***/ - "./src/WebGL/core/Texture.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/core/Texture.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Texture: () => ( - /* binding */ - h - ), - /* harmony export */ - TextureIdCount: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ../constants/TextureConstants */ - "./src/WebGL/constants/TextureConstants.ts" - ), f = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), u = r( - /*! ./EventDispatcher */ - "./src/WebGL/core/EventDispatcher.ts" - ), b = r( - /*! ./UVMapping */ - "./src/WebGL/core/UVMapping.ts" - ); - class h extends u.EventDispatcher { - constructor(c, S) { - super(), this.id = _++, this.name = "", this.image = c, this.mapping = new b.UVMapping(), this.wrapS = n.ClampToEdgeWrapping, this.wrapT = n.ClampToEdgeWrapping, this.anisotropy = 1, S ? (this.format = n.RFormat, this.type = n.FloatType, this.premultiplyAlpha = !1, this.flipY = !1, this.unpackAlignment = 1, this.magFilter = n.NearestFilter, this.minFilter = n.NearestFilter) : (this.format = n.RGBAFormat, this.type = n.UnsignedByteType, this.offset = new f.Vector2(0, 0), this.repeat = new f.Vector2(1, 1), this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.magFilter = n.LinearFilter, this.minFilter = n.LinearMipMapLinearFilter), this.needsUpdate = !1, this.onUpdate = null; - } - clone(c = new h()) { - return c.image = this.image, c.mapping = this.mapping, c.wrapS = this.wrapS, c.wrapT = this.wrapT, c.magFilter = this.magFilter, c.minFilter = this.minFilter, c.anisotropy = this.anisotropy, c.format = this.format, c.type = this.type, c.offset.copy(this.offset), c.repeat.copy(this.repeat), c.premultiplyAlpha = this.premultiplyAlpha, c.flipY = this.flipY, c.unpackAlignment = this.unpackAlignment, c; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - } - let _ = 0; - } - ), - /***/ - "./src/WebGL/core/UVMapping.ts": ( - /*!*************************************!*\ - !*** ./src/WebGL/core/UVMapping.ts ***! - \*************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - UVMapping: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - class n { - } - } - ), - /***/ - "./src/WebGL/core/index.ts": ( - /*!*********************************!*\ - !*** ./src/WebGL/core/index.ts ***! - \*********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - EventDispatcher: () => ( - /* reexport safe */ - n.EventDispatcher - ), - /* harmony export */ - Geometry: () => ( - /* reexport safe */ - f.Geometry - ), - /* harmony export */ - GeometryGroup: () => ( - /* reexport safe */ - f.GeometryGroup - ), - /* harmony export */ - GeometryIDCount: () => ( - /* reexport safe */ - f.GeometryIDCount - ), - /* harmony export */ - Light: () => ( - /* reexport safe */ - u.Light - ), - /* harmony export */ - Object3D: () => ( - /* reexport safe */ - u.Object3D - ), - /* harmony export */ - Object3DIDCount: () => ( - /* reexport safe */ - u.Object3DIDCount - ), - /* harmony export */ - Projector: () => ( - /* reexport safe */ - b.Projector - ), - /* harmony export */ - Raycaster: () => ( - /* reexport safe */ - h.Raycaster - ), - /* harmony export */ - Scene: () => ( - /* reexport safe */ - u.Scene - ), - /* harmony export */ - Texture: () => ( - /* reexport safe */ - _.Texture - ), - /* harmony export */ - TextureIdCount: () => ( - /* reexport safe */ - _.TextureIdCount - ), - /* harmony export */ - UVMapping: () => ( - /* reexport safe */ - E.UVMapping - ), - /* harmony export */ - intersectObject: () => ( - /* reexport safe */ - h.intersectObject - ) - /* harmony export */ - }); - var n = r( - /*! ./EventDispatcher */ - "./src/WebGL/core/EventDispatcher.ts" - ), f = r( - /*! ./Geometry */ - "./src/WebGL/core/Geometry.ts" - ), u = r( - /*! ./Object3D */ - "./src/WebGL/core/Object3D.ts" - ), b = r( - /*! ./Projector */ - "./src/WebGL/core/Projector.ts" - ), h = r( - /*! ./Raycaster */ - "./src/WebGL/core/Raycaster.ts" - ), _ = r( - /*! ./Texture */ - "./src/WebGL/core/Texture.ts" - ), E = r( - /*! ./UVMapping */ - "./src/WebGL/core/UVMapping.ts" - ); - } - ), - /***/ - "./src/WebGL/index.ts": ( - /*!****************************!*\ - !*** ./src/WebGL/index.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - BackSide: () => ( - /* reexport safe */ - n.BackSide - ), - /* harmony export */ - Camera: () => ( - /* reexport safe */ - c.Camera - ), - /* harmony export */ - ClampToEdgeWrapping: () => ( - /* reexport safe */ - n.ClampToEdgeWrapping - ), - /* harmony export */ - Coloring: () => ( - /* reexport safe */ - n.Coloring - ), - /* harmony export */ - Cylinder: () => ( - /* reexport safe */ - E.Cylinder - ), - /* harmony export */ - DoubleSide: () => ( - /* reexport safe */ - n.DoubleSide - ), - /* harmony export */ - EventDispatcher: () => ( - /* reexport safe */ - f.EventDispatcher - ), - /* harmony export */ - FloatType: () => ( - /* reexport safe */ - n.FloatType - ), - /* harmony export */ - Fog: () => ( - /* reexport safe */ - S.Fog - ), - /* harmony export */ - FrontSide: () => ( - /* reexport safe */ - n.FrontSide - ), - /* harmony export */ - Geometry: () => ( - /* reexport safe */ - f.Geometry - ), - /* harmony export */ - GeometryGroup: () => ( - /* reexport safe */ - f.GeometryGroup - ), - /* harmony export */ - GeometryIDCount: () => ( - /* reexport safe */ - f.GeometryIDCount - ), - /* harmony export */ - ImposterMaterial: () => ( - /* reexport safe */ - u.ImposterMaterial - ), - /* harmony export */ - InstancedMaterial: () => ( - /* reexport safe */ - u.InstancedMaterial - ), - /* harmony export */ - Light: () => ( - /* reexport safe */ - f.Light - ), - /* harmony export */ - Line: () => ( - /* reexport safe */ - h.Line - ), - /* harmony export */ - LineBasicMaterial: () => ( - /* reexport safe */ - u.LineBasicMaterial - ), - /* harmony export */ - LineStyle: () => ( - /* reexport safe */ - h.LineStyle - ), - /* harmony export */ - LinearFilter: () => ( - /* reexport safe */ - n.LinearFilter - ), - /* harmony export */ - LinearMipMapLinearFilter: () => ( - /* reexport safe */ - n.LinearMipMapLinearFilter - ), - /* harmony export */ - Material: () => ( - /* reexport safe */ - u.Material - ), - /* harmony export */ - MaterialIdCount: () => ( - /* reexport safe */ - u.MaterialIdCount - ), - /* harmony export */ - Matrix3: () => ( - /* reexport safe */ - b.Matrix3 - ), - /* harmony export */ - Matrix4: () => ( - /* reexport safe */ - b.Matrix4 - ), - /* harmony export */ - Mesh: () => ( - /* reexport safe */ - h.Mesh - ), - /* harmony export */ - MeshDoubleLambertMaterial: () => ( - /* reexport safe */ - u.MeshDoubleLambertMaterial - ), - /* harmony export */ - MeshLambertMaterial: () => ( - /* reexport safe */ - u.MeshLambertMaterial - ), - /* harmony export */ - MeshOutlineMaterial: () => ( - /* reexport safe */ - u.MeshOutlineMaterial - ), - /* harmony export */ - NearestFilter: () => ( - /* reexport safe */ - n.NearestFilter - ), - /* harmony export */ - Object3D: () => ( - /* reexport safe */ - f.Object3D - ), - /* harmony export */ - Object3DIDCount: () => ( - /* reexport safe */ - f.Object3DIDCount - ), - /* harmony export */ - Projector: () => ( - /* reexport safe */ - f.Projector - ), - /* harmony export */ - Quaternion: () => ( - /* reexport safe */ - b.Quaternion - ), - /* harmony export */ - R32Format: () => ( - /* reexport safe */ - n.R32Format - ), - /* harmony export */ - RFormat: () => ( - /* reexport safe */ - n.RFormat - ), - /* harmony export */ - RGBAFormat: () => ( - /* reexport safe */ - n.RGBAFormat - ), - /* harmony export */ - Ray: () => ( - /* reexport safe */ - b.Ray - ), - /* harmony export */ - Raycaster: () => ( - /* reexport safe */ - f.Raycaster - ), - /* harmony export */ - Renderer: () => ( - /* reexport safe */ - y.Renderer - ), - /* harmony export */ - Scene: () => ( - /* reexport safe */ - f.Scene - ), - /* harmony export */ - ShaderLib: () => ( - /* reexport safe */ - _.ShaderLib - ), - /* harmony export */ - ShaderUtils: () => ( - /* reexport safe */ - _.ShaderUtils - ), - /* harmony export */ - Shading: () => ( - /* reexport safe */ - n.Shading - ), - /* harmony export */ - Sphere: () => ( - /* reexport safe */ - E.Sphere - ), - /* harmony export */ - SphereImposterMaterial: () => ( - /* reexport safe */ - u.SphereImposterMaterial - ), - /* harmony export */ - SphereImposterOutlineMaterial: () => ( - /* reexport safe */ - u.SphereImposterOutlineMaterial - ), - /* harmony export */ - Sprite: () => ( - /* reexport safe */ - h.Sprite - ), - /* harmony export */ - SpriteAlignment: () => ( - /* reexport safe */ - n.SpriteAlignment - ), - /* harmony export */ - SpriteMaterial: () => ( - /* reexport safe */ - u.SpriteMaterial - ), - /* harmony export */ - SpritePlugin: () => ( - /* reexport safe */ - w.SpritePlugin - ), - /* harmony export */ - StickImposterMaterial: () => ( - /* reexport safe */ - u.StickImposterMaterial - ), - /* harmony export */ - StickImposterOutlineMaterial: () => ( - /* reexport safe */ - u.StickImposterOutlineMaterial - ), - /* harmony export */ - Texture: () => ( - /* reexport safe */ - f.Texture - ), - /* harmony export */ - TextureIdCount: () => ( - /* reexport safe */ - f.TextureIdCount - ), - /* harmony export */ - TextureOperations: () => ( - /* reexport safe */ - n.TextureOperations - ), - /* harmony export */ - Triangle: () => ( - /* reexport safe */ - E.Triangle - ), - /* harmony export */ - UVMapping: () => ( - /* reexport safe */ - f.UVMapping - ), - /* harmony export */ - UnsignedByteType: () => ( - /* reexport safe */ - n.UnsignedByteType - ), - /* harmony export */ - Vector2: () => ( - /* reexport safe */ - b.Vector2 - ), - /* harmony export */ - Vector3: () => ( - /* reexport safe */ - b.Vector3 - ), - /* harmony export */ - VolumetricMaterial: () => ( - /* reexport safe */ - u.VolumetricMaterial - ), - /* harmony export */ - basic: () => ( - /* reexport safe */ - _.basic - ), - /* harmony export */ - clamp: () => ( - /* reexport safe */ - b.clamp - ), - /* harmony export */ - clone: () => ( - /* reexport safe */ - _.clone - ), - /* harmony export */ - conversionMatrix3: () => ( - /* reexport safe */ - b.conversionMatrix3 - ), - /* harmony export */ - degToRad: () => ( - /* reexport safe */ - b.degToRad - ), - /* harmony export */ - instanced: () => ( - /* reexport safe */ - _.instanced - ), - /* harmony export */ - intersectObject: () => ( - /* reexport safe */ - f.intersectObject - ), - /* harmony export */ - lambert: () => ( - /* reexport safe */ - _.lambert - ), - /* harmony export */ - lambertdouble: () => ( - /* reexport safe */ - _.lambertdouble - ), - /* harmony export */ - outline: () => ( - /* reexport safe */ - _.outline - ), - /* harmony export */ - screen: () => ( - /* reexport safe */ - _.screen - ), - /* harmony export */ - screenaa: () => ( - /* reexport safe */ - _.screenaa - ), - /* harmony export */ - sphereimposter: () => ( - /* reexport safe */ - _.sphereimposter - ), - /* harmony export */ - sphereimposteroutline: () => ( - /* reexport safe */ - _.sphereimposteroutline - ), - /* harmony export */ - sprite: () => ( - /* reexport safe */ - _.sprite - ), - /* harmony export */ - stickimposter: () => ( - /* reexport safe */ - _.stickimposter - ), - /* harmony export */ - stickimposteroutline: () => ( - /* reexport safe */ - _.stickimposteroutline - ), - /* harmony export */ - volumetric: () => ( - /* reexport safe */ - _.volumetric - ) - /* harmony export */ - }); - var n = r( - /*! ./constants */ - "./src/WebGL/constants/index.ts" - ), f = r( - /*! ./core */ - "./src/WebGL/core/index.ts" - ), u = r( - /*! ./materials */ - "./src/WebGL/materials/index.ts" - ), b = r( - /*! ./math */ - "./src/WebGL/math/index.ts" - ), h = r( - /*! ./objects */ - "./src/WebGL/objects/index.ts" - ), _ = r( - /*! ./shaders */ - "./src/WebGL/shaders/index.ts" - ), E = r( - /*! ./shapes */ - "./src/WebGL/shapes/index.ts" - ), c = r( - /*! ./Camera */ - "./src/WebGL/Camera.ts" - ), S = r( - /*! ./Fog */ - "./src/WebGL/Fog.ts" - ), y = r( - /*! ./Renderer */ - "./src/WebGL/Renderer.ts" - ), w = r( - /*! ./SpritePlugin */ - "./src/WebGL/SpritePlugin.ts" - ); - } - ), - /***/ - "./src/WebGL/materials/ImposterMaterial.ts": ( - /*!*************************************************!*\ - !*** ./src/WebGL/materials/ImposterMaterial.ts ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ImposterMaterial: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ./../constants/Coloring */ - "./src/WebGL/constants/Coloring.ts" - ), f = r( - /*! ./../constants/Shading */ - "./src/WebGL/constants/Shading.ts" - ), u = r( - /*! ../../colors */ - "./src/colors.ts" - ), b = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), h = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class _ extends h.Material { - constructor(c) { - super(), this.color = new u.Color(16777215), this.ambient = new u.Color(1048575), this.emissive = new u.Color(0), this.imposter = !0, this.wrapAround = !1, this.wrapRGB = new b.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = f.Shading.SmoothShading, this.shaderID = null, this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.setValues(c); - } - clone(c = new _()) { - return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c; - } - } - } - ), - /***/ - "./src/WebGL/materials/InstancedMaterial.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/materials/InstancedMaterial.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - InstancedMaterial: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ../constants/Coloring */ - "./src/WebGL/constants/Coloring.ts" - ), f = r( - /*! ../constants/Shading */ - "./src/WebGL/constants/Shading.ts" - ), u = r( - /*! ../../colors */ - "./src/colors.ts" - ), b = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), h = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class _ extends h.Material { - constructor(c) { - super(), this.color = new u.Color(16777215), this.ambient = new u.Color(1048575), this.emissive = new u.Color(0), this.wrapAround = !1, this.wrapRGB = new b.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = f.Shading.SmoothShading, this.shaderID = "instanced", this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.sphere = null, this.setValues(c); - } - clone(c = new _()) { - return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c.sphere = this.sphere, c; - } - } - } - ), - /***/ - "./src/WebGL/materials/LineBasicMaterial.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/materials/LineBasicMaterial.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - LineBasicMaterial: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../../colors */ - "./src/colors.ts" - ), f = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class u extends f.Material { - constructor(h) { - super(), this.color = new n.Color(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.vertexColors = !1, this.fog = !0, this.shaderID = "basic", this.setValues(h); - } - clone(h = new u()) { - return super.clone.call(this, h), h.color.copy(this.color), h; - } - } - } - ), - /***/ - "./src/WebGL/materials/Material.ts": ( - /*!*****************************************!*\ - !*** ./src/WebGL/materials/Material.ts ***! - \*****************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Material: () => ( - /* binding */ - h - ), - /* harmony export */ - MaterialIdCount: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ../constants/Sides */ - "./src/WebGL/constants/Sides.ts" - ), f = r( - /*! ../core */ - "./src/WebGL/core/index.ts" - ), u = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), b = r( - /*! ../../colors */ - "./src/colors.ts" - ); - class h extends f.EventDispatcher { - constructor() { - super(...arguments), this.id = _++, this.name = "", this.side = n.FrontSide, this.opacity = 1, this.transparent = !1, this.depthTest = !0, this.depthWrite = !0, this.stencilTest = !0, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.alphaTest = 0, this.visible = !0, this.needsUpdate = !0, this.outline = !1; - } - setValues(c = {}) { - if (c !== void 0) - for (var S in c) { - var y = c[S]; - if (y === void 0) { - console.warn("$3Dmol.Material: '" + S + "' parameter is undefined."); - continue; - } - if (S in this) { - var w = this[S]; - w instanceof b.Color && y instanceof b.Color ? w.copy(y) : w instanceof b.Color ? w.set(y) : w instanceof u.Vector3 && y instanceof u.Vector3 ? w.copy(y) : this[S] = y; - } - } - } - //TODO: might want to look into blending equations - clone(c = new h()) { - return c.name = this.name, c.side = this.side, c.opacity = this.opacity, c.transparent = this.transparent, c.depthTest = this.depthTest, c.depthWrite = this.depthWrite, c.stencilTest = this.stencilTest, c.polygonOffset = this.polygonOffset, c.polygonOffsetFactor = this.polygonOffsetFactor, c.polygonOffsetUnits = this.polygonOffsetUnits, c.alphaTest = this.alphaTest, c.overdraw = this.overdraw, c.visible = this.visible, c; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - } - let _ = 0; - } - ), - /***/ - "./src/WebGL/materials/MeshDoubleLambertMaterial.ts": ( - /*!**********************************************************!*\ - !*** ./src/WebGL/materials/MeshDoubleLambertMaterial.ts ***! - \**********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MeshDoubleLambertMaterial: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./../constants/Sides */ - "./src/WebGL/constants/Sides.ts" - ), f = r( - /*! ./MeshLambertMaterial */ - "./src/WebGL/materials/MeshLambertMaterial.ts" - ); - class u extends f.MeshLambertMaterial { - constructor(h) { - super(h), this.shaderID = "lambertdouble", this.side = n.DoubleSide, this.outline = !1; - } - clone(h = new u()) { - return super.clone.call(this, h), h; - } - } - } - ), - /***/ - "./src/WebGL/materials/MeshLambertMaterial.ts": ( - /*!****************************************************!*\ - !*** ./src/WebGL/materials/MeshLambertMaterial.ts ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MeshLambertMaterial: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ./../constants/Coloring */ - "./src/WebGL/constants/Coloring.ts" - ), f = r( - /*! ./../constants/Shading */ - "./src/WebGL/constants/Shading.ts" - ), u = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ), b = r( - /*! ../../colors */ - "./src/colors.ts" - ), h = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - class _ extends u.Material { - constructor(c) { - super(), this.color = new b.Color(16777215), this.ambient = new b.Color(1048575), this.emissive = new b.Color(0), this.wrapAround = !1, this.wrapRGB = new h.Vector3(1, 1, 1), this.map = void 0, this.lightMap = null, this.specularMap = null, this.envMap = null, this.reflectivity = 1, this.refractionRatio = 0.98, this.fog = !0, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.shading = f.Shading.SmoothShading, this.shaderID = "lambert", this.vertexColors = n.Coloring.NoColors, this.skinning = !1, this.setValues(c); - } - clone(c = new _()) { - return super.clone.call(this, c), c.color.copy(this.color), c.ambient.copy(this.ambient), c.emissive.copy(this.emissive), c.wrapAround = this.wrapAround, c.wrapRGB.copy(this.wrapRGB), c.map = this.map, c.lightMap = this.lightMap, c.specularMap = this.specularMap, c.envMap = this.envMap, c.combine = this.combine, c.reflectivity = this.reflectivity, c.refractionRatio = this.refractionRatio, c.fog = this.fog, c.shading = this.shading, c.shaderID = this.shaderID, c.vertexColors = this.vertexColors, c.skinning = this.skinning, c.morphTargets = this.morphTargets, c.morphNormals = this.morphNormals, c; - } - } - } - ), - /***/ - "./src/WebGL/materials/MeshOutlineMaterial.ts": ( - /*!****************************************************!*\ - !*** ./src/WebGL/materials/MeshOutlineMaterial.ts ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MeshOutlineMaterial: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../../colors */ - "./src/colors.ts" - ), f = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class u extends f.Material { - constructor(h) { - super(), h = h || {}, this.fog = !0, this.shaderID = "outline", this.wireframe = !1, this.outlineColor = h.color || new n.Color(0, 0, 0), this.outlineWidth = h.width || 0.1, this.outlinePushback = h.pushback || 1; - } - clone(h = new u()) { - return super.clone.call(this, h), h.fog = this.fog, h.shaderID = this.shaderID, h.wireframe = this.wireframe, h; - } - } - } - ), - /***/ - "./src/WebGL/materials/SphereImposterMaterial.ts": ( - /*!*******************************************************!*\ - !*** ./src/WebGL/materials/SphereImposterMaterial.ts ***! - \*******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SphereImposterMaterial: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./ImposterMaterial */ - "./src/WebGL/materials/ImposterMaterial.ts" - ); - class f extends n.ImposterMaterial { - constructor(b) { - super(b), this.shaderID = "sphereimposter", this.setValues(b); - } - clone(b = new f()) { - return super.clone.call(this, b), b; - } - } - } - ), - /***/ - "./src/WebGL/materials/SphereImposterOutlineMaterial.ts": ( - /*!**************************************************************!*\ - !*** ./src/WebGL/materials/SphereImposterOutlineMaterial.ts ***! - \**************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SphereImposterOutlineMaterial: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../../colors */ - "./src/colors.ts" - ), f = r( - /*! ./ImposterMaterial */ - "./src/WebGL/materials/ImposterMaterial.ts" - ); - class u extends f.ImposterMaterial { - constructor(h) { - super(h), h = h || {}, this.shaderID = "sphereimposteroutline", this.outlineColor = h.color || new n.Color(0, 0, 0), this.outlineWidth = h.width || 0.1, this.outlinePushback = h.pushback || 1, this.setValues(h); - } - clone(h = new u()) { - return super.clone.call(this, h), h.outlineColor = this.outlineColor, h.outlineWidth = this.outlineWidth, h.outlinePushback = this.outlinePushback, h; - } - } - } - ), - /***/ - "./src/WebGL/materials/SpriteMaterial.ts": ( - /*!***********************************************!*\ - !*** ./src/WebGL/materials/SpriteMaterial.ts ***! - \***********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SpriteMaterial: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ../constants/SpriteAlignment */ - "./src/WebGL/constants/SpriteAlignment.ts" - ), f = r( - /*! ../core/Texture */ - "./src/WebGL/core/Texture.ts" - ), u = r( - /*! ../../colors */ - "./src/colors.ts" - ), b = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ), h = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class _ extends h.Material { - constructor(c) { - super(), this.color = new u.Color(16777215), this.map = new f.Texture(), this.useScreenCoordinates = !0, this.fog = !1, this.uvOffset = new b.Vector2(0, 0), this.uvScale = new b.Vector2(1, 1), this.depthTest = !this.useScreenCoordinates, this.sizeAttenuation = !this.useScreenCoordinates, this.screenOffset = this.screenOffset, this.scaleByViewPort = !this.sizeAttenuation, this.alignment = n.SpriteAlignment.center.clone(), this.setValues(c), c = c || {}, c.depthTest === void 0 && (this.depthTest = !this.useScreenCoordinates), c.sizeAttenuation === void 0 && (this.sizeAttenuation = !this.useScreenCoordinates), c.scaleByViewPort === void 0 && (this.scaleByViewPort = !this.sizeAttenuation); - } - clone(c = new _()) { - return super.clone.call(this, c), c.color.copy(this.color), c.map = this.map, c.useScreenCoordinates = this.useScreenCoordinates, c.screenOffset = this.screenOffset, c.sizeAttenuation = this.sizeAttenuation, c.scaleByViewport = this.scaleByViewPort, c.alignment.copy(this.alignment), c.uvOffset.copy(this.uvOffset), c; - } - } - } - ), - /***/ - "./src/WebGL/materials/StickImposterMaterial.ts": ( - /*!******************************************************!*\ - !*** ./src/WebGL/materials/StickImposterMaterial.ts ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - StickImposterMaterial: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./ImposterMaterial */ - "./src/WebGL/materials/ImposterMaterial.ts" - ); - class f extends n.ImposterMaterial { - constructor(b) { - super(b), this.shaderID = "stickimposter", this.setValues(b); - } - clone(b = new f()) { - return super.clone.call(this, b), b; - } - } - } - ), - /***/ - "./src/WebGL/materials/StickImposterOutlineMaterial.ts": ( - /*!*************************************************************!*\ - !*** ./src/WebGL/materials/StickImposterOutlineMaterial.ts ***! - \*************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - StickImposterOutlineMaterial: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../../colors */ - "./src/colors.ts" - ), f = r( - /*! ./ImposterMaterial */ - "./src/WebGL/materials/ImposterMaterial.ts" - ); - class u extends f.ImposterMaterial { - constructor(h = {}) { - super(h), this.shaderID = "stickimposteroutline", this.outlineColor = new n.Color(0, 0, 0), this.outlineWidth = 0.1, this.outlinePushback = 1, h.color && (this.outlineColor = h.color), h.width && (this.outlineWidth = h.width), h.pushback && (this.outlinePushback = h.pushback), this.setValues(h); - } - clone(h = new u()) { - return super.clone.call(this, h), h.outlineColor = this.outlineColor, h.outlineWidth = this.outlineWidth, h.outlinePushback = this.outlinePushback, h; - } - } - } - ), - /***/ - "./src/WebGL/materials/VolumetricMaterial.ts": ( - /*!***************************************************!*\ - !*** ./src/WebGL/materials/VolumetricMaterial.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - VolumetricMaterial: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ../constants/Sides */ - "./src/WebGL/constants/Sides.ts" - ), f = r( - /*! ../../colors */ - "./src/colors.ts" - ), u = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ); - class b extends u.Material { - constructor(_) { - super(), this.transparent = !1, this.volumetric = !0, this.color = new f.Color(16777215), this.transferfn = null, this.map = void 0, this.extent = [], this.maxdepth = 100, this.unit = 0, this.texmatrix = null, this.transfermin = -1, this.transfermax = 1, this.subsamples = 5, this.shaderID = "volumetric", this.side = n.FrontSide, this.setValues(_); - } - clone(_ = new b()) { - return super.clone.call(this, _), _.transparent = this.transparent, _.volumetric = this.volumetric, _.color = this.color, _.transferfn = this.transferfn, _.map = this.map, _.extent = this.extent, _.maxdepth = this.maxdepth, _.unit = this.unit, _.texmatrix = this.texmatrix, _.transfermin = this.transfermin, _.transfermax = this.transfermax, _.subsamples = this.subsamples, _.shaderID = this.shaderID, _.side = this.side, _; - } - } - } - ), - /***/ - "./src/WebGL/materials/index.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/materials/index.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ImposterMaterial: () => ( - /* reexport safe */ - n.ImposterMaterial - ), - /* harmony export */ - InstancedMaterial: () => ( - /* reexport safe */ - f.InstancedMaterial - ), - /* harmony export */ - LineBasicMaterial: () => ( - /* reexport safe */ - u.LineBasicMaterial - ), - /* harmony export */ - Material: () => ( - /* reexport safe */ - b.Material - ), - /* harmony export */ - MaterialIdCount: () => ( - /* reexport safe */ - b.MaterialIdCount - ), - /* harmony export */ - MeshDoubleLambertMaterial: () => ( - /* reexport safe */ - h.MeshDoubleLambertMaterial - ), - /* harmony export */ - MeshLambertMaterial: () => ( - /* reexport safe */ - _.MeshLambertMaterial - ), - /* harmony export */ - MeshOutlineMaterial: () => ( - /* reexport safe */ - E.MeshOutlineMaterial - ), - /* harmony export */ - SphereImposterMaterial: () => ( - /* reexport safe */ - c.SphereImposterMaterial - ), - /* harmony export */ - SphereImposterOutlineMaterial: () => ( - /* reexport safe */ - S.SphereImposterOutlineMaterial - ), - /* harmony export */ - SpriteMaterial: () => ( - /* reexport safe */ - y.SpriteMaterial - ), - /* harmony export */ - StickImposterMaterial: () => ( - /* reexport safe */ - w.StickImposterMaterial - ), - /* harmony export */ - StickImposterOutlineMaterial: () => ( - /* reexport safe */ - L.StickImposterOutlineMaterial - ), - /* harmony export */ - VolumetricMaterial: () => ( - /* reexport safe */ - s.VolumetricMaterial - ) - /* harmony export */ - }); - var n = r( - /*! ./ImposterMaterial */ - "./src/WebGL/materials/ImposterMaterial.ts" - ), f = r( - /*! ./InstancedMaterial */ - "./src/WebGL/materials/InstancedMaterial.ts" - ), u = r( - /*! ./LineBasicMaterial */ - "./src/WebGL/materials/LineBasicMaterial.ts" - ), b = r( - /*! ./Material */ - "./src/WebGL/materials/Material.ts" - ), h = r( - /*! ./MeshDoubleLambertMaterial */ - "./src/WebGL/materials/MeshDoubleLambertMaterial.ts" - ), _ = r( - /*! ./MeshLambertMaterial */ - "./src/WebGL/materials/MeshLambertMaterial.ts" - ), E = r( - /*! ./MeshOutlineMaterial */ - "./src/WebGL/materials/MeshOutlineMaterial.ts" - ), c = r( - /*! ./SphereImposterMaterial */ - "./src/WebGL/materials/SphereImposterMaterial.ts" - ), S = r( - /*! ./SphereImposterOutlineMaterial */ - "./src/WebGL/materials/SphereImposterOutlineMaterial.ts" - ), y = r( - /*! ./SpriteMaterial */ - "./src/WebGL/materials/SpriteMaterial.ts" - ), w = r( - /*! ./StickImposterMaterial */ - "./src/WebGL/materials/StickImposterMaterial.ts" - ), L = r( - /*! ./StickImposterOutlineMaterial */ - "./src/WebGL/materials/StickImposterOutlineMaterial.ts" - ), s = r( - /*! ./VolumetricMaterial */ - "./src/WebGL/materials/VolumetricMaterial.ts" - ); - } - ), - /***/ - "./src/WebGL/math/Quaternion.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/math/Quaternion.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Quaternion: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - class n { - constructor(u, b, h, _) { - this.x = u || 0, this.y = b || 0, this.z = h || 0, this.w = _ !== void 0 ? _ : 1; - } - set(u, b, h, _) { - return this.x = u, this.y = b, this.z = h, this.w = _, this; - } - copy(u) { - return this.x = u.x, this.y = u.y, this.z = u.z, this.w = u.w, this; - } - conjugate() { - return this.x *= -1, this.y *= -1, this.z *= -1, this; - } - inverse() { - return this.conjugate().normalize(); - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - } - lengthxyz() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - normalize() { - let u = this.length(); - return u === 0 ? (this.x = 0, this.y = 0, this.z = 0, this.w = 1) : (u = 1 / u, this.x *= u, this.y *= u, this.z *= u, this.w *= u), this; - } - multiply(u) { - return this.multiplyQuaternions(this, u); - } - multiplyScalar(u) { - return this.x *= u, this.y *= u, this.z *= u, this.w *= u, this; - } - multiplyQuaternions(u, b) { - const h = u.x, _ = u.y, E = u.z, c = u.w, S = b.x, y = b.y, w = b.z, L = b.w; - return this.x = h * L + c * S + _ * w - E * y, this.y = _ * L + c * y + E * S - h * w, this.z = E * L + c * w + h * y - _ * S, this.w = c * L - h * S - _ * y - E * w, this; - } - sub(u) { - return this.x -= u.x, this.y -= u.y, this.z -= u.z, this.w -= u.w, this; - } - clone() { - return new n(this.x, this.y, this.z, this.w); - } - setFromEuler(u) { - const b = Math.cos(u.x / 2), h = Math.cos(u.y / 2), _ = Math.cos(u.z / 2), E = Math.sin(u.x / 2), c = Math.sin(u.y / 2), S = Math.sin(u.z / 2); - return this.x = E * h * _ + b * c * S, this.y = b * c * _ - E * h * S, this.z = b * h * S + E * c * _, this.w = b * h * _ - E * c * S, this; - } - } - } - ), - /***/ - "./src/WebGL/math/Vector2.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/math/Vector2.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Vector2: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - class n { - constructor(u, b) { - this.x = u || 0, this.y = b || 0; - } - set(u, b) { - return this.x = u, this.y = b, this; - } - subVectors(u, b) { - return this.x = u.x - b.x, this.y = u.y - b.y, this; - } - copy(u) { - return this.x = u.x, this.y = u.y, this; - } - clone() { - return new n(this.x, this.y); - } - } - } - ), - /***/ - "./src/WebGL/math/index.ts": ( - /*!*********************************!*\ - !*** ./src/WebGL/math/index.ts ***! - \*********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Matrix3: () => ( - /* reexport safe */ - _.Matrix3 - ), - /* harmony export */ - Matrix4: () => ( - /* reexport safe */ - _.Matrix4 - ), - /* harmony export */ - Quaternion: () => ( - /* reexport safe */ - n.Quaternion - ), - /* harmony export */ - Ray: () => ( - /* reexport safe */ - _.Ray - ), - /* harmony export */ - Vector2: () => ( - /* reexport safe */ - f.Vector2 - ), - /* harmony export */ - Vector3: () => ( - /* reexport safe */ - _.Vector3 - ), - /* harmony export */ - clamp: () => ( - /* reexport safe */ - u.clamp - ), - /* harmony export */ - conversionMatrix3: () => ( - /* reexport safe */ - b.conversionMatrix3 - ), - /* harmony export */ - degToRad: () => ( - /* reexport safe */ - h.degToRad - ) - /* harmony export */ - }); - var n = r( - /*! ./Quaternion */ - "./src/WebGL/math/Quaternion.ts" - ), f = r( - /*! ./Vector2 */ - "./src/WebGL/math/Vector2.ts" - ), u = r( - /*! ./utils/clamp */ - "./src/WebGL/math/utils/clamp.ts" - ), b = r( - /*! ./utils/conversionMatrix3 */ - "./src/WebGL/math/utils/conversionMatrix3.ts" - ), h = r( - /*! ./utils/degToRad */ - "./src/WebGL/math/utils/degToRad.ts" - ), _ = r( - /*! ./math */ - "./src/WebGL/math/math.ts" - ); - } - ), - /***/ - "./src/WebGL/math/math.ts": ( - /*!********************************!*\ - !*** ./src/WebGL/math/math.ts ***! - \********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Matrix3: () => ( - /* binding */ - y - ), - /* harmony export */ - Matrix4: () => ( - /* binding */ - c - ), - /* harmony export */ - Ray: () => ( - /* binding */ - w - ), - /* harmony export */ - Vector3: () => ( - /* binding */ - S - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/degToRad */ - "./src/WebGL/math/utils/degToRad.ts" - ), f = r( - /*! ./utils/clamp */ - "./src/WebGL/math/utils/clamp.ts" - ), u, b, h, _, E; - class c { - constructor(s = 1, o = 0, A = 0, p = 0, v = 0, a = 1, l = 0, g = 0, M = 0, C = 0, T = 1, D = 0, I = 0, B = 0, P = 0, z = 1) { - typeof s < "u" && typeof s != "number" ? this.elements = new Float32Array(s) : (this.elements = new Float32Array(16), this.elements[0] = s, this.elements[4] = o, this.elements[8] = A, this.elements[12] = p, this.elements[1] = v, this.elements[5] = a, this.elements[9] = l, this.elements[13] = g, this.elements[2] = M, this.elements[6] = C, this.elements[10] = T, this.elements[14] = D, this.elements[3] = I, this.elements[7] = B, this.elements[11] = P, this.elements[15] = z); - } - // eslint-disable-next-line no-unused-vars, class-methods-use-this - makeScale(s, o, A) { - throw new Error("Method not implemented."); - } - set(s, o, A, p, v, a, l, g, M, C, T, D, I, B, P, z) { - const k = this.elements; - return k[0] = s, k[4] = o, k[8] = A, k[12] = p, k[1] = v, k[5] = a, k[9] = l, k[13] = g, k[2] = M, k[6] = C, k[10] = T, k[14] = D, k[3] = I, k[7] = B, k[11] = P, k[15] = z, this; - } - identity() { - return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this; - } - copy(s) { - const o = s.elements; - return this.set(o[0], o[4], o[8], o[12], o[1], o[5], o[9], o[13], o[2], o[6], o[10], o[14], o[3], o[7], o[11], o[15]), this; - } - matrix3FromTopLeft() { - const s = this.elements; - return new y(s[0], s[4], s[8], s[1], s[5], s[9], s[2], s[6], s[10]); - } - setRotationFromEuler(s, o) { - const A = this.elements, { x: p, y: v, z: a } = s, l = Math.cos(p), g = Math.sin(p), M = Math.cos(v), C = Math.sin(v), T = Math.cos(a), D = Math.sin(a); - if (o === void 0 || o === "XYZ") { - const I = l * T, B = l * D, P = g * T, z = g * D; - A[0] = M * T, A[4] = -M * D, A[8] = C, A[1] = B + P * C, A[5] = I - z * C, A[9] = -g * M, A[2] = z - I * C, A[6] = P + B * C, A[10] = l * M; - } else - console.error(`Error with matrix4 setRotationFromEuler. Order: ${o}`); - return this; - } - setRotationFromQuaternion(s) { - const o = this.elements, { x: A, y: p, z: v, w: a } = s, l = A + A, g = p + p, M = v + v, C = A * l, T = A * g, D = A * M, I = p * g, B = p * M, P = v * M, z = a * l, k = a * g, N = a * M; - return o[0] = 1 - (I + P), o[4] = T - N, o[8] = D + k, o[1] = T + N, o[5] = 1 - (C + P), o[9] = B - z, o[2] = D - k, o[6] = B + z, o[10] = 1 - (C + I), this; - } - multiplyMatrices(s, o) { - const A = s.elements, p = o.elements, v = this.elements, a = A[0], l = A[4], g = A[8], M = A[12], C = A[1], T = A[5], D = A[9], I = A[13], B = A[2], P = A[6], z = A[10], k = A[14], N = A[3], R = A[7], U = A[11], W = A[15], G = p[0], F = p[4], V = p[8], J = p[12], X = p[1], oe = p[5], te = p[9], ve = p[13], se = p[2], le = p[6], Ce = p[10], be = p[14], Le = p[3], ae = p[7], _e = p[11], Ee = p[15]; - return v[0] = a * G + l * X + g * se + M * Le, v[4] = a * F + l * oe + g * le + M * ae, v[8] = a * V + l * te + g * Ce + M * _e, v[12] = a * J + l * ve + g * be + M * Ee, v[1] = C * G + T * X + D * se + I * Le, v[5] = C * F + T * oe + D * le + I * ae, v[9] = C * V + T * te + D * Ce + I * _e, v[13] = C * J + T * ve + D * be + I * Ee, v[2] = B * G + P * X + z * se + k * Le, v[6] = B * F + P * oe + z * le + k * ae, v[10] = B * V + P * te + z * Ce + k * _e, v[14] = B * J + P * ve + z * be + k * Ee, v[3] = N * G + R * X + U * se + W * Le, v[7] = N * F + R * oe + U * le + W * ae, v[11] = N * V + R * te + U * Ce + W * _e, v[15] = N * J + R * ve + U * be + W * Ee, this; - } - multiplyScalar(s) { - const o = this.elements; - return o[0] *= s, o[4] *= s, o[8] *= s, o[12] *= s, o[1] *= s, o[5] *= s, o[9] *= s, o[13] *= s, o[2] *= s, o[6] *= s, o[10] *= s, o[14] *= s, o[3] *= s, o[7] *= s, o[11] *= s, o[15] *= s, this; - } - makeTranslation(s, o, A) { - return this.set(1, 0, 0, s, 0, 1, 0, o, 0, 0, 1, A, 0, 0, 0, 1), this; - } - // snap values close to integers to their integer value - // useful and identifying identity matrices - snap(s) { - const o = Math.pow(10, 4), A = this.elements; - for (let p = 0; p < 16; p++) { - const v = Math.round(A[p]); - v === Math.round(A[p] * o) / o && (A[p] = v); - } - return this; - } - transpose() { - const s = this.elements; - let o; - return o = s[1], s[1] = s[4], s[4] = o, o = s[2], s[2] = s[8], s[8] = o, o = s[6], s[6] = s[9], s[9] = o, o = s[3], s[3] = s[12], s[12] = o, o = s[7], s[7] = s[13], s[13] = o, o = s[11], s[11] = s[14], s[14] = o, this; - } - setPosition(s) { - const o = this.elements; - return o[12] = s.x, o[13] = s.y, o[14] = s.z, this; - } - translate(s) { - const o = this.elements; - return o[12] += s.x, o[13] += s.y, o[14] += s.z, this; - } - getInverse(s, o) { - const A = this.elements, p = s.elements, v = p[0], a = p[4], l = p[8], g = p[12], M = p[1], C = p[5], T = p[9], D = p[13], I = p[2], B = p[6], P = p[10], z = p[14], k = p[3], N = p[7], R = p[11], U = p[15]; - A[0] = T * z * N - D * P * N + D * B * R - C * z * R - T * B * U + C * P * U, A[4] = g * P * N - l * z * N - g * B * R + a * z * R + l * B * U - a * P * U, A[8] = l * D * N - g * T * N + g * C * R - a * D * R - l * C * U + a * T * U, A[12] = g * T * B - l * D * B - g * C * P + a * D * P + l * C * z - a * T * z, A[1] = D * P * k - T * z * k - D * I * R + M * z * R + T * I * U - M * P * U, A[5] = l * z * k - g * P * k + g * I * R - v * z * R - l * I * U + v * P * U, A[9] = g * T * k - l * D * k - g * M * R + v * D * R + l * M * U - v * T * U, A[13] = l * D * I - g * T * I + g * M * P - v * D * P - l * M * z + v * T * z, A[2] = C * z * k - D * B * k + D * I * N - M * z * N - C * I * U + M * B * U, A[6] = g * B * k - a * z * k - g * I * N + v * z * N + a * I * U - v * B * U, A[10] = a * D * k - g * C * k + g * M * N - v * D * N - a * M * U + v * C * U, A[14] = g * C * I - a * D * I - g * M * B + v * D * B + a * M * z - v * C * z, A[3] = T * B * k - C * P * k - T * I * N + M * P * N + C * I * R - M * B * R, A[7] = a * P * k - l * B * k + l * I * N - v * P * N - a * I * R + v * B * R, A[11] = l * C * k - a * T * k - l * M * N + v * T * N + a * M * R - v * C * R, A[15] = a * T * I - l * C * I + l * M * B - v * T * B - a * M * P + v * C * P; - const W = v * A[0] + M * A[4] + I * A[8] + k * A[12]; - if (W === 0) { - const G = "Matrix4.getInverse(): can't invert matrix, determinant is 0"; - if (o) - throw new Error(G); - return console.warn(G), this.identity(), this; - } - return this.multiplyScalar(1 / W), this; - } - isReflected() { - const s = this.elements, o = s[0], A = s[4], p = s[8], v = s[1], a = s[5], l = s[9], g = s[2], M = s[6], C = s[10]; - return o * a * C + // +aei - v * M * p + // +bfg - g * A * l - // +cdh - g * a * p - // -ceg - v * A * C - // -bdi - o * M * l < 0; - } - scale(s) { - const o = this.elements, { x: A } = s, { y: p } = s, { z: v } = s; - return o[0] *= A, o[4] *= p, o[8] *= v, o[1] *= A, o[5] *= p, o[9] *= v, o[2] *= A, o[6] *= p, o[10] *= v, o[3] *= A, o[7] *= p, o[11] *= v, this; - } - getMaxScaleOnAxis() { - const s = this.elements, o = s[0] * s[0] + s[1] * s[1] + s[2] * s[2], A = s[4] * s[4] + s[5] * s[5] + s[6] * s[6], p = s[8] * s[8] + s[9] * s[9] + s[10] * s[10]; - return Math.sqrt(Math.max(o, Math.max(A, p))); - } - makeFrustum(s, o, A, p, v, a) { - const l = this.elements, g = 2 * v / (o - s), M = 2 * v / (p - A), C = (o + s) / (o - s), T = (p + A) / (p - A), D = -(a + v) / (a - v), I = -2 * a * v / (a - v); - return l[0] = g, l[4] = 0, l[8] = C, l[12] = 0, l[1] = 0, l[5] = M, l[9] = T, l[13] = 0, l[2] = 0, l[6] = 0, l[10] = D, l[14] = I, l[3] = 0, l[7] = 0, l[11] = -1, l[15] = 0, this; - } - makePerspective(s, o, A, p) { - const v = A * Math.tan((0, n.degToRad)(s * 0.5)), a = -v, l = a * o, g = v * o; - return this.makeFrustum(l, g, a, v, A, p); - } - makeOrthographic(s, o, A, p, v, a) { - const l = this.elements, g = 1 / (o - s), M = 1 / (A - p), C = 1 / (a - v), T = (o + s) * g, D = (A + p) * M, I = (a + v) * C; - return l[0] = 2 * g, l[4] = 0, l[8] = 0, l[12] = -T, l[1] = 0, l[5] = 2 * M, l[9] = 0, l[13] = -D, l[2] = 0, l[6] = 0, l[10] = -2 * C, l[14] = -I, l[3] = 0, l[7] = 0, l[11] = 0, l[15] = 1, this; - } - isEqual(s) { - const o = s.elements, A = this.elements; - return A[0] === o[0] && A[4] === o[4] && A[8] === o[8] && A[12] === o[12] && A[1] === o[1] && A[5] === o[5] && A[9] === o[9] && A[13] === o[13] && A[2] === o[2] && A[6] === o[6] && A[10] === o[10] && A[14] === o[14] && A[3] === o[3] && A[7] === o[7] && A[11] === o[11] && A[15] === o[15]; - } - clone() { - const s = this.elements; - return new c(s[0], s[4], s[8], s[12], s[1], s[5], s[9], s[13], s[2], s[6], s[10], s[14], s[3], s[7], s[11], s[15]); - } - isIdentity() { - const s = this.elements; - return s[0] === 1 && s[4] === 0 && s[8] === 0 && s[12] === 0 && s[1] === 0 && s[5] === 1 && s[9] === 0 && s[13] === 0 && s[2] === 0 && s[6] === 0 && s[10] === 1 && s[14] === 0 && s[3] === 0 && s[7] === 0 && s[11] === 0 && s[15] === 1; - } - // return true if elements are with digits of identity - isNearlyIdentity(s) { - return this.clone().snap(s).isIdentity(); - } - getScale(s) { - const o = this.elements; - return s = s || new S(), h.set(o[0], o[1], o[2]), _.set(o[4], o[5], o[6]), E.set(o[8], o[9], o[10]), s.x = h.length(), s.y = _.length(), s.z = E.length(), s; - } - lookAt(s, o, A) { - const p = this.elements; - return E.subVectors(s, o).normalize(), E.length() === 0 && (E.z = 1), h.crossVectors(A, E).normalize(), h.length() === 0 && (E.x += 1e-4, h.crossVectors(A, E).normalize()), _.crossVectors(E, h), p[0] = h.x, p[4] = _.x, p[8] = E.x, p[1] = h.y, p[5] = _.y, p[9] = E.y, p[2] = h.z, p[6] = _.z, p[10] = E.z, this; - } - compose(s, o, A) { - const p = this.elements; - return u.identity(), u.setRotationFromQuaternion(o), b.makeScale(A.x, A.y, A.z), this.multiplyMatrices(u, b), p[12] = s.x, p[13] = s.y, p[14] = s.z, this; - } - } - u = new c(), b = new c(); - class S { - constructor(s, o, A) { - this.x = s || 0, this.y = o || 0, this.z = A || 0, this.atomid = void 0; - } - set(s, o, A) { - return this.x = s, this.y = o, this.z = A, this; - } - copy(s) { - return this.x = s.x, this.y = s.y, this.z = s.z, this; - } - add(s) { - return this.x += s.x, this.y += s.y, this.z += s.z, this; - } - addVectors(s, o) { - return this.x = s.x + o.x, this.y = s.y + o.y, this.z = s.z + o.z, this; - } - multiplyVectors(s, o) { - return this.x = s.x * o.x, this.y = s.y * o.y, this.z = s.z * o.z, this; - } - sub(s) { - return this.x -= s.x, this.y -= s.y, this.z -= s.z, this; - } - subVectors(s, o) { - return this.x = s.x - o.x, this.y = s.y - o.y, this.z = s.z - o.z, this; - } - multiplyScalar(s) { - return this.x *= s, this.y *= s, this.z *= s, this; - } - divideScalar(s) { - return s !== 0 ? (this.x /= s, this.y /= s, this.z /= s) : (this.x = 0, this.y = 0, this.z = 0), this; - } - // accumulate maximum - max(s) { - return this.x = Math.max(this.x, s.x), this.y = Math.max(this.y, s.y), this.z = Math.max(this.z, s.z), this; - } - // accumulate min - min(s) { - return this.x = Math.min(this.x, s.x), this.y = Math.min(this.y, s.y), this.z = Math.min(this.z, s.z), this; - } - distanceTo(s) { - return Math.sqrt(this.distanceToSquared(s)); - } - distanceToSquared(s) { - const o = this.x - s.x, A = this.y - s.y, p = this.z - s.z; - return o * o + A * A + p * p; - } - applyMatrix3(s) { - const { x: o } = this, { y: A } = this, { z: p } = this, v = s.elements; - return this.x = v[0] * o + v[3] * A + v[6] * p, this.y = v[1] * o + v[4] * A + v[7] * p, this.z = v[2] * o + v[5] * A + v[8] * p, this; - } - applyMatrix4(s) { - const { x: o } = this, { y: A } = this, { z: p } = this, v = s.elements; - return this.x = v[0] * o + v[4] * A + v[8] * p + v[12], this.y = v[1] * o + v[5] * A + v[9] * p + v[13], this.z = v[2] * o + v[6] * A + v[10] * p + v[14], this; - } - applyProjection(s) { - const { x: o } = this, { y: A } = this, { z: p } = this, v = s.elements, a = v[3] * o + v[7] * A + v[11] * p + v[15]; - return this.x = (v[0] * o + v[4] * A + v[8] * p + v[12]) / a, this.y = (v[1] * o + v[5] * A + v[9] * p + v[13]) / a, this.z = (v[2] * o + v[6] * A + v[10] * p + v[14]) / a, this; - } - applyQuaternion(s) { - const { x: o } = this, { y: A } = this, { z: p } = this, v = s.x, a = s.y, l = s.z, g = s.w, M = {}; - M.x = 2 * (A * l - p * a), M.y = 2 * (p * v - o * l), M.z = 2 * (o * a - A * v); - const C = {}; - return C.x = M.y * l - M.z * a, C.y = M.z * v - M.x * l, C.z = M.x * a - M.y * v, this.x = o + g * M.x + C.x, this.y = A + g * M.y + C.y, this.z = p + g * M.z + C.z, this; - } - negate() { - return this.multiplyScalar(-1); - } - dot(s) { - return this.x * s.x + this.y * s.y + this.z * s.z; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - normalize() { - return this.divideScalar(this.length()); - } - cross(s) { - const { x: o } = this, { y: A } = this, { z: p } = this; - return this.x = A * s.z - p * s.y, this.y = p * s.x - o * s.z, this.z = o * s.y - A * s.x, this; - } - crossVectors(s, o) { - return this.x = s.y * o.z - s.z * o.y, this.y = s.z * o.x - s.x * o.z, this.z = s.x * o.y - s.y * o.x, this; - } - equals(s) { - return this.x == s.x && this.y == s.y && this.z == s.z; - } - getPositionFromMatrix(s) { - return this.x = s.elements[12], this.y = s.elements[13], this.z = s.elements[14], this; - } - setEulerFromRotationMatrix(s, o) { - const A = s.elements, p = A[0], v = A[4], a = A[8], l = A[5], g = A[9], M = A[6], C = A[10]; - return o === void 0 || o === "XYZ" ? (this.y = Math.asin((0, f.clamp)(a, -1, 1)), Math.abs(a) < 0.99999 ? (this.x = Math.atan2(-g, C), this.z = Math.atan2(-v, p)) : (this.x = Math.atan2(M, l), this.z = 0)) : console.error(`Error with vector's setEulerFromRotationMatrix: Unknown order: ${o}`), this; - } - rotateAboutVector(s, o) { - s.normalize(); - const A = Math.cos(o), p = Math.sin(o), v = this.clone().multiplyScalar(A), a = s.clone().cross(this).multiplyScalar(p), l = s.clone().multiplyScalar(s.clone().dot(this)).multiplyScalar(1 - A), g = v.add(a).add(l); - return this.x = g.x, this.y = g.y, this.z = g.z, this; - } - setFromMatrixPosition(s) { - const o = s.elements; - return this.x = o[12], this.y = o[13], this.z = o[14], this; - } - // unproject is defined after Matrix4 - transformDirection(s) { - const { x: o } = this, { y: A } = this, { z: p } = this, v = s.elements; - return this.x = v[0] * o + v[4] * A + v[8] * p, this.y = v[1] * o + v[5] * A + v[9] * p, this.z = v[2] * o + v[6] * A + v[10] * p, this.normalize(); - } - clone() { - return new S(this.x, this.y, this.z); - } - unproject(s) { - const o = u; - return o.multiplyMatrices(s.matrixWorld, o.getInverse(s.projectionMatrix)), this.applyMatrix4(o); - } - } - h = new S(), _ = new S(), E = new S(); - class y { - constructor(s = 1, o = 0, A = 0, p = 0, v = 1, a = 0, l = 0, g = 0, M = 1) { - this.elements = new Float32Array(9), this.set(s, o, A, p, v, a, l, g, M); - } - set(s, o, A, p, v, a, l, g, M) { - const C = this.elements; - return C[0] = s, C[3] = o, C[6] = A, C[1] = p, C[4] = v, C[7] = a, C[2] = l, C[5] = g, C[8] = M, this; - } - identity() { - return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this; - } - copy(s) { - const o = s.elements; - this.set(o[0], o[3], o[6], o[1], o[4], o[7], o[2], o[5], o[8]); - } - multiplyScalar(s) { - const o = this.elements; - return o[0] *= s, o[3] *= s, o[6] *= s, o[1] *= s, o[4] *= s, o[7] *= s, o[2] *= s, o[5] *= s, o[8] *= s, this; - } - getInverse3(s) { - const o = s.elements, A = this.elements; - A[0] = o[4] * o[8] - o[5] * o[7], A[3] = o[6] * o[5] - o[3] * o[8], A[6] = o[3] * o[7] - o[6] * o[4], A[1] = o[7] * o[2] - o[1] * o[8], A[4] = o[0] * o[8] - o[6] * o[2], A[7] = o[1] * o[6] - o[0] * o[7], A[2] = o[1] * o[5] - o[2] * o[4], A[5] = o[2] * o[3] - o[0] * o[5], A[8] = o[0] * o[4] - o[1] * o[3]; - const p = o[0] * A[0] + o[3] * A[1] + o[6] * A[2]; - return this.multiplyScalar(1 / p), this; - } - getInverse(s, o) { - const A = s.elements, p = this.elements; - p[0] = A[10] * A[5] - A[6] * A[9], p[1] = -A[10] * A[1] + A[2] * A[9], p[2] = A[6] * A[1] - A[2] * A[5], p[3] = -A[10] * A[4] + A[6] * A[8], p[4] = A[10] * A[0] - A[2] * A[8], p[5] = -A[6] * A[0] + A[2] * A[4], p[6] = A[9] * A[4] - A[5] * A[8], p[7] = -A[9] * A[0] + A[1] * A[8], p[8] = A[5] * A[0] - A[1] * A[4]; - const v = A[0] * p[0] + A[1] * p[3] + A[2] * p[6]; - if (v === 0) { - const a = "Matrix3.getInverse(): can't invert matrix, determinant is 0"; - if (o) - throw new Error(a); - return console.warn(a), this.identity(), this; - } - return this.multiplyScalar(1 / v), this; - } - // https://en.wikipedia.org/wiki/Determinant - getDeterminant() { - const s = this.elements; - return s[0] * s[4] * s[8] + // +aei - s[1] * s[5] * s[6] + // +bfg - s[2] * s[3] * s[7] - // +cdh - s[2] * s[4] * s[6] - // -ceg - s[1] * s[3] * s[8] - // -bdi - s[0] * s[5] * s[7]; - } - transpose() { - let s; - const o = this.elements; - return s = o[1], o[1] = o[3], o[3] = s, s = o[2], o[2] = o[6], o[6] = s, s = o[5], o[5] = o[7], o[7] = s, this; - } - clone() { - const s = this.elements; - return new y(s[0], s[3], s[6], s[1], s[4], s[7], s[2], s[5], s[8]); - } - getMatrix4() { - const s = this.elements; - return new c(s[0], s[3], s[6], 0, s[1], s[4], s[7], 0, s[2], s[5], s[8], 0); - } - } - class w { - constructor(s, o) { - this.origin = s !== void 0 ? s : new S(), this.direction = o !== void 0 ? o : new S(); - } - set(s, o) { - return this.origin.copy(s), this.direction.copy(o), this; - } - copy(s) { - return this.origin.copy(s.origin), this.direction.copy(s.direction), this; - } - at(s, o) { - return (o || new S()).copy(this.direction).multiplyScalar(s).add(this.origin); - } - recast(s) { - const o = h; - return this.origin.copy(this.at(s, o)), this; - } - closestPointToPoint(s, o) { - const A = o || new S(); - A.subVectors(s, this.origin); - const p = A.dot(this.direction); - return A.copy(this.direction).multiplyScalar(p).add(this.origin); - } - distanceToPoint(s) { - const o = h, A = o.subVectors(s, this.origin).dot(this.direction); - return o.copy(this.direction).multiplyScalar(A).add(this.origin), o.distanceTo(s); - } - // eslint-disable-next-line class-methods-use-this - isIntersectionCylinder() { - } - isIntersectionSphere(s) { - return this.distanceToPoint(s.center) <= s.radius; - } - isIntersectionPlane(s) { - return s.normal.dot(this.direction) !== 0 || s.distanceToPoint(this.origin) === 0; - } - distanceToPlane(s) { - const o = s.normal.dot(this.direction); - return o === 0 ? s.distanceToPoint(this.origin) === 0 ? 0 : void 0 : -(this.origin.dot(s.normal) + s.constant) / o; - } - intersectPlane(s, o) { - const A = this.distanceToPlane(s); - if (A !== void 0) - return this.at(A, o); - } - applyMatrix4(s) { - return this.direction.add(this.origin).applyMatrix4(s), this.origin.applyMatrix4(s), this.direction.sub(this.origin), this; - } - clone() { - return new w().copy(this); - } - } - } - ), - /***/ - "./src/WebGL/math/utils/clamp.ts": ( - /*!***************************************!*\ - !*** ./src/WebGL/math/utils/clamp.ts ***! - \***************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - clamp: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f, u, b) { - return Math.min(Math.max(f, u), b); - } - } - ), - /***/ - "./src/WebGL/math/utils/conversionMatrix3.ts": ( - /*!***************************************************!*\ - !*** ./src/WebGL/math/utils/conversionMatrix3.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - conversionMatrix3: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/math.ts" - ); - function f(u, b, h, _, E, c) { - _ = _ * Math.PI / 180, E = E * Math.PI / 180, c = c * Math.PI / 180; - const S = (A) => A * A, y = Math.cos(_), w = Math.cos(E), L = Math.cos(c), s = Math.sin(c); - return new n.Matrix3(u, b * L, h * w, 0, b * s, h * (y - w * L) / s, 0, 0, h * Math.sqrt(1 - S(y) - S(w) - S(L) + 2 * y * w * L) / s); - } - } - ), - /***/ - "./src/WebGL/math/utils/degToRad.ts": ( - /*!******************************************!*\ - !*** ./src/WebGL/math/utils/degToRad.ts ***! - \******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - degToRad: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - const n = Math.PI / 180; - function f(u) { - return u * n; - } - } - ), - /***/ - "./src/WebGL/objects/Line.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/objects/Line.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Line: () => ( - /* binding */ - b - ), - /* harmony export */ - LineStyle: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../materials */ - "./src/WebGL/materials/index.ts" - ), f = r( - /*! ../core */ - "./src/WebGL/core/index.ts" - ), u; - (function(h) { - h[h.LineStrip = 0] = "LineStrip", h[h.LinePieces = 1] = "LinePieces"; - })(u || (u = {})); - class b extends f.Object3D { - constructor(_, E = new n.LineBasicMaterial({ - color: Math.random() * 16777215 - }), c = u.LineStrip) { - super(), this.geometry = _, this.material = E, this.type = c; - } - clone(_ = new b(this.geometry, this.material, this.type)) { - return super.clone.call(this, _), _; - } - } - } - ), - /***/ - "./src/WebGL/objects/Mesh.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/objects/Mesh.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Mesh: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../core */ - "./src/WebGL/core/index.ts" - ); - class f extends n.Object3D { - constructor(b, h) { - super(), this.geometry = b, this.material = h; - } - clone(b) { - return b === void 0 && (b = new f(this.geometry, this.material)), super.clone.call(this, b), b; - } - } - } - ), - /***/ - "./src/WebGL/objects/Sprite.ts": ( - /*!*************************************!*\ - !*** ./src/WebGL/objects/Sprite.ts ***! - \*************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Sprite: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../materials */ - "./src/WebGL/materials/index.ts" - ), f = r( - /*! ../core */ - "./src/WebGL/core/index.ts" - ); - class u extends f.Object3D { - constructor(h = new n.SpriteMaterial()) { - super(), this.material = h, this.rotation3d = this.rotation, this.rotation = 0; - } - updateMatrix() { - this.matrix.setPosition(this.position), this.rotation3d.set(0, 0, this.rotation), this.matrix.setRotationFromEuler(this.rotation3d), (this.scale.x !== 1 || this.scale.y !== 1) && this.matrix.scale(this.scale), this.matrixWorldNeedsUpdate = !0; - } - clone(h = new u(this.material)) { - return f.Object3D.prototype.clone.call(this, h), h; - } - } - } - ), - /***/ - "./src/WebGL/objects/index.ts": ( - /*!************************************!*\ - !*** ./src/WebGL/objects/index.ts ***! - \************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Line: () => ( - /* reexport safe */ - n.Line - ), - /* harmony export */ - LineStyle: () => ( - /* reexport safe */ - n.LineStyle - ), - /* harmony export */ - Mesh: () => ( - /* reexport safe */ - f.Mesh - ), - /* harmony export */ - Sprite: () => ( - /* reexport safe */ - u.Sprite - ) - /* harmony export */ - }); - var n = r( - /*! ./Line */ - "./src/WebGL/objects/Line.ts" - ), f = r( - /*! ./Mesh */ - "./src/WebGL/objects/Mesh.ts" - ), u = r( - /*! ./Sprite */ - "./src/WebGL/objects/Sprite.ts" - ); - } - ), - /***/ - "./src/WebGL/shaders/ShaderType.ts": ( - /*!*****************************************!*\ - !*** ./src/WebGL/shaders/ShaderType.ts ***! - \*****************************************/ - /***/ - (t, e, r) => { - r.r(e); - } - ), - /***/ - "./src/WebGL/shaders/index.ts": ( - /*!************************************!*\ - !*** ./src/WebGL/shaders/index.ts ***! - \************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ShaderLib: () => ( - /* reexport safe */ - n.ShaderLib - ), - /* harmony export */ - ShaderUtils: () => ( - /* reexport safe */ - f.ShaderUtils - ), - /* harmony export */ - basic: () => ( - /* reexport safe */ - n.basic - ), - /* harmony export */ - clone: () => ( - /* reexport safe */ - f.clone - ), - /* harmony export */ - instanced: () => ( - /* reexport safe */ - n.instanced - ), - /* harmony export */ - lambert: () => ( - /* reexport safe */ - n.lambert - ), - /* harmony export */ - lambertdouble: () => ( - /* reexport safe */ - n.lambertdouble - ), - /* harmony export */ - outline: () => ( - /* reexport safe */ - n.outline - ), - /* harmony export */ - screen: () => ( - /* reexport safe */ - n.screen - ), - /* harmony export */ - screenaa: () => ( - /* reexport safe */ - n.screenaa - ), - /* harmony export */ - sphereimposter: () => ( - /* reexport safe */ - n.sphereimposter - ), - /* harmony export */ - sphereimposteroutline: () => ( - /* reexport safe */ - n.sphereimposteroutline - ), - /* harmony export */ - sprite: () => ( - /* reexport safe */ - n.sprite - ), - /* harmony export */ - stickimposter: () => ( - /* reexport safe */ - n.stickimposter - ), - /* harmony export */ - stickimposteroutline: () => ( - /* reexport safe */ - n.stickimposteroutline - ), - /* harmony export */ - volumetric: () => ( - /* reexport safe */ - n.volumetric - ) - /* harmony export */ - }); - var n = r( - /*! ./lib */ - "./src/WebGL/shaders/lib/index.ts" - ), f = r( - /*! ./utils */ - "./src/WebGL/shaders/utils/index.ts" - ); - r( - /*! ./ShaderType */ - "./src/WebGL/shaders/ShaderType.ts" - ); - } - ), - /***/ - "./src/WebGL/shaders/lib/basic/index.ts": ( - /*!**********************************************!*\ - !*** ./src/WebGL/shaders/lib/basic/index.ts ***! - \**********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - basic: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/basic/uniforms.ts" - ), f = r( - /*! ./basic.frag */ - "./src/WebGL/shaders/lib/basic/basic.frag" - ), u = r( - /*! ./basic.vert */ - "./src/WebGL/shaders/lib/basic/basic.vert" - ); - const b = { - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/basic/uniforms.ts": ( - /*!*************************************************!*\ - !*** ./src/WebGL/shaders/lib/basic/uniforms.ts ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/index.ts": ( - /*!****************************************!*\ - !*** ./src/WebGL/shaders/lib/index.ts ***! - \****************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ShaderLib: () => ( - /* binding */ - o - ), - /* harmony export */ - basic: () => ( - /* reexport safe */ - n.basic - ), - /* harmony export */ - instanced: () => ( - /* reexport safe */ - f.instanced - ), - /* harmony export */ - lambert: () => ( - /* reexport safe */ - u.lambert - ), - /* harmony export */ - lambertdouble: () => ( - /* reexport safe */ - b.lambertdouble - ), - /* harmony export */ - outline: () => ( - /* reexport safe */ - h.outline - ), - /* harmony export */ - screen: () => ( - /* reexport safe */ - _.screen - ), - /* harmony export */ - screenaa: () => ( - /* reexport safe */ - E.screenaa - ), - /* harmony export */ - sphereimposter: () => ( - /* reexport safe */ - c.sphereimposter - ), - /* harmony export */ - sphereimposteroutline: () => ( - /* reexport safe */ - S.sphereimposteroutline - ), - /* harmony export */ - sprite: () => ( - /* reexport safe */ - y.sprite - ), - /* harmony export */ - stickimposter: () => ( - /* reexport safe */ - w.stickimposter - ), - /* harmony export */ - stickimposteroutline: () => ( - /* reexport safe */ - L.stickimposteroutline - ), - /* harmony export */ - volumetric: () => ( - /* reexport safe */ - s.volumetric - ) - /* harmony export */ - }); - var n = r( - /*! ./basic */ - "./src/WebGL/shaders/lib/basic/index.ts" - ), f = r( - /*! ./instanced */ - "./src/WebGL/shaders/lib/instanced/index.ts" - ), u = r( - /*! ./lambert */ - "./src/WebGL/shaders/lib/lambert/index.ts" - ), b = r( - /*! ./lambertdouble */ - "./src/WebGL/shaders/lib/lambertdouble/index.ts" - ), h = r( - /*! ./outline */ - "./src/WebGL/shaders/lib/outline/index.ts" - ), _ = r( - /*! ./screen */ - "./src/WebGL/shaders/lib/screen/index.ts" - ), E = r( - /*! ./screenaa */ - "./src/WebGL/shaders/lib/screenaa/index.ts" - ), c = r( - /*! ./sphereimposter */ - "./src/WebGL/shaders/lib/sphereimposter/index.ts" - ), S = r( - /*! ./sphereimposteroutline */ - "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts" - ), y = r( - /*! ./sprite */ - "./src/WebGL/shaders/lib/sprite/index.ts" - ), w = r( - /*! ./stickimposter */ - "./src/WebGL/shaders/lib/stickimposter/index.ts" - ), L = r( - /*! ./stickimposteroutline */ - "./src/WebGL/shaders/lib/stickimposteroutline/index.ts" - ), s = r( - /*! ./volumetric */ - "./src/WebGL/shaders/lib/volumetric/index.ts" - ); - const o = { - basic: n.basic, - instanced: f.instanced, - lambert: u.lambert, - lambertdouble: b.lambertdouble, - outline: h.outline, - screen: _.screen, - screenaa: E.screenaa, - sphereimposter: c.sphereimposter, - sphereimposteroutline: S.sphereimposteroutline, - sprite: y.sprite, - stickimposter: w.stickimposter, - stickimposteroutline: L.stickimposteroutline, - volumetric: s.volumetric - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/instanced/index.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/instanced/index.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - instanced: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/instanced/uniforms.ts" - ), f = r( - /*! ./instanced.frag */ - "./src/WebGL/shaders/lib/instanced/instanced.frag" - ), u = r( - /*! ./instanced.vert */ - "./src/WebGL/shaders/lib/instanced/instanced.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/instanced/uniforms.ts": ( - /*!*****************************************************!*\ - !*** ./src/WebGL/shaders/lib/instanced/uniforms.ts ***! - \*****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - directionalLightColor: { type: "fv", value: [] }, - directionalLightDirection: { type: "fv", value: [] } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambert/index.ts": ( - /*!************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambert/index.ts ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - lambert: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/lambert/uniforms.ts" - ), f = r( - /*! ./lambert.frag */ - "./src/WebGL/shaders/lib/lambert/lambert.frag" - ), u = r( - /*! ./lambert.vert */ - "./src/WebGL/shaders/lib/lambert/lambert.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambert/uniforms.ts": ( - /*!***************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambert/uniforms.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - directionalLightColor: { type: "fv", value: [] }, - directionalLightDirection: { type: "fv", value: [] } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambertdouble/index.ts": ( - /*!******************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambertdouble/index.ts ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - lambertdouble: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts" - ), f = r( - /*! ./lambertdouble.frag */ - "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.frag" - ), u = r( - /*! ./lambertdouble.vert */ - "./src/WebGL/shaders/lib/lambertdouble/lambertdouble.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/lambertdouble/uniforms.ts": ( - /*!*********************************************************!*\ - !*** ./src/WebGL/shaders/lib/lambertdouble/uniforms.ts ***! - \*********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - directionalLightColor: { type: "fv", value: [] }, - directionalLightDirection: { type: "fv", value: [] } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/outline/index.ts": ( - /*!************************************************!*\ - !*** ./src/WebGL/shaders/lib/outline/index.ts ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - outline: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/outline/uniforms.ts" - ), f = r( - /*! ./outline.frag */ - "./src/WebGL/shaders/lib/outline/outline.frag" - ), u = r( - /*! ./outline.vert */ - "./src/WebGL/shaders/lib/outline/outline.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/outline/uniforms.ts": ( - /*!***************************************************!*\ - !*** ./src/WebGL/shaders/lib/outline/uniforms.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - outlineColor: { type: "c", value: new n.Color(0, 0, 0) }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - outlineWidth: { type: "f", value: 0.1 }, - outlinePushback: { type: "f", value: 1 } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/screen/index.ts": ( - /*!***********************************************!*\ - !*** ./src/WebGL/shaders/lib/screen/index.ts ***! - \***********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - screen: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/screen/uniforms.ts" - ), f = r( - /*! ./screen.frag */ - "./src/WebGL/shaders/lib/screen/screen.frag" - ), u = r( - /*! ./screen.vert */ - "./src/WebGL/shaders/lib/screen/screen.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/screen/uniforms.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/screen/uniforms.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = {}; - } - ), - /***/ - "./src/WebGL/shaders/lib/screenaa/index.ts": ( - /*!*************************************************!*\ - !*** ./src/WebGL/shaders/lib/screenaa/index.ts ***! - \*************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - screenaa: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/screenaa/uniforms.ts" - ), f = r( - /*! ./screenaa.frag */ - "./src/WebGL/shaders/lib/screenaa/screenaa.frag" - ), u = r( - /*! ./screenaa.vert */ - "./src/WebGL/shaders/lib/screenaa/screenaa.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/screenaa/uniforms.ts": ( - /*!****************************************************!*\ - !*** ./src/WebGL/shaders/lib/screenaa/uniforms.ts ***! - \****************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = {}; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposter/index.ts": ( - /*!*******************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposter/index.ts ***! - \*******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - sphereimposter: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts" - ), f = r( - /*! ./sphereimposter.frag */ - "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.frag" - ), u = r( - /*! ./sphereimposter.vert */ - "./src/WebGL/shaders/lib/sphereimposter/sphereimposter.vert" - ); - const b = { - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposter/uniforms.ts": ( - /*!**********************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposter/uniforms.ts ***! - \**********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - directionalLightColor: { type: "fv", value: [] }, - directionalLightDirection: { type: "fv", value: [] } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposteroutline/index.ts": ( - /*!**************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposteroutline/index.ts ***! - \**************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - sphereimposteroutline: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts" - ), f = r( - /*! ./sphereimposteroutline.frag */ - "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.frag" - ), u = r( - /*! ./sphereimposteroutline.vert */ - "./src/WebGL/shaders/lib/sphereimposteroutline/sphereimposteroutline.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts": ( - /*!*****************************************************************!*\ - !*** ./src/WebGL/shaders/lib/sphereimposteroutline/uniforms.ts ***! - \*****************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - outlineColor: { type: "c", value: new n.Color(0, 0, 0) }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - outlineWidth: { type: "f", value: 0.1 }, - outlinePushback: { type: "f", value: 1 } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/sprite/index.ts": ( - /*!***********************************************!*\ - !*** ./src/WebGL/shaders/lib/sprite/index.ts ***! - \***********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - sprite: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/sprite/uniforms.ts" - ), f = r( - /*! ./sprite.frag */ - "./src/WebGL/shaders/lib/sprite/sprite.frag" - ), u = r( - /*! ./sprite.vert */ - "./src/WebGL/shaders/lib/sprite/sprite.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/sprite/uniforms.ts": ( - /*!**************************************************!*\ - !*** ./src/WebGL/shaders/lib/sprite/uniforms.ts ***! - \**************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = {}; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposter/index.ts": ( - /*!******************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposter/index.ts ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - stickimposter: () => ( - /* binding */ - _ - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/stickimposter/uniforms.ts" - ), f = r( - /*! ../../utils/stickimposterFragmentShader.partial.frag */ - "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag" - ), u = r( - /*! ./stickimposter.partial.frag */ - "./src/WebGL/shaders/lib/stickimposter/stickimposter.partial.frag" - ), b = r( - /*! ./stickimposter.vert */ - "./src/WebGL/shaders/lib/stickimposter/stickimposter.vert" - ); - const _ = { - fragmentShader: [f.default, u.default].join(` -`).replace("#define GLSLIFY 1", ""), - vertexShader: b.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposter/uniforms.ts": ( - /*!*********************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposter/uniforms.ts ***! - \*********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - directionalLightColor: { type: "fv", value: [] }, - directionalLightDirection: { type: "fv", value: [] } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposteroutline/index.ts": ( - /*!*************************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposteroutline/index.ts ***! - \*************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - stickimposteroutline: () => ( - /* binding */ - h - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts" - ), f = r( - /*! ../../utils/stickimposterFragmentShader.partial.frag */ - "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag" - ), u = r( - /*! ./stickimposteroutline.vert */ - "./src/WebGL/shaders/lib/stickimposteroutline/stickimposteroutline.vert" - ); - const h = { - fragmentShader: (f.default + "gl_FragColor = vec4(color,1.0);}").replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts": ( - /*!****************************************************************!*\ - !*** ./src/WebGL/shaders/lib/stickimposteroutline/uniforms.ts ***! - \****************************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - outlineColor: { type: "c", value: new n.Color(0, 0, 0) }, - outlineWidth: { type: "f", value: 0.1 }, - outlinePushback: { type: "f", value: 1 } - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/volumetric/index.ts": ( - /*!***************************************************!*\ - !*** ./src/WebGL/shaders/lib/volumetric/index.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - volumetric: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./uniforms */ - "./src/WebGL/shaders/lib/volumetric/uniforms.ts" - ), f = r( - /*! ./volumetric.frag */ - "./src/WebGL/shaders/lib/volumetric/volumetric.frag" - ), u = r( - /*! ./volumetric.vert */ - "./src/WebGL/shaders/lib/volumetric/volumetric.vert" - ); - const b = { - fragmentShader: f.default.replace("#define GLSLIFY 1", ""), - vertexShader: u.default.replace("#define GLSLIFY 1", ""), - uniforms: n.uniforms - }; - } - ), - /***/ - "./src/WebGL/shaders/lib/volumetric/uniforms.ts": ( - /*!******************************************************!*\ - !*** ./src/WebGL/shaders/lib/volumetric/uniforms.ts ***! - \******************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - uniforms: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../../colors */ - "./src/colors.ts" - ); - const f = { - opacity: { type: "f", value: 1 }, - fogColor: { type: "c", value: new n.Color(1, 1, 1) }, - fogNear: { type: "f", value: 1 }, - fogFar: { type: "f", value: 2e3 }, - data: { type: "i", value: 3 }, - colormap: { type: "i", value: 4 }, - depthmap: { type: "i", value: 5 }, - step: { type: "f", value: 1 }, - maxdepth: { type: "f", value: 100 }, - subsamples: { type: "f", value: 5 }, - textmat: { type: "mat4", value: [] }, - projinv: { type: "mat4", value: [] }, - transfermin: { type: "f", value: -0.2 }, - transfermax: { type: "f", value: 0.2 } - }; - } - ), - /***/ - "./src/WebGL/shaders/utils/clone.ts": ( - /*!******************************************!*\ - !*** ./src/WebGL/shaders/utils/clone.ts ***! - \******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - clone: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../../colors */ - "./src/colors.ts" - ); - function f(u) { - let b = {}; - for (const _ in u) { - b[_] = {}, b[_].type = u[_].type; - var h = u[_].value; - h instanceof n.Color ? b[_].value = h.clone() : typeof h == "number" ? b[_].value = h : h instanceof Array ? b[_].value = [] : console.error("Error copying shader uniforms from ShaderLib: unknown type for uniform"); - } - return b; - } - } - ), - /***/ - "./src/WebGL/shaders/utils/index.ts": ( - /*!******************************************!*\ - !*** ./src/WebGL/shaders/utils/index.ts ***! - \******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - ShaderUtils: () => ( - /* binding */ - u - ), - /* harmony export */ - clone: () => ( - /* reexport safe */ - n.clone - ) - /* harmony export */ - }); - var n = r( - /*! ./clone */ - "./src/WebGL/shaders/utils/clone.ts" - ), f = r( - /*! ./stickimposterFragmentShader.partial.frag */ - "./src/WebGL/shaders/utils/stickimposterFragmentShader.partial.frag" - ); - const u = { - clone: n.clone, - stickimposterFragmentShader: f.default - }; - } - ), - /***/ - "./src/WebGL/shapes/Cylinder.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/shapes/Cylinder.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Cylinder: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - let f = new n.Vector3(); - class u { - constructor(h = new n.Vector3(), _ = new n.Vector3(), E = 0) { - this.c1 = h, this.c2 = _, this.radius = E, this.direction = new n.Vector3().subVectors(this.c2, this.c1).normalize(); - } - copy(h) { - return this.c1.copy(h.c1), this.c2.copy(h.c2), this.direction.copy(h.direction), this.radius = h.radius, this; - } - lengthSq() { - return f.subVectors(this.c2, this.c1).lengthSq(); - } - applyMatrix4(h) { - return this.direction.add(this.c1).applyMatrix4(h), this.c1.applyMatrix4(h), this.c2.applyMatrix4(h), this.direction.sub(this.c1).normalize(), this.radius = this.radius * h.getMaxScaleOnAxis(), this; - } - } - } - ), - /***/ - "./src/WebGL/shapes/Sphere.ts": ( - /*!************************************!*\ - !*** ./src/WebGL/shapes/Sphere.ts ***! - \************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Sphere: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - class f { - constructor(b = { x: 0, y: 0, z: 0 }, h = 0) { - this.center = new n.Vector3(b.x, b.y, b.z), this.radius = h; - } - set(b, h) { - return this.center.copy(b), this.radius = h, this; - } - copy(b) { - return this.center.copy(b.center), this.radius = b.radius, this; - } - applyMatrix4(b) { - return this.center.applyMatrix4(b), this.radius = this.radius * b.getMaxScaleOnAxis(), this; - } - translate(b) { - return this.center.add(b), this; - } - equals(b) { - return b.center.equals(this.center) && b.radius === this.radius; - } - clone() { - return new f().copy(this); - } - } - } - ), - /***/ - "./src/WebGL/shapes/Triangle.ts": ( - /*!**************************************!*\ - !*** ./src/WebGL/shapes/Triangle.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Triangle: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../math */ - "./src/WebGL/math/index.ts" - ); - const f = new n.Vector3(); - class u { - constructor(h = new n.Vector3(), _ = new n.Vector3(), E = new n.Vector3()) { - this.a = h, this.b = _, this.c = E; - } - copy(h) { - return this.a.copy(h.a), this.b.copy(h.b), this.c.copy(h.c), this; - } - applyMatrix4(h) { - return this.a.applyMatrix4(h), this.b.applyMatrix4(h), this.c.applyMatrix4(h), this; - } - getNormal() { - var h = this.a.clone(); - return h.sub(this.b), f.subVectors(this.c, this.b), h.cross(f), h.normalize(), h; - } - } - } - ), - /***/ - "./src/WebGL/shapes/index.ts": ( - /*!***********************************!*\ - !*** ./src/WebGL/shapes/index.ts ***! - \***********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Cylinder: () => ( - /* reexport safe */ - f.Cylinder - ), - /* harmony export */ - Sphere: () => ( - /* reexport safe */ - n.Sphere - ), - /* harmony export */ - Triangle: () => ( - /* reexport safe */ - u.Triangle - ) - /* harmony export */ - }); - var n = r( - /*! ./Sphere */ - "./src/WebGL/shapes/Sphere.ts" - ), f = r( - /*! ./Cylinder */ - "./src/WebGL/shapes/Cylinder.ts" - ), u = r( - /*! ./Triangle */ - "./src/WebGL/shapes/Triangle.ts" - ); - } - ), - /***/ - "./src/autoload.ts": ( - /*!*************************!*\ - !*** ./src/autoload.ts ***! - \*************************/ - /***/ - (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { - /* harmony export */ - autoinit: () => ( - /* binding */ - autoinit - ), - /* harmony export */ - autoload: () => ( - /* binding */ - autoload - ), - /* harmony export */ - processing_autoinit: () => ( - /* binding */ - processing_autoinit - ), - /* harmony export */ - viewers: () => ( - /* binding */ - viewers - ) - /* harmony export */ - }); - var _GLViewer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( - /*! ./GLViewer */ - "./src/GLViewer.ts" - ), _ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( - /*! ./ProteinSurface4 */ - "./src/ProteinSurface4.ts" - ), _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( - /*! ./utilities */ - "./src/utilities.ts" - ), _colors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( - /*! ./colors */ - "./src/colors.ts" - ), autoinit = !1, processing_autoinit = !1, viewers = {}; - function autoload(viewer, callback) { - var i, dataname, type; - if (document.querySelector(".viewer_3Dmoljs") != null && (autoinit = !0), autoinit) { - processing_autoinit = !0, viewer = viewer ?? null; - var nviewers = 0; - document.querySelectorAll(".viewer_3Dmoljs").forEach((viewerdiv) => { - var datauri = [], datatypes = [], uri = ""; - viewerdiv.style.position == "static" && (viewerdiv.style.position = "relative"); - var UI = null; - if (type = null, viewerdiv.dataset.pdb) - datauri.push("https://files.rcsb.org/view/" + viewerdiv.dataset.pdb + ".pdb"), datatypes.push("pdb"); - else if (viewerdiv.dataset.cid) - datatypes.push("sdf"), datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + viewerdiv.dataset.cid + "/SDF?record_type=3d"); - else if (viewerdiv.dataset.href || viewerdiv.dataset.url) { - viewerdiv.dataset.href ? uri = viewerdiv.dataset.href : uri = viewerdiv.dataset.url, datauri.push(uri), type = uri.substring(uri.lastIndexOf(".") + 1), datatypes.push(type); - var molName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf(".")); - molName == "/" && (molName = uri.substring(uri.lastIndexOf("/") + 1)), viewerdiv.dataset[datatypes[datatypes.length - 1]] = molName; - } - var divdata = viewerdiv.dataset; - for (i in divdata) - i.substring(0, 3) === "pdb" && i !== "pdb" ? (datauri.push("https://files.rcsb.org/view/" + divdata[i] + ".pdb"), datatypes.push("pdb")) : i.substring(0, 4) === "href" && i !== "href" ? (uri = divdata[i], datauri.push(uri), datatypes.push(uri.substring(uri.lastIndexOf(".") + 1))) : i.substring(0, 3) === "cid" && i !== "cid" && (datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + divdata[i] + "/SDF?record_type=3d"), datatypes.push("sdf")); - var options = {}; - viewerdiv.dataset.options && (options = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.options)); - var bgcolor = _colors__WEBPACK_IMPORTED_MODULE_3__.CC.color(viewerdiv.dataset.backgroundcolor), bgalpha = viewerdiv.dataset.backgroundalpha; - bgalpha = bgalpha == null ? 1 : parseFloat(bgalpha); - var style = { line: {} }; - viewerdiv.dataset.style && (style = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.style)); - var select = {}; - viewerdiv.dataset.select && (select = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.select)); - var selectstylelist = [], surfaces = [], labels = [], zoomto = {}, spin = null, d = viewerdiv.dataset, stylere = /style(.+)/, surfre = /surface(.*)/, reslabre = /labelres(.*)/, keys = []; - for (dataname in d) - Object.prototype.hasOwnProperty.call(d, dataname) && keys.push(dataname); - for (keys.sort(), i = 0; i < keys.length; i++) { - dataname = keys[i]; - var m = stylere.exec(dataname), selname, newsel, styleobj; - m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), selectstylelist.push([newsel, styleobj])), m = surfre.exec(dataname), m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), surfaces.push([newsel, styleobj])), m = reslabre.exec(dataname), m && (selname = "select" + m[1], newsel = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[selname]), styleobj = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname]), labels.push([newsel, styleobj])), dataname == "zoomto" && (zoomto = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname])), dataname == "spin" && (spin = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(d[dataname])); - } - var applyStyles = function(t) { - for (t.setStyle(select, style), UI && UI.createSelectionAndStyle(select, style), i = 0; i < selectstylelist.length; i++) { - let e = selectstylelist[i][0] || {}, r = selectstylelist[i][1] || { line: {} }; - t.setStyle(e, r), UI && UI.createSelectionAndStyle(select, style); - } - for (i = 0; i < surfaces.length; i++) { - let e = surfaces[i][0] || {}, r = surfaces[i][1] || {}; - UI ? t.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, r, e, e).then((f) => { - UI.loadSurface("VDW", e, r, f); - }) : t.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW, r, e, e); - } - for (i = 0; i < labels.length; i++) { - let e = labels[i][0] || {}, r = labels[i][1] || {}; - t.addResLabels(e, r); - } - t.render(), t.zoomTo(zoomto), spin && t.spin(spin.axis, spin.speed); - }, glviewer = viewer; - try { - var config = (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.config) || {}; - config.backgroundColor === void 0 && (config.backgroundColor = bgcolor), config.backgroundAlpha === void 0 && (config.backgroundAlpha = bgalpha), glviewer == null ? glviewer = viewers[viewerdiv.id || nviewers++] = (0, _GLViewer__WEBPACK_IMPORTED_MODULE_0__.createViewer)(viewerdiv, config) : (glviewer.setBackgroundColor(bgcolor, bgalpha), glviewer.setConfig(config), UI && UI.initiateUI()), viewerdiv.dataset.ui && $3Dmol.StateManager && (UI = new $3Dmol.StateManager(glviewer)); - } catch (t) { - console.log(t), viewerdiv.textContent = "WebGL appears to be disabled."; - } - if (datauri.length != 0) { - let i = 0; - var process = function(moldata) { - uri = datauri[i]; - var type = viewerdiv.dataset.type || viewerdiv.dataset.datatype || datatypes[i]; - if (glviewer.addModel(moldata, type, options), UI) { - var modelName = viewerdiv.dataset[datatypes[i]]; - UI.setModelTitle(modelName); - } - if (i += 1, i < datauri.length) - (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.get)(datauri[i]).then(process); - else { - if (applyStyles(glviewer), viewerdiv.dataset.callback) { - var runres = eval(viewerdiv.dataset.callback); - typeof runres == "function" && runres(glviewer); - } - processing_autoinit = !1, callback && callback(glviewer); - } - }; - (0, _utilities__WEBPACK_IMPORTED_MODULE_2__.get)(datauri[0]).then(process); - } else { - if (viewerdiv.dataset.element) { - var moldataid = "#" + viewerdiv.dataset.element, molelem = document.querySelector(moldataid), moldata = molelem ? molelem.textContent : ""; - type = viewerdiv.dataset.type || viewerdiv.dataset.datatype, glviewer.addModel(moldata, type, options); - } - if (applyStyles(glviewer), viewerdiv.dataset.callback) { - var runres = eval(viewerdiv.dataset.callback); - typeof runres == "function" && runres(glviewer); - } - processing_autoinit = !1, callback && callback(glviewer); - } - }); - } - } - document.onreadystatechange = () => { - document.readyState === "complete" && autoload(); - }; - } - ), - /***/ - "./src/colors.ts": ( - /*!***********************!*\ - !*** ./src/colors.ts ***! - \***********************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CC: () => ( - /* binding */ - f - ), - /* harmony export */ - Color: () => ( - /* binding */ - n - ), - /* harmony export */ - builtinColorSchemes: () => ( - /* binding */ - S - ), - /* harmony export */ - chains: () => ( - /* binding */ - c - ), - /* harmony export */ - elementColors: () => ( - /* binding */ - _ - ), - /* harmony export */ - htmlColors: () => ( - /* binding */ - u - ), - /* harmony export */ - residues: () => ( - /* binding */ - E - ), - /* harmony export */ - ssColors: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - class n { - constructor(w, L, s) { - return this.r = 0, this.g = 0, this.b = 0, arguments.length > 1 && typeof w == "number" ? (this.r = w || 0, this.g = L || 0, this.b = s || 0, this) : this.set(w || 0); - } - set(w) { - return w instanceof n ? w.clone() : (typeof w == "number" ? this.setHex(w) : typeof w == "object" && (this.r = (w == null ? void 0 : w.r) || 0, this.g = (w == null ? void 0 : w.g) || 0, this.b = (w == null ? void 0 : w.b) || 0), this); - } - setHex(w) { - return w = Math.floor(w), this.r = (w >> 16 & 255) / 255, this.g = (w >> 8 & 255) / 255, this.b = (w & 255) / 255, this; - } - getHex() { - var w = Math.round(this.r * 255), L = Math.round(this.g * 255), s = Math.round(this.b * 255); - return w << 16 | L << 8 | s; - } - clone() { - return new n(this.r, this.g, this.b); - } - copy(w) { - return this.r = w.r, this.g = w.g, this.b = w.b, this; - } - //return object that represents color components from 0 to 255 - scaled() { - var w = {}; - return w.r = Math.round(this.r * 255), w.g = Math.round(this.g * 255), w.b = Math.round(this.b * 255), w.a = 1, w; - } - } - class f { - static color(w) { - if (!w) - return f.cache[0]; - if (w instanceof n) - return w; - if (typeof w == "number" && typeof f.cache[w] < "u") - return f.cache[w]; - if (w && Array.isArray(w)) - return w.map(f.color); - let L = f.getHex(w), s = new n(L); - return f.cache[L] = s, s; - } - static getHex(w) { - var L; - if (Array.isArray(w)) - return w.map(f.getHex); - if (typeof w == "string") { - let s = w; - if (!isNaN(parseInt(s))) - return parseInt(s); - if (s = s.trim(), s.length == 4 && s[0] == "#" && (s = "#" + s[1] + s[1] + s[2] + s[2] + s[3] + s[3]), s.length == 7 && s[0] == "#") - return parseInt(s.substring(1), 16); - let o = f.rgbRegEx.exec(s); - if (o) { - o[1] != "" && console.log("WARNING: Opacity value in rgba ignored. Specify separately as opacity attribute."); - let A = 0; - for (let p = 2; p < 5; p++) { - A *= 256; - let v = o[p].endsWith("%") ? 255 * parseFloat(o[p]) / 100 : parseFloat(o[p]); - A += Math.round(v); - } - return A; - } - return ((L = window == null ? void 0 : window.$3Dmol) === null || L === void 0 ? void 0 : L.htmlColors[w.toLowerCase()]) || 0; - } - return w; - } - } - f.rgbRegEx = /rgb(a?)\(\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)/i, f.cache = { 0: new n(0) }; - const u = { - aliceblue: 15792383, - antiquewhite: 16444375, - aqua: 65535, - aquamarine: 8388564, - azure: 15794175, - beige: 16119260, - bisque: 16770244, - black: 0, - blanchedalmond: 16772045, - blue: 255, - blueviolet: 9055202, - brown: 10824234, - burlywood: 14596231, - cadetblue: 6266528, - chartreuse: 8388352, - chocolate: 13789470, - coral: 16744272, - cornflowerblue: 6591981, - cornsilk: 16775388, - crimson: 14423100, - cyan: 65535, - darkblue: 139, - darkcyan: 35723, - darkgoldenrod: 12092939, - darkgray: 11119017, - darkgrey: 11119017, - darkgreen: 25600, - darkkhaki: 12433259, - darkmagenta: 9109643, - darkolivegreen: 5597999, - darkorange: 16747520, - darkorchid: 10040012, - darkred: 9109504, - darksalmon: 15308410, - darkseagreen: 9419919, - darkslateblue: 4734347, - darkslategray: 3100495, - darkslategrey: 3100495, - darkturquoise: 52945, - darkviolet: 9699539, - deeppink: 16716947, - deepskyblue: 49151, - dimgray: 6908265, - dimgrey: 6908265, - dodgerblue: 2003199, - firebrick: 11674146, - floralwhite: 16775920, - forestgreen: 2263842, - fuchsia: 16711935, - gainsboro: 14474460, - ghostwhite: 16316671, - gold: 16766720, - goldenrod: 14329120, - gray: 8421504, - grey: 8421504, - green: 32768, - greenyellow: 11403055, - honeydew: 15794160, - hotpink: 16738740, - indianred: 13458524, - indigo: 4915330, - ivory: 16777200, - khaki: 15787660, - lavender: 15132410, - lavenderblush: 16773365, - lawngreen: 8190976, - lemonchiffon: 16775885, - lightblue: 11393254, - lightcoral: 15761536, - lightcyan: 14745599, - lightgoldenrodyellow: 16448210, - lightgray: 13882323, - lightgrey: 13882323, - lightgreen: 9498256, - lightpink: 16758465, - lightsalmon: 16752762, - lightseagreen: 2142890, - lightskyblue: 8900346, - lightslategray: 7833753, - lightslategrey: 7833753, - lightsteelblue: 11584734, - lightyellow: 16777184, - lime: 65280, - limegreen: 3329330, - linen: 16445670, - magenta: 16711935, - maroon: 8388608, - mediumaquamarine: 6737322, - mediumblue: 205, - mediumorchid: 12211667, - mediumpurple: 9662683, - mediumseagreen: 3978097, - mediumslateblue: 8087790, - mediumspringgreen: 64154, - mediumturquoise: 4772300, - mediumvioletred: 13047173, - midnightblue: 1644912, - mintcream: 16121850, - mistyrose: 16770273, - moccasin: 16770229, - navajowhite: 16768685, - navy: 128, - oldlace: 16643558, - olive: 8421376, - olivedrab: 7048739, - orange: 16753920, - orangered: 16729344, - orchid: 14315734, - palegoldenrod: 15657130, - palegreen: 10025880, - paleturquoise: 11529966, - palevioletred: 14381203, - papayawhip: 16773077, - peachpuff: 16767673, - peru: 13468991, - pink: 16761035, - plum: 14524637, - powderblue: 11591910, - purple: 8388736, - rebeccapurple: 6697881, - red: 16711680, - rosybrown: 12357519, - royalblue: 4286945, - saddlebrown: 9127187, - salmon: 16416882, - sandybrown: 16032864, - seagreen: 3050327, - seashell: 16774638, - sienna: 10506797, - silver: 12632256, - skyblue: 8900331, - slateblue: 6970061, - slategray: 7372944, - slategrey: 7372944, - snow: 16775930, - springgreen: 65407, - steelblue: 4620980, - tan: 13808780, - teal: 32896, - thistle: 14204888, - tomato: 16737095, - turquoise: 4251856, - violet: 15631086, - wheat: 16113331, - white: 16777215, - whitesmoke: 16119285, - yellow: 16776960, - yellowgreen: 10145074 - }, b = { - //names are in helix-sheet-coil order - pyMol: { h: 16711680, s: 16776960, c: 65280 }, - Jmol: { h: 16711808, s: 16762880, c: 16777215 } - }, h = { - H: 16777215, - He: 16761035, - HE: 16761035, - Li: 11674146, - LI: 11674146, - B: 65280, - C: 13158600, - N: 9408511, - O: 15728640, - F: 14329120, - Na: 255, - NA: 255, - Mg: 2263842, - MG: 2263842, - Al: 8421520, - AL: 8421520, - Si: 14329120, - SI: 14329120, - P: 16753920, - S: 16762930, - Cl: 65280, - CL: 65280, - Ca: 8421520, - CA: 8421520, - Ti: 8421520, - TI: 8421520, - Cr: 8421520, - CR: 8421520, - Mn: 8421520, - MN: 8421520, - Fe: 16753920, - FE: 16753920, - Ni: 10824234, - NI: 10824234, - Cu: 10824234, - CU: 10824234, - Zn: 10824234, - ZN: 10824234, - Br: 10824234, - BR: 10824234, - Ag: 8421520, - AG: 8421520, - I: 10494192, - Ba: 16753920, - BA: 16753920, - Au: 14329120, - AU: 14329120 - }, _ = { - defaultColor: 16716947, - /** Jmol-like element colors*/ - Jmol: { - H: 16777215, - He: 14286847, - HE: 14286847, - Li: 13402367, - LI: 13402367, - Be: 12779264, - BE: 12779264, - B: 16758197, - C: 9474192, - N: 3166456, - O: 16715021, - F: 9494608, - Ne: 11789301, - NE: 11789301, - Na: 11230450, - NA: 11230450, - Mg: 9109248, - MG: 9109248, - Al: 12560038, - AL: 12560038, - Si: 1578e4, - SI: 1578e4, - P: 16744448, - S: 16777008, - Cl: 2093087, - CL: 2093087, - Ar: 8442339, - AR: 8442339, - K: 9388244, - Ca: 4062976, - CA: 4062976, - Sc: 15132390, - SC: 15132390, - Ti: 12567239, - TI: 12567239, - V: 10921643, - Cr: 9083335, - CR: 9083335, - Mn: 10255047, - MN: 10255047, - Fe: 14706227, - FE: 14706227, - Co: 15765664, - CO: 15765664, - Ni: 5296208, - NI: 5296208, - Cu: 13140019, - CU: 13140019, - Zn: 8224944, - ZN: 8224944, - Ga: 12750735, - GA: 12750735, - Ge: 6721423, - GE: 6721423, - As: 12419299, - AS: 12419299, - Se: 16752896, - SE: 16752896, - Br: 10889513, - BR: 10889513, - Kr: 6076625, - KR: 6076625, - Rb: 7351984, - RB: 7351984, - Sr: 65280, - SR: 65280, - Y: 9764863, - Zr: 9756896, - ZR: 9756896, - Nb: 7586505, - NB: 7586505, - Mo: 5551541, - MO: 5551541, - Tc: 3907230, - TC: 3907230, - Ru: 2396047, - RU: 2396047, - Rh: 687500, - RH: 687500, - Pd: 27013, - PD: 27013, - Ag: 12632256, - AG: 12632256, - Cd: 16767375, - CD: 16767375, - In: 10909043, - IN: 10909043, - Sn: 6717568, - SN: 6717568, - Sb: 10380213, - SB: 10380213, - Te: 13924864, - TE: 13924864, - I: 9699476, - Xe: 4366e3, - XE: 4366e3, - Cs: 5707663, - CS: 5707663, - Ba: 51456, - BA: 51456, - La: 7394559, - LA: 7394559, - Ce: 16777159, - CE: 16777159, - Pr: 14286791, - PR: 14286791, - Nd: 13107143, - ND: 13107143, - Pm: 10747847, - PM: 10747847, - Sm: 9437127, - SM: 9437127, - Eu: 6422471, - EU: 6422471, - Gd: 4587463, - GD: 4587463, - Tb: 3211207, - TB: 3211207, - Dy: 2097095, - DY: 2097095, - Ho: 65436, - HO: 65436, - Er: 58997, - ER: 58997, - Tm: 54354, - TM: 54354, - Yb: 48952, - YB: 48952, - Lu: 43812, - LU: 43812, - Hf: 5096191, - HF: 5096191, - Ta: 5089023, - TA: 5089023, - W: 2200790, - Re: 2522539, - RE: 2522539, - Os: 2516630, - OS: 2516630, - Ir: 1528967, - IR: 1528967, - Pt: 13684960, - PT: 13684960, - Au: 16765219, - AU: 16765219, - Hg: 12105936, - HG: 12105936, - Tl: 10900557, - TL: 10900557, - Pb: 5724513, - PB: 5724513, - Bi: 10375093, - BI: 10375093, - Po: 11230208, - PO: 11230208, - At: 7688005, - AT: 7688005, - Rn: 4358806, - RN: 4358806, - Fr: 4325478, - FR: 4325478, - Ra: 32e3, - RA: 32e3, - Ac: 7384058, - AC: 7384058, - Th: 47871, - TH: 47871, - Pa: 41471, - PA: 41471, - U: 36863, - Np: 33023, - NP: 33023, - Pu: 27647, - PU: 27647, - Am: 5528818, - AM: 5528818, - Cm: 7888099, - CM: 7888099, - Bk: 9064419, - BK: 9064419, - Cf: 10565332, - CF: 10565332, - Es: 11739092, - ES: 11739092, - Fm: 11739066, - FM: 11739066, - Md: 11734438, - MD: 11734438, - No: 12389767, - NO: 12389767, - Lr: 13041766, - LR: 13041766, - Rf: 13369433, - RF: 13369433, - Db: 13697103, - DB: 13697103, - Sg: 14221381, - SG: 14221381, - Bh: 14680120, - BH: 14680120, - Hs: 15073326, - HS: 15073326, - Mt: 15400998, - MT: 15400998 - }, - /** rasmol-like element colors */ - rasmol: h, - defaultColors: Object.assign({}, h), - greenCarbon: Object.assign(Object.assign({}, h), { C: 65280 }), - cyanCarbon: Object.assign(Object.assign({}, h), { C: 65535 }), - magentaCarbon: Object.assign(Object.assign({}, h), { C: 16711935 }), - yellowCarbon: Object.assign(Object.assign({}, h), { C: 16776960 }), - whiteCarbon: Object.assign(Object.assign({}, h), { C: 16777215 }), - orangeCarbon: Object.assign(Object.assign({}, h), { C: 16753920 }), - purpleCarbon: Object.assign(Object.assign({}, h), { C: 8388736 }), - blueCarbon: Object.assign(Object.assign({}, h), { C: 255 }) - }, E = { - /** @property standard amino acid color scheme*/ - amino: { - ALA: 13158600, - ARG: 1334015, - ASN: 56540, - ASP: 15075850, - CYS: 15132160, - GLN: 56540, - GLU: 15075850, - GLY: 15461355, - HIS: 8553170, - ILE: 1016335, - LEU: 1016335, - LYS: 1334015, - MET: 15132160, - PHE: 3289770, - PRO: 14456450, - SER: 16422400, - THR: 16422400, - TRP: 11819700, - TYR: 3289770, - VAL: 1016335, - ASX: 16738740, - GLX: 16738740 - }, - /** @property shapely amino acid color scheme*/ - shapely: { - ALA: 9240460, - ARG: 124, - ASN: 16743536, - ASP: 10485826, - CYS: 16777072, - GLN: 16731212, - GLU: 6684672, - GLY: 16777215, - HIS: 7368959, - ILE: 19456, - LEU: 4546117, - LYS: 4671416, - MET: 12099650, - PHE: 5459026, - PRO: 5395026, - SER: 16740418, - THR: 12078080, - TRP: 5195264, - TYR: 9203788, - VAL: 16747775, - ASX: 16711935, - GLX: 16711935 - }, - /** @property nucleic acid color scheme*/ - nucleic: { - A: 10526975, - G: 16740464, - I: 8454143, - C: 16747595, - T: 10551200, - U: 16744576 - } - }, c = { - /** @property chain based standard color scheme */ - atom: { - A: 12636415, - B: 11599792, - C: 16761032, - D: 16777088, - E: 16761087, - F: 11596016, - G: 16765040, - H: 15761536, - I: 16113331, - J: 49151, - K: 13458524, - L: 6737322, - M: 10145074, - N: 15631086, - O: 52945, - P: 65407, - Q: 3978097, - R: 139, - S: 12433259, - T: 25600, - U: 8388608, - V: 8421376, - W: 8388736, - X: 32896, - Y: 12092939, - Z: 11674146 - }, - /** @property hetatm color scheme */ - hetatm: { - A: 9478351, - B: 8441752, - C: 13602992, - D: 13619056, - E: 13603023, - F: 8437952, - G: 13607008, - H: 12603504, - I: 12955267, - J: 42959, - K: 11881548, - L: 5682578, - M: 9090346, - N: 12481214, - O: 46753, - P: 53103, - Q: 3447649, - R: 187, - S: 10854235, - T: 37888, - U: 11534336, - V: 11579392, - W: 11534512, - X: 45232, - Y: 15250963, - Z: 12726834 - } - }, S = { - /** secondary structure pymol */ - ssPyMol: { prop: "ss", map: b.pyMol }, - ssJmol: { prop: "ss", map: b.Jmol }, - Jmol: { prop: "elem", map: _.Jmol }, - amino: { prop: "resn", map: E.amino }, - shapely: { prop: "resn", map: E.shapely }, - nucleic: { prop: "resn", map: E.nucleic }, - chain: { prop: "chain", map: c.atom }, - rasmol: { prop: "elem", map: _.rasmol }, - default: { prop: "elem", map: _.defaultColors }, - greenCarbon: { prop: "elem", map: _.greenCarbon }, - chainHetatm: { prop: "chain", map: c.hetatm }, - cyanCarbon: { prop: "elem", map: _.cyanCarbon }, - magentaCarbon: { prop: "elem", map: _.magentaCarbon }, - purpleCarbon: { prop: "elem", map: _.purpleCarbon }, - whiteCarbon: { prop: "elem", map: _.whiteCarbon }, - orangeCarbon: { prop: "elem", map: _.orangeCarbon }, - yellowCarbon: { prop: "elem", map: _.yellowCarbon }, - blueCarbon: { prop: "elem", map: _.blueCarbon } - }; - } - ), - /***/ - "./src/glcartoon.ts": ( - /*!**************************!*\ - !*** ./src/glcartoon.ts ***! - \**************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - drawCartoon: () => ( - /* binding */ - B - ), - /* harmony export */ - subdivide_spline: () => ( - /* binding */ - c - ) - /* harmony export */ - }); - var n = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), f = r( - /*! ./WebGL/shapes */ - "./src/WebGL/shapes/index.ts" - ), u = r( - /*! ./WebGL */ - "./src/WebGL/index.ts" - ), b = r( - /*! ./Gradient */ - "./src/Gradient.ts" - ), h = r( - /*! ./colors */ - "./src/colors.ts" - ), _ = r( - /*! ./GLDraw */ - "./src/GLDraw.ts" - ), E = r( - /*! ./utilities */ - "./src/utilities.ts" - ); - function c(P, z) { - var k = [], N = P; - N = [], N.push(P[0]); - var R, U, W, G, F, V, J, X, oe; - for (R = 1, U = P.length - 1; R < U; R++) - if (F = P[R], V = P[R + 1], F.smoothen) { - var te = new n.Vector3((F.x + V.x) / 2, (F.y + V.y) / 2, (F.z + V.z) / 2); - te.atom = F.atom, N.push(te); - } else - N.push(F); - for (N.push(P[P.length - 1]), R = -1, W = N.length; R <= W - 3; R++) - if (G = N[R === -1 ? 0 : R], F = N[R + 1], V = N[R + 2], J = N[R === W - 3 ? W - 1 : R + 3], X = new n.Vector3().subVectors(V, G).multiplyScalar(0.5), oe = new n.Vector3().subVectors(J, F).multiplyScalar(0.5), !V.skip) - for (var ve = 0; ve < z; ve++) { - var se = 1 / z * ve, le = F.x + se * X.x + se * se * (-3 * F.x + 3 * V.x - 2 * X.x - oe.x) + se * se * se * (2 * F.x - 2 * V.x + X.x + oe.x), Ce = F.y + se * X.y + se * se * (-3 * F.y + 3 * V.y - 2 * X.y - oe.y) + se * se * se * (2 * F.y - 2 * V.y + X.y + oe.y), be = F.z + se * X.z + se * se * (-3 * F.z + 3 * V.z - 2 * X.z - oe.z) + se * se * se * (2 * F.z - 2 * V.z + X.z + oe.z), Le = new n.Vector3(le, Ce, be); - ve < z / 2 ? Le.atom = F.atom : Le.atom = V.atom, k.push(Le); - } - return k.push(N[N.length - 1]), k; - } - const S = 0.5, y = 1.3, w = 0.8, L = 0.4, s = 0.4; - function o(P, z, k, N) { - for (var R, U, W, G, F = 0, V = z.length; F < V; F++) { - G = Math.round(F * (N.length - 1) / V), W = h.CC.color(N[G]); - var J = P.updateGeoGroup(2), X = J.vertexArray, oe = J.colorArray, te = J.faceArray; - R = J.vertices, U = R * 3, X[U] = z[F].x, X[U + 1] = z[F].y, X[U + 2] = z[F].z, X[U + 3] = k[F].x, X[U + 4] = k[F].y, X[U + 5] = k[F].z; - for (var ve = 0; ve < 6; ++ve) - oe[U + 3 * ve] = W.r, oe[U + 1 + 3 * ve] = W.g, oe[U + 2 + 3 * ve] = W.b; - if (F > 0) { - var se = [R, R + 1, R - 1, R - 2], le = J.faceidx; - te[le] = se[0], te[le + 1] = se[1], te[le + 2] = se[3], te[le + 3] = se[1], te[le + 4] = se[2], te[le + 5] = se[3], J.faceidx += 6; - } - J.vertices += 2; - } - } - function A(P, z, k, N, R, U, W) { - var G, F, V, J; - if (V = z.length, V < 2 || z[0].length < 2) - return; - for (G = 0; G < V; G++) - z[G] = c(z[G], N); - if (J = z[0].length, !R) - return o(P, z[0], z[V - 1], k); - var X, oe, te, ve, se, le, Ce = [], be = [], Le = []; - for (F = 0; F < V; F++) - Ce.push(0.25 + 1.5 * Math.sqrt((V - 1) * F - Math.pow(F, 2)) / (V - 1)), be.push(0.5), Le.push(2 * (Math.pow(F / V, 2) - F / V) + 0.6); - var ae = []; - for (F = 0; F < V * 2 - 1; F++) - ae[F] = [F, F + 1, F + 1 - 2 * V, F - 2 * V]; - ae[V * 2 - 1] = [ - F, - F + 1 - 2 * V, - F + 1 - 4 * V, - F - 2 * V - ]; - var _e, Ee, Be, Ne, Ge, ke, pe, de, ce, Ae; - let Oe = P.updateGeoGroup(); - for (G = 0; G < J; G++) { - let j = P.groups, ee = !1; - Oe = P.updateGeoGroup(2 * V), j != P.groups && G > 0 && (G = G - 1, ee = !0), ke = Math.round(G * (k.length - 1) / J), Ge = h.CC.color(k[ke]), se = te, le = ve, te = [], ve = [], X = [], z[0][G].atom !== void 0 && (Ne = z[0][G].atom, W === "oval" ? oe = Ce : W === "rectangle" ? oe = be : W === "parabola" && (oe = Le)), oe || (oe = be); - var We, Ue; - for (F = 0; F < V; F++) - G < J - 1 ? We = z[F][G + 1].clone().sub(z[F][G]) : We = z[F][G - 1].clone().sub(z[F][G]).negate(), F < V - 1 ? Ue = z[F + 1][G].clone().sub(z[F][G]) : Ue = z[F - 1][G].clone().sub(z[F][G]).negate(), X[F] = Ue.cross(We).normalize().multiplyScalar(R * oe[F]); - for (F = 0; F < V; F++) - te[F] = z[F][G].clone().add(X[F].clone().negate()); - for (F = 0; F < V; F++) - ve[F] = z[F][G].clone().add(X[F]); - for (pe = Oe.vertexArray, de = Oe.colorArray, ce = Oe.faceArray, _e = Oe.vertices, Ee = _e * 3, F = 0; F < V; F++) - pe[Ee + 3 * F + 0] = te[F].x, pe[Ee + 3 * F + 1] = te[F].y, pe[Ee + 3 * F + 2] = te[F].z; - for (F = 0; F < V; F++) - pe[Ee + 3 * F + 0 + 3 * V] = ve[V - 1 - F].x, pe[Ee + 3 * F + 1 + 3 * V] = ve[V - 1 - F].y, pe[Ee + 3 * F + 2 + 3 * V] = ve[V - 1 - F].z; - for (F = 0; F < 2 * V; ++F) - de[Ee + 3 * F + 0] = Ge.r, de[Ee + 3 * F + 1] = Ge.g, de[Ee + 3 * F + 2] = Ge.b; - if (G > 0 && !ee) { - for (F = 0; F < V * 2; F++) - Ae = [ - _e + ae[F][0], - _e + ae[F][1], - _e + ae[F][2], - _e + ae[F][3] - ], Be = Oe.faceidx, ce[Be] = Ae[0], ce[Be + 1] = Ae[1], ce[Be + 2] = Ae[3], ce[Be + 3] = Ae[1], ce[Be + 4] = Ae[2], ce[Be + 5] = Ae[3], Oe.faceidx += 6; - if (Ne.clickable || Ne.hoverable) { - var Z = []; - Z.push(new f.Triangle(se[0], te[0], te[V - 1])), Z.push(new f.Triangle(se[0], te[V - 1], se[V - 1])), Z.push(new f.Triangle(se[V - 1], te[V - 1], ve[V - 1])), Z.push(new f.Triangle(se[V - 1], ve[V - 1], le[V - 1])), Z.push(new f.Triangle(ve[0], le[0], le[V - 1])), Z.push(new f.Triangle(ve[V - 1], ve[0], le[V - 1])), Z.push(new f.Triangle(te[0], se[0], le[0])), Z.push(new f.Triangle(ve[0], te[0], le[0])); - for (F in Z) - Ne.intersectionShape.triangle.push(Z[F]); - } - } - Oe.vertices += 2 * V; - } - for (pe = Oe.vertexArray, de = Oe.colorArray, ce = Oe.faceArray, _e = Oe.vertices, Ee = _e * 3, Be = Oe.faceidx, G = 0; G < V - 1; G++) - Ae = [G, G + 1, 2 * V - 2 - G, 2 * V - 1 - G], Be = Oe.faceidx, ce[Be] = Ae[0], ce[Be + 1] = Ae[1], ce[Be + 2] = Ae[3], ce[Be + 3] = Ae[1], ce[Be + 4] = Ae[2], ce[Be + 5] = Ae[3], Oe.faceidx += 6; - for (G = 0; G < V - 1; G++) - Ae = [ - _e - 1 - G, - _e - 2 - G, - _e - 2 * V + G + 1, - _e - 2 * V + G - ], Be = Oe.faceidx, ce[Be] = Ae[0], ce[Be + 1] = Ae[1], ce[Be + 2] = Ae[3], ce[Be + 3] = Ae[1], ce[Be + 4] = Ae[2], ce[Be + 5] = Ae[3], Oe.faceidx += 6; - } - function p(P, z, k, N, R, U) { - if (!(z.length < 2)) { - var W, G; - if (W = z[0], G = z[z.length - 1], W = c(W, N), G = c(G, N), !R) - return o(P, W, G, k); - var F = [], V, J, X, oe, te, ve = [ - [0, 2, -6, -8], - [-4, -2, 6, 4], - [7, -1, -5, 3], - [-3, 5, 1, -7] - ], se, le, Ce, be, Le, ae, _e, Ee, Be, Ne, Ge, ke, pe, de, ce, Ae, Oe; - for (Ee = 0, Be = W.length; Ee < Be; Ee++) { - if (Le = Math.round(Ee * (k.length - 1) / Be), be = h.CC.color(k[Le]), F.push(J = W[Ee]), F.push(J), F.push(X = G[Ee]), F.push(X), Ee < Be - 1) { - var We = W[Ee + 1].clone().sub(W[Ee]), Ue = G[Ee].clone().sub(W[Ee]); - V = Ue.cross(We).normalize().multiplyScalar(R); - } - for (F.push(oe = W[Ee].clone().add(V)), F.push(oe), F.push(te = G[Ee].clone().add(V)), F.push(te), J.atom !== void 0 && (ae = J.atom), de = P.updateGeoGroup(8), ce = de.vertexArray, Ae = de.colorArray, Oe = de.faceArray, se = de.vertices, le = se * 3, ce[le] = J.x, ce[le + 1] = J.y, ce[le + 2] = J.z, ce[le + 3] = J.x, ce[le + 4] = J.y, ce[le + 5] = J.z, ce[le + 6] = X.x, ce[le + 7] = X.y, ce[le + 8] = X.z, ce[le + 9] = X.x, ce[le + 10] = X.y, ce[le + 11] = X.z, ce[le + 12] = oe.x, ce[le + 13] = oe.y, ce[le + 14] = oe.z, ce[le + 15] = oe.x, ce[le + 16] = oe.y, ce[le + 17] = oe.z, ce[le + 18] = te.x, ce[le + 19] = te.y, ce[le + 20] = te.z, ce[le + 21] = te.x, ce[le + 22] = te.y, ce[le + 23] = te.z, Ne = 0; Ne < 8; ++Ne) - Ae[le + 3 * Ne] = be.r, Ae[le + 1 + 3 * Ne] = be.g, Ae[le + 2 + 3 * Ne] = be.b; - if (Ee > 0) { - var Z = _e !== void 0 && ae !== void 0 && _e.serial !== ae.serial; - for (Ne = 0; Ne < 4; Ne++) { - var j = [ - se + ve[Ne][0], - se + ve[Ne][1], - se + ve[Ne][2], - se + ve[Ne][3] - ]; - if (Ce = de.faceidx, Oe[Ce] = j[0], Oe[Ce + 1] = j[1], Oe[Ce + 2] = j[3], Oe[Ce + 3] = j[1], Oe[Ce + 4] = j[2], Oe[Ce + 5] = j[3], de.faceidx += 6, ae.clickable || _e.clickable || ae.hoverable || _e.hoverable) { - var ee = F[j[3]].clone(), ge = F[j[0]].clone(), ye = F[j[2]].clone(), $e = F[j[1]].clone(); - if (ee.atom = F[j[3]].atom || null, ye.atom = F[j[2]].atom || null, ge.atom = F[j[0]].atom || null, $e.atom = F[j[1]].atom || null, Z) { - var Re = ee.clone().add(ge).multiplyScalar(0.5), Y = ye.clone().add($e).multiplyScalar(0.5), ue = ee.clone().add($e).multiplyScalar(0.5); - Ne % 2 === 0 ? ((_e.clickable || _e.hoverable) && (Ge = new f.Triangle(Re, ue, ee), ke = new f.Triangle(Y, ye, ue), pe = new f.Triangle(ue, ye, ee), _e.intersectionShape.triangle.push(Ge), _e.intersectionShape.triangle.push(ke), _e.intersectionShape.triangle.push(pe)), (ae.clickable || ae.hoverable) && (Ge = new f.Triangle(ge, $e, ue), ke = new f.Triangle($e, Y, ue), pe = new f.Triangle(ge, ue, Re), ae.intersectionShape.triangle.push(Ge), ae.intersectionShape.triangle.push(ke), ae.intersectionShape.triangle.push(pe))) : ((ae.clickable || ae.hoverable) && (Ge = new f.Triangle(Re, ue, ee), ke = new f.Triangle(Y, ye, ue), pe = new f.Triangle(ue, ye, ee), ae.intersectionShape.triangle.push(Ge), ae.intersectionShape.triangle.push(ke), ae.intersectionShape.triangle.push(pe)), (_e.clickable || _e.hoverable) && (Ge = new f.Triangle(ge, $e, ue), ke = new f.Triangle($e, Y, ue), pe = new f.Triangle(ge, ue, Re), _e.intersectionShape.triangle.push(Ge), _e.intersectionShape.triangle.push(ke), _e.intersectionShape.triangle.push(pe))); - } else - (ae.clickable || ae.hoverable) && (Ge = new f.Triangle(ge, $e, ee), ke = new f.Triangle($e, ye, ee), ae.intersectionShape.triangle.push(Ge), ae.intersectionShape.triangle.push(ke)); - } - } - } - de.vertices += 8, _e = ae; - } - var Se = F.length - 8; - for (de = P.updateGeoGroup(8), ce = de.vertexArray, Ae = de.colorArray, Oe = de.faceArray, se = de.vertices, le = se * 3, Ce = de.faceidx, Ee = 0; Ee < 4; Ee++) { - F.push(F[Ee * 2]), F.push(F[Se + Ee * 2]); - var Fe = F[Ee * 2], he = F[Se + Ee * 2]; - ce[le + 6 * Ee] = Fe.x, ce[le + 1 + 6 * Ee] = Fe.y, ce[le + 2 + 6 * Ee] = Fe.z, ce[le + 3 + 6 * Ee] = he.x, ce[le + 4 + 6 * Ee] = he.y, ce[le + 5 + 6 * Ee] = he.z, Ae[le + 6 * Ee] = be.r, Ae[le + 1 + 6 * Ee] = be.g, Ae[le + 2 + 6 * Ee] = be.b, Ae[le + 3 + 6 * Ee] = be.r, Ae[le + 4 + 6 * Ee] = be.g, Ae[le + 5 + 6 * Ee] = be.b; - } - Se += 8, Ge = [se, se + 2, se + 6, se + 4], ke = [se + 1, se + 5, se + 7, se + 3], Oe[Ce] = Ge[0], Oe[Ce + 1] = Ge[1], Oe[Ce + 2] = Ge[3], Oe[Ce + 3] = Ge[1], Oe[Ce + 4] = Ge[2], Oe[Ce + 5] = Ge[3], Oe[Ce + 6] = ke[0], Oe[Ce + 7] = ke[1], Oe[Ce + 8] = ke[3], Oe[Ce + 9] = ke[1], Oe[Ce + 10] = ke[2], Oe[Ce + 11] = ke[3], de.faceidx += 12, de.vertices += 8; - } - } - function v(P, z, k, N, R, U, W) { - (!W || W === "default") && (W = "rectangle"), W === "edged" ? p(P, z, k, N, R) : (W === "rectangle" || W === "oval" || W === "parabola") && A(P, z, k, N, R, U, W); - } - function a(P) { - return P && P.elem === "C" && P.atom === "CA"; - } - function l(P, z) { - if (P && z && P.chain === z.chain) { - if (!P.hetflag && !z.hetflag && P.reschain === z.reschain && (P.resi === z.resi || P.resi === z.resi - 1)) - return !0; - if (P.resi < z.resi) { - var k = P.x - z.x, N = P.y - z.y, R = P.z - z.z, U = k * k + N * N + R * R; - if (P.atom == "CA" && z.atom == "CA" && U < 16) - return !0; - if ((P.atom == "P" || z.atom == "P") && U < 64) - return !0; - } - } - return !1; - } - function g(P, z, k, N, R) { - if (!(z == null || z.vertices == 0)) { - R && (z.initTypedArrays(), z.setUpNormals()); - var U = new u.MeshDoubleLambertMaterial(); - U.vertexColors = u.Coloring.FaceColors, typeof k == "number" && k >= 0 && k < 1 && (U.transparent = !0, U.opacity = k), U.outline = N; - var W = new u.Mesh(z, U); - P.add(W); - } - } - function M(P, z, k, N, R, U, W, G, F) { - var V, J, X, oe, te, ve; - if (!(!N || !R || !W)) { - var se = R.sub(N); - se.normalize(); - var le = G[F]; - for (J = F + 1; J < G.length && (le = G[J], le.atom != W.atom); J++) - ; - if (le = le ? new n.Vector3(le.x, le.y, le.z) : new n.Vector3(0, 0, 0), le.sub(N), W.ss === "arrow start") { - var Ce = le.clone().multiplyScalar(0.3).cross(R); - N.add(Ce); - var be = le.clone().cross(se).normalize(); - se.rotateAboutVector(be, 0.43); - } - for (W.style.cartoon.ribbon ? V = W.style.cartoon.thickness || L : W.style.cartoon.width ? V = W.style.cartoon.width : W.ss === "c" ? W.atom === "P" ? V = w : V = S : W.ss === "arrow start" ? (V = y, te = !0) : W.ss === "arrow end" || W.ss === "h" && W.style.cartoon.tubes || W.ss === "tube start" ? V = S : V = y, U != null && se.dot(U) < 0 && se.negate(), se.multiplyScalar(V), J = 0; J < z; J++) - X = -1 + J * 2 / (z - 1), oe = new n.Vector3(N.x + X * se.x, N.y + X * se.y, N.z + X * se.z), oe.atom = W, k && W.ss === "s" && (oe.smoothen = !0), P[J].push(oe); - if (te) - for (se.multiplyScalar(2), J = 0; J < z; J++) - X = -1 + J * 2 / (z - 1), oe = new n.Vector3(N.x + X * se.x, N.y + X * se.y, N.z + X * se.z), oe.atom = W, oe.smoothen = !1, oe.skip = !0, P[J].push(oe); - return ve = W.style.cartoon.style || "default", P.style ? P.style != ve && (console.log("Warning: a cartoon chain's strand-style is ambiguous"), P.style = "default") : P.style = ve, (W.ss === "arrow start" || W.ss === "arrow end") && (W.ss = "s"), te; - } - } - const C = { - C: !0, - CA: !0, - O: !0, - P: !0, - OP2: !0, - O2P: !0, - "O5'": !0, - "O3'": !0, - "C5'": !0, - "C2'": !0, - "O5*": !0, - "O3*": !0, - "C5*": !0, - "C2*": !0, - N1: !0, - N3: !0 - }, T = { DA: !0, DG: !0, A: !0, G: !0 }, D = { DT: !0, DC: !0, U: !0, C: !0, T: !0 }, I = { DA: !0, DG: !0, A: !0, G: !0, DT: !0, DC: !0, U: !0, C: !0, T: !0 }; - function B(P, z, k, N = 10) { - let R = N, U = N; - var W, G, F, V, J, X, oe, te, ve, se, le, Ce, be, Le, ae, _e, Ee, Be, Ne = new u.Geometry(!0), Ge = new u.Geometry(!0), ke = [], pe = [], de = 1, ce = !1, Ae = {}; - for (var Oe in b.Gradient.builtinGradients) - b.Gradient.builtinGradients.hasOwnProperty(Oe) && (Ae[Oe] = new b.Gradient.builtinGradients[Oe](k[1], k[0])); - var We = function(K, ze) { - return k && ze.color === "spectrum" ? ze.colorscheme in Ae ? Ae[ze.colorscheme].valueToHex(K.resi) : Ae.sinebow.valueToHex(K.resi) : (0, E.getColorFromStyle)(K, ze).getHex(); - }; - for (te = 0; te < R; te++) - pe[te] = []; - var Ue = !1, Z = !1, j = []; - for (te in z) { - if (V = z[te], V.elem === "C" && V.atom === "CA") { - var ee = l(F, V); - ee && V.ss === "s" ? Ue = !0 : Ue && (F && G && F.style.cartoon.arrows && G.style.cartoon.arrows && (F.ss = "arrow end", G.ss = "arrow start"), Ue = !1), ee && (F.ss === "h" || F.ss == "tube start") && F.style.cartoon.tubes ? !Z && F.ss != "tube start" && V.style.cartoon.tubes && (V.ss = "tube start", Z = !0) : Z && (F.ss === "tube start" ? F.ss = "tube end" : G && G.style.cartoon.tubes && (G.ss = "tube end"), Z = !1), G = F, F = V; - } - V && V.atom in C && j.push(V); - } - Z && F.style.cartoon.tubes && (F.ss = "tube end", Z = !1); - var ge = function(K) { - pe[0].length > 0 && v(Ge, pe, ke, U, oe, de, pe.style); - var ze = [], Ve = null; - if (K) { - for (te = 0; te < R; te++) - ze[te] = pe[te][pe[te].length - 1]; - Ve = ke[ke.length - 1]; - } - for (pe = [], te = 0; te < R; te++) - pe[te] = []; - if (ke = [], K) { - for (te = 0; te < R; te++) - pe[te].push(ze[te]); - ke.push(Ve); - } - g(P, Ge, de, ce, !0), g(P, Ne, de, ce, !1), Ge = new u.Geometry(!0), Ne = new u.Geometry(!0); - }; - F = void 0; - for (var ye = 0; ye < j.length; ye++) { - V = j[ye]; - var $e = V.resn.trim(), Re = $e in I; - if (de = 1, W = V.style.cartoon, F && F.style.cartoon && (de = F.style.cartoon.opacity), F && F.style.cartoon && F.style.cartoon.outline && (ce = F.style.cartoon.outline), F && F.style.cartoon && (!V.style.cartoon || F.style.cartoon.opacity != V.style.cartoon.opacity) && ge(F.chain == V.chain), W.style === "trace") { - if (!V.hetflag) { - if (V.elem === "C" && V.atom === "CA" || Re && V.atom === "P" || V.atom === "BB") { - if (X = We(V, W), (0, E.isNumeric)(W.thickness) ? oe = W.thickness : oe = L, l(F, V)) - if (X == J) { - var Y = h.CC.color(X); - _.GLDraw.drawCylinder(Ne, F, V, oe, Y, 2, 2); - } else { - var ue = new n.Vector3().addVectors(F, V).multiplyScalar(0.5), Se = h.CC.color(J), Fe = h.CC.color(X); - _.GLDraw.drawCylinder(Ne, F, ue, oe, Se, 2, 0), _.GLDraw.drawCylinder(Ne, ue, V, oe, Fe, 0, 2); - } - if ((V.clickable === !0 || V.hoverable) && V.intersectionShape !== void 0) { - var he = new n.Vector3(V.x, V.y, V.z); - V.intersectionShape.sphere.push(new f.Sphere(he, oe)); - } - F = V, J = X; - } - } - } else { - if (a(V) || Re && (V.atom === "P" || V.atom.indexOf("O5") == 0)) { - if (Be) - if (V.ss === "tube end") - Be = !1, Ee = new n.Vector3(V.x, V.y, V.z), _.GLDraw.drawCylinder(Ne, _e, Ee, 2, h.CC.color(J), 1, 1), V.ss = "h"; - else if (F.chain != V.chain || F.ss === "tube end") - Be = !1, F.ss = "h", Ee = new n.Vector3(F.x, F.y, F.z), _.GLDraw.drawCylinder(Ne, _e, Ee, 2, h.CC.color(J), 1, 1); - else - continue; - if (F && (!l(F, V) || F.ss === "tube start")) { - for (F.ss === "tube start" && (Be = !0, _e = new n.Vector3(F.x, F.y, F.z), F.ss = "h"), ae && (Ce ? Le = new n.Vector3().addVectors(F, Ce).multiplyScalar(0.5) : Le = new n.Vector3(F.x, F.y, F.z), _.GLDraw.drawCylinder(Ne, Le, ae, s, h.CC.color(ae.color), 0, 2), M(pe, R, !0, Ce, be, le, F, j, ye), ke.push(X), Le = null, ae = null), pe[0].length > 0 && v(Ge, pe, ke, U, oe, de, pe.style), pe = [], te = 0; te < R; te++) - pe[te] = []; - ke = []; - } - if (F === void 0 || F.rescode != V.rescode || F.resi != V.resi) { - if (ae) { - Le = new n.Vector3().addVectors(F, V).multiplyScalar(0.5); - var De = Le.clone().sub(ae).multiplyScalar(0.02); - Le.add(De), _.GLDraw.drawCylinder(Ne, Le, ae, s, h.CC.color(ae.color), 0, 2), Le = null, ae = null; - } - X = We(V, W), ke.push(X), (0, E.isNumeric)(W.thickness) ? oe = W.thickness : oe = L, F = V, ve = new n.Vector3(F.x, F.y, F.z), ve.resi = F.resi, J = X; - } - (V.clickable === !0 || V.hoverable === !0) && (V.intersectionShape === void 0 || V.intersectionShape.triangle === void 0) && (V.intersectionShape = { - sphere: null, - cylinder: [], - line: [], - triangle: [] - }); - } else - a(F) && V.atom === "O" || Re && F.atom === "P" && (V.atom === "OP2" || V.atom === "O2P") || Re && F.atom.indexOf("O5") == 0 && V.atom.indexOf("C5") == 0 ? (se = new n.Vector3(V.x, V.y, V.z), se.resi = V.resi, (V.atom === "OP2" || V.atom === "O2P") && (be = new n.Vector3(V.x, V.y, V.z))) : Re && V.atom.indexOf("O3") == 0 ? Ce = new n.Vector3(V.x, V.y, V.z) : (V.atom === "N1" && $e in T || V.atom === "N3" && $e in D) && (ae = new n.Vector3(V.x, V.y, V.z), ae.color = (0, E.getColorFromStyle)(V, W).getHex()); - se && ve && se.resi === ve.resi && (M(pe, R, !0, ve, se, le, F, j, ye), le = se, ve = null, se = null, ke.push(X)); - } - } - ae && (Ce ? Le = new n.Vector3().addVectors(F, Ce).multiplyScalar(0.5) : Le = new n.Vector3(F.x, F.y, F.z), _.GLDraw.drawCylinder(Ne, Le, ae, s, h.CC.color(ae.color), 0, 2), M(pe, R, !0, Ce, be, le, F, j, ye), ke.push(X)), ge(!1); - } - } - ), - /***/ - "./src/index.ts": ( - /*!**********************!*\ - !*** ./src/index.ts ***! - \**********************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CAP: () => ( - /* reexport safe */ - s.CAP - ), - /* harmony export */ - CC: () => ( - /* reexport safe */ - f.CC - ), - /* harmony export */ - Color: () => ( - /* reexport safe */ - f.Color - ), - /* harmony export */ - CustomLinear: () => ( - /* reexport safe */ - n.CustomLinear - ), - /* harmony export */ - Cylinder: () => ( - /* reexport safe */ - E.Cylinder - ), - /* harmony export */ - GLDraw: () => ( - /* reexport safe */ - s.GLDraw - ), - /* harmony export */ - GLModel: () => ( - /* reexport safe */ - A.GLModel - ), - /* harmony export */ - GLShape: () => ( - /* reexport safe */ - L.GLShape - ), - /* harmony export */ - GLViewer: () => ( - /* reexport safe */ - p.GLViewer - ), - /* harmony export */ - GLVolumetricRender: () => ( - /* reexport safe */ - w.GLVolumetricRender - ), - /* harmony export */ - Gradient: () => ( - /* reexport safe */ - n.Gradient - ), - /* harmony export */ - GradientType: () => ( - /* reexport safe */ - n.GradientType - ), - /* harmony export */ - Label: () => ( - /* reexport safe */ - u.Label - ), - /* harmony export */ - LabelCount: () => ( - /* reexport safe */ - u.LabelCount - ), - /* harmony export */ - MarchingCube: () => ( - /* reexport safe */ - S.MarchingCube - ), - /* harmony export */ - MarchingCubeInitializer: () => ( - /* reexport safe */ - S.MarchingCubeInitializer - ), - /* harmony export */ - Matrix3: () => ( - /* reexport safe */ - _.Matrix3 - ), - /* harmony export */ - Matrix4: () => ( - /* reexport safe */ - _.Matrix4 - ), - /* harmony export */ - Parsers: () => ( - /* reexport safe */ - h.Parsers - ), - /* harmony export */ - PausableTimer: () => ( - /* reexport safe */ - c.PausableTimer - ), - /* harmony export */ - PointGrid: () => ( - /* reexport safe */ - S.PointGrid - ), - /* harmony export */ - ProteinSurface: () => ( - /* reexport safe */ - S.ProteinSurface - ), - /* harmony export */ - Quaternion: () => ( - /* reexport safe */ - _.Quaternion - ), - /* harmony export */ - ROYGB: () => ( - /* reexport safe */ - n.ROYGB - ), - /* harmony export */ - RWB: () => ( - /* reexport safe */ - n.RWB - ), - /* harmony export */ - Ray: () => ( - /* reexport safe */ - _.Ray - ), - /* harmony export */ - Sinebow: () => ( - /* reexport safe */ - n.Sinebow - ), - /* harmony export */ - Sphere: () => ( - /* reexport safe */ - E.Sphere - ), - /* harmony export */ - SurfaceType: () => ( - /* reexport safe */ - S.SurfaceType - ), - /* harmony export */ - Triangle: () => ( - /* reexport safe */ - E.Triangle - ), - /* harmony export */ - Vector2: () => ( - /* reexport safe */ - _.Vector2 - ), - /* harmony export */ - Vector3: () => ( - /* reexport safe */ - _.Vector3 - ), - /* harmony export */ - VolumeData: () => ( - /* reexport safe */ - y.VolumeData - ), - /* harmony export */ - adjustVolumeStyle: () => ( - /* reexport safe */ - c.adjustVolumeStyle - ), - /* harmony export */ - applyPartialCharges: () => ( - /* reexport safe */ - b.applyPartialCharges - ), - /* harmony export */ - autoinit: () => ( - /* reexport safe */ - v.autoinit - ), - /* harmony export */ - autoload: () => ( - /* reexport safe */ - v.autoload - ), - /* harmony export */ - base64ToArray: () => ( - /* reexport safe */ - c.base64ToArray - ), - /* harmony export */ - bondLength: () => ( - /* reexport safe */ - h.bondLength - ), - /* harmony export */ - builtinColorSchemes: () => ( - /* reexport safe */ - f.builtinColorSchemes - ), - /* harmony export */ - builtinGradients: () => ( - /* reexport safe */ - n.builtinGradients - ), - /* harmony export */ - chains: () => ( - /* reexport safe */ - f.chains - ), - /* harmony export */ - clamp: () => ( - /* reexport safe */ - _.clamp - ), - /* harmony export */ - conversionMatrix3: () => ( - /* reexport safe */ - _.conversionMatrix3 - ), - /* harmony export */ - createStereoViewer: () => ( - /* reexport safe */ - p.createStereoViewer - ), - /* harmony export */ - createViewer: () => ( - /* reexport safe */ - p.createViewer - ), - /* harmony export */ - createViewerGrid: () => ( - /* reexport safe */ - p.createViewerGrid - ), - /* harmony export */ - deepCopy: () => ( - /* reexport safe */ - c.deepCopy - ), - /* harmony export */ - degToRad: () => ( - /* reexport safe */ - _.degToRad - ), - /* harmony export */ - download: () => ( - /* reexport safe */ - c.download - ), - /* harmony export */ - drawCartoon: () => ( - /* reexport safe */ - o.drawCartoon - ), - /* harmony export */ - elementColors: () => ( - /* reexport safe */ - f.elementColors - ), - /* harmony export */ - extend: () => ( - /* reexport safe */ - c.extend - ), - /* harmony export */ - get: () => ( - /* reexport safe */ - c.get - ), - /* harmony export */ - getAtomProperty: () => ( - /* reexport safe */ - c.getAtomProperty - ), - /* harmony export */ - getColorFromStyle: () => ( - /* reexport safe */ - c.getColorFromStyle - ), - /* harmony export */ - getElement: () => ( - /* reexport safe */ - c.getElement - ), - /* harmony export */ - getExtent: () => ( - /* reexport safe */ - c.getExtent - ), - /* harmony export */ - getGradient: () => ( - /* reexport safe */ - n.getGradient - ), - /* harmony export */ - getPropertyRange: () => ( - /* reexport safe */ - c.getPropertyRange - ), - /* harmony export */ - getbin: () => ( - /* reexport safe */ - c.getbin - ), - /* harmony export */ - htmlColors: () => ( - /* reexport safe */ - f.htmlColors - ), - /* harmony export */ - isEmptyObject: () => ( - /* reexport safe */ - c.isEmptyObject - ), - /* harmony export */ - isNumeric: () => ( - /* reexport safe */ - c.isNumeric - ), - /* harmony export */ - makeFunction: () => ( - /* reexport safe */ - c.makeFunction - ), - /* harmony export */ - mergeGeos: () => ( - /* reexport safe */ - c.mergeGeos - ), - /* harmony export */ - normalizeValue: () => ( - /* reexport safe */ - n.normalizeValue - ), - /* harmony export */ - partialCharges: () => ( - /* reexport safe */ - b.partialCharges - ), - /* harmony export */ - processing_autoinit: () => ( - /* reexport safe */ - v.processing_autoinit - ), - /* harmony export */ - residues: () => ( - /* reexport safe */ - f.residues - ), - /* harmony export */ - setBondLength: () => ( - /* reexport safe */ - h.setBondLength - ), - /* harmony export */ - setSyncSurface: () => ( - /* reexport safe */ - S.setSyncSurface - ), - /* harmony export */ - specStringToObject: () => ( - /* reexport safe */ - c.specStringToObject - ), - /* harmony export */ - splitMesh: () => ( - /* reexport safe */ - L.splitMesh - ), - /* harmony export */ - ssColors: () => ( - /* reexport safe */ - f.ssColors - ), - /* harmony export */ - subdivide_spline: () => ( - /* reexport safe */ - o.subdivide_spline - ), - /* harmony export */ - syncSurface: () => ( - /* reexport safe */ - S.syncSurface - ), - /* harmony export */ - viewers: () => ( - /* reexport safe */ - v.viewers - ) - /* harmony export */ - }); - var n = r( - /*! ./Gradient */ - "./src/Gradient.ts" - ), f = r( - /*! ./colors */ - "./src/colors.ts" - ), u = r( - /*! ./Label */ - "./src/Label.ts" - ), b = r( - /*! ./partialCharges */ - "./src/partialCharges.ts" - ), h = r( - /*! ./parsers */ - "./src/parsers/index.ts" - ), _ = r( - /*! ./WebGL/math */ - "./src/WebGL/math/index.ts" - ), E = r( - /*! ./WebGL/shapes */ - "./src/WebGL/shapes/index.ts" - ), c = r( - /*! ./utilities */ - "./src/utilities.ts" - ), S = r( - /*! ./ProteinSurface4 */ - "./src/ProteinSurface4.ts" - ), y = r( - /*! ./VolumeData */ - "./src/VolumeData.ts" - ), w = r( - /*! ./VolumetricRender */ - "./src/VolumetricRender.ts" - ), L = r( - /*! ./GLShape */ - "./src/GLShape.ts" - ), s = r( - /*! ./GLDraw */ - "./src/GLDraw.ts" - ), o = r( - /*! ./glcartoon */ - "./src/glcartoon.ts" - ), A = r( - /*! ./GLModel */ - "./src/GLModel.ts" - ), p = r( - /*! ./GLViewer */ - "./src/GLViewer.ts" - ), v = r( - /*! ./autoload */ - "./src/autoload.ts" - ); - r( - /*! ./specs */ - "./src/specs.ts" - ), window && (window.$3Dmol = e); - } - ), - /***/ - "./src/parsers/CDJSON.ts": ( - /*!*******************************!*\ - !*** ./src/parsers/CDJSON.ts ***! - \*******************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CDJSON: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f, u) { - var b = [[]]; - typeof f == "string" && (f = JSON.parse(f)); - for (var h = f.m, _ = h[0].a, E = h[0].b, c = h[0].s, S = u !== void 0 && u.parseStyle !== void 0 ? u.parseStyle : c !== void 0, y = b[b.length - 1].length, w = 0; w < _.length; w++) { - var L = _[w], s = {}; - s.id = L.i, s.x = L.x, s.y = L.y, s.z = L.z || 0, s.bonds = [], s.bondOrder = []; - var o = L.l || "C"; - s.elem = o[0].toUpperCase() + o.substring(1).toLowerCase(), s.serial = b[b.length - 1].length, S && (s.style = c[L.s || 0]), b[b.length - 1].push(s); - } - for (let A = 0; A < E.length; A++) { - let p = E[A], v = p.b + y, a = p.e + y, l = p.o || 1, g = b[b.length - 1][v], M = b[b.length - 1][a]; - g.bonds.push(a), g.bondOrder.push(l), M.bonds.push(v), M.bondOrder.push(l); - } - return b; - } - } - ), - /***/ - "./src/parsers/CIF.ts": ( - /*!****************************!*\ - !*** ./src/parsers/CIF.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CIF: () => ( - /* binding */ - h - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ), f = r( - /*! ./utils/computeSecondaryStructure */ - "./src/parsers/utils/computeSecondaryStructure.ts" - ), u = r( - /*! ./utils/processSymmetries */ - "./src/parsers/utils/processSymmetries.ts" - ), b = r( - /*! ../WebGL */ - "./src/WebGL/index.ts" - ); - function h(_, E = {}) { - var c = [], S = !E.doAssembly, y = c.modelData = [], w = E.assignBonds === void 0 ? !0 : E.assignBonds, L = function(j, ee, ge, ye) { - return new b.Vector3(ee, ge, ye).applyMatrix3(j); - }; - function s(j, ee) { - for (var ge = [], ye = 0, $e = 0; $e < j.length; ) { - for (; j.substring($e, $e + ee.length) !== ee && $e < j.length; ) { - if (j[$e] === "'") - for ($e++; $e < j.length && j[$e] !== "'"; ) - $e++; - else if (j[$e] === '"') - for ($e++; $e < j.length && j[$e] !== '"'; ) - $e++; - $e++; - } - ge.push(j.substring(ye, $e)), ye = $e = $e + ee.length; - } - return ge; - } - var o = _.split(/\r?\n|\r/), A = [], p = !1; - for (let j = 0; j < o.length; j++) { - var v = o[j].split("#")[0]; - if (p ? v[0] === ";" && (p = !1) : v[0] === ";" && (p = !0), p || v !== "") { - if (!p && (v = v.trim(), v[0] === "_")) { - var a = v.split(/\s/)[0].indexOf("."); - if (a > -1) { - let ee = v.split(""); - ee[a] = "_", v = ee.join(""), v = v.substring(0, a) + "_" + v.substring(a + 1); - } - } - A.push(v); - } - } - for (var l = 0; l < A.length; ) { - for (; !A[l].startsWith("data_") || A[l] === "data_global"; ) - l++; - l++; - for (var g = {}; l < A.length && !A[l].startsWith("data_"); ) - if (A[l][0] === void 0) - l++; - else if (A[l][0] === "_") { - var M = A[l].split(/\s/)[0].toLowerCase(), C = g[M] = g[M] || [], T = A[l].substring(A[l].indexOf(M) + M.length); - if (T === "") - if (l++, A[l][0] === ";") { - var D = A[l].substring(1); - for (l++; A[l] !== ";"; ) - D = D + ` -` + A[l], l++; - C.push(D); - } else - C.push(A[l]); - else - C.push(T.trim()); - l++; - } else if (A[l].substring(0, 5) === "loop_") { - l++; - for (var I = []; A[l] === "" || A[l][0] === "_"; ) { - if (A[l] !== "") { - let j = A[l].split(/\s/)[0].toLowerCase(), ee = g[j] = g[j] || []; - I.push(ee); - } - l++; - } - for (var B = 0; l < A.length && A[l][0] !== "_" && !A[l].startsWith("loop_") && !A[l].startsWith("data_"); ) { - let j = s(A[l], " "); - for (var P = 0; P < j.length; P++) - j[P] !== "" && (I[B].push(j[P]), B = (B + 1) % I.length); - l++; - } - } else - l++; - y.push({ symmetries: [] }), c.push([]); - var z = g._atom_site_id !== void 0 ? g._atom_site_id.length : g._atom_site_label.length, k; - if (g._cell_length_a !== void 0) { - var N = parseFloat(g._cell_length_a), R = parseFloat(g._cell_length_b), U = parseFloat(g._cell_length_c), W = parseFloat(g._cell_angle_alpha) || 90, G = parseFloat(g._cell_angle_beta) || 90, F = parseFloat(g._cell_angle_gamma) || 90; - k = (0, b.conversionMatrix3)(N, R, U, W, G, F), y[y.length - 1].cryst = { - a: N, - b: R, - c: U, - alpha: W, - beta: G, - gamma: F - }; - } - for (var V = 0; V < z; V++) - if (!(g._atom_site_group_pdb !== void 0 && g._atom_site_group_pdb[V] === "TER")) { - var J = {}; - if (g._atom_site_cartn_x !== void 0) - J.x = parseFloat(g._atom_site_cartn_x[V]), J.y = parseFloat(g._atom_site_cartn_y[V]), J.z = parseFloat(g._atom_site_cartn_z[V]); - else { - var X = L(k, parseFloat(g._atom_site_fract_x[V]), parseFloat(g._atom_site_fract_y[V]), parseFloat(g._atom_site_fract_z[V])); - J.x = X.x, J.y = X.y, J.z = X.z; - } - J.chain = g._atom_site_auth_asym_id ? g._atom_site_auth_asym_id[V] : void 0, J.resi = g._atom_site_auth_seq_id ? parseInt(g._atom_site_auth_seq_id[V]) : void 0, J.resn = g._atom_site_auth_comp_id ? g._atom_site_auth_comp_id[V].trim() : void 0, J.atom = g._atom_site_auth_atom_id ? g._atom_site_auth_atom_id[V].replace(/"/gm, "") : void 0, J.hetflag = !g._atom_site_group_pdb || g._atom_site_group_pdb[V] === "HETA" || g._atom_site_group_pdb[V] === "HETATM"; - var oe = "X"; - g._atom_site_type_symbol ? oe = g._atom_site_type_symbol[V].replace(/\(?\+?\d+.*/, "") : g._atom_site_label && (oe = g._atom_site_label[V].split("_")[0].replace(/\(?\d+.*/, "")), J.elem = oe[0].toUpperCase() + oe.substring(1, 2).toLowerCase(), J.bonds = [], J.ss = "c", J.serial = V, J.bondOrder = [], J.properties = {}, c[c.length - 1].push(J); - } - if (g._pdbx_struct_oper_list_id !== void 0 && !S) - for (let j = 0; j < g._pdbx_struct_oper_list_id.length; j++) { - var te = parseFloat(g["_pdbx_struct_oper_list_matrix[1][1]"][j]), ve = parseFloat(g["_pdbx_struct_oper_list_matrix[1][2]"][j]), se = parseFloat(g["_pdbx_struct_oper_list_matrix[1][3]"][j]), le = parseFloat(g["_pdbx_struct_oper_list_vector[1]"][j]), Ce = parseFloat(g["_pdbx_struct_oper_list_matrix[2][1]"][j]), be = parseFloat(g["_pdbx_struct_oper_list_matrix[2][2]"][j]), Le = parseFloat(g["_pdbx_struct_oper_list_matrix[2][3]"][j]), ae = parseFloat(g["_pdbx_struct_oper_list_vector[2]"][j]), _e = parseFloat(g["_pdbx_struct_oper_list_matrix[3][1]"][j]), Ee = parseFloat(g["_pdbx_struct_oper_list_matrix[3][2]"][j]), Be = parseFloat(g["_pdbx_struct_oper_list_matrix[3][3]"][j]), Ne = parseFloat(g["_pdbx_struct_oper_list_vector[3]"][j]), Ge = new b.Matrix4(te, ve, se, le, Ce, be, Le, ae, _e, Ee, Be, Ne); - y[y.length - 1].symmetries.push(Ge); - } - var ke = function(j) { - var ee = j.match("-"); - j = j.replace(/[-xyz]/g, ""); - var ge = j.split("/"), ye, $e; - return ge[1] === void 0 ? $e = 1 : $e = parseInt(ge[1]), ge[0] === "" ? ye = 1 : ye = parseInt(ge[0]), ye / $e * (ee ? -1 : 1); - }; - if (g._symmetry_equiv_pos_as_xyz !== void 0 && !S) - for (var pe = 0; pe < g._symmetry_equiv_pos_as_xyz.length; pe++) { - var de = g._symmetry_equiv_pos_as_xyz[pe].replace(/["' ]/g, ""), ce = de.split(",").map(function(ee) { - return ee.replace(/-/g, "+-"); - }); - let j = new b.Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1); - for (let ee = 0; ee < 3; ee++) { - var Ae = ce[ee].split("+"); - for (let ge = 0; ge < Ae.length; ge++) { - var Oe = Ae[ge]; - if (Oe !== "") { - var We = ke(Oe); - Oe.match("x") ? j.elements[ee + 0] = We : Oe.match("y") ? j.elements[ee + 4] = We : Oe.match("z") ? j.elements[ee + 8] = We : j.elements[ee + 12] = We; - } - } - } - var Ue = k.getMatrix4(), Z = new b.Matrix4().getInverse(Ue, !0); - j = new b.Matrix4().multiplyMatrices(j, Z), j = new b.Matrix4().multiplyMatrices(Ue, j), y[y.length - 1].symmetries.push(j); - } - } - for (let j = 0; j < c.length; j++) - w && (0, n.assignBonds)(c[j]), (0, f.computeSecondaryStructure)(c[j], E.hbondCutoff), (0, u.processSymmetries)(y[j].symmetries, c[j], E, y[j].cryst), E.duplicateAssemblyAtoms && !E.dontConnectDuplicatedAtoms && w && (0, n.assignBonds)(c[j]); - return c; - } - } - ), - /***/ - "./src/parsers/CUBE.ts": ( - /*!*****************************!*\ - !*** ./src/parsers/CUBE.ts ***! - \*****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - CUBE: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ../WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./utils/assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ), u = r( - /*! ./utils/anumToSymbol */ - "./src/parsers/utils/anumToSymbol.ts" - ); - function b(h, _) { - _ = _ || {}; - var E = [[]], c = h.split(/\r?\n/), S = _.assignBonds === void 0 ? !0 : _.assignBonds; - if (c.length < 6) - return E; - var y = c[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), w = Math.abs(parseFloat(y[0])); - let L = {}; - var s = L.origin = new n.Vector3(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])); - y = c[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), y = c[3].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - var o = y[0] > 0 ? 0.529177 : 1; - s.multiplyScalar(o); - var A = Math.abs(y[0]), p = new n.Vector3(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])).multiplyScalar(o); - y = c[4].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - var v = Math.abs(y[0]), a = new n.Vector3(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])).multiplyScalar(o); - y = c[5].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - var l = Math.abs(y[0]), g = new n.Vector3(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])).multiplyScalar(o); - if (L.size = { x: A, y: v, z: l }, L.unit = new n.Vector3(p.x, a.y, g.z), p.y != 0 || p.z != 0 || a.x != 0 || a.z != 0 || g.x != 0 || g.y != 0) { - L.matrix4 = new n.Matrix4(p.x, a.x, g.x, 0, p.y, a.y, g.y, 0, p.z, a.z, g.z, 0, 0, 0, 0, 1); - let P = new n.Matrix4().makeTranslation(s.x, s.y, s.z); - L.matrix4 = L.matrix4.multiplyMatrices(P, L.matrix4), L.matrix = L.matrix4.matrix3FromTopLeft(), L.origin = new n.Vector3(0, 0, 0), L.unit = new n.Vector3(1, 1, 1); - } - E.modelData = [{ cryst: L }], c = c.splice(6, w); - for (var M = E[E.length - 1].length, C = M + c.length, T = M; T < C; ++T) { - var D = {}; - D.serial = T; - var I = c[T - M], B = I.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - D.elem = u.anumToSymbol[B[0]], D.x = parseFloat(B[2]) * o, D.y = parseFloat(B[3]) * o, D.z = parseFloat(B[4]) * o, D.hetflag = !0, D.bonds = [], D.bondOrder = [], D.properties = {}, E[E.length - 1].push(D); - } - if (S) - for (let P = 0; P < E.length; P++) - (0, f.assignBonds)(E[P]); - return E; - } - } - ), - /***/ - "./src/parsers/GRO.ts": ( - /*!****************************!*\ - !*** ./src/parsers/GRO.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - GRO: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/assignPDBBonds */ - "./src/parsers/utils/assignPDBBonds.ts" - ), f = r( - /*! ./utils/atomNameToElem */ - "./src/parsers/utils/atomNameToElem.ts" - ); - function u(b) { - for (var h = [], _ = b.split(/\r?\n|\r/); _.length > 0 && !(_.length < 3); ) { - var E = parseInt(_[1]); - if (isNaN(E) || E <= 0 || _.length < E + 3) - break; - var c = []; - h.push(c); - for (var S = 2, y = c.length, w = y + E, L = y; L < w; L++) { - var s = _[S++], o = {}; - o.serial = L, o.atom = s.slice(10, 15).trim(), o.elem = (0, f.atomNameToElem)(o.atom, !0), o.x = 10 * parseFloat(s.slice(20, 28)), o.y = 10 * parseFloat(s.slice(28, 36)), o.z = 10 * parseFloat(s.slice(36, 44)), o.resi = parseInt(s.slice(0, 5)), o.resn = s.slice(5, 10).trim(), o.bonds = [], o.bondOrder = [], o.properties = {}, s.length > 44 && (o.dx = 10 * parseFloat(s.slice(44, 52)), o.dy = 10 * parseFloat(s.slice(52, 60)), o.dz = 10 * parseFloat(s.slice(60, 68))), c[L] = o; - } - if (_.length <= S + 3) { - var A = _[S++], p = A.trim().split(/\s+/); - if (p.length == 3) { - for (var v = 0; v < 3; v++) - p[v] = parseFloat(p[v]) * 10; - h.box = p; - } - } - _.splice(0, ++S); - } - for (let a = 0; a < h.length; a++) - (0, n.assignPDBBonds)(h[a]); - return h; - } - } - ), - /***/ - "./src/parsers/LAMMPSTRJ.ts": ( - /*!**********************************!*\ - !*** ./src/parsers/LAMMPSTRJ.ts ***! - \**********************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - LAMMPSTRJ: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ); - function f(u, b) { - for (var h = [], _ = { - id: "serial", - type: "atom", - element: "elem", - q: "charge", - radius: "radius", - x: "x", - xu: "x", - xs: "x", - xsu: "x", - y: "y", - yu: "y", - ys: "y", - ysu: "y", - z: "z", - zu: "z", - zs: "z", - zsu: "z" - }, E = u.split(/\r?\n|\r/), c = 0, S = 0, y = 0; y < E.length - 9; ) { - for (var w = y; w < E.length; w++) - if (E[w].match(/ITEM: NUMBER OF ATOMS/) && (S = parseInt(E[w + 1])), E[w].match(/ITEM: ATOMS/)) { - c = w + 1; - break; - } - var L = E[c - 1].replace("ITEM: ATOMS ", "").split(" "); - h.push([]); - for (let l = c; l < c + S; l++) { - for (var s = {}, o = {}, A = E[l].split(" "), p = 0; p < A.length; p++) { - var v = _[L[p]]; - v != null && (v == "serial" ? s[v] = parseInt(A[p]) : v == "x" || v == "y" || v === "z" ? s[v] = parseFloat(A[p]) : v == "charge" || v == "radius" ? o[v] = parseFloat(A[p]) : s[v] = A[p]), s.properties = o, s.bonds = [], s.bondOrder = []; - } - h[h.length - 1][l - c] = s; - } - y = c + S - 1; - } - if (b.assignBonds) - for (var a = 0; a < h.length; a++) - (0, n.assignBonds)(h[a]); - return h; - } - } - ), - /***/ - "./src/parsers/MMTF.ts": ( - /*!*****************************!*\ - !*** ./src/parsers/MMTF.ts ***! - \*****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MMTFparser: () => ( - /* binding */ - S - ) - /* harmony export */ - }); - var n = r( - /*! ../utilities */ - "./src/utilities.ts" - ), f = r( - /*! ../WebGL */ - "./src/WebGL/index.ts" - ), u = r( - /*! ./utils/computeSecondaryStructure */ - "./src/parsers/utils/computeSecondaryStructure.ts" - ), b = r( - /*! ./utils/processSymmetries */ - "./src/parsers/utils/processSymmetries.ts" - ), h = r( - /*! ./src/vendor/mmtf.js */ - "./src/vendor/mmtf.js" - ), _ = function(y) { - return String.fromCharCode.apply(null, y).replace(/\0/g, ""); - }, E = function(y) { - return y == 0 || y == 2 || y == 4 ? "h" : y == 3 ? "s" : "c"; - }; - let c = /* @__PURE__ */ new Set([ - "D-SACCHARIDE", - "D-SACCHARIDE 1,4 AND 1,4 LINKING", - "D-SACCHARIDE 1,4 AND 1,6 LINKING", - "L-SACCHARIDE", - "L-SACCHARIDE 1,4 AND 1,4 LINKING", - "L-SACCHARIDE 1,4 AND 1,6 LINKING", - "NON-POLYMER", - "OTHER", - "PEPTIDE-LIKE", - "SACCHARIDE" - ]); - function S(y, w) { - var L = !w.keepH, s = w.altLoc ? w.altLoc : "A", o = !!w.noSecondaryStructure, A = !w.noComputeSecondaryStructure, p = !w.doAssembly, v = w.assemblyIndex ? w.assemblyIndex : 0; - typeof y == "string" ? y = (0, n.base64ToArray)(y) : y = new Uint8Array(y); - var a = h.decode(y), l = [[]], g = l.modelData = [], M = 0, C = 0, T = 0, D = a.secStructList, I = a.bFactorList, B = a.altLocList, P = a.occupancyList, z = a.bondAtomList, k = a.bondOrderList, N = a.numModels; - if (N == 0) - return l; - w.multimodel || (N = 1); - var R, U, W, G, F, V, J = []; - if (!p && a.bioAssemblyList && a.bioAssemblyList.length > 0) { - var X = a.bioAssemblyList[v].transformList; - for (R = 0, V = X.length; R < V; R++) { - var oe = new f.Matrix4(X[R].matrix); - oe.transpose(), J.push(oe); - } - } - var te = null; - if (a.unitCell) { - var ve = a.unitCell; - te = { a: ve[0], b: ve[1], c: ve[2], alpha: ve[3], beta: ve[4], gamma: ve[5] }; - } - let se = []; - a.entityList.forEach((Me) => { - Me.chainIndexList.forEach((Q) => { - se[Q] = Me.type == "polymer"; - }); - }); - var le = 0; - for (F = 0; F < N; F++) { - var Ce = a.chainsPerModel[F], be = l[l.length - 1], Le = []; - for (g.push({ symmetries: J, cryst: te }), R = 0; R < Ce; ++R) { - var ae = a.groupsPerChain[M], _e = _(a.chainIdList.subarray(M * 4, M * 4 + 4)); - a.chainNameList && (_e = _(a.chainNameList.subarray(M * 4, M * 4 + 4))); - var Ee = C, Be = ""; - for (U = 0; U < ae; ++U) { - var Ne = a.groupList[a.groupTypeList[C]], Ge = Ne.atomNameList.length, ke = 0, pe = !1, de = !1; - if (D) { - ke = D[C]; - var ce = E(ke); - (C == 0 || ce != Be) && (pe = !0), Be = ce; - var Ae = C + 1; - (Ae >= D.length || E(D[Ae] != ce)) && (de = !0); - } - var Oe = a.groupIdList[C], We = Ne.groupName; - let Me = Ne.chemCompType; - var Ue = T; - let Q = c.has(Me) || !se[M]; - for (W = 0; W < Ge; ++W) { - var Z = Ne.elementList[W]; - if (L && Z == "H") { - T += 1; - continue; - } - var j = ""; - I && (j = I[T]); - var ee = ""; - B && B[T] && (ee = String.fromCharCode(B[T])); - var ge = ""; - if (P && (ge = P[T]), ee != "" && ee != s && s != "*") { - T += 1; - continue; - } - var ye = a.atomIdList[T], $e = Ne.atomNameList[W], Re = 0; - Ne.atomChargeList && (Re = Ne.atomChargeList[W]); - var Y = a.xCoordList[T], ue = a.yCoordList[T], Se = a.zCoordList[T]; - Le[T] = be.length, be.push({ - resn: We, - x: Y, - y: ue, - z: Se, - elem: Z, - hetflag: Q, - chain: _e, - resi: Oe, - icode: ee, - rescode: Oe + (ee != " " ? "^" + ee : ""), - // resi - // and - // icode - serial: ye, - altLoc: ee, - index: T, - atom: $e, - bonds: [], - ss: E(ke), - ssbegin: pe, - ssend: de, - bondOrder: [], - properties: { charge: Re, occupancy: ge }, - b: j - }), T += 1; - } - var Fe = Ne.bondAtomList; - for (W = 0, G = Ne.bondOrderList.length; W < G; ++W) { - var he = Ue + Fe[W * 2], De = Ue + Fe[W * 2 + 1], K = Ne.bondOrderList[W], ze = Le[he], Ve = Le[De], $ = be[ze], xe = be[Ve]; - $ && xe && ($.bonds.push(Ve), $.bondOrder.push(K), xe.bonds.push(ze), xe.bondOrder.push(K)); - } - C += 1; - } - for (C = Ee, U = 0; U < ae; ++U) - C += 1; - M += 1; - } - if (z) - for (let Me = le, Q = z.length; Me < Q; Me += 2) { - let fe = z[Me], Te = z[Me + 1], Ze = k ? k[Me / 2] : 1; - if (fe >= T) { - le = Me; - break; - } - let Ke = Le[fe], je = Le[Te], Je = be[Ke], St = be[je]; - Je && St && (Je.bonds.push(je), Je.bondOrder.push(Ze), St.bonds.push(Ke), St.bondOrder.push(Ze)); - } - w.multimodel && (w.onemol || l.push([])); - } - if (!p) - for (let Me = 0; Me < l.length; Me++) - (0, b.processSymmetries)(g[Me].symmetries, l[Me], w, g[Me].cryst); - return A && !o && (0, u.computeSecondaryStructure)(l, w.hbondCutoff), l; - } - } - ), - /***/ - "./src/parsers/MOL2.ts": ( - /*!*****************************!*\ - !*** ./src/parsers/MOL2.ts ***! - \*****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - MOL2: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - let n = { - "C.1": "C", - C1: "C", - "C.2": "C", - C2: "C", - "C.3": "C", - C3: "C", - "C.ar": "C", - Car: "C", - "C.cat": "C", - Ccat: "C", - "H.spc": "H", - Hspc: "H", - "H.t3p": "H", - Ht3p: "H", - "N.1": "N", - N1: "N", - "N.2": "N", - N2: "N", - "N.3": "N", - N3: "N", - "N.4": "N", - N4: "N", - "N.am": "N", - Nam: "N", - "N.ar": "N", - Nar: "N", - "N.p13": "N", - Np13: "N", - "O.2": "O", - O2: "O", - "O.3": "O", - O3: "O", - "O.co2": "O", - Oco2: "O", - "O.spc": "O", - Ospc: "O", - "O.t3p": "O", - Ot3p: "O", - "P.3": "P", - P3: "P", - "S.2": "S", - S2: "S", - "S.3": "S", - S3: "S", - "S.o": "S", - So: "S", - "S.o2": "S", - So2: "S" - }; - function f(u, b) { - var h = [[]], _ = !1; - typeof b.keepH < "u" && (_ = !b.keepH); - var E = u.search(/@MOLECULE/), c = u.search(/@ATOM/); - if (E == -1 || c == -1) - return h; - for (var S = u.substring(E).split(/\r?\n|\r/); S.length > 0; ) { - var y = [], w = S[2].replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), L = parseInt(w[0]), s = 0; - w.length > 1 && (s = parseInt(w[1])); - var o = 4, A; - for (A = 3; A < S.length; A++) - if (S[A] == "@ATOM") { - o = A + 1; - break; - } - var p = h[h.length - 1].length, v = p + L, a; - for (A = p; A < v; A++) { - a = S[o++], w = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - var l = {}, g = w[5]; - if (n[g] !== void 0 ? g = n[g] : (g = g.split(".")[0], g = g[0].toUpperCase() + g.substring(1).toLowerCase()), l.atom = w[1], l.elem = g, !(l.elem == "H" && _)) { - var M = h[h.length - 1].length, C = parseInt(w[0]); - l.serial = C, l.x = parseFloat(w[2]), l.y = parseFloat(w[3]), l.z = parseFloat(w[4]), l.atom = w[5]; - var T = parseFloat(w[8]); - l.index = M, l.bonds = [], l.bondOrder = [], l.properties = { - charge: T, - partialCharge: T - }, y[C] = M, h[h.length - 1].push(l); - } - } - for (var D = !1; o < S.length; ) - if (S[o++] == "@BOND") { - D = !0; - break; - } - if (D && s) - for (A = 0; A < s; A++) { - a = S[o++], w = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "); - var I = parseInt(w[1]), B = h[h.length - 1][y[I]], P = parseInt(w[2]), z = h[h.length - 1][y[P]], k = parseInt(w[3]); - isNaN(k) && (k = 1), B !== void 0 && z !== void 0 && (B.bonds.push(y[P]), B.bondOrder.push(k), z.bonds.push(y[I]), z.bondOrder.push(k)); - } - if (b.multimodel) { - b.onemol || h.push([]), S.splice(0, o), u = S.join(` -`); - continue; - } else - break; - } - return h; - } - } - ), - /***/ - "./src/parsers/PDB.ts": ( - /*!****************************!*\ - !*** ./src/parsers/PDB.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - PDB: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/getSinglePDB */ - "./src/parsers/utils/getSinglePDB.ts" - ); - function f(u, b) { - b = b || {}; - var h = [], _ = {}; - h.modelData = []; - for (var E = u.split(/\r?\n|\r/); E.length > 0; ) { - var c = (0, n.getSinglePDB)(E, b, _), S = c[0], y = c[1]; - if (E = c[2], S.length != 0) { - if (b.multimodel && b.onemol && h.length > 0) - for (var w = h[0].length, L = 0; L < S.length; L++) { - var s = S[L]; - s.index = L; - for (var o = 0; o < s.bonds.length; o++) - s.bonds[o] += w; - h[0].push(s); - } - else - h.modelData.push(y), h.push(S); - if (!b.multimodel) - break; - } - } - return h; - } - } - ), - /***/ - "./src/parsers/PQR.ts": ( - /*!****************************!*\ - !*** ./src/parsers/PQR.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - PQR: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ./utils/assignPDBBonds */ - "./src/parsers/utils/assignPDBBonds.ts" - ), f = r( - /*! ./utils/computeSecondaryStructure */ - "./src/parsers/utils/computeSecondaryStructure.ts" - ); - function u(b, h) { - var _ = [[]], E = !h.noSecondaryStructure; - _.modelData = [{ symmetries: [] }]; - var c = [], S = b.split(/\r?\n|\r/), y; - for (let D = 0; D < S.length; D++) { - y = S[D].replace(/^\s*/, ""); - var w = y.substring(0, 6); - if (w.indexOf("END") == 0) - if (h.multimodel) { - h.onemol || _.push([]); - continue; - } else - break; - else if (w == "ATOM " || w == "HETATM") { - var L; - let I = parseInt(y.substring(6, 11)), B = y.substring(12, 16).replace(/ /g, ""), P = y.substring(17, 20).trim(), z = y.substring(21, 22), k = parseInt(y.substring(22, 26)); - var s = y.substring(30).trim().split(/\s+/), o = parseFloat(s[0]), A = parseFloat(s[1]), p = parseFloat(s[2]), v = parseFloat(s[3]), a = parseFloat(s[4]), l = B[0]; - B.length > 1 && B[1].toUpperCase() != B[1] && (l = B.substring(0, 2)), y[0] == "H" ? L = !0 : L = !1, c[I] = _[_.length - 1].length, _[_.length - 1].push({ - resn: P, - x: o, - y: A, - z: p, - elem: l, - hetflag: L, - chain: z, - resi: k, - serial: I, - atom: B, - bonds: [], - ss: "c", - bondOrder: [], - properties: { - charge: v, - partialCharge: v, - radius: a - }, - pdbline: y - }); - } else if (w == "CONECT") { - var g = parseInt(y.substring(6, 11)), M = _[_.length - 1][c[g]]; - for (let I = 0; I < 4; I++) { - var C = parseInt(y.substring([11, 16, 21, 26][I], [11, 16, 21, 26][I] + 5)), T = _[_.length - 1][c[C]]; - M !== void 0 && T !== void 0 && (M.bonds.push(c[C]), M.bondOrder.push(1)); - } - } - } - for (let D = 0; D < _.length; D++) - (0, n.assignPDBBonds)(_[D]), E && (0, f.computeSecondaryStructure)(_[D], h.hbondCutoff); - return _; - } - } - ), - /***/ - "./src/parsers/PRMTOP.ts": ( - /*!*******************************!*\ - !*** ./src/parsers/PRMTOP.ts ***! - \*******************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - PRMTOP: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f) { - var u = [], b, h = 0, _ = f.split(/\r?\n|\r/); - if (_.length > 0 && _[0].includes("VERSION")) { - var E = _.filter(function(o) { - return o.includes("POINTERS") || o.includes("ATOM_NAME") || o.includes("CHARGE") || o.includes("RADII") || o.includes("BONDS_INC_HYDROGEN") || o.includes("BONDS_WITHOUT_HYDROGEN"); - }), c = L("POINTERS"); - if (c == -1) - return []; - var S = s(c), y = parseInt(_[c + 1].slice(0, S[1])); - if (isNaN(y) || y <= 0) - return []; - if (c = L("ATOM_NAME"), c == -1) - return []; - S = s(c); - var w = S[0]; - for (let o = 0; o < y / S[0]; o++) { - o == parseInt(y / S[0]) && (w = y % S[0]); - for (let A = 0; A < w; A++) { - let p = {}, v = { charge: "", radii: "" }; - p.serial = h, p.x = 0, p.y = 0, p.z = 0, p.atom = _[c + 1].slice(S[1] * A, S[1] * (A + 1)), p.elem = _[c + 1].slice(S[1] * A, S[1] * A + 1), p.properties = v, p.bonds = [], p.bondOrder = [], u.push(p), h++; - } - c++; - } - if (c = L("CHARGE"), c != -1) { - S = s(c), h = 0, w = S[0]; - for (let o = 0; o < y / S[0]; o++) { - o == parseInt(y / S[0]) && (w = y % S[0]); - for (let A = 0; A < w; A++) - u[h].properties.charge = parseFloat(_[c + 1].slice(S[1] * A, S[1] * (A + 1))), h++; - c++; - } - } - if (c = L("RADII"), c != -1) { - S = s(c), h = 0, w = S[0]; - for (let o = 0; o < y / S[0]; o++) { - o == parseInt(y / S[0]) && (w = y % S[0]); - for (let A = 0; A < w; A++) - u[h].properties.radii = parseFloat(_[c + 1].slice(S[1] * A, S[1] * (A + 1))), h++; - c++; - } - } - if (c = L("BONDS_WITHOUT_HYDROGEN"), c != -1) - for (S = s(c), h = 0, w = S[0], c = c + 1; !_[c].match(/^%FLAG/); ) { - _[c + 1].match(/^%FLAG/) && (w = y % S[0]); - for (let o = 0; o < w; o++) - h % 3 == 0 ? b = parseInt(_[c].slice(S[1] * o, S[1] * (o + 1)) / 3) : h % 3 == 1 && u[b].bonds.push(parseInt(_[c].slice(S[1] * o, S[1] * (o + 1)) / 3)), h++; - c++; - } - if (c = L("BONDS_INC_HYDROGEN"), c != -1) - for (S = s(c), h = 0, w = S[0], c = c + 1; !_[c].match(/^%FLAG/); ) { - _[c + 1].match(/^%FLAG/) && (w = y % S[0]); - for (let o = 0; o < w; o++) - h % 3 == 0 ? b = parseInt(_[c].slice(S[1] * o, S[1] * (o + 1)) / 3) : h % 3 == 1 && u[b].bonds.push(parseInt(_[c].slice(S[1] * o, S[1] * (o + 1)) / 3)), h++; - c++; - } - } else - return []; - function L(o) { - var A = _.indexOf(E.filter(function(p) { - return p.includes(o); - })[0]); - if (Number.isInteger(A) && A > 0) { - for (; !_[A].includes("FORMAT"); ) - A++; - return A; - } else - return -1; - } - function s(o) { - var A = _[o].match(/\((\d*)\S*/), p = _[o].match(/[a-zA-Z](\d*)\)\s*/); - return p == null && (p = _[o].match(/[a-zA-Z](\d*)\.\d*\)\s*/)), [A[1], p[1]]; - } - return [u]; - } - } - ), - /***/ - "./src/parsers/SDF.ts": ( - /*!****************************!*\ - !*** ./src/parsers/SDF.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - SDF: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = function(b, h) { - var _ = [[]], E = !1; - for (typeof h.keepH < "u" && (E = !h.keepH); b.length > 0 && !(b.length < 4); ) { - var c = parseInt(b[3].substring(0, 3)); - if (isNaN(c) || c <= 0) - break; - var S = parseInt(b[3].substring(3, 6)), y = 4; - if (b.length < 4 + c + S) - break; - var w = [], L = _[_.length - 1].length, s = L + c, o, A; - for (o = L; o < s; o++, y++) { - A = b[y]; - var p = {}, v = A.substring(31, 34).replace(/ /g, ""); - p.atom = p.elem = v[0].toUpperCase() + v.substring(1).toLowerCase(), (p.elem !== "H" || !E) && (p.serial = o, w[o] = _[_.length - 1].length, p.x = parseFloat(A.substring(0, 10)), p.y = parseFloat(A.substring(10, 20)), p.z = parseFloat(A.substring(20, 30)), p.hetflag = !0, p.bonds = [], p.bondOrder = [], p.properties = {}, p.index = _[_.length - 1].length, _[_.length - 1].push(p)); - } - for (o = 0; o < S; o++, y++) { - A = b[y]; - var a = w[parseInt(A.substring(0, 3)) - 1 + L], l = w[parseInt(A.substring(3, 6)) - 1 + L], g = parseFloat(A.substring(6)); - typeof a < "u" && typeof l < "u" && (_[_.length - 1][a].bonds.push(l), _[_.length - 1][a].bondOrder.push(g), _[_.length - 1][l].bonds.push(a), _[_.length - 1][l].bondOrder.push(g)); - } - if (h.multimodel) { - for (h.onemol || _.push([]); b[y] !== "$$$$" && y < b.length; ) - y++; - b.splice(0, ++y); - } else - break; - } - return _; - }, f = function(b, h) { - var _ = [[]], E = !1; - for (typeof h.keepH < "u" && (E = !h.keepH); b.length > 0 && !(b.length < 8 || !b[4].startsWith("M V30 BEGIN CTAB") || !b[5].startsWith("M V30 COUNTS") || b[5].length < 14); ) { - var c = b[5].substring(13).match(/\S+/g); - if (c.length < 2) - break; - var S = parseInt(c[0]); - if (isNaN(S) || S <= 0) - break; - var y = parseInt(c[1]), w = 7; - if (b.length < 8 + S + y) - break; - var L = [], s = _[_.length - 1].length, o = s + S, A, p; - for (A = s; A < o; A++, w++) { - p = b[w]; - var v = p.substring(6).match(/\S+/g); - if (v.length > 4) { - var a = {}, l = v[1].replace(/ /g, ""); - a.atom = a.elem = l[0].toUpperCase() + l.substring(1).toLowerCase(), (a.elem !== "H" || !E) && (a.serial = A, L[A] = _[_.length - 1].length, a.x = parseFloat(v[2]), a.y = parseFloat(v[3]), a.z = parseFloat(v[4]), a.hetflag = !0, a.bonds = [], a.bondOrder = [], a.properties = {}, a.index = _[_.length - 1].length, _[_.length - 1].push(a)); - } - } - if (b[w] === "M V30 END ATOM") - w++; - else - break; - if (y !== 0 && b[w] === "M V30 BEGIN BOND") - w++; - else - break; - for (A = 0; A < y; A++, w++) { - p = b[w]; - var g = p.substring(6).match(/\S+/g); - if (g.length > 3) { - var M = L[parseInt(g[2]) - 1 + s], C = L[parseInt(g[3]) - 1 + s], T = parseFloat(g[1]); - typeof M < "u" && typeof C < "u" && (_[_.length - 1][M].bonds.push(C), _[_.length - 1][M].bondOrder.push(T), _[_.length - 1][C].bonds.push(M), _[_.length - 1][C].bondOrder.push(T)); - } - } - if (h.multimodel) { - for (h.onemol || _.push([]); b[w] !== "$$$$" && w < b.length; ) - w++; - b.splice(0, ++w); - } else - break; - } - return _; - }; - function u(b, h) { - var _ = "V2000", E = b.split(/\r?\n|\r/); - return E.length > 3 && E[3].length > 38 && (_ = E[3].substring(34, 39)), _ === "V2000" ? n(E, h) : _ === "V3000" ? f(E, h) : [[""]]; - } - } - ), - /***/ - "./src/parsers/VASP.ts": ( - /*!*****************************!*\ - !*** ./src/parsers/VASP.ts ***! - \*****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - VASP: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../WebGL */ - "./src/WebGL/index.ts" - ); - function f(u) { - var b = [[]], h = {}, _ = u.replace(/^\s+/, "").split(/\r?\n/); - if (_.length < 3) - return b; - if (_[1].match(/\d+/)) - h.length = parseFloat(_[1]); - else - return console.log("Warning: second line of the vasp structure file must be a number"), b; - if (h.length < 0) - return console.log("Warning: Vasp implementation for negative lattice lengths is not yet available"), b; - h.xVec = new Float32Array(_[2].replace(/^\s+/, "").split(/\s+/)), h.yVec = new Float32Array(_[3].replace(/^\s+/, "").split(/\s+/)), h.zVec = new Float32Array(_[4].replace(/^\s+/, "").split(/\s+/)); - var E = new n.Matrix3(h.xVec[0], h.xVec[1], h.xVec[2], h.yVec[0], h.yVec[1], h.yVec[2], h.zVec[0], h.zVec[1], h.zVec[2]); - E.multiplyScalar(h.length), b.modelData = [{ symmetries: [], cryst: { matrix: E } }]; - var c = _[5].replace(/\s+/, "").replace(/\s+$/, "").split(/\s+/), S = new Int16Array(_[6].replace(/^\s+/, "").split(/\s+/)), y = _[7].replace(/\s+/, ""); - if (y.match(/C/)) - y = "cartesian"; - else if (y.match(/D/)) - y = "direct"; - else - return console.log("Warning: Unknown vasp mode in POSCAR file: mode must be either C(artesian) or D(irect)"), b; - if (c.length != S.length) - return console.log("Warning: declaration of atomary species wrong:"), console.log(c), console.log(S), b; - _.splice(0, 8); - for (var w = 0, L = 0, s = c.length; L < s; L++) { - for (var o = c[L], A = 0, p = S[L]; A < p; A++) { - var v = new Float32Array(_[w + A].replace(/^\s+/, "").split(/\s+/)), a = {}; - a.elem = o, y == "cartesian" ? (a.x = h.length * v[0], a.y = h.length * v[1], a.z = h.length * v[2]) : (a.x = h.length * (v[0] * h.xVec[0] + v[1] * h.yVec[0] + v[2] * h.zVec[0]), a.y = h.length * (v[0] * h.xVec[1] + v[1] * h.yVec[1] + v[2] * h.zVec[1]), a.z = h.length * (v[0] * h.xVec[2] + v[1] * h.yVec[2] + v[2] * h.zVec[2])), a.bonds = [], b[0].push(a); - } - w += S[L]; - } - return b; - } - } - ), - /***/ - "./src/parsers/XYZ.ts": ( - /*!****************************!*\ - !*** ./src/parsers/XYZ.ts ***! - \****************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - XYZ: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - var n = r( - /*! ../WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./utils/assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ); - function u(b, h) { - h = h || {}; - for (var _ = [[]], E = h.assignBonds === void 0 ? !0 : h.assignBonds, c = b.split(/\r?\n|\r/); c.length > 0 && !(c.length < 3); ) { - var S = parseInt(c[0]); - if (isNaN(S) || S <= 0 || c.length < S + 2) - break; - var y = /Lattice\s*=\s*["\{\}]([^"\{\}]+)["\{\}]\s*/gi, w = y.exec(c[1]); - if (w != null && w.length > 1) { - var L = new Float32Array(w[1].split(/\s+/)), s = new n.Matrix3(L[0], L[3], L[6], L[1], L[4], L[7], L[2], L[5], L[8]); - _.modelData = [{ cryst: { matrix: s } }]; - } - for (var o = 2, A = _[_.length - 1].length, p = A + S, v = A; v < p; v++) { - var a = c[o++], l = a.replace(/^\s+/, "").replace(/\s+/g, " ").split(" "), g = {}; - g.serial = v; - var M = l[0]; - g.atom = g.elem = M[0].toUpperCase() + M.substring(1, 2).toLowerCase(), g.x = parseFloat(l[1]), g.y = parseFloat(l[2]), g.z = parseFloat(l[3]), g.hetflag = !0, g.bonds = [], g.bondOrder = [], g.properties = {}, _[_.length - 1][v] = g, l.length >= 7 && (g.dx = parseFloat(l[4]), g.dy = parseFloat(l[5]), g.dz = parseFloat(l[6])); - } - if (h.multimodel) - _.push([]), c.splice(0, o); - else - break; - } - if (E) - for (let T = 0; T < _.length; T++) - (0, f.assignBonds)(_[T]); - if (h.onemol) { - var C = _; - _ = [], _.push(C[0]); - for (let T = 1; T < C.length; T++) { - let D = _[0].length; - for (let I = 0; I < C[T].length; I++) { - let B = C[T][I]; - for (let P = 0; P < B.bonds.length; P++) - B.bonds[P] = B.bonds[P] + D; - B.index = _[0].length, B.serial = _[0].length, _[0].push(B); - } - } - } - return _; - } - } - ), - /***/ - "./src/parsers/index.ts": ( - /*!******************************!*\ - !*** ./src/parsers/index.ts ***! - \******************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Parsers: () => ( - /* binding */ - A - ), - /* harmony export */ - bondLength: () => ( - /* reexport safe */ - o.bondLength - ), - /* harmony export */ - setBondLength: () => ( - /* reexport safe */ - o.setBondLength - ) - /* harmony export */ - }); - var n = r( - /*! ./VASP */ - "./src/parsers/VASP.ts" - ), f = r( - /*! ./CUBE */ - "./src/parsers/CUBE.ts" - ), u = r( - /*! ./XYZ */ - "./src/parsers/XYZ.ts" - ), b = r( - /*! ./SDF */ - "./src/parsers/SDF.ts" - ), h = r( - /*! ./CDJSON */ - "./src/parsers/CDJSON.ts" - ), _ = r( - /*! ./CIF */ - "./src/parsers/CIF.ts" - ), E = r( - /*! ./MOL2 */ - "./src/parsers/MOL2.ts" - ), c = r( - /*! ./PDB */ - "./src/parsers/PDB.ts" - ), S = r( - /*! ./PQR */ - "./src/parsers/PQR.ts" - ), y = r( - /*! ./MMTF */ - "./src/parsers/MMTF.ts" - ), w = r( - /*! ./PRMTOP */ - "./src/parsers/PRMTOP.ts" - ), L = r( - /*! ./GRO */ - "./src/parsers/GRO.ts" - ), s = r( - /*! ./LAMMPSTRJ */ - "./src/parsers/LAMMPSTRJ.ts" - ), o = r( - /*! ./utils/bondLength */ - "./src/parsers/utils/bondLength.ts" - ); - const A = { - vasp: n.VASP, - VASP: n.VASP, - cube: f.CUBE, - CUBE: f.CUBE, - xyz: u.XYZ, - XYZ: u.XYZ, - sdf: b.SDF, - SDF: b.SDF, - json: h.CDJSON, - cdjson: h.CDJSON, - CDJSON: h.CDJSON, - mcif: _.CIF, - cif: _.CIF, - CIF: _.CIF, - mol2: E.MOL2, - MOL2: E.MOL2, - pdb: c.PDB, - PDB: c.PDB, - pdbqt: c.PDB, - PDBQT: c.PDB, - pqr: S.PQR, - PQR: S.PQR, - mmtf: y.MMTFparser, - MMTF: y.MMTFparser, - prmtop: w.PRMTOP, - PRMTOP: w.PRMTOP, - gro: L.GRO, - GRO: L.GRO, - lammpstrj: s.LAMMPSTRJ, - LAMMPSTRJ: s.LAMMPSTRJ - }; - } - ), - /***/ - "./src/parsers/utils/anumToSymbol.ts": ( - /*!*******************************************!*\ - !*** ./src/parsers/utils/anumToSymbol.ts ***! - \*******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - anumToSymbol: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = { - 1: "H", - 2: "He", - 3: "Li", - 4: "Be", - 5: "B", - 6: "C", - 7: "N", - 8: "O", - 9: "F", - 10: "Ne", - 11: "Na", - 12: "Mg", - 13: "Al", - 14: "Si", - 15: "P", - 16: "S", - 17: "Cl", - 18: "Ar", - 19: "K", - 20: "Ca", - 21: "Sc", - 22: "Ti", - 23: "V", - 24: "Cr", - 25: "Mn", - 26: "Fe", - 27: "Co", - 28: "Ni", - 29: "Cu", - 30: "Zn", - 31: "Ga", - 32: "Ge", - 33: "As", - 34: "Se", - 35: "Br", - 36: "Kr", - 37: "Rb", - 38: "Sr", - 39: "Y", - 40: "Zr", - 41: "Nb", - 42: "Mo", - 43: "Tc", - 44: "Ru", - 45: "Rh", - 46: "Pd", - 47: "Ag", - 48: "Cd", - 49: "In", - 50: "Sn", - 51: "Sb", - 52: "Te", - 53: "I", - 54: "Xe", - 55: "Cs", - 56: "Ba", - 71: "Lu", - 72: "Hf", - 73: "Ta", - 74: "W", - 75: "Re", - 76: "Os", - 77: "Ir", - 78: "Pt", - 79: "Au", - 80: "Hg", - 81: "Tl", - 82: "Pb", - 83: "Bi", - 84: "Po", - 85: "At", - 86: "Rn", - 87: "Fr", - 88: "Ra", - 104: "Rf", - 105: "Db", - 106: "Sg", - 107: "Bh", - 108: "Hs", - 109: "Mt", - 110: "Ds", - 111: "Rg", - 112: "Cn", - 113: "Nh", - 114: "Fl", - 115: "Mc", - 116: "Lv", - 117: "Ts", - 118: "Og", - 57: "La", - 58: "Ce", - 59: "Pr", - 60: "Nd", - 61: "Pm", - 62: "Sm", - 63: "Eu", - 64: "Gd", - 65: "Tb", - 66: "Dy", - 67: "Ho", - 68: "Er", - 69: "Tm", - 70: "Yb", - 89: "Ac", - 90: "Th", - 91: "Pa", - 92: "U", - 93: "Np", - 94: "Pu", - 95: "Am", - 96: "Cm", - 97: "Bk", - 98: "Cf", - 99: "Es", - 100: "Fm", - 101: "Md", - 102: "No" - }; - } - ), - /***/ - "./src/parsers/utils/areConnected.ts": ( - /*!*******************************************!*\ - !*** ./src/parsers/utils/areConnected.ts ***! - \*******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - areConnected: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./bondLength */ - "./src/parsers/utils/bondLength.ts" - ); - function f(u, b) { - var h = (0, n.bondLength)(u.elem) + (0, n.bondLength)(b.elem); - h += 0.25, h *= h; - var _ = u.x - b.x; - if (_ *= _, _ > h) - return !1; - var E = u.y - b.y; - if (E *= E, E > h) - return !1; - var c = u.z - b.z; - if (c *= c, c > h) - return !1; - var S = _ + E + c; - return isNaN(S) || S < 0.5 || S > h ? !1 : !(u.altLoc != b.altLoc && u.altLoc != " " && b.altLoc != " "); - } - } - ), - /***/ - "./src/parsers/utils/assignBackboneHBonds.ts": ( - /*!***************************************************!*\ - !*** ./src/parsers/utils/assignBackboneHBonds.ts ***! - \***************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - assignBackboneHBonds: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f, u) { - let b = u || 3.2, h = b * b, _ = []; - for (let o = 0, A = f.length; o < A; o++) { - f[o].index = o; - var E = f[o]; - !E.hetflag && (E.atom === "N" || E.atom === "O") && (_.push(E), E.hbondOther = null, E.hbondDistanceSq = Number.POSITIVE_INFINITY); - } - _.sort(function(o, A) { - return o.z - A.z; - }); - for (let o = 0, A = _.length; o < A; o++) { - var c = _[o]; - for (let p = o + 1; p < A; p++) { - var S = _[p], y = S.z - c.z; - if (y > b) - break; - if (S.atom != c.atom) { - var w = Math.abs(S.y - c.y); - if (!(w > b)) { - var L = Math.abs(S.x - c.x); - if (!(L > b)) { - var s = L * L + w * w + y * y; - s > h || S.chain == c.chain && Math.abs(S.resi - c.resi) < 4 || (s < c.hbondDistanceSq && (c.hbondOther = S, c.hbondDistanceSq = s), s < S.hbondDistanceSq && (S.hbondOther = c, S.hbondDistanceSq = s)); - } - } - } - } - } - } - } - ), - /***/ - "./src/parsers/utils/assignBonds.ts": ( - /*!******************************************!*\ - !*** ./src/parsers/utils/assignBonds.ts ***! - \******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - assignBonds: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./areConnected */ - "./src/parsers/utils/areConnected.ts" - ); - function f(u) { - for (var b = 0, h = u.length; b < h; b++) - u[b].index || (u[b].index = b); - for (var _ = {}, E = 4.95, c = 0; c < u.length; c++) { - var S = u[c], y = Math.floor(S.x / E), w = Math.floor(S.y / E), L = Math.floor(S.z / E); - _[y] || (_[y] = {}), _[y][w] || (_[y][w] = {}), _[y][w][L] || (_[y][w][L] = []), _[y][w][L].push(S); - } - var s = function(A, p) { - for (var v = 0; v < A.length; v++) - for (var a = A[v], l = 0; l < p.length; l++) { - var g = p[l]; - if ((0, n.areConnected)(a, g)) { - var M = a.bonds.indexOf(g.index), C = g.bonds.indexOf(a.index); - M == -1 && C == -1 ? (a.bonds.push(g.index), a.bondOrder.push(1), g.bonds.push(a.index), g.bondOrder.push(1)) : M == -1 ? (a.bonds.push(g.index), a.bondOrder.push(g.bondOrder[C])) : C == -1 && (g.bonds.push(a.index), g.bondOrder.push(a.bondOrder[M])); - } - } - }, o = [ - { x: 0, y: 0, z: 1 }, - { x: 0, y: 1, z: -1 }, - { x: 0, y: 1, z: 0 }, - { x: 0, y: 1, z: 1 }, - { x: 1, y: -1, z: -1 }, - { x: 1, y: -1, z: 0 }, - { x: 1, y: -1, z: 1 }, - { x: 1, y: 0, z: -1 }, - { x: 1, y: 0, z: 0 }, - { x: 1, y: 0, z: 1 }, - { x: 1, y: 1, z: -1 }, - { x: 1, y: 1, z: 0 }, - { x: 1, y: 1, z: 1 } - ]; - for (let A in _) { - let p = parseInt(A); - for (let v in _[p]) { - let a = parseInt(v); - for (let l in _[p][a]) { - let g = parseInt(l), M = _[p][a][g]; - for (let C = 0; C < M.length; C++) { - let T = M[C]; - for (let D = C + 1; D < M.length; D++) { - let I = M[D]; - (0, n.areConnected)(T, I) && T.bonds.indexOf(I.index) == -1 && (T.bonds.push(I.index), T.bondOrder.push(1), I.bonds.push(T.index), I.bondOrder.push(1)); - } - } - for (let C = 0; C < o.length; C++) { - let T = o[C]; - if (!_[p + T.x] || !_[p + T.x][a + T.y] || !_[p + T.x][a + T.y][g + T.z]) - continue; - let D = _[p + T.x][a + T.y][g + T.z]; - s(M, D); - } - } - } - } - } - } - ), - /***/ - "./src/parsers/utils/assignPDBBonds.ts": ( - /*!*********************************************!*\ - !*** ./src/parsers/utils/assignPDBBonds.ts ***! - \*********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - assignPDBBonds: () => ( - /* binding */ - b - ) - /* harmony export */ - }); - var n = r( - /*! ./areConnected */ - "./src/parsers/utils/areConnected.ts" - ), f = r( - /*! ./assignBonds */ - "./src/parsers/utils/assignBonds.ts" - ), u = r( - /*! ./standardResidues */ - "./src/parsers/utils/standardResidues.ts" - ); - function b(h) { - var _ = [], E = [], c, S; - for (c = 0, S = h.length; c < S; c++) { - var y = h[c]; - y.index = c, y.hetflag || !u.standardResidues.has(y.resn) ? E.push(y) : _.push(y); - } - (0, f.assignBonds)(E), _.sort(function(v, a) { - return v.chain != a.chain ? v.chain < a.chain ? -1 : 1 : v.resi - a.resi; - }); - var w = -1, L = -1, s; - for (c = 0, S = _.length; c < S; c++) { - var o = _[c]; - o.resi !== w && (w = o.resi, s || L++, s = !1), o.reschain = L; - for (var A = c + 1; A < _.length; A++) { - var p = _[A]; - if (p.chain != o.chain || p.resi - o.resi > 1) - break; - (0, n.areConnected)(o, p) && (o.bonds.indexOf(p.index) === -1 && (o.bonds.push(p.index), o.bondOrder.push(1), p.bonds.push(o.index), p.bondOrder.push(1)), o.resi !== p.resi && (s = !0)); - } - } - } - } - ), - /***/ - "./src/parsers/utils/atomNameToElem.ts": ( - /*!*********************************************!*\ - !*** ./src/parsers/utils/atomNameToElem.ts ***! - \*********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - atomNameToElem: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./bondLength */ - "./src/parsers/utils/bondLength.ts" - ); - function f(u, b) { - var h = u.replace(/ /g, ""); - return h.length > 0 && h[0] == "H" && h != "Hg" && h != "He" && h != "Hf" && h != "Hs" && h != "Ho" && (h = "H"), h.length > 1 && (h = h[0].toUpperCase() + h.substring(1).toLowerCase(), typeof n.bondTable[h] > "u" ? h = h[0] : b && (h == "Ca" || h == "Cd") && (h = "C")), h; - } - } - ), - /***/ - "./src/parsers/utils/bondLength.ts": ( - /*!*****************************************!*\ - !*** ./src/parsers/utils/bondLength.ts ***! - \*****************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - bondLength: () => ( - /* binding */ - f - ), - /* harmony export */ - bondTable: () => ( - /* binding */ - n - ), - /* harmony export */ - setBondLength: () => ( - /* binding */ - u - ) - /* harmony export */ - }); - let n = { - H: 0.37, - He: 0.32, - Li: 1.34, - Be: 0.9, - B: 0.82, - C: 0.77, - N: 0.75, - O: 0.73, - F: 0.71, - Ne: 0.69, - Na: 1.54, - Mg: 1.3, - Al: 1.18, - Si: 1.11, - P: 1.06, - S: 1.02, - Cl: 0.99, - Ar: 0.97, - K: 1.96, - Ca: 1.74, - Sc: 1.44, - Ti: 1.56, - V: 1.25, - /* Cr */ - Mn: 1.39, - Fe: 1.25, - Co: 1.26, - Ni: 1.21, - Cu: 1.38, - Zn: 1.31, - Ga: 1.26, - Ge: 1.22, - /* As */ - Se: 1.16, - Br: 1.14, - Kr: 1.1, - Rb: 2.11, - Sr: 1.92, - Y: 1.62, - Zr: 1.48, - Nb: 1.37, - Mo: 1.45, - Tc: 1.56, - Ru: 1.26, - Rh: 1.35, - Pd: 1.31, - Ag: 1.53, - Cd: 1.48, - In: 1.44, - Sn: 1.41, - Sb: 1.38, - Te: 1.35, - I: 1.33, - Xe: 1.3, - Cs: 2.25, - Ba: 1.98, - Lu: 1.6, - Hf: 1.5, - Ta: 1.38, - W: 1.46, - Re: 1.59, - Os: 1.44, - Ir: 1.37, - Pt: 1.28, - Au: 1.44, - Hg: 1.49, - Tl: 1.48, - Pb: 1.47, - Bi: 1.46, - /* Po */ - /* At */ - Rn: 1.45 - // None of the bottom row or any of the Lanthanides have bond lengths - }; - function f(b) { - return n[b] || 1.6; - } - function u(b, h) { - h < 0 && (h = 0), n[b] = h; - } - } - ), - /***/ - "./src/parsers/utils/computeSecondaryStructure.ts": ( - /*!********************************************************!*\ - !*** ./src/parsers/utils/computeSecondaryStructure.ts ***! - \********************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - computeSecondaryStructure: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ./assignBackboneHBonds */ - "./src/parsers/utils/assignBackboneHBonds.ts" - ); - function f(u, b) { - (0, n.assignBackboneHBonds)(u, b); - var h = {}, _, E, c, S, y, w; - for (_ = 0, E = u.length; _ < E; _++) - if (y = u[_], typeof h[y.chain] > "u" && (h[y.chain] = []), isFinite(y.hbondDistanceSq)) { - var L = y.hbondOther; - typeof h[L.chain] > "u" && (h[L.chain] = []), Math.abs(L.resi - y.resi) === 4 && (h[y.chain][y.resi] = "h"); - } - for (c in h) - for (S = 1; S < h[c].length - 1; S++) { - var s = h[c][S - 1], o = h[c][S + 1]; - w = h[c][S], s == "h" && s == o && w != s && (h[c][S] = s); - } - for (_ = 0, E = u.length; _ < E; _++) - y = u[_], isFinite(y.hbondDistanceSq) && h[y.chain][y.resi] != "h" && y.ss != "h" && (h[y.chain][y.resi] = "maybesheet"); - for (let A = 0, p = u.length; A < p; A++) - if (y = u[A], isFinite(y.hbondDistanceSq) && h[y.chain][y.resi] == "maybesheet") { - let v = y.hbondOther, a = h[v.chain][v.resi]; - (a == "maybesheet" || a == "s") && (h[y.chain][y.resi] = "s", h[v.chain][v.resi] = "s"); - } - for (let A in h) { - for (let p = 1; p < h[A].length - 1; p++) { - let v = h[A][p - 1], a = h[A][p + 1]; - w = h[A][p], v == "s" && v == a && w != v && (h[A][p] = v); - } - for (let p = 0; p < h[A].length; p++) { - let v = h[A][p]; - (v == "h" || v == "s") && h[A][p - 1] != v && h[A][p + 1] != v && delete h[A][p]; - } - } - for (_ = 0, E = u.length; _ < E; _++) - y = u[_], w = h[y.chain][y.resi], delete y.hbondOther, delete y.hbondDistanceSq, !(typeof w > "u" || w == "maybesheet") && (y.ss = w, h[y.chain][y.resi - 1] != w && (y.ssbegin = !0), h[y.chain][y.resi + 1] != w && (y.ssend = !0)); - } - } - ), - /***/ - "./src/parsers/utils/getSinglePDB.ts": ( - /*!*******************************************!*\ - !*** ./src/parsers/utils/getSinglePDB.ts ***! - \*******************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - getSinglePDB: () => ( - /* binding */ - S - ) - /* harmony export */ - }); - var n = r( - /*! ../../WebGL */ - "./src/WebGL/index.ts" - ), f = r( - /*! ./atomNameToElem */ - "./src/parsers/utils/atomNameToElem.ts" - ), u = r( - /*! ./bondLength */ - "./src/parsers/utils/bondLength.ts" - ), b = r( - /*! ./computeSecondaryStructure */ - "./src/parsers/utils/computeSecondaryStructure.ts" - ), h = r( - /*! ./isEmpty */ - "./src/parsers/utils/isEmpty.ts" - ), _ = r( - /*! ./processSymmetries */ - "./src/parsers/utils/processSymmetries.ts" - ), E = r( - /*! ./assignPDBBonds */ - "./src/parsers/utils/assignPDBBonds.ts" - ), c = r( - /*! ./validateBonds */ - "./src/parsers/utils/validateBonds.ts" - ); - function S(y, w, L) { - var s = [], o = w.assignBonds === void 0 ? !0 : w.assignBonds, A = !w.keepH, p = !!w.noSecondaryStructure, v = !w.noComputeSecondaryStructure, a = !w.doAssembly, l = w.altLoc ? w.altLoc : "A", g = { symmetries: [] }, M, C = [], T = [], D, I = {}; - for (let We = 0; We < y.length; We++) { - D = y[We].replace(/^\s*/, ""); - var B = D.substring(0, 6), P, z, k; - if (B.indexOf("END") == 0) { - if (C = y.slice(We + 1), B == "END") - for (var N in L) - L.hasOwnProperty(N) && delete L[N]; - break; - } else if (B == "ATOM " || B == "HETATM") { - var R, U, W, G, F, V, J, X, oe, te, ve, se; - if (ve = D.substring(16, 17), ve != " " && ve != l && l != "*" || (te = parseInt(D.substring(6, 11)), M = D.substring(12, 16).replace(/ /g, ""), R = D.substring(17, 20).replace(/ /g, ""), U = D.substring(21, 22), W = parseInt(D.substring(22, 26)), G = D.substring(26, 27), F = parseFloat(D.substring(30, 38)), V = parseFloat(D.substring(38, 46)), J = parseFloat(D.substring(46, 54)), se = parseFloat(D.substring(60, 68)), oe = D.substring(76, 78).replace(/ /g, ""), oe === "" || typeof u.bondTable[oe] > "u" ? oe = (0, f.atomNameToElem)(D.substring(12, 14), D[0] == "A") : oe = oe[0].toUpperCase() + oe.substring(1).toLowerCase(), oe == "H" && A)) - continue; - B[0] == "H" ? X = !0 : X = !1, T[te] = s.length, s.push({ - resn: R, - x: F, - y: V, - z: J, - elem: oe, - hetflag: X, - altLoc: ve, - chain: U, - resi: W, - icode: G, - rescode: W + (G != " " ? "^" + G : ""), - // resi - // and - // icode - serial: te, - atom: M, - bonds: [], - ss: "c", - bondOrder: [], - properties: {}, - b: se, - pdbline: D - }); - } else if (B == "SHEET ") { - P = D.substring(21, 22), z = parseInt(D.substring(22, 26)), k = parseInt(D.substring(33, 37)), P in L || (L[P] = {}), L[P][z] = "s1"; - for (var le = z + 1; le < k; le++) - L[P][le] = "s"; - L[P][k] = "s2"; - } else if (B == "CONECT") { - var Ce = parseInt(D.substring(6, 11)), be = T[Ce], Le = s[be], ae = [11, 16, 21, 26]; - for (let Ue = 0; Ue < 4; Ue++) { - var _e = parseInt(D.substring(ae[Ue], ae[Ue] + 5)), Ee = T[_e]; - let Z = be + ":" + Ee; - var Be = s[Ee]; - if (Le !== void 0 && Be !== void 0) - if (!I[Z]) - I[Z] = 1, (Le.bonds.length == 0 || Le.bonds[Le.bonds.length - 1] != Ee) && (Le.bonds.push(Ee), Le.bondOrder.push(1)); - else { - I[Z] += 1; - for (let j = 0; j < Le.bonds.length; j++) - if (Le.bonds[j] == Ee) { - var Ne = I[Z]; - Ne >= 4 ? Le.bondOrder[j] = 1 : Le.bondOrder[j] = Ne; - } - } - } - } else if (B == "HELIX ") { - P = D.substring(19, 20), z = parseInt(D.substring(21, 25)), k = parseInt(D.substring(33, 37)), P in L || (L[P] = {}), L[P][z] = "h1"; - for (let Ue = z + 1; Ue < k; Ue++) - L[P][Ue] = "h"; - L[P][k] = "h2"; - } else if (!a && B == "REMARK" && D.substring(13, 18) == "BIOMT") { - var Ge, ke = new n.Matrix4(); - for (Ge = 1; Ge <= 3; Ge++) - if (D = y[We].replace(/^\s*/, ""), parseInt(D.substring(18, 19)) == Ge) - ke.elements[Ge - 1] = parseFloat(D.substring(23, 33)), ke.elements[Ge - 1 + 4] = parseFloat(D.substring(33, 43)), ke.elements[Ge - 1 + 8] = parseFloat(D.substring(43, 53)), ke.elements[Ge - 1 + 12] = parseFloat(D.substring(53)), We++; - else - for (; D.substring(13, 18) == "BIOMT"; ) - We++, D = y[We].replace(/^\s*/, ""); - ke.elements[3] = 0, ke.elements[7] = 0, ke.elements[11] = 0, ke.elements[15] = 1, g.symmetries.push(ke), We--; - } else if (B == "CRYST1") { - let Ue, Z, j, ee, ge, ye; - Ue = parseFloat(D.substring(7, 15)), Z = parseFloat(D.substring(16, 24)), j = parseFloat(D.substring(25, 33)), ee = parseFloat(D.substring(34, 40)), ge = parseFloat(D.substring(41, 47)), ye = parseFloat(D.substring(48, 54)), g.cryst = { - a: Ue, - b: Z, - c: j, - alpha: ee, - beta: ge, - gamma: ye - }; - } else if (B == "ANISOU") { - let Ue = parseInt(D.substring(6, 11)); - var pe = T[Ue], de = s[pe]; - if (de) { - var ce = D.substring(30).trim().split(/\s+/), Ae = { - u11: parseInt(ce[0]), - u22: parseInt(ce[1]), - u33: parseInt(ce[2]), - u12: parseInt(ce[3]), - u13: parseInt(ce[4]), - u23: parseInt(ce[5]) - }; - de.uMat = Ae; - } - } - } - if ((0, c.validateBonds)(s, T), o && (0, E.assignPDBBonds)(s), a || (0, _.processSymmetries)(g.symmetries, s, w, g.cryst), v && !p && (0, b.computeSecondaryStructure)(s, w.hbondCutoff), !(0, h.isEmpty)(L)) { - for (let We = 0; We < s.length; We++) - if (M = s[We], M !== void 0 && M.chain in L && M.resi in L[M.chain]) { - var Oe = L[M.chain][M.resi]; - M.ss = Oe[0], Oe.length > 1 && (Oe[1] == "1" ? M.ssbegin = !0 : Oe[1] == "2" && (M.ssend = !0)); - } - } - return [s, g, C]; - } - } - ), - /***/ - "./src/parsers/utils/isEmpty.ts": ( - /*!**************************************!*\ - !*** ./src/parsers/utils/isEmpty.ts ***! - \**************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - isEmpty: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f) { - var u; - for (u in f) - return !1; - return !0; - } - } - ), - /***/ - "./src/parsers/utils/processSymmetries.ts": ( - /*!************************************************!*\ - !*** ./src/parsers/utils/processSymmetries.ts ***! - \************************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - processSymmetries: () => ( - /* binding */ - f - ) - /* harmony export */ - }); - var n = r( - /*! ../../WebGL */ - "./src/WebGL/index.ts" - ); - function f(u, b, h, _) { - var E = !h.duplicateAssemblyAtoms, c = b.length, S = c, y, w, L; - let s = -1; - if (h.normalizeAssembly && _) { - let l = (0, n.conversionMatrix3)(_.a, _.b, _.c, _.alpha, _.beta, _.gamma), g = new n.Matrix3(); - for (g.getInverse3(l), y = 0; y < u.length; y++) { - let M = new n.Vector3(0, 0, 0); - for (L = 0; L < c; L++) { - let I = new n.Vector3(b[L].x, b[L].y, b[L].z); - I.applyMatrix4(u[y]), I.applyMatrix3(g), M.add(I); - } - M.divideScalar(c); - const C = [M.x, M.y, M.z]; - let T = [0, 0, 0]; - for (let I = 0; I < 3; I++) { - for (; C[I] < -1e-3; ) - C[I] += 1, T[I] += 1; - for (; C[I] > 1.001; ) - C[I] -= 1, T[I] -= 1; - } - const D = new n.Vector3(T[0], T[1], T[2]); - D.applyMatrix3(l), u[y].isNearlyIdentity() && D.lengthSq() > 1e-3 && (s = y), u[y].translate(D); - } - } - if (E) { - if (u.length > 1) - for (y = 0; y < b.length; y++) { - var v = []; - for (w = 0; w < u.length; w++) - if (!u[w].isNearlyIdentity()) { - var a = new n.Vector3(); - a.set(b[y].x, b[y].y, b[y].z), a.applyMatrix4(u[w]), v.push(a); - } - b[y].symmetries = v; - } - } else { - for (L = 0; L < c; L++) - b[L].sym = -1; - for (y = 0; y < u.length; y++) - if (!u[y].isNearlyIdentity() && s != y) { - let l = new n.Vector3(); - for (L = 0; L < c; L++) { - var o = []; - for (w = 0; w < b[L].bonds.length; w++) - o.push(b[L].bonds[w] + S); - l.set(b[L].x, b[L].y, b[L].z), l.applyMatrix4(u[y]); - var A = {}; - for (var p in b[L]) - A[p] = b[L][p]; - A.x = l.x, A.y = l.y, A.z = l.z, A.bonds = o, A.sym = y, A.index = b.length, b.push(A); - } - S = b.length; - } else - for (L = 0; L < c; L++) - b[L].sym = y; - if (s >= 0) { - let l = new n.Vector3(); - for (L = 0; L < c; L++) - l.set(b[L].x, b[L].y, b[L].z), l.applyMatrix4(u[s]), b[L].x = l.x, b[L].y = l.y, b[L].z = l.z; - } - u.length = 0; - } - } - } - ), - /***/ - "./src/parsers/utils/standardResidues.ts": ( - /*!***********************************************!*\ - !*** ./src/parsers/utils/standardResidues.ts ***! - \***********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - standardResidues: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = /* @__PURE__ */ new Set([ - "ABU", - "ACD", - "ALA", - "ALB", - "ALI", - "ARG", - "AR0", - "ASN", - "ASP", - "ASX", - "BAS", - "CYS", - "CYH", - "CYX", - "CSS", - "CSH", - "GLN", - "GLU", - "GLX", - "GLY", - "HIS", - "HIE", - "HID", - "HIP", - "HYP", - "ILE", - "ILU", - "LEU", - "LYS", - "MET", - "PCA", - "PGA", - "PHE", - "PR0", - "PRO", - "PRZ", - "SER", - "THR", - "TRP", - "TYR", - "VAL", - "A", - "1MA", - "C", - "5MC", - "OMC", - "G", - "1MG", - "2MG", - "M2G", - "7MG", - "OMG", - "YG", - "I", - "T", - "U", - "+U", - "H2U", - "5MU", - "PSU", - "ACE", - "F0R", - "H2O", - "HOH", - "WAT" - ]); - } - ), - /***/ - "./src/parsers/utils/validateBonds.ts": ( - /*!********************************************!*\ - !*** ./src/parsers/utils/validateBonds.ts ***! - \********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - validateBonds: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - function n(f, u) { - for (var b = 0, h = f.length; b < h; b++) - for (var _ = f[b], E = 0; E < _.bonds.length; E++) { - var c = _.bonds[E], S = f[c], y = u[_.serial]; - if (S && y) { - var w = S.bonds.indexOf(y); - w < 0 && (S.bonds.push(y), S.bondOrder.push(_.bondOrder[E])); - } - } - } - } - ), - /***/ - "./src/partialCharges.ts": ( - /*!*******************************!*\ - !*** ./src/partialCharges.ts ***! - \*******************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - applyPartialCharges: () => ( - /* binding */ - f - ), - /* harmony export */ - partialCharges: () => ( - /* binding */ - n - ) - /* harmony export */ - }); - const n = { - "ALA:N": -0.15, - "ALA:CA": 0.1, - "ALA:CB": 0, - "ALA:C": 0.6, - "ALA:O": -0.55, - "ARG:N": -0.15, - "ARG:CA": 0.1, - "ARG:CB": 0, - "ARG:CG": 0, - "ARG:CD": 0.1, - "ARG:NE": -0.1, - "ARG:CZ": 0.5, - "ARG:NH1": 0.25, - "ARG:NH2": 0.25, - "ARG:C": 0.6, - "ARG:O": -0.55, - "ASN:N": -0.15, - "ASN:CA": 0.1, - "ASN:CB": 0, - "ASN:CG": 0.55, - "ASN:OD1": -0.55, - "ASN:ND2": 0, - "ASN:C": 0.6, - "ASN:O": -0.55, - "ASP:N": -0.15, - "ASP:CA": 0.1, - "ASP:CB": 0, - "ASP:CG": 0.14, - "ASP:OD1": -0.57, - "ASP:OD2": -0.57, - "ASP:C": 0.6, - "ASP:O": -0.55, - "CYS:N": -0.15, - "CYS:CA": 0.1, - "CYS:CB": 0.19, - "CYS:SG": -0.19, - "CYS:C": 0.6, - "CYS:O": -0.55, - "GLN:N": -0.15, - "GLN:CA": 0.1, - "GLN:CB": 0, - "GLN:CG": 0, - "GLN:CD": 0.55, - "GLN:OE1": -0.55, - "GLN:NE2": 0, - "GLN:C": 0.6, - "GLN:O": -0.55, - "GLU:N": -0.15, - "GLU:CA": 0.1, - "GLU:CB": 0, - "GLU:CG": 0, - "GLU:CD": 0.14, - "GLU:OE1": -0.57, - "GLU:OE2": -0.57, - "GLU:C": 0.6, - "GLU:O": -0.55, - "GLY:N": -0.15, - "GLY:CA": 0.1, - "GLY:C": 0.6, - "GLY:O": -0.55, - "HIS:N": -0.15, - "HIS:CA": 0.1, - "HIS:CB": 0, - "HIS:CG": 0.1, - "HIS:ND1": -0.1, - "HIS:CD2": 0.1, - "HIS:NE2": -0.4, - "HIS:CE1": 0.3, - "HIS:C": 0.6, - "HIS:O": -0.55, - "ILE:N": -0.15, - "ILE:CA": 0.1, - "ILE:CB": 0, - "ILE:CG2": 0, - "ILE:CG1": 0, - "ILE:CD": 0, - "ILE:C": 0.6, - "ILE:O": -0.55, - "LEU:N": -0.15, - "LEU:CA": 0.1, - "LEU:CB": 0, - "LEU:CG": 0, - "LEU:CD1": 0, - "LEU:CD2": 0, - "LEU:C": 0.6, - "LEU:O": -0.55, - "LYS:N": -0.15, - "LYS:CA": 0.1, - "LYS:CB": 0, - "LYS:CG": 0, - "LYS:CD": 0, - "LYS:CE": 0.25, - "LYS:NZ": 0.75, - "LYS:C": 0.6, - "LYS:O": -0.55, - "MET:N": -0.15, - "MET:CA": 0.1, - "MET:CB": 0, - "MET:CG": 0.06, - "MET:SD": -0.12, - "MET:CE": 0.06, - "MET:C": 0.6, - "MET:O": -0.55, - "PHE:N": -0.15, - "PHE:CA": 0.1, - "PHE:CB": 0, - "PHE:CG": 0, - "PHE:CD1": 0, - "PHE:CD2": 0, - "PHE:CE1": 0, - "PHE:CE2": 0, - "PHE:CZ": 0, - "PHE:C": 0.6, - "PHE:O": -0.55, - "PRO:N": -0.25, - "PRO:CD": 0.1, - "PRO:CA": 0.1, - "PRO:CB": 0, - "PRO:CG": 0, - "PRO:C": 0.6, - "PRO:O": -0.55, - "SER:N": -0.15, - "SER:CA": 0.1, - "SER:CB": 0.25, - "SER:OG": -0.25, - "SER:C": 0.6, - "SER:O": -0.55, - "THR:N": -0.15, - "THR:CA": 0.1, - "THR:CB": 0.25, - "THR:OG1": -0.25, - "THR:CG2": 0, - "THR:C": 0.6, - "THR:O": -0.55, - "TRP:N": -0.15, - "TRP:CA": 0.1, - "TRP:CB": 0, - "TRP:CG": -0.03, - "TRP:CD2": 0.1, - "TRP:CE2": -0.04, - "TRP:CE3": -0.03, - "TRP:CD1": 0.06, - "TRP:NE1": -0.06, - "TRP:CZ2": 0, - "TRP:CZ3": 0, - "TRP:CH2": 0, - "TRP:C": 0.6, - "TRP:O": -0.55, - "TYR:N": -0.15, - "TYR:CA": 0.1, - "TYR:CB": 0, - "TYR:CG": 0, - "TYR:CD1": 0, - "TYR:CE1": 0, - "TYR:CD2": 0, - "TYR:CE2": 0, - "TYR:CZ": 0.25, - "TYR:OH": -0.25, - "TYR:C": 0.6, - "TYR:O": -0.55, - "VAL:N": -0.15, - "VAL:CA": 0.1, - "VAL:CB": 0, - "VAL:CG1": 0, - "VAL:CG2": 0, - "VAL:C": 0.6, - "VAL:O": -0.55 - }; - function f(u, b) { - if ((!b || typeof u.partialCharge > "u") && u.resn && u.atom) { - var h = u.resn + ":" + u.atom; - u.properties.partialCharge = n[h]; - } - } - } - ), - /***/ - "./src/specs.ts": ( - /*!**********************!*\ - !*** ./src/specs.ts ***! - \**********************/ - /***/ - (t, e, r) => { - r.r(e); - } - ), - /***/ - "./src/utilities.ts": ( - /*!**************************!*\ - !*** ./src/utilities.ts ***! - \**************************/ - /***/ - (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { - /* harmony export */ - PausableTimer: () => ( - /* binding */ - PausableTimer - ), - /* harmony export */ - adjustVolumeStyle: () => ( - /* binding */ - adjustVolumeStyle - ), - /* harmony export */ - base64ToArray: () => ( - /* binding */ - base64ToArray - ), - /* harmony export */ - deepCopy: () => ( - /* binding */ - deepCopy - ), - /* harmony export */ - download: () => ( - /* binding */ - download - ), - /* harmony export */ - extend: () => ( - /* binding */ - extend - ), - /* harmony export */ - get: () => ( - /* binding */ - get - ), - /* harmony export */ - getAtomProperty: () => ( - /* binding */ - getAtomProperty - ), - /* harmony export */ - getColorFromStyle: () => ( - /* binding */ - getColorFromStyle - ), - /* harmony export */ - getElement: () => ( - /* binding */ - getElement - ), - /* harmony export */ - getExtent: () => ( - /* binding */ - getExtent - ), - /* harmony export */ - getPropertyRange: () => ( - /* binding */ - getPropertyRange - ), - /* harmony export */ - getbin: () => ( - /* binding */ - getbin - ), - /* harmony export */ - isEmptyObject: () => ( - /* binding */ - isEmptyObject - ), - /* harmony export */ - isNumeric: () => ( - /* binding */ - isNumeric - ), - /* harmony export */ - makeFunction: () => ( - /* binding */ - makeFunction - ), - /* harmony export */ - mergeGeos: () => ( - /* binding */ - mergeGeos - ), - /* harmony export */ - specStringToObject: () => ( - /* binding */ - specStringToObject - ) - /* harmony export */ - }); - var _Gradient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( - /*! ./Gradient */ - "./src/Gradient.ts" - ), _VolumeData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( - /*! ./VolumeData */ - "./src/VolumeData.ts" - ), _colors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( - /*! ./colors */ - "./src/colors.ts" - ); - function extend(t, e) { - for (var r in e) - e.hasOwnProperty(r) && e[r] !== void 0 && (t[r] = e[r]); - return t; - } - function deepCopy(t) { - let e, r, n; - if (t == null) - return {}; - if (typeof t != "object" || t === null) - return t; - e = Array.isArray(t) ? [] : {}; - for (n in t) - r = t[n], e[n] = deepCopy(r); - return e; - } - function isNumeric(t) { - var e = typeof t; - return (e === "number" || e === "string") && !isNaN(t - parseFloat(t)); - } - function isEmptyObject(t) { - var e; - for (e in t) - return !1; - return !0; - } - function makeFunction(callback) { - return callback && typeof callback == "string" && (callback = eval("(" + callback + ")")), callback && typeof callback != "function" ? null : callback; - } - function adjustVolumeStyle(t) { - t && (t.volformat && !(t.voldata instanceof _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData) && (t.voldata = new _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData(t.voldata, t.volformat)), t.volscheme && (t.volscheme = _Gradient__WEBPACK_IMPORTED_MODULE_0__.Gradient.getGradient(t.volscheme))); - } - function getExtent(t, e) { - var r, n, f, u, b, h, _, E, c, S, y = !e; - if (r = n = f = 9999, u = b = h = -9999, _ = E = c = S = 0, t.length === 0) - return [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; - for (var w = 0; w < t.length; w++) { - var L = t[w]; - if (!(typeof L > "u" || !isFinite(L.x) || !isFinite(L.y) || !isFinite(L.z)) && (S++, _ += L.x, E += L.y, c += L.z, r = r < L.x ? r : L.x, n = n < L.y ? n : L.y, f = f < L.z ? f : L.z, u = u > L.x ? u : L.x, b = b > L.y ? b : L.y, h = h > L.z ? h : L.z, L.symmetries && y)) - for (var s = 0; s < L.symmetries.length; s++) - S++, _ += L.symmetries[s].x, E += L.symmetries[s].y, c += L.symmetries[s].z, r = r < L.symmetries[s].x ? r : L.symmetries[s].x, n = n < L.symmetries[s].y ? n : L.symmetries[s].y, f = f < L.symmetries[s].z ? f : L.symmetries[s].z, u = u > L.symmetries[s].x ? u : L.symmetries[s].x, b = b > L.symmetries[s].y ? b : L.symmetries[s].y, h = h > L.symmetries[s].z ? h : L.symmetries[s].z; - } - return [ - [r, n, f], - [u, b, h], - [_ / S, E / S, c / S] - ]; - } - function getPropertyRange(t, e) { - for (var r = Number.POSITIVE_INFINITY, n = Number.NEGATIVE_INFINITY, f = 0, u = t.length; f < u; f++) { - var b = t[f], h = getAtomProperty(b, e); - h != null && (h < r && (r = h), h > n && (n = h)); - } - return !isFinite(r) && !isFinite(n) ? r = n = 0 : isFinite(r) ? isFinite(n) || (n = r) : r = n, [r, n]; - } - class PausableTimer { - constructor(e, r, n) { - this.total_time_run = 0, this.fn = e, this.arg = n, this.countdown = r, this.start_time = (/* @__PURE__ */ new Date()).getTime(), this.ident = setTimeout(e, r, n); - } - cancel() { - clearTimeout(this.ident); - } - pause() { - clearTimeout(this.ident), this.total_time_run = (/* @__PURE__ */ new Date()).getTime() - this.start_time; - } - resume() { - this.ident = setTimeout(this.fn, Math.max(0, this.countdown - this.total_time_run), this.arg); - } - } - function base64ToArray(t) { - for (var e = window.atob(t), r = e.length, n = new Uint8Array(r), f = 0; f < r; f++) - n[f] = e.charCodeAt(f); - return n; - } - function getAtomProperty(t, e) { - var r = null; - return t.properties && typeof t.properties[e] < "u" ? r = t.properties[e] : typeof t[e] < "u" && (r = t[e]), r; - } - function mergeGeos(t, e) { - var r = e.geometry; - r !== void 0 && t.geometryGroups.push(r.geometryGroups[0]); - } - function specStringToObject(t) { - if (typeof t == "object") - return t; - if (typeof t > "u" || t == null) - return t; - try { - return JSON.parse(t); - } catch { - } - t = t.replace(/%7E/g, "~"); - var e = function(y) { - return isNumeric(y) ? Math.floor(parseFloat(y)) == parseInt(y) || y.indexOf(".") >= 0 ? parseFloat(y) : parseInt(y) : y === "true" ? !0 : y === "false" ? !1 : y; - }, r = {}; - if (t === "all") - return r; - for (var n = t.split(";"), f = 0; f < n.length; f++) { - var u = n[f].split(":"), b = u[0], h = {}, _ = u[1]; - if (_) - if (_ = _.replace(/~/g, "="), _.indexOf("=") !== -1) - for (var E = _.split(","), c = 0; c < E.length; c++) { - var S = E[c].split("=", 2); - h[S[0]] = e(S[1]); - } - else - _.indexOf(",") !== -1 ? h = _.split(",") : h = e(_); - r[b] = h; - } - return r; - } - function checkStatus(t) { - if (!t.ok) - throw new Error(`HTTP ${t.status} - ${t.statusText}`); - return t; - } - function get(t, e) { - var r = fetch(t).then(checkStatus).then((n) => n.text()); - return e ? r.then(e) : r; - } - function getbin(t, e, r, n) { - var f; - return r == "POST" ? f = fetch(t, { method: "POST", body: n }).then((u) => checkStatus(u)).then((u) => u.arrayBuffer()) : f = fetch(t).then((u) => checkStatus(u)).then((u) => u.arrayBuffer()), e ? f.then(e) : f; - } - function download(t, e, r, n) { - var f = "", u = "", b = "", h = "", _ = null, E = e.addModel(); - if (t.indexOf(":") < 0 && (t.length == 4 ? t = "pdb:" + t : isNaN(t) ? t = "url:" + t : t = "cid:" + t), t.substring(0, 5) === "mmtf:") - u = r && r.pdbUri ? r.pdbUri : "https://mmtf.rcsb.org/v1.0/full/", t = t.substring(5).toUpperCase(), h = u + t, r && typeof r.noComputeSecondaryStructure > "u" && (r.noComputeSecondaryStructure = !0), _ = new Promise(function(S) { - getbin(h).then(function(y) { - E.addMolData(y, "mmtf", r), e.zoomTo(), e.render(), S(E); - }, function() { - console.log("fetch of " + h + " failed."); - }); - }); - else { - if (t.substring(0, 4) === "pdb:") { - if (f = "mmtf", r && r.format && (f = r.format), r && typeof r.noComputeSecondaryStructure > "u" && (r.noComputeSecondaryStructure = !0), t = t.substring(4).toUpperCase(), !t.match(/^[1-9][A-Za-z0-9]{3}$/)) { - alert("Wrong PDB ID"); - return; - } - f == "mmtf" ? (b = r && r.mmtfUri ? r.mmtfUri : "https://mmtf.rcsb.org/v1.0/full/", h = b + t.toUpperCase()) : (u = r && r.pdbUri ? r.pdbUri : "https://files.rcsb.org/view/", h = u + t + "." + f); - } else if (t.substring(0, 4) == "cid:") { - if (f = "sdf", t = t.substring(4), !t.match(/^[0-9]+$/)) { - alert("Wrong Compound ID"); - return; - } - h = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + t + "/SDF?record_type=3d"; - } else - t.substring(0, 4) == "url:" && (h = t.substring(4), f = h); - var c = function(S) { - E.addMolData(S, f, r), e.zoomTo(), e.render(); - }; - _ = new Promise(function(S) { - f == "mmtf" ? getbin(h).then(function(y) { - c(y), S(E); - }).catch(function() { - u = r && r.pdbUri ? r.pdbUri : "https://files.rcsb.org/view/", h = u + t + ".pdb", f = "pdb", console.log("falling back to pdb format"), get(h).then(function(y) { - c(y), S(E); - }).catch(function(y) { - c(""), S(E), console.log("fetch of " + h + " failed: " + y.statusText); - }); - }) : get(h).then(function(y) { - c(y), S(E); - }).catch(function(y) { - c(""), S(E), console.log("fetch of " + h + " failed: " + y.statusText); - }); - }); - } - return n ? (_.then(function(S) { - n(S); - }), E) : _; - } - function getColorFromStyle(t, e) { - let r = e.colorscheme; - if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r] < "u") - r = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r]; - else if (typeof r == "string" && r.endsWith("Carbon")) { - let b = r.substring(0, r.lastIndexOf("Carbon")).toLowerCase(); - if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[b] < "u") { - let h = Object.assign({}, _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors.defaultColors); - h.C = _colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[b], _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r] = { prop: "elem", map: h }, r = _colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r]; - } - } - let n = t.color; - if (typeof e.color < "u" && e.color != "spectrum" && (n = e.color), typeof r < "u") { - let b, h; - if (typeof _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[r] < "u") - r = _colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[r], typeof r[t[r.prop]] < "u" && (n = r.map[t[r.prop]]); - else if (typeof r[t[r.prop]] < "u") - n = r.map[t[r.prop]]; - else if (typeof r.prop < "u" && typeof r.gradient < "u") { - b = r.prop; - var f = r.gradient; - typeof _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[f] < "u" && (f = new _Gradient__WEBPACK_IMPORTED_MODULE_0__.builtinGradients[f](r.min, r.max, r.mid ? r.mid : r.colors)); - let _ = f.range() || [-1, 1]; - h = getAtomProperty(t, b), h != null && (n = f.valueToHex(h, _)); - } else - typeof r.prop < "u" && typeof r.map < "u" ? (b = r.prop, h = getAtomProperty(t, b), typeof r.map[h] < "u" && (n = r.map[h])) : typeof e.colorscheme[t.elem] < "u" ? n = e.colorscheme[t.elem] : console.log("Could not interpret colorscheme " + r); - } else - typeof e.colorfunc < "u" && (n = e.colorfunc(t)); - return _colors__WEBPACK_IMPORTED_MODULE_2__.CC.color(n); - } - function getElement(t) { - let e = t; - return typeof t == "string" ? e = document.querySelector("#" + t) : typeof t == "object" && t.get && (e = t.get(0)), e; - } - } - ), - /***/ - "./node_modules/upng-js/UPNG.js": ( - /*!**************************************!*\ - !*** ./node_modules/upng-js/UPNG.js ***! - \**************************************/ - /***/ - (t, e, r) => { - (function() { - var n = {}, f; - t.exports = n, f = r( - /*! pako */ - "./node_modules/upng-js/node_modules/pako/index.js" - ), function(u, b) { - u.toRGBA8 = function(h) { - var _ = h.width, E = h.height; - if (h.tabs.acTL == null) - return [u.toRGBA8.decodeImage(h.data, _, E, h).buffer]; - var c = []; - h.frames[0].data == null && (h.frames[0].data = h.data); - for (var S, y = new Uint8Array(_ * E * 4), w = 0; w < h.frames.length; w++) { - var L = h.frames[w], s = L.rect.x, o = L.rect.y, A = L.rect.width, p = L.rect.height, v = u.toRGBA8.decodeImage(L.data, A, p, h); - if (w == 0 ? S = v : L.blend == 0 ? u._copyTile(v, A, p, S, _, E, s, o, 0) : L.blend == 1 && u._copyTile(v, A, p, S, _, E, s, o, 1), c.push(S.buffer), S = S.slice(0), L.dispose != 0) { - if (L.dispose == 1) - u._copyTile(y, A, p, S, _, E, s, o, 0); - else if (L.dispose == 2) { - for (var a = w - 1; h.frames[a].dispose == 2; ) - a--; - S = new Uint8Array(c[a]).slice(0); - } - } - } - return c; - }, u.toRGBA8.decodeImage = function(h, _, E, c) { - var S = _ * E, y = u.decode._getBPP(c), w = Math.ceil(_ * y / 8), L = new Uint8Array(S * 4), s = new Uint32Array(L.buffer), o = c.ctype, A = c.depth, p = u._bin.readUshort; - if (o == 6) { - var v = S << 2; - if (A == 8) - for (var a = 0; a < v; a++) - L[a] = h[a]; - if (A == 16) - for (var a = 0; a < v; a++) - L[a] = h[a << 1]; - } else if (o == 2) { - var l = c.tabs.tRNS, g = -1, M = -1, C = -1; - if (l && (g = l[0], M = l[1], C = l[2]), A == 8) - for (var a = 0; a < S; a++) { - var T = a << 2, D = a * 3; - L[T] = h[D], L[T + 1] = h[D + 1], L[T + 2] = h[D + 2], L[T + 3] = 255, g != -1 && h[D] == g && h[D + 1] == M && h[D + 2] == C && (L[T + 3] = 0); - } - if (A == 16) - for (var a = 0; a < S; a++) { - var T = a << 2, D = a * 6; - L[T] = h[D], L[T + 1] = h[D + 2], L[T + 2] = h[D + 4], L[T + 3] = 255, g != -1 && p(h, D) == g && p(h, D + 2) == M && p(h, D + 4) == C && (L[T + 3] = 0); - } - } else if (o == 3) { - var I = c.tabs.PLTE, B = c.tabs.tRNS, P = B ? B.length : 0; - if (A == 1) - for (var z = 0; z < E; z++) - for (var k = z * w, N = z * _, a = 0; a < _; a++) { - var T = N + a << 2, R = h[k + (a >> 3)] >> 7 - ((a & 7) << 0) & 1, U = 3 * R; - L[T] = I[U], L[T + 1] = I[U + 1], L[T + 2] = I[U + 2], L[T + 3] = R < P ? B[R] : 255; - } - if (A == 2) - for (var z = 0; z < E; z++) - for (var k = z * w, N = z * _, a = 0; a < _; a++) { - var T = N + a << 2, R = h[k + (a >> 2)] >> 6 - ((a & 3) << 1) & 3, U = 3 * R; - L[T] = I[U], L[T + 1] = I[U + 1], L[T + 2] = I[U + 2], L[T + 3] = R < P ? B[R] : 255; - } - if (A == 4) - for (var z = 0; z < E; z++) - for (var k = z * w, N = z * _, a = 0; a < _; a++) { - var T = N + a << 2, R = h[k + (a >> 1)] >> 4 - ((a & 1) << 2) & 15, U = 3 * R; - L[T] = I[U], L[T + 1] = I[U + 1], L[T + 2] = I[U + 2], L[T + 3] = R < P ? B[R] : 255; - } - if (A == 8) - for (var a = 0; a < S; a++) { - var T = a << 2, R = h[a], U = 3 * R; - L[T] = I[U], L[T + 1] = I[U + 1], L[T + 2] = I[U + 2], L[T + 3] = R < P ? B[R] : 255; - } - } else if (o == 4) { - if (A == 8) - for (var a = 0; a < S; a++) { - var T = a << 2, W = a << 1, G = h[W]; - L[T] = G, L[T + 1] = G, L[T + 2] = G, L[T + 3] = h[W + 1]; - } - if (A == 16) - for (var a = 0; a < S; a++) { - var T = a << 2, W = a << 2, G = h[W]; - L[T] = G, L[T + 1] = G, L[T + 2] = G, L[T + 3] = h[W + 2]; - } - } else if (o == 0) { - var g = c.tabs.tRNS ? c.tabs.tRNS : -1; - if (A == 1) - for (var a = 0; a < S; a++) { - var G = 255 * (h[a >> 3] >> 7 - (a & 7) & 1), F = G == g * 255 ? 0 : 255; - s[a] = F << 24 | G << 16 | G << 8 | G; - } - if (A == 2) - for (var a = 0; a < S; a++) { - var G = 85 * (h[a >> 2] >> 6 - ((a & 3) << 1) & 3), F = G == g * 85 ? 0 : 255; - s[a] = F << 24 | G << 16 | G << 8 | G; - } - if (A == 4) - for (var a = 0; a < S; a++) { - var G = 17 * (h[a >> 1] >> 4 - ((a & 1) << 2) & 15), F = G == g * 17 ? 0 : 255; - s[a] = F << 24 | G << 16 | G << 8 | G; - } - if (A == 8) - for (var a = 0; a < S; a++) { - var G = h[a], F = G == g ? 0 : 255; - s[a] = F << 24 | G << 16 | G << 8 | G; - } - if (A == 16) - for (var a = 0; a < S; a++) { - var G = h[a << 1], F = p(h, a << 1) == g ? 0 : 255; - s[a] = F << 24 | G << 16 | G << 8 | G; - } - } - return L; - }, u.decode = function(h) { - for (var _ = new Uint8Array(h), E = 8, c = u._bin, S = c.readUshort, y = c.readUint, w = { tabs: {}, frames: [] }, L = new Uint8Array(_.length), s = 0, o, A = 0, p = [137, 80, 78, 71, 13, 10, 26, 10], v = 0; v < 8; v++) - if (_[v] != p[v]) - throw "The input is not a PNG file!"; - for (; E < _.length; ) { - var a = c.readUint(_, E); - E += 4; - var l = c.readASCII(_, E, 4); - if (E += 4, l == "IHDR") - u.decode._IHDR(_, E, w); - else if (l == "IDAT") { - for (var v = 0; v < a; v++) - L[s + v] = _[E + v]; - s += a; - } else if (l == "acTL") - w.tabs[l] = { num_frames: y(_, E), num_plays: y(_, E + 4) }, o = new Uint8Array(_.length); - else if (l == "fcTL") { - if (A != 0) { - var g = w.frames[w.frames.length - 1]; - g.data = u.decode._decompress(w, o.slice(0, A), g.rect.width, g.rect.height), A = 0; - } - var M = { x: y(_, E + 12), y: y(_, E + 16), width: y(_, E + 4), height: y(_, E + 8) }, C = S(_, E + 22); - C = S(_, E + 20) / (C == 0 ? 100 : C); - var T = { rect: M, delay: Math.round(C * 1e3), dispose: _[E + 24], blend: _[E + 25] }; - w.frames.push(T); - } else if (l == "fdAT") { - for (var v = 0; v < a - 4; v++) - o[A + v] = _[E + v + 4]; - A += a - 4; - } else if (l == "pHYs") - w.tabs[l] = [c.readUint(_, E), c.readUint(_, E + 4), _[E + 8]]; - else if (l == "cHRM") { - w.tabs[l] = []; - for (var v = 0; v < 8; v++) - w.tabs[l].push(c.readUint(_, E + v * 4)); - } else if (l == "tEXt") { - w.tabs[l] == null && (w.tabs[l] = {}); - var D = c.nextZero(_, E), I = c.readASCII(_, E, D - E), B = c.readASCII(_, D + 1, E + a - D - 1); - w.tabs[l][I] = B; - } else if (l == "iTXt") { - w.tabs[l] == null && (w.tabs[l] = {}); - var D = 0, P = E; - D = c.nextZero(_, P); - var I = c.readASCII(_, P, D - P); - P = D + 1, _[P], _[P + 1], P += 2, D = c.nextZero(_, P), c.readASCII(_, P, D - P), P = D + 1, D = c.nextZero(_, P), c.readUTF8(_, P, D - P), P = D + 1; - var B = c.readUTF8(_, P, a - (P - E)); - w.tabs[l][I] = B; - } else if (l == "PLTE") - w.tabs[l] = c.readBytes(_, E, a); - else if (l == "hIST") { - var z = w.tabs.PLTE.length / 3; - w.tabs[l] = []; - for (var v = 0; v < z; v++) - w.tabs[l].push(S(_, E + v * 2)); - } else if (l == "tRNS") - w.ctype == 3 ? w.tabs[l] = c.readBytes(_, E, a) : w.ctype == 0 ? w.tabs[l] = S(_, E) : w.ctype == 2 && (w.tabs[l] = [S(_, E), S(_, E + 2), S(_, E + 4)]); - else if (l == "gAMA") - w.tabs[l] = c.readUint(_, E) / 1e5; - else if (l == "sRGB") - w.tabs[l] = _[E]; - else if (l == "bKGD") - w.ctype == 0 || w.ctype == 4 ? w.tabs[l] = [S(_, E)] : w.ctype == 2 || w.ctype == 6 ? w.tabs[l] = [S(_, E), S(_, E + 2), S(_, E + 4)] : w.ctype == 3 && (w.tabs[l] = _[E]); - else if (l == "IEND") { - if (A != 0) { - var g = w.frames[w.frames.length - 1]; - g.data = u.decode._decompress(w, o.slice(0, A), g.rect.width, g.rect.height), A = 0; - } - w.data = u.decode._decompress(w, L, w.width, w.height); - break; - } - E += a, c.readUint(_, E), E += 4; - } - return delete w.compress, delete w.interlace, delete w.filter, w; - }, u.decode._decompress = function(h, _, E, c) { - return h.compress == 0 && (_ = u.decode._inflate(_)), h.interlace == 0 ? _ = u.decode._filterZero(_, h, 0, E, c) : h.interlace == 1 && (_ = u.decode._readInterlace(_, h)), _; - }, u.decode._inflate = function(h) { - return b.inflate(h); - }, u.decode._readInterlace = function(h, _) { - for (var E = _.width, c = _.height, S = u.decode._getBPP(_), y = S >> 3, w = Math.ceil(E * S / 8), L = new Uint8Array(c * w), s = 0, o = [0, 0, 4, 0, 2, 0, 1], A = [0, 4, 0, 2, 0, 1, 0], p = [8, 8, 8, 4, 4, 2, 2], v = [8, 8, 4, 4, 2, 2, 1], a = 0; a < 7; ) { - for (var l = p[a], g = v[a], M = 0, C = 0, T = o[a]; T < c; ) - T += l, C++; - for (var D = A[a]; D < E; ) - D += g, M++; - var I = Math.ceil(M * S / 8); - u.decode._filterZero(h, _, s, M, C); - for (var B = 0, P = o[a]; P < c; ) { - for (var z = A[a], k = s + B * I << 3; z < E; ) { - if (S == 1) { - var N = h[k >> 3]; - N = N >> 7 - (k & 7) & 1, L[P * w + (z >> 3)] |= N << 7 - ((z & 3) << 0); - } - if (S == 2) { - var N = h[k >> 3]; - N = N >> 6 - (k & 7) & 3, L[P * w + (z >> 2)] |= N << 6 - ((z & 3) << 1); - } - if (S == 4) { - var N = h[k >> 3]; - N = N >> 4 - (k & 7) & 15, L[P * w + (z >> 1)] |= N << 4 - ((z & 1) << 2); - } - if (S >= 8) - for (var R = P * w + z * y, U = 0; U < y; U++) - L[R + U] = h[(k >> 3) + U]; - k += S, z += g; - } - B++, P += l; - } - M * C != 0 && (s += C * (1 + I)), a = a + 1; - } - return L; - }, u.decode._getBPP = function(h) { - var _ = [1, null, 3, 1, 2, null, 4][h.ctype]; - return _ * h.depth; - }, u.decode._filterZero = function(h, _, E, c, S) { - var y = u.decode._getBPP(_), w = Math.ceil(c * y / 8), L = u.decode._paeth; - y = Math.ceil(y / 8); - for (var s = 0; s < S; s++) { - var o = E + s * w, A = o + s + 1, p = h[A - 1]; - if (p == 0) - for (var v = 0; v < w; v++) - h[o + v] = h[A + v]; - else if (p == 1) { - for (var v = 0; v < y; v++) - h[o + v] = h[A + v]; - for (var v = y; v < w; v++) - h[o + v] = h[A + v] + h[o + v - y] & 255; - } else if (s == 0) { - for (var v = 0; v < y; v++) - h[o + v] = h[A + v]; - if (p == 2) - for (var v = y; v < w; v++) - h[o + v] = h[A + v] & 255; - if (p == 3) - for (var v = y; v < w; v++) - h[o + v] = h[A + v] + (h[o + v - y] >> 1) & 255; - if (p == 4) - for (var v = y; v < w; v++) - h[o + v] = h[A + v] + L(h[o + v - y], 0, 0) & 255; - } else { - if (p == 2) - for (var v = 0; v < w; v++) - h[o + v] = h[A + v] + h[o + v - w] & 255; - if (p == 3) { - for (var v = 0; v < y; v++) - h[o + v] = h[A + v] + (h[o + v - w] >> 1) & 255; - for (var v = y; v < w; v++) - h[o + v] = h[A + v] + (h[o + v - w] + h[o + v - y] >> 1) & 255; - } - if (p == 4) { - for (var v = 0; v < y; v++) - h[o + v] = h[A + v] + L(0, h[o + v - w], 0) & 255; - for (var v = y; v < w; v++) - h[o + v] = h[A + v] + L(h[o + v - y], h[o + v - w], h[o + v - y - w]) & 255; - } - } - } - return h; - }, u.decode._paeth = function(h, _, E) { - var c = h + _ - E, S = Math.abs(c - h), y = Math.abs(c - _), w = Math.abs(c - E); - return S <= y && S <= w ? h : y <= w ? _ : E; - }, u.decode._IHDR = function(h, _, E) { - var c = u._bin; - E.width = c.readUint(h, _), _ += 4, E.height = c.readUint(h, _), _ += 4, E.depth = h[_], _++, E.ctype = h[_], _++, E.compress = h[_], _++, E.filter = h[_], _++, E.interlace = h[_], _++; - }, u._bin = { - nextZero: function(h, _) { - for (; h[_] != 0; ) - _++; - return _; - }, - readUshort: function(h, _) { - return h[_] << 8 | h[_ + 1]; - }, - writeUshort: function(h, _, E) { - h[_] = E >> 8 & 255, h[_ + 1] = E & 255; - }, - readUint: function(h, _) { - return h[_] * 16777216 + (h[_ + 1] << 16 | h[_ + 2] << 8 | h[_ + 3]); - }, - writeUint: function(h, _, E) { - h[_] = E >> 24 & 255, h[_ + 1] = E >> 16 & 255, h[_ + 2] = E >> 8 & 255, h[_ + 3] = E & 255; - }, - readASCII: function(h, _, E) { - for (var c = "", S = 0; S < E; S++) - c += String.fromCharCode(h[_ + S]); - return c; - }, - writeASCII: function(h, _, E) { - for (var c = 0; c < E.length; c++) - h[_ + c] = E.charCodeAt(c); - }, - readBytes: function(h, _, E) { - for (var c = [], S = 0; S < E; S++) - c.push(h[_ + S]); - return c; - }, - pad: function(h) { - return h.length < 2 ? "0" + h : h; - }, - readUTF8: function(h, _, E) { - for (var c = "", S, y = 0; y < E; y++) - c += "%" + u._bin.pad(h[_ + y].toString(16)); - try { - S = decodeURIComponent(c); - } catch { - return u._bin.readASCII(h, _, E); - } - return S; - } - }, u._copyTile = function(h, _, E, c, S, y, w, L, s) { - for (var o = Math.min(_, S), A = Math.min(E, y), p = 0, v = 0, a = 0; a < A; a++) - for (var l = 0; l < o; l++) - if (w >= 0 && L >= 0 ? (p = a * _ + l << 2, v = (L + a) * S + w + l << 2) : (p = (-L + a) * _ - w + l << 2, v = a * S + l << 2), s == 0) - c[v] = h[p], c[v + 1] = h[p + 1], c[v + 2] = h[p + 2], c[v + 3] = h[p + 3]; - else if (s == 1) { - var g = h[p + 3] * 0.00392156862745098, M = h[p] * g, C = h[p + 1] * g, T = h[p + 2] * g, D = c[v + 3] * (1 / 255), I = c[v] * D, B = c[v + 1] * D, P = c[v + 2] * D, z = 1 - g, k = g + D * z, N = k == 0 ? 0 : 1 / k; - c[v + 3] = 255 * k, c[v + 0] = (M + I * z) * N, c[v + 1] = (C + B * z) * N, c[v + 2] = (T + P * z) * N; - } else if (s == 2) { - var g = h[p + 3], M = h[p], C = h[p + 1], T = h[p + 2], D = c[v + 3], I = c[v], B = c[v + 1], P = c[v + 2]; - g == D && M == I && C == B && T == P ? (c[v] = 0, c[v + 1] = 0, c[v + 2] = 0, c[v + 3] = 0) : (c[v] = M, c[v + 1] = C, c[v + 2] = T, c[v + 3] = g); - } else if (s == 3) { - var g = h[p + 3], M = h[p], C = h[p + 1], T = h[p + 2], D = c[v + 3], I = c[v], B = c[v + 1], P = c[v + 2]; - if (g == D && M == I && C == B && T == P) - continue; - if (g < 220 && D > 20) - return !1; - } - return !0; - }, u.encode = function(h, _, E, c, S, y) { - c == null && (c = 0), y == null && (y = !1); - for (var w = new Uint8Array(h[0].byteLength * h.length + 100), L = [137, 80, 78, 71, 13, 10, 26, 10], s = 0; s < 8; s++) - w[s] = L[s]; - var o = 8, A = u._bin, p = u.crc.crc, v = A.writeUint, a = A.writeUshort, l = A.writeASCII, g = u.encode.compressPNG(h, _, E, c, y); - v(w, o, 13), o += 4, l(w, o, "IHDR"), o += 4, v(w, o, _), o += 4, v(w, o, E), o += 4, w[o] = g.depth, o++, w[o] = g.ctype, o++, w[o] = 0, o++, w[o] = 0, o++, w[o] = 0, o++, v(w, o, p(w, o - 17, 17)), o += 4, v(w, o, 1), o += 4, l(w, o, "sRGB"), o += 4, w[o] = 1, o++, v(w, o, p(w, o - 5, 5)), o += 4; - var M = h.length > 1; - if (M && (v(w, o, 8), o += 4, l(w, o, "acTL"), o += 4, v(w, o, h.length), o += 4, v(w, o, 0), o += 4, v(w, o, p(w, o - 12, 12)), o += 4), g.ctype == 3) { - var C = g.plte.length; - v(w, o, C * 3), o += 4, l(w, o, "PLTE"), o += 4; - for (var s = 0; s < C; s++) { - var T = s * 3, D = g.plte[s], I = D & 255, B = D >> 8 & 255, P = D >> 16 & 255; - w[o + T + 0] = I, w[o + T + 1] = B, w[o + T + 2] = P; - } - if (o += C * 3, v(w, o, p(w, o - C * 3 - 4, C * 3 + 4)), o += 4, g.gotAlpha) { - v(w, o, C), o += 4, l(w, o, "tRNS"), o += 4; - for (var s = 0; s < C; s++) - w[o + s] = g.plte[s] >> 24 & 255; - o += C, v(w, o, p(w, o - C - 4, C + 4)), o += 4; - } - } - for (var z = 0, k = 0; k < g.frames.length; k++) { - var N = g.frames[k]; - M && (v(w, o, 26), o += 4, l(w, o, "fcTL"), o += 4, v(w, o, z++), o += 4, v(w, o, N.rect.width), o += 4, v(w, o, N.rect.height), o += 4, v(w, o, N.rect.x), o += 4, v(w, o, N.rect.y), o += 4, a(w, o, S[k]), o += 2, a(w, o, 1e3), o += 2, w[o] = N.dispose, o++, w[o] = N.blend, o++, v(w, o, p(w, o - 30, 30)), o += 4); - var R = N.cimg, C = R.length; - v(w, o, C + (k == 0 ? 0 : 4)), o += 4; - var U = o; - l(w, o, k == 0 ? "IDAT" : "fdAT"), o += 4, k != 0 && (v(w, o, z++), o += 4); - for (var s = 0; s < C; s++) - w[o + s] = R[s]; - o += C, v(w, o, p(w, U, o - U)), o += 4; - } - return v(w, o, 0), o += 4, l(w, o, "IEND"), o += 4, v(w, o, p(w, o - 4, 4)), o += 4, w.buffer.slice(0, o); - }, u.encode.compressPNG = function(h, _, E, c, S) { - for (var y = u.encode.compress(h, _, E, c, !1, S), w = 0; w < h.length; w++) { - var L = y.frames[w]; - L.rect.width; - var s = L.rect.height, o = L.bpl, A = L.bpp, p = new Uint8Array(s * o + s); - L.cimg = u.encode._filterZero(L.img, s, A, o, p); - } - return y; - }, u.encode.compress = function(h, _, E, c, S, y) { - y == null && (y = !1); - for (var w = 6, L = 8, s = 4, o = 255, A = 0; A < h.length; A++) - for (var p = new Uint8Array(h[A]), v = p.length, a = 0; a < v; a += 4) - o &= p[a + 3]; - var l = o != 255, g = {}, M = []; - if (h.length != 0 && (g[0] = 0, M.push(0), c != 0 && c--), c != 0) { - var C = u.quantize(h, c, S); - h = C.bufs; - for (var a = 0; a < C.plte.length; a++) { - var T = C.plte[a].est.rgba; - g[T] == null && (g[T] = M.length, M.push(T)); - } - } else - for (var A = 0; A < h.length; A++) - for (var D = new Uint32Array(h[A]), v = D.length, a = 0; a < v; a++) { - var T = D[a]; - if ((a < _ || T != D[a - 1] && T != D[a - _]) && g[T] == null && (g[T] = M.length, M.push(T), M.length >= 300)) - break; - } - var I = l ? S : !1, B = M.length; - B <= 256 && y == !1 && (B <= 2 ? L = 1 : B <= 4 ? L = 2 : B <= 16 ? L = 4 : L = 8, S && (L = 8), l = !0); - for (var P = [], A = 0; A < h.length; A++) { - var z = new Uint8Array(h[A]), k = new Uint32Array(z.buffer), N = 0, R = 0, U = _, W = E, G = 0; - if (A != 0 && !I) { - for (var F = S || A == 1 || P[P.length - 2].dispose == 2 ? 1 : 2, V = 0, J = 1e9, X = 0; X < F; X++) { - for (var ae = new Uint8Array(h[A - 1 - X]), oe = new Uint32Array(h[A - 1 - X]), te = _, ve = E, se = -1, le = -1, Ce = 0; Ce < E; Ce++) - for (var be = 0; be < _; be++) { - var a = Ce * _ + be; - k[a] != oe[a] && (be < te && (te = be), be > se && (se = be), Ce < ve && (ve = Ce), Ce > le && (le = Ce)); - } - var Le = se == -1 ? 1 : (se - te + 1) * (le - ve + 1); - Le < J && (J = Le, V = X, se == -1 ? (N = R = 0, U = W = 1) : (N = te, R = ve, U = se - te + 1, W = le - ve + 1)); - } - var ae = new Uint8Array(h[A - 1 - V]); - V == 1 && (P[P.length - 1].dispose = 2); - var _e = new Uint8Array(U * W * 4); - new Uint32Array(_e.buffer), u._copyTile(ae, _, E, _e, U, W, -N, -R, 0), u._copyTile(z, _, E, _e, U, W, -N, -R, 3) ? (u._copyTile(z, _, E, _e, U, W, -N, -R, 2), G = 1) : (u._copyTile(z, _, E, _e, U, W, -N, -R, 0), G = 0), z = _e, k = new Uint32Array(z.buffer); - } - var Ee = 4 * U; - if (B <= 256 && y == !1) { - Ee = Math.ceil(L * U / 8); - for (var _e = new Uint8Array(Ee * W), Ce = 0; Ce < W; Ce++) { - var a = Ce * Ee, Be = Ce * U; - if (L == 8) - for (var be = 0; be < U; be++) - _e[a + be] = g[k[Be + be]]; - else if (L == 4) - for (var be = 0; be < U; be++) - _e[a + (be >> 1)] |= g[k[Be + be]] << 4 - (be & 1) * 4; - else if (L == 2) - for (var be = 0; be < U; be++) - _e[a + (be >> 2)] |= g[k[Be + be]] << 6 - (be & 3) * 2; - else if (L == 1) - for (var be = 0; be < U; be++) - _e[a + (be >> 3)] |= g[k[Be + be]] << 7 - (be & 7) * 1; - } - z = _e, w = 3, s = 1; - } else if (l == !1 && h.length == 1) { - for (var _e = new Uint8Array(U * W * 3), Ne = U * W, a = 0; a < Ne; a++) { - var Ge = a * 3, ke = a * 4; - _e[Ge] = z[ke], _e[Ge + 1] = z[ke + 1], _e[Ge + 2] = z[ke + 2]; - } - z = _e, w = 2, s = 3, Ee = 3 * U; - } - P.push({ rect: { x: N, y: R, width: U, height: W }, img: z, bpl: Ee, bpp: s, blend: G, dispose: I ? 1 : 0 }); - } - return { ctype: w, depth: L, plte: M, gotAlpha: l, frames: P }; - }, u.encode._filterZero = function(h, _, E, c, S) { - for (var y = [], w = 0; w < 5; w++) - if (!(_ * c > 5e5 && (w == 2 || w == 3 || w == 4))) { - for (var L = 0; L < _; L++) - u.encode._filterLine(S, h, L, c, E, w); - if (y.push(b.deflate(S)), E == 1) - break; - } - for (var s, o = 1e9, A = 0; A < y.length; A++) - y[A].length < o && (s = A, o = y[A].length); - return y[s]; - }, u.encode._filterLine = function(h, _, E, c, S, y) { - var w = E * c, L = w + E, s = u.decode._paeth; - if (h[L] = y, L++, y == 0) - for (var o = 0; o < c; o++) - h[L + o] = _[w + o]; - else if (y == 1) { - for (var o = 0; o < S; o++) - h[L + o] = _[w + o]; - for (var o = S; o < c; o++) - h[L + o] = _[w + o] - _[w + o - S] + 256 & 255; - } else if (E == 0) { - for (var o = 0; o < S; o++) - h[L + o] = _[w + o]; - if (y == 2) - for (var o = S; o < c; o++) - h[L + o] = _[w + o]; - if (y == 3) - for (var o = S; o < c; o++) - h[L + o] = _[w + o] - (_[w + o - S] >> 1) + 256 & 255; - if (y == 4) - for (var o = S; o < c; o++) - h[L + o] = _[w + o] - s(_[w + o - S], 0, 0) + 256 & 255; - } else { - if (y == 2) - for (var o = 0; o < c; o++) - h[L + o] = _[w + o] + 256 - _[w + o - c] & 255; - if (y == 3) { - for (var o = 0; o < S; o++) - h[L + o] = _[w + o] + 256 - (_[w + o - c] >> 1) & 255; - for (var o = S; o < c; o++) - h[L + o] = _[w + o] + 256 - (_[w + o - c] + _[w + o - S] >> 1) & 255; - } - if (y == 4) { - for (var o = 0; o < S; o++) - h[L + o] = _[w + o] + 256 - s(0, _[w + o - c], 0) & 255; - for (var o = S; o < c; o++) - h[L + o] = _[w + o] + 256 - s(_[w + o - S], _[w + o - c], _[w + o - S - c]) & 255; - } - } - }, u.crc = { - table: function() { - for (var h = new Uint32Array(256), _ = 0; _ < 256; _++) { - for (var E = _, c = 0; c < 8; c++) - E & 1 ? E = 3988292384 ^ E >>> 1 : E = E >>> 1; - h[_] = E; - } - return h; - }(), - update: function(h, _, E, c) { - for (var S = 0; S < c; S++) - h = u.crc.table[(h ^ _[E + S]) & 255] ^ h >>> 8; - return h; - }, - crc: function(h, _, E) { - return u.crc.update(4294967295, h, _, E) ^ 4294967295; - } - }, u.quantize = function(h, _, E) { - for (var c = [], S = 0, y = 0; y < h.length; y++) - c.push(u.encode.alphaMul(new Uint8Array(h[y]), E)), S += h[y].byteLength; - for (var w = new Uint8Array(S), L = new Uint32Array(w.buffer), s = 0, y = 0; y < c.length; y++) { - for (var o = c[y], A = o.length, p = 0; p < A; p++) - w[s + p] = o[p]; - s += A; - } - var v = { i0: 0, i1: w.length, bst: null, est: null, tdst: 0, left: null, right: null }; - v.bst = u.quantize.stats(w, v.i0, v.i1), v.est = u.quantize.estats(v.bst); - for (var a = [v]; a.length < _; ) { - for (var l = 0, g = 0, y = 0; y < a.length; y++) - a[y].est.L > l && (l = a[y].est.L, g = y); - if (l < 1e-3) - break; - var M = a[g], C = u.quantize.splitPixels(w, L, M.i0, M.i1, M.est.e, M.est.eMq255), T = { i0: M.i0, i1: C, bst: null, est: null, tdst: 0, left: null, right: null }; - T.bst = u.quantize.stats(w, T.i0, T.i1), T.est = u.quantize.estats(T.bst); - var D = { i0: C, i1: M.i1, bst: null, est: null, tdst: 0, left: null, right: null }; - D.bst = { R: [], m: [], N: M.bst.N - T.bst.N }; - for (var y = 0; y < 16; y++) - D.bst.R[y] = M.bst.R[y] - T.bst.R[y]; - for (var y = 0; y < 4; y++) - D.bst.m[y] = M.bst.m[y] - T.bst.m[y]; - D.est = u.quantize.estats(D.bst), M.left = T, M.right = D, a[g] = T, a.push(D); - } - a.sort(function(F, V) { - return V.bst.N - F.bst.N; - }); - for (var I = 0; I < c.length; I++) { - for (var B = u.quantize.planeDst, P = new Uint8Array(c[I].buffer), z = new Uint32Array(c[I].buffer), k = P.length, y = 0; y < k; y += 4) { - for (var N = P[y] * 0.00392156862745098, R = P[y + 1] * (1 / 255), U = P[y + 2] * (1 / 255), W = P[y + 3] * (1 / 255), G = v; G.left; ) - G = B(G.est, N, R, U, W) <= 0 ? G.left : G.right; - z[y >> 2] = G.est.rgba; - } - c[I] = z.buffer; - } - return { bufs: c, plte: a }; - }, u.quantize.getNearest = function(h, _, E, c, S) { - if (h.left == null) - return h.tdst = u.quantize.dist(h.est.q, _, E, c, S), h; - var y = u.quantize.planeDst(h.est, _, E, c, S), w = h.left, L = h.right; - y > 0 && (w = h.right, L = h.left); - var s = u.quantize.getNearest(w, _, E, c, S); - if (s.tdst <= y * y) - return s; - var o = u.quantize.getNearest(L, _, E, c, S); - return o.tdst < s.tdst ? o : s; - }, u.quantize.planeDst = function(h, _, E, c, S) { - var y = h.e; - return y[0] * _ + y[1] * E + y[2] * c + y[3] * S - h.eMq; - }, u.quantize.dist = function(h, _, E, c, S) { - var y = _ - h[0], w = E - h[1], L = c - h[2], s = S - h[3]; - return y * y + w * w + L * L + s * s; - }, u.quantize.splitPixels = function(h, _, E, c, S, y) { - var w = u.quantize.vecDot; - for (c -= 4; E < c; ) { - for (; w(h, E, S) <= y; ) - E += 4; - for (; w(h, c, S) > y; ) - c -= 4; - if (E >= c) - break; - var L = _[E >> 2]; - _[E >> 2] = _[c >> 2], _[c >> 2] = L, E += 4, c -= 4; - } - for (; w(h, E, S) > y; ) - E -= 4; - return E + 4; - }, u.quantize.vecDot = function(h, _, E) { - return h[_] * E[0] + h[_ + 1] * E[1] + h[_ + 2] * E[2] + h[_ + 3] * E[3]; - }, u.quantize.stats = function(h, _, E) { - for (var c = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], S = [0, 0, 0, 0], y = E - _ >> 2, w = _; w < E; w += 4) { - var L = h[w] * 0.00392156862745098, s = h[w + 1] * (1 / 255), o = h[w + 2] * (1 / 255), A = h[w + 3] * (1 / 255); - S[0] += L, S[1] += s, S[2] += o, S[3] += A, c[0] += L * L, c[1] += L * s, c[2] += L * o, c[3] += L * A, c[5] += s * s, c[6] += s * o, c[7] += s * A, c[10] += o * o, c[11] += o * A, c[15] += A * A; - } - return c[4] = c[1], c[8] = c[2], c[12] = c[3], c[9] = c[6], c[13] = c[7], c[14] = c[11], { R: c, m: S, N: y }; - }, u.quantize.estats = function(h) { - var _ = h.R, E = h.m, c = h.N, S = E[0], y = E[1], w = E[2], L = E[3], s = c == 0 ? 0 : 1 / c, o = [ - _[0] - S * S * s, - _[1] - S * y * s, - _[2] - S * w * s, - _[3] - S * L * s, - _[4] - y * S * s, - _[5] - y * y * s, - _[6] - y * w * s, - _[7] - y * L * s, - _[8] - w * S * s, - _[9] - w * y * s, - _[10] - w * w * s, - _[11] - w * L * s, - _[12] - L * S * s, - _[13] - L * y * s, - _[14] - L * w * s, - _[15] - L * L * s - ], A = o, p = u.M4, v = [0.5, 0.5, 0.5, 0.5], a = 0, l = 0; - if (c != 0) - for (var g = 0; g < 10 && (v = p.multVec(A, v), l = Math.sqrt(p.dot(v, v)), v = p.sml(1 / l, v), !(Math.abs(l - a) < 1e-9)); g++) - a = l; - var M = [S * s, y * s, w * s, L * s], C = p.dot(p.sml(255, M), v), T = M[3] < 1e-3 ? 0 : 1 / M[3]; - return { - Cov: o, - q: M, - e: v, - L: a, - eMq255: C, - eMq: p.dot(v, M), - rgba: (Math.round(255 * M[3]) << 24 | Math.round(255 * M[2] * T) << 16 | Math.round(255 * M[1] * T) << 8 | Math.round(255 * M[0] * T) << 0) >>> 0 - }; - }, u.M4 = { - multVec: function(h, _) { - return [ - h[0] * _[0] + h[1] * _[1] + h[2] * _[2] + h[3] * _[3], - h[4] * _[0] + h[5] * _[1] + h[6] * _[2] + h[7] * _[3], - h[8] * _[0] + h[9] * _[1] + h[10] * _[2] + h[11] * _[3], - h[12] * _[0] + h[13] * _[1] + h[14] * _[2] + h[15] * _[3] - ]; - }, - dot: function(h, _) { - return h[0] * _[0] + h[1] * _[1] + h[2] * _[2] + h[3] * _[3]; - }, - sml: function(h, _) { - return [h * _[0], h * _[1], h * _[2], h * _[3]]; - } - }, u.encode.alphaMul = function(h, _) { - for (var E = new Uint8Array(h.length), c = h.length >> 2, S = 0; S < c; S++) { - var y = S << 2, w = h[y + 3]; - _ && (w = w < 128 ? 0 : 255); - var L = w * (1 / 255); - E[y + 0] = h[y + 0] * L, E[y + 1] = h[y + 1] * L, E[y + 2] = h[y + 2] * L, E[y + 3] = w; - } - return E; - }; - }(n, f); - })(); - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/index.js": ( - /*!*********************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/index.js ***! - \*********************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ./lib/utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ).assign, f = r( - /*! ./lib/deflate */ - "./node_modules/upng-js/node_modules/pako/lib/deflate.js" - ), u = r( - /*! ./lib/inflate */ - "./node_modules/upng-js/node_modules/pako/lib/inflate.js" - ), b = r( - /*! ./lib/zlib/constants */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js" - ), h = {}; - n(h, f, u, b), t.exports = h; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/deflate.js": ( - /*!***************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/deflate.js ***! - \***************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ./zlib/deflate */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js" - ), f = r( - /*! ./utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), u = r( - /*! ./utils/strings */ - "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js" - ), b = r( - /*! ./zlib/messages */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js" - ), h = r( - /*! ./zlib/zstream */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js" - ), _ = Object.prototype.toString, E = 0, c = 4, S = 0, y = 1, w = 2, L = -1, s = 0, o = 8; - function A(l) { - if (!(this instanceof A)) - return new A(l); - this.options = f.assign({ - level: L, - method: o, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: s, - to: "" - }, l || {}); - var g = this.options; - g.raw && g.windowBits > 0 ? g.windowBits = -g.windowBits : g.gzip && g.windowBits > 0 && g.windowBits < 16 && (g.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new h(), this.strm.avail_out = 0; - var M = n.deflateInit2( - this.strm, - g.level, - g.method, - g.windowBits, - g.memLevel, - g.strategy - ); - if (M !== S) - throw new Error(b[M]); - if (g.header && n.deflateSetHeader(this.strm, g.header), g.dictionary) { - var C; - if (typeof g.dictionary == "string" ? C = u.string2buf(g.dictionary) : _.call(g.dictionary) === "[object ArrayBuffer]" ? C = new Uint8Array(g.dictionary) : C = g.dictionary, M = n.deflateSetDictionary(this.strm, C), M !== S) - throw new Error(b[M]); - this._dict_set = !0; - } - } - A.prototype.push = function(l, g) { - var M = this.strm, C = this.options.chunkSize, T, D; - if (this.ended) - return !1; - D = g === ~~g ? g : g === !0 ? c : E, typeof l == "string" ? M.input = u.string2buf(l) : _.call(l) === "[object ArrayBuffer]" ? M.input = new Uint8Array(l) : M.input = l, M.next_in = 0, M.avail_in = M.input.length; - do { - if (M.avail_out === 0 && (M.output = new f.Buf8(C), M.next_out = 0, M.avail_out = C), T = n.deflate(M, D), T !== y && T !== S) - return this.onEnd(T), this.ended = !0, !1; - (M.avail_out === 0 || M.avail_in === 0 && (D === c || D === w)) && (this.options.to === "string" ? this.onData(u.buf2binstring(f.shrinkBuf(M.output, M.next_out))) : this.onData(f.shrinkBuf(M.output, M.next_out))); - } while ((M.avail_in > 0 || M.avail_out === 0) && T !== y); - return D === c ? (T = n.deflateEnd(this.strm), this.onEnd(T), this.ended = !0, T === S) : (D === w && (this.onEnd(S), M.avail_out = 0), !0); - }, A.prototype.onData = function(l) { - this.chunks.push(l); - }, A.prototype.onEnd = function(l) { - l === S && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = f.flattenChunks(this.chunks)), this.chunks = [], this.err = l, this.msg = this.strm.msg; - }; - function p(l, g) { - var M = new A(g); - if (M.push(l, !0), M.err) - throw M.msg || b[M.err]; - return M.result; - } - function v(l, g) { - return g = g || {}, g.raw = !0, p(l, g); - } - function a(l, g) { - return g = g || {}, g.gzip = !0, p(l, g); - } - e.Deflate = A, e.deflate = p, e.deflateRaw = v, e.gzip = a; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/inflate.js": ( - /*!***************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/inflate.js ***! - \***************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ./zlib/inflate */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js" - ), f = r( - /*! ./utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), u = r( - /*! ./utils/strings */ - "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js" - ), b = r( - /*! ./zlib/constants */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js" - ), h = r( - /*! ./zlib/messages */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js" - ), _ = r( - /*! ./zlib/zstream */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js" - ), E = r( - /*! ./zlib/gzheader */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js" - ), c = Object.prototype.toString; - function S(L) { - if (!(this instanceof S)) - return new S(L); - this.options = f.assign({ - chunkSize: 16384, - windowBits: 0, - to: "" - }, L || {}); - var s = this.options; - s.raw && s.windowBits >= 0 && s.windowBits < 16 && (s.windowBits = -s.windowBits, s.windowBits === 0 && (s.windowBits = -15)), s.windowBits >= 0 && s.windowBits < 16 && !(L && L.windowBits) && (s.windowBits += 32), s.windowBits > 15 && s.windowBits < 48 && (s.windowBits & 15 || (s.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new _(), this.strm.avail_out = 0; - var o = n.inflateInit2( - this.strm, - s.windowBits - ); - if (o !== b.Z_OK) - throw new Error(h[o]); - if (this.header = new E(), n.inflateGetHeader(this.strm, this.header), s.dictionary && (typeof s.dictionary == "string" ? s.dictionary = u.string2buf(s.dictionary) : c.call(s.dictionary) === "[object ArrayBuffer]" && (s.dictionary = new Uint8Array(s.dictionary)), s.raw && (o = n.inflateSetDictionary(this.strm, s.dictionary), o !== b.Z_OK))) - throw new Error(h[o]); - } - S.prototype.push = function(L, s) { - var o = this.strm, A = this.options.chunkSize, p = this.options.dictionary, v, a, l, g, M, C = !1; - if (this.ended) - return !1; - a = s === ~~s ? s : s === !0 ? b.Z_FINISH : b.Z_NO_FLUSH, typeof L == "string" ? o.input = u.binstring2buf(L) : c.call(L) === "[object ArrayBuffer]" ? o.input = new Uint8Array(L) : o.input = L, o.next_in = 0, o.avail_in = o.input.length; - do { - if (o.avail_out === 0 && (o.output = new f.Buf8(A), o.next_out = 0, o.avail_out = A), v = n.inflate(o, b.Z_NO_FLUSH), v === b.Z_NEED_DICT && p && (v = n.inflateSetDictionary(this.strm, p)), v === b.Z_BUF_ERROR && C === !0 && (v = b.Z_OK, C = !1), v !== b.Z_STREAM_END && v !== b.Z_OK) - return this.onEnd(v), this.ended = !0, !1; - o.next_out && (o.avail_out === 0 || v === b.Z_STREAM_END || o.avail_in === 0 && (a === b.Z_FINISH || a === b.Z_SYNC_FLUSH)) && (this.options.to === "string" ? (l = u.utf8border(o.output, o.next_out), g = o.next_out - l, M = u.buf2string(o.output, l), o.next_out = g, o.avail_out = A - g, g && f.arraySet(o.output, o.output, l, g, 0), this.onData(M)) : this.onData(f.shrinkBuf(o.output, o.next_out))), o.avail_in === 0 && o.avail_out === 0 && (C = !0); - } while ((o.avail_in > 0 || o.avail_out === 0) && v !== b.Z_STREAM_END); - return v === b.Z_STREAM_END && (a = b.Z_FINISH), a === b.Z_FINISH ? (v = n.inflateEnd(this.strm), this.onEnd(v), this.ended = !0, v === b.Z_OK) : (a === b.Z_SYNC_FLUSH && (this.onEnd(b.Z_OK), o.avail_out = 0), !0); - }, S.prototype.onData = function(L) { - this.chunks.push(L); - }, S.prototype.onEnd = function(L) { - L === b.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = f.flattenChunks(this.chunks)), this.chunks = [], this.err = L, this.msg = this.strm.msg; - }; - function y(L, s) { - var o = new S(s); - if (o.push(L, !0), o.err) - throw o.msg || h[o.err]; - return o.result; - } - function w(L, s) { - return s = s || {}, s.raw = !0, y(L, s); - } - e.Inflate = S, e.inflate = y, e.inflateRaw = w, e.ungzip = y; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/utils/common.js ***! - \********************************************************************/ - /***/ - (t, e) => { - var r = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u"; - function n(b, h) { - return Object.prototype.hasOwnProperty.call(b, h); - } - e.assign = function(b) { - for (var h = Array.prototype.slice.call(arguments, 1); h.length; ) { - var _ = h.shift(); - if (_) { - if (typeof _ != "object") - throw new TypeError(_ + "must be non-object"); - for (var E in _) - n(_, E) && (b[E] = _[E]); - } - } - return b; - }, e.shrinkBuf = function(b, h) { - return b.length === h ? b : b.subarray ? b.subarray(0, h) : (b.length = h, b); - }; - var f = { - arraySet: function(b, h, _, E, c) { - if (h.subarray && b.subarray) { - b.set(h.subarray(_, _ + E), c); - return; - } - for (var S = 0; S < E; S++) - b[c + S] = h[_ + S]; - }, - // Join array of chunks to single array. - flattenChunks: function(b) { - var h, _, E, c, S, y; - for (E = 0, h = 0, _ = b.length; h < _; h++) - E += b[h].length; - for (y = new Uint8Array(E), c = 0, h = 0, _ = b.length; h < _; h++) - S = b[h], y.set(S, c), c += S.length; - return y; - } - }, u = { - arraySet: function(b, h, _, E, c) { - for (var S = 0; S < E; S++) - b[c + S] = h[_ + S]; - }, - // Join array of chunks to single array. - flattenChunks: function(b) { - return [].concat.apply([], b); - } - }; - e.setTyped = function(b) { - b ? (e.Buf8 = Uint8Array, e.Buf16 = Uint16Array, e.Buf32 = Int32Array, e.assign(e, f)) : (e.Buf8 = Array, e.Buf16 = Array, e.Buf32 = Array, e.assign(e, u)); - }, e.setTyped(r); - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/utils/strings.js": ( - /*!*********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/utils/strings.js ***! - \*********************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ./common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), f = !0, u = !0; - try { - String.fromCharCode.apply(null, [0]); - } catch { - f = !1; - } - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch { - u = !1; - } - for (var b = new n.Buf8(256), h = 0; h < 256; h++) - b[h] = h >= 252 ? 6 : h >= 248 ? 5 : h >= 240 ? 4 : h >= 224 ? 3 : h >= 192 ? 2 : 1; - b[254] = b[254] = 1, e.string2buf = function(E) { - var c, S, y, w, L, s = E.length, o = 0; - for (w = 0; w < s; w++) - S = E.charCodeAt(w), (S & 64512) === 55296 && w + 1 < s && (y = E.charCodeAt(w + 1), (y & 64512) === 56320 && (S = 65536 + (S - 55296 << 10) + (y - 56320), w++)), o += S < 128 ? 1 : S < 2048 ? 2 : S < 65536 ? 3 : 4; - for (c = new n.Buf8(o), L = 0, w = 0; L < o; w++) - S = E.charCodeAt(w), (S & 64512) === 55296 && w + 1 < s && (y = E.charCodeAt(w + 1), (y & 64512) === 56320 && (S = 65536 + (S - 55296 << 10) + (y - 56320), w++)), S < 128 ? c[L++] = S : S < 2048 ? (c[L++] = 192 | S >>> 6, c[L++] = 128 | S & 63) : S < 65536 ? (c[L++] = 224 | S >>> 12, c[L++] = 128 | S >>> 6 & 63, c[L++] = 128 | S & 63) : (c[L++] = 240 | S >>> 18, c[L++] = 128 | S >>> 12 & 63, c[L++] = 128 | S >>> 6 & 63, c[L++] = 128 | S & 63); - return c; - }; - function _(E, c) { - if (c < 65534 && (E.subarray && u || !E.subarray && f)) - return String.fromCharCode.apply(null, n.shrinkBuf(E, c)); - for (var S = "", y = 0; y < c; y++) - S += String.fromCharCode(E[y]); - return S; - } - e.buf2binstring = function(E) { - return _(E, E.length); - }, e.binstring2buf = function(E) { - for (var c = new n.Buf8(E.length), S = 0, y = c.length; S < y; S++) - c[S] = E.charCodeAt(S); - return c; - }, e.buf2string = function(E, c) { - var S, y, w, L, s = c || E.length, o = new Array(s * 2); - for (y = 0, S = 0; S < s; ) { - if (w = E[S++], w < 128) { - o[y++] = w; - continue; - } - if (L = b[w], L > 4) { - o[y++] = 65533, S += L - 1; - continue; - } - for (w &= L === 2 ? 31 : L === 3 ? 15 : 7; L > 1 && S < s; ) - w = w << 6 | E[S++] & 63, L--; - if (L > 1) { - o[y++] = 65533; - continue; - } - w < 65536 ? o[y++] = w : (w -= 65536, o[y++] = 55296 | w >> 10 & 1023, o[y++] = 56320 | w & 1023); - } - return _(o, y); - }, e.utf8border = function(E, c) { - var S; - for (c = c || E.length, c > E.length && (c = E.length), S = c - 1; S >= 0 && (E[S] & 192) === 128; ) - S--; - return S < 0 || S === 0 ? c : S + b[E[S]] > c ? S : c; - }; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js ***! - \********************************************************************/ - /***/ - (t) => { - function e(r, n, f, u) { - for (var b = r & 65535 | 0, h = r >>> 16 & 65535 | 0, _ = 0; f !== 0; ) { - _ = f > 2e3 ? 2e3 : f, f -= _; - do - b = b + n[u++] | 0, h = h + b | 0; - while (--_); - b %= 65521, h %= 65521; - } - return b | h << 16 | 0; - } - t.exports = e; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js": ( - /*!**********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/constants.js ***! - \**********************************************************************/ - /***/ - (t) => { - t.exports = { - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type - }; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js": ( - /*!******************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js ***! - \******************************************************************/ - /***/ - (t) => { - function e() { - for (var f, u = [], b = 0; b < 256; b++) { - f = b; - for (var h = 0; h < 8; h++) - f = f & 1 ? 3988292384 ^ f >>> 1 : f >>> 1; - u[b] = f; - } - return u; - } - var r = e(); - function n(f, u, b, h) { - var _ = r, E = h + b; - f ^= -1; - for (var c = h; c < E; c++) - f = f >>> 8 ^ _[(f ^ u[c]) & 255]; - return f ^ -1; - } - t.exports = n; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/deflate.js ***! - \********************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ../utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), f = r( - /*! ./trees */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js" - ), u = r( - /*! ./adler32 */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js" - ), b = r( - /*! ./crc32 */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js" - ), h = r( - /*! ./messages */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js" - ), _ = 0, E = 1, c = 3, S = 4, y = 5, w = 0, L = 1, s = -2, o = -3, A = -5, p = -1, v = 1, a = 2, l = 3, g = 4, M = 0, C = 2, T = 8, D = 9, I = 15, B = 8, P = 29, z = 256, k = z + 1 + P, N = 30, R = 19, U = 2 * k + 1, W = 15, G = 3, F = 258, V = F + G + 1, J = 32, X = 42, oe = 69, te = 73, ve = 91, se = 103, le = 113, Ce = 666, be = 1, Le = 2, ae = 3, _e = 4, Ee = 3; - function Be($, xe) { - return $.msg = h[xe], xe; - } - function Ne($) { - return ($ << 1) - ($ > 4 ? 9 : 0); - } - function Ge($) { - for (var xe = $.length; --xe >= 0; ) - $[xe] = 0; - } - function ke($) { - var xe = $.state, Me = xe.pending; - Me > $.avail_out && (Me = $.avail_out), Me !== 0 && (n.arraySet($.output, xe.pending_buf, xe.pending_out, Me, $.next_out), $.next_out += Me, xe.pending_out += Me, $.total_out += Me, $.avail_out -= Me, xe.pending -= Me, xe.pending === 0 && (xe.pending_out = 0)); - } - function pe($, xe) { - f._tr_flush_block($, $.block_start >= 0 ? $.block_start : -1, $.strstart - $.block_start, xe), $.block_start = $.strstart, ke($.strm); - } - function de($, xe) { - $.pending_buf[$.pending++] = xe; - } - function ce($, xe) { - $.pending_buf[$.pending++] = xe >>> 8 & 255, $.pending_buf[$.pending++] = xe & 255; - } - function Ae($, xe, Me, Q) { - var fe = $.avail_in; - return fe > Q && (fe = Q), fe === 0 ? 0 : ($.avail_in -= fe, n.arraySet(xe, $.input, $.next_in, fe, Me), $.state.wrap === 1 ? $.adler = u($.adler, xe, fe, Me) : $.state.wrap === 2 && ($.adler = b($.adler, xe, fe, Me)), $.next_in += fe, $.total_in += fe, fe); - } - function Oe($, xe) { - var Me = $.max_chain_length, Q = $.strstart, fe, Te, Ze = $.prev_length, Ke = $.nice_match, je = $.strstart > $.w_size - V ? $.strstart - ($.w_size - V) : 0, Je = $.window, St = $.w_mask, rt = $.prev, it = $.strstart + F, tt = Je[Q + Ze - 1], Et = Je[Q + Ze]; - $.prev_length >= $.good_match && (Me >>= 2), Ke > $.lookahead && (Ke = $.lookahead); - do - if (fe = xe, !(Je[fe + Ze] !== Et || Je[fe + Ze - 1] !== tt || Je[fe] !== Je[Q] || Je[++fe] !== Je[Q + 1])) { - Q += 2, fe++; - do - ; - while (Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Je[++Q] === Je[++fe] && Q < it); - if (Te = F - (it - Q), Q = it - F, Te > Ze) { - if ($.match_start = xe, Ze = Te, Te >= Ke) - break; - tt = Je[Q + Ze - 1], Et = Je[Q + Ze]; - } - } - while ((xe = rt[xe & St]) > je && --Me !== 0); - return Ze <= $.lookahead ? Ze : $.lookahead; - } - function We($) { - var xe = $.w_size, Me, Q, fe, Te, Ze; - do { - if (Te = $.window_size - $.lookahead - $.strstart, $.strstart >= xe + (xe - V)) { - n.arraySet($.window, $.window, xe, xe, 0), $.match_start -= xe, $.strstart -= xe, $.block_start -= xe, Q = $.hash_size, Me = Q; - do - fe = $.head[--Me], $.head[Me] = fe >= xe ? fe - xe : 0; - while (--Q); - Q = xe, Me = Q; - do - fe = $.prev[--Me], $.prev[Me] = fe >= xe ? fe - xe : 0; - while (--Q); - Te += xe; - } - if ($.strm.avail_in === 0) - break; - if (Q = Ae($.strm, $.window, $.strstart + $.lookahead, Te), $.lookahead += Q, $.lookahead + $.insert >= G) - for (Ze = $.strstart - $.insert, $.ins_h = $.window[Ze], $.ins_h = ($.ins_h << $.hash_shift ^ $.window[Ze + 1]) & $.hash_mask; $.insert && ($.ins_h = ($.ins_h << $.hash_shift ^ $.window[Ze + G - 1]) & $.hash_mask, $.prev[Ze & $.w_mask] = $.head[$.ins_h], $.head[$.ins_h] = Ze, Ze++, $.insert--, !($.lookahead + $.insert < G)); ) - ; - } while ($.lookahead < V && $.strm.avail_in !== 0); - } - function Ue($, xe) { - var Me = 65535; - for (Me > $.pending_buf_size - 5 && (Me = $.pending_buf_size - 5); ; ) { - if ($.lookahead <= 1) { - if (We($), $.lookahead === 0 && xe === _) - return be; - if ($.lookahead === 0) - break; - } - $.strstart += $.lookahead, $.lookahead = 0; - var Q = $.block_start + Me; - if (($.strstart === 0 || $.strstart >= Q) && ($.lookahead = $.strstart - Q, $.strstart = Q, pe($, !1), $.strm.avail_out === 0) || $.strstart - $.block_start >= $.w_size - V && (pe($, !1), $.strm.avail_out === 0)) - return be; - } - return $.insert = 0, xe === S ? (pe($, !0), $.strm.avail_out === 0 ? ae : _e) : ($.strstart > $.block_start && (pe($, !1), $.strm.avail_out === 0), be); - } - function Z($, xe) { - for (var Me, Q; ; ) { - if ($.lookahead < V) { - if (We($), $.lookahead < V && xe === _) - return be; - if ($.lookahead === 0) - break; - } - if (Me = 0, $.lookahead >= G && ($.ins_h = ($.ins_h << $.hash_shift ^ $.window[$.strstart + G - 1]) & $.hash_mask, Me = $.prev[$.strstart & $.w_mask] = $.head[$.ins_h], $.head[$.ins_h] = $.strstart), Me !== 0 && $.strstart - Me <= $.w_size - V && ($.match_length = Oe($, Me)), $.match_length >= G) - if (Q = f._tr_tally($, $.strstart - $.match_start, $.match_length - G), $.lookahead -= $.match_length, $.match_length <= $.max_lazy_match && $.lookahead >= G) { - $.match_length--; - do - $.strstart++, $.ins_h = ($.ins_h << $.hash_shift ^ $.window[$.strstart + G - 1]) & $.hash_mask, Me = $.prev[$.strstart & $.w_mask] = $.head[$.ins_h], $.head[$.ins_h] = $.strstart; - while (--$.match_length !== 0); - $.strstart++; - } else - $.strstart += $.match_length, $.match_length = 0, $.ins_h = $.window[$.strstart], $.ins_h = ($.ins_h << $.hash_shift ^ $.window[$.strstart + 1]) & $.hash_mask; - else - Q = f._tr_tally($, 0, $.window[$.strstart]), $.lookahead--, $.strstart++; - if (Q && (pe($, !1), $.strm.avail_out === 0)) - return be; - } - return $.insert = $.strstart < G - 1 ? $.strstart : G - 1, xe === S ? (pe($, !0), $.strm.avail_out === 0 ? ae : _e) : $.last_lit && (pe($, !1), $.strm.avail_out === 0) ? be : Le; - } - function j($, xe) { - for (var Me, Q, fe; ; ) { - if ($.lookahead < V) { - if (We($), $.lookahead < V && xe === _) - return be; - if ($.lookahead === 0) - break; - } - if (Me = 0, $.lookahead >= G && ($.ins_h = ($.ins_h << $.hash_shift ^ $.window[$.strstart + G - 1]) & $.hash_mask, Me = $.prev[$.strstart & $.w_mask] = $.head[$.ins_h], $.head[$.ins_h] = $.strstart), $.prev_length = $.match_length, $.prev_match = $.match_start, $.match_length = G - 1, Me !== 0 && $.prev_length < $.max_lazy_match && $.strstart - Me <= $.w_size - V && ($.match_length = Oe($, Me), $.match_length <= 5 && ($.strategy === v || $.match_length === G && $.strstart - $.match_start > 4096) && ($.match_length = G - 1)), $.prev_length >= G && $.match_length <= $.prev_length) { - fe = $.strstart + $.lookahead - G, Q = f._tr_tally($, $.strstart - 1 - $.prev_match, $.prev_length - G), $.lookahead -= $.prev_length - 1, $.prev_length -= 2; - do - ++$.strstart <= fe && ($.ins_h = ($.ins_h << $.hash_shift ^ $.window[$.strstart + G - 1]) & $.hash_mask, Me = $.prev[$.strstart & $.w_mask] = $.head[$.ins_h], $.head[$.ins_h] = $.strstart); - while (--$.prev_length !== 0); - if ($.match_available = 0, $.match_length = G - 1, $.strstart++, Q && (pe($, !1), $.strm.avail_out === 0)) - return be; - } else if ($.match_available) { - if (Q = f._tr_tally($, 0, $.window[$.strstart - 1]), Q && pe($, !1), $.strstart++, $.lookahead--, $.strm.avail_out === 0) - return be; - } else - $.match_available = 1, $.strstart++, $.lookahead--; - } - return $.match_available && (Q = f._tr_tally($, 0, $.window[$.strstart - 1]), $.match_available = 0), $.insert = $.strstart < G - 1 ? $.strstart : G - 1, xe === S ? (pe($, !0), $.strm.avail_out === 0 ? ae : _e) : $.last_lit && (pe($, !1), $.strm.avail_out === 0) ? be : Le; - } - function ee($, xe) { - for (var Me, Q, fe, Te, Ze = $.window; ; ) { - if ($.lookahead <= F) { - if (We($), $.lookahead <= F && xe === _) - return be; - if ($.lookahead === 0) - break; - } - if ($.match_length = 0, $.lookahead >= G && $.strstart > 0 && (fe = $.strstart - 1, Q = Ze[fe], Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe])) { - Te = $.strstart + F; - do - ; - while (Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && Q === Ze[++fe] && fe < Te); - $.match_length = F - (Te - fe), $.match_length > $.lookahead && ($.match_length = $.lookahead); - } - if ($.match_length >= G ? (Me = f._tr_tally($, 1, $.match_length - G), $.lookahead -= $.match_length, $.strstart += $.match_length, $.match_length = 0) : (Me = f._tr_tally($, 0, $.window[$.strstart]), $.lookahead--, $.strstart++), Me && (pe($, !1), $.strm.avail_out === 0)) - return be; - } - return $.insert = 0, xe === S ? (pe($, !0), $.strm.avail_out === 0 ? ae : _e) : $.last_lit && (pe($, !1), $.strm.avail_out === 0) ? be : Le; - } - function ge($, xe) { - for (var Me; ; ) { - if ($.lookahead === 0 && (We($), $.lookahead === 0)) { - if (xe === _) - return be; - break; - } - if ($.match_length = 0, Me = f._tr_tally($, 0, $.window[$.strstart]), $.lookahead--, $.strstart++, Me && (pe($, !1), $.strm.avail_out === 0)) - return be; - } - return $.insert = 0, xe === S ? (pe($, !0), $.strm.avail_out === 0 ? ae : _e) : $.last_lit && (pe($, !1), $.strm.avail_out === 0) ? be : Le; - } - function ye($, xe, Me, Q, fe) { - this.good_length = $, this.max_lazy = xe, this.nice_length = Me, this.max_chain = Q, this.func = fe; - } - var $e; - $e = [ - /* good lazy nice chain */ - new ye(0, 0, 0, 0, Ue), - /* 0 store only */ - new ye(4, 4, 8, 4, Z), - /* 1 max speed, no lazy matches */ - new ye(4, 5, 16, 8, Z), - /* 2 */ - new ye(4, 6, 32, 32, Z), - /* 3 */ - new ye(4, 4, 16, 16, j), - /* 4 lazy matches */ - new ye(8, 16, 32, 32, j), - /* 5 */ - new ye(8, 16, 128, 128, j), - /* 6 */ - new ye(8, 32, 128, 256, j), - /* 7 */ - new ye(32, 128, 258, 1024, j), - /* 8 */ - new ye(32, 258, 258, 4096, j) - /* 9 max compression */ - ]; - function Re($) { - $.window_size = 2 * $.w_size, Ge($.head), $.max_lazy_match = $e[$.level].max_lazy, $.good_match = $e[$.level].good_length, $.nice_match = $e[$.level].nice_length, $.max_chain_length = $e[$.level].max_chain, $.strstart = 0, $.block_start = 0, $.lookahead = 0, $.insert = 0, $.match_length = $.prev_length = G - 1, $.match_available = 0, $.ins_h = 0; - } - function Y() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = T, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new n.Buf16(U * 2), this.dyn_dtree = new n.Buf16((2 * N + 1) * 2), this.bl_tree = new n.Buf16((2 * R + 1) * 2), Ge(this.dyn_ltree), Ge(this.dyn_dtree), Ge(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new n.Buf16(W + 1), this.heap = new n.Buf16(2 * k + 1), Ge(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new n.Buf16(2 * k + 1), Ge(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - function ue($) { - var xe; - return !$ || !$.state ? Be($, s) : ($.total_in = $.total_out = 0, $.data_type = C, xe = $.state, xe.pending = 0, xe.pending_out = 0, xe.wrap < 0 && (xe.wrap = -xe.wrap), xe.status = xe.wrap ? X : le, $.adler = xe.wrap === 2 ? 0 : 1, xe.last_flush = _, f._tr_init(xe), w); - } - function Se($) { - var xe = ue($); - return xe === w && Re($.state), xe; - } - function Fe($, xe) { - return !$ || !$.state || $.state.wrap !== 2 ? s : ($.state.gzhead = xe, w); - } - function he($, xe, Me, Q, fe, Te) { - if (!$) - return s; - var Ze = 1; - if (xe === p && (xe = 6), Q < 0 ? (Ze = 0, Q = -Q) : Q > 15 && (Ze = 2, Q -= 16), fe < 1 || fe > D || Me !== T || Q < 8 || Q > 15 || xe < 0 || xe > 9 || Te < 0 || Te > g) - return Be($, s); - Q === 8 && (Q = 9); - var Ke = new Y(); - return $.state = Ke, Ke.strm = $, Ke.wrap = Ze, Ke.gzhead = null, Ke.w_bits = Q, Ke.w_size = 1 << Ke.w_bits, Ke.w_mask = Ke.w_size - 1, Ke.hash_bits = fe + 7, Ke.hash_size = 1 << Ke.hash_bits, Ke.hash_mask = Ke.hash_size - 1, Ke.hash_shift = ~~((Ke.hash_bits + G - 1) / G), Ke.window = new n.Buf8(Ke.w_size * 2), Ke.head = new n.Buf16(Ke.hash_size), Ke.prev = new n.Buf16(Ke.w_size), Ke.lit_bufsize = 1 << fe + 6, Ke.pending_buf_size = Ke.lit_bufsize * 4, Ke.pending_buf = new n.Buf8(Ke.pending_buf_size), Ke.d_buf = 1 * Ke.lit_bufsize, Ke.l_buf = 3 * Ke.lit_bufsize, Ke.level = xe, Ke.strategy = Te, Ke.method = Me, Se($); - } - function De($, xe) { - return he($, xe, T, I, B, M); - } - function K($, xe) { - var Me, Q, fe, Te; - if (!$ || !$.state || xe > y || xe < 0) - return $ ? Be($, s) : s; - if (Q = $.state, !$.output || !$.input && $.avail_in !== 0 || Q.status === Ce && xe !== S) - return Be($, $.avail_out === 0 ? A : s); - if (Q.strm = $, Me = Q.last_flush, Q.last_flush = xe, Q.status === X) - if (Q.wrap === 2) - $.adler = 0, de(Q, 31), de(Q, 139), de(Q, 8), Q.gzhead ? (de( - Q, - (Q.gzhead.text ? 1 : 0) + (Q.gzhead.hcrc ? 2 : 0) + (Q.gzhead.extra ? 4 : 0) + (Q.gzhead.name ? 8 : 0) + (Q.gzhead.comment ? 16 : 0) - ), de(Q, Q.gzhead.time & 255), de(Q, Q.gzhead.time >> 8 & 255), de(Q, Q.gzhead.time >> 16 & 255), de(Q, Q.gzhead.time >> 24 & 255), de(Q, Q.level === 9 ? 2 : Q.strategy >= a || Q.level < 2 ? 4 : 0), de(Q, Q.gzhead.os & 255), Q.gzhead.extra && Q.gzhead.extra.length && (de(Q, Q.gzhead.extra.length & 255), de(Q, Q.gzhead.extra.length >> 8 & 255)), Q.gzhead.hcrc && ($.adler = b($.adler, Q.pending_buf, Q.pending, 0)), Q.gzindex = 0, Q.status = oe) : (de(Q, 0), de(Q, 0), de(Q, 0), de(Q, 0), de(Q, 0), de(Q, Q.level === 9 ? 2 : Q.strategy >= a || Q.level < 2 ? 4 : 0), de(Q, Ee), Q.status = le); - else { - var Ze = T + (Q.w_bits - 8 << 4) << 8, Ke = -1; - Q.strategy >= a || Q.level < 2 ? Ke = 0 : Q.level < 6 ? Ke = 1 : Q.level === 6 ? Ke = 2 : Ke = 3, Ze |= Ke << 6, Q.strstart !== 0 && (Ze |= J), Ze += 31 - Ze % 31, Q.status = le, ce(Q, Ze), Q.strstart !== 0 && (ce(Q, $.adler >>> 16), ce(Q, $.adler & 65535)), $.adler = 1; - } - if (Q.status === oe) - if (Q.gzhead.extra) { - for (fe = Q.pending; Q.gzindex < (Q.gzhead.extra.length & 65535) && !(Q.pending === Q.pending_buf_size && (Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), ke($), fe = Q.pending, Q.pending === Q.pending_buf_size)); ) - de(Q, Q.gzhead.extra[Q.gzindex] & 255), Q.gzindex++; - Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), Q.gzindex === Q.gzhead.extra.length && (Q.gzindex = 0, Q.status = te); - } else - Q.status = te; - if (Q.status === te) - if (Q.gzhead.name) { - fe = Q.pending; - do { - if (Q.pending === Q.pending_buf_size && (Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), ke($), fe = Q.pending, Q.pending === Q.pending_buf_size)) { - Te = 1; - break; - } - Q.gzindex < Q.gzhead.name.length ? Te = Q.gzhead.name.charCodeAt(Q.gzindex++) & 255 : Te = 0, de(Q, Te); - } while (Te !== 0); - Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), Te === 0 && (Q.gzindex = 0, Q.status = ve); - } else - Q.status = ve; - if (Q.status === ve) - if (Q.gzhead.comment) { - fe = Q.pending; - do { - if (Q.pending === Q.pending_buf_size && (Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), ke($), fe = Q.pending, Q.pending === Q.pending_buf_size)) { - Te = 1; - break; - } - Q.gzindex < Q.gzhead.comment.length ? Te = Q.gzhead.comment.charCodeAt(Q.gzindex++) & 255 : Te = 0, de(Q, Te); - } while (Te !== 0); - Q.gzhead.hcrc && Q.pending > fe && ($.adler = b($.adler, Q.pending_buf, Q.pending - fe, fe)), Te === 0 && (Q.status = se); - } else - Q.status = se; - if (Q.status === se && (Q.gzhead.hcrc ? (Q.pending + 2 > Q.pending_buf_size && ke($), Q.pending + 2 <= Q.pending_buf_size && (de(Q, $.adler & 255), de(Q, $.adler >> 8 & 255), $.adler = 0, Q.status = le)) : Q.status = le), Q.pending !== 0) { - if (ke($), $.avail_out === 0) - return Q.last_flush = -1, w; - } else if ($.avail_in === 0 && Ne(xe) <= Ne(Me) && xe !== S) - return Be($, A); - if (Q.status === Ce && $.avail_in !== 0) - return Be($, A); - if ($.avail_in !== 0 || Q.lookahead !== 0 || xe !== _ && Q.status !== Ce) { - var je = Q.strategy === a ? ge(Q, xe) : Q.strategy === l ? ee(Q, xe) : $e[Q.level].func(Q, xe); - if ((je === ae || je === _e) && (Q.status = Ce), je === be || je === ae) - return $.avail_out === 0 && (Q.last_flush = -1), w; - if (je === Le && (xe === E ? f._tr_align(Q) : xe !== y && (f._tr_stored_block(Q, 0, 0, !1), xe === c && (Ge(Q.head), Q.lookahead === 0 && (Q.strstart = 0, Q.block_start = 0, Q.insert = 0))), ke($), $.avail_out === 0)) - return Q.last_flush = -1, w; - } - return xe !== S ? w : Q.wrap <= 0 ? L : (Q.wrap === 2 ? (de(Q, $.adler & 255), de(Q, $.adler >> 8 & 255), de(Q, $.adler >> 16 & 255), de(Q, $.adler >> 24 & 255), de(Q, $.total_in & 255), de(Q, $.total_in >> 8 & 255), de(Q, $.total_in >> 16 & 255), de(Q, $.total_in >> 24 & 255)) : (ce(Q, $.adler >>> 16), ce(Q, $.adler & 65535)), ke($), Q.wrap > 0 && (Q.wrap = -Q.wrap), Q.pending !== 0 ? w : L); - } - function ze($) { - var xe; - return !$ || !$.state ? s : (xe = $.state.status, xe !== X && xe !== oe && xe !== te && xe !== ve && xe !== se && xe !== le && xe !== Ce ? Be($, s) : ($.state = null, xe === le ? Be($, o) : w)); - } - function Ve($, xe) { - var Me = xe.length, Q, fe, Te, Ze, Ke, je, Je, St; - if (!$ || !$.state || (Q = $.state, Ze = Q.wrap, Ze === 2 || Ze === 1 && Q.status !== X || Q.lookahead)) - return s; - for (Ze === 1 && ($.adler = u($.adler, xe, Me, 0)), Q.wrap = 0, Me >= Q.w_size && (Ze === 0 && (Ge(Q.head), Q.strstart = 0, Q.block_start = 0, Q.insert = 0), St = new n.Buf8(Q.w_size), n.arraySet(St, xe, Me - Q.w_size, Q.w_size, 0), xe = St, Me = Q.w_size), Ke = $.avail_in, je = $.next_in, Je = $.input, $.avail_in = Me, $.next_in = 0, $.input = xe, We(Q); Q.lookahead >= G; ) { - fe = Q.strstart, Te = Q.lookahead - (G - 1); - do - Q.ins_h = (Q.ins_h << Q.hash_shift ^ Q.window[fe + G - 1]) & Q.hash_mask, Q.prev[fe & Q.w_mask] = Q.head[Q.ins_h], Q.head[Q.ins_h] = fe, fe++; - while (--Te); - Q.strstart = fe, Q.lookahead = G - 1, We(Q); - } - return Q.strstart += Q.lookahead, Q.block_start = Q.strstart, Q.insert = Q.lookahead, Q.lookahead = 0, Q.match_length = Q.prev_length = G - 1, Q.match_available = 0, $.next_in = je, $.input = Je, $.avail_in = Ke, Q.wrap = Ze, w; - } - e.deflateInit = De, e.deflateInit2 = he, e.deflateReset = Se, e.deflateResetKeep = ue, e.deflateSetHeader = Fe, e.deflate = K, e.deflateEnd = ze, e.deflateSetDictionary = Ve, e.deflateInfo = "pako deflate (from Nodeca project)"; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js": ( - /*!*********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/gzheader.js ***! - \*********************************************************************/ - /***/ - (t) => { - function e() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1; - } - t.exports = e; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js ***! - \********************************************************************/ - /***/ - (t) => { - var e = 30, r = 12; - t.exports = function(f, u) { - var b, h, _, E, c, S, y, w, L, s, o, A, p, v, a, l, g, M, C, T, D, I, B, P, z; - b = f.state, h = f.next_in, P = f.input, _ = h + (f.avail_in - 5), E = f.next_out, z = f.output, c = E - (u - f.avail_out), S = E + (f.avail_out - 257), y = b.dmax, w = b.wsize, L = b.whave, s = b.wnext, o = b.window, A = b.hold, p = b.bits, v = b.lencode, a = b.distcode, l = (1 << b.lenbits) - 1, g = (1 << b.distbits) - 1; - e: - do { - p < 15 && (A += P[h++] << p, p += 8, A += P[h++] << p, p += 8), M = v[A & l]; - t: - for (; ; ) { - if (C = M >>> 24, A >>>= C, p -= C, C = M >>> 16 & 255, C === 0) - z[E++] = M & 65535; - else if (C & 16) { - T = M & 65535, C &= 15, C && (p < C && (A += P[h++] << p, p += 8), T += A & (1 << C) - 1, A >>>= C, p -= C), p < 15 && (A += P[h++] << p, p += 8, A += P[h++] << p, p += 8), M = a[A & g]; - r: - for (; ; ) { - if (C = M >>> 24, A >>>= C, p -= C, C = M >>> 16 & 255, C & 16) { - if (D = M & 65535, C &= 15, p < C && (A += P[h++] << p, p += 8, p < C && (A += P[h++] << p, p += 8)), D += A & (1 << C) - 1, D > y) { - f.msg = "invalid distance too far back", b.mode = e; - break e; - } - if (A >>>= C, p -= C, C = E - c, D > C) { - if (C = D - C, C > L && b.sane) { - f.msg = "invalid distance too far back", b.mode = e; - break e; - } - if (I = 0, B = o, s === 0) { - if (I += w - C, C < T) { - T -= C; - do - z[E++] = o[I++]; - while (--C); - I = E - D, B = z; - } - } else if (s < C) { - if (I += w + s - C, C -= s, C < T) { - T -= C; - do - z[E++] = o[I++]; - while (--C); - if (I = 0, s < T) { - C = s, T -= C; - do - z[E++] = o[I++]; - while (--C); - I = E - D, B = z; - } - } - } else if (I += s - C, C < T) { - T -= C; - do - z[E++] = o[I++]; - while (--C); - I = E - D, B = z; - } - for (; T > 2; ) - z[E++] = B[I++], z[E++] = B[I++], z[E++] = B[I++], T -= 3; - T && (z[E++] = B[I++], T > 1 && (z[E++] = B[I++])); - } else { - I = E - D; - do - z[E++] = z[I++], z[E++] = z[I++], z[E++] = z[I++], T -= 3; - while (T > 2); - T && (z[E++] = z[I++], T > 1 && (z[E++] = z[I++])); - } - } else if (C & 64) { - f.msg = "invalid distance code", b.mode = e; - break e; - } else { - M = a[(M & 65535) + (A & (1 << C) - 1)]; - continue r; - } - break; - } - } else if (C & 64) - if (C & 32) { - b.mode = r; - break e; - } else { - f.msg = "invalid literal/length code", b.mode = e; - break e; - } - else { - M = v[(M & 65535) + (A & (1 << C) - 1)]; - continue t; - } - break; - } - } while (h < _ && E < S); - T = p >> 3, h -= T, p -= T << 3, A &= (1 << p) - 1, f.next_in = h, f.next_out = E, f.avail_in = h < _ ? 5 + (_ - h) : 5 - (h - _), f.avail_out = E < S ? 257 + (S - E) : 257 - (E - S), b.hold = A, b.bits = p; - }; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inflate.js ***! - \********************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ../utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), f = r( - /*! ./adler32 */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/adler32.js" - ), u = r( - /*! ./crc32 */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/crc32.js" - ), b = r( - /*! ./inffast */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inffast.js" - ), h = r( - /*! ./inftrees */ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js" - ), _ = 0, E = 1, c = 2, S = 4, y = 5, w = 6, L = 0, s = 1, o = 2, A = -2, p = -3, v = -4, a = -5, l = 8, g = 1, M = 2, C = 3, T = 4, D = 5, I = 6, B = 7, P = 8, z = 9, k = 10, N = 11, R = 12, U = 13, W = 14, G = 15, F = 16, V = 17, J = 18, X = 19, oe = 20, te = 21, ve = 22, se = 23, le = 24, Ce = 25, be = 26, Le = 27, ae = 28, _e = 29, Ee = 30, Be = 31, Ne = 32, Ge = 852, ke = 592, pe = 15, de = pe; - function ce(he) { - return (he >>> 24 & 255) + (he >>> 8 & 65280) + ((he & 65280) << 8) + ((he & 255) << 24); - } - function Ae() { - this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new n.Buf16(320), this.work = new n.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - function Oe(he) { - var De; - return !he || !he.state ? A : (De = he.state, he.total_in = he.total_out = De.total = 0, he.msg = "", De.wrap && (he.adler = De.wrap & 1), De.mode = g, De.last = 0, De.havedict = 0, De.dmax = 32768, De.head = null, De.hold = 0, De.bits = 0, De.lencode = De.lendyn = new n.Buf32(Ge), De.distcode = De.distdyn = new n.Buf32(ke), De.sane = 1, De.back = -1, L); - } - function We(he) { - var De; - return !he || !he.state ? A : (De = he.state, De.wsize = 0, De.whave = 0, De.wnext = 0, Oe(he)); - } - function Ue(he, De) { - var K, ze; - return !he || !he.state || (ze = he.state, De < 0 ? (K = 0, De = -De) : (K = (De >> 4) + 1, De < 48 && (De &= 15)), De && (De < 8 || De > 15)) ? A : (ze.window !== null && ze.wbits !== De && (ze.window = null), ze.wrap = K, ze.wbits = De, We(he)); - } - function Z(he, De) { - var K, ze; - return he ? (ze = new Ae(), he.state = ze, ze.window = null, K = Ue(he, De), K !== L && (he.state = null), K) : A; - } - function j(he) { - return Z(he, de); - } - var ee = !0, ge, ye; - function $e(he) { - if (ee) { - var De; - for (ge = new n.Buf32(512), ye = new n.Buf32(32), De = 0; De < 144; ) - he.lens[De++] = 8; - for (; De < 256; ) - he.lens[De++] = 9; - for (; De < 280; ) - he.lens[De++] = 7; - for (; De < 288; ) - he.lens[De++] = 8; - for (h(E, he.lens, 0, 288, ge, 0, he.work, { bits: 9 }), De = 0; De < 32; ) - he.lens[De++] = 5; - h(c, he.lens, 0, 32, ye, 0, he.work, { bits: 5 }), ee = !1; - } - he.lencode = ge, he.lenbits = 9, he.distcode = ye, he.distbits = 5; - } - function Re(he, De, K, ze) { - var Ve, $ = he.state; - return $.window === null && ($.wsize = 1 << $.wbits, $.wnext = 0, $.whave = 0, $.window = new n.Buf8($.wsize)), ze >= $.wsize ? (n.arraySet($.window, De, K - $.wsize, $.wsize, 0), $.wnext = 0, $.whave = $.wsize) : (Ve = $.wsize - $.wnext, Ve > ze && (Ve = ze), n.arraySet($.window, De, K - ze, Ve, $.wnext), ze -= Ve, ze ? (n.arraySet($.window, De, K - ze, ze, 0), $.wnext = ze, $.whave = $.wsize) : ($.wnext += Ve, $.wnext === $.wsize && ($.wnext = 0), $.whave < $.wsize && ($.whave += Ve))), 0; - } - function Y(he, De) { - var K, ze, Ve, $, xe, Me, Q, fe, Te, Ze, Ke, je, Je, St, rt = 0, it, tt, Et, lt, wt, Pt, vt, bt, mt = new n.Buf8(4), Tt, Ot, kt = ( - /* permutation of code lengths */ - [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] - ); - if (!he || !he.state || !he.output || !he.input && he.avail_in !== 0) - return A; - K = he.state, K.mode === R && (K.mode = U), xe = he.next_out, Ve = he.output, Q = he.avail_out, $ = he.next_in, ze = he.input, Me = he.avail_in, fe = K.hold, Te = K.bits, Ze = Me, Ke = Q, bt = L; - e: - for (; ; ) - switch (K.mode) { - case g: - if (K.wrap === 0) { - K.mode = U; - break; - } - for (; Te < 16; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (K.wrap & 2 && fe === 35615) { - K.check = 0, mt[0] = fe & 255, mt[1] = fe >>> 8 & 255, K.check = u(K.check, mt, 2, 0), fe = 0, Te = 0, K.mode = M; - break; - } - if (K.flags = 0, K.head && (K.head.done = !1), !(K.wrap & 1) || /* check if zlib header allowed */ - (((fe & 255) << 8) + (fe >> 8)) % 31) { - he.msg = "incorrect header check", K.mode = Ee; - break; - } - if ((fe & 15) !== l) { - he.msg = "unknown compression method", K.mode = Ee; - break; - } - if (fe >>>= 4, Te -= 4, vt = (fe & 15) + 8, K.wbits === 0) - K.wbits = vt; - else if (vt > K.wbits) { - he.msg = "invalid window size", K.mode = Ee; - break; - } - K.dmax = 1 << vt, he.adler = K.check = 1, K.mode = fe & 512 ? k : R, fe = 0, Te = 0; - break; - case M: - for (; Te < 16; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (K.flags = fe, (K.flags & 255) !== l) { - he.msg = "unknown compression method", K.mode = Ee; - break; - } - if (K.flags & 57344) { - he.msg = "unknown header flags set", K.mode = Ee; - break; - } - K.head && (K.head.text = fe >> 8 & 1), K.flags & 512 && (mt[0] = fe & 255, mt[1] = fe >>> 8 & 255, K.check = u(K.check, mt, 2, 0)), fe = 0, Te = 0, K.mode = C; - case C: - for (; Te < 32; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.head && (K.head.time = fe), K.flags & 512 && (mt[0] = fe & 255, mt[1] = fe >>> 8 & 255, mt[2] = fe >>> 16 & 255, mt[3] = fe >>> 24 & 255, K.check = u(K.check, mt, 4, 0)), fe = 0, Te = 0, K.mode = T; - case T: - for (; Te < 16; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.head && (K.head.xflags = fe & 255, K.head.os = fe >> 8), K.flags & 512 && (mt[0] = fe & 255, mt[1] = fe >>> 8 & 255, K.check = u(K.check, mt, 2, 0)), fe = 0, Te = 0, K.mode = D; - case D: - if (K.flags & 1024) { - for (; Te < 16; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.length = fe, K.head && (K.head.extra_len = fe), K.flags & 512 && (mt[0] = fe & 255, mt[1] = fe >>> 8 & 255, K.check = u(K.check, mt, 2, 0)), fe = 0, Te = 0; - } else - K.head && (K.head.extra = null); - K.mode = I; - case I: - if (K.flags & 1024 && (je = K.length, je > Me && (je = Me), je && (K.head && (vt = K.head.extra_len - K.length, K.head.extra || (K.head.extra = new Array(K.head.extra_len)), n.arraySet( - K.head.extra, - ze, - $, - // extra field is limited to 65536 bytes - // - no need for additional size check - je, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - vt - )), K.flags & 512 && (K.check = u(K.check, ze, je, $)), Me -= je, $ += je, K.length -= je), K.length)) - break e; - K.length = 0, K.mode = B; - case B: - if (K.flags & 2048) { - if (Me === 0) - break e; - je = 0; - do - vt = ze[$ + je++], K.head && vt && K.length < 65536 && (K.head.name += String.fromCharCode(vt)); - while (vt && je < Me); - if (K.flags & 512 && (K.check = u(K.check, ze, je, $)), Me -= je, $ += je, vt) - break e; - } else - K.head && (K.head.name = null); - K.length = 0, K.mode = P; - case P: - if (K.flags & 4096) { - if (Me === 0) - break e; - je = 0; - do - vt = ze[$ + je++], K.head && vt && K.length < 65536 && (K.head.comment += String.fromCharCode(vt)); - while (vt && je < Me); - if (K.flags & 512 && (K.check = u(K.check, ze, je, $)), Me -= je, $ += je, vt) - break e; - } else - K.head && (K.head.comment = null); - K.mode = z; - case z: - if (K.flags & 512) { - for (; Te < 16; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (fe !== (K.check & 65535)) { - he.msg = "header crc mismatch", K.mode = Ee; - break; - } - fe = 0, Te = 0; - } - K.head && (K.head.hcrc = K.flags >> 9 & 1, K.head.done = !0), he.adler = K.check = 0, K.mode = R; - break; - case k: - for (; Te < 32; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - he.adler = K.check = ce(fe), fe = 0, Te = 0, K.mode = N; - case N: - if (K.havedict === 0) - return he.next_out = xe, he.avail_out = Q, he.next_in = $, he.avail_in = Me, K.hold = fe, K.bits = Te, o; - he.adler = K.check = 1, K.mode = R; - case R: - if (De === y || De === w) - break e; - case U: - if (K.last) { - fe >>>= Te & 7, Te -= Te & 7, K.mode = Le; - break; - } - for (; Te < 3; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - switch (K.last = fe & 1, fe >>>= 1, Te -= 1, fe & 3) { - case 0: - K.mode = W; - break; - case 1: - if ($e(K), K.mode = oe, De === w) { - fe >>>= 2, Te -= 2; - break e; - } - break; - case 2: - K.mode = V; - break; - case 3: - he.msg = "invalid block type", K.mode = Ee; - } - fe >>>= 2, Te -= 2; - break; - case W: - for (fe >>>= Te & 7, Te -= Te & 7; Te < 32; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if ((fe & 65535) !== (fe >>> 16 ^ 65535)) { - he.msg = "invalid stored block lengths", K.mode = Ee; - break; - } - if (K.length = fe & 65535, fe = 0, Te = 0, K.mode = G, De === w) - break e; - case G: - K.mode = F; - case F: - if (je = K.length, je) { - if (je > Me && (je = Me), je > Q && (je = Q), je === 0) - break e; - n.arraySet(Ve, ze, $, je, xe), Me -= je, $ += je, Q -= je, xe += je, K.length -= je; - break; - } - K.mode = R; - break; - case V: - for (; Te < 14; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (K.nlen = (fe & 31) + 257, fe >>>= 5, Te -= 5, K.ndist = (fe & 31) + 1, fe >>>= 5, Te -= 5, K.ncode = (fe & 15) + 4, fe >>>= 4, Te -= 4, K.nlen > 286 || K.ndist > 30) { - he.msg = "too many length or distance symbols", K.mode = Ee; - break; - } - K.have = 0, K.mode = J; - case J: - for (; K.have < K.ncode; ) { - for (; Te < 3; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.lens[kt[K.have++]] = fe & 7, fe >>>= 3, Te -= 3; - } - for (; K.have < 19; ) - K.lens[kt[K.have++]] = 0; - if (K.lencode = K.lendyn, K.lenbits = 7, Tt = { bits: K.lenbits }, bt = h(_, K.lens, 0, 19, K.lencode, 0, K.work, Tt), K.lenbits = Tt.bits, bt) { - he.msg = "invalid code lengths set", K.mode = Ee; - break; - } - K.have = 0, K.mode = X; - case X: - for (; K.have < K.nlen + K.ndist; ) { - for (; rt = K.lencode[fe & (1 << K.lenbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Te); ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (Et < 16) - fe >>>= it, Te -= it, K.lens[K.have++] = Et; - else { - if (Et === 16) { - for (Ot = it + 2; Te < Ot; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (fe >>>= it, Te -= it, K.have === 0) { - he.msg = "invalid bit length repeat", K.mode = Ee; - break; - } - vt = K.lens[K.have - 1], je = 3 + (fe & 3), fe >>>= 2, Te -= 2; - } else if (Et === 17) { - for (Ot = it + 3; Te < Ot; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - fe >>>= it, Te -= it, vt = 0, je = 3 + (fe & 7), fe >>>= 3, Te -= 3; - } else { - for (Ot = it + 7; Te < Ot; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - fe >>>= it, Te -= it, vt = 0, je = 11 + (fe & 127), fe >>>= 7, Te -= 7; - } - if (K.have + je > K.nlen + K.ndist) { - he.msg = "invalid bit length repeat", K.mode = Ee; - break; - } - for (; je--; ) - K.lens[K.have++] = vt; - } - } - if (K.mode === Ee) - break; - if (K.lens[256] === 0) { - he.msg = "invalid code -- missing end-of-block", K.mode = Ee; - break; - } - if (K.lenbits = 9, Tt = { bits: K.lenbits }, bt = h(E, K.lens, 0, K.nlen, K.lencode, 0, K.work, Tt), K.lenbits = Tt.bits, bt) { - he.msg = "invalid literal/lengths set", K.mode = Ee; - break; - } - if (K.distbits = 6, K.distcode = K.distdyn, Tt = { bits: K.distbits }, bt = h(c, K.lens, K.nlen, K.ndist, K.distcode, 0, K.work, Tt), K.distbits = Tt.bits, bt) { - he.msg = "invalid distances set", K.mode = Ee; - break; - } - if (K.mode = oe, De === w) - break e; - case oe: - K.mode = te; - case te: - if (Me >= 6 && Q >= 258) { - he.next_out = xe, he.avail_out = Q, he.next_in = $, he.avail_in = Me, K.hold = fe, K.bits = Te, b(he, Ke), xe = he.next_out, Ve = he.output, Q = he.avail_out, $ = he.next_in, ze = he.input, Me = he.avail_in, fe = K.hold, Te = K.bits, K.mode === R && (K.back = -1); - break; - } - for (K.back = 0; rt = K.lencode[fe & (1 << K.lenbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Te); ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (tt && !(tt & 240)) { - for (lt = it, wt = tt, Pt = Et; rt = K.lencode[Pt + ((fe & (1 << lt + wt) - 1) >> lt)], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(lt + it <= Te); ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - fe >>>= lt, Te -= lt, K.back += lt; - } - if (fe >>>= it, Te -= it, K.back += it, K.length = Et, tt === 0) { - K.mode = be; - break; - } - if (tt & 32) { - K.back = -1, K.mode = R; - break; - } - if (tt & 64) { - he.msg = "invalid literal/length code", K.mode = Ee; - break; - } - K.extra = tt & 15, K.mode = ve; - case ve: - if (K.extra) { - for (Ot = K.extra; Te < Ot; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.length += fe & (1 << K.extra) - 1, fe >>>= K.extra, Te -= K.extra, K.back += K.extra; - } - K.was = K.length, K.mode = se; - case se: - for (; rt = K.distcode[fe & (1 << K.distbits) - 1], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(it <= Te); ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (!(tt & 240)) { - for (lt = it, wt = tt, Pt = Et; rt = K.distcode[Pt + ((fe & (1 << lt + wt) - 1) >> lt)], it = rt >>> 24, tt = rt >>> 16 & 255, Et = rt & 65535, !(lt + it <= Te); ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - fe >>>= lt, Te -= lt, K.back += lt; - } - if (fe >>>= it, Te -= it, K.back += it, tt & 64) { - he.msg = "invalid distance code", K.mode = Ee; - break; - } - K.offset = Et, K.extra = tt & 15, K.mode = le; - case le: - if (K.extra) { - for (Ot = K.extra; Te < Ot; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - K.offset += fe & (1 << K.extra) - 1, fe >>>= K.extra, Te -= K.extra, K.back += K.extra; - } - if (K.offset > K.dmax) { - he.msg = "invalid distance too far back", K.mode = Ee; - break; - } - K.mode = Ce; - case Ce: - if (Q === 0) - break e; - if (je = Ke - Q, K.offset > je) { - if (je = K.offset - je, je > K.whave && K.sane) { - he.msg = "invalid distance too far back", K.mode = Ee; - break; - } - je > K.wnext ? (je -= K.wnext, Je = K.wsize - je) : Je = K.wnext - je, je > K.length && (je = K.length), St = K.window; - } else - St = Ve, Je = xe - K.offset, je = K.length; - je > Q && (je = Q), Q -= je, K.length -= je; - do - Ve[xe++] = St[Je++]; - while (--je); - K.length === 0 && (K.mode = te); - break; - case be: - if (Q === 0) - break e; - Ve[xe++] = K.length, Q--, K.mode = te; - break; - case Le: - if (K.wrap) { - for (; Te < 32; ) { - if (Me === 0) - break e; - Me--, fe |= ze[$++] << Te, Te += 8; - } - if (Ke -= Q, he.total_out += Ke, K.total += Ke, Ke && (he.adler = K.check = /*UPDATE(state.check, put - _out, _out);*/ - K.flags ? u(K.check, Ve, Ke, xe - Ke) : f(K.check, Ve, Ke, xe - Ke)), Ke = Q, (K.flags ? fe : ce(fe)) !== K.check) { - he.msg = "incorrect data check", K.mode = Ee; - break; - } - fe = 0, Te = 0; - } - K.mode = ae; - case ae: - if (K.wrap && K.flags) { - for (; Te < 32; ) { - if (Me === 0) - break e; - Me--, fe += ze[$++] << Te, Te += 8; - } - if (fe !== (K.total & 4294967295)) { - he.msg = "incorrect length check", K.mode = Ee; - break; - } - fe = 0, Te = 0; - } - K.mode = _e; - case _e: - bt = s; - break e; - case Ee: - bt = p; - break e; - case Be: - return v; - case Ne: - default: - return A; - } - return he.next_out = xe, he.avail_out = Q, he.next_in = $, he.avail_in = Me, K.hold = fe, K.bits = Te, (K.wsize || Ke !== he.avail_out && K.mode < Ee && (K.mode < Le || De !== S)) && Re(he, he.output, he.next_out, Ke - he.avail_out), Ze -= he.avail_in, Ke -= he.avail_out, he.total_in += Ze, he.total_out += Ke, K.total += Ke, K.wrap && Ke && (he.adler = K.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - K.flags ? u(K.check, Ve, Ke, he.next_out - Ke) : f(K.check, Ve, Ke, he.next_out - Ke)), he.data_type = K.bits + (K.last ? 64 : 0) + (K.mode === R ? 128 : 0) + (K.mode === oe || K.mode === G ? 256 : 0), (Ze === 0 && Ke === 0 || De === S) && bt === L && (bt = a), bt; - } - function ue(he) { - if (!he || !he.state) - return A; - var De = he.state; - return De.window && (De.window = null), he.state = null, L; - } - function Se(he, De) { - var K; - return !he || !he.state || (K = he.state, !(K.wrap & 2)) ? A : (K.head = De, De.done = !1, L); - } - function Fe(he, De) { - var K = De.length, ze, Ve, $; - return !he || !he.state || (ze = he.state, ze.wrap !== 0 && ze.mode !== N) ? A : ze.mode === N && (Ve = 1, Ve = f(Ve, De, K, 0), Ve !== ze.check) ? p : ($ = Re(he, De, K, K), $ ? (ze.mode = Be, v) : (ze.havedict = 1, L)); - } - e.inflateReset = We, e.inflateReset2 = Ue, e.inflateResetKeep = Oe, e.inflateInit = j, e.inflateInit2 = Z, e.inflate = Y, e.inflateEnd = ue, e.inflateGetHeader = Se, e.inflateSetDictionary = Fe, e.inflateInfo = "pako inflate (from Nodeca project)"; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js": ( - /*!*********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/inftrees.js ***! - \*********************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ../utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), f = 15, u = 852, b = 592, h = 0, _ = 1, E = 2, c = [ - /* Length codes 257..285 base */ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 13, - 15, - 17, - 19, - 23, - 27, - 31, - 35, - 43, - 51, - 59, - 67, - 83, - 99, - 115, - 131, - 163, - 195, - 227, - 258, - 0, - 0 - ], S = [ - /* Length codes 257..285 extra */ - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 17, - 17, - 17, - 17, - 18, - 18, - 18, - 18, - 19, - 19, - 19, - 19, - 20, - 20, - 20, - 20, - 21, - 21, - 21, - 21, - 16, - 72, - 78 - ], y = [ - /* Distance codes 0..29 base */ - 1, - 2, - 3, - 4, - 5, - 7, - 9, - 13, - 17, - 25, - 33, - 49, - 65, - 97, - 129, - 193, - 257, - 385, - 513, - 769, - 1025, - 1537, - 2049, - 3073, - 4097, - 6145, - 8193, - 12289, - 16385, - 24577, - 0, - 0 - ], w = [ - /* Distance codes 0..29 extra */ - 16, - 16, - 16, - 16, - 17, - 17, - 18, - 18, - 19, - 19, - 20, - 20, - 21, - 21, - 22, - 22, - 23, - 23, - 24, - 24, - 25, - 25, - 26, - 26, - 27, - 27, - 28, - 28, - 29, - 29, - 64, - 64 - ]; - t.exports = function(s, o, A, p, v, a, l, g) { - var M = g.bits, C = 0, T = 0, D = 0, I = 0, B = 0, P = 0, z = 0, k = 0, N = 0, R = 0, U, W, G, F, V, J = null, X = 0, oe, te = new n.Buf16(f + 1), ve = new n.Buf16(f + 1), se = null, le = 0, Ce, be, Le; - for (C = 0; C <= f; C++) - te[C] = 0; - for (T = 0; T < p; T++) - te[o[A + T]]++; - for (B = M, I = f; I >= 1 && te[I] === 0; I--) - ; - if (B > I && (B = I), I === 0) - return v[a++] = 20971520, v[a++] = 20971520, g.bits = 1, 0; - for (D = 1; D < I && te[D] === 0; D++) - ; - for (B < D && (B = D), k = 1, C = 1; C <= f; C++) - if (k <<= 1, k -= te[C], k < 0) - return -1; - if (k > 0 && (s === h || I !== 1)) - return -1; - for (ve[1] = 0, C = 1; C < f; C++) - ve[C + 1] = ve[C] + te[C]; - for (T = 0; T < p; T++) - o[A + T] !== 0 && (l[ve[o[A + T]]++] = T); - if (s === h ? (J = se = l, oe = 19) : s === _ ? (J = c, X -= 257, se = S, le -= 257, oe = 256) : (J = y, se = w, oe = -1), R = 0, T = 0, C = D, V = a, P = B, z = 0, G = -1, N = 1 << B, F = N - 1, s === _ && N > u || s === E && N > b) - return 1; - for (; ; ) { - Ce = C - z, l[T] < oe ? (be = 0, Le = l[T]) : l[T] > oe ? (be = se[le + l[T]], Le = J[X + l[T]]) : (be = 96, Le = 0), U = 1 << C - z, W = 1 << P, D = W; - do - W -= U, v[V + (R >> z) + W] = Ce << 24 | be << 16 | Le | 0; - while (W !== 0); - for (U = 1 << C - 1; R & U; ) - U >>= 1; - if (U !== 0 ? (R &= U - 1, R += U) : R = 0, T++, --te[C] === 0) { - if (C === I) - break; - C = o[A + l[T]]; - } - if (C > B && (R & F) !== G) { - for (z === 0 && (z = B), V += D, P = C - z, k = 1 << P; P + z < I && (k -= te[P + z], !(k <= 0)); ) - P++, k <<= 1; - if (N += 1 << P, s === _ && N > u || s === E && N > b) - return 1; - G = R & F, v[G] = B << 24 | P << 16 | V - a | 0; - } - } - return R !== 0 && (v[V + R] = C - z << 24 | 4194304 | 0), g.bits = B, 0; - }; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js": ( - /*!*********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/messages.js ***! - \*********************************************************************/ - /***/ - (t) => { - t.exports = { - 2: "need dictionary", - /* Z_NEED_DICT 2 */ - 1: "stream end", - /* Z_STREAM_END 1 */ - 0: "", - /* Z_OK 0 */ - "-1": "file error", - /* Z_ERRNO (-1) */ - "-2": "stream error", - /* Z_STREAM_ERROR (-2) */ - "-3": "data error", - /* Z_DATA_ERROR (-3) */ - "-4": "insufficient memory", - /* Z_MEM_ERROR (-4) */ - "-5": "buffer error", - /* Z_BUF_ERROR (-5) */ - "-6": "incompatible version" - /* Z_VERSION_ERROR (-6) */ - }; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js": ( - /*!******************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/trees.js ***! - \******************************************************************/ - /***/ - (t, e, r) => { - var n = r( - /*! ../utils/common */ - "./node_modules/upng-js/node_modules/pako/lib/utils/common.js" - ), f = 4, u = 0, b = 1, h = 2; - function _(Y) { - for (var ue = Y.length; --ue >= 0; ) - Y[ue] = 0; - } - var E = 0, c = 1, S = 2, y = 3, w = 258, L = 29, s = 256, o = s + 1 + L, A = 30, p = 19, v = 2 * o + 1, a = 15, l = 16, g = 7, M = 256, C = 16, T = 17, D = 18, I = ( - /* extra bits for each length code */ - [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0] - ), B = ( - /* extra bits for each distance code */ - [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13] - ), P = ( - /* extra bits for each bit length code */ - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7] - ), z = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], k = 512, N = new Array((o + 2) * 2); - _(N); - var R = new Array(A * 2); - _(R); - var U = new Array(k); - _(U); - var W = new Array(w - y + 1); - _(W); - var G = new Array(L); - _(G); - var F = new Array(A); - _(F); - function V(Y, ue, Se, Fe, he) { - this.static_tree = Y, this.extra_bits = ue, this.extra_base = Se, this.elems = Fe, this.max_length = he, this.has_stree = Y && Y.length; - } - var J, X, oe; - function te(Y, ue) { - this.dyn_tree = Y, this.max_code = 0, this.stat_desc = ue; - } - function ve(Y) { - return Y < 256 ? U[Y] : U[256 + (Y >>> 7)]; - } - function se(Y, ue) { - Y.pending_buf[Y.pending++] = ue & 255, Y.pending_buf[Y.pending++] = ue >>> 8 & 255; - } - function le(Y, ue, Se) { - Y.bi_valid > l - Se ? (Y.bi_buf |= ue << Y.bi_valid & 65535, se(Y, Y.bi_buf), Y.bi_buf = ue >> l - Y.bi_valid, Y.bi_valid += Se - l) : (Y.bi_buf |= ue << Y.bi_valid & 65535, Y.bi_valid += Se); - } - function Ce(Y, ue, Se) { - le( - Y, - Se[ue * 2], - Se[ue * 2 + 1] - /*.Len*/ - ); - } - function be(Y, ue) { - var Se = 0; - do - Se |= Y & 1, Y >>>= 1, Se <<= 1; - while (--ue > 0); - return Se >>> 1; - } - function Le(Y) { - Y.bi_valid === 16 ? (se(Y, Y.bi_buf), Y.bi_buf = 0, Y.bi_valid = 0) : Y.bi_valid >= 8 && (Y.pending_buf[Y.pending++] = Y.bi_buf & 255, Y.bi_buf >>= 8, Y.bi_valid -= 8); - } - function ae(Y, ue) { - var Se = ue.dyn_tree, Fe = ue.max_code, he = ue.stat_desc.static_tree, De = ue.stat_desc.has_stree, K = ue.stat_desc.extra_bits, ze = ue.stat_desc.extra_base, Ve = ue.stat_desc.max_length, $, xe, Me, Q, fe, Te, Ze = 0; - for (Q = 0; Q <= a; Q++) - Y.bl_count[Q] = 0; - for (Se[Y.heap[Y.heap_max] * 2 + 1] = 0, $ = Y.heap_max + 1; $ < v; $++) - xe = Y.heap[$], Q = Se[Se[xe * 2 + 1] * 2 + 1] + 1, Q > Ve && (Q = Ve, Ze++), Se[xe * 2 + 1] = Q, !(xe > Fe) && (Y.bl_count[Q]++, fe = 0, xe >= ze && (fe = K[xe - ze]), Te = Se[xe * 2], Y.opt_len += Te * (Q + fe), De && (Y.static_len += Te * (he[xe * 2 + 1] + fe))); - if (Ze !== 0) { - do { - for (Q = Ve - 1; Y.bl_count[Q] === 0; ) - Q--; - Y.bl_count[Q]--, Y.bl_count[Q + 1] += 2, Y.bl_count[Ve]--, Ze -= 2; - } while (Ze > 0); - for (Q = Ve; Q !== 0; Q--) - for (xe = Y.bl_count[Q]; xe !== 0; ) - Me = Y.heap[--$], !(Me > Fe) && (Se[Me * 2 + 1] !== Q && (Y.opt_len += (Q - Se[Me * 2 + 1]) * Se[Me * 2], Se[Me * 2 + 1] = Q), xe--); - } - } - function _e(Y, ue, Se) { - var Fe = new Array(a + 1), he = 0, De, K; - for (De = 1; De <= a; De++) - Fe[De] = he = he + Se[De - 1] << 1; - for (K = 0; K <= ue; K++) { - var ze = Y[K * 2 + 1]; - ze !== 0 && (Y[K * 2] = be(Fe[ze]++, ze)); - } - } - function Ee() { - var Y, ue, Se, Fe, he, De = new Array(a + 1); - for (Se = 0, Fe = 0; Fe < L - 1; Fe++) - for (G[Fe] = Se, Y = 0; Y < 1 << I[Fe]; Y++) - W[Se++] = Fe; - for (W[Se - 1] = Fe, he = 0, Fe = 0; Fe < 16; Fe++) - for (F[Fe] = he, Y = 0; Y < 1 << B[Fe]; Y++) - U[he++] = Fe; - for (he >>= 7; Fe < A; Fe++) - for (F[Fe] = he << 7, Y = 0; Y < 1 << B[Fe] - 7; Y++) - U[256 + he++] = Fe; - for (ue = 0; ue <= a; ue++) - De[ue] = 0; - for (Y = 0; Y <= 143; ) - N[Y * 2 + 1] = 8, Y++, De[8]++; - for (; Y <= 255; ) - N[Y * 2 + 1] = 9, Y++, De[9]++; - for (; Y <= 279; ) - N[Y * 2 + 1] = 7, Y++, De[7]++; - for (; Y <= 287; ) - N[Y * 2 + 1] = 8, Y++, De[8]++; - for (_e(N, o + 1, De), Y = 0; Y < A; Y++) - R[Y * 2 + 1] = 5, R[Y * 2] = be(Y, 5); - J = new V(N, I, s + 1, o, a), X = new V(R, B, 0, A, a), oe = new V(new Array(0), P, 0, p, g); - } - function Be(Y) { - var ue; - for (ue = 0; ue < o; ue++) - Y.dyn_ltree[ue * 2] = 0; - for (ue = 0; ue < A; ue++) - Y.dyn_dtree[ue * 2] = 0; - for (ue = 0; ue < p; ue++) - Y.bl_tree[ue * 2] = 0; - Y.dyn_ltree[M * 2] = 1, Y.opt_len = Y.static_len = 0, Y.last_lit = Y.matches = 0; - } - function Ne(Y) { - Y.bi_valid > 8 ? se(Y, Y.bi_buf) : Y.bi_valid > 0 && (Y.pending_buf[Y.pending++] = Y.bi_buf), Y.bi_buf = 0, Y.bi_valid = 0; - } - function Ge(Y, ue, Se, Fe) { - Ne(Y), Fe && (se(Y, Se), se(Y, ~Se)), n.arraySet(Y.pending_buf, Y.window, ue, Se, Y.pending), Y.pending += Se; - } - function ke(Y, ue, Se, Fe) { - var he = ue * 2, De = Se * 2; - return Y[he] < Y[De] || Y[he] === Y[De] && Fe[ue] <= Fe[Se]; - } - function pe(Y, ue, Se) { - for (var Fe = Y.heap[Se], he = Se << 1; he <= Y.heap_len && (he < Y.heap_len && ke(ue, Y.heap[he + 1], Y.heap[he], Y.depth) && he++, !ke(ue, Fe, Y.heap[he], Y.depth)); ) - Y.heap[Se] = Y.heap[he], Se = he, he <<= 1; - Y.heap[Se] = Fe; - } - function de(Y, ue, Se) { - var Fe, he, De = 0, K, ze; - if (Y.last_lit !== 0) - do - Fe = Y.pending_buf[Y.d_buf + De * 2] << 8 | Y.pending_buf[Y.d_buf + De * 2 + 1], he = Y.pending_buf[Y.l_buf + De], De++, Fe === 0 ? Ce(Y, he, ue) : (K = W[he], Ce(Y, K + s + 1, ue), ze = I[K], ze !== 0 && (he -= G[K], le(Y, he, ze)), Fe--, K = ve(Fe), Ce(Y, K, Se), ze = B[K], ze !== 0 && (Fe -= F[K], le(Y, Fe, ze))); - while (De < Y.last_lit); - Ce(Y, M, ue); - } - function ce(Y, ue) { - var Se = ue.dyn_tree, Fe = ue.stat_desc.static_tree, he = ue.stat_desc.has_stree, De = ue.stat_desc.elems, K, ze, Ve = -1, $; - for (Y.heap_len = 0, Y.heap_max = v, K = 0; K < De; K++) - Se[K * 2] !== 0 ? (Y.heap[++Y.heap_len] = Ve = K, Y.depth[K] = 0) : Se[K * 2 + 1] = 0; - for (; Y.heap_len < 2; ) - $ = Y.heap[++Y.heap_len] = Ve < 2 ? ++Ve : 0, Se[$ * 2] = 1, Y.depth[$] = 0, Y.opt_len--, he && (Y.static_len -= Fe[$ * 2 + 1]); - for (ue.max_code = Ve, K = Y.heap_len >> 1; K >= 1; K--) - pe(Y, Se, K); - $ = De; - do - K = Y.heap[ - 1 - /*SMALLEST*/ - ], Y.heap[ - 1 - /*SMALLEST*/ - ] = Y.heap[Y.heap_len--], pe( - Y, - Se, - 1 - /*SMALLEST*/ - ), ze = Y.heap[ - 1 - /*SMALLEST*/ - ], Y.heap[--Y.heap_max] = K, Y.heap[--Y.heap_max] = ze, Se[$ * 2] = Se[K * 2] + Se[ze * 2], Y.depth[$] = (Y.depth[K] >= Y.depth[ze] ? Y.depth[K] : Y.depth[ze]) + 1, Se[K * 2 + 1] = Se[ze * 2 + 1] = $, Y.heap[ - 1 - /*SMALLEST*/ - ] = $++, pe( - Y, - Se, - 1 - /*SMALLEST*/ - ); - while (Y.heap_len >= 2); - Y.heap[--Y.heap_max] = Y.heap[ - 1 - /*SMALLEST*/ - ], ae(Y, ue), _e(Se, Ve, Y.bl_count); - } - function Ae(Y, ue, Se) { - var Fe, he = -1, De, K = ue[0 * 2 + 1], ze = 0, Ve = 7, $ = 4; - for (K === 0 && (Ve = 138, $ = 3), ue[(Se + 1) * 2 + 1] = 65535, Fe = 0; Fe <= Se; Fe++) - De = K, K = ue[(Fe + 1) * 2 + 1], !(++ze < Ve && De === K) && (ze < $ ? Y.bl_tree[De * 2] += ze : De !== 0 ? (De !== he && Y.bl_tree[De * 2]++, Y.bl_tree[C * 2]++) : ze <= 10 ? Y.bl_tree[T * 2]++ : Y.bl_tree[D * 2]++, ze = 0, he = De, K === 0 ? (Ve = 138, $ = 3) : De === K ? (Ve = 6, $ = 3) : (Ve = 7, $ = 4)); - } - function Oe(Y, ue, Se) { - var Fe, he = -1, De, K = ue[0 * 2 + 1], ze = 0, Ve = 7, $ = 4; - for (K === 0 && (Ve = 138, $ = 3), Fe = 0; Fe <= Se; Fe++) - if (De = K, K = ue[(Fe + 1) * 2 + 1], !(++ze < Ve && De === K)) { - if (ze < $) - do - Ce(Y, De, Y.bl_tree); - while (--ze !== 0); - else - De !== 0 ? (De !== he && (Ce(Y, De, Y.bl_tree), ze--), Ce(Y, C, Y.bl_tree), le(Y, ze - 3, 2)) : ze <= 10 ? (Ce(Y, T, Y.bl_tree), le(Y, ze - 3, 3)) : (Ce(Y, D, Y.bl_tree), le(Y, ze - 11, 7)); - ze = 0, he = De, K === 0 ? (Ve = 138, $ = 3) : De === K ? (Ve = 6, $ = 3) : (Ve = 7, $ = 4); - } - } - function We(Y) { - var ue; - for (Ae(Y, Y.dyn_ltree, Y.l_desc.max_code), Ae(Y, Y.dyn_dtree, Y.d_desc.max_code), ce(Y, Y.bl_desc), ue = p - 1; ue >= 3 && Y.bl_tree[z[ue] * 2 + 1] === 0; ue--) - ; - return Y.opt_len += 3 * (ue + 1) + 5 + 5 + 4, ue; - } - function Ue(Y, ue, Se, Fe) { - var he; - for (le(Y, ue - 257, 5), le(Y, Se - 1, 5), le(Y, Fe - 4, 4), he = 0; he < Fe; he++) - le(Y, Y.bl_tree[z[he] * 2 + 1], 3); - Oe(Y, Y.dyn_ltree, ue - 1), Oe(Y, Y.dyn_dtree, Se - 1); - } - function Z(Y) { - var ue = 4093624447, Se; - for (Se = 0; Se <= 31; Se++, ue >>>= 1) - if (ue & 1 && Y.dyn_ltree[Se * 2] !== 0) - return u; - if (Y.dyn_ltree[18] !== 0 || Y.dyn_ltree[20] !== 0 || Y.dyn_ltree[26] !== 0) - return b; - for (Se = 32; Se < s; Se++) - if (Y.dyn_ltree[Se * 2] !== 0) - return b; - return u; - } - var j = !1; - function ee(Y) { - j || (Ee(), j = !0), Y.l_desc = new te(Y.dyn_ltree, J), Y.d_desc = new te(Y.dyn_dtree, X), Y.bl_desc = new te(Y.bl_tree, oe), Y.bi_buf = 0, Y.bi_valid = 0, Be(Y); - } - function ge(Y, ue, Se, Fe) { - le(Y, (E << 1) + (Fe ? 1 : 0), 3), Ge(Y, ue, Se, !0); - } - function ye(Y) { - le(Y, c << 1, 3), Ce(Y, M, N), Le(Y); - } - function $e(Y, ue, Se, Fe) { - var he, De, K = 0; - Y.level > 0 ? (Y.strm.data_type === h && (Y.strm.data_type = Z(Y)), ce(Y, Y.l_desc), ce(Y, Y.d_desc), K = We(Y), he = Y.opt_len + 3 + 7 >>> 3, De = Y.static_len + 3 + 7 >>> 3, De <= he && (he = De)) : he = De = Se + 5, Se + 4 <= he && ue !== -1 ? ge(Y, ue, Se, Fe) : Y.strategy === f || De === he ? (le(Y, (c << 1) + (Fe ? 1 : 0), 3), de(Y, N, R)) : (le(Y, (S << 1) + (Fe ? 1 : 0), 3), Ue(Y, Y.l_desc.max_code + 1, Y.d_desc.max_code + 1, K + 1), de(Y, Y.dyn_ltree, Y.dyn_dtree)), Be(Y), Fe && Ne(Y); - } - function Re(Y, ue, Se) { - return Y.pending_buf[Y.d_buf + Y.last_lit * 2] = ue >>> 8 & 255, Y.pending_buf[Y.d_buf + Y.last_lit * 2 + 1] = ue & 255, Y.pending_buf[Y.l_buf + Y.last_lit] = Se & 255, Y.last_lit++, ue === 0 ? Y.dyn_ltree[Se * 2]++ : (Y.matches++, ue--, Y.dyn_ltree[(W[Se] + s + 1) * 2]++, Y.dyn_dtree[ve(ue) * 2]++), Y.last_lit === Y.lit_bufsize - 1; - } - e._tr_init = ee, e._tr_stored_block = ge, e._tr_flush_block = $e, e._tr_tally = Re, e._tr_align = ye; - } - ), - /***/ - "./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js": ( - /*!********************************************************************!*\ - !*** ./node_modules/upng-js/node_modules/pako/lib/zlib/zstream.js ***! - \********************************************************************/ - /***/ - (t) => { - function e() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - } - t.exports = e; - } - ), - /***/ - "./src/SurfaceWorker.js": ( - /*!******************************!*\ - !*** ./src/SurfaceWorker.js ***! - \******************************/ - /***/ - () => { - $3Dmol.workerString = (function() { - self.onmessage = function(t) { - var e = t.data, r = e.type; - if (r < 0) - self.atomData = e.atoms, self.volume = e.volume, self.ps = new ProteinSurface(); - else { - var n = self.ps; - n.initparm(e.expandedExtent, r != 1, self.volume), n.fillvoxels(self.atomData, e.extendedAtoms), n.buildboundary(), (r === 4 || r === 2) && (n.fastdistancemap(), n.boundingatom(!1), n.fillvoxelswaals(self.atomData, e.extendedAtoms)), n.marchingcube(r); - var f = n.getFacesAndVertices(e.atomsToShow); - self.postMessage(f); - } - }; - }).toString().replace(/(^.*?\{|\}$)/g, ""), $3Dmol.workerString += `; -function _classCallCheck() {};`, $3Dmol.workerString += `; -` + $3Dmol.Vector3.toString(), $3Dmol.workerString += `; -` + $3Dmol.MarchingCubeInitializer.toString() + `; - -`, $3Dmol.workerString += `; -` + $3Dmol.PointGrid.toString() + `; -`, $3Dmol.workerString += `; -var ProteinSurface = ` + $3Dmol.ProteinSurface.toString() + `; -`, $3Dmol.SurfaceWorker = window.URL ? window.URL.createObjectURL(new Blob([$3Dmol.workerString], { type: "text/javascript" })) : void 0; - } - ), - /***/ - "./src/exporter.js": ( - /*!*************************!*\ - !*** ./src/exporter.js ***! - \*************************/ - /***/ - (t) => { - typeof t.exports == "object" && (t.exports = window.$3Dmol); - } - ), - /***/ - "./src/vendor/mmtf.js": ( - /*!****************************!*\ - !*** ./src/vendor/mmtf.js ***! - \****************************/ - /***/ - function(t, e) { - (function(r, n) { - n(e); - })(this, function(r) { - function n(Z, j, ee) { - for (var ge = (Z.byteLength, 0), ye = ee.length; ye > ge; ge++) { - var $e = ee.charCodeAt(ge); - if (128 > $e) - Z.setUint8(j++, $e >>> 0 & 127 | 0); - else if (2048 > $e) - Z.setUint8(j++, $e >>> 6 & 31 | 192), Z.setUint8(j++, $e >>> 0 & 63 | 128); - else if (65536 > $e) - Z.setUint8(j++, $e >>> 12 & 15 | 224), Z.setUint8(j++, $e >>> 6 & 63 | 128), Z.setUint8(j++, $e >>> 0 & 63 | 128); - else { - if (!(1114112 > $e)) - throw new Error("bad codepoint " + $e); - Z.setUint8(j++, $e >>> 18 & 7 | 240), Z.setUint8(j++, $e >>> 12 & 63 | 128), Z.setUint8(j++, $e >>> 6 & 63 | 128), Z.setUint8(j++, $e >>> 0 & 63 | 128); - } - } - } - function f(Z) { - for (var j = 0, ee = 0, ge = Z.length; ge > ee; ee++) { - var ye = Z.charCodeAt(ee); - if (128 > ye) - j += 1; - else if (2048 > ye) - j += 2; - else if (65536 > ye) - j += 3; - else { - if (!(1114112 > ye)) - throw new Error("bad codepoint " + ye); - j += 4; - } - } - return j; - } - function u(Z, j, ee) { - var ge = typeof Z; - if (ge === "string") { - var ye = f(Z); - if (32 > ye) - return j.setUint8(ee, 160 | ye), n(j, ee + 1, Z), 1 + ye; - if (256 > ye) - return j.setUint8(ee, 217), j.setUint8(ee + 1, ye), n(j, ee + 2, Z), 2 + ye; - if (65536 > ye) - return j.setUint8(ee, 218), j.setUint16(ee + 1, ye), n(j, ee + 3, Z), 3 + ye; - if (4294967296 > ye) - return j.setUint8(ee, 219), j.setUint32(ee + 1, ye), n(j, ee + 5, Z), 5 + ye; - } - if (Z instanceof Uint8Array) { - var ye = Z.byteLength, $e = new Uint8Array(j.buffer); - if (256 > ye) - return j.setUint8(ee, 196), j.setUint8(ee + 1, ye), $e.set(Z, ee + 2), 2 + ye; - if (65536 > ye) - return j.setUint8(ee, 197), j.setUint16(ee + 1, ye), $e.set(Z, ee + 3), 3 + ye; - if (4294967296 > ye) - return j.setUint8(ee, 198), j.setUint32(ee + 1, ye), $e.set(Z, ee + 5), 5 + ye; - } - if (ge === "number") { - if (!isFinite(Z)) - throw new Error("Number not finite: " + Z); - if (Math.floor(Z) !== Z) - return j.setUint8(ee, 203), j.setFloat64(ee + 1, Z), 9; - if (Z >= 0) { - if (128 > Z) - return j.setUint8(ee, Z), 1; - if (256 > Z) - return j.setUint8(ee, 204), j.setUint8(ee + 1, Z), 2; - if (65536 > Z) - return j.setUint8(ee, 205), j.setUint16(ee + 1, Z), 3; - if (4294967296 > Z) - return j.setUint8(ee, 206), j.setUint32(ee + 1, Z), 5; - throw new Error("Number too big 0x" + Z.toString(16)); - } - if (Z >= -32) - return j.setInt8(ee, Z), 1; - if (Z >= -128) - return j.setUint8(ee, 208), j.setInt8(ee + 1, Z), 2; - if (Z >= -32768) - return j.setUint8(ee, 209), j.setInt16(ee + 1, Z), 3; - if (Z >= -2147483648) - return j.setUint8(ee, 210), j.setInt32(ee + 1, Z), 5; - throw new Error("Number too small -0x" + (-Z).toString(16).substr(1)); - } - if (Z === null) - return j.setUint8(ee, 192), 1; - if (ge === "boolean") - return j.setUint8(ee, Z ? 195 : 194), 1; - if (ge === "object") { - var ye, ue = 0, Re = Array.isArray(Z); - if (Re) - ye = Z.length; - else { - var Y = Object.keys(Z); - ye = Y.length; - } - var ue; - if (16 > ye ? (j.setUint8(ee, ye | (Re ? 144 : 128)), ue = 1) : 65536 > ye ? (j.setUint8(ee, Re ? 220 : 222), j.setUint16(ee + 1, ye), ue = 3) : 4294967296 > ye && (j.setUint8(ee, Re ? 221 : 223), j.setUint32(ee + 1, ye), ue = 5), Re) - for (var Se = 0; ye > Se; Se++) - ue += u(Z[Se], j, ee + ue); - else - for (var Se = 0; ye > Se; Se++) { - var Fe = Y[Se]; - ue += u(Fe, j, ee + ue), ue += u(Z[Fe], j, ee + ue); - } - return ue; - } - throw new Error("Unknown type " + ge); - } - function b(Z) { - var j = typeof Z; - if (j === "string") { - var ee = f(Z); - if (32 > ee) - return 1 + ee; - if (256 > ee) - return 2 + ee; - if (65536 > ee) - return 3 + ee; - if (4294967296 > ee) - return 5 + ee; - } - if (Z instanceof Uint8Array) { - var ee = Z.byteLength; - if (256 > ee) - return 2 + ee; - if (65536 > ee) - return 3 + ee; - if (4294967296 > ee) - return 5 + ee; - } - if (j === "number") { - if (Math.floor(Z) !== Z) - return 9; - if (Z >= 0) { - if (128 > Z) - return 1; - if (256 > Z) - return 2; - if (65536 > Z) - return 3; - if (4294967296 > Z) - return 5; - throw new Error("Number too big 0x" + Z.toString(16)); - } - if (Z >= -32) - return 1; - if (Z >= -128) - return 2; - if (Z >= -32768) - return 3; - if (Z >= -2147483648) - return 5; - throw new Error("Number too small -0x" + Z.toString(16).substr(1)); - } - if (j === "boolean" || Z === null) - return 1; - if (j === "object") { - var ee, ge = 0; - if (Array.isArray(Z)) { - ee = Z.length; - for (var ye = 0; ee > ye; ye++) - ge += b(Z[ye]); - } else { - var $e = Object.keys(Z); - ee = $e.length; - for (var ye = 0; ee > ye; ye++) { - var Re = $e[ye]; - ge += b(Re) + b(Z[Re]); - } - } - if (16 > ee) - return 1 + ge; - if (65536 > ee) - return 3 + ge; - if (4294967296 > ee) - return 5 + ge; - throw new Error("Array or object too long 0x" + ee.toString(16)); - } - throw new Error("Unknown type " + j); - } - function h(Z) { - var j = new ArrayBuffer(b(Z)), ee = new DataView(j); - return u(Z, ee, 0), new Uint8Array(j); - } - function _(Z, j, ee) { - return j ? new Z(j.buffer, j.byteOffset, j.byteLength / (ee || 1)) : void 0; - } - function E(Z) { - return _(DataView, Z); - } - function c(Z) { - return _(Uint8Array, Z); - } - function S(Z) { - return _(Int8Array, Z); - } - function y(Z) { - return _(Int32Array, Z, 4); - } - function w(Z) { - return _(Float32Array, Z, 4); - } - function L(Z, j) { - var ee = Z.length / 2; - j || (j = new Int16Array(ee)); - for (var ge = 0, ye = 0; ee > ge; ++ge, ye += 2) - j[ge] = Z[ye] << 8 ^ Z[ye + 1] << 0; - return j; - } - function s(Z, j) { - var ee = Z.length; - j || (j = new Uint8Array(2 * ee)); - for (var ge = E(j), ye = 0; ee > ye; ++ye) - ge.setInt16(2 * ye, Z[ye]); - return c(j); - } - function o(Z, j) { - var ee = Z.length / 4; - j || (j = new Int32Array(ee)); - for (var ge = 0, ye = 0; ee > ge; ++ge, ye += 4) - j[ge] = Z[ye] << 24 ^ Z[ye + 1] << 16 ^ Z[ye + 2] << 8 ^ Z[ye + 3] << 0; - return j; - } - function A(Z, j) { - var ee = Z.length; - j || (j = new Uint8Array(4 * ee)); - for (var ge = E(j), ye = 0; ee > ye; ++ye) - ge.setInt32(4 * ye, Z[ye]); - return c(j); - } - function p(Z, j) { - var ee = Z.length; - j || (j = new Float32Array(ee / 4)); - for (var ge = E(j), ye = E(Z), $e = 0, Re = 0, Y = ee / 4; Y > $e; ++$e, Re += 4) - ge.setFloat32(Re, ye.getFloat32(Re), !0); - return j; - } - function v(Z, j, ee) { - var ge = Z.length, ye = 1 / j; - ee || (ee = new Float32Array(ge)); - for (var $e = 0; ge > $e; ++$e) - ee[$e] = Z[$e] * ye; - return ee; - } - function a(Z, j, ee) { - var ge = Z.length; - ee || (ee = new Int32Array(ge)); - for (var ye = 0; ge > ye; ++ye) - ee[ye] = Math.round(Z[ye] * j); - return ee; - } - function l(Z, j) { - var ee, ge; - if (!j) { - var ye = 0; - for (ee = 0, ge = Z.length; ge > ee; ee += 2) - ye += Z[ee + 1]; - j = new Z.constructor(ye); - } - var $e = 0; - for (ee = 0, ge = Z.length; ge > ee; ee += 2) - for (var Re = Z[ee], Y = Z[ee + 1], ue = 0; Y > ue; ++ue) - j[$e] = Re, ++$e; - return j; - } - function g(Z) { - if (Z.length === 0) - return new Int32Array(); - var j, ee, ge = 2; - for (j = 1, ee = Z.length; ee > j; ++j) - Z[j - 1] !== Z[j] && (ge += 2); - var ye = new Int32Array(ge), $e = 0, Re = 1; - for (j = 1, ee = Z.length; ee > j; ++j) - Z[j - 1] !== Z[j] ? (ye[$e] = Z[j - 1], ye[$e + 1] = Re, Re = 1, $e += 2) : ++Re; - return ye[$e] = Z[Z.length - 1], ye[$e + 1] = Re, ye; - } - function M(Z, j) { - var ee = Z.length; - j || (j = new Z.constructor(ee)), ee && (j[0] = Z[0]); - for (var ge = 1; ee > ge; ++ge) - j[ge] = Z[ge] + j[ge - 1]; - return j; - } - function C(Z, j) { - var ee = Z.length; - j || (j = new Z.constructor(ee)), j[0] = Z[0]; - for (var ge = 1; ee > ge; ++ge) - j[ge] = Z[ge] - Z[ge - 1]; - return j; - } - function T(Z, j) { - var ee, ge, ye = Z instanceof Int8Array ? 127 : 32767, $e = -ye - 1, Re = Z.length; - if (!j) { - var Y = 0; - for (ee = 0; Re > ee; ++ee) - Z[ee] < ye && Z[ee] > $e && ++Y; - j = new Int32Array(Y); - } - for (ee = 0, ge = 0; Re > ee; ) { - for (var ue = 0; Z[ee] === ye || Z[ee] === $e; ) - ue += Z[ee], ++ee; - ue += Z[ee], ++ee, j[ge] = ue, ++ge; - } - return j; - } - function D(Z, j) { - var ee, ge = j ? 127 : 32767, ye = -ge - 1, $e = Z.length, Re = 0; - for (ee = 0; $e > ee; ++ee) { - var Y = Z[ee]; - Y === 0 ? ++Re : Y > 0 ? (Re += Math.ceil(Y / ge), Y % ge === 0 && (Re += 1)) : (Re += Math.ceil(Y / ye), Y % ye === 0 && (Re += 1)); - } - var ue = j ? new Int8Array(Re) : new Int16Array(Re), Se = 0; - for (ee = 0; $e > ee; ++ee) { - var Y = Z[ee]; - if (Y >= 0) - for (; Y >= ge; ) - ue[Se] = ge, ++Se, Y -= ge; - else - for (; ye >= Y; ) - ue[Se] = ye, ++Se, Y -= ye; - ue[Se] = Y, ++Se; - } - return ue; - } - function I(Z, j) { - return M(l(Z), j); - } - function B(Z) { - return g(C(Z)); - } - function P(Z, j, ee) { - return v(l(Z, y(ee)), j, ee); - } - function z(Z, j) { - return g(a(Z, j)); - } - function k(Z, j, ee) { - return v(M(Z, y(ee)), j, ee); - } - function N(Z, j, ee) { - return C(a(Z, j), ee); - } - function R(Z, j, ee) { - return v(T(Z, y(ee)), j, ee); - } - function U(Z, j, ee) { - var ge = T(Z, y(ee)); - return k(ge, j, w(ge)); - } - function W(Z, j, ee) { - return D(N(Z, j), ee); - } - function G($e) { - var j = E($e), ee = j.getInt32(0), ge = j.getInt32(4), ye = $e.subarray(8, 12), $e = $e.subarray(12); - return [ee, $e, ge, ye]; - } - function F(Z, j, ee, ge) { - var ye = new ArrayBuffer(12 + ge.byteLength), $e = new Uint8Array(ye), Re = new DataView(ye); - return Re.setInt32(0, Z), Re.setInt32(4, j), ee && $e.set(ee, 8), $e.set(ge, 12), $e; - } - function V(Z) { - var j = Z.length, ee = c(Z); - return F(2, j, void 0, ee); - } - function J(Z) { - var j = Z.length, ee = A(Z); - return F(4, j, void 0, ee); - } - function X(Z, j) { - var ee = Z.length / j, ge = A([j]), ye = c(Z); - return F(5, ee, ge, ye); - } - function oe(Z) { - var j = Z.length, ee = A(g(Z)); - return F(6, j, void 0, ee); - } - function te(Z) { - var j = Z.length, ee = A(B(Z)); - return F(8, j, void 0, ee); - } - function ve(Z, j) { - var ee = Z.length, ge = A([j]), ye = A(z(Z, j)); - return F(9, ee, ge, ye); - } - function se(Z, j) { - var ee = Z.length, ge = A([j]), ye = s(W(Z, j)); - return F(10, ee, ge, ye); - } - function le(Z) { - var j = {}; - return pe.forEach(function(ee) { - Z[ee] !== void 0 && (j[ee] = Z[ee]); - }), Z.bondAtomList && (j.bondAtomList = J(Z.bondAtomList)), Z.bondOrderList && (j.bondOrderList = V(Z.bondOrderList)), j.xCoordList = se(Z.xCoordList, 1e3), j.yCoordList = se(Z.yCoordList, 1e3), j.zCoordList = se(Z.zCoordList, 1e3), Z.bFactorList && (j.bFactorList = se(Z.bFactorList, 100)), Z.atomIdList && (j.atomIdList = te(Z.atomIdList)), Z.altLocList && (j.altLocList = oe(Z.altLocList)), Z.occupancyList && (j.occupancyList = ve(Z.occupancyList, 100)), j.groupIdList = te(Z.groupIdList), j.groupTypeList = J(Z.groupTypeList), Z.secStructList && (j.secStructList = V(Z.secStructList)), Z.insCodeList && (j.insCodeList = oe(Z.insCodeList)), Z.sequenceIndexList && (j.sequenceIndexList = te(Z.sequenceIndexList)), j.chainIdList = X(Z.chainIdList, 4), Z.chainNameList && (j.chainNameList = X(Z.chainNameList, 4)), j; - } - function Ce(Z) { - function j(ue) { - for (var Se = {}, Fe = 0; ue > Fe; Fe++) { - var he = $e(); - Se[he] = $e(); - } - return Se; - } - function ee(ue) { - var Se = Z.subarray(Re, Re + ue); - return Re += ue, Se; - } - function ge(ue) { - var Se = Z.subarray(Re, Re + ue); - Re += ue; - var Fe = 65535; - if (ue > Fe) { - for (var he = [], De = 0; De < Se.length; De += Fe) - he.push(String.fromCharCode.apply(null, Se.subarray(De, De + Fe))); - return he.join(""); - } - return String.fromCharCode.apply(null, Se); - } - function ye(ue) { - for (var Se = new Array(ue), Fe = 0; ue > Fe; Fe++) - Se[Fe] = $e(); - return Se; - } - function $e() { - var ue, Se, Fe = Z[Re]; - if (!(128 & Fe)) - return Re++, Fe; - if ((240 & Fe) === 128) - return Se = 15 & Fe, Re++, j(Se); - if ((240 & Fe) === 144) - return Se = 15 & Fe, Re++, ye(Se); - if ((224 & Fe) === 160) - return Se = 31 & Fe, Re++, ge(Se); - if ((224 & Fe) === 224) - return ue = Y.getInt8(Re), Re++, ue; - switch (Fe) { - case 192: - return Re++, null; - case 194: - return Re++, !1; - case 195: - return Re++, !0; - case 196: - return Se = Y.getUint8(Re + 1), Re += 2, ee(Se); - case 197: - return Se = Y.getUint16(Re + 1), Re += 3, ee(Se); - case 198: - return Se = Y.getUint32(Re + 1), Re += 5, ee(Se); - case 202: - return ue = Y.getFloat32(Re + 1), Re += 5, ue; - case 203: - return ue = Y.getFloat64(Re + 1), Re += 9, ue; - case 204: - return ue = Z[Re + 1], Re += 2, ue; - case 205: - return ue = Y.getUint16(Re + 1), Re += 3, ue; - case 206: - return ue = Y.getUint32(Re + 1), Re += 5, ue; - case 208: - return ue = Y.getInt8(Re + 1), Re += 2, ue; - case 209: - return ue = Y.getInt16(Re + 1), Re += 3, ue; - case 210: - return ue = Y.getInt32(Re + 1), Re += 5, ue; - case 217: - return Se = Y.getUint8(Re + 1), Re += 2, ge(Se); - case 218: - return Se = Y.getUint16(Re + 1), Re += 3, ge(Se); - case 219: - return Se = Y.getUint32(Re + 1), Re += 5, ge(Se); - case 220: - return Se = Y.getUint16(Re + 1), Re += 3, ye(Se); - case 221: - return Se = Y.getUint32(Re + 1), Re += 5, ye(Se); - case 222: - return Se = Y.getUint16(Re + 1), Re += 3, j(Se); - case 223: - return Se = Y.getUint32(Re + 1), Re += 5, j(Se); - } - throw new Error("Unknown type 0x" + Fe.toString(16)); - } - var Re = 0, Y = new DataView(Z.buffer); - return $e(); - } - function be(Z, j, ee, ge) { - switch (Z) { - case 1: - return p(j); - case 2: - return S(j); - case 3: - return L(j); - case 4: - return o(j); - case 5: - return c(j); - case 6: - return l(o(j), new Uint8Array(ee)); - case 7: - return l(o(j)); - case 8: - return I(o(j)); - case 9: - return P(o(j), o(ge)[0]); - case 10: - return U(L(j), o(ge)[0]); - case 11: - return v(L(j), o(ge)[0]); - case 12: - return R(L(j), o(ge)[0]); - case 13: - return R(S(j), o(ge)[0]); - case 14: - return T(L(j)); - case 15: - return T(S(j)); - } - } - function Le(Z, j) { - j = j || {}; - var ee = j.ignoreFields, ge = {}; - return ce.forEach(function(ye) { - var $e = ee ? ee.indexOf(ye) !== -1 : !1, Re = Z[ye]; - $e || Re === void 0 || (Re instanceof Uint8Array ? ge[ye] = be.apply(null, G(Re)) : ge[ye] = Re); - }), ge; - } - function ae(Z) { - return String.fromCharCode.apply(null, Z).replace(/\0/g, ""); - } - function _e(Z, j, ee) { - ee = ee || {}; - var ge, ye, $e, Re, Y, ue, Se = ee.firstModelOnly, Fe = j.onModel, he = j.onChain, De = j.onGroup, K = j.onAtom, ze = j.onBond, Ve = 0, $ = 0, xe = 0, Me = 0, Q = 0, fe = -1, Te = Z.chainNameList, Ze = Z.secStructList, Ke = Z.insCodeList, je = Z.sequenceIndexList, Je = Z.atomIdList, St = Z.bFactorList, rt = Z.altLocList, it = Z.occupancyList, tt = Z.bondAtomList, Et = Z.bondOrderList; - for (ge = 0, ye = Z.chainsPerModel.length; ye > ge && !(Se && Ve > 0); ++ge) { - var lt = Z.chainsPerModel[Ve]; - for (Fe && Fe({ chainCount: lt, modelIndex: Ve }), $e = 0; lt > $e; ++$e) { - var wt = Z.groupsPerChain[$]; - if (he) { - var Pt = ae(Z.chainIdList.subarray(4 * $, 4 * $ + 4)), vt = null; - Te && (vt = ae(Te.subarray(4 * $, 4 * $ + 4))), he({ groupCount: wt, chainIndex: $, modelIndex: Ve, chainId: Pt, chainName: vt }); - } - for (Re = 0; wt > Re; ++Re) { - var bt = Z.groupList[Z.groupTypeList[xe]], mt = bt.atomNameList.length; - if (De) { - var Tt = null; - Ze && (Tt = Ze[xe]); - var Ot = null; - Z.insCodeList && (Ot = String.fromCharCode(Ke[xe])); - var kt = null; - je && (kt = je[xe]), De({ atomCount: mt, groupIndex: xe, chainIndex: $, modelIndex: Ve, groupId: Z.groupIdList[xe], groupType: Z.groupTypeList[xe], groupName: bt.groupName, singleLetterCode: bt.singleLetterCode, chemCompType: bt.chemCompType, secStruct: Tt, insCode: Ot, sequenceIndex: kt }); - } - for (Y = 0; mt > Y; ++Y) { - if (K) { - var Xt = null; - Je && (Xt = Je[Me]); - var Ft = null; - St && (Ft = St[Me]); - var Qt = null; - rt && (Qt = String.fromCharCode(rt[Me])); - var Jt = null; - it && (Jt = it[Me]), K({ atomIndex: Me, groupIndex: xe, chainIndex: $, modelIndex: Ve, atomId: Xt, element: bt.elementList[Y], atomName: bt.atomNameList[Y], formalCharge: bt.formalChargeList[Y], xCoord: Z.xCoordList[Me], yCoord: Z.yCoordList[Me], zCoord: Z.zCoordList[Me], bFactor: Ft, altLoc: Qt, occupancy: Jt }); - } - Me += 1; - } - if (ze) { - var qt = bt.bondAtomList; - for (Y = 0, ue = bt.bondOrderList.length; ue > Y; ++Y) - ze({ atomIndex1: Me - mt + qt[2 * Y], atomIndex2: Me - mt + qt[2 * Y + 1], bondOrder: bt.bondOrderList[Y] }); - } - xe += 1; - } - $ += 1; - } - if (Q = fe + 1, fe = Me - 1, ze && tt) - for (Y = 0, ue = tt.length; ue > Y; Y += 2) { - var er = tt[Y], tr = tt[Y + 1]; - (er >= Q && fe >= er || tr >= Q && fe >= tr) && ze({ atomIndex1: er, atomIndex2: tr, bondOrder: Et ? Et[Y / 2] : null }); - } - Ve += 1; - } - } - function Ee(Z) { - return h(le(Z)); - } - function Be(Z, j) { - Z instanceof ArrayBuffer && (Z = new Uint8Array(Z)); - var ee; - return ee = Z instanceof Uint8Array ? Ce(Z) : Z, Le(ee, j); - } - function Ne(Z, j, ee, ge) { - function ye() { - try { - var Re = Be($e.response); - ee(Re); - } catch (Y) { - ge(Y); - } - } - var $e = new XMLHttpRequest(); - $e.addEventListener("load", ye, !0), $e.addEventListener("error", ge, !0), $e.responseType = "arraybuffer", $e.open("GET", j + Z.toUpperCase()), $e.send(); - } - function Ge(Z, j, ee) { - Ne(Z, We, j, ee); - } - function ke(Z, j, ee) { - Ne(Z, Ue, j, ee); - } - var pe = ["mmtfVersion", "mmtfProducer", "unitCell", "spaceGroup", "structureId", "title", "depositionDate", "releaseDate", "experimentalMethods", "resolution", "rFree", "rWork", "bioAssemblyList", "ncsOperatorList", "entityList", "groupList", "numBonds", "numAtoms", "numGroups", "numChains", "numModels", "groupsPerChain", "chainsPerModel"], de = ["xCoordList", "yCoordList", "zCoordList", "groupIdList", "groupTypeList", "chainIdList", "bFactorList", "atomIdList", "altLocList", "occupancyList", "secStructList", "insCodeList", "sequenceIndexList", "chainNameList", "bondAtomList", "bondOrderList"], ce = pe.concat(de), Ae = "v1.0.1", Oe = "//mmtf.rcsb.org/v1.0/", We = Oe + "full/", Ue = Oe + "reduced/"; - r.encode = Ee, r.decode = Be, r.traverse = _e, r.fetch = Ge, r.fetchReduced = ke, r.version = Ae, r.fetchUrl = We, r.fetchReducedUrl = Ue, r.encodeMsgpack = h, r.encodeMmtf = le, r.decodeMsgpack = Ce, r.decodeMmtf = Le; - }); - } - ), - /***/ - "./node_modules/pako/dist/pako.esm.mjs": ( - /*!*********************************************!*\ - !*** ./node_modules/pako/dist/pako.esm.mjs ***! - \*********************************************/ - /***/ - (t, e, r) => { - r.r(e), r.d(e, { - /* harmony export */ - Deflate: () => ( - /* binding */ - Ki - ), - /* harmony export */ - Inflate: () => ( - /* binding */ - Qi - ), - /* harmony export */ - constants: () => ( - /* binding */ - tn - ), - /* harmony export */ - default: () => ( - /* binding */ - Ks - ), - /* harmony export */ - deflate: () => ( - /* binding */ - Zi - ), - /* harmony export */ - deflateRaw: () => ( - /* binding */ - Yi - ), - /* harmony export */ - gzip: () => ( - /* binding */ - Xi - ), - /* harmony export */ - inflate: () => ( - /* binding */ - Ji - ), - /* harmony export */ - inflateRaw: () => ( - /* binding */ - qi - ), - /* harmony export */ - ungzip: () => ( - /* binding */ - en - ) - /* harmony export */ - }); - /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */ - const n = 4, f = 0, u = 1, b = 2; - function h(x) { - let H = x.length; - for (; --H >= 0; ) - x[H] = 0; - } - const _ = 0, E = 1, c = 2, S = 3, y = 258, w = 29, L = 256, s = L + 1 + w, o = 30, A = 19, p = 2 * s + 1, v = 15, a = 16, l = 7, g = 256, M = 16, C = 17, T = 18, D = ( - /* extra bits for each length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) - ), I = ( - /* extra bits for each distance code */ - new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) - ), B = ( - /* extra bits for each bit length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) - ), P = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), z = 512, k = new Array((s + 2) * 2); - h(k); - const N = new Array(o * 2); - h(N); - const R = new Array(z); - h(R); - const U = new Array(y - S + 1); - h(U); - const W = new Array(w); - h(W); - const G = new Array(o); - h(G); - function F(x, H, O, q, ne) { - this.static_tree = x, this.extra_bits = H, this.extra_base = O, this.elems = q, this.max_length = ne, this.has_stree = x && x.length; - } - let V, J, X; - function oe(x, H) { - this.dyn_tree = x, this.max_code = 0, this.stat_desc = H; - } - const te = (x) => x < 256 ? R[x] : R[256 + (x >>> 7)], ve = (x, H) => { - x.pending_buf[x.pending++] = H & 255, x.pending_buf[x.pending++] = H >>> 8 & 255; - }, se = (x, H, O) => { - x.bi_valid > a - O ? (x.bi_buf |= H << x.bi_valid & 65535, ve(x, x.bi_buf), x.bi_buf = H >> a - x.bi_valid, x.bi_valid += O - a) : (x.bi_buf |= H << x.bi_valid & 65535, x.bi_valid += O); - }, le = (x, H, O) => { - se( - x, - O[H * 2], - O[H * 2 + 1] - /*.Len*/ - ); - }, Ce = (x, H) => { - let O = 0; - do - O |= x & 1, x >>>= 1, O <<= 1; - while (--H > 0); - return O >>> 1; - }, be = (x) => { - x.bi_valid === 16 ? (ve(x, x.bi_buf), x.bi_buf = 0, x.bi_valid = 0) : x.bi_valid >= 8 && (x.pending_buf[x.pending++] = x.bi_buf & 255, x.bi_buf >>= 8, x.bi_valid -= 8); - }, Le = (x, H) => { - const O = H.dyn_tree, q = H.max_code, ne = H.stat_desc.static_tree, ie = H.stat_desc.has_stree, Pe = H.stat_desc.extra_bits, we = H.stat_desc.extra_base, Qe = H.stat_desc.max_length; - let me, Ie, ut, Xe, He, qe, Ct = 0; - for (Xe = 0; Xe <= v; Xe++) - x.bl_count[Xe] = 0; - for (O[x.heap[x.heap_max] * 2 + 1] = 0, me = x.heap_max + 1; me < p; me++) - Ie = x.heap[me], Xe = O[O[Ie * 2 + 1] * 2 + 1] + 1, Xe > Qe && (Xe = Qe, Ct++), O[Ie * 2 + 1] = Xe, !(Ie > q) && (x.bl_count[Xe]++, He = 0, Ie >= we && (He = Pe[Ie - we]), qe = O[Ie * 2], x.opt_len += qe * (Xe + He), ie && (x.static_len += qe * (ne[Ie * 2 + 1] + He))); - if (Ct !== 0) { - do { - for (Xe = Qe - 1; x.bl_count[Xe] === 0; ) - Xe--; - x.bl_count[Xe]--, x.bl_count[Xe + 1] += 2, x.bl_count[Qe]--, Ct -= 2; - } while (Ct > 0); - for (Xe = Qe; Xe !== 0; Xe--) - for (Ie = x.bl_count[Xe]; Ie !== 0; ) - ut = x.heap[--me], !(ut > q) && (O[ut * 2 + 1] !== Xe && (x.opt_len += (Xe - O[ut * 2 + 1]) * O[ut * 2], O[ut * 2 + 1] = Xe), Ie--); - } - }, ae = (x, H, O) => { - const q = new Array(v + 1); - let ne = 0, ie, Pe; - for (ie = 1; ie <= v; ie++) - ne = ne + O[ie - 1] << 1, q[ie] = ne; - for (Pe = 0; Pe <= H; Pe++) { - let we = x[Pe * 2 + 1]; - we !== 0 && (x[Pe * 2] = Ce(q[we]++, we)); - } - }, _e = () => { - let x, H, O, q, ne; - const ie = new Array(v + 1); - for (O = 0, q = 0; q < w - 1; q++) - for (W[q] = O, x = 0; x < 1 << D[q]; x++) - U[O++] = q; - for (U[O - 1] = q, ne = 0, q = 0; q < 16; q++) - for (G[q] = ne, x = 0; x < 1 << I[q]; x++) - R[ne++] = q; - for (ne >>= 7; q < o; q++) - for (G[q] = ne << 7, x = 0; x < 1 << I[q] - 7; x++) - R[256 + ne++] = q; - for (H = 0; H <= v; H++) - ie[H] = 0; - for (x = 0; x <= 143; ) - k[x * 2 + 1] = 8, x++, ie[8]++; - for (; x <= 255; ) - k[x * 2 + 1] = 9, x++, ie[9]++; - for (; x <= 279; ) - k[x * 2 + 1] = 7, x++, ie[7]++; - for (; x <= 287; ) - k[x * 2 + 1] = 8, x++, ie[8]++; - for (ae(k, s + 1, ie), x = 0; x < o; x++) - N[x * 2 + 1] = 5, N[x * 2] = Ce(x, 5); - V = new F(k, D, L + 1, s, v), J = new F(N, I, 0, o, v), X = new F(new Array(0), B, 0, A, l); - }, Ee = (x) => { - let H; - for (H = 0; H < s; H++) - x.dyn_ltree[H * 2] = 0; - for (H = 0; H < o; H++) - x.dyn_dtree[H * 2] = 0; - for (H = 0; H < A; H++) - x.bl_tree[H * 2] = 0; - x.dyn_ltree[g * 2] = 1, x.opt_len = x.static_len = 0, x.sym_next = x.matches = 0; - }, Be = (x) => { - x.bi_valid > 8 ? ve(x, x.bi_buf) : x.bi_valid > 0 && (x.pending_buf[x.pending++] = x.bi_buf), x.bi_buf = 0, x.bi_valid = 0; - }, Ne = (x, H, O, q) => { - const ne = H * 2, ie = O * 2; - return x[ne] < x[ie] || x[ne] === x[ie] && q[H] <= q[O]; - }, Ge = (x, H, O) => { - const q = x.heap[O]; - let ne = O << 1; - for (; ne <= x.heap_len && (ne < x.heap_len && Ne(H, x.heap[ne + 1], x.heap[ne], x.depth) && ne++, !Ne(H, q, x.heap[ne], x.depth)); ) - x.heap[O] = x.heap[ne], O = ne, ne <<= 1; - x.heap[O] = q; - }, ke = (x, H, O) => { - let q, ne, ie = 0, Pe, we; - if (x.sym_next !== 0) - do - q = x.pending_buf[x.sym_buf + ie++] & 255, q += (x.pending_buf[x.sym_buf + ie++] & 255) << 8, ne = x.pending_buf[x.sym_buf + ie++], q === 0 ? le(x, ne, H) : (Pe = U[ne], le(x, Pe + L + 1, H), we = D[Pe], we !== 0 && (ne -= W[Pe], se(x, ne, we)), q--, Pe = te(q), le(x, Pe, O), we = I[Pe], we !== 0 && (q -= G[Pe], se(x, q, we))); - while (ie < x.sym_next); - le(x, g, H); - }, pe = (x, H) => { - const O = H.dyn_tree, q = H.stat_desc.static_tree, ne = H.stat_desc.has_stree, ie = H.stat_desc.elems; - let Pe, we, Qe = -1, me; - for (x.heap_len = 0, x.heap_max = p, Pe = 0; Pe < ie; Pe++) - O[Pe * 2] !== 0 ? (x.heap[++x.heap_len] = Qe = Pe, x.depth[Pe] = 0) : O[Pe * 2 + 1] = 0; - for (; x.heap_len < 2; ) - me = x.heap[++x.heap_len] = Qe < 2 ? ++Qe : 0, O[me * 2] = 1, x.depth[me] = 0, x.opt_len--, ne && (x.static_len -= q[me * 2 + 1]); - for (H.max_code = Qe, Pe = x.heap_len >> 1; Pe >= 1; Pe--) - Ge(x, O, Pe); - me = ie; - do - Pe = x.heap[ - 1 - /*SMALLEST*/ - ], x.heap[ - 1 - /*SMALLEST*/ - ] = x.heap[x.heap_len--], Ge( - x, - O, - 1 - /*SMALLEST*/ - ), we = x.heap[ - 1 - /*SMALLEST*/ - ], x.heap[--x.heap_max] = Pe, x.heap[--x.heap_max] = we, O[me * 2] = O[Pe * 2] + O[we * 2], x.depth[me] = (x.depth[Pe] >= x.depth[we] ? x.depth[Pe] : x.depth[we]) + 1, O[Pe * 2 + 1] = O[we * 2 + 1] = me, x.heap[ - 1 - /*SMALLEST*/ - ] = me++, Ge( - x, - O, - 1 - /*SMALLEST*/ - ); - while (x.heap_len >= 2); - x.heap[--x.heap_max] = x.heap[ - 1 - /*SMALLEST*/ - ], Le(x, H), ae(O, Qe, x.bl_count); - }, de = (x, H, O) => { - let q, ne = -1, ie, Pe = H[0 * 2 + 1], we = 0, Qe = 7, me = 4; - for (Pe === 0 && (Qe = 138, me = 3), H[(O + 1) * 2 + 1] = 65535, q = 0; q <= O; q++) - ie = Pe, Pe = H[(q + 1) * 2 + 1], !(++we < Qe && ie === Pe) && (we < me ? x.bl_tree[ie * 2] += we : ie !== 0 ? (ie !== ne && x.bl_tree[ie * 2]++, x.bl_tree[M * 2]++) : we <= 10 ? x.bl_tree[C * 2]++ : x.bl_tree[T * 2]++, we = 0, ne = ie, Pe === 0 ? (Qe = 138, me = 3) : ie === Pe ? (Qe = 6, me = 3) : (Qe = 7, me = 4)); - }, ce = (x, H, O) => { - let q, ne = -1, ie, Pe = H[0 * 2 + 1], we = 0, Qe = 7, me = 4; - for (Pe === 0 && (Qe = 138, me = 3), q = 0; q <= O; q++) - if (ie = Pe, Pe = H[(q + 1) * 2 + 1], !(++we < Qe && ie === Pe)) { - if (we < me) - do - le(x, ie, x.bl_tree); - while (--we !== 0); - else - ie !== 0 ? (ie !== ne && (le(x, ie, x.bl_tree), we--), le(x, M, x.bl_tree), se(x, we - 3, 2)) : we <= 10 ? (le(x, C, x.bl_tree), se(x, we - 3, 3)) : (le(x, T, x.bl_tree), se(x, we - 11, 7)); - we = 0, ne = ie, Pe === 0 ? (Qe = 138, me = 3) : ie === Pe ? (Qe = 6, me = 3) : (Qe = 7, me = 4); - } - }, Ae = (x) => { - let H; - for (de(x, x.dyn_ltree, x.l_desc.max_code), de(x, x.dyn_dtree, x.d_desc.max_code), pe(x, x.bl_desc), H = A - 1; H >= 3 && x.bl_tree[P[H] * 2 + 1] === 0; H--) - ; - return x.opt_len += 3 * (H + 1) + 5 + 5 + 4, H; - }, Oe = (x, H, O, q) => { - let ne; - for (se(x, H - 257, 5), se(x, O - 1, 5), se(x, q - 4, 4), ne = 0; ne < q; ne++) - se(x, x.bl_tree[P[ne] * 2 + 1], 3); - ce(x, x.dyn_ltree, H - 1), ce(x, x.dyn_dtree, O - 1); - }, We = (x) => { - let H = 4093624447, O; - for (O = 0; O <= 31; O++, H >>>= 1) - if (H & 1 && x.dyn_ltree[O * 2] !== 0) - return f; - if (x.dyn_ltree[9 * 2] !== 0 || x.dyn_ltree[10 * 2] !== 0 || x.dyn_ltree[13 * 2] !== 0) - return u; - for (O = 32; O < L; O++) - if (x.dyn_ltree[O * 2] !== 0) - return u; - return f; - }; - let Ue = !1; - const Z = (x) => { - Ue || (_e(), Ue = !0), x.l_desc = new oe(x.dyn_ltree, V), x.d_desc = new oe(x.dyn_dtree, J), x.bl_desc = new oe(x.bl_tree, X), x.bi_buf = 0, x.bi_valid = 0, Ee(x); - }, j = (x, H, O, q) => { - se(x, (_ << 1) + (q ? 1 : 0), 3), Be(x), ve(x, O), ve(x, ~O), O && x.pending_buf.set(x.window.subarray(H, H + O), x.pending), x.pending += O; - }, ee = (x) => { - se(x, E << 1, 3), le(x, g, k), be(x); - }, ge = (x, H, O, q) => { - let ne, ie, Pe = 0; - x.level > 0 ? (x.strm.data_type === b && (x.strm.data_type = We(x)), pe(x, x.l_desc), pe(x, x.d_desc), Pe = Ae(x), ne = x.opt_len + 3 + 7 >>> 3, ie = x.static_len + 3 + 7 >>> 3, ie <= ne && (ne = ie)) : ne = ie = O + 5, O + 4 <= ne && H !== -1 ? j(x, H, O, q) : x.strategy === n || ie === ne ? (se(x, (E << 1) + (q ? 1 : 0), 3), ke(x, k, N)) : (se(x, (c << 1) + (q ? 1 : 0), 3), Oe(x, x.l_desc.max_code + 1, x.d_desc.max_code + 1, Pe + 1), ke(x, x.dyn_ltree, x.dyn_dtree)), Ee(x), q && Be(x); - }, ye = (x, H, O) => (x.pending_buf[x.sym_buf + x.sym_next++] = H, x.pending_buf[x.sym_buf + x.sym_next++] = H >> 8, x.pending_buf[x.sym_buf + x.sym_next++] = O, H === 0 ? x.dyn_ltree[O * 2]++ : (x.matches++, H--, x.dyn_ltree[(U[O] + L + 1) * 2]++, x.dyn_dtree[te(H) * 2]++), x.sym_next === x.sym_end); - var $e = Z, Re = j, Y = ge, ue = ye, Se = ee, Fe = { - _tr_init: $e, - _tr_stored_block: Re, - _tr_flush_block: Y, - _tr_tally: ue, - _tr_align: Se - }, De = (x, H, O, q) => { - let ne = x & 65535 | 0, ie = x >>> 16 & 65535 | 0, Pe = 0; - for (; O !== 0; ) { - Pe = O > 2e3 ? 2e3 : O, O -= Pe; - do - ne = ne + H[q++] | 0, ie = ie + ne | 0; - while (--Pe); - ne %= 65521, ie %= 65521; - } - return ne | ie << 16 | 0; - }; - const K = () => { - let x, H = []; - for (var O = 0; O < 256; O++) { - x = O; - for (var q = 0; q < 8; q++) - x = x & 1 ? 3988292384 ^ x >>> 1 : x >>> 1; - H[O] = x; - } - return H; - }, ze = new Uint32Array(K()); - var $ = (x, H, O, q) => { - const ne = ze, ie = q + O; - x ^= -1; - for (let Pe = q; Pe < ie; Pe++) - x = x >>> 8 ^ ne[(x ^ H[Pe]) & 255]; - return x ^ -1; - }, xe = { - 2: "need dictionary", - /* Z_NEED_DICT 2 */ - 1: "stream end", - /* Z_STREAM_END 1 */ - 0: "", - /* Z_OK 0 */ - "-1": "file error", - /* Z_ERRNO (-1) */ - "-2": "stream error", - /* Z_STREAM_ERROR (-2) */ - "-3": "data error", - /* Z_DATA_ERROR (-3) */ - "-4": "insufficient memory", - /* Z_MEM_ERROR (-4) */ - "-5": "buffer error", - /* Z_BUF_ERROR (-5) */ - "-6": "incompatible version" - /* Z_VERSION_ERROR (-6) */ - }, Me = { - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type - }; - const { _tr_init: Q, _tr_stored_block: fe, _tr_flush_block: Te, _tr_tally: Ze, _tr_align: Ke } = Fe, { - Z_NO_FLUSH: je, - Z_PARTIAL_FLUSH: Je, - Z_FULL_FLUSH: St, - Z_FINISH: rt, - Z_BLOCK: it, - Z_OK: tt, - Z_STREAM_END: Et, - Z_STREAM_ERROR: lt, - Z_DATA_ERROR: wt, - Z_BUF_ERROR: Pt, - Z_DEFAULT_COMPRESSION: vt, - Z_FILTERED: bt, - Z_HUFFMAN_ONLY: mt, - Z_RLE: Tt, - Z_FIXED: Ot, - Z_DEFAULT_STRATEGY: kt, - Z_UNKNOWN: Xt, - Z_DEFLATED: Ft - } = Me, Qt = 9, Jt = 15, qt = 8, lr = 256 + 1 + 29, Or = 30, Dr = 19, Pr = 2 * lr + 1, Ir = 15, at = 3, Bt = 258, pt = Bt + at + 1, yt = 32, At = 42, rr = 57, $r = 69, Rr = 73, Br = 91, zr = 103, Ht = 113, fr = 666, Dt = 1, ir = 2, Vt = 3, nr = 4, nn = 3, jt = (x, H) => (x.msg = xe[H], H), Xr = (x) => x * 2 - (x > 4 ? 9 : 0), Gt = (x) => { - let H = x.length; - for (; --H >= 0; ) - x[H] = 0; - }, sn = (x) => { - let H, O, q, ne = x.w_size; - H = x.hash_size, q = H; - do - O = x.head[--q], x.head[q] = O >= ne ? O - ne : 0; - while (--H); - H = ne, q = H; - do - O = x.prev[--q], x.prev[q] = O >= ne ? O - ne : 0; - while (--H); - }; - let Wt = (x, H, O) => (H << x.hash_shift ^ O) & x.hash_mask; - const It = (x) => { - const H = x.state; - let O = H.pending; - O > x.avail_out && (O = x.avail_out), O !== 0 && (x.output.set(H.pending_buf.subarray(H.pending_out, H.pending_out + O), x.next_out), x.next_out += O, H.pending_out += O, x.total_out += O, x.avail_out -= O, H.pending -= O, H.pending === 0 && (H.pending_out = 0)); - }, $t = (x, H) => { - Te(x, x.block_start >= 0 ? x.block_start : -1, x.strstart - x.block_start, H), x.block_start = x.strstart, It(x.strm); - }, dt = (x, H) => { - x.pending_buf[x.pending++] = H; - }, hr = (x, H) => { - x.pending_buf[x.pending++] = H >>> 8 & 255, x.pending_buf[x.pending++] = H & 255; - }, kr = (x, H, O, q) => { - let ne = x.avail_in; - return ne > q && (ne = q), ne === 0 ? 0 : (x.avail_in -= ne, H.set(x.input.subarray(x.next_in, x.next_in + ne), O), x.state.wrap === 1 ? x.adler = De(x.adler, H, ne, O) : x.state.wrap === 2 && (x.adler = $(x.adler, H, ne, O)), x.next_in += ne, x.total_in += ne, ne); - }, Qr = (x, H) => { - let O = x.max_chain_length, q = x.strstart, ne, ie, Pe = x.prev_length, we = x.nice_match; - const Qe = x.strstart > x.w_size - pt ? x.strstart - (x.w_size - pt) : 0, me = x.window, Ie = x.w_mask, ut = x.prev, Xe = x.strstart + Bt; - let He = me[q + Pe - 1], qe = me[q + Pe]; - x.prev_length >= x.good_match && (O >>= 2), we > x.lookahead && (we = x.lookahead); - do - if (ne = H, !(me[ne + Pe] !== qe || me[ne + Pe - 1] !== He || me[ne] !== me[q] || me[++ne] !== me[q + 1])) { - q += 2, ne++; - do - ; - while (me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && me[++q] === me[++ne] && q < Xe); - if (ie = Bt - (Xe - q), q = Xe - Bt, ie > Pe) { - if (x.match_start = H, Pe = ie, ie >= we) - break; - He = me[q + Pe - 1], qe = me[q + Pe]; - } - } - while ((H = ut[H & Ie]) > Qe && --O !== 0); - return Pe <= x.lookahead ? Pe : x.lookahead; - }, sr = (x) => { - const H = x.w_size; - let O, q, ne; - do { - if (q = x.window_size - x.lookahead - x.strstart, x.strstart >= H + (H - pt) && (x.window.set(x.window.subarray(H, H + H - q), 0), x.match_start -= H, x.strstart -= H, x.block_start -= H, x.insert > x.strstart && (x.insert = x.strstart), sn(x), q += H), x.strm.avail_in === 0) - break; - if (O = kr(x.strm, x.window, x.strstart + x.lookahead, q), x.lookahead += O, x.lookahead + x.insert >= at) - for (ne = x.strstart - x.insert, x.ins_h = x.window[ne], x.ins_h = Wt(x, x.ins_h, x.window[ne + 1]); x.insert && (x.ins_h = Wt(x, x.ins_h, x.window[ne + at - 1]), x.prev[ne & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = ne, ne++, x.insert--, !(x.lookahead + x.insert < at)); ) - ; - } while (x.lookahead < pt && x.strm.avail_in !== 0); - }, Jr = (x, H) => { - let O = x.pending_buf_size - 5 > x.w_size ? x.w_size : x.pending_buf_size - 5, q, ne, ie, Pe = 0, we = x.strm.avail_in; - do { - if (q = 65535, ie = x.bi_valid + 42 >> 3, x.strm.avail_out < ie || (ie = x.strm.avail_out - ie, ne = x.strstart - x.block_start, q > ne + x.strm.avail_in && (q = ne + x.strm.avail_in), q > ie && (q = ie), q < O && (q === 0 && H !== rt || H === je || q !== ne + x.strm.avail_in))) - break; - Pe = H === rt && q === ne + x.strm.avail_in ? 1 : 0, fe(x, 0, 0, Pe), x.pending_buf[x.pending - 4] = q, x.pending_buf[x.pending - 3] = q >> 8, x.pending_buf[x.pending - 2] = ~q, x.pending_buf[x.pending - 1] = ~q >> 8, It(x.strm), ne && (ne > q && (ne = q), x.strm.output.set(x.window.subarray(x.block_start, x.block_start + ne), x.strm.next_out), x.strm.next_out += ne, x.strm.avail_out -= ne, x.strm.total_out += ne, x.block_start += ne, q -= ne), q && (kr(x.strm, x.strm.output, x.strm.next_out, q), x.strm.next_out += q, x.strm.avail_out -= q, x.strm.total_out += q); - } while (Pe === 0); - return we -= x.strm.avail_in, we && (we >= x.w_size ? (x.matches = 2, x.window.set(x.strm.input.subarray(x.strm.next_in - x.w_size, x.strm.next_in), 0), x.strstart = x.w_size, x.insert = x.strstart) : (x.window_size - x.strstart <= we && (x.strstart -= x.w_size, x.window.set(x.window.subarray(x.w_size, x.w_size + x.strstart), 0), x.matches < 2 && x.matches++, x.insert > x.strstart && (x.insert = x.strstart)), x.window.set(x.strm.input.subarray(x.strm.next_in - we, x.strm.next_in), x.strstart), x.strstart += we, x.insert += we > x.w_size - x.insert ? x.w_size - x.insert : we), x.block_start = x.strstart), x.high_water < x.strstart && (x.high_water = x.strstart), Pe ? nr : H !== je && H !== rt && x.strm.avail_in === 0 && x.strstart === x.block_start ? ir : (ie = x.window_size - x.strstart, x.strm.avail_in > ie && x.block_start >= x.w_size && (x.block_start -= x.w_size, x.strstart -= x.w_size, x.window.set(x.window.subarray(x.w_size, x.w_size + x.strstart), 0), x.matches < 2 && x.matches++, ie += x.w_size, x.insert > x.strstart && (x.insert = x.strstart)), ie > x.strm.avail_in && (ie = x.strm.avail_in), ie && (kr(x.strm, x.window, x.strstart, ie), x.strstart += ie, x.insert += ie > x.w_size - x.insert ? x.w_size - x.insert : ie), x.high_water < x.strstart && (x.high_water = x.strstart), ie = x.bi_valid + 42 >> 3, ie = x.pending_buf_size - ie > 65535 ? 65535 : x.pending_buf_size - ie, O = ie > x.w_size ? x.w_size : ie, ne = x.strstart - x.block_start, (ne >= O || (ne || H === rt) && H !== je && x.strm.avail_in === 0 && ne <= ie) && (q = ne > ie ? ie : ne, Pe = H === rt && x.strm.avail_in === 0 && q === ne ? 1 : 0, fe(x, x.block_start, q, Pe), x.block_start += q, It(x.strm)), Pe ? Vt : Dt); - }, Fr = (x, H) => { - let O, q; - for (; ; ) { - if (x.lookahead < pt) { - if (sr(x), x.lookahead < pt && H === je) - return Dt; - if (x.lookahead === 0) - break; - } - if (O = 0, x.lookahead >= at && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart), O !== 0 && x.strstart - O <= x.w_size - pt && (x.match_length = Qr(x, O)), x.match_length >= at) - if (q = Ze(x, x.strstart - x.match_start, x.match_length - at), x.lookahead -= x.match_length, x.match_length <= x.max_lazy_match && x.lookahead >= at) { - x.match_length--; - do - x.strstart++, x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart; - while (--x.match_length !== 0); - x.strstart++; - } else - x.strstart += x.match_length, x.match_length = 0, x.ins_h = x.window[x.strstart], x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + 1]); - else - q = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++; - if (q && ($t(x, !1), x.strm.avail_out === 0)) - return Dt; - } - return x.insert = x.strstart < at - 1 ? x.strstart : at - 1, H === rt ? ($t(x, !0), x.strm.avail_out === 0 ? Vt : nr) : x.sym_next && ($t(x, !1), x.strm.avail_out === 0) ? Dt : ir; - }, ar = (x, H) => { - let O, q, ne; - for (; ; ) { - if (x.lookahead < pt) { - if (sr(x), x.lookahead < pt && H === je) - return Dt; - if (x.lookahead === 0) - break; - } - if (O = 0, x.lookahead >= at && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart), x.prev_length = x.match_length, x.prev_match = x.match_start, x.match_length = at - 1, O !== 0 && x.prev_length < x.max_lazy_match && x.strstart - O <= x.w_size - pt && (x.match_length = Qr(x, O), x.match_length <= 5 && (x.strategy === bt || x.match_length === at && x.strstart - x.match_start > 4096) && (x.match_length = at - 1)), x.prev_length >= at && x.match_length <= x.prev_length) { - ne = x.strstart + x.lookahead - at, q = Ze(x, x.strstart - 1 - x.prev_match, x.prev_length - at), x.lookahead -= x.prev_length - 1, x.prev_length -= 2; - do - ++x.strstart <= ne && (x.ins_h = Wt(x, x.ins_h, x.window[x.strstart + at - 1]), O = x.prev[x.strstart & x.w_mask] = x.head[x.ins_h], x.head[x.ins_h] = x.strstart); - while (--x.prev_length !== 0); - if (x.match_available = 0, x.match_length = at - 1, x.strstart++, q && ($t(x, !1), x.strm.avail_out === 0)) - return Dt; - } else if (x.match_available) { - if (q = Ze(x, 0, x.window[x.strstart - 1]), q && $t(x, !1), x.strstart++, x.lookahead--, x.strm.avail_out === 0) - return Dt; - } else - x.match_available = 1, x.strstart++, x.lookahead--; - } - return x.match_available && (q = Ze(x, 0, x.window[x.strstart - 1]), x.match_available = 0), x.insert = x.strstart < at - 1 ? x.strstart : at - 1, H === rt ? ($t(x, !0), x.strm.avail_out === 0 ? Vt : nr) : x.sym_next && ($t(x, !1), x.strm.avail_out === 0) ? Dt : ir; - }, an = (x, H) => { - let O, q, ne, ie; - const Pe = x.window; - for (; ; ) { - if (x.lookahead <= Bt) { - if (sr(x), x.lookahead <= Bt && H === je) - return Dt; - if (x.lookahead === 0) - break; - } - if (x.match_length = 0, x.lookahead >= at && x.strstart > 0 && (ne = x.strstart - 1, q = Pe[ne], q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne])) { - ie = x.strstart + Bt; - do - ; - while (q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && q === Pe[++ne] && ne < ie); - x.match_length = Bt - (ie - ne), x.match_length > x.lookahead && (x.match_length = x.lookahead); - } - if (x.match_length >= at ? (O = Ze(x, 1, x.match_length - at), x.lookahead -= x.match_length, x.strstart += x.match_length, x.match_length = 0) : (O = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++), O && ($t(x, !1), x.strm.avail_out === 0)) - return Dt; - } - return x.insert = 0, H === rt ? ($t(x, !0), x.strm.avail_out === 0 ? Vt : nr) : x.sym_next && ($t(x, !1), x.strm.avail_out === 0) ? Dt : ir; - }, on = (x, H) => { - let O; - for (; ; ) { - if (x.lookahead === 0 && (sr(x), x.lookahead === 0)) { - if (H === je) - return Dt; - break; - } - if (x.match_length = 0, O = Ze(x, 0, x.window[x.strstart]), x.lookahead--, x.strstart++, O && ($t(x, !1), x.strm.avail_out === 0)) - return Dt; - } - return x.insert = 0, H === rt ? ($t(x, !0), x.strm.avail_out === 0 ? Vt : nr) : x.sym_next && ($t(x, !1), x.strm.avail_out === 0) ? Dt : ir; - }; - function zt(x, H, O, q, ne) { - this.good_length = x, this.max_lazy = H, this.nice_length = O, this.max_chain = q, this.func = ne; - } - const cr = [ - /* good lazy nice chain */ - new zt(0, 0, 0, 0, Jr), - /* 0 store only */ - new zt(4, 4, 8, 4, Fr), - /* 1 max speed, no lazy matches */ - new zt(4, 5, 16, 8, Fr), - /* 2 */ - new zt(4, 6, 32, 32, Fr), - /* 3 */ - new zt(4, 4, 16, 16, ar), - /* 4 lazy matches */ - new zt(8, 16, 32, 32, ar), - /* 5 */ - new zt(8, 16, 128, 128, ar), - /* 6 */ - new zt(8, 32, 128, 256, ar), - /* 7 */ - new zt(32, 128, 258, 1024, ar), - /* 8 */ - new zt(32, 258, 258, 4096, ar) - /* 9 max compression */ - ], ln = (x) => { - x.window_size = 2 * x.w_size, Gt(x.head), x.max_lazy_match = cr[x.level].max_lazy, x.good_match = cr[x.level].good_length, x.nice_match = cr[x.level].nice_length, x.max_chain_length = cr[x.level].max_chain, x.strstart = 0, x.block_start = 0, x.lookahead = 0, x.insert = 0, x.match_length = x.prev_length = at - 1, x.match_available = 0, x.ins_h = 0; - }; - function hn() { - this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = Ft, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(Pr * 2), this.dyn_dtree = new Uint16Array((2 * Or + 1) * 2), this.bl_tree = new Uint16Array((2 * Dr + 1) * 2), Gt(this.dyn_ltree), Gt(this.dyn_dtree), Gt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(Ir + 1), this.heap = new Uint16Array(2 * lr + 1), Gt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * lr + 1), Gt(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; - } - const ur = (x) => { - if (!x) - return 1; - const H = x.state; - return !H || H.strm !== x || H.status !== At && //#ifdef GZIP - H.status !== rr && //#endif - H.status !== $r && H.status !== Rr && H.status !== Br && H.status !== zr && H.status !== Ht && H.status !== fr ? 1 : 0; - }, qr = (x) => { - if (ur(x)) - return jt(x, lt); - x.total_in = x.total_out = 0, x.data_type = Xt; - const H = x.state; - return H.pending = 0, H.pending_out = 0, H.wrap < 0 && (H.wrap = -H.wrap), H.status = //#ifdef GZIP - H.wrap === 2 ? rr : ( - //#endif - H.wrap ? At : Ht - ), x.adler = H.wrap === 2 ? 0 : 1, H.last_flush = -2, Q(H), tt; - }, ei = (x) => { - const H = qr(x); - return H === tt && ln(x.state), H; - }, cn = (x, H) => ur(x) || x.state.wrap !== 2 ? lt : (x.state.gzhead = H, tt), ti = (x, H, O, q, ne, ie) => { - if (!x) - return lt; - let Pe = 1; - if (H === vt && (H = 6), q < 0 ? (Pe = 0, q = -q) : q > 15 && (Pe = 2, q -= 16), ne < 1 || ne > Qt || O !== Ft || q < 8 || q > 15 || H < 0 || H > 9 || ie < 0 || ie > Ot || q === 8 && Pe !== 1) - return jt(x, lt); - q === 8 && (q = 9); - const we = new hn(); - return x.state = we, we.strm = x, we.status = At, we.wrap = Pe, we.gzhead = null, we.w_bits = q, we.w_size = 1 << we.w_bits, we.w_mask = we.w_size - 1, we.hash_bits = ne + 7, we.hash_size = 1 << we.hash_bits, we.hash_mask = we.hash_size - 1, we.hash_shift = ~~((we.hash_bits + at - 1) / at), we.window = new Uint8Array(we.w_size * 2), we.head = new Uint16Array(we.hash_size), we.prev = new Uint16Array(we.w_size), we.lit_bufsize = 1 << ne + 6, we.pending_buf_size = we.lit_bufsize * 4, we.pending_buf = new Uint8Array(we.pending_buf_size), we.sym_buf = we.lit_bufsize, we.sym_end = (we.lit_bufsize - 1) * 3, we.level = H, we.strategy = ie, we.method = O, ei(x); - }, un = (x, H) => ti(x, H, Ft, Jt, qt, kt), dn = (x, H) => { - if (ur(x) || H > it || H < 0) - return x ? jt(x, lt) : lt; - const O = x.state; - if (!x.output || x.avail_in !== 0 && !x.input || O.status === fr && H !== rt) - return jt(x, x.avail_out === 0 ? Pt : lt); - const q = O.last_flush; - if (O.last_flush = H, O.pending !== 0) { - if (It(x), x.avail_out === 0) - return O.last_flush = -1, tt; - } else if (x.avail_in === 0 && Xr(H) <= Xr(q) && H !== rt) - return jt(x, Pt); - if (O.status === fr && x.avail_in !== 0) - return jt(x, Pt); - if (O.status === At && O.wrap === 0 && (O.status = Ht), O.status === At) { - let ne = Ft + (O.w_bits - 8 << 4) << 8, ie = -1; - if (O.strategy >= mt || O.level < 2 ? ie = 0 : O.level < 6 ? ie = 1 : O.level === 6 ? ie = 2 : ie = 3, ne |= ie << 6, O.strstart !== 0 && (ne |= yt), ne += 31 - ne % 31, hr(O, ne), O.strstart !== 0 && (hr(O, x.adler >>> 16), hr(O, x.adler & 65535)), x.adler = 1, O.status = Ht, It(x), O.pending !== 0) - return O.last_flush = -1, tt; - } - if (O.status === rr) { - if (x.adler = 0, dt(O, 31), dt(O, 139), dt(O, 8), O.gzhead) - dt( - O, - (O.gzhead.text ? 1 : 0) + (O.gzhead.hcrc ? 2 : 0) + (O.gzhead.extra ? 4 : 0) + (O.gzhead.name ? 8 : 0) + (O.gzhead.comment ? 16 : 0) - ), dt(O, O.gzhead.time & 255), dt(O, O.gzhead.time >> 8 & 255), dt(O, O.gzhead.time >> 16 & 255), dt(O, O.gzhead.time >> 24 & 255), dt(O, O.level === 9 ? 2 : O.strategy >= mt || O.level < 2 ? 4 : 0), dt(O, O.gzhead.os & 255), O.gzhead.extra && O.gzhead.extra.length && (dt(O, O.gzhead.extra.length & 255), dt(O, O.gzhead.extra.length >> 8 & 255)), O.gzhead.hcrc && (x.adler = $(x.adler, O.pending_buf, O.pending, 0)), O.gzindex = 0, O.status = $r; - else if (dt(O, 0), dt(O, 0), dt(O, 0), dt(O, 0), dt(O, 0), dt(O, O.level === 9 ? 2 : O.strategy >= mt || O.level < 2 ? 4 : 0), dt(O, nn), O.status = Ht, It(x), O.pending !== 0) - return O.last_flush = -1, tt; - } - if (O.status === $r) { - if (O.gzhead.extra) { - let ne = O.pending, ie = (O.gzhead.extra.length & 65535) - O.gzindex; - for (; O.pending + ie > O.pending_buf_size; ) { - let we = O.pending_buf_size - O.pending; - if (O.pending_buf.set(O.gzhead.extra.subarray(O.gzindex, O.gzindex + we), O.pending), O.pending = O.pending_buf_size, O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)), O.gzindex += we, It(x), O.pending !== 0) - return O.last_flush = -1, tt; - ne = 0, ie -= we; - } - let Pe = new Uint8Array(O.gzhead.extra); - O.pending_buf.set(Pe.subarray(O.gzindex, O.gzindex + ie), O.pending), O.pending += ie, O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)), O.gzindex = 0; - } - O.status = Rr; - } - if (O.status === Rr) { - if (O.gzhead.name) { - let ne = O.pending, ie; - do { - if (O.pending === O.pending_buf_size) { - if (O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)), It(x), O.pending !== 0) - return O.last_flush = -1, tt; - ne = 0; - } - O.gzindex < O.gzhead.name.length ? ie = O.gzhead.name.charCodeAt(O.gzindex++) & 255 : ie = 0, dt(O, ie); - } while (ie !== 0); - O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)), O.gzindex = 0; - } - O.status = Br; - } - if (O.status === Br) { - if (O.gzhead.comment) { - let ne = O.pending, ie; - do { - if (O.pending === O.pending_buf_size) { - if (O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)), It(x), O.pending !== 0) - return O.last_flush = -1, tt; - ne = 0; - } - O.gzindex < O.gzhead.comment.length ? ie = O.gzhead.comment.charCodeAt(O.gzindex++) & 255 : ie = 0, dt(O, ie); - } while (ie !== 0); - O.gzhead.hcrc && O.pending > ne && (x.adler = $(x.adler, O.pending_buf, O.pending - ne, ne)); - } - O.status = zr; - } - if (O.status === zr) { - if (O.gzhead.hcrc) { - if (O.pending + 2 > O.pending_buf_size && (It(x), O.pending !== 0)) - return O.last_flush = -1, tt; - dt(O, x.adler & 255), dt(O, x.adler >> 8 & 255), x.adler = 0; - } - if (O.status = Ht, It(x), O.pending !== 0) - return O.last_flush = -1, tt; - } - if (x.avail_in !== 0 || O.lookahead !== 0 || H !== je && O.status !== fr) { - let ne = O.level === 0 ? Jr(O, H) : O.strategy === mt ? on(O, H) : O.strategy === Tt ? an(O, H) : cr[O.level].func(O, H); - if ((ne === Vt || ne === nr) && (O.status = fr), ne === Dt || ne === Vt) - return x.avail_out === 0 && (O.last_flush = -1), tt; - if (ne === ir && (H === Je ? Ke(O) : H !== it && (fe(O, 0, 0, !1), H === St && (Gt(O.head), O.lookahead === 0 && (O.strstart = 0, O.block_start = 0, O.insert = 0))), It(x), x.avail_out === 0)) - return O.last_flush = -1, tt; - } - return H !== rt ? tt : O.wrap <= 0 ? Et : (O.wrap === 2 ? (dt(O, x.adler & 255), dt(O, x.adler >> 8 & 255), dt(O, x.adler >> 16 & 255), dt(O, x.adler >> 24 & 255), dt(O, x.total_in & 255), dt(O, x.total_in >> 8 & 255), dt(O, x.total_in >> 16 & 255), dt(O, x.total_in >> 24 & 255)) : (hr(O, x.adler >>> 16), hr(O, x.adler & 65535)), It(x), O.wrap > 0 && (O.wrap = -O.wrap), O.pending !== 0 ? tt : Et); - }, _n = (x) => { - if (ur(x)) - return lt; - const H = x.state.status; - return x.state = null, H === Ht ? jt(x, wt) : tt; - }, pn = (x, H) => { - let O = H.length; - if (ur(x)) - return lt; - const q = x.state, ne = q.wrap; - if (ne === 2 || ne === 1 && q.status !== At || q.lookahead) - return lt; - if (ne === 1 && (x.adler = De(x.adler, H, O, 0)), q.wrap = 0, O >= q.w_size) { - ne === 0 && (Gt(q.head), q.strstart = 0, q.block_start = 0, q.insert = 0); - let Qe = new Uint8Array(q.w_size); - Qe.set(H.subarray(O - q.w_size, O), 0), H = Qe, O = q.w_size; - } - const ie = x.avail_in, Pe = x.next_in, we = x.input; - for (x.avail_in = O, x.next_in = 0, x.input = H, sr(q); q.lookahead >= at; ) { - let Qe = q.strstart, me = q.lookahead - (at - 1); - do - q.ins_h = Wt(q, q.ins_h, q.window[Qe + at - 1]), q.prev[Qe & q.w_mask] = q.head[q.ins_h], q.head[q.ins_h] = Qe, Qe++; - while (--me); - q.strstart = Qe, q.lookahead = at - 1, sr(q); - } - return q.strstart += q.lookahead, q.block_start = q.strstart, q.insert = q.lookahead, q.lookahead = 0, q.match_length = q.prev_length = at - 1, q.match_available = 0, x.next_in = Pe, x.input = we, x.avail_in = ie, q.wrap = ne, tt; - }; - var gn = un, mn = ti, vn = ei, bn = qr, yn = cn, xn = dn, En = _n, wn = pn, An = "pako deflate (from Nodeca project)", dr = { - deflateInit: gn, - deflateInit2: mn, - deflateReset: vn, - deflateResetKeep: bn, - deflateSetHeader: yn, - deflate: xn, - deflateEnd: En, - deflateSetDictionary: wn, - deflateInfo: An - }; - const Mn = (x, H) => Object.prototype.hasOwnProperty.call(x, H); - var Cn = function(x) { - const H = Array.prototype.slice.call(arguments, 1); - for (; H.length; ) { - const O = H.shift(); - if (O) { - if (typeof O != "object") - throw new TypeError(O + "must be non-object"); - for (const q in O) - Mn(O, q) && (x[q] = O[q]); - } - } - return x; - }, Sn = (x) => { - let H = 0; - for (let q = 0, ne = x.length; q < ne; q++) - H += x[q].length; - const O = new Uint8Array(H); - for (let q = 0, ne = 0, ie = x.length; q < ie; q++) { - let Pe = x[q]; - O.set(Pe, ne), ne += Pe.length; - } - return O; - }, yr = { - assign: Cn, - flattenChunks: Sn - }; - let ri = !0; - try { - String.fromCharCode.apply(null, new Uint8Array(1)); - } catch { - ri = !1; - } - const _r = new Uint8Array(256); - for (let x = 0; x < 256; x++) - _r[x] = x >= 252 ? 6 : x >= 248 ? 5 : x >= 240 ? 4 : x >= 224 ? 3 : x >= 192 ? 2 : 1; - _r[254] = _r[254] = 1; - var Ln = (x) => { - if (typeof TextEncoder == "function" && TextEncoder.prototype.encode) - return new TextEncoder().encode(x); - let H, O, q, ne, ie, Pe = x.length, we = 0; - for (ne = 0; ne < Pe; ne++) - O = x.charCodeAt(ne), (O & 64512) === 55296 && ne + 1 < Pe && (q = x.charCodeAt(ne + 1), (q & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (q - 56320), ne++)), we += O < 128 ? 1 : O < 2048 ? 2 : O < 65536 ? 3 : 4; - for (H = new Uint8Array(we), ie = 0, ne = 0; ie < we; ne++) - O = x.charCodeAt(ne), (O & 64512) === 55296 && ne + 1 < Pe && (q = x.charCodeAt(ne + 1), (q & 64512) === 56320 && (O = 65536 + (O - 55296 << 10) + (q - 56320), ne++)), O < 128 ? H[ie++] = O : O < 2048 ? (H[ie++] = 192 | O >>> 6, H[ie++] = 128 | O & 63) : O < 65536 ? (H[ie++] = 224 | O >>> 12, H[ie++] = 128 | O >>> 6 & 63, H[ie++] = 128 | O & 63) : (H[ie++] = 240 | O >>> 18, H[ie++] = 128 | O >>> 12 & 63, H[ie++] = 128 | O >>> 6 & 63, H[ie++] = 128 | O & 63); - return H; - }; - const Tn = (x, H) => { - if (H < 65534 && x.subarray && ri) - return String.fromCharCode.apply(null, x.length === H ? x : x.subarray(0, H)); - let O = ""; - for (let q = 0; q < H; q++) - O += String.fromCharCode(x[q]); - return O; - }; - var On = (x, H) => { - const O = H || x.length; - if (typeof TextDecoder == "function" && TextDecoder.prototype.decode) - return new TextDecoder().decode(x.subarray(0, H)); - let q, ne; - const ie = new Array(O * 2); - for (ne = 0, q = 0; q < O; ) { - let Pe = x[q++]; - if (Pe < 128) { - ie[ne++] = Pe; - continue; - } - let we = _r[Pe]; - if (we > 4) { - ie[ne++] = 65533, q += we - 1; - continue; - } - for (Pe &= we === 2 ? 31 : we === 3 ? 15 : 7; we > 1 && q < O; ) - Pe = Pe << 6 | x[q++] & 63, we--; - if (we > 1) { - ie[ne++] = 65533; - continue; - } - Pe < 65536 ? ie[ne++] = Pe : (Pe -= 65536, ie[ne++] = 55296 | Pe >> 10 & 1023, ie[ne++] = 56320 | Pe & 1023); - } - return Tn(ie, ne); - }, Dn = (x, H) => { - H = H || x.length, H > x.length && (H = x.length); - let O = H - 1; - for (; O >= 0 && (x[O] & 192) === 128; ) - O--; - return O < 0 || O === 0 ? H : O + _r[x[O]] > H ? O : H; - }, pr = { - string2buf: Ln, - buf2string: On, - utf8border: Dn - }; - function Pn() { - this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; - } - var ii = Pn; - const ni = Object.prototype.toString, { - Z_NO_FLUSH: In, - Z_SYNC_FLUSH: $n, - Z_FULL_FLUSH: Rn, - Z_FINISH: Bn, - Z_OK: xr, - Z_STREAM_END: zn, - Z_DEFAULT_COMPRESSION: kn, - Z_DEFAULT_STRATEGY: Fn, - Z_DEFLATED: Un - } = Me; - function gr(x) { - this.options = yr.assign({ - level: kn, - method: Un, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Fn - }, x || {}); - let H = this.options; - H.raw && H.windowBits > 0 ? H.windowBits = -H.windowBits : H.gzip && H.windowBits > 0 && H.windowBits < 16 && (H.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0; - let O = dr.deflateInit2( - this.strm, - H.level, - H.method, - H.windowBits, - H.memLevel, - H.strategy - ); - if (O !== xr) - throw new Error(xe[O]); - if (H.header && dr.deflateSetHeader(this.strm, H.header), H.dictionary) { - let q; - if (typeof H.dictionary == "string" ? q = pr.string2buf(H.dictionary) : ni.call(H.dictionary) === "[object ArrayBuffer]" ? q = new Uint8Array(H.dictionary) : q = H.dictionary, O = dr.deflateSetDictionary(this.strm, q), O !== xr) - throw new Error(xe[O]); - this._dict_set = !0; - } - } - gr.prototype.push = function(x, H) { - const O = this.strm, q = this.options.chunkSize; - let ne, ie; - if (this.ended) - return !1; - for (H === ~~H ? ie = H : ie = H === !0 ? Bn : In, typeof x == "string" ? O.input = pr.string2buf(x) : ni.call(x) === "[object ArrayBuffer]" ? O.input = new Uint8Array(x) : O.input = x, O.next_in = 0, O.avail_in = O.input.length; ; ) { - if (O.avail_out === 0 && (O.output = new Uint8Array(q), O.next_out = 0, O.avail_out = q), (ie === $n || ie === Rn) && O.avail_out <= 6) { - this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0; - continue; - } - if (ne = dr.deflate(O, ie), ne === zn) - return O.next_out > 0 && this.onData(O.output.subarray(0, O.next_out)), ne = dr.deflateEnd(this.strm), this.onEnd(ne), this.ended = !0, ne === xr; - if (O.avail_out === 0) { - this.onData(O.output); - continue; - } - if (ie > 0 && O.next_out > 0) { - this.onData(O.output.subarray(0, O.next_out)), O.avail_out = 0; - continue; - } - if (O.avail_in === 0) - break; - } - return !0; - }, gr.prototype.onData = function(x) { - this.chunks.push(x); - }, gr.prototype.onEnd = function(x) { - x === xr && (this.result = yr.flattenChunks(this.chunks)), this.chunks = [], this.err = x, this.msg = this.strm.msg; - }; - function Ur(x, H) { - const O = new gr(H); - if (O.push(x, !0), O.err) - throw O.msg || xe[O.err]; - return O.result; - } - function Nn(x, H) { - return H = H || {}, H.raw = !0, Ur(x, H); - } - function Gn(x, H) { - return H = H || {}, H.gzip = !0, Ur(x, H); - } - var Wn = gr, Hn = Ur, Vn = Nn, jn = Gn, Kn = Me, Zn = { - Deflate: Wn, - deflate: Hn, - deflateRaw: Vn, - gzip: jn, - constants: Kn - }; - const Er = 16209, Yn = 16191; - var Xn = function(H, O) { - let q, ne, ie, Pe, we, Qe, me, Ie, ut, Xe, He, qe, Ct, ht, st, gt, ot, Ye, _t, Lt, et, xt, ct, nt; - const ft = H.state; - q = H.next_in, ct = H.input, ne = q + (H.avail_in - 5), ie = H.next_out, nt = H.output, Pe = ie - (O - H.avail_out), we = ie + (H.avail_out - 257), Qe = ft.dmax, me = ft.wsize, Ie = ft.whave, ut = ft.wnext, Xe = ft.window, He = ft.hold, qe = ft.bits, Ct = ft.lencode, ht = ft.distcode, st = (1 << ft.lenbits) - 1, gt = (1 << ft.distbits) - 1; - e: - do { - qe < 15 && (He += ct[q++] << qe, qe += 8, He += ct[q++] << qe, qe += 8), ot = Ct[He & st]; - t: - for (; ; ) { - if (Ye = ot >>> 24, He >>>= Ye, qe -= Ye, Ye = ot >>> 16 & 255, Ye === 0) - nt[ie++] = ot & 65535; - else if (Ye & 16) { - _t = ot & 65535, Ye &= 15, Ye && (qe < Ye && (He += ct[q++] << qe, qe += 8), _t += He & (1 << Ye) - 1, He >>>= Ye, qe -= Ye), qe < 15 && (He += ct[q++] << qe, qe += 8, He += ct[q++] << qe, qe += 8), ot = ht[He & gt]; - r: - for (; ; ) { - if (Ye = ot >>> 24, He >>>= Ye, qe -= Ye, Ye = ot >>> 16 & 255, Ye & 16) { - if (Lt = ot & 65535, Ye &= 15, qe < Ye && (He += ct[q++] << qe, qe += 8, qe < Ye && (He += ct[q++] << qe, qe += 8)), Lt += He & (1 << Ye) - 1, Lt > Qe) { - H.msg = "invalid distance too far back", ft.mode = Er; - break e; - } - if (He >>>= Ye, qe -= Ye, Ye = ie - Pe, Lt > Ye) { - if (Ye = Lt - Ye, Ye > Ie && ft.sane) { - H.msg = "invalid distance too far back", ft.mode = Er; - break e; - } - if (et = 0, xt = Xe, ut === 0) { - if (et += me - Ye, Ye < _t) { - _t -= Ye; - do - nt[ie++] = Xe[et++]; - while (--Ye); - et = ie - Lt, xt = nt; - } - } else if (ut < Ye) { - if (et += me + ut - Ye, Ye -= ut, Ye < _t) { - _t -= Ye; - do - nt[ie++] = Xe[et++]; - while (--Ye); - if (et = 0, ut < _t) { - Ye = ut, _t -= Ye; - do - nt[ie++] = Xe[et++]; - while (--Ye); - et = ie - Lt, xt = nt; - } - } - } else if (et += ut - Ye, Ye < _t) { - _t -= Ye; - do - nt[ie++] = Xe[et++]; - while (--Ye); - et = ie - Lt, xt = nt; - } - for (; _t > 2; ) - nt[ie++] = xt[et++], nt[ie++] = xt[et++], nt[ie++] = xt[et++], _t -= 3; - _t && (nt[ie++] = xt[et++], _t > 1 && (nt[ie++] = xt[et++])); - } else { - et = ie - Lt; - do - nt[ie++] = nt[et++], nt[ie++] = nt[et++], nt[ie++] = nt[et++], _t -= 3; - while (_t > 2); - _t && (nt[ie++] = nt[et++], _t > 1 && (nt[ie++] = nt[et++])); - } - } else if (Ye & 64) { - H.msg = "invalid distance code", ft.mode = Er; - break e; - } else { - ot = ht[(ot & 65535) + (He & (1 << Ye) - 1)]; - continue r; - } - break; - } - } else if (Ye & 64) - if (Ye & 32) { - ft.mode = Yn; - break e; - } else { - H.msg = "invalid literal/length code", ft.mode = Er; - break e; - } - else { - ot = Ct[(ot & 65535) + (He & (1 << Ye) - 1)]; - continue t; - } - break; - } - } while (q < ne && ie < we); - _t = qe >> 3, q -= _t, qe -= _t << 3, He &= (1 << qe) - 1, H.next_in = q, H.next_out = ie, H.avail_in = q < ne ? 5 + (ne - q) : 5 - (q - ne), H.avail_out = ie < we ? 257 + (we - ie) : 257 - (ie - we), ft.hold = He, ft.bits = qe; - }; - const or = 15, si = 852, ai = 592, oi = 0, Nr = 1, li = 2, Qn = new Uint16Array([ - /* Length codes 257..285 base */ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 13, - 15, - 17, - 19, - 23, - 27, - 31, - 35, - 43, - 51, - 59, - 67, - 83, - 99, - 115, - 131, - 163, - 195, - 227, - 258, - 0, - 0 - ]), Jn = new Uint8Array([ - /* Length codes 257..285 extra */ - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 17, - 17, - 17, - 17, - 18, - 18, - 18, - 18, - 19, - 19, - 19, - 19, - 20, - 20, - 20, - 20, - 21, - 21, - 21, - 21, - 16, - 72, - 78 - ]), qn = new Uint16Array([ - /* Distance codes 0..29 base */ - 1, - 2, - 3, - 4, - 5, - 7, - 9, - 13, - 17, - 25, - 33, - 49, - 65, - 97, - 129, - 193, - 257, - 385, - 513, - 769, - 1025, - 1537, - 2049, - 3073, - 4097, - 6145, - 8193, - 12289, - 16385, - 24577, - 0, - 0 - ]), es = new Uint8Array([ - /* Distance codes 0..29 extra */ - 16, - 16, - 16, - 16, - 17, - 17, - 18, - 18, - 19, - 19, - 20, - 20, - 21, - 21, - 22, - 22, - 23, - 23, - 24, - 24, - 25, - 25, - 26, - 26, - 27, - 27, - 28, - 28, - 29, - 29, - 64, - 64 - ]); - var mr = (x, H, O, q, ne, ie, Pe, we) => { - const Qe = we.bits; - let me = 0, Ie = 0, ut = 0, Xe = 0, He = 0, qe = 0, Ct = 0, ht = 0, st = 0, gt = 0, ot, Ye, _t, Lt, et, xt = null, ct; - const nt = new Uint16Array(or + 1), ft = new Uint16Array(or + 1); - let Yt = null, rn, Lr, Tr; - for (me = 0; me <= or; me++) - nt[me] = 0; - for (Ie = 0; Ie < q; Ie++) - nt[H[O + Ie]]++; - for (He = Qe, Xe = or; Xe >= 1 && nt[Xe] === 0; Xe--) - ; - if (He > Xe && (He = Xe), Xe === 0) - return ne[ie++] = 1 << 24 | 64 << 16 | 0, ne[ie++] = 1 << 24 | 64 << 16 | 0, we.bits = 1, 0; - for (ut = 1; ut < Xe && nt[ut] === 0; ut++) - ; - for (He < ut && (He = ut), ht = 1, me = 1; me <= or; me++) - if (ht <<= 1, ht -= nt[me], ht < 0) - return -1; - if (ht > 0 && (x === oi || Xe !== 1)) - return -1; - for (ft[1] = 0, me = 1; me < or; me++) - ft[me + 1] = ft[me] + nt[me]; - for (Ie = 0; Ie < q; Ie++) - H[O + Ie] !== 0 && (Pe[ft[H[O + Ie]]++] = Ie); - if (x === oi ? (xt = Yt = Pe, ct = 20) : x === Nr ? (xt = Qn, Yt = Jn, ct = 257) : (xt = qn, Yt = es, ct = 0), gt = 0, Ie = 0, me = ut, et = ie, qe = He, Ct = 0, _t = -1, st = 1 << He, Lt = st - 1, x === Nr && st > si || x === li && st > ai) - return 1; - for (; ; ) { - rn = me - Ct, Pe[Ie] + 1 < ct ? (Lr = 0, Tr = Pe[Ie]) : Pe[Ie] >= ct ? (Lr = Yt[Pe[Ie] - ct], Tr = xt[Pe[Ie] - ct]) : (Lr = 96, Tr = 0), ot = 1 << me - Ct, Ye = 1 << qe, ut = Ye; - do - Ye -= ot, ne[et + (gt >> Ct) + Ye] = rn << 24 | Lr << 16 | Tr | 0; - while (Ye !== 0); - for (ot = 1 << me - 1; gt & ot; ) - ot >>= 1; - if (ot !== 0 ? (gt &= ot - 1, gt += ot) : gt = 0, Ie++, --nt[me] === 0) { - if (me === Xe) - break; - me = H[O + Pe[Ie]]; - } - if (me > He && (gt & Lt) !== _t) { - for (Ct === 0 && (Ct = He), et += ut, qe = me - Ct, ht = 1 << qe; qe + Ct < Xe && (ht -= nt[qe + Ct], !(ht <= 0)); ) - qe++, ht <<= 1; - if (st += 1 << qe, x === Nr && st > si || x === li && st > ai) - return 1; - _t = gt & Lt, ne[_t] = He << 24 | qe << 16 | et - ie | 0; - } - } - return gt !== 0 && (ne[et + gt] = me - Ct << 24 | 64 << 16 | 0), we.bits = He, 0; - }; - const ts = 0, fi = 1, hi = 2, { - Z_FINISH: ci, - Z_BLOCK: rs, - Z_TREES: wr, - Z_OK: Kt, - Z_STREAM_END: is, - Z_NEED_DICT: ns, - Z_STREAM_ERROR: Rt, - Z_DATA_ERROR: ui, - Z_MEM_ERROR: di, - Z_BUF_ERROR: ss, - Z_DEFLATED: _i - } = Me, Ar = 16180, pi = 16181, gi = 16182, mi = 16183, vi = 16184, bi = 16185, yi = 16186, xi = 16187, Ei = 16188, wi = 16189, Mr = 16190, Ut = 16191, Gr = 16192, Ai = 16193, Wr = 16194, Mi = 16195, Ci = 16196, Si = 16197, Li = 16198, Cr = 16199, Sr = 16200, Ti = 16201, Oi = 16202, Di = 16203, Pi = 16204, Ii = 16205, Hr = 16206, $i = 16207, Ri = 16208, Mt = 16209, Bi = 16210, zi = 16211, as = 852, os = 592, ls = 15, ki = (x) => (x >>> 24 & 255) + (x >>> 8 & 65280) + ((x & 65280) << 8) + ((x & 255) << 24); - function fs() { - this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; - } - const Zt = (x) => { - if (!x) - return 1; - const H = x.state; - return !H || H.strm !== x || H.mode < Ar || H.mode > zi ? 1 : 0; - }, Fi = (x) => { - if (Zt(x)) - return Rt; - const H = x.state; - return x.total_in = x.total_out = H.total = 0, x.msg = "", H.wrap && (x.adler = H.wrap & 1), H.mode = Ar, H.last = 0, H.havedict = 0, H.flags = -1, H.dmax = 32768, H.head = null, H.hold = 0, H.bits = 0, H.lencode = H.lendyn = new Int32Array(as), H.distcode = H.distdyn = new Int32Array(os), H.sane = 1, H.back = -1, Kt; - }, Ui = (x) => { - if (Zt(x)) - return Rt; - const H = x.state; - return H.wsize = 0, H.whave = 0, H.wnext = 0, Fi(x); - }, Ni = (x, H) => { - let O; - if (Zt(x)) - return Rt; - const q = x.state; - return H < 0 ? (O = 0, H = -H) : (O = (H >> 4) + 5, H < 48 && (H &= 15)), H && (H < 8 || H > 15) ? Rt : (q.window !== null && q.wbits !== H && (q.window = null), q.wrap = O, q.wbits = H, Ui(x)); - }, Gi = (x, H) => { - if (!x) - return Rt; - const O = new fs(); - x.state = O, O.strm = x, O.window = null, O.mode = Ar; - const q = Ni(x, H); - return q !== Kt && (x.state = null), q; - }, hs = (x) => Gi(x, ls); - let Wi = !0, Vr, jr; - const cs = (x) => { - if (Wi) { - Vr = new Int32Array(512), jr = new Int32Array(32); - let H = 0; - for (; H < 144; ) - x.lens[H++] = 8; - for (; H < 256; ) - x.lens[H++] = 9; - for (; H < 280; ) - x.lens[H++] = 7; - for (; H < 288; ) - x.lens[H++] = 8; - for (mr(fi, x.lens, 0, 288, Vr, 0, x.work, { bits: 9 }), H = 0; H < 32; ) - x.lens[H++] = 5; - mr(hi, x.lens, 0, 32, jr, 0, x.work, { bits: 5 }), Wi = !1; - } - x.lencode = Vr, x.lenbits = 9, x.distcode = jr, x.distbits = 5; - }, Hi = (x, H, O, q) => { - let ne; - const ie = x.state; - return ie.window === null && (ie.wsize = 1 << ie.wbits, ie.wnext = 0, ie.whave = 0, ie.window = new Uint8Array(ie.wsize)), q >= ie.wsize ? (ie.window.set(H.subarray(O - ie.wsize, O), 0), ie.wnext = 0, ie.whave = ie.wsize) : (ne = ie.wsize - ie.wnext, ne > q && (ne = q), ie.window.set(H.subarray(O - q, O - q + ne), ie.wnext), q -= ne, q ? (ie.window.set(H.subarray(O - q, O), 0), ie.wnext = q, ie.whave = ie.wsize) : (ie.wnext += ne, ie.wnext === ie.wsize && (ie.wnext = 0), ie.whave < ie.wsize && (ie.whave += ne))), 0; - }, us = (x, H) => { - let O, q, ne, ie, Pe, we, Qe, me, Ie, ut, Xe, He, qe, Ct, ht = 0, st, gt, ot, Ye, _t, Lt, et, xt; - const ct = new Uint8Array(4); - let nt, ft; - const Yt = ( - /* permutation of code lengths */ - new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]) - ); - if (Zt(x) || !x.output || !x.input && x.avail_in !== 0) - return Rt; - O = x.state, O.mode === Ut && (O.mode = Gr), Pe = x.next_out, ne = x.output, Qe = x.avail_out, ie = x.next_in, q = x.input, we = x.avail_in, me = O.hold, Ie = O.bits, ut = we, Xe = Qe, xt = Kt; - e: - for (; ; ) - switch (O.mode) { - case Ar: - if (O.wrap === 0) { - O.mode = Gr; - break; - } - for (; Ie < 16; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (O.wrap & 2 && me === 35615) { - O.wbits === 0 && (O.wbits = 15), O.check = 0, ct[0] = me & 255, ct[1] = me >>> 8 & 255, O.check = $(O.check, ct, 2, 0), me = 0, Ie = 0, O.mode = pi; - break; - } - if (O.head && (O.head.done = !1), !(O.wrap & 1) || /* check if zlib header allowed */ - (((me & 255) << 8) + (me >> 8)) % 31) { - x.msg = "incorrect header check", O.mode = Mt; - break; - } - if ((me & 15) !== _i) { - x.msg = "unknown compression method", O.mode = Mt; - break; - } - if (me >>>= 4, Ie -= 4, et = (me & 15) + 8, O.wbits === 0 && (O.wbits = et), et > 15 || et > O.wbits) { - x.msg = "invalid window size", O.mode = Mt; - break; - } - O.dmax = 1 << O.wbits, O.flags = 0, x.adler = O.check = 1, O.mode = me & 512 ? wi : Ut, me = 0, Ie = 0; - break; - case pi: - for (; Ie < 16; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (O.flags = me, (O.flags & 255) !== _i) { - x.msg = "unknown compression method", O.mode = Mt; - break; - } - if (O.flags & 57344) { - x.msg = "unknown header flags set", O.mode = Mt; - break; - } - O.head && (O.head.text = me >> 8 & 1), O.flags & 512 && O.wrap & 4 && (ct[0] = me & 255, ct[1] = me >>> 8 & 255, O.check = $(O.check, ct, 2, 0)), me = 0, Ie = 0, O.mode = gi; - case gi: - for (; Ie < 32; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.head && (O.head.time = me), O.flags & 512 && O.wrap & 4 && (ct[0] = me & 255, ct[1] = me >>> 8 & 255, ct[2] = me >>> 16 & 255, ct[3] = me >>> 24 & 255, O.check = $(O.check, ct, 4, 0)), me = 0, Ie = 0, O.mode = mi; - case mi: - for (; Ie < 16; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.head && (O.head.xflags = me & 255, O.head.os = me >> 8), O.flags & 512 && O.wrap & 4 && (ct[0] = me & 255, ct[1] = me >>> 8 & 255, O.check = $(O.check, ct, 2, 0)), me = 0, Ie = 0, O.mode = vi; - case vi: - if (O.flags & 1024) { - for (; Ie < 16; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.length = me, O.head && (O.head.extra_len = me), O.flags & 512 && O.wrap & 4 && (ct[0] = me & 255, ct[1] = me >>> 8 & 255, O.check = $(O.check, ct, 2, 0)), me = 0, Ie = 0; - } else - O.head && (O.head.extra = null); - O.mode = bi; - case bi: - if (O.flags & 1024 && (He = O.length, He > we && (He = we), He && (O.head && (et = O.head.extra_len - O.length, O.head.extra || (O.head.extra = new Uint8Array(O.head.extra_len)), O.head.extra.set( - q.subarray( - ie, - // extra field is limited to 65536 bytes - // - no need for additional size check - ie + He - ), - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - et - )), O.flags & 512 && O.wrap & 4 && (O.check = $(O.check, q, He, ie)), we -= He, ie += He, O.length -= He), O.length)) - break e; - O.length = 0, O.mode = yi; - case yi: - if (O.flags & 2048) { - if (we === 0) - break e; - He = 0; - do - et = q[ie + He++], O.head && et && O.length < 65536 && (O.head.name += String.fromCharCode(et)); - while (et && He < we); - if (O.flags & 512 && O.wrap & 4 && (O.check = $(O.check, q, He, ie)), we -= He, ie += He, et) - break e; - } else - O.head && (O.head.name = null); - O.length = 0, O.mode = xi; - case xi: - if (O.flags & 4096) { - if (we === 0) - break e; - He = 0; - do - et = q[ie + He++], O.head && et && O.length < 65536 && (O.head.comment += String.fromCharCode(et)); - while (et && He < we); - if (O.flags & 512 && O.wrap & 4 && (O.check = $(O.check, q, He, ie)), we -= He, ie += He, et) - break e; - } else - O.head && (O.head.comment = null); - O.mode = Ei; - case Ei: - if (O.flags & 512) { - for (; Ie < 16; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (O.wrap & 4 && me !== (O.check & 65535)) { - x.msg = "header crc mismatch", O.mode = Mt; - break; - } - me = 0, Ie = 0; - } - O.head && (O.head.hcrc = O.flags >> 9 & 1, O.head.done = !0), x.adler = O.check = 0, O.mode = Ut; - break; - case wi: - for (; Ie < 32; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - x.adler = O.check = ki(me), me = 0, Ie = 0, O.mode = Mr; - case Mr: - if (O.havedict === 0) - return x.next_out = Pe, x.avail_out = Qe, x.next_in = ie, x.avail_in = we, O.hold = me, O.bits = Ie, ns; - x.adler = O.check = 1, O.mode = Ut; - case Ut: - if (H === rs || H === wr) - break e; - case Gr: - if (O.last) { - me >>>= Ie & 7, Ie -= Ie & 7, O.mode = Hr; - break; - } - for (; Ie < 3; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - switch (O.last = me & 1, me >>>= 1, Ie -= 1, me & 3) { - case 0: - O.mode = Ai; - break; - case 1: - if (cs(O), O.mode = Cr, H === wr) { - me >>>= 2, Ie -= 2; - break e; - } - break; - case 2: - O.mode = Ci; - break; - case 3: - x.msg = "invalid block type", O.mode = Mt; - } - me >>>= 2, Ie -= 2; - break; - case Ai: - for (me >>>= Ie & 7, Ie -= Ie & 7; Ie < 32; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if ((me & 65535) !== (me >>> 16 ^ 65535)) { - x.msg = "invalid stored block lengths", O.mode = Mt; - break; - } - if (O.length = me & 65535, me = 0, Ie = 0, O.mode = Wr, H === wr) - break e; - case Wr: - O.mode = Mi; - case Mi: - if (He = O.length, He) { - if (He > we && (He = we), He > Qe && (He = Qe), He === 0) - break e; - ne.set(q.subarray(ie, ie + He), Pe), we -= He, ie += He, Qe -= He, Pe += He, O.length -= He; - break; - } - O.mode = Ut; - break; - case Ci: - for (; Ie < 14; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (O.nlen = (me & 31) + 257, me >>>= 5, Ie -= 5, O.ndist = (me & 31) + 1, me >>>= 5, Ie -= 5, O.ncode = (me & 15) + 4, me >>>= 4, Ie -= 4, O.nlen > 286 || O.ndist > 30) { - x.msg = "too many length or distance symbols", O.mode = Mt; - break; - } - O.have = 0, O.mode = Si; - case Si: - for (; O.have < O.ncode; ) { - for (; Ie < 3; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.lens[Yt[O.have++]] = me & 7, me >>>= 3, Ie -= 3; - } - for (; O.have < 19; ) - O.lens[Yt[O.have++]] = 0; - if (O.lencode = O.lendyn, O.lenbits = 7, nt = { bits: O.lenbits }, xt = mr(ts, O.lens, 0, 19, O.lencode, 0, O.work, nt), O.lenbits = nt.bits, xt) { - x.msg = "invalid code lengths set", O.mode = Mt; - break; - } - O.have = 0, O.mode = Li; - case Li: - for (; O.have < O.nlen + O.ndist; ) { - for (; ht = O.lencode[me & (1 << O.lenbits) - 1], st = ht >>> 24, gt = ht >>> 16 & 255, ot = ht & 65535, !(st <= Ie); ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (ot < 16) - me >>>= st, Ie -= st, O.lens[O.have++] = ot; - else { - if (ot === 16) { - for (ft = st + 2; Ie < ft; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (me >>>= st, Ie -= st, O.have === 0) { - x.msg = "invalid bit length repeat", O.mode = Mt; - break; - } - et = O.lens[O.have - 1], He = 3 + (me & 3), me >>>= 2, Ie -= 2; - } else if (ot === 17) { - for (ft = st + 3; Ie < ft; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - me >>>= st, Ie -= st, et = 0, He = 3 + (me & 7), me >>>= 3, Ie -= 3; - } else { - for (ft = st + 7; Ie < ft; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - me >>>= st, Ie -= st, et = 0, He = 11 + (me & 127), me >>>= 7, Ie -= 7; - } - if (O.have + He > O.nlen + O.ndist) { - x.msg = "invalid bit length repeat", O.mode = Mt; - break; - } - for (; He--; ) - O.lens[O.have++] = et; - } - } - if (O.mode === Mt) - break; - if (O.lens[256] === 0) { - x.msg = "invalid code -- missing end-of-block", O.mode = Mt; - break; - } - if (O.lenbits = 9, nt = { bits: O.lenbits }, xt = mr(fi, O.lens, 0, O.nlen, O.lencode, 0, O.work, nt), O.lenbits = nt.bits, xt) { - x.msg = "invalid literal/lengths set", O.mode = Mt; - break; - } - if (O.distbits = 6, O.distcode = O.distdyn, nt = { bits: O.distbits }, xt = mr(hi, O.lens, O.nlen, O.ndist, O.distcode, 0, O.work, nt), O.distbits = nt.bits, xt) { - x.msg = "invalid distances set", O.mode = Mt; - break; - } - if (O.mode = Cr, H === wr) - break e; - case Cr: - O.mode = Sr; - case Sr: - if (we >= 6 && Qe >= 258) { - x.next_out = Pe, x.avail_out = Qe, x.next_in = ie, x.avail_in = we, O.hold = me, O.bits = Ie, Xn(x, Xe), Pe = x.next_out, ne = x.output, Qe = x.avail_out, ie = x.next_in, q = x.input, we = x.avail_in, me = O.hold, Ie = O.bits, O.mode === Ut && (O.back = -1); - break; - } - for (O.back = 0; ht = O.lencode[me & (1 << O.lenbits) - 1], st = ht >>> 24, gt = ht >>> 16 & 255, ot = ht & 65535, !(st <= Ie); ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (gt && !(gt & 240)) { - for (Ye = st, _t = gt, Lt = ot; ht = O.lencode[Lt + ((me & (1 << Ye + _t) - 1) >> Ye)], st = ht >>> 24, gt = ht >>> 16 & 255, ot = ht & 65535, !(Ye + st <= Ie); ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - me >>>= Ye, Ie -= Ye, O.back += Ye; - } - if (me >>>= st, Ie -= st, O.back += st, O.length = ot, gt === 0) { - O.mode = Ii; - break; - } - if (gt & 32) { - O.back = -1, O.mode = Ut; - break; - } - if (gt & 64) { - x.msg = "invalid literal/length code", O.mode = Mt; - break; - } - O.extra = gt & 15, O.mode = Ti; - case Ti: - if (O.extra) { - for (ft = O.extra; Ie < ft; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.length += me & (1 << O.extra) - 1, me >>>= O.extra, Ie -= O.extra, O.back += O.extra; - } - O.was = O.length, O.mode = Oi; - case Oi: - for (; ht = O.distcode[me & (1 << O.distbits) - 1], st = ht >>> 24, gt = ht >>> 16 & 255, ot = ht & 65535, !(st <= Ie); ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (!(gt & 240)) { - for (Ye = st, _t = gt, Lt = ot; ht = O.distcode[Lt + ((me & (1 << Ye + _t) - 1) >> Ye)], st = ht >>> 24, gt = ht >>> 16 & 255, ot = ht & 65535, !(Ye + st <= Ie); ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - me >>>= Ye, Ie -= Ye, O.back += Ye; - } - if (me >>>= st, Ie -= st, O.back += st, gt & 64) { - x.msg = "invalid distance code", O.mode = Mt; - break; - } - O.offset = ot, O.extra = gt & 15, O.mode = Di; - case Di: - if (O.extra) { - for (ft = O.extra; Ie < ft; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - O.offset += me & (1 << O.extra) - 1, me >>>= O.extra, Ie -= O.extra, O.back += O.extra; - } - if (O.offset > O.dmax) { - x.msg = "invalid distance too far back", O.mode = Mt; - break; - } - O.mode = Pi; - case Pi: - if (Qe === 0) - break e; - if (He = Xe - Qe, O.offset > He) { - if (He = O.offset - He, He > O.whave && O.sane) { - x.msg = "invalid distance too far back", O.mode = Mt; - break; - } - He > O.wnext ? (He -= O.wnext, qe = O.wsize - He) : qe = O.wnext - He, He > O.length && (He = O.length), Ct = O.window; - } else - Ct = ne, qe = Pe - O.offset, He = O.length; - He > Qe && (He = Qe), Qe -= He, O.length -= He; - do - ne[Pe++] = Ct[qe++]; - while (--He); - O.length === 0 && (O.mode = Sr); - break; - case Ii: - if (Qe === 0) - break e; - ne[Pe++] = O.length, Qe--, O.mode = Sr; - break; - case Hr: - if (O.wrap) { - for (; Ie < 32; ) { - if (we === 0) - break e; - we--, me |= q[ie++] << Ie, Ie += 8; - } - if (Xe -= Qe, x.total_out += Xe, O.total += Xe, O.wrap & 4 && Xe && (x.adler = O.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/ - O.flags ? $(O.check, ne, Xe, Pe - Xe) : De(O.check, ne, Xe, Pe - Xe)), Xe = Qe, O.wrap & 4 && (O.flags ? me : ki(me)) !== O.check) { - x.msg = "incorrect data check", O.mode = Mt; - break; - } - me = 0, Ie = 0; - } - O.mode = $i; - case $i: - if (O.wrap && O.flags) { - for (; Ie < 32; ) { - if (we === 0) - break e; - we--, me += q[ie++] << Ie, Ie += 8; - } - if (O.wrap & 4 && me !== (O.total & 4294967295)) { - x.msg = "incorrect length check", O.mode = Mt; - break; - } - me = 0, Ie = 0; - } - O.mode = Ri; - case Ri: - xt = is; - break e; - case Mt: - xt = ui; - break e; - case Bi: - return di; - case zi: - default: - return Rt; - } - return x.next_out = Pe, x.avail_out = Qe, x.next_in = ie, x.avail_in = we, O.hold = me, O.bits = Ie, (O.wsize || Xe !== x.avail_out && O.mode < Mt && (O.mode < Hr || H !== ci)) && Hi(x, x.output, x.next_out, Xe - x.avail_out), ut -= x.avail_in, Xe -= x.avail_out, x.total_in += ut, x.total_out += Xe, O.total += Xe, O.wrap & 4 && Xe && (x.adler = O.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/ - O.flags ? $(O.check, ne, Xe, x.next_out - Xe) : De(O.check, ne, Xe, x.next_out - Xe)), x.data_type = O.bits + (O.last ? 64 : 0) + (O.mode === Ut ? 128 : 0) + (O.mode === Cr || O.mode === Wr ? 256 : 0), (ut === 0 && Xe === 0 || H === ci) && xt === Kt && (xt = ss), xt; - }, ds = (x) => { - if (Zt(x)) - return Rt; - let H = x.state; - return H.window && (H.window = null), x.state = null, Kt; - }, _s = (x, H) => { - if (Zt(x)) - return Rt; - const O = x.state; - return O.wrap & 2 ? (O.head = H, H.done = !1, Kt) : Rt; - }, ps = (x, H) => { - const O = H.length; - let q, ne, ie; - return Zt(x) || (q = x.state, q.wrap !== 0 && q.mode !== Mr) ? Rt : q.mode === Mr && (ne = 1, ne = De(ne, H, O, 0), ne !== q.check) ? ui : (ie = Hi(x, H, O, O), ie ? (q.mode = Bi, di) : (q.havedict = 1, Kt)); - }; - var gs = Ui, ms = Ni, vs = Fi, bs = hs, ys = Gi, xs = us, Es = ds, ws = _s, As = ps, Ms = "pako inflate (from Nodeca project)", Nt = { - inflateReset: gs, - inflateReset2: ms, - inflateResetKeep: vs, - inflateInit: bs, - inflateInit2: ys, - inflate: xs, - inflateEnd: Es, - inflateGetHeader: ws, - inflateSetDictionary: As, - inflateInfo: Ms - }; - function Cs() { - this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1; - } - var Ss = Cs; - const Vi = Object.prototype.toString, { - Z_NO_FLUSH: Ls, - Z_FINISH: Ts, - Z_OK: vr, - Z_STREAM_END: Kr, - Z_NEED_DICT: Zr, - Z_STREAM_ERROR: Os, - Z_DATA_ERROR: ji, - Z_MEM_ERROR: Ds - } = Me; - function br(x) { - this.options = yr.assign({ - chunkSize: 65536, - windowBits: 15, - to: "" - }, x || {}); - const H = this.options; - H.raw && H.windowBits >= 0 && H.windowBits < 16 && (H.windowBits = -H.windowBits, H.windowBits === 0 && (H.windowBits = -15)), H.windowBits >= 0 && H.windowBits < 16 && !(x && x.windowBits) && (H.windowBits += 32), H.windowBits > 15 && H.windowBits < 48 && (H.windowBits & 15 || (H.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ii(), this.strm.avail_out = 0; - let O = Nt.inflateInit2( - this.strm, - H.windowBits - ); - if (O !== vr) - throw new Error(xe[O]); - if (this.header = new Ss(), Nt.inflateGetHeader(this.strm, this.header), H.dictionary && (typeof H.dictionary == "string" ? H.dictionary = pr.string2buf(H.dictionary) : Vi.call(H.dictionary) === "[object ArrayBuffer]" && (H.dictionary = new Uint8Array(H.dictionary)), H.raw && (O = Nt.inflateSetDictionary(this.strm, H.dictionary), O !== vr))) - throw new Error(xe[O]); - } - br.prototype.push = function(x, H) { - const O = this.strm, q = this.options.chunkSize, ne = this.options.dictionary; - let ie, Pe, we; - if (this.ended) - return !1; - for (H === ~~H ? Pe = H : Pe = H === !0 ? Ts : Ls, Vi.call(x) === "[object ArrayBuffer]" ? O.input = new Uint8Array(x) : O.input = x, O.next_in = 0, O.avail_in = O.input.length; ; ) { - for (O.avail_out === 0 && (O.output = new Uint8Array(q), O.next_out = 0, O.avail_out = q), ie = Nt.inflate(O, Pe), ie === Zr && ne && (ie = Nt.inflateSetDictionary(O, ne), ie === vr ? ie = Nt.inflate(O, Pe) : ie === ji && (ie = Zr)); O.avail_in > 0 && ie === Kr && O.state.wrap > 0 && x[O.next_in] !== 0; ) - Nt.inflateReset(O), ie = Nt.inflate(O, Pe); - switch (ie) { - case Os: - case ji: - case Zr: - case Ds: - return this.onEnd(ie), this.ended = !0, !1; - } - if (we = O.avail_out, O.next_out && (O.avail_out === 0 || ie === Kr)) - if (this.options.to === "string") { - let Qe = pr.utf8border(O.output, O.next_out), me = O.next_out - Qe, Ie = pr.buf2string(O.output, Qe); - O.next_out = me, O.avail_out = q - me, me && O.output.set(O.output.subarray(Qe, Qe + me), 0), this.onData(Ie); - } else - this.onData(O.output.length === O.next_out ? O.output : O.output.subarray(0, O.next_out)); - if (!(ie === vr && we === 0)) { - if (ie === Kr) - return ie = Nt.inflateEnd(this.strm), this.onEnd(ie), this.ended = !0, !0; - if (O.avail_in === 0) - break; - } - } - return !0; - }, br.prototype.onData = function(x) { - this.chunks.push(x); - }, br.prototype.onEnd = function(x) { - x === vr && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = yr.flattenChunks(this.chunks)), this.chunks = [], this.err = x, this.msg = this.strm.msg; - }; - function Yr(x, H) { - const O = new br(H); - if (O.push(x), O.err) - throw O.msg || xe[O.err]; - return O.result; - } - function Ps(x, H) { - return H = H || {}, H.raw = !0, Yr(x, H); - } - var Is = br, $s = Yr, Rs = Ps, Bs = Yr, zs = Me, ks = { - Inflate: Is, - inflate: $s, - inflateRaw: Rs, - ungzip: Bs, - constants: zs - }; - const { Deflate: Fs, deflate: Us, deflateRaw: Ns, gzip: Gs } = Zn, { Inflate: Ws, inflate: Hs, inflateRaw: Vs, ungzip: js } = ks; - var Ki = Fs, Zi = Us, Yi = Ns, Xi = Gs, Qi = Ws, Ji = Hs, qi = Vs, en = js, tn = Me, Ks = { - Deflate: Ki, - deflate: Zi, - deflateRaw: Yi, - gzip: Xi, - Inflate: Qi, - inflate: Ji, - inflateRaw: qi, - ungzip: en, - constants: tn - }; - } - ) - /******/ - }, __webpack_module_cache__ = {}; - function __webpack_require__(t) { - var e = __webpack_module_cache__[t]; - if (e !== void 0) - return e.exports; - var r = __webpack_module_cache__[t] = { - /******/ - // no module.id needed - /******/ - // no module.loaded needed - /******/ - exports: {} - /******/ - }; - return __webpack_modules__[t].call(r.exports, r, r.exports, __webpack_require__), r.exports; - } - __webpack_require__.n = (t) => { - var e = t && t.__esModule ? ( - /******/ - () => t.default - ) : ( - /******/ - () => t - ); - return __webpack_require__.d(e, { a: e }), e; - }, __webpack_require__.d = (t, e) => { - for (var r in e) - __webpack_require__.o(e, r) && !__webpack_require__.o(t, r) && Object.defineProperty(t, r, { enumerable: !0, get: e[r] }); - }, __webpack_require__.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e), __webpack_require__.r = (t) => { - typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 }); - }, __webpack_require__("./src/index.ts"), __webpack_require__("./src/SurfaceWorker.js"); - var __webpack_exports__ = __webpack_require__("./src/exporter.js"); - return __webpack_exports__; - })() - )); -})(_3Dmol$1); -var _3DmolExports = _3Dmol$1.exports; -const _3Dmol = /* @__PURE__ */ getDefaultExportFromCjs(_3DmolExports), MolecularViewer_svelte_svelte_type_style_lang = "", { - SvelteComponent: SvelteComponent$a, - add_render_callback, - append: append$8, - attr: attr$8, - binding_callbacks: binding_callbacks$3, - create_in_transition, - destroy_each: destroy_each$2, - detach: detach$a, - element: element$7, - ensure_array_like: ensure_array_like$2, - init: init$a, - insert: insert$a, - listen: listen$2, - noop: noop$6, - null_to_empty, - run_all: run_all$3, - safe_not_equal: safe_not_equal$b, - select_option, - select_value, - set_data: set_data$3, - set_input_value: set_input_value$1, - set_style: set_style$3, - space: space$7, - svg_element: svg_element$3, - text: text$3, - toggle_class: toggle_class$5, - transition_in: transition_in$7 -} = window.__gradio__svelte__internal, { onMount: onMount$1, onDestroy: onDestroy$1 } = window.__gradio__svelte__internal; -function get_each_context$2(t, e, r) { - const n = t.slice(); - return n[53] = e[r], n[54] = e, n[55] = r, n; -} -function get_each_context_1$1(t, e, r) { - const n = t.slice(); - return n[56] = e[r], n[58] = r, n; -} -function get_each_context_2(t, e, r) { - const n = t.slice(); - return n[59] = e[r], n[60] = e, n[61] = r, n; -} -function get_each_context_3(t, e, r) { - const n = t.slice(); - return n[62] = e[r], n; -} -function create_if_block_8$1(t) { - let e, r, n, f, u, b, h, _, E, c, S, y, w, L, s, o, A, p, v, a, l, g, M, C, T, D, I, B, P; - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("div"), f = element$7("span"), f.textContent = " ", u = element$7("span"), b = text$3("Very high ("), h = text$3( - /*confidenceLabel*/ - t[2] - ), _ = text$3(" > 90)"), E = space$7(), c = element$7("div"), S = element$7("span"), S.textContent = " ", y = element$7("span"), w = text$3("Confident (90 > "), L = text$3( - /*confidenceLabel*/ - t[2] - ), s = text$3(" > 70)"), o = space$7(), A = element$7("div"), p = element$7("span"), p.textContent = " ", v = element$7("span"), a = text$3("Low (70 > "), l = text$3( - /*confidenceLabel*/ - t[2] - ), g = text$3(" > 50)"), M = space$7(), C = element$7("div"), T = element$7("span"), T.textContent = " ", D = element$7("span"), I = text$3("Very low ("), B = text$3( - /*confidenceLabel*/ - t[2] - ), P = text$3(" < 50)"), attr$8(f, "class", "w-4 h-4 svelte-1skivl7"), set_style$3(f, "background-color", "rgb(0, 83, 214)"), attr$8(u, "class", "legendlabel svelte-1skivl7"), attr$8(n, "class", "flex space-x-1 py-1 items-center svelte-1skivl7"), attr$8(S, "class", "w-4 h-4 svelte-1skivl7"), set_style$3(S, "background-color", "rgb(101, 203, 243)"), attr$8(y, "class", "legendlabel svelte-1skivl7"), attr$8(c, "class", "flex space-x-1 py-1 items-center svelte-1skivl7"), attr$8(p, "class", "w-4 h-4 svelte-1skivl7"), set_style$3(p, "background-color", "rgb(255, 219, 19)"), attr$8(v, "class", "legendlabel svelte-1skivl7"), attr$8(A, "class", "flex space-x-1 py-1 items-center svelte-1skivl7"), attr$8(T, "class", "w-4 h-4 svelte-1skivl7"), set_style$3(T, "background-color", "rgb(255, 125, 69)"), attr$8(D, "class", "legendlabel svelte-1skivl7"), attr$8(C, "class", "flex space-x-1 py-1 items-center svelte-1skivl7"), attr$8(r, "class", "flex text-sm items-center space-x-2 justify-center svelte-1skivl7"), attr$8(e, "class", "absolute bottom-0 left-0 z-50 p-2 -mb-2 w-full bg-white svelte-1skivl7"); - }, - m(z, k) { - insert$a(z, e, k), append$8(e, r), append$8(r, n), append$8(n, f), append$8(n, u), append$8(u, b), append$8(u, h), append$8(u, _), append$8(r, E), append$8(r, c), append$8(c, S), append$8(c, y), append$8(y, w), append$8(y, L), append$8(y, s), append$8(r, o), append$8(r, A), append$8(A, p), append$8(A, v), append$8(v, a), append$8(v, l), append$8(v, g), append$8(r, M), append$8(r, C), append$8(C, T), append$8(C, D), append$8(D, I), append$8(D, B), append$8(D, P); - }, - p(z, k) { - k[0] & /*confidenceLabel*/ - 4 && set_data$3( - h, - /*confidenceLabel*/ - z[2] - ), k[0] & /*confidenceLabel*/ - 4 && set_data$3( - L, - /*confidenceLabel*/ - z[2] - ), k[0] & /*confidenceLabel*/ - 4 && set_data$3( - l, - /*confidenceLabel*/ - z[2] - ), k[0] & /*confidenceLabel*/ - 4 && set_data$3( - B, - /*confidenceLabel*/ - z[2] - ); - }, - d(z) { - z && detach$a(e); - } - }; -} -function create_if_block_6$1(t) { - let e; - function r(u, b) { - return ( - /*isAnimated*/ - u[10] ? create_else_block$5 : create_if_block_7$1 - ); - } - let n = r(t), f = n(t); - return { - c() { - e = element$7("div"), f.c(), attr$8(e, "class", "absolute z-50 bottom-0 right-0 mr-2 flex divide-x border border-gray-200 mb-2 rounded items-center justify-center svelte-1skivl7"); - }, - m(u, b) { - insert$a(u, e, b), f.m(e, null); - }, - p(u, b) { - n === (n = r(u)) && f ? f.p(u, b) : (f.d(1), f = n(u), f && (f.c(), f.m(e, null))); - }, - d(u) { - u && detach$a(e), f.d(); - } - }; -} -function create_else_block$5(t) { - let e, r, n; - return { - c() { - e = element$7("button"), e.innerHTML = '', attr$8(e, "class", "p-2 svelte-1skivl7"), attr$8(e, "title", "Pause"); - }, - m(f, u) { - insert$a(f, e, u), r || (n = listen$2( - e, - "click", - /*toggleAnimation*/ - t[19] - ), r = !0); - }, - p: noop$6, - d(f) { - f && detach$a(e), r = !1, n(); - } - }; -} -function create_if_block_7$1(t) { - let e, r, n; - return { - c() { - e = element$7("button"), e.innerHTML = '', attr$8(e, "class", "p-2 svelte-1skivl7"), attr$8(e, "title", "Play"); - }, - m(f, u) { - insert$a(f, e, u), r || (n = listen$2( - e, - "click", - /*toggleAnimation*/ - t[19] - ), r = !0); - }, - p: noop$6, - d(f) { - f && detach$a(e), r = !1, n(); - } - }; -} -function create_if_block_2$1(t) { - let e, r, n, f, u, b, h, _, E, c, S, y, w, L, s, o, A, p = ensure_array_like$2(Object.keys( - /*config*/ - t[0] - )), v = []; - for (let a = 0; a < p.length; a += 1) - v[a] = create_each_block_2(get_each_context_2(t, p, a)); - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("h5"), n.textContent = "Settings", f = space$7(), u = element$7("button"), u.innerHTML = ' Close menu', b = space$7(); - for (let a = 0; a < v.length; a += 1) - v[a].c(); - h = space$7(), _ = element$7("div"), E = element$7("div"), c = element$7("label"), c.textContent = "Label atoms on hover", S = space$7(), y = element$7("label"), w = element$7("input"), L = space$7(), s = element$7("div"), attr$8(n, "id", "settings-drawer-label"), attr$8(n, "class", "inline-flex items-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400 svelte-1skivl7"), attr$8(u, "type", "button"), attr$8(u, "data-drawer-hide", "drawer-example"), attr$8(u, "aria-controls", "drawer-example"), attr$8(u, "class", "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 right-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white svelte-1skivl7"), attr$8(r, "class", "p-4 svelte-1skivl7"), attr$8(c, "class", "text-sm font-medium text-gray-600 dark:text-gray-400 w-1/2 svelte-1skivl7"), attr$8(w, "type", "checkbox"), attr$8(w, "class", "sr-only peer svelte-1skivl7"), attr$8(s, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1skivl7"), attr$8(y, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center justify-center svelte-1skivl7"), attr$8(E, "class", "flex items-center border-t border-b border-gray-200 bg-white px-4 py-2 space-x-2 svelte-1skivl7"), attr$8(_, "class", "bg-white svelte-1skivl7"), attr$8(e, "id", "settings-drawer"), attr$8(e, "class", "absolute top-0 right-0 z-50 h-full overflow-y-auto transition-transform bg-gray-100 w-80 dark:bg-gray-800 svelte-1skivl7"), attr$8(e, "tabindex", "-1"), attr$8(e, "aria-labelledby", "settings-drawer-label"); - }, - m(a, l) { - insert$a(a, e, l), append$8(e, r), append$8(r, n), append$8(r, f), append$8(r, u), append$8(e, b); - for (let g = 0; g < v.length; g += 1) - v[g] && v[g].m(e, null); - append$8(e, h), append$8(e, _), append$8(_, E), append$8(E, c), append$8(E, S), append$8(E, y), append$8(y, w), set_input_value$1( - w, - /*labelHover*/ - t[5] - ), append$8(y, L), append$8(y, s), o || (A = [ - listen$2( - u, - "click", - /*toggleOffCanvas*/ - t[14] - ), - listen$2( - w, - "change", - /*input_change_handler_1*/ - t[25] - ) - ], o = !0); - }, - p(a, l) { - if (l[0] & /*config, settings*/ - 4097) { - p = ensure_array_like$2(Object.keys( - /*config*/ - a[0] - )); - let g; - for (g = 0; g < p.length; g += 1) { - const M = get_each_context_2(a, p, g); - v[g] ? v[g].p(M, l) : (v[g] = create_each_block_2(M), v[g].c(), v[g].m(e, h)); - } - for (; g < v.length; g += 1) - v[g].d(1); - v.length = p.length; - } - l[0] & /*labelHover*/ - 32 && set_input_value$1( - w, - /*labelHover*/ - a[5] - ); - }, - d(a) { - a && detach$a(e), destroy_each$2(v, a), o = !1, run_all$3(A); - } - }; -} -function create_if_block_5$1(t) { - let e, r, n, f, u, b; - function h() { - t[22].call( - r, - /*setting*/ - t[59] - ); - } - return { - c() { - e = element$7("label"), r = element$7("input"), n = space$7(), f = element$7("div"), attr$8(r, "type", "checkbox"), r.__value = "", set_input_value$1(r, r.__value), attr$8(r, "class", "sr-only peer svelte-1skivl7"), attr$8(f, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1skivl7"), attr$8(e, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center justify-center svelte-1skivl7"); - }, - m(_, E) { - insert$a(_, e, E), append$8(e, r), r.checked = /*config*/ - t[0][ - /*setting*/ - t[59] - ], append$8(e, n), append$8(e, f), u || (b = listen$2(r, "change", h), u = !0); - }, - p(_, E) { - t = _, E[0] & /*config, settings*/ - 4097 && (r.checked = /*config*/ - t[0][ - /*setting*/ - t[59] - ]); - }, - d(_) { - _ && detach$a(e), u = !1, b(); - } - }; -} -function create_if_block_4$1(t) { - let e, r, n, f, u, b, h, _, E = ( - /*config*/ - t[0][ - /*setting*/ - t[59] - ] + "" - ), c, S, y; - function w() { - return ( - /*change_handler*/ - t[23]( - /*setting*/ - t[59] - ) - ); - } - return { - c() { - e = element$7("div"), r = element$7("input"), h = space$7(), _ = element$7("span"), c = text$3(E), attr$8(r, "id", "medium-range"), attr$8(r, "type", "range"), r.value = n = /*config*/ - t[0][ - /*setting*/ - t[59] - ], attr$8(r, "min", f = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].min), attr$8(r, "max", u = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].max), attr$8(r, "step", b = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].step), attr$8(r, "class", "w-2/3 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 svelte-1skivl7"), attr$8(_, "class", "w-1/3 text-center text-sm font-medium text-gray-600 dark:text-gray-400 svelte-1skivl7"), attr$8(e, "class", "flex items-center svelte-1skivl7"); - }, - m(L, s) { - insert$a(L, e, s), append$8(e, r), append$8(e, h), append$8(e, _), append$8(_, c), S || (y = listen$2(r, "change", w), S = !0); - }, - p(L, s) { - t = L, s[0] & /*config, settings*/ - 4097 && n !== (n = /*config*/ - t[0][ - /*setting*/ - t[59] - ]) && (r.value = n), s[0] & /*config, settings*/ - 4097 && f !== (f = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].min) && attr$8(r, "min", f), s[0] & /*config, settings*/ - 4097 && u !== (u = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].max) && attr$8(r, "max", u), s[0] & /*config, settings*/ - 4097 && b !== (b = /*settings*/ - t[12][ - /*setting*/ - t[59] - ].step) && attr$8(r, "step", b), s[0] & /*config*/ - 1 && E !== (E = /*config*/ - t[0][ - /*setting*/ - t[59] - ] + "") && set_data$3(c, E); - }, - d(L) { - L && detach$a(e), S = !1, y(); - } - }; -} -function create_if_block_3$1(t) { - let e, r, n, f, u, b, h, _, E = ensure_array_like$2( - /*settings*/ - t[12][ - /*setting*/ - t[59] - ].options - ), c = []; - for (let y = 0; y < E.length; y += 1) - c[y] = create_each_block_3(get_each_context_3(t, E, y)); - function S() { - t[24].call( - u, - /*setting*/ - t[59] - ); - } - return { - c() { - e = element$7("label"), r = text$3("Select style"), f = space$7(), u = element$7("select"); - for (let y = 0; y < c.length; y += 1) - c[y].c(); - attr$8(e, "for", n = /*setting*/ - t[59]), attr$8(e, "class", "sr-only svelte-1skivl7"), attr$8(u, "id", b = /*setting*/ - t[59]), attr$8(u, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), /*config*/ - t[0][ - /*setting*/ - t[59] - ] === void 0 && add_render_callback(S); - }, - m(y, w) { - insert$a(y, e, w), append$8(e, r), insert$a(y, f, w), insert$a(y, u, w); - for (let L = 0; L < c.length; L += 1) - c[L] && c[L].m(u, null); - select_option( - u, - /*config*/ - t[0][ - /*setting*/ - t[59] - ], - !0 - ), h || (_ = listen$2(u, "change", S), h = !0); - }, - p(y, w) { - if (t = y, w[0] & /*config, settings*/ - 4097 && n !== (n = /*setting*/ - t[59]) && attr$8(e, "for", n), w[0] & /*settings, config*/ - 4097) { - E = ensure_array_like$2( - /*settings*/ - t[12][ - /*setting*/ - t[59] - ].options - ); - let L; - for (L = 0; L < E.length; L += 1) { - const s = get_each_context_3(t, E, L); - c[L] ? c[L].p(s, w) : (c[L] = create_each_block_3(s), c[L].c(), c[L].m(u, null)); - } - for (; L < c.length; L += 1) - c[L].d(1); - c.length = E.length; - } - w[0] & /*config, settings*/ - 4097 && b !== (b = /*setting*/ - t[59]) && attr$8(u, "id", b), w[0] & /*config, settings*/ - 4097 && select_option( - u, - /*config*/ - t[0][ - /*setting*/ - t[59] - ] - ); - }, - d(y) { - y && (detach$a(e), detach$a(f), detach$a(u)), destroy_each$2(c, y), h = !1, _(); - } - }; -} -function create_each_block_3(t) { - let e, r = ( - /*option*/ - t[62] + "" - ), n, f, u; - return { - c() { - e = element$7("option"), n = text$3(r), e.__value = f = /*option*/ - t[62], set_input_value$1(e, e.__value), e.selected = u = /*option*/ - t[62] == /*config*/ - t[0][ - /*setting*/ - t[59] - ], attr$8(e, "class", "svelte-1skivl7"); - }, - m(b, h) { - insert$a(b, e, h), append$8(e, n); - }, - p(b, h) { - h[0] & /*config*/ - 1 && r !== (r = /*option*/ - b[62] + "") && set_data$3(n, r), h[0] & /*config, settings*/ - 4097 && f !== (f = /*option*/ - b[62]) && (e.__value = f, set_input_value$1(e, e.__value)), h[0] & /*config, settings*/ - 4097 && u !== (u = /*option*/ - b[62] == /*config*/ - b[0][ - /*setting*/ - b[59] - ]) && (e.selected = u); - }, - d(b) { - b && detach$a(e); - } - }; -} -function create_each_block_2(t) { - let e, r, n, f = ( - /*setting*/ - t[59] + "" - ), u, b, h, _, E, c = ( - /*settings*/ - t[12][ - /*setting*/ - t[59] - ].type == "toggle" && create_if_block_5$1(t) - ), S = ( - /*settings*/ - t[12][ - /*setting*/ - t[59] - ].type == "range" && create_if_block_4$1(t) - ), y = ( - /*settings*/ - t[12][ - /*setting*/ - t[59] - ].type == "select" && create_if_block_3$1(t) - ); - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("label"), u = text$3(f), h = space$7(), c && c.c(), _ = space$7(), S && S.c(), E = space$7(), y && y.c(), attr$8(n, "for", b = /*setting*/ - t[59]), attr$8(n, "class", "text-sm font-medium text-gray-600 dark:text-gray-400 w-1/2 svelte-1skivl7"), attr$8(r, "class", "flex items-center border-t border-b border-gray-200 bg-white px-4 py-2 space-x-2 svelte-1skivl7"), attr$8(e, "class", "flex flex-col mb-4 divide-y svelte-1skivl7"); - }, - m(w, L) { - insert$a(w, e, L), append$8(e, r), append$8(r, n), append$8(n, u), append$8(r, h), c && c.m(r, null), append$8(r, _), S && S.m(r, null), append$8(r, E), y && y.m(r, null); - }, - p(w, L) { - L[0] & /*config*/ - 1 && f !== (f = /*setting*/ - w[59] + "") && set_data$3(u, f), L[0] & /*config, settings*/ - 4097 && b !== (b = /*setting*/ - w[59]) && attr$8(n, "for", b), /*settings*/ - w[12][ - /*setting*/ - w[59] - ].type == "toggle" ? c ? c.p(w, L) : (c = create_if_block_5$1(w), c.c(), c.m(r, _)) : c && (c.d(1), c = null), /*settings*/ - w[12][ - /*setting*/ - w[59] - ].type == "range" ? S ? S.p(w, L) : (S = create_if_block_4$1(w), S.c(), S.m(r, E)) : S && (S.d(1), S = null), /*settings*/ - w[12][ - /*setting*/ - w[59] - ].type == "select" ? y ? y.p(w, L) : (y = create_if_block_3$1(w), y.c(), y.m(r, null)) : y && (y.d(1), y = null); - }, - d(w) { - w && detach$a(e), c && c.d(), S && S.d(), y && y.d(); - } - }; -} -function create_if_block$6(t) { - let e, r, n, f, u, b, h, _, E, c, S = ensure_array_like$2( - /*representations*/ - t[1] - ), y = []; - for (let w = 0; w < S.length; w += 1) - y[w] = create_each_block$2(get_each_context$2(t, S, w)); - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("h5"), n.textContent = "Representations", f = space$7(), u = element$7("button"), u.innerHTML = ' Close menu', b = space$7(); - for (let w = 0; w < y.length; w += 1) - y[w].c(); - h = space$7(), _ = element$7("button"), _.innerHTML = '
Add representation
', attr$8(n, "id", "drawer-label"), attr$8(n, "class", "inline-flex items-center mb-4 text-base font-semibold text-gray-500 dark:text-gray-400 svelte-1skivl7"), attr$8(u, "type", "button"), attr$8(u, "data-drawer-hide", "drawer-example"), attr$8(u, "aria-controls", "drawer-example"), attr$8(u, "class", "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 right-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white svelte-1skivl7"), attr$8(r, "class", "p-4 svelte-1skivl7"), attr$8(_, "class", "w-full flex text-orange-600 justify-center my-2 text-sm space-x-2 items-center hover:text-gray-600 cursor-pointer svelte-1skivl7"), attr$8(e, "id", "drawer-example"), attr$8(e, "class", "absolute top-0 right-0 z-50 h-full overflow-y-auto transition-transform bg-gray-100 w-80 dark:bg-gray-800 border-l border-gray-200 svelte-1skivl7"), attr$8(e, "tabindex", "-1"), attr$8(e, "aria-labelledby", "drawer-label"); - }, - m(w, L) { - insert$a(w, e, L), append$8(e, r), append$8(r, n), append$8(r, f), append$8(r, u), append$8(e, b); - for (let s = 0; s < y.length; s += 1) - y[s] && y[s].m(e, null); - append$8(e, h), append$8(e, _), E || (c = [ - listen$2( - u, - "click", - /*toggleOffCanvasReps*/ - t[15] - ), - listen$2( - _, - "click", - /*insertRep*/ - t[17] - ) - ], E = !0); - }, - p(w, L) { - if (L[0] & /*representations, moldata, resetZoom, deleteRep*/ - 327690) { - S = ensure_array_like$2( - /*representations*/ - w[1] - ); - let s; - for (s = 0; s < S.length; s += 1) { - const o = get_each_context$2(w, S, s); - y[s] ? y[s].p(o, L) : (y[s] = create_each_block$2(o), y[s].c(), y[s].m(e, h)); - } - for (; s < y.length; s += 1) - y[s].d(1); - y.length = S.length; - } - }, - d(w) { - w && detach$a(e), destroy_each$2(y, w), E = !1, run_all$3(c); - } - }; -} -function create_if_block_1$5(t) { - let e, r, n, f, u, b, h, _, E, c, S, y, w, L, s, o, A, p, v, a, l, g, M, C, T, D, I, B, P, z, k, N, R, U, W, G, F, V, J, X, oe, te, ve, se, le, Ce, be, Le, ae, _e, Ee, Be, Ne, Ge, ke, pe, de, ce, Ae, Oe, We, Ue, Z, j, ee, ge, ye, $e, Re, Y, ue, Se, Fe, he, De, K, ze, Ve, $, xe, Me, Q, fe, Te, Ze, Ke, je, Je, St, rt, it, tt, Et, lt = ensure_array_like$2( - /*moldata*/ - t[3] - ), wt = []; - for (let pt = 0; pt < lt.length; pt += 1) - wt[pt] = create_each_block_1$1(get_each_context_1$1(t, lt, pt)); - function Pt() { - t[29].call( - n, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function vt() { - t[30].call( - u, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function bt() { - t[31].call( - _, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function mt() { - t[32].call( - c, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function Tt() { - t[33].call( - s, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function Ot(...pt) { - return ( - /*change_handler_1*/ - t[34]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55], - ...pt - ) - ); - } - function kt() { - t[35].call( - B, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function Xt() { - t[36].call( - F, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function Ft() { - t[37].call( - le, - /*each_value*/ - t[54], - /*index*/ - t[55] - ); - } - function Qt() { - return ( - /*click_handler_3*/ - t[38]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Jt() { - return ( - /*click_handler_4*/ - t[39]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function qt() { - return ( - /*click_handler_5*/ - t[40]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function er() { - return ( - /*click_handler_6*/ - t[41]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function tr() { - return ( - /*click_handler_7*/ - t[42]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function lr() { - return ( - /*click_handler_8*/ - t[43]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Or() { - return ( - /*click_handler_9*/ - t[44]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Dr() { - return ( - /*click_handler_10*/ - t[45]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Pr() { - return ( - /*click_handler_11*/ - t[46]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Ir() { - return ( - /*click_handler_12*/ - t[47]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function at() { - return ( - /*click_handler_13*/ - t[48]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function Bt() { - return ( - /*click_handler_14*/ - t[49]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("select"); - for (let pt = 0; pt < wt.length; pt += 1) - wt[pt].c(); - f = space$7(), u = element$7("input"), b = space$7(), h = element$7("div"), _ = element$7("input"), E = space$7(), c = element$7("input"), S = space$7(), y = element$7("div"), w = element$7("label"), w.textContent = "Select style", L = space$7(), s = element$7("select"), o = element$7("option"), o.textContent = "Stick", A = element$7("option"), A.textContent = "Cartoon", p = element$7("option"), p.textContent = "Surface", v = text$3(`$ - `), a = element$7("option"), a.textContent = "Sphere", l = space$7(), g = element$7("div"), M = element$7("div"), M.textContent = "Expand selection", C = space$7(), T = element$7("input"), I = space$7(), B = element$7("input"), P = space$7(), z = element$7("div"), z.textContent = "Å", k = space$7(), N = element$7("div"), R = element$7("div"), U = element$7("span"), U.textContent = "Full residue", W = space$7(), G = element$7("label"), F = element$7("input"), V = space$7(), J = element$7("div"), X = space$7(), oe = element$7("div"), te = element$7("span"), te.textContent = "Only sidechain", ve = space$7(), se = element$7("label"), le = element$7("input"), Ce = space$7(), be = element$7("div"), Le = space$7(), ae = element$7("div"), _e = element$7("button"), Be = space$7(), Ne = element$7("button"), ke = space$7(), pe = element$7("button"), ce = space$7(), Ae = element$7("button"), We = space$7(), Ue = element$7("button"), j = space$7(), ee = element$7("button"), ye = space$7(), $e = element$7("button"), Y = space$7(), ue = element$7("div"), Se = element$7("button"), Fe = text$3("AlphaFold"), De = space$7(), K = element$7("button"), ze = text$3("PyMol"), $ = space$7(), xe = element$7("button"), Me = text$3("Jmol"), fe = space$7(), Te = element$7("button"), Ze = text$3("Chain"), je = space$7(), Je = element$7("button"), St = text$3("Spectrum"), attr$8(n, "id", "style"), attr$8(n, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), /*rep*/ - t[53].model === void 0 && add_render_callback(Pt), attr$8(u, "type", "text"), attr$8(u, "id", "chain"), attr$8(u, "class", "w-1/2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), attr$8(u, "placeholder", "Chain"), attr$8(r, "class", "p-1 flex space-x-1 svelte-1skivl7"), attr$8(_, "type", "text"), attr$8(_, "id", "chain"), attr$8(_, "class", "w-1/2 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), attr$8(_, "placeholder", "Resname"), attr$8(c, "type", "text"), attr$8(c, "id", "residue_range"), attr$8(c, "class", "w-full bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), attr$8(c, "placeholder", "Residue range"), attr$8(h, "class", "p-1 flex space-x-1 svelte-1skivl7"), attr$8(w, "for", "countries"), attr$8(w, "class", "block mb-2 text-sm w-1/3 font-medium text-gray-600 dark:text-white svelte-1skivl7"), o.__value = "stick", set_input_value$1(o, o.__value), attr$8(o, "class", "svelte-1skivl7"), A.__value = "cartoon", set_input_value$1(A, A.__value), attr$8(A, "class", "svelte-1skivl7"), p.__value = "surface", set_input_value$1(p, p.__value), attr$8(p, "class", "svelte-1skivl7"), a.__value = "sphere", set_input_value$1(a, a.__value), attr$8(a, "class", "svelte-1skivl7"), attr$8(s, "id", "style"), attr$8(s, "class", "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 svelte-1skivl7"), /*rep*/ - t[53].style === void 0 && add_render_callback(Tt), attr$8(y, "class", "p-1 flex space-x-1 items-center svelte-1skivl7"), attr$8(M, "class", " svelte-1skivl7"), attr$8(T, "id", "around"), attr$8(T, "type", "range"), T.value = D = /*rep*/ - t[53].around, attr$8(T, "min", "0"), attr$8(T, "max", "10"), attr$8(T, "step", "0.5"), attr$8(T, "class", "h-2 w-1/3 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 svelte-1skivl7"), attr$8(B, "type", "text"), attr$8(B, "class", "w-8 svelte-1skivl7"), attr$8(z, "class", "svelte-1skivl7"), attr$8(g, "class", "flex p-1 items-center text-gray-700 space-x-1 text-sm svelte-1skivl7"), attr$8(U, "class", "svelte-1skivl7"), attr$8(F, "type", "checkbox"), F.__value = "", set_input_value$1(F, F.__value), attr$8(F, "class", "sr-only peer svelte-1skivl7"), attr$8(J, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1skivl7"), attr$8(G, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center svelte-1skivl7"), attr$8(R, "class", "flex space-x-1 w-1/2 svelte-1skivl7"), attr$8(te, "class", "svelte-1skivl7"), attr$8(le, "type", "checkbox"), le.__value = "", set_input_value$1(le, le.__value), attr$8(le, "class", "sr-only peer svelte-1skivl7"), attr$8(be, "class", "w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-400 svelte-1skivl7"), attr$8(se, "class", "relative inline-flex items-center mr-5 cursor-pointer text-center svelte-1skivl7"), attr$8(oe, "class", "flex space-x-1 w-1/2 svelte-1skivl7"), attr$8(N, "class", "flex p-1 items-center text-gray-700 space-x-1 text-sm svelte-1skivl7"), attr$8(_e, "class", Ee = null_to_empty( - /*rep*/ - t[53].color === "orangeCarbon" ? "bg-orange-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-orange-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(Ne, "class", Ge = null_to_empty( - /*rep*/ - t[53].color === "redCarbon" ? "bg-red-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-red-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(pe, "class", de = null_to_empty( - /*rep*/ - t[53].color === "blackCarbon" ? "bg-black rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-black rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(Ae, "class", Oe = null_to_empty( - /*rep*/ - t[53].color === "blueCarbon" ? "bg-blue-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-blue-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(Ue, "class", Z = null_to_empty( - /*rep*/ - t[53].color === "grayCarbon" ? "bg-gray-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-gray-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(ee, "class", ge = null_to_empty( - /*rep*/ - t[53].color === "greenCarbon" ? "bg-green-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-green-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8($e, "class", Re = null_to_empty( - /*rep*/ - t[53].color === "cyanCarbon" ? "bg-cyan-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-cyan-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7"), attr$8(ae, "class", "flex space-x-2 mt-2 svelte-1skivl7"), attr$8(Se, "class", he = null_to_empty( - /*rep*/ - t[53].color === "alphafold" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7"), attr$8(K, "class", Ve = null_to_empty( - /*rep*/ - t[53].color === "default" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7"), attr$8(xe, "class", Q = null_to_empty( - /*rep*/ - t[53].color === "Jmol" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7"), attr$8(Te, "class", Ke = null_to_empty( - /*rep*/ - t[53].color === "chain" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7"), attr$8(Je, "class", rt = null_to_empty( - /*rep*/ - t[53].color === "spectrum" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7"), attr$8(ue, "class", "flex space-x-2 py-2 text-sm svelte-1skivl7"), attr$8(e, "class", "svelte-1skivl7"); - }, - m(pt, yt) { - insert$a(pt, e, yt), append$8(e, r), append$8(r, n); - for (let At = 0; At < wt.length; At += 1) - wt[At] && wt[At].m(n, null); - select_option( - n, - /*rep*/ - t[53].model, - !0 - ), append$8(r, f), append$8(r, u), set_input_value$1( - u, - /*rep*/ - t[53].chain - ), append$8(e, b), append$8(e, h), append$8(h, _), set_input_value$1( - _, - /*rep*/ - t[53].resname - ), append$8(h, E), append$8(h, c), set_input_value$1( - c, - /*rep*/ - t[53].residue_range - ), append$8(e, S), append$8(e, y), append$8(y, w), append$8(y, L), append$8(y, s), append$8(s, o), append$8(s, A), append$8(s, p), append$8(s, v), append$8(s, a), select_option( - s, - /*rep*/ - t[53].style, - !0 - ), append$8(e, l), append$8(e, g), append$8(g, M), append$8(g, C), append$8(g, T), append$8(g, I), append$8(g, B), set_input_value$1( - B, - /*rep*/ - t[53].around - ), append$8(g, P), append$8(g, z), append$8(e, k), append$8(e, N), append$8(N, R), append$8(R, U), append$8(R, W), append$8(R, G), append$8(G, F), F.checked = /*rep*/ - t[53].byres, append$8(G, V), append$8(G, J), append$8(N, X), append$8(N, oe), append$8(oe, te), append$8(oe, ve), append$8(oe, se), append$8(se, le), le.checked = /*rep*/ - t[53].sidechain, append$8(se, Ce), append$8(se, be), append$8(e, Le), append$8(e, ae), append$8(ae, _e), append$8(ae, Be), append$8(ae, Ne), append$8(ae, ke), append$8(ae, pe), append$8(ae, ce), append$8(ae, Ae), append$8(ae, We), append$8(ae, Ue), append$8(ae, j), append$8(ae, ee), append$8(ae, ye), append$8(ae, $e), append$8(e, Y), append$8(e, ue), append$8(ue, Se), append$8(Se, Fe), append$8(ue, De), append$8(ue, K), append$8(K, ze), append$8(ue, $), append$8(ue, xe), append$8(xe, Me), append$8(ue, fe), append$8(ue, Te), append$8(Te, Ze), append$8(ue, je), append$8(ue, Je), append$8(Je, St), tt || (Et = [ - listen$2(n, "change", Pt), - listen$2(u, "input", vt), - listen$2(_, "input", bt), - listen$2(c, "input", mt), - listen$2(s, "change", Tt), - listen$2(T, "change", Ot), - listen$2(B, "input", kt), - listen$2(F, "change", Xt), - listen$2(le, "change", Ft), - listen$2(_e, "click", Qt), - listen$2(Ne, "click", Jt), - listen$2(pe, "click", qt), - listen$2(Ae, "click", er), - listen$2(Ue, "click", tr), - listen$2(ee, "click", lr), - listen$2($e, "click", Or), - listen$2(Se, "click", Dr), - listen$2(K, "click", Pr), - listen$2(xe, "click", Ir), - listen$2(Te, "click", at), - listen$2(Je, "click", Bt) - ], tt = !0); - }, - p(pt, yt) { - if (t = pt, yt[0] & /*moldata*/ - 8) { - lt = ensure_array_like$2( - /*moldata*/ - t[3] - ); - let At; - for (At = 0; At < lt.length; At += 1) { - const rr = get_each_context_1$1(t, lt, At); - wt[At] ? wt[At].p(rr, yt) : (wt[At] = create_each_block_1$1(rr), wt[At].c(), wt[At].m(n, null)); - } - for (; At < wt.length; At += 1) - wt[At].d(1); - wt.length = lt.length; - } - yt[0] & /*representations*/ - 2 && select_option( - n, - /*rep*/ - t[53].model - ), yt[0] & /*representations*/ - 2 && u.value !== /*rep*/ - t[53].chain && set_input_value$1( - u, - /*rep*/ - t[53].chain - ), yt[0] & /*representations*/ - 2 && _.value !== /*rep*/ - t[53].resname && set_input_value$1( - _, - /*rep*/ - t[53].resname - ), yt[0] & /*representations*/ - 2 && c.value !== /*rep*/ - t[53].residue_range && set_input_value$1( - c, - /*rep*/ - t[53].residue_range - ), yt[0] & /*representations*/ - 2 && select_option( - s, - /*rep*/ - t[53].style - ), yt[0] & /*representations*/ - 2 && D !== (D = /*rep*/ - t[53].around) && (T.value = D), yt[0] & /*representations*/ - 2 && B.value !== /*rep*/ - t[53].around && set_input_value$1( - B, - /*rep*/ - t[53].around - ), yt[0] & /*representations*/ - 2 && (F.checked = /*rep*/ - t[53].byres), yt[0] & /*representations*/ - 2 && (le.checked = /*rep*/ - t[53].sidechain), yt[0] & /*representations*/ - 2 && Ee !== (Ee = null_to_empty( - /*rep*/ - t[53].color === "orangeCarbon" ? "bg-orange-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-orange-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(_e, "class", Ee), yt[0] & /*representations*/ - 2 && Ge !== (Ge = null_to_empty( - /*rep*/ - t[53].color === "redCarbon" ? "bg-red-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-red-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(Ne, "class", Ge), yt[0] & /*representations*/ - 2 && de !== (de = null_to_empty( - /*rep*/ - t[53].color === "blackCarbon" ? "bg-black rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-black rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(pe, "class", de), yt[0] & /*representations*/ - 2 && Oe !== (Oe = null_to_empty( - /*rep*/ - t[53].color === "blueCarbon" ? "bg-blue-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-blue-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(Ae, "class", Oe), yt[0] & /*representations*/ - 2 && Z !== (Z = null_to_empty( - /*rep*/ - t[53].color === "grayCarbon" ? "bg-gray-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-gray-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(Ue, "class", Z), yt[0] & /*representations*/ - 2 && ge !== (ge = null_to_empty( - /*rep*/ - t[53].color === "greenCarbon" ? "bg-green-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-green-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8(ee, "class", ge), yt[0] & /*representations*/ - 2 && Re !== (Re = null_to_empty( - /*rep*/ - t[53].color === "cyanCarbon" ? "bg-cyan-600 rounded-full w-8 h-8 border-4 border-gray-300 cursor-pointer" : "bg-cyan-600 rounded-full w-8 h-8 border-4 border-white cursor-pointer" - ) + " svelte-1skivl7") && attr$8($e, "class", Re), yt[0] & /*representations*/ - 2 && he !== (he = null_to_empty( - /*rep*/ - t[53].color === "alphafold" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7") && attr$8(Se, "class", he), yt[0] & /*representations*/ - 2 && Ve !== (Ve = null_to_empty( - /*rep*/ - t[53].color === "default" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7") && attr$8(K, "class", Ve), yt[0] & /*representations*/ - 2 && Q !== (Q = null_to_empty( - /*rep*/ - t[53].color === "Jmol" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7") && attr$8(xe, "class", Q), yt[0] & /*representations*/ - 2 && Ke !== (Ke = null_to_empty( - /*rep*/ - t[53].color === "chain" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7") && attr$8(Te, "class", Ke), yt[0] & /*representations*/ - 2 && rt !== (rt = null_to_empty( - /*rep*/ - t[53].color === "spectrum" ? "rounded-lg p-1 border border-gray-400 cursor-pointer bg-gray-200" : "rounded-lg p-1 border border-gray-200 cursor-pointer bg-white" - ) + " svelte-1skivl7") && attr$8(Je, "class", rt); - }, - i(pt) { - pt && (it || add_render_callback(() => { - it = create_in_transition(e, fade, {}), it.start(); - })); - }, - o: noop$6, - d(pt) { - pt && detach$a(e), destroy_each$2(wt, pt), tt = !1, run_all$3(Et); - } - }; -} -function create_each_block_1$1(t) { - let e, r = ( - /*mol*/ - t[56].name + "" - ), n, f, u; - return { - c() { - e = element$7("option"), n = text$3(r), f = text$3(" #"), u = text$3( - /*i*/ - t[58] - ), e.__value = /*i*/ - t[58], set_input_value$1(e, e.__value), attr$8(e, "class", "svelte-1skivl7"); - }, - m(b, h) { - insert$a(b, e, h), append$8(e, n), append$8(e, f), append$8(e, u); - }, - p(b, h) { - h[0] & /*moldata*/ - 8 && r !== (r = /*mol*/ - b[56].name + "") && set_data$3(n, r); - }, - d(b) { - b && detach$a(e); - } - }; -} -function create_each_block$2(t) { - let e, r, n, f, u, b, h, _, E, c, S, y, w, L, s, o; - function A() { - return ( - /*click_handler*/ - t[26]( - /*rep*/ - t[53], - /*each_value*/ - t[54], - /*index*/ - t[55] - ) - ); - } - function p() { - return ( - /*click_handler_1*/ - t[27]( - /*index*/ - t[55] - ) - ); - } - function v() { - return ( - /*click_handler_2*/ - t[28]( - /*rep*/ - t[53] - ) - ); - } - let a = ( - /*rep*/ - t[53].visible && create_if_block_1$5(t) - ); - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("div"), f = element$7("button"), u = svg_element$3("svg"), b = svg_element$3("path"), _ = space$7(), E = element$7("span"), E.textContent = `Representation #${/*index*/ - t[55]}`, c = space$7(), S = element$7("button"), S.innerHTML = '', y = space$7(), w = element$7("button"), w.innerHTML = '', L = space$7(), a && a.c(), attr$8(b, "stroke-linecap", "round"), attr$8(b, "stroke-linejoin", "round"), attr$8(b, "d", "M8.25 4.5l7.5 7.5-7.5 7.5"), attr$8(b, "class", "svelte-1skivl7"), attr$8(u, "xmlns", "http://www.w3.org/2000/svg"), attr$8(u, "fill", "none"), attr$8(u, "viewBox", "0 0 24 24"), attr$8(u, "stroke-width", "1.5"), attr$8(u, "stroke", "currentColor"), attr$8(u, "class", h = null_to_empty( - /*rep*/ - t[53].visible ? "transform rotate-90 w-5 h-5 " : "w-5 h-5 " - ) + " svelte-1skivl7"), attr$8(E, "class", "svelte-1skivl7"), attr$8(f, "class", "flex items-center space-x-2 svelte-1skivl7"), attr$8(S, "class", "svelte-1skivl7"), attr$8(w, "title", "zoom to selection"), attr$8(w, "class", "svelte-1skivl7"), attr$8(n, "class", "flex space-x-2 items-center cursor-pointer p-1 svelte-1skivl7"), attr$8(r, "class", " svelte-1skivl7"), attr$8(e, "class", "bg-white border-b border-t border-gray-200 py-4 px-2 svelte-1skivl7"); - }, - m(l, g) { - insert$a(l, e, g), append$8(e, r), append$8(r, n), append$8(n, f), append$8(f, u), append$8(u, b), append$8(f, _), append$8(f, E), append$8(n, c), append$8(n, S), append$8(n, y), append$8(n, w), append$8(r, L), a && a.m(r, null), s || (o = [ - listen$2(f, "click", A), - listen$2(S, "click", p), - listen$2(w, "click", v) - ], s = !0); - }, - p(l, g) { - t = l, g[0] & /*representations*/ - 2 && h !== (h = null_to_empty( - /*rep*/ - t[53].visible ? "transform rotate-90 w-5 h-5 " : "w-5 h-5 " - ) + " svelte-1skivl7") && attr$8(u, "class", h), /*rep*/ - t[53].visible ? a ? (a.p(t, g), g[0] & /*representations*/ - 2 && transition_in$7(a, 1)) : (a = create_if_block_1$5(t), a.c(), transition_in$7(a, 1), a.m(r, null)) : a && (a.d(1), a = null); - }, - d(l) { - l && detach$a(e), a && a.d(), s = !1, run_all$3(o); - } - }; -} -function create_fragment$a(t) { - let e, r, n, f, u, b, h, _, E, c, S, y, w, L, s, o, A, p, v, a, l, g, M = ( - /*anyColorAlphaFold*/ - t[11] && create_if_block_8$1(t) - ), C = ( - /*hasFrames*/ - t[9] && create_if_block_6$1(t) - ), T = ( - /*showOffCanvas*/ - t[7] && create_if_block_2$1(t) - ), D = ( - /*showOffCanvasReps*/ - t[8] && create_if_block$6(t) - ); - return { - c() { - e = element$7("div"), r = element$7("div"), n = element$7("div"), f = element$7("div"), u = element$7("button"), u.innerHTML = '', b = space$7(), h = element$7("button"), h.innerHTML = '', _ = space$7(), E = element$7("button"), E.innerHTML = '', c = space$7(), M && M.c(), S = space$7(), C && C.c(), y = space$7(), w = element$7("div"), L = element$7("button"), L.innerHTML = '', s = space$7(), o = element$7("span"), o.textContent = "Cite 3dmol.js as Rego & Koes, doi:10/gb5g5n", A = space$7(), p = element$7("div"), v = space$7(), T && T.c(), a = space$7(), D && D.c(), attr$8(u, "class", "p-2 svelte-1skivl7"), attr$8(u, "title", "Reset View"), attr$8(h, "class", "p-2 svelte-1skivl7"), attr$8(h, "title", "Settings"), attr$8(E, "class", "p-2 svelte-1skivl7"), attr$8(E, "title", "Representations"), attr$8(f, "class", "absolute z-50 top-0 right-0 mr-2 flex flex-col divide-y border border-gray-200 mt-2 rounded items-center justify-center bg-white dark:bg-gray-800 svelte-1skivl7"), attr$8(L, "class", "p-1 svelte-1skivl7"), attr$8(L, "title", "How to cite 3Dmol.js"), attr$8(o, "class", "absolute -top-1 left-6 w-max rounded bg-gray-900 px-2 py-1 text-sm font-medium text-gray-50 opacity-0 shadow transition-opacity svelte-1skivl7"), toggle_class$5( - o, - "opacity-100", - /*showCiteTooltip*/ - t[6] - ), attr$8(w, "class", "absolute z-50 bottom-0 left-0 ml-2 flex divide-x mb-2 rounded items-center justify-center svelte-1skivl7"), attr$8(p, "class", "viewer w-full h-full z-10 svelte-1skivl7"), attr$8(n, "class", "gr-block gr-box relative w-full overflow-hidden svelte-1skivl7"), attr$8(r, "class", "overflow-hidden flex gap-px w-full h-full flex-wrap svelte-1skivl7"), attr$8(e, "class", "bg-white w-full minh svelte-1skivl7"); - }, - m(I, B) { - insert$a(I, e, B), append$8(e, r), append$8(r, n), append$8(n, f), append$8(f, u), append$8(f, b), append$8(f, h), append$8(f, _), append$8(f, E), append$8(n, c), M && M.m(n, null), append$8(n, S), C && C.m(n, null), append$8(n, y), append$8(n, w), append$8(w, L), append$8(w, s), append$8(w, o), append$8(n, A), append$8(n, p), t[21](p), append$8(n, v), T && T.m(n, null), append$8(n, a), D && D.m(n, null), l || (g = [ - listen$2( - u, - "click", - /*resetZoom*/ - t[18] - ), - listen$2( - h, - "click", - /*toggleOffCanvas*/ - t[14] - ), - listen$2( - E, - "click", - /*toggleOffCanvasReps*/ - t[15] - ), - listen$2( - L, - "click", - /*toggleCiteTooltip*/ - t[13] - ) - ], l = !0); - }, - p(I, B) { - /*anyColorAlphaFold*/ - I[11] ? M ? M.p(I, B) : (M = create_if_block_8$1(I), M.c(), M.m(n, S)) : M && (M.d(1), M = null), /*hasFrames*/ - I[9] ? C ? C.p(I, B) : (C = create_if_block_6$1(I), C.c(), C.m(n, y)) : C && (C.d(1), C = null), B[0] & /*showCiteTooltip*/ - 64 && toggle_class$5( - o, - "opacity-100", - /*showCiteTooltip*/ - I[6] - ), /*showOffCanvas*/ - I[7] ? T ? T.p(I, B) : (T = create_if_block_2$1(I), T.c(), T.m(n, a)) : T && (T.d(1), T = null), /*showOffCanvasReps*/ - I[8] ? D ? D.p(I, B) : (D = create_if_block$6(I), D.c(), D.m(n, null)) : D && (D.d(1), D = null); - }, - i: noop$6, - o: noop$6, - d(I) { - I && detach$a(e), M && M.d(), C && C.d(), t[21](null), T && T.d(), D && D.d(), l = !1, run_all$3(g); - } - }; -} -function fade(t, { delay: e = 0, duration: r = 50 }) { - const n = +getComputedStyle(t).opacity; - return { - delay: e, - duration: r, - css: (f) => `opacity: ${f * n}` - }; -} -function instance$9(t, e, r) { - let n = _3Dmol, f, { confidenceLabel: u = null } = e, { moldata: b = null } = e, h = { - backgroundColor: { - type: "select", - options: ["white", "black", "gray", "lightgray", "beige", "orange"] - }, - orthographic: { type: "toggle" }, - disableFog: { type: "toggle" } - }, { config: _ = {} } = e, E = !0, c = !1; - function S() { - r(6, c = !c); - } - let { representations: y = [] } = e, w = !1, L = !1; - function s() { - r(7, w = !w); - } - function o() { - r(8, L = !L); - } - function A(pe) { - y.splice(pe, 1), r(1, y); - } - function p() { - y.push({ - model: 0, - chain: "", - resname: "", - style: "cartoon", - color: "grayCarbon", - residue_range: "", - around: 0, - byres: !1, - visible: !0 - }), r(1, y); - } - let v = function(pe) { - return pe.b < 50 ? "OrangeRed" : pe.b < 70 ? "Gold" : pe.b < 90 ? "MediumTurquoise" : "Blue"; - }, a; - function l(pe) { - if (pe.type != null) - a.zoomTo(); - else { - let de = { model: pe.model }; - pe.chain !== "" && (de.chain = pe.chain), pe.residue_range !== "" && (de.resi = pe.residue_range), pe.resname !== "" && (de.resn = pe.resname), a.zoomTo(de); - } - } - function g(pe) { - a !== void 0 && (a.setStyle(), a.removeAllSurfaces(), pe.forEach((de) => { - let ce; - de.color === "alphafold" ? ce = { colorfunc: v } : de.color == "spectrum" ? ce = { color: "spectrum" } : ce = { colorscheme: de.color }; - let Ae = { model: de.model }; - if (de.chain !== "" && (Ae.chain = de.chain), de.residue_range !== "" && (Ae.resi = de.residue_range), de.resname !== "" && (Ae.resn = de.resname), Ae.byres = de.byres, de.around !== 0 && (Ae.expand = de.around), de.sidechain && (Ae = { - and: [Ae, { atom: ["N", "C", "O"], invert: !0 }] - }), de.style === "surface") - ce.opacity = 0.8, a.addSurface(n.SurfaceType.VDW, ce, Ae); - else - try { - a.getModel(Ae.model) != null && a.addStyle(Ae, { [de.style]: ce }); - } catch (Oe) { - console.log(Oe); - } - }), a.render()); - } - onMount$1(() => { - console.log("MolecularViewer Mounted"); - let pe = { ..._, cartoonQuality: 7 }; - r(20, a = n.createViewer(f, pe)); - let de = []; - y.forEach((ce) => { - de.some((Ae) => Ae.model === ce.model && Ae.chain === ce.chain && Ae.resname === ce.resname && Ae.style === ce.style && Ae.color === ce.color && Ae.residue_range === ce.residue_range && Ae.around === ce.around && Ae.byres === ce.byres && Ae.sidechain === ce.sidechain) || de.push(ce); - }), r(1, y = de), console.log(b), b.length > 0 && b.forEach((ce) => { - ce.asFrames ? a.addModelsAsFrames(ce.data, ce.format) : a.addModel(ce.data, ce.format); - }), g(y), a.zoomTo(), a.render(), a.zoom(0.8, 2e3), y.forEach((ce) => { - ce.color === "alphafold" && r(11, T = !0); - }), E && a.setHoverable( - {}, - !0, - function(ce, Ae, Oe, We) { - if (!ce.label) { - let Ue; - T ? Ue = ce.resn + ":" + ce.resi + ":" + ce.atom + " (" + u + " " + ce.b + ")" : Ue = ce.resn + ":" + ce.resi + ":" + ce.atom, ce.label = Ae.addLabel(Ue, { - position: ce, - backgroundColor: "#ffffff", - borderColor: "#dddddd", - fontColor: "black" - }); - } - }, - function(ce, Ae) { - ce.label && (Ae.removeLabel(ce.label), delete ce.label); - } - ); - }); - let M = !1, C = !1, T = !1; - function D() { - console.log(a.isAnimated()), C ? a.pauseAnimate() : a.animate({ loop: "forward", reps: 0 }), a.render(), console.log(a.isAnimated()), r(10, C = !C); - } - function I(pe) { - binding_callbacks$3[pe ? "unshift" : "push"](() => { - f = pe, r(4, f); - }); - } - function B(pe) { - _[pe] = this.checked, r(0, _), r(12, h); - } - const P = (pe) => { - r(0, _[pe] = event.target.value, _); - }; - function z(pe) { - _[pe] = select_value(this), r(0, _), r(12, h); - } - function k() { - E = this.value, r(5, E); - } - const N = (pe, de, ce) => r(1, de[ce].visible = !pe.visible, y), R = (pe) => A(pe), U = (pe) => l(pe); - function W(pe, de) { - pe[de].model = select_value(this), r(1, y); - } - function G(pe, de) { - pe[de].chain = this.value, r(1, y); - } - function F(pe, de) { - pe[de].resname = this.value, r(1, y); - } - function V(pe, de) { - pe[de].residue_range = this.value, r(1, y); - } - function J(pe, de) { - pe[de].style = select_value(this), r(1, y); - } - const X = (pe, de, ce, Ae) => { - r(1, de[ce].around = Ae.target.value, y); - }; - function oe(pe, de) { - pe[de].around = this.value, r(1, y); - } - function te(pe, de) { - pe[de].byres = this.checked, r(1, y); - } - function ve(pe, de) { - pe[de].sidechain = this.checked, r(1, y); - } - const se = (pe, de, ce) => r(1, de[ce].color = "orangeCarbon", y), le = (pe, de, ce) => r(1, de[ce].color = "redCarbon", y), Ce = (pe, de, ce) => r(1, de[ce].color = "blackCarbon", y), be = (pe, de, ce) => r(1, de[ce].color = "blueCarbon", y), Le = (pe, de, ce) => r(1, de[ce].color = "grayCarbon", y), ae = (pe, de, ce) => r(1, de[ce].color = "greenCarbon", y), _e = (pe, de, ce) => r(1, de[ce].color = "cyanCarbon", y), Ee = (pe, de, ce) => r(1, de[ce].color = "alphafold", y), Be = (pe, de, ce) => r(1, de[ce].color = "default", y), Ne = (pe, de, ce) => r(1, de[ce].color = "Jmol", y), Ge = (pe, de, ce) => r(1, de[ce].color = "chain", y), ke = (pe, de, ce) => r(1, de[ce].color = "spectrum", y); - return t.$$set = (pe) => { - "confidenceLabel" in pe && r(2, u = pe.confidenceLabel), "moldata" in pe && r(3, b = pe.moldata), "config" in pe && r(0, _ = pe.config), "representations" in pe && r(1, y = pe.representations); - }, t.$$.update = () => { - t.$$.dirty[0] & /*view, config*/ - 1048577 && a != null && (a.setBackgroundColor(_.backgroundColor), a.enableFog(!_.disableFog), a.setCameraParameters({ orthographic: _.orthographic })), t.$$.dirty[0] & /*representations*/ - 2 && g(y), t.$$.dirty[0] & /*moldata*/ - 8 && b.forEach((pe) => { - pe.asFrames && r(9, M = !0); - }), t.$$.dirty[0] & /*representations*/ - 2 && (r(11, T = !1), y.forEach((pe) => { - pe.color === "alphafold" && r(11, T = !0); - })); - }, [ - _, - y, - u, - b, - f, - E, - c, - w, - L, - M, - C, - T, - h, - S, - s, - o, - A, - p, - l, - D, - a, - I, - B, - P, - z, - k, - N, - R, - U, - W, - G, - F, - V, - J, - X, - oe, - te, - ve, - se, - le, - Ce, - be, - Le, - ae, - _e, - Ee, - Be, - Ne, - Ge, - ke - ]; -} -class MolecularViewer extends SvelteComponent$a { - constructor(e) { - super(), init$a( - this, - e, - instance$9, - create_fragment$a, - safe_not_equal$b, - { - confidenceLabel: 2, - moldata: 3, - config: 0, - representations: 1 - }, - null, - [-1, -1, -1] - ); - } -} -const { - SvelteComponent: SvelteComponent$9, - bubble: bubble$2, - check_outros: check_outros$5, - create_component: create_component$5, - destroy_component: destroy_component$5, - detach: detach$9, - empty: empty$3, - group_outros: group_outros$5, - init: init$9, - insert: insert$9, - mount_component: mount_component$5, - safe_not_equal: safe_not_equal$a, - space: space$6, - transition_in: transition_in$6, - transition_out: transition_out$6 -} = window.__gradio__svelte__internal; -function create_else_block$4(t) { - let e, r; - return e = new Empty({ - props: { - unpadded_box: !0, - size: "large", - $$slots: { default: [create_default_slot$2] }, - $$scope: { ctx: t } - } - }), { - c() { - create_component$5(e.$$.fragment); - }, - m(n, f) { - mount_component$5(e, n, f), r = !0; - }, - p(n, f) { - const u = {}; - f & /*$$scope*/ - 8192 && (u.$$scope = { dirty: f, ctx: n }), e.$set(u); - }, - i(n) { - r || (transition_in$6(e.$$.fragment, n), r = !0); - }, - o(n) { - transition_out$6(e.$$.fragment, n), r = !1; - }, - d(n) { - destroy_component$5(e, n); - } - }; -} -function create_if_block$5(t) { - let e, r, n, f; - e = new FilePreview({ - props: { - i18n: ( - /*i18n*/ - t[5] - ), - selectable: ( - /*selectable*/ - t[3] - ), - value: ( - /*value*/ - t[0] - ), - height: ( - /*height*/ - t[4] - ) - } - }), e.$on( - "select", - /*select_handler*/ - t[12] - ); - let u = ( - /*moldata*/ - t[9] != null && /*molviewer*/ - t[10] && create_if_block_1$4(t) - ); - return { - c() { - create_component$5(e.$$.fragment), r = space$6(), u && u.c(), n = empty$3(); - }, - m(b, h) { - mount_component$5(e, b, h), insert$9(b, r, h), u && u.m(b, h), insert$9(b, n, h), f = !0; - }, - p(b, h) { - const _ = {}; - h & /*i18n*/ - 32 && (_.i18n = /*i18n*/ - b[5]), h & /*selectable*/ - 8 && (_.selectable = /*selectable*/ - b[3]), h & /*value*/ - 1 && (_.value = /*value*/ - b[0]), h & /*height*/ - 16 && (_.height = /*height*/ - b[4]), e.$set(_), /*moldata*/ - b[9] != null && /*molviewer*/ - b[10] ? u ? (u.p(b, h), h & /*moldata, molviewer*/ - 1536 && transition_in$6(u, 1)) : (u = create_if_block_1$4(b), u.c(), transition_in$6(u, 1), u.m(n.parentNode, n)) : u && (group_outros$5(), transition_out$6(u, 1, 1, () => { - u = null; - }), check_outros$5()); - }, - i(b) { - f || (transition_in$6(e.$$.fragment, b), transition_in$6(u), f = !0); - }, - o(b) { - transition_out$6(e.$$.fragment, b), transition_out$6(u), f = !1; - }, - d(b) { - b && (detach$9(r), detach$9(n)), destroy_component$5(e, b), u && u.d(b); - } - }; -} -function create_default_slot$2(t) { - let e, r; - return e = new File$1({}), { - c() { - create_component$5(e.$$.fragment); - }, - m(n, f) { - mount_component$5(e, n, f), r = !0; - }, - i(n) { - r || (transition_in$6(e.$$.fragment, n), r = !0); - }, - o(n) { - transition_out$6(e.$$.fragment, n), r = !1; - }, - d(n) { - destroy_component$5(e, n); - } - }; -} -function create_if_block_1$4(t) { - let e, r; - return e = new MolecularViewer({ - props: { - moldata: ( - /*moldata*/ - t[9] - ), - config: ( - /*config*/ - t[6] - ), - confidenceLabel: ( - /*confidenceLabel*/ - t[7] - ), - representations: ( - /*representations*/ - t[8] - ) - } - }), { - c() { - create_component$5(e.$$.fragment); - }, - m(n, f) { - mount_component$5(e, n, f), r = !0; - }, - p(n, f) { - const u = {}; - f & /*moldata*/ - 512 && (u.moldata = /*moldata*/ - n[9]), f & /*config*/ - 64 && (u.config = /*config*/ - n[6]), f & /*confidenceLabel*/ - 128 && (u.confidenceLabel = /*confidenceLabel*/ - n[7]), f & /*representations*/ - 256 && (u.representations = /*representations*/ - n[8]), e.$set(u); - }, - i(n) { - r || (transition_in$6(e.$$.fragment, n), r = !0); - }, - o(n) { - transition_out$6(e.$$.fragment, n), r = !1; - }, - d(n) { - destroy_component$5(e, n); - } - }; -} -function create_fragment$9(t) { - let e, r, n, f, u, b; - e = new BlockLabel({ - props: { - show_label: ( - /*show_label*/ - t[2] - ), - float: ( - /*value*/ - t[0] === null - ), - Icon: File$1, - label: ( - /*label*/ - t[1] || "File" - ) - } - }); - const h = [create_if_block$5, create_else_block$4], _ = []; - function E(c, S) { - return ( - /*value*/ - c[0] ? 0 : 1 - ); +var ptPerUnit = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + pt: 1, + // TeX point + mm: 7227 / 2540, + // millimeter + cm: 7227 / 254, + // centimeter + in: 72.27, + // inch + bp: 803 / 800, + // big (PostScript) points + pc: 12, + // pica + dd: 1238 / 1157, + // didot + cc: 14856 / 1157, + // cicero (12 didot) + nd: 685 / 642, + // new didot + nc: 1370 / 107, + // new cicero (12 new didot) + sp: 1 / 65536, + // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + px: 803 / 800 + // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX +}, relativeUnit = { + ex: !0, + em: !0, + mu: !0 +}, validUnit = function(e) { + return typeof e != "string" && (e = e.unit), e in ptPerUnit || e in relativeUnit || e === "ex"; +}, calculateSize = function(e, t) { + var r; + if (e.unit in ptPerUnit) + r = ptPerUnit[e.unit] / t.fontMetrics().ptPerEm / t.sizeMultiplier; + else if (e.unit === "mu") + r = t.fontMetrics().cssEmPerMu; + else { + var a; + if (t.style.isTight() ? a = t.havingStyle(t.style.text()) : a = t, e.unit === "ex") + r = a.fontMetrics().xHeight; + else if (e.unit === "em") + r = a.fontMetrics().quad; + else + throw new ParseError("Invalid unit: '" + e.unit + "'"); + a !== t && (r *= a.sizeMultiplier / t.sizeMultiplier); } - return n = E(t), f = _[n] = h[n](t), { - c() { - create_component$5(e.$$.fragment), r = space$6(), f.c(), u = empty$3(); - }, - m(c, S) { - mount_component$5(e, c, S), insert$9(c, r, S), _[n].m(c, S), insert$9(c, u, S), b = !0; - }, - p(c, [S]) { - const y = {}; - S & /*show_label*/ - 4 && (y.show_label = /*show_label*/ - c[2]), S & /*value*/ - 1 && (y.float = /*value*/ - c[0] === null), S & /*label*/ - 2 && (y.label = /*label*/ - c[1] || "File"), e.$set(y); - let w = n; - n = E(c), n === w ? _[n].p(c, S) : (group_outros$5(), transition_out$6(_[w], 1, 1, () => { - _[w] = null; - }), check_outros$5(), f = _[n], f ? f.p(c, S) : (f = _[n] = h[n](c), f.c()), transition_in$6(f, 1), f.m(u.parentNode, u)); - }, - i(c) { - b || (transition_in$6(e.$$.fragment, c), transition_in$6(f), b = !0); - }, - o(c) { - transition_out$6(e.$$.fragment, c), transition_out$6(f), b = !1; - }, - d(c) { - c && (detach$9(r), detach$9(u)), destroy_component$5(e, c), _[n].d(c); - } - }; -} -function instance$8(t, e, r) { - let { value: n = null } = e, { label: f } = e, { show_label: u = !0 } = e, { selectable: b = !1 } = e, { height: h = void 0 } = e, { i18n: _ } = e, { config: E = {} } = e, { confidenceLabel: c = "" } = e, { representations: S = [] } = e, { moldata: y = null } = e, { molviewer: w = !1 } = e, { errors: L = [] } = e; - function s(o) { - bubble$2.call(this, t, o); + return Math.min(e.number * r, t.maxSize); +}, makeEm = function(e) { + return +e.toFixed(4) + "em"; +}, createClass = function(e) { + return e.filter((t) => t).join(" "); +}, initNode = function(e, t, r) { + if (this.classes = e || [], this.attributes = {}, this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = r || {}, t) { + t.style.isTight() && this.classes.push("mtight"); + var a = t.getColor(); + a && (this.style.color = a); } - return t.$$set = (o) => { - "value" in o && r(0, n = o.value), "label" in o && r(1, f = o.label), "show_label" in o && r(2, u = o.show_label), "selectable" in o && r(3, b = o.selectable), "height" in o && r(4, h = o.height), "i18n" in o && r(5, _ = o.i18n), "config" in o && r(6, E = o.config), "confidenceLabel" in o && r(7, c = o.confidenceLabel), "representations" in o && r(8, S = o.representations), "moldata" in o && r(9, y = o.moldata), "molviewer" in o && r(10, w = o.molviewer), "errors" in o && r(11, L = o.errors); - }, [ - n, - f, - u, - b, - h, - _, - E, - c, - S, - y, - w, - L, - s - ]; -} -class File_1 extends SvelteComponent$9 { - constructor(e) { - super(), init$9(this, e, instance$8, create_fragment$9, safe_not_equal$a, { - value: 0, - label: 1, - show_label: 2, - selectable: 3, - height: 4, - i18n: 5, - config: 6, - confidenceLabel: 7, - representations: 8, - moldata: 9, - molviewer: 10, - errors: 11 - }); +}, toNode = function(e) { + var t = document.createElement(e); + t.className = createClass(this.classes); + for (var r in this.style) + this.style.hasOwnProperty(r) && (t.style[r] = this.style[r]); + for (var a in this.attributes) + this.attributes.hasOwnProperty(a) && t.setAttribute(a, this.attributes[a]); + for (var l = 0; l < this.children.length; l++) + t.appendChild(this.children[l].toNode()); + return t; +}, toMarkup = function(e) { + var t = "<" + e; + this.classes.length && (t += ' class="' + utils.escape(createClass(this.classes)) + '"'); + var r = ""; + for (var a in this.style) + this.style.hasOwnProperty(a) && (r += utils.hyphenate(a) + ":" + this.style[a] + ";"); + r && (t += ' style="' + utils.escape(r) + '"'); + for (var l in this.attributes) + this.attributes.hasOwnProperty(l) && (t += " " + l + '="' + utils.escape(this.attributes[l]) + '"'); + t += ">"; + for (var d = 0; d < this.children.length; d++) + t += this.children[d].toMarkup(); + return t += "", t; +}; +class Span { + constructor(e, t, r, a) { + this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.width = void 0, this.maxFontSize = void 0, this.style = void 0, initNode.call(this, e, r, a), this.children = t || []; } -} -var fn$1 = new Intl.Collator(0, { numeric: 1 }).compare; -function semiver$1(t, e, r) { - return t = t.split("."), e = e.split("."), fn$1(t[0], e[0]) || fn$1(t[1], e[1]) || (e[2] = e.slice(2).join("."), r = /[.-]/.test(t[2] = t.slice(2).join(".")), r == /[.-]/.test(e[2]) ? fn$1(t[2], e[2]) : r ? -1 : 1); -} -function resolve_root$1(t, e, r) { - return e.startsWith("http://") || e.startsWith("https://") ? r ? t : e : t + e; -} -function determine_protocol$1(t) { - if (t.startsWith("http")) { - const { protocol: e, host: r } = new URL(t); - return r.endsWith("hf.space") ? { - ws_protocol: "wss", - host: r, - http_protocol: e - } : { - ws_protocol: e === "https:" ? "wss" : "ws", - http_protocol: e, - host: r - }; - } else if (t.startsWith("file:")) - return { - ws_protocol: "ws", - http_protocol: "http:", - host: "lite.local" - // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`. - }; - return { - ws_protocol: "wss", - http_protocol: "https:", - host: t - }; -} -const RE_SPACE_NAME$1 = /^[^\/]*\/[^\/]*$/, RE_SPACE_DOMAIN$1 = /.*hf\.space\/{0,1}$/; -async function process_endpoint$1(t, e) { - const r = {}; - e && (r.Authorization = `Bearer ${e}`); - const n = t.trim(); - if (RE_SPACE_NAME$1.test(n)) - try { - const f = await fetch( - `https://huggingface.co/api/spaces/${n}/host`, - { headers: r } - ); - if (f.status !== 200) - throw new Error("Space metadata could not be loaded."); - const u = (await f.json()).host; - return { - space_id: t, - ...determine_protocol$1(u) - }; - } catch (f) { - throw new Error("Space metadata could not be loaded." + f.message); - } - if (RE_SPACE_DOMAIN$1.test(n)) { - const { ws_protocol: f, http_protocol: u, host: b } = determine_protocol$1(n); - return { - space_id: b.replace(".hf.space", ""), - ws_protocol: f, - http_protocol: u, - host: b - }; + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not + * all browsers support attributes the same, and having too many custom + * attributes is probably bad. + */ + setAttribute(e, t) { + this.attributes[e] = t; } - return { - space_id: !1, - ...determine_protocol$1(n) - }; -} -function map_names_to_ids$1(t) { - let e = {}; - return t.forEach(({ api_name: r }, n) => { - r && (e[r] = n); - }), e; -} -const RE_DISABLED_DISCUSSION$1 = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/; -async function discussions_enabled$1(t) { - try { - const r = (await fetch( - `https://huggingface.co/api/spaces/${t}/discussions`, - { - method: "HEAD" - } - )).headers.get("x-error-message"); - return !(r && RE_DISABLED_DISCUSSION$1.test(r)); - } catch { - return !1; + hasClass(e) { + return utils.contains(this.classes, e); } -} -function normalise_file(t, e, r) { - if (t == null) - return null; - if (Array.isArray(t)) { - const n = []; - for (const f of t) - f == null ? n.push(null) : n.push(normalise_file(f, e, r)); - return n; + toNode() { + return toNode.call(this, "span"); + } + toMarkup() { + return toMarkup.call(this, "span"); } - return t.is_stream ? r == null ? new FileData$1({ - ...t, - url: e + "/stream/" + t.path - }) : new FileData$1({ - ...t, - url: "/proxy=" + r + "stream/" + t.path - }) : new FileData$1({ - ...t, - url: get_fetchable_url_or_file(t.path, e, r) - }); } -function is_url(t) { - try { - const e = new URL(t); - return e.protocol === "http:" || e.protocol === "https:"; - } catch { - return !1; +class Anchor { + constructor(e, t, r, a) { + this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, initNode.call(this, t, a), this.children = r || [], this.setAttribute("href", e); + } + setAttribute(e, t) { + this.attributes[e] = t; + } + hasClass(e) { + return utils.contains(this.classes, e); + } + toNode() { + return toNode.call(this, "a"); + } + toMarkup() { + return toMarkup.call(this, "a"); } } -function get_fetchable_url_or_file(t, e, r) { - return t == null ? r ? `/proxy=${r}file=` : `${e}/file=` : is_url(t) ? t : r ? `/proxy=${r}file=${t}` : `${e}/file=${t}`; +class Img { + constructor(e, t, r) { + this.src = void 0, this.alt = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.alt = t, this.src = e, this.classes = ["mord"], this.style = r; + } + hasClass(e) { + return utils.contains(this.classes, e); + } + toNode() { + var e = document.createElement("img"); + e.src = this.src, e.alt = this.alt, e.className = "mord"; + for (var t in this.style) + this.style.hasOwnProperty(t) && (e.style[t] = this.style[t]); + return e; + } + toMarkup() { + var e = '' + utils.escape(this.alt) + ' f.blob - ); - return await Promise.all( - await r(e, n).then( - async (f) => { - if (f.error) - throw new Error(f.error); - return f.files ? f.files.map((u, b) => { - const h = new FileData$1({ ...t[b], path: u }); - return normalise_file(h, e, null); - }) : []; - } - ) - ); +var iCombinations = { + î: "ı̂", + ï: "ı̈", + í: "ı́", + // 'ī': '\u0131\u0304', // enable when we add Extended Latin + ì: "ı̀" +}; +class SymbolNode { + constructor(e, t, r, a, l, d, o, u) { + this.text = void 0, this.height = void 0, this.depth = void 0, this.italic = void 0, this.skew = void 0, this.width = void 0, this.maxFontSize = void 0, this.classes = void 0, this.style = void 0, this.text = e, this.height = t || 0, this.depth = r || 0, this.italic = a || 0, this.skew = l || 0, this.width = d || 0, this.classes = o || [], this.style = u || {}, this.maxFontSize = 0; + var p = scriptFromCodepoint(this.text.charCodeAt(0)); + p && this.classes.push(p + "_fallback"), /[îïíì]/.test(this.text) && (this.text = iCombinations[this.text]); + } + hasClass(e) { + return utils.contains(this.classes, e); + } + /** + * Creates a text node or span from a symbol node. Note that a span is only + * created if it is needed. + */ + toNode() { + var e = document.createTextNode(this.text), t = null; + this.italic > 0 && (t = document.createElement("span"), t.style.marginRight = makeEm(this.italic)), this.classes.length > 0 && (t = t || document.createElement("span"), t.className = createClass(this.classes)); + for (var r in this.style) + this.style.hasOwnProperty(r) && (t = t || document.createElement("span"), t.style[r] = this.style[r]); + return t ? (t.appendChild(e), t) : e; + } + /** + * Creates markup for a symbol node. + */ + toMarkup() { + var e = !1, t = " 0 && (r += "margin-right:" + this.italic + "em;"); + for (var a in this.style) + this.style.hasOwnProperty(a) && (r += utils.hyphenate(a) + ":" + this.style[a] + ";"); + r && (e = !0, t += ' style="' + utils.escape(r) + '"'); + var l = utils.escape(this.text); + return e ? (t += ">", t += l, t += "", t) : l; + } } -async function prepare_files(t, e) { - return t.map( - (r, n) => new FileData$1({ - path: r.name, - orig_name: r.name, - blob: r, - size: r.size, - mime_type: r.type, - is_stream: e - }) - ); +class SvgNode { + constructor(e, t) { + this.children = void 0, this.attributes = void 0, this.children = e || [], this.attributes = t || {}; + } + toNode() { + var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg"); + for (var r in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]); + for (var a = 0; a < this.children.length; a++) + t.appendChild(this.children[a].toNode()); + return t; + } + toMarkup() { + var e = ' { - s.append("files", A); - }); - try { - var y = await t(`${b}/upload`, { - method: "POST", - body: s, - headers: E - }); - } catch { - return { error: BROKEN_CONNECTION_MSG$1 }; - } - const o = await y.json(); - S.push(...o); - } - return { files: S }; - } - async function f(b, h = { normalise_files: !0 }) { - return new Promise(async (_) => { - const { status_callback: E, hf_token: c, normalise_files: S } = h, y = { - predict: D, - submit: I, - view_api: P, - component_server: B - }, w = S ?? !0; - if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) { - const z = await import("./wrapper-98f94c21-0e07ab68.js"); - NodeBlob$1 = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = z.WebSocket; - } - const { ws_protocol: L, http_protocol: s, host: o, space_id: A } = await process_endpoint$1(b, c), p = Math.random().toString(36).substring(2), v = {}; - let a, l = {}, g = !1; - c && A && (g = await get_jwt$1(A, c)); - async function M(z) { - if (a = z, l = map_names_to_ids$1((z == null ? void 0 : z.dependencies) || []), a.auth_required) - return { - config: a, - ...y - }; - try { - C = await P(a); - } catch (k) { - console.error(`Could not get api details: ${k.message}`); - } - return { - config: a, - ...y - }; - } - let C; - async function T(z) { - if (E && E(z), z.status === "running") - try { - a = await resolve_config$1( - t, - `${s}//${o}`, - c - ); - const k = await M(a); - _(k); - } catch (k) { - console.error(k), E && E({ - status: "error", - message: "Could not load this space.", - load_status: "error", - detail: "NOT_FOUND" - }); - } - } - try { - a = await resolve_config$1( - t, - `${s}//${o}`, - c - ); - const z = await M(a); - _(z); - } catch (z) { - console.error(z), A ? check_space_status$1( - A, - RE_SPACE_NAME$1.test(A) ? "space_name" : "subdomain", - T - ) : E && E({ - status: "error", - message: "Could not load this space.", - load_status: "error", - detail: "NOT_FOUND" - }); - } - function D(z, k, N) { - let R = !1, U = !1, W; - if (typeof z == "number") - W = a.dependencies[z]; - else { - const G = z.replace(/^\//, ""); - W = a.dependencies[l[G]]; - } - if (W.types.continuous) - throw new Error( - "Cannot call predict on this function as it may run forever. Use submit instead" - ); - return new Promise((G, F) => { - const V = I(z, k, N); - let J; - V.on("data", (X) => { - U && (V.destroy(), G(X)), R = !0, J = X; - }).on("status", (X) => { - X.stage === "error" && F(X), X.stage === "complete" && (U = !0, R && (V.destroy(), G(J))); - }); - }); - } - function I(z, k, N) { - let R, U; - if (typeof z == "number") - R = z, U = C.unnamed_endpoints[R]; - else { - const ae = z.replace(/^\//, ""); - R = l[ae], U = C.named_endpoints[z.trim()]; - } - if (typeof R != "number") - throw new Error( - "There is no endpoint matching that name of fn_index matching that number." - ); - let W, G, F = a.protocol ?? "sse"; - const V = typeof z == "number" ? "/predict" : z; - let J, X = null, oe = !1; - const te = {}; - let ve = ""; - typeof window < "u" && (ve = new URLSearchParams(window.location.search).toString()), u( - `${s}//${resolve_root$1(o, a.path, !0)}`, - k, - U, - c - ).then((ae) => { - if (J = { data: ae || [], event_data: N, fn_index: R }, skip_queue$1(R, a)) - se({ - type: "status", - endpoint: V, - stage: "pending", - queue: !1, - fn_index: R, - time: /* @__PURE__ */ new Date() - }), r( - `${s}//${resolve_root$1(o, a.path, !0)}/run${V.startsWith("/") ? V : `/${V}`}${ve ? "?" + ve : ""}`, - { - ...J, - session_hash: p - }, - c - ).then(([Ee, Be]) => { - const Ne = w ? transform_output( - Ee.data, - U, - a.root, - a.root_url - ) : Ee.data; - Be == 200 ? (se({ - type: "data", - endpoint: V, - fn_index: R, - data: Ne, - time: /* @__PURE__ */ new Date() - }), se({ - type: "status", - endpoint: V, - fn_index: R, - stage: "complete", - eta: Ee.average_duration, - queue: !1, - time: /* @__PURE__ */ new Date() - })) : se({ - type: "status", - stage: "error", - endpoint: V, - fn_index: R, - message: Ee.error, - queue: !1, - time: /* @__PURE__ */ new Date() - }); - }).catch((Ee) => { - se({ - type: "status", - stage: "error", - message: Ee.message, - endpoint: V, - fn_index: R, - queue: !1, - time: /* @__PURE__ */ new Date() - }); - }); - else if (F == "ws") { - se({ - type: "status", - stage: "pending", - queue: !0, - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date() - }); - let Ee = new URL(`${L}://${resolve_root$1( - o, - a.path, - !0 - )} - /queue/join${ve ? "?" + ve : ""}`); - g && Ee.searchParams.set("__sign", g), W = e(Ee), W.onclose = (Be) => { - Be.wasClean || se({ - type: "status", - stage: "error", - broken: !0, - message: BROKEN_CONNECTION_MSG$1, - queue: !0, - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date() - }); - }, W.onmessage = function(Be) { - const Ne = JSON.parse(Be.data), { type: Ge, status: ke, data: pe } = handle_message$1( - Ne, - v[R] - ); - if (Ge === "update" && ke && !oe) - se({ - type: "status", - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date(), - ...ke - }), ke.stage === "error" && W.close(); - else if (Ge === "hash") { - W.send(JSON.stringify({ fn_index: R, session_hash: p })); - return; - } else - Ge === "data" ? W.send(JSON.stringify({ ...J, session_hash: p })) : Ge === "complete" ? oe = ke : Ge === "log" ? se({ - type: "log", - log: pe.log, - level: pe.level, - endpoint: V, - fn_index: R - }) : Ge === "generating" && se({ - type: "status", - time: /* @__PURE__ */ new Date(), - ...ke, - stage: ke == null ? void 0 : ke.stage, - queue: !0, - endpoint: V, - fn_index: R - }); - pe && (se({ - type: "data", - time: /* @__PURE__ */ new Date(), - data: w ? transform_output( - pe.data, - U, - a.root, - a.root_url - ) : pe.data, - endpoint: V, - fn_index: R - }), oe && (se({ - type: "status", - time: /* @__PURE__ */ new Date(), - ...oe, - stage: ke == null ? void 0 : ke.stage, - queue: !0, - endpoint: V, - fn_index: R - }), W.close())); - }, semiver$1(a.version || "2.0.0", "3.6") < 0 && addEventListener( - "open", - () => W.send(JSON.stringify({ hash: p })) - ); - } else { - se({ - type: "status", - stage: "pending", - queue: !0, - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date() - }); - var _e = new URLSearchParams({ - fn_index: R.toString(), - session_hash: p - }).toString(); - let Ee = new URL( - `${s}//${resolve_root$1( - o, - a.path, - !0 - )}/queue/join?${ve ? ve + "&" : ""}${_e}` - ); - G = new EventSource(Ee), G.onmessage = async function(Be) { - const Ne = JSON.parse(Be.data), { type: Ge, status: ke, data: pe } = handle_message$1( - Ne, - v[R] - ); - if (Ge === "update" && ke && !oe) - se({ - type: "status", - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date(), - ...ke - }), ke.stage === "error" && G.close(); - else if (Ge === "data") { - X = Ne.event_id; - let [de, ce] = await r( - `${s}//${resolve_root$1( - o, - a.path, - !0 - )}/queue/data`, - { - ...J, - session_hash: p, - event_id: X - }, - c - ); - ce !== 200 && (se({ - type: "status", - stage: "error", - message: BROKEN_CONNECTION_MSG$1, - queue: !0, - endpoint: V, - fn_index: R, - time: /* @__PURE__ */ new Date() - }), G.close()); - } else - Ge === "complete" ? oe = ke : Ge === "log" ? se({ - type: "log", - log: pe.log, - level: pe.level, - endpoint: V, - fn_index: R - }) : Ge === "generating" && se({ - type: "status", - time: /* @__PURE__ */ new Date(), - ...ke, - stage: ke == null ? void 0 : ke.stage, - queue: !0, - endpoint: V, - fn_index: R - }); - pe && (se({ - type: "data", - time: /* @__PURE__ */ new Date(), - data: w ? transform_output( - pe.data, - U, - a.root, - a.root_url - ) : pe.data, - endpoint: V, - fn_index: R - }), oe && (se({ - type: "status", - time: /* @__PURE__ */ new Date(), - ...oe, - stage: ke == null ? void 0 : ke.stage, - queue: !0, - endpoint: V, - fn_index: R - }), G.close())); - }; - } - }); - function se(ae) { - const Ee = te[ae.type] || []; - Ee == null || Ee.forEach((Be) => Be(ae)); - } - function le(ae, _e) { - const Ee = te, Be = Ee[ae] || []; - return Ee[ae] = Be, Be == null || Be.push(_e), { on: le, off: Ce, cancel: be, destroy: Le }; - } - function Ce(ae, _e) { - const Ee = te; - let Be = Ee[ae] || []; - return Be = Be == null ? void 0 : Be.filter((Ne) => Ne !== _e), Ee[ae] = Be, { on: le, off: Ce, cancel: be, destroy: Le }; - } - async function be() { - const ae = { - stage: "complete", - queue: !1, - time: /* @__PURE__ */ new Date() - }; - oe = ae, se({ - ...ae, - type: "status", - endpoint: V, - fn_index: R - }); - let _e = {}; - F === "ws" ? (W && W.readyState === 0 ? W.addEventListener("open", () => { - W.close(); - }) : W.close(), _e = { fn_index: R, session_hash: p }) : (G.close(), _e = { event_id: X }); - try { - await t( - `${s}//${resolve_root$1( - o, - a.path, - !0 - )}/reset`, - { - headers: { "Content-Type": "application/json" }, - method: "POST", - body: JSON.stringify(_e) - } - ); - } catch { - console.warn( - "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable." - ); - } - } - function Le() { - for (const ae in te) - te[ae].forEach((_e) => { - Ce(ae, _e); - }); - } - return { - on: le, - off: Ce, - cancel: be, - destroy: Le - }; - } - async function B(z, k, N) { - var R; - const U = { "Content-Type": "application/json" }; - c && (U.Authorization = `Bearer ${c}`); - let W, G = a.components.find( - (J) => J.id === z - ); - (R = G == null ? void 0 : G.props) != null && R.root_url ? W = G.props.root_url : W = `${s}//${resolve_root$1( - o, - a.path, - !0 - )}/`; - const F = await t( - `${W}component_server/`, - { - method: "POST", - body: JSON.stringify({ - data: N, - component_id: z, - fn_name: k, - session_hash: p - }), - headers: U - } - ); - if (!F.ok) - throw new Error( - "Could not connect to component server: " + F.statusText - ); - return await F.json(); - } - async function P(z) { - if (C) - return C; - const k = { "Content-Type": "application/json" }; - c && (k.Authorization = `Bearer ${c}`); - let N; - if (semiver$1(z.version || "2.0.0", "3.30") < 0 ? N = await t( - "https://gradio-space-api-fetcher-v2.hf.space/api", - { - method: "POST", - body: JSON.stringify({ - serialize: !1, - config: JSON.stringify(z) - }), - headers: k - } - ) : N = await t(`${z.root}/info`, { - headers: k - }), !N.ok) - throw new Error(BROKEN_CONNECTION_MSG$1); - let R = await N.json(); - return "api" in R && (R = R.api), R.named_endpoints["/predict"] && !R.unnamed_endpoints[0] && (R.unnamed_endpoints[0] = R.named_endpoints["/predict"]), transform_api_info$1(R, z, l); - } - }); + toNode() { + var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "path"); + return this.alternate ? t.setAttribute("d", this.alternate) : t.setAttribute("d", path[this.pathName]), t; + } + toMarkup() { + return this.alternate ? '' : ''; } - async function u(b, h, _, E) { - const c = await walk_and_store_blobs$1( - h, - void 0, - [], - !0, - _ - ); - return Promise.all( - c.map(async ({ path: S, blob: y, type: w }) => { - if (y) { - const L = (await n(b, [y], E)).files[0]; - return { path: S, file_url: L, type: w, name: y == null ? void 0 : y.name }; - } - return { path: S, type: w }; - }) - ).then((S) => (S.forEach(({ path: y, file_url: w, type: L, name: s }) => { - if (L === "Gallery") - update_object$1(h, w, y); - else if (w) { - const o = new FileData$1({ path: w, orig_name: s }); - update_object$1(h, o, y); - } - }), h)); +} +class LineNode { + constructor(e) { + this.attributes = void 0, this.attributes = e || {}; + } + toNode() { + var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "line"); + for (var r in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]); + return t; + } + toMarkup() { + var e = " new WebSocket(...t) -); -function transform_output(t, e, r, n) { - return t.map((f, u) => { - var b, h, _, E; - return ((h = (b = e == null ? void 0 : e.returns) == null ? void 0 : b[u]) == null ? void 0 : h.component) === "File" ? normalise_file(f, r, n) : ((E = (_ = e == null ? void 0 : e.returns) == null ? void 0 : _[u]) == null ? void 0 : E.component) === "Gallery" ? f.map((c) => Array.isArray(c) ? [normalise_file(c[0], r, n), c[1]] : [normalise_file(c, r, n), null]) : typeof f == "object" && f.path ? normalise_file(f, r, n) : f; - }); +function assertSymbolDomNode(n) { + if (n instanceof SymbolNode) + return n; + throw new Error("Expected symbolNode but got " + String(n) + "."); } -function get_type$1(t, e, r, n) { - switch (t.type) { - case "string": - return "string"; - case "boolean": - return "boolean"; - case "number": - return "number"; - } - if (r === "JSONSerializable" || r === "StringSerializable") - return "any"; - if (r === "ListStringSerializable") - return "string[]"; - if (e === "Image") - return n === "parameter" ? "Blob | File | Buffer" : "string"; - if (r === "FileSerializable") - return (t == null ? void 0 : t.type) === "array" ? n === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : n === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}"; - if (r === "GallerySerializable") - return n === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"; -} -function get_description$1(t, e) { - return e === "GallerySerializable" ? "array of [file, label] tuples" : e === "ListStringSerializable" ? "array of strings" : e === "FileSerializable" ? "array of files or single file" : t.description; -} -function transform_api_info$1(t, e, r) { - const n = { - named_endpoints: {}, - unnamed_endpoints: {} +function assertSpan(n) { + if (n instanceof Span) + return n; + throw new Error("Expected span but got " + String(n) + "."); +} +var NON_ATOMS = { + "accent-token": 1, + mathord: 1, + "op-token": 1, + spacing: 1, + textord: 1 +}, symbols = { + math: {}, + text: {} +}; +function defineSymbol(n, e, t, r, a, l) { + symbols[n][a] = { + font: e, + group: t, + replace: r + }, l && r && (symbols[n][r] = symbols[n][a]); +} +var math = "math", text$a = "text", main = "main", ams = "ams", accent = "accent-token", bin = "bin", close = "close", inner = "inner", mathord = "mathord", op = "op-token", open = "open", punct = "punct", rel = "rel", spacing = "spacing", textord = "textord"; +defineSymbol(math, main, rel, "≡", "\\equiv", !0); +defineSymbol(math, main, rel, "≺", "\\prec", !0); +defineSymbol(math, main, rel, "≻", "\\succ", !0); +defineSymbol(math, main, rel, "∼", "\\sim", !0); +defineSymbol(math, main, rel, "⊥", "\\perp"); +defineSymbol(math, main, rel, "⪯", "\\preceq", !0); +defineSymbol(math, main, rel, "⪰", "\\succeq", !0); +defineSymbol(math, main, rel, "≃", "\\simeq", !0); +defineSymbol(math, main, rel, "∣", "\\mid", !0); +defineSymbol(math, main, rel, "≪", "\\ll", !0); +defineSymbol(math, main, rel, "≫", "\\gg", !0); +defineSymbol(math, main, rel, "≍", "\\asymp", !0); +defineSymbol(math, main, rel, "∥", "\\parallel"); +defineSymbol(math, main, rel, "⋈", "\\bowtie", !0); +defineSymbol(math, main, rel, "⌣", "\\smile", !0); +defineSymbol(math, main, rel, "⊑", "\\sqsubseteq", !0); +defineSymbol(math, main, rel, "⊒", "\\sqsupseteq", !0); +defineSymbol(math, main, rel, "≐", "\\doteq", !0); +defineSymbol(math, main, rel, "⌢", "\\frown", !0); +defineSymbol(math, main, rel, "∋", "\\ni", !0); +defineSymbol(math, main, rel, "∝", "\\propto", !0); +defineSymbol(math, main, rel, "⊢", "\\vdash", !0); +defineSymbol(math, main, rel, "⊣", "\\dashv", !0); +defineSymbol(math, main, rel, "∋", "\\owns"); +defineSymbol(math, main, punct, ".", "\\ldotp"); +defineSymbol(math, main, punct, "⋅", "\\cdotp"); +defineSymbol(math, main, textord, "#", "\\#"); +defineSymbol(text$a, main, textord, "#", "\\#"); +defineSymbol(math, main, textord, "&", "\\&"); +defineSymbol(text$a, main, textord, "&", "\\&"); +defineSymbol(math, main, textord, "ℵ", "\\aleph", !0); +defineSymbol(math, main, textord, "∀", "\\forall", !0); +defineSymbol(math, main, textord, "ℏ", "\\hbar", !0); +defineSymbol(math, main, textord, "∃", "\\exists", !0); +defineSymbol(math, main, textord, "∇", "\\nabla", !0); +defineSymbol(math, main, textord, "♭", "\\flat", !0); +defineSymbol(math, main, textord, "ℓ", "\\ell", !0); +defineSymbol(math, main, textord, "♮", "\\natural", !0); +defineSymbol(math, main, textord, "♣", "\\clubsuit", !0); +defineSymbol(math, main, textord, "℘", "\\wp", !0); +defineSymbol(math, main, textord, "♯", "\\sharp", !0); +defineSymbol(math, main, textord, "♢", "\\diamondsuit", !0); +defineSymbol(math, main, textord, "ℜ", "\\Re", !0); +defineSymbol(math, main, textord, "♡", "\\heartsuit", !0); +defineSymbol(math, main, textord, "ℑ", "\\Im", !0); +defineSymbol(math, main, textord, "♠", "\\spadesuit", !0); +defineSymbol(math, main, textord, "§", "\\S", !0); +defineSymbol(text$a, main, textord, "§", "\\S"); +defineSymbol(math, main, textord, "¶", "\\P", !0); +defineSymbol(text$a, main, textord, "¶", "\\P"); +defineSymbol(math, main, textord, "†", "\\dag"); +defineSymbol(text$a, main, textord, "†", "\\dag"); +defineSymbol(text$a, main, textord, "†", "\\textdagger"); +defineSymbol(math, main, textord, "‡", "\\ddag"); +defineSymbol(text$a, main, textord, "‡", "\\ddag"); +defineSymbol(text$a, main, textord, "‡", "\\textdaggerdbl"); +defineSymbol(math, main, close, "⎱", "\\rmoustache", !0); +defineSymbol(math, main, open, "⎰", "\\lmoustache", !0); +defineSymbol(math, main, close, "⟯", "\\rgroup", !0); +defineSymbol(math, main, open, "⟮", "\\lgroup", !0); +defineSymbol(math, main, bin, "∓", "\\mp", !0); +defineSymbol(math, main, bin, "⊖", "\\ominus", !0); +defineSymbol(math, main, bin, "⊎", "\\uplus", !0); +defineSymbol(math, main, bin, "⊓", "\\sqcap", !0); +defineSymbol(math, main, bin, "∗", "\\ast"); +defineSymbol(math, main, bin, "⊔", "\\sqcup", !0); +defineSymbol(math, main, bin, "◯", "\\bigcirc", !0); +defineSymbol(math, main, bin, "∙", "\\bullet", !0); +defineSymbol(math, main, bin, "‡", "\\ddagger"); +defineSymbol(math, main, bin, "≀", "\\wr", !0); +defineSymbol(math, main, bin, "⨿", "\\amalg"); +defineSymbol(math, main, bin, "&", "\\And"); +defineSymbol(math, main, rel, "⟵", "\\longleftarrow", !0); +defineSymbol(math, main, rel, "⇐", "\\Leftarrow", !0); +defineSymbol(math, main, rel, "⟸", "\\Longleftarrow", !0); +defineSymbol(math, main, rel, "⟶", "\\longrightarrow", !0); +defineSymbol(math, main, rel, "⇒", "\\Rightarrow", !0); +defineSymbol(math, main, rel, "⟹", "\\Longrightarrow", !0); +defineSymbol(math, main, rel, "↔", "\\leftrightarrow", !0); +defineSymbol(math, main, rel, "⟷", "\\longleftrightarrow", !0); +defineSymbol(math, main, rel, "⇔", "\\Leftrightarrow", !0); +defineSymbol(math, main, rel, "⟺", "\\Longleftrightarrow", !0); +defineSymbol(math, main, rel, "↦", "\\mapsto", !0); +defineSymbol(math, main, rel, "⟼", "\\longmapsto", !0); +defineSymbol(math, main, rel, "↗", "\\nearrow", !0); +defineSymbol(math, main, rel, "↩", "\\hookleftarrow", !0); +defineSymbol(math, main, rel, "↪", "\\hookrightarrow", !0); +defineSymbol(math, main, rel, "↘", "\\searrow", !0); +defineSymbol(math, main, rel, "↼", "\\leftharpoonup", !0); +defineSymbol(math, main, rel, "⇀", "\\rightharpoonup", !0); +defineSymbol(math, main, rel, "↙", "\\swarrow", !0); +defineSymbol(math, main, rel, "↽", "\\leftharpoondown", !0); +defineSymbol(math, main, rel, "⇁", "\\rightharpoondown", !0); +defineSymbol(math, main, rel, "↖", "\\nwarrow", !0); +defineSymbol(math, main, rel, "⇌", "\\rightleftharpoons", !0); +defineSymbol(math, ams, rel, "≮", "\\nless", !0); +defineSymbol(math, ams, rel, "", "\\@nleqslant"); +defineSymbol(math, ams, rel, "", "\\@nleqq"); +defineSymbol(math, ams, rel, "⪇", "\\lneq", !0); +defineSymbol(math, ams, rel, "≨", "\\lneqq", !0); +defineSymbol(math, ams, rel, "", "\\@lvertneqq"); +defineSymbol(math, ams, rel, "⋦", "\\lnsim", !0); +defineSymbol(math, ams, rel, "⪉", "\\lnapprox", !0); +defineSymbol(math, ams, rel, "⊀", "\\nprec", !0); +defineSymbol(math, ams, rel, "⋠", "\\npreceq", !0); +defineSymbol(math, ams, rel, "⋨", "\\precnsim", !0); +defineSymbol(math, ams, rel, "⪹", "\\precnapprox", !0); +defineSymbol(math, ams, rel, "≁", "\\nsim", !0); +defineSymbol(math, ams, rel, "", "\\@nshortmid"); +defineSymbol(math, ams, rel, "∤", "\\nmid", !0); +defineSymbol(math, ams, rel, "⊬", "\\nvdash", !0); +defineSymbol(math, ams, rel, "⊭", "\\nvDash", !0); +defineSymbol(math, ams, rel, "⋪", "\\ntriangleleft"); +defineSymbol(math, ams, rel, "⋬", "\\ntrianglelefteq", !0); +defineSymbol(math, ams, rel, "⊊", "\\subsetneq", !0); +defineSymbol(math, ams, rel, "", "\\@varsubsetneq"); +defineSymbol(math, ams, rel, "⫋", "\\subsetneqq", !0); +defineSymbol(math, ams, rel, "", "\\@varsubsetneqq"); +defineSymbol(math, ams, rel, "≯", "\\ngtr", !0); +defineSymbol(math, ams, rel, "", "\\@ngeqslant"); +defineSymbol(math, ams, rel, "", "\\@ngeqq"); +defineSymbol(math, ams, rel, "⪈", "\\gneq", !0); +defineSymbol(math, ams, rel, "≩", "\\gneqq", !0); +defineSymbol(math, ams, rel, "", "\\@gvertneqq"); +defineSymbol(math, ams, rel, "⋧", "\\gnsim", !0); +defineSymbol(math, ams, rel, "⪊", "\\gnapprox", !0); +defineSymbol(math, ams, rel, "⊁", "\\nsucc", !0); +defineSymbol(math, ams, rel, "⋡", "\\nsucceq", !0); +defineSymbol(math, ams, rel, "⋩", "\\succnsim", !0); +defineSymbol(math, ams, rel, "⪺", "\\succnapprox", !0); +defineSymbol(math, ams, rel, "≆", "\\ncong", !0); +defineSymbol(math, ams, rel, "", "\\@nshortparallel"); +defineSymbol(math, ams, rel, "∦", "\\nparallel", !0); +defineSymbol(math, ams, rel, "⊯", "\\nVDash", !0); +defineSymbol(math, ams, rel, "⋫", "\\ntriangleright"); +defineSymbol(math, ams, rel, "⋭", "\\ntrianglerighteq", !0); +defineSymbol(math, ams, rel, "", "\\@nsupseteqq"); +defineSymbol(math, ams, rel, "⊋", "\\supsetneq", !0); +defineSymbol(math, ams, rel, "", "\\@varsupsetneq"); +defineSymbol(math, ams, rel, "⫌", "\\supsetneqq", !0); +defineSymbol(math, ams, rel, "", "\\@varsupsetneqq"); +defineSymbol(math, ams, rel, "⊮", "\\nVdash", !0); +defineSymbol(math, ams, rel, "⪵", "\\precneqq", !0); +defineSymbol(math, ams, rel, "⪶", "\\succneqq", !0); +defineSymbol(math, ams, rel, "", "\\@nsubseteqq"); +defineSymbol(math, ams, bin, "⊴", "\\unlhd"); +defineSymbol(math, ams, bin, "⊵", "\\unrhd"); +defineSymbol(math, ams, rel, "↚", "\\nleftarrow", !0); +defineSymbol(math, ams, rel, "↛", "\\nrightarrow", !0); +defineSymbol(math, ams, rel, "⇍", "\\nLeftarrow", !0); +defineSymbol(math, ams, rel, "⇏", "\\nRightarrow", !0); +defineSymbol(math, ams, rel, "↮", "\\nleftrightarrow", !0); +defineSymbol(math, ams, rel, "⇎", "\\nLeftrightarrow", !0); +defineSymbol(math, ams, rel, "△", "\\vartriangle"); +defineSymbol(math, ams, textord, "ℏ", "\\hslash"); +defineSymbol(math, ams, textord, "▽", "\\triangledown"); +defineSymbol(math, ams, textord, "◊", "\\lozenge"); +defineSymbol(math, ams, textord, "Ⓢ", "\\circledS"); +defineSymbol(math, ams, textord, "®", "\\circledR"); +defineSymbol(text$a, ams, textord, "®", "\\circledR"); +defineSymbol(math, ams, textord, "∡", "\\measuredangle", !0); +defineSymbol(math, ams, textord, "∄", "\\nexists"); +defineSymbol(math, ams, textord, "℧", "\\mho"); +defineSymbol(math, ams, textord, "Ⅎ", "\\Finv", !0); +defineSymbol(math, ams, textord, "⅁", "\\Game", !0); +defineSymbol(math, ams, textord, "‵", "\\backprime"); +defineSymbol(math, ams, textord, "▲", "\\blacktriangle"); +defineSymbol(math, ams, textord, "▼", "\\blacktriangledown"); +defineSymbol(math, ams, textord, "■", "\\blacksquare"); +defineSymbol(math, ams, textord, "⧫", "\\blacklozenge"); +defineSymbol(math, ams, textord, "★", "\\bigstar"); +defineSymbol(math, ams, textord, "∢", "\\sphericalangle", !0); +defineSymbol(math, ams, textord, "∁", "\\complement", !0); +defineSymbol(math, ams, textord, "ð", "\\eth", !0); +defineSymbol(text$a, main, textord, "ð", "ð"); +defineSymbol(math, ams, textord, "╱", "\\diagup"); +defineSymbol(math, ams, textord, "╲", "\\diagdown"); +defineSymbol(math, ams, textord, "□", "\\square"); +defineSymbol(math, ams, textord, "□", "\\Box"); +defineSymbol(math, ams, textord, "◊", "\\Diamond"); +defineSymbol(math, ams, textord, "¥", "\\yen", !0); +defineSymbol(text$a, ams, textord, "¥", "\\yen", !0); +defineSymbol(math, ams, textord, "✓", "\\checkmark", !0); +defineSymbol(text$a, ams, textord, "✓", "\\checkmark"); +defineSymbol(math, ams, textord, "ℶ", "\\beth", !0); +defineSymbol(math, ams, textord, "ℸ", "\\daleth", !0); +defineSymbol(math, ams, textord, "ℷ", "\\gimel", !0); +defineSymbol(math, ams, textord, "ϝ", "\\digamma", !0); +defineSymbol(math, ams, textord, "ϰ", "\\varkappa"); +defineSymbol(math, ams, open, "┌", "\\@ulcorner", !0); +defineSymbol(math, ams, close, "┐", "\\@urcorner", !0); +defineSymbol(math, ams, open, "└", "\\@llcorner", !0); +defineSymbol(math, ams, close, "┘", "\\@lrcorner", !0); +defineSymbol(math, ams, rel, "≦", "\\leqq", !0); +defineSymbol(math, ams, rel, "⩽", "\\leqslant", !0); +defineSymbol(math, ams, rel, "⪕", "\\eqslantless", !0); +defineSymbol(math, ams, rel, "≲", "\\lesssim", !0); +defineSymbol(math, ams, rel, "⪅", "\\lessapprox", !0); +defineSymbol(math, ams, rel, "≊", "\\approxeq", !0); +defineSymbol(math, ams, bin, "⋖", "\\lessdot"); +defineSymbol(math, ams, rel, "⋘", "\\lll", !0); +defineSymbol(math, ams, rel, "≶", "\\lessgtr", !0); +defineSymbol(math, ams, rel, "⋚", "\\lesseqgtr", !0); +defineSymbol(math, ams, rel, "⪋", "\\lesseqqgtr", !0); +defineSymbol(math, ams, rel, "≑", "\\doteqdot"); +defineSymbol(math, ams, rel, "≓", "\\risingdotseq", !0); +defineSymbol(math, ams, rel, "≒", "\\fallingdotseq", !0); +defineSymbol(math, ams, rel, "∽", "\\backsim", !0); +defineSymbol(math, ams, rel, "⋍", "\\backsimeq", !0); +defineSymbol(math, ams, rel, "⫅", "\\subseteqq", !0); +defineSymbol(math, ams, rel, "⋐", "\\Subset", !0); +defineSymbol(math, ams, rel, "⊏", "\\sqsubset", !0); +defineSymbol(math, ams, rel, "≼", "\\preccurlyeq", !0); +defineSymbol(math, ams, rel, "⋞", "\\curlyeqprec", !0); +defineSymbol(math, ams, rel, "≾", "\\precsim", !0); +defineSymbol(math, ams, rel, "⪷", "\\precapprox", !0); +defineSymbol(math, ams, rel, "⊲", "\\vartriangleleft"); +defineSymbol(math, ams, rel, "⊴", "\\trianglelefteq"); +defineSymbol(math, ams, rel, "⊨", "\\vDash", !0); +defineSymbol(math, ams, rel, "⊪", "\\Vvdash", !0); +defineSymbol(math, ams, rel, "⌣", "\\smallsmile"); +defineSymbol(math, ams, rel, "⌢", "\\smallfrown"); +defineSymbol(math, ams, rel, "≏", "\\bumpeq", !0); +defineSymbol(math, ams, rel, "≎", "\\Bumpeq", !0); +defineSymbol(math, ams, rel, "≧", "\\geqq", !0); +defineSymbol(math, ams, rel, "⩾", "\\geqslant", !0); +defineSymbol(math, ams, rel, "⪖", "\\eqslantgtr", !0); +defineSymbol(math, ams, rel, "≳", "\\gtrsim", !0); +defineSymbol(math, ams, rel, "⪆", "\\gtrapprox", !0); +defineSymbol(math, ams, bin, "⋗", "\\gtrdot"); +defineSymbol(math, ams, rel, "⋙", "\\ggg", !0); +defineSymbol(math, ams, rel, "≷", "\\gtrless", !0); +defineSymbol(math, ams, rel, "⋛", "\\gtreqless", !0); +defineSymbol(math, ams, rel, "⪌", "\\gtreqqless", !0); +defineSymbol(math, ams, rel, "≖", "\\eqcirc", !0); +defineSymbol(math, ams, rel, "≗", "\\circeq", !0); +defineSymbol(math, ams, rel, "≜", "\\triangleq", !0); +defineSymbol(math, ams, rel, "∼", "\\thicksim"); +defineSymbol(math, ams, rel, "≈", "\\thickapprox"); +defineSymbol(math, ams, rel, "⫆", "\\supseteqq", !0); +defineSymbol(math, ams, rel, "⋑", "\\Supset", !0); +defineSymbol(math, ams, rel, "⊐", "\\sqsupset", !0); +defineSymbol(math, ams, rel, "≽", "\\succcurlyeq", !0); +defineSymbol(math, ams, rel, "⋟", "\\curlyeqsucc", !0); +defineSymbol(math, ams, rel, "≿", "\\succsim", !0); +defineSymbol(math, ams, rel, "⪸", "\\succapprox", !0); +defineSymbol(math, ams, rel, "⊳", "\\vartriangleright"); +defineSymbol(math, ams, rel, "⊵", "\\trianglerighteq"); +defineSymbol(math, ams, rel, "⊩", "\\Vdash", !0); +defineSymbol(math, ams, rel, "∣", "\\shortmid"); +defineSymbol(math, ams, rel, "∥", "\\shortparallel"); +defineSymbol(math, ams, rel, "≬", "\\between", !0); +defineSymbol(math, ams, rel, "⋔", "\\pitchfork", !0); +defineSymbol(math, ams, rel, "∝", "\\varpropto"); +defineSymbol(math, ams, rel, "◀", "\\blacktriangleleft"); +defineSymbol(math, ams, rel, "∴", "\\therefore", !0); +defineSymbol(math, ams, rel, "∍", "\\backepsilon"); +defineSymbol(math, ams, rel, "▶", "\\blacktriangleright"); +defineSymbol(math, ams, rel, "∵", "\\because", !0); +defineSymbol(math, ams, rel, "⋘", "\\llless"); +defineSymbol(math, ams, rel, "⋙", "\\gggtr"); +defineSymbol(math, ams, bin, "⊲", "\\lhd"); +defineSymbol(math, ams, bin, "⊳", "\\rhd"); +defineSymbol(math, ams, rel, "≂", "\\eqsim", !0); +defineSymbol(math, main, rel, "⋈", "\\Join"); +defineSymbol(math, ams, rel, "≑", "\\Doteq", !0); +defineSymbol(math, ams, bin, "∔", "\\dotplus", !0); +defineSymbol(math, ams, bin, "∖", "\\smallsetminus"); +defineSymbol(math, ams, bin, "⋒", "\\Cap", !0); +defineSymbol(math, ams, bin, "⋓", "\\Cup", !0); +defineSymbol(math, ams, bin, "⩞", "\\doublebarwedge", !0); +defineSymbol(math, ams, bin, "⊟", "\\boxminus", !0); +defineSymbol(math, ams, bin, "⊞", "\\boxplus", !0); +defineSymbol(math, ams, bin, "⋇", "\\divideontimes", !0); +defineSymbol(math, ams, bin, "⋉", "\\ltimes", !0); +defineSymbol(math, ams, bin, "⋊", "\\rtimes", !0); +defineSymbol(math, ams, bin, "⋋", "\\leftthreetimes", !0); +defineSymbol(math, ams, bin, "⋌", "\\rightthreetimes", !0); +defineSymbol(math, ams, bin, "⋏", "\\curlywedge", !0); +defineSymbol(math, ams, bin, "⋎", "\\curlyvee", !0); +defineSymbol(math, ams, bin, "⊝", "\\circleddash", !0); +defineSymbol(math, ams, bin, "⊛", "\\circledast", !0); +defineSymbol(math, ams, bin, "⋅", "\\centerdot"); +defineSymbol(math, ams, bin, "⊺", "\\intercal", !0); +defineSymbol(math, ams, bin, "⋒", "\\doublecap"); +defineSymbol(math, ams, bin, "⋓", "\\doublecup"); +defineSymbol(math, ams, bin, "⊠", "\\boxtimes", !0); +defineSymbol(math, ams, rel, "⇢", "\\dashrightarrow", !0); +defineSymbol(math, ams, rel, "⇠", "\\dashleftarrow", !0); +defineSymbol(math, ams, rel, "⇇", "\\leftleftarrows", !0); +defineSymbol(math, ams, rel, "⇆", "\\leftrightarrows", !0); +defineSymbol(math, ams, rel, "⇚", "\\Lleftarrow", !0); +defineSymbol(math, ams, rel, "↞", "\\twoheadleftarrow", !0); +defineSymbol(math, ams, rel, "↢", "\\leftarrowtail", !0); +defineSymbol(math, ams, rel, "↫", "\\looparrowleft", !0); +defineSymbol(math, ams, rel, "⇋", "\\leftrightharpoons", !0); +defineSymbol(math, ams, rel, "↶", "\\curvearrowleft", !0); +defineSymbol(math, ams, rel, "↺", "\\circlearrowleft", !0); +defineSymbol(math, ams, rel, "↰", "\\Lsh", !0); +defineSymbol(math, ams, rel, "⇈", "\\upuparrows", !0); +defineSymbol(math, ams, rel, "↿", "\\upharpoonleft", !0); +defineSymbol(math, ams, rel, "⇃", "\\downharpoonleft", !0); +defineSymbol(math, main, rel, "⊶", "\\origof", !0); +defineSymbol(math, main, rel, "⊷", "\\imageof", !0); +defineSymbol(math, ams, rel, "⊸", "\\multimap", !0); +defineSymbol(math, ams, rel, "↭", "\\leftrightsquigarrow", !0); +defineSymbol(math, ams, rel, "⇉", "\\rightrightarrows", !0); +defineSymbol(math, ams, rel, "⇄", "\\rightleftarrows", !0); +defineSymbol(math, ams, rel, "↠", "\\twoheadrightarrow", !0); +defineSymbol(math, ams, rel, "↣", "\\rightarrowtail", !0); +defineSymbol(math, ams, rel, "↬", "\\looparrowright", !0); +defineSymbol(math, ams, rel, "↷", "\\curvearrowright", !0); +defineSymbol(math, ams, rel, "↻", "\\circlearrowright", !0); +defineSymbol(math, ams, rel, "↱", "\\Rsh", !0); +defineSymbol(math, ams, rel, "⇊", "\\downdownarrows", !0); +defineSymbol(math, ams, rel, "↾", "\\upharpoonright", !0); +defineSymbol(math, ams, rel, "⇂", "\\downharpoonright", !0); +defineSymbol(math, ams, rel, "⇝", "\\rightsquigarrow", !0); +defineSymbol(math, ams, rel, "⇝", "\\leadsto"); +defineSymbol(math, ams, rel, "⇛", "\\Rrightarrow", !0); +defineSymbol(math, ams, rel, "↾", "\\restriction"); +defineSymbol(math, main, textord, "‘", "`"); +defineSymbol(math, main, textord, "$", "\\$"); +defineSymbol(text$a, main, textord, "$", "\\$"); +defineSymbol(text$a, main, textord, "$", "\\textdollar"); +defineSymbol(math, main, textord, "%", "\\%"); +defineSymbol(text$a, main, textord, "%", "\\%"); +defineSymbol(math, main, textord, "_", "\\_"); +defineSymbol(text$a, main, textord, "_", "\\_"); +defineSymbol(text$a, main, textord, "_", "\\textunderscore"); +defineSymbol(math, main, textord, "∠", "\\angle", !0); +defineSymbol(math, main, textord, "∞", "\\infty", !0); +defineSymbol(math, main, textord, "′", "\\prime"); +defineSymbol(math, main, textord, "△", "\\triangle"); +defineSymbol(math, main, textord, "Γ", "\\Gamma", !0); +defineSymbol(math, main, textord, "Δ", "\\Delta", !0); +defineSymbol(math, main, textord, "Θ", "\\Theta", !0); +defineSymbol(math, main, textord, "Λ", "\\Lambda", !0); +defineSymbol(math, main, textord, "Ξ", "\\Xi", !0); +defineSymbol(math, main, textord, "Π", "\\Pi", !0); +defineSymbol(math, main, textord, "Σ", "\\Sigma", !0); +defineSymbol(math, main, textord, "Υ", "\\Upsilon", !0); +defineSymbol(math, main, textord, "Φ", "\\Phi", !0); +defineSymbol(math, main, textord, "Ψ", "\\Psi", !0); +defineSymbol(math, main, textord, "Ω", "\\Omega", !0); +defineSymbol(math, main, textord, "A", "Α"); +defineSymbol(math, main, textord, "B", "Β"); +defineSymbol(math, main, textord, "E", "Ε"); +defineSymbol(math, main, textord, "Z", "Ζ"); +defineSymbol(math, main, textord, "H", "Η"); +defineSymbol(math, main, textord, "I", "Ι"); +defineSymbol(math, main, textord, "K", "Κ"); +defineSymbol(math, main, textord, "M", "Μ"); +defineSymbol(math, main, textord, "N", "Ν"); +defineSymbol(math, main, textord, "O", "Ο"); +defineSymbol(math, main, textord, "P", "Ρ"); +defineSymbol(math, main, textord, "T", "Τ"); +defineSymbol(math, main, textord, "X", "Χ"); +defineSymbol(math, main, textord, "¬", "\\neg", !0); +defineSymbol(math, main, textord, "¬", "\\lnot"); +defineSymbol(math, main, textord, "⊤", "\\top"); +defineSymbol(math, main, textord, "⊥", "\\bot"); +defineSymbol(math, main, textord, "∅", "\\emptyset"); +defineSymbol(math, ams, textord, "∅", "\\varnothing"); +defineSymbol(math, main, mathord, "α", "\\alpha", !0); +defineSymbol(math, main, mathord, "β", "\\beta", !0); +defineSymbol(math, main, mathord, "γ", "\\gamma", !0); +defineSymbol(math, main, mathord, "δ", "\\delta", !0); +defineSymbol(math, main, mathord, "ϵ", "\\epsilon", !0); +defineSymbol(math, main, mathord, "ζ", "\\zeta", !0); +defineSymbol(math, main, mathord, "η", "\\eta", !0); +defineSymbol(math, main, mathord, "θ", "\\theta", !0); +defineSymbol(math, main, mathord, "ι", "\\iota", !0); +defineSymbol(math, main, mathord, "κ", "\\kappa", !0); +defineSymbol(math, main, mathord, "λ", "\\lambda", !0); +defineSymbol(math, main, mathord, "μ", "\\mu", !0); +defineSymbol(math, main, mathord, "ν", "\\nu", !0); +defineSymbol(math, main, mathord, "ξ", "\\xi", !0); +defineSymbol(math, main, mathord, "ο", "\\omicron", !0); +defineSymbol(math, main, mathord, "π", "\\pi", !0); +defineSymbol(math, main, mathord, "ρ", "\\rho", !0); +defineSymbol(math, main, mathord, "σ", "\\sigma", !0); +defineSymbol(math, main, mathord, "τ", "\\tau", !0); +defineSymbol(math, main, mathord, "υ", "\\upsilon", !0); +defineSymbol(math, main, mathord, "ϕ", "\\phi", !0); +defineSymbol(math, main, mathord, "χ", "\\chi", !0); +defineSymbol(math, main, mathord, "ψ", "\\psi", !0); +defineSymbol(math, main, mathord, "ω", "\\omega", !0); +defineSymbol(math, main, mathord, "ε", "\\varepsilon", !0); +defineSymbol(math, main, mathord, "ϑ", "\\vartheta", !0); +defineSymbol(math, main, mathord, "ϖ", "\\varpi", !0); +defineSymbol(math, main, mathord, "ϱ", "\\varrho", !0); +defineSymbol(math, main, mathord, "ς", "\\varsigma", !0); +defineSymbol(math, main, mathord, "φ", "\\varphi", !0); +defineSymbol(math, main, bin, "∗", "*", !0); +defineSymbol(math, main, bin, "+", "+"); +defineSymbol(math, main, bin, "−", "-", !0); +defineSymbol(math, main, bin, "⋅", "\\cdot", !0); +defineSymbol(math, main, bin, "∘", "\\circ", !0); +defineSymbol(math, main, bin, "÷", "\\div", !0); +defineSymbol(math, main, bin, "±", "\\pm", !0); +defineSymbol(math, main, bin, "×", "\\times", !0); +defineSymbol(math, main, bin, "∩", "\\cap", !0); +defineSymbol(math, main, bin, "∪", "\\cup", !0); +defineSymbol(math, main, bin, "∖", "\\setminus", !0); +defineSymbol(math, main, bin, "∧", "\\land"); +defineSymbol(math, main, bin, "∨", "\\lor"); +defineSymbol(math, main, bin, "∧", "\\wedge", !0); +defineSymbol(math, main, bin, "∨", "\\vee", !0); +defineSymbol(math, main, textord, "√", "\\surd"); +defineSymbol(math, main, open, "⟨", "\\langle", !0); +defineSymbol(math, main, open, "∣", "\\lvert"); +defineSymbol(math, main, open, "∥", "\\lVert"); +defineSymbol(math, main, close, "?", "?"); +defineSymbol(math, main, close, "!", "!"); +defineSymbol(math, main, close, "⟩", "\\rangle", !0); +defineSymbol(math, main, close, "∣", "\\rvert"); +defineSymbol(math, main, close, "∥", "\\rVert"); +defineSymbol(math, main, rel, "=", "="); +defineSymbol(math, main, rel, ":", ":"); +defineSymbol(math, main, rel, "≈", "\\approx", !0); +defineSymbol(math, main, rel, "≅", "\\cong", !0); +defineSymbol(math, main, rel, "≥", "\\ge"); +defineSymbol(math, main, rel, "≥", "\\geq", !0); +defineSymbol(math, main, rel, "←", "\\gets"); +defineSymbol(math, main, rel, ">", "\\gt", !0); +defineSymbol(math, main, rel, "∈", "\\in", !0); +defineSymbol(math, main, rel, "", "\\@not"); +defineSymbol(math, main, rel, "⊂", "\\subset", !0); +defineSymbol(math, main, rel, "⊃", "\\supset", !0); +defineSymbol(math, main, rel, "⊆", "\\subseteq", !0); +defineSymbol(math, main, rel, "⊇", "\\supseteq", !0); +defineSymbol(math, ams, rel, "⊈", "\\nsubseteq", !0); +defineSymbol(math, ams, rel, "⊉", "\\nsupseteq", !0); +defineSymbol(math, main, rel, "⊨", "\\models"); +defineSymbol(math, main, rel, "←", "\\leftarrow", !0); +defineSymbol(math, main, rel, "≤", "\\le"); +defineSymbol(math, main, rel, "≤", "\\leq", !0); +defineSymbol(math, main, rel, "<", "\\lt", !0); +defineSymbol(math, main, rel, "→", "\\rightarrow", !0); +defineSymbol(math, main, rel, "→", "\\to"); +defineSymbol(math, ams, rel, "≱", "\\ngeq", !0); +defineSymbol(math, ams, rel, "≰", "\\nleq", !0); +defineSymbol(math, main, spacing, " ", "\\ "); +defineSymbol(math, main, spacing, " ", "\\space"); +defineSymbol(math, main, spacing, " ", "\\nobreakspace"); +defineSymbol(text$a, main, spacing, " ", "\\ "); +defineSymbol(text$a, main, spacing, " ", " "); +defineSymbol(text$a, main, spacing, " ", "\\space"); +defineSymbol(text$a, main, spacing, " ", "\\nobreakspace"); +defineSymbol(math, main, spacing, null, "\\nobreak"); +defineSymbol(math, main, spacing, null, "\\allowbreak"); +defineSymbol(math, main, punct, ",", ","); +defineSymbol(math, main, punct, ";", ";"); +defineSymbol(math, ams, bin, "⊼", "\\barwedge", !0); +defineSymbol(math, ams, bin, "⊻", "\\veebar", !0); +defineSymbol(math, main, bin, "⊙", "\\odot", !0); +defineSymbol(math, main, bin, "⊕", "\\oplus", !0); +defineSymbol(math, main, bin, "⊗", "\\otimes", !0); +defineSymbol(math, main, textord, "∂", "\\partial", !0); +defineSymbol(math, main, bin, "⊘", "\\oslash", !0); +defineSymbol(math, ams, bin, "⊚", "\\circledcirc", !0); +defineSymbol(math, ams, bin, "⊡", "\\boxdot", !0); +defineSymbol(math, main, bin, "△", "\\bigtriangleup"); +defineSymbol(math, main, bin, "▽", "\\bigtriangledown"); +defineSymbol(math, main, bin, "†", "\\dagger"); +defineSymbol(math, main, bin, "⋄", "\\diamond"); +defineSymbol(math, main, bin, "⋆", "\\star"); +defineSymbol(math, main, bin, "◃", "\\triangleleft"); +defineSymbol(math, main, bin, "▹", "\\triangleright"); +defineSymbol(math, main, open, "{", "\\{"); +defineSymbol(text$a, main, textord, "{", "\\{"); +defineSymbol(text$a, main, textord, "{", "\\textbraceleft"); +defineSymbol(math, main, close, "}", "\\}"); +defineSymbol(text$a, main, textord, "}", "\\}"); +defineSymbol(text$a, main, textord, "}", "\\textbraceright"); +defineSymbol(math, main, open, "{", "\\lbrace"); +defineSymbol(math, main, close, "}", "\\rbrace"); +defineSymbol(math, main, open, "[", "\\lbrack", !0); +defineSymbol(text$a, main, textord, "[", "\\lbrack", !0); +defineSymbol(math, main, close, "]", "\\rbrack", !0); +defineSymbol(text$a, main, textord, "]", "\\rbrack", !0); +defineSymbol(math, main, open, "(", "\\lparen", !0); +defineSymbol(math, main, close, ")", "\\rparen", !0); +defineSymbol(text$a, main, textord, "<", "\\textless", !0); +defineSymbol(text$a, main, textord, ">", "\\textgreater", !0); +defineSymbol(math, main, open, "⌊", "\\lfloor", !0); +defineSymbol(math, main, close, "⌋", "\\rfloor", !0); +defineSymbol(math, main, open, "⌈", "\\lceil", !0); +defineSymbol(math, main, close, "⌉", "\\rceil", !0); +defineSymbol(math, main, textord, "\\", "\\backslash"); +defineSymbol(math, main, textord, "∣", "|"); +defineSymbol(math, main, textord, "∣", "\\vert"); +defineSymbol(text$a, main, textord, "|", "\\textbar", !0); +defineSymbol(math, main, textord, "∥", "\\|"); +defineSymbol(math, main, textord, "∥", "\\Vert"); +defineSymbol(text$a, main, textord, "∥", "\\textbardbl"); +defineSymbol(text$a, main, textord, "~", "\\textasciitilde"); +defineSymbol(text$a, main, textord, "\\", "\\textbackslash"); +defineSymbol(text$a, main, textord, "^", "\\textasciicircum"); +defineSymbol(math, main, rel, "↑", "\\uparrow", !0); +defineSymbol(math, main, rel, "⇑", "\\Uparrow", !0); +defineSymbol(math, main, rel, "↓", "\\downarrow", !0); +defineSymbol(math, main, rel, "⇓", "\\Downarrow", !0); +defineSymbol(math, main, rel, "↕", "\\updownarrow", !0); +defineSymbol(math, main, rel, "⇕", "\\Updownarrow", !0); +defineSymbol(math, main, op, "∐", "\\coprod"); +defineSymbol(math, main, op, "⋁", "\\bigvee"); +defineSymbol(math, main, op, "⋀", "\\bigwedge"); +defineSymbol(math, main, op, "⨄", "\\biguplus"); +defineSymbol(math, main, op, "⋂", "\\bigcap"); +defineSymbol(math, main, op, "⋃", "\\bigcup"); +defineSymbol(math, main, op, "∫", "\\int"); +defineSymbol(math, main, op, "∫", "\\intop"); +defineSymbol(math, main, op, "∬", "\\iint"); +defineSymbol(math, main, op, "∭", "\\iiint"); +defineSymbol(math, main, op, "∏", "\\prod"); +defineSymbol(math, main, op, "∑", "\\sum"); +defineSymbol(math, main, op, "⨂", "\\bigotimes"); +defineSymbol(math, main, op, "⨁", "\\bigoplus"); +defineSymbol(math, main, op, "⨀", "\\bigodot"); +defineSymbol(math, main, op, "∮", "\\oint"); +defineSymbol(math, main, op, "∯", "\\oiint"); +defineSymbol(math, main, op, "∰", "\\oiiint"); +defineSymbol(math, main, op, "⨆", "\\bigsqcup"); +defineSymbol(math, main, op, "∫", "\\smallint"); +defineSymbol(text$a, main, inner, "…", "\\textellipsis"); +defineSymbol(math, main, inner, "…", "\\mathellipsis"); +defineSymbol(text$a, main, inner, "…", "\\ldots", !0); +defineSymbol(math, main, inner, "…", "\\ldots", !0); +defineSymbol(math, main, inner, "⋯", "\\@cdots", !0); +defineSymbol(math, main, inner, "⋱", "\\ddots", !0); +defineSymbol(math, main, textord, "⋮", "\\varvdots"); +defineSymbol(math, main, accent, "ˊ", "\\acute"); +defineSymbol(math, main, accent, "ˋ", "\\grave"); +defineSymbol(math, main, accent, "¨", "\\ddot"); +defineSymbol(math, main, accent, "~", "\\tilde"); +defineSymbol(math, main, accent, "ˉ", "\\bar"); +defineSymbol(math, main, accent, "˘", "\\breve"); +defineSymbol(math, main, accent, "ˇ", "\\check"); +defineSymbol(math, main, accent, "^", "\\hat"); +defineSymbol(math, main, accent, "⃗", "\\vec"); +defineSymbol(math, main, accent, "˙", "\\dot"); +defineSymbol(math, main, accent, "˚", "\\mathring"); +defineSymbol(math, main, mathord, "", "\\@imath"); +defineSymbol(math, main, mathord, "", "\\@jmath"); +defineSymbol(math, main, textord, "ı", "ı"); +defineSymbol(math, main, textord, "ȷ", "ȷ"); +defineSymbol(text$a, main, textord, "ı", "\\i", !0); +defineSymbol(text$a, main, textord, "ȷ", "\\j", !0); +defineSymbol(text$a, main, textord, "ß", "\\ss", !0); +defineSymbol(text$a, main, textord, "æ", "\\ae", !0); +defineSymbol(text$a, main, textord, "œ", "\\oe", !0); +defineSymbol(text$a, main, textord, "ø", "\\o", !0); +defineSymbol(text$a, main, textord, "Æ", "\\AE", !0); +defineSymbol(text$a, main, textord, "Œ", "\\OE", !0); +defineSymbol(text$a, main, textord, "Ø", "\\O", !0); +defineSymbol(text$a, main, accent, "ˊ", "\\'"); +defineSymbol(text$a, main, accent, "ˋ", "\\`"); +defineSymbol(text$a, main, accent, "ˆ", "\\^"); +defineSymbol(text$a, main, accent, "˜", "\\~"); +defineSymbol(text$a, main, accent, "ˉ", "\\="); +defineSymbol(text$a, main, accent, "˘", "\\u"); +defineSymbol(text$a, main, accent, "˙", "\\."); +defineSymbol(text$a, main, accent, "¸", "\\c"); +defineSymbol(text$a, main, accent, "˚", "\\r"); +defineSymbol(text$a, main, accent, "ˇ", "\\v"); +defineSymbol(text$a, main, accent, "¨", '\\"'); +defineSymbol(text$a, main, accent, "˝", "\\H"); +defineSymbol(text$a, main, accent, "◯", "\\textcircled"); +var ligatures = { + "--": !0, + "---": !0, + "``": !0, + "''": !0 +}; +defineSymbol(text$a, main, textord, "–", "--", !0); +defineSymbol(text$a, main, textord, "–", "\\textendash"); +defineSymbol(text$a, main, textord, "—", "---", !0); +defineSymbol(text$a, main, textord, "—", "\\textemdash"); +defineSymbol(text$a, main, textord, "‘", "`", !0); +defineSymbol(text$a, main, textord, "‘", "\\textquoteleft"); +defineSymbol(text$a, main, textord, "’", "'", !0); +defineSymbol(text$a, main, textord, "’", "\\textquoteright"); +defineSymbol(text$a, main, textord, "“", "``", !0); +defineSymbol(text$a, main, textord, "“", "\\textquotedblleft"); +defineSymbol(text$a, main, textord, "”", "''", !0); +defineSymbol(text$a, main, textord, "”", "\\textquotedblright"); +defineSymbol(math, main, textord, "°", "\\degree", !0); +defineSymbol(text$a, main, textord, "°", "\\degree"); +defineSymbol(text$a, main, textord, "°", "\\textdegree", !0); +defineSymbol(math, main, textord, "£", "\\pounds"); +defineSymbol(math, main, textord, "£", "\\mathsterling", !0); +defineSymbol(text$a, main, textord, "£", "\\pounds"); +defineSymbol(text$a, main, textord, "£", "\\textsterling", !0); +defineSymbol(math, ams, textord, "✠", "\\maltese"); +defineSymbol(text$a, ams, textord, "✠", "\\maltese"); +var mathTextSymbols = '0123456789/@."'; +for (var i = 0; i < mathTextSymbols.length; i++) { + var ch = mathTextSymbols.charAt(i); + defineSymbol(math, main, textord, ch, ch); +} +var textSymbols = '0123456789!@*()-=+";:?/.,'; +for (var _i = 0; _i < textSymbols.length; _i++) { + var _ch = textSymbols.charAt(_i); + defineSymbol(text$a, main, textord, _ch, _ch); +} +var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +for (var _i2 = 0; _i2 < letters.length; _i2++) { + var _ch2 = letters.charAt(_i2); + defineSymbol(math, main, mathord, _ch2, _ch2), defineSymbol(text$a, main, textord, _ch2, _ch2); +} +defineSymbol(math, ams, textord, "C", "ℂ"); +defineSymbol(text$a, ams, textord, "C", "ℂ"); +defineSymbol(math, ams, textord, "H", "ℍ"); +defineSymbol(text$a, ams, textord, "H", "ℍ"); +defineSymbol(math, ams, textord, "N", "ℕ"); +defineSymbol(text$a, ams, textord, "N", "ℕ"); +defineSymbol(math, ams, textord, "P", "ℙ"); +defineSymbol(text$a, ams, textord, "P", "ℙ"); +defineSymbol(math, ams, textord, "Q", "ℚ"); +defineSymbol(text$a, ams, textord, "Q", "ℚ"); +defineSymbol(math, ams, textord, "R", "ℝ"); +defineSymbol(text$a, ams, textord, "R", "ℝ"); +defineSymbol(math, ams, textord, "Z", "ℤ"); +defineSymbol(text$a, ams, textord, "Z", "ℤ"); +defineSymbol(math, main, mathord, "h", "ℎ"); +defineSymbol(text$a, main, mathord, "h", "ℎ"); +var wideChar = ""; +for (var _i3 = 0; _i3 < letters.length; _i3++) { + var _ch3 = letters.charAt(_i3); + wideChar = String.fromCharCode(55349, 56320 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56372 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56424 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56580 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56684 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56736 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56788 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56840 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56944 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), _i3 < 26 && (wideChar = String.fromCharCode(55349, 56632 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar), wideChar = String.fromCharCode(55349, 56476 + _i3), defineSymbol(math, main, mathord, _ch3, wideChar), defineSymbol(text$a, main, textord, _ch3, wideChar)); +} +wideChar = "𝕜"; +defineSymbol(math, main, mathord, "k", wideChar); +defineSymbol(text$a, main, textord, "k", wideChar); +for (var _i4 = 0; _i4 < 10; _i4++) { + var _ch4 = _i4.toString(); + wideChar = String.fromCharCode(55349, 57294 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57314 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57324 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar), wideChar = String.fromCharCode(55349, 57334 + _i4), defineSymbol(math, main, mathord, _ch4, wideChar), defineSymbol(text$a, main, textord, _ch4, wideChar); +} +var extraLatin = "ÐÞþ"; +for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { + var _ch5 = extraLatin.charAt(_i5); + defineSymbol(math, main, mathord, _ch5, _ch5), defineSymbol(text$a, main, textord, _ch5, _ch5); +} +var wideLatinLetterData = [ + ["mathbf", "textbf", "Main-Bold"], + // A-Z bold upright + ["mathbf", "textbf", "Main-Bold"], + // a-z bold upright + ["mathnormal", "textit", "Math-Italic"], + // A-Z italic + ["mathnormal", "textit", "Math-Italic"], + // a-z italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // A-Z bold italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // a-z bold italic + // Map fancy A-Z letters to script, not calligraphic. + // This aligns with unicode-math and math fonts (except Cambria Math). + ["mathscr", "textscr", "Script-Regular"], + // A-Z script + ["", "", ""], + // a-z script. No font + ["", "", ""], + // A-Z bold script. No font + ["", "", ""], + // a-z bold script. No font + ["mathfrak", "textfrak", "Fraktur-Regular"], + // A-Z Fraktur + ["mathfrak", "textfrak", "Fraktur-Regular"], + // a-z Fraktur + ["mathbb", "textbb", "AMS-Regular"], + // A-Z double-struck + ["mathbb", "textbb", "AMS-Regular"], + // k double-struck + // Note that we are using a bold font, but font metrics for regular Fraktur. + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // A-Z bold Fraktur + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // a-z bold Fraktur + ["mathsf", "textsf", "SansSerif-Regular"], + // A-Z sans-serif + ["mathsf", "textsf", "SansSerif-Regular"], + // a-z sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // A-Z bold sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // a-z bold sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // A-Z italic sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // a-z italic sans-serif + ["", "", ""], + // A-Z bold italic sans. No font + ["", "", ""], + // a-z bold italic sans. No font + ["mathtt", "texttt", "Typewriter-Regular"], + // A-Z monospace + ["mathtt", "texttt", "Typewriter-Regular"] + // a-z monospace +], wideNumeralData = [ + ["mathbf", "textbf", "Main-Bold"], + // 0-9 bold + ["", "", ""], + // 0-9 double-struck. No KaTeX font. + ["mathsf", "textsf", "SansSerif-Regular"], + // 0-9 sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // 0-9 bold sans-serif + ["mathtt", "texttt", "Typewriter-Regular"] + // 0-9 monospace +], wideCharacterFont = function(e, t) { + var r = e.charCodeAt(0), a = e.charCodeAt(1), l = (r - 55296) * 1024 + (a - 56320) + 65536, d = t === "math" ? 0 : 1; + if (119808 <= l && l < 120484) { + var o = Math.floor((l - 119808) / 26); + return [wideLatinLetterData[o][2], wideLatinLetterData[o][d]]; + } else if (120782 <= l && l <= 120831) { + var u = Math.floor((l - 120782) / 10); + return [wideNumeralData[u][2], wideNumeralData[u][d]]; + } else { + if (l === 120485 || l === 120486) + return [wideLatinLetterData[0][2], wideLatinLetterData[0][d]]; + if (120486 < l && l < 120782) + return ["", ""]; + throw new ParseError("Unsupported character: " + e); + } +}, lookupSymbol = function(e, t, r) { + return symbols[r][e] && symbols[r][e].replace && (e = symbols[r][e].replace), { + value: e, + metrics: getCharacterMetrics(e, t, r) }; - for (const f in t) { - const u = t[f]; - for (const b in u) { - const h = e.dependencies[b] ? b : r[b.replace("/", "")], _ = u[b]; - n[f][b] = {}, n[f][b].parameters = {}, n[f][b].returns = {}, n[f][b].type = e.dependencies[h].types, n[f][b].parameters = _.parameters.map( - ({ label: E, component: c, type: S, serializer: y }) => ({ - label: E, - component: c, - type: get_type$1(S, c, y, "parameter"), - description: get_description$1(S, y) - }) - ), n[f][b].returns = _.returns.map( - ({ label: E, component: c, type: S, serializer: y }) => ({ - label: E, - component: c, - type: get_type$1(S, c, y, "return"), - description: get_description$1(S, y) - }) - ); +}, makeSymbol = function(e, t, r, a, l) { + var d = lookupSymbol(e, t, r), o = d.metrics; + e = d.value; + var u; + if (o) { + var p = o.italic; + (r === "text" || a && a.font === "mathit") && (p = 0), u = new SymbolNode(e, o.height, o.depth, p, o.skew, o.width, l); + } else + typeof console < "u" && console.warn("No character metrics " + ("for '" + e + "' in style '" + t + "' and mode '" + r + "'")), u = new SymbolNode(e, 0, 0, 0, 0, 0, l); + if (a) { + u.maxFontSize = a.sizeMultiplier, a.style.isTight() && u.classes.push("mtight"); + var m = a.getColor(); + m && (u.style.color = m); + } + return u; +}, mathsym = function(e, t, r, a) { + return a === void 0 && (a = []), r.font === "boldsymbol" && lookupSymbol(e, "Main-Bold", t).metrics ? makeSymbol(e, "Main-Bold", t, r, a.concat(["mathbf"])) : e === "\\" || symbols[t][e].font === "main" ? makeSymbol(e, "Main-Regular", t, r, a) : makeSymbol(e, "AMS-Regular", t, r, a.concat(["amsrm"])); +}, boldsymbol = function(e, t, r, a, l) { + return l !== "textord" && lookupSymbol(e, "Math-BoldItalic", t).metrics ? { + fontName: "Math-BoldItalic", + fontClass: "boldsymbol" + } : { + fontName: "Main-Bold", + fontClass: "mathbf" + }; +}, makeOrd = function(e, t, r) { + var a = e.mode, l = e.text, d = ["mord"], o = a === "math" || a === "text" && t.font, u = o ? t.font : t.fontFamily, p = "", m = ""; + if (l.charCodeAt(0) === 55349 && ([p, m] = wideCharacterFont(l, a)), p.length > 0) + return makeSymbol(l, p, a, t, d.concat(m)); + if (u) { + var y, w; + if (u === "boldsymbol") { + var b = boldsymbol(l, a, t, d, r); + y = b.fontName, w = [b.fontClass]; + } else o ? (y = fontMap[u].fontName, w = [u]) : (y = retrieveTextFontName(u, t.fontWeight, t.fontShape), w = [u, t.fontWeight, t.fontShape]); + if (lookupSymbol(l, y, a).metrics) + return makeSymbol(l, y, a, t, d.concat(w)); + if (ligatures.hasOwnProperty(l) && y.slice(0, 10) === "Typewriter") { + for (var A = [], f = 0; f < l.length; f++) + A.push(makeSymbol(l[f], y, a, t, d.concat(w))); + return makeFragment(A); + } + } + if (r === "mathord") + return makeSymbol(l, "Math-Italic", a, t, d.concat(["mathnormal"])); + if (r === "textord") { + var s = symbols[a][l] && symbols[a][l].font; + if (s === "ams") { + var h = retrieveTextFontName("amsrm", t.fontWeight, t.fontShape); + return makeSymbol(l, h, a, t, d.concat("amsrm", t.fontWeight, t.fontShape)); + } else if (s === "main" || !s) { + var _ = retrieveTextFontName("textrm", t.fontWeight, t.fontShape); + return makeSymbol(l, _, a, t, d.concat(t.fontWeight, t.fontShape)); + } else { + var g = retrieveTextFontName(s, t.fontWeight, t.fontShape); + return makeSymbol(l, g, a, t, d.concat(g, t.fontWeight, t.fontShape)); } + } else + throw new Error("unexpected type: " + r + " in makeOrd"); +}, canCombine = (n, e) => { + if (createClass(n.classes) !== createClass(e.classes) || n.skew !== e.skew || n.maxFontSize !== e.maxFontSize) + return !1; + if (n.classes.length === 1) { + var t = n.classes[0]; + if (t === "mbin" || t === "mord") + return !1; + } + for (var r in n.style) + if (n.style.hasOwnProperty(r) && n.style[r] !== e.style[r]) + return !1; + for (var a in e.style) + if (e.style.hasOwnProperty(a) && n.style[a] !== e.style[a]) + return !1; + return !0; +}, tryCombineChars = (n) => { + for (var e = 0; e < n.length - 1; e++) { + var t = n[e], r = n[e + 1]; + t instanceof SymbolNode && r instanceof SymbolNode && canCombine(t, r) && (t.text += r.text, t.height = Math.max(t.height, r.height), t.depth = Math.max(t.depth, r.depth), t.italic = r.italic, n.splice(e + 1, 1), e--); } return n; -} -async function get_jwt$1(t, e) { - try { - return (await (await fetch(`https://huggingface.co/api/spaces/${t}/jwt`, { - headers: { - Authorization: `Bearer ${e}` - } - })).json()).token || !1; - } catch (r) { - return console.error(r), !1; - } -} -function update_object$1(t, e, r) { - for (; r.length > 1; ) - t = t[r.shift()]; - t[r.shift()] = e; -} -async function walk_and_store_blobs$1(t, e = void 0, r = [], n = !1, f = void 0) { - if (Array.isArray(t)) { - let u = []; - return await Promise.all( - t.map(async (b, h) => { - var _; - let E = r.slice(); - E.push(h); - const c = await walk_and_store_blobs$1( - t[h], - n ? ((_ = f == null ? void 0 : f.parameters[h]) == null ? void 0 : _.component) || void 0 : e, - E, - !1, - f - ); - u = u.concat(c); - }) - ), u; - } else { - if (globalThis.Buffer && t instanceof globalThis.Buffer) - return [ - { - path: r, - blob: e === "Image" ? !1 : new NodeBlob$1([t]), - type: e - } - ]; - if (typeof t == "object") { - let u = []; - for (let b in t) - if (t.hasOwnProperty(b)) { - let h = r.slice(); - h.push(b), u = u.concat( - await walk_and_store_blobs$1( - t[b], - void 0, - h, - !1, - f - ) - ); - } - return u; +}, sizeElementFromChildren = function(e) { + for (var t = 0, r = 0, a = 0, l = 0; l < e.children.length; l++) { + var d = e.children[l]; + d.height > t && (t = d.height), d.depth > r && (r = d.depth), d.maxFontSize > a && (a = d.maxFontSize); + } + e.height = t, e.depth = r, e.maxFontSize = a; +}, makeSpan$2 = function(e, t, r, a) { + var l = new Span(e, t, r, a); + return sizeElementFromChildren(l), l; +}, makeSvgSpan = (n, e, t, r) => new Span(n, e, t, r), makeLineSpan = function(e, t, r) { + var a = makeSpan$2([e], [], t); + return a.height = Math.max(r || t.fontMetrics().defaultRuleThickness, t.minRuleThickness), a.style.borderBottomWidth = makeEm(a.height), a.maxFontSize = 1, a; +}, makeAnchor = function(e, t, r, a) { + var l = new Anchor(e, t, r, a); + return sizeElementFromChildren(l), l; +}, makeFragment = function(e) { + var t = new DocumentFragment(e); + return sizeElementFromChildren(t), t; +}, wrapFragment = function(e, t) { + return e instanceof DocumentFragment ? makeSpan$2([], [e], t) : e; +}, getVListChildrenAndDepth = function(e) { + if (e.positionType === "individualShift") { + for (var t = e.children, r = [t[0]], a = -t[0].shift - t[0].elem.depth, l = a, d = 1; d < t.length; d++) { + var o = -t[d].shift - l - t[d].elem.depth, u = o - (t[d - 1].elem.height + t[d - 1].elem.depth); + l = l + o, r.push({ + type: "kern", + size: u + }), r.push(t[d]); } + return { + children: r, + depth: a + }; } - return []; -} -function skip_queue$1(t, e) { - var r, n, f, u; - return !(((n = (r = e == null ? void 0 : e.dependencies) == null ? void 0 : r[t]) == null ? void 0 : n.queue) === null ? e.enable_queue : (u = (f = e == null ? void 0 : e.dependencies) == null ? void 0 : f[t]) != null && u.queue) || !1; -} -async function resolve_config$1(t, e, r) { - const n = {}; - if (r && (n.Authorization = `Bearer ${r}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) { - const f = window.gradio_config.root, u = window.gradio_config; - return u.root = resolve_root$1(e, u.root, !1), { ...u, path: f }; - } else if (e) { - let f = await t(`${e}/config`, { - headers: n - }); - if (f.status === 200) { - const u = await f.json(); - return u.path = u.path ?? "", u.root = e, u; + var p; + if (e.positionType === "top") { + for (var m = e.positionData, y = 0; y < e.children.length; y++) { + var w = e.children[y]; + m -= w.type === "kern" ? w.size : w.elem.height + w.elem.depth; } - throw new Error("Could not get config."); + p = m; + } else if (e.positionType === "bottom") + p = -e.positionData; + else { + var b = e.children[0]; + if (b.type !== "elem") + throw new Error('First child must have type "elem".'); + if (e.positionType === "shift") + p = -b.elem.depth - e.positionData; + else if (e.positionType === "firstBaseline") + p = -b.elem.depth; + else + throw new Error("Invalid positionType " + e.positionType + "."); } - throw new Error("No config or app endpoint found"); -} -async function check_space_status$1(t, e, r) { - let n = e === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${t}` : `https://huggingface.co/api/spaces/${t}`, f, u; - try { - if (f = await fetch(n), u = f.status, u !== 200) - throw new Error(); - f = await f.json(); - } catch { - r({ - status: "error", - load_status: "error", - message: "Could not get space status", - detail: "NOT_FOUND" - }); - return; + return { + children: e.children, + depth: p + }; +}, makeVList = function(e, t) { + for (var { + children: r, + depth: a + } = getVListChildrenAndDepth(e), l = 0, d = 0; d < r.length; d++) { + var o = r[d]; + if (o.type === "elem") { + var u = o.elem; + l = Math.max(l, u.maxFontSize, u.height); + } } - if (!f || u !== 200) - return; - const { - runtime: { stage: b }, - id: h - } = f; - switch (b) { - case "STOPPED": - case "SLEEPING": - r({ - status: "sleeping", - load_status: "pending", - message: "Space is asleep. Waking it up...", - detail: b - }), setTimeout(() => { - check_space_status$1(t, e, r); - }, 1e3); + l += 2; + var p = makeSpan$2(["pstrut"], []); + p.style.height = makeEm(l); + for (var m = [], y = a, w = a, b = a, A = 0; A < r.length; A++) { + var f = r[A]; + if (f.type === "kern") + b += f.size; + else { + var s = f.elem, h = f.wrapperClasses || [], _ = f.wrapperStyle || {}, g = makeSpan$2(h, [p, s], void 0, _); + g.style.top = makeEm(-l - b - s.depth), f.marginLeft && (g.style.marginLeft = f.marginLeft), f.marginRight && (g.style.marginRight = f.marginRight), m.push(g), b += s.height + s.depth; + } + y = Math.min(y, b), w = Math.max(w, b); + } + var x = makeSpan$2(["vlist"], m); + x.style.height = makeEm(w); + var c; + if (y < 0) { + var v = makeSpan$2([], []), M = makeSpan$2(["vlist"], [v]); + M.style.height = makeEm(-y); + var E = makeSpan$2(["vlist-s"], [new SymbolNode("​")]); + c = [makeSpan$2(["vlist-r"], [x, E]), makeSpan$2(["vlist-r"], [M])]; + } else + c = [makeSpan$2(["vlist-r"], [x])]; + var $ = makeSpan$2(["vlist-t"], c); + return c.length === 2 && $.classes.push("vlist-t2"), $.height = w, $.depth = -y, $; +}, makeGlue = (n, e) => { + var t = makeSpan$2(["mspace"], [], e), r = calculateSize(n, e); + return t.style.marginRight = makeEm(r), t; +}, retrieveTextFontName = function(e, t, r) { + var a = ""; + switch (e) { + case "amsrm": + a = "AMS"; break; - case "PAUSED": - r({ - status: "paused", - load_status: "error", - message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.", - detail: b, - discussions_enabled: await discussions_enabled$1(h) - }); + case "textrm": + a = "Main"; break; - case "RUNNING": - case "RUNNING_BUILDING": - r({ - status: "running", - load_status: "complete", - message: "", - detail: b - }); + case "textsf": + a = "SansSerif"; break; - case "BUILDING": - r({ - status: "building", - load_status: "pending", - message: "Space is building...", - detail: b - }), setTimeout(() => { - check_space_status$1(t, e, r); - }, 1e3); + case "texttt": + a = "Typewriter"; break; default: - r({ - status: "space_error", - load_status: "error", - message: "This space is experiencing an issue.", - detail: b, - discussions_enabled: await discussions_enabled$1(h) - }); - break; - } -} -function handle_message$1(t, e) { - switch (t.msg) { - case "send_data": - return { type: "data" }; - case "send_hash": - return { type: "hash" }; - case "queue_full": - return { - type: "update", - status: { - queue: !0, - message: QUEUE_FULL_MSG$1, - stage: "error", - code: t.code, - success: t.success - } - }; - case "estimation": - return { - type: "update", - status: { - queue: !0, - stage: e || "pending", - code: t.code, - size: t.queue_size, - position: t.rank, - eta: t.rank_eta, - success: t.success - } - }; - case "progress": - return { - type: "update", - status: { - queue: !0, - stage: "pending", - code: t.code, - progress_data: t.progress_data, - success: t.success - } - }; - case "log": - return { type: "log", data: t }; - case "process_generating": - return { - type: "generating", - status: { - queue: !0, - message: t.success ? null : t.output.error, - stage: t.success ? "generating" : "error", - code: t.code, - progress_data: t.progress_data, - eta: t.average_duration - }, - data: t.success ? t.output : null - }; - case "process_completed": - return "error" in t.output ? { - type: "update", - status: { - queue: !0, - message: t.output.error, - stage: "error", - code: t.code, - success: t.success - } - } : { - type: "complete", - status: { - queue: !0, - message: t.success ? void 0 : t.output.error, - stage: t.success ? "complete" : "error", - code: t.code, - progress_data: t.progress_data, - eta: t.output.average_duration - }, - data: t.success ? t.output : null - }; - case "process_starts": - return { - type: "update", - status: { - queue: !0, - stage: "pending", - code: t.code, - size: t.rank, - position: 0, - success: t.success - } - }; - } - return { type: "none", status: { stage: "error", queue: !0 } }; -} -function noop$5() { -} -function run(t) { - return t(); -} -function run_all$2(t) { - t.forEach(run); -} -function is_function(t) { - return typeof t == "function"; -} -function safe_not_equal$9(t, e) { - return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function"; -} -function subscribe(t, ...e) { - if (t == null) { - for (const n of e) - n(void 0); - return noop$5; + a = e; } - const r = t.subscribe(...e); - return r.unsubscribe ? () => r.unsubscribe() : r; -} -const is_client = typeof window < "u"; -let now = is_client ? () => window.performance.now() : () => Date.now(), raf = is_client ? (t) => requestAnimationFrame(t) : noop$5; -const tasks = /* @__PURE__ */ new Set(); -function run_tasks(t) { - tasks.forEach((e) => { - e.c(t) || (tasks.delete(e), e.f()); - }), tasks.size !== 0 && raf(run_tasks); -} -function loop(t) { - let e; - return tasks.size === 0 && raf(run_tasks), { - promise: new Promise((r) => { - tasks.add(e = { c: t, f: r }); - }), - abort() { - tasks.delete(e); - } - }; -} -const subscriber_queue = []; -function readable(t, e) { - return { - subscribe: writable(t, e).subscribe - }; -} -function writable(t, e = noop$5) { - let r; - const n = /* @__PURE__ */ new Set(); - function f(h) { - if (safe_not_equal$9(t, h) && (t = h, r)) { - const _ = !subscriber_queue.length; - for (const E of n) - E[1](), subscriber_queue.push(E, t); - if (_) { - for (let E = 0; E < subscriber_queue.length; E += 2) - subscriber_queue[E][0](subscriber_queue[E + 1]); - subscriber_queue.length = 0; - } - } + var l; + return t === "textbf" && r === "textit" ? l = "BoldItalic" : t === "textbf" ? l = "Bold" : t === "textit" ? l = "Italic" : l = "Regular", a + "-" + l; +}, fontMap = { + // styles + mathbf: { + variant: "bold", + fontName: "Main-Bold" + }, + mathrm: { + variant: "normal", + fontName: "Main-Regular" + }, + textit: { + variant: "italic", + fontName: "Main-Italic" + }, + mathit: { + variant: "italic", + fontName: "Main-Italic" + }, + mathnormal: { + variant: "italic", + fontName: "Math-Italic" + }, + // "boldsymbol" is missing because they require the use of multiple fonts: + // Math-BoldItalic and Main-Bold. This is handled by a special case in + // makeOrd which ends up calling boldsymbol. + // families + mathbb: { + variant: "double-struck", + fontName: "AMS-Regular" + }, + mathcal: { + variant: "script", + fontName: "Caligraphic-Regular" + }, + mathfrak: { + variant: "fraktur", + fontName: "Fraktur-Regular" + }, + mathscr: { + variant: "script", + fontName: "Script-Regular" + }, + mathsf: { + variant: "sans-serif", + fontName: "SansSerif-Regular" + }, + mathtt: { + variant: "monospace", + fontName: "Typewriter-Regular" } - function u(h) { - f(h(t)); +}, svgData = { + // path, width, height + vec: ["vec", 0.471, 0.714], + // values from the font glyph + oiintSize1: ["oiintSize1", 0.957, 0.499], + // oval to overlay the integrand + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659] +}, staticSvg = function(e, t) { + var [r, a, l] = svgData[e], d = new PathNode(r), o = new SvgNode([d], { + width: makeEm(a), + height: makeEm(l), + // Override CSS rule `.katex svg { width: 100% }` + style: "width:" + makeEm(a), + viewBox: "0 0 " + 1e3 * a + " " + 1e3 * l, + preserveAspectRatio: "xMinYMin" + }), u = makeSvgSpan(["overlay"], [o], t); + return u.height = l, u.style.height = makeEm(l), u.style.width = makeEm(a), u; +}, buildCommon = { + fontMap, + makeSymbol, + mathsym, + makeSpan: makeSpan$2, + makeSvgSpan, + makeLineSpan, + makeAnchor, + makeFragment, + wrapFragment, + makeVList, + makeOrd, + makeGlue, + staticSvg, + svgData, + tryCombineChars +}, thinspace = { + number: 3, + unit: "mu" +}, mediumspace = { + number: 4, + unit: "mu" +}, thickspace = { + number: 5, + unit: "mu" +}, spacings = { + mord: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + minner: thinspace + }, + mbin: { + mord: mediumspace, + mop: mediumspace, + mopen: mediumspace, + minner: mediumspace + }, + mrel: { + mord: thickspace, + mop: thickspace, + mopen: thickspace, + minner: thickspace + }, + mopen: {}, + mclose: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mpunct: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + mopen: thinspace, + mclose: thinspace, + mpunct: thinspace, + minner: thinspace + }, + minner: { + mord: thinspace, + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + mopen: thinspace, + mpunct: thinspace, + minner: thinspace } - function b(h, _ = noop$5) { - const E = [h, _]; - return n.add(E), n.size === 1 && (r = e(f, u) || noop$5), h(t), () => { - n.delete(E), n.size === 0 && r && (r(), r = null); - }; +}, tightSpacings = { + mord: { + mop: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace + }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { + mop: thinspace + }, + mpunct: {}, + minner: { + mop: thinspace } - return { set: f, update: u, subscribe: b }; -} -function derived(t, e, r) { - const n = !Array.isArray(t), f = n ? [t] : t; - if (!f.every(Boolean)) - throw new Error("derived() expects stores as input, got a falsy value"); - const u = e.length < 2; - return readable(r, (b, h) => { - let _ = !1; - const E = []; - let c = 0, S = noop$5; - const y = () => { - if (c) - return; - S(); - const L = e(n ? E[0] : E, b, h); - u ? b(L) : S = is_function(L) ? L : noop$5; - }, w = f.map( - (L, s) => subscribe( - L, - (o) => { - E[s] = o, c &= ~(1 << s), _ && y(); - }, - () => { - c |= 1 << s; - } - ) - ); - return _ = !0, y(), function() { - run_all$2(w), S(), _ = !1; - }; +}, _functions = {}, _htmlGroupBuilders = {}, _mathmlGroupBuilders = {}; +function defineFunction(n) { + for (var { + type: e, + names: t, + props: r, + handler: a, + htmlBuilder: l, + mathmlBuilder: d + } = n, o = { + type: e, + numArgs: r.numArgs, + argTypes: r.argTypes, + allowedInArgument: !!r.allowedInArgument, + allowedInText: !!r.allowedInText, + allowedInMath: r.allowedInMath === void 0 ? !0 : r.allowedInMath, + numOptionalArgs: r.numOptionalArgs || 0, + infix: !!r.infix, + primitive: !!r.primitive, + handler: a + }, u = 0; u < t.length; ++u) + _functions[t[u]] = o; + e && (l && (_htmlGroupBuilders[e] = l), d && (_mathmlGroupBuilders[e] = d)); +} +function defineFunctionBuilders(n) { + var { + type: e, + htmlBuilder: t, + mathmlBuilder: r + } = n; + defineFunction({ + type: e, + names: [], + props: { + numArgs: 0 + }, + handler() { + throw new Error("Should never be called."); + }, + htmlBuilder: t, + mathmlBuilder: r }); } -function is_date(t) { - return Object.prototype.toString.call(t) === "[object Date]"; -} -function tick_spring(t, e, r, n) { - if (typeof r == "number" || is_date(r)) { - const f = n - r, u = (r - e) / (t.dt || 1 / 60), b = t.opts.stiffness * f, h = t.opts.damping * u, _ = (b - h) * t.inv_mass, E = (u + _) * t.dt; - return Math.abs(E) < t.opts.precision && Math.abs(f) < t.opts.precision ? n : (t.settled = !1, is_date(r) ? new Date(r.getTime() + E) : r + E); - } else { - if (Array.isArray(r)) - return r.map( - (f, u) => tick_spring(t, e[u], r[u], n[u]) - ); - if (typeof r == "object") { - const f = {}; - for (const u in r) - f[u] = tick_spring(t, e[u], r[u], n[u]); - return f; +var normalizeArgument = function(e) { + return e.type === "ordgroup" && e.body.length === 1 ? e.body[0] : e; +}, ordargument = function(e) { + return e.type === "ordgroup" ? e.body : [e]; +}, makeSpan$1 = buildCommon.makeSpan, binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"], binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"], styleMap$1 = { + display: Style$1.DISPLAY, + text: Style$1.TEXT, + script: Style$1.SCRIPT, + scriptscript: Style$1.SCRIPTSCRIPT +}, DomEnum = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner" +}, buildExpression$1 = function(e, t, r, a) { + a === void 0 && (a = [null, null]); + for (var l = [], d = 0; d < e.length; d++) { + var o = buildGroup$1(e[d], t); + if (o instanceof DocumentFragment) { + var u = o.children; + l.push(...u); } else - throw new Error(`Cannot spring ${typeof r} values`); - } -} -function spring(t, e = {}) { - const r = writable(t), { stiffness: n = 0.15, damping: f = 0.8, precision: u = 0.01 } = e; - let b, h, _, E = t, c = t, S = 1, y = 0, w = !1; - function L(o, A = {}) { - c = o; - const p = _ = {}; - return t == null || A.hard || s.stiffness >= 1 && s.damping >= 1 ? (w = !0, b = now(), E = o, r.set(t = c), Promise.resolve()) : (A.soft && (y = 1 / ((A.soft === !0 ? 0.5 : +A.soft) * 60), S = 0), h || (b = now(), w = !1, h = loop((v) => { - if (w) - return w = !1, h = null, !1; - S = Math.min(S + y, 1); - const a = { - inv_mass: S, - opts: s, - settled: !0, - dt: (v - b) * 60 / 1e3 - }, l = tick_spring(a, E, t, c); - return b = v, E = t, r.set(t = l), a.settled && (h = null), !a.settled; - })), new Promise((v) => { - h.promise.then(() => { - p === _ && v(); - }); - })); + l.push(o); } - const s = { - set: L, - update: (o, A) => L(o(c, t), A), - subscribe: r.subscribe, - stiffness: n, - damping: f, - precision: u - }; - return s; -} -var isMergeableObject = function t(e) { - return isNonNullObject(e) && !isSpecial(e); + if (buildCommon.tryCombineChars(l), !r) + return l; + var p = t; + if (e.length === 1) { + var m = e[0]; + m.type === "sizing" ? p = t.havingSize(m.size) : m.type === "styling" && (p = t.havingStyle(styleMap$1[m.style])); + } + var y = makeSpan$1([a[0] || "leftmost"], [], t), w = makeSpan$1([a[1] || "rightmost"], [], t), b = r === "root"; + return traverseNonSpaceNodes(l, (A, f) => { + var s = f.classes[0], h = A.classes[0]; + s === "mbin" && utils.contains(binRightCanceller, h) ? f.classes[0] = "mord" : h === "mbin" && utils.contains(binLeftCanceller, s) && (A.classes[0] = "mord"); + }, { + node: y + }, w, b), traverseNonSpaceNodes(l, (A, f) => { + var s = getTypeOfDomTree(f), h = getTypeOfDomTree(A), _ = s && h ? A.hasClass("mtight") ? tightSpacings[s][h] : spacings[s][h] : null; + if (_) + return buildCommon.makeGlue(_, p); + }, { + node: y + }, w, b), l; +}, traverseNonSpaceNodes = function n(e, t, r, a, l) { + a && e.push(a); + for (var d = 0; d < e.length; d++) { + var o = e[d], u = checkPartialGroup(o); + if (u) { + n(u.children, t, r, null, l); + continue; + } + var p = !o.hasClass("mspace"); + if (p) { + var m = t(o, r.node); + m && (r.insertAfter ? r.insertAfter(m) : (e.unshift(m), d++)); + } + p ? r.node = o : l && o.hasClass("newline") && (r.node = makeSpan$1(["leftmost"])), r.insertAfter = /* @__PURE__ */ ((y) => (w) => { + e.splice(y + 1, 0, w), d++; + })(d); + } + a && e.pop(); +}, checkPartialGroup = function(e) { + return e instanceof DocumentFragment || e instanceof Anchor || e instanceof Span && e.hasClass("enclosing") ? e : null; +}, getOutermostNode = function n(e, t) { + var r = checkPartialGroup(e); + if (r) { + var a = r.children; + if (a.length) { + if (t === "right") + return n(a[a.length - 1], "right"); + if (t === "left") + return n(a[0], "left"); + } + } + return e; +}, getTypeOfDomTree = function(e, t) { + return e ? (t && (e = getOutermostNode(e, t)), DomEnum[e.classes[0]] || null) : null; +}, makeNullDelimiter = function(e, t) { + var r = ["nulldelimiter"].concat(e.baseSizingClasses()); + return makeSpan$1(t.concat(r)); +}, buildGroup$1 = function(e, t, r) { + if (!e) + return makeSpan$1(); + if (_htmlGroupBuilders[e.type]) { + var a = _htmlGroupBuilders[e.type](e, t); + if (r && t.size !== r.size) { + a = makeSpan$1(t.sizingClasses(r), [a], t); + var l = t.sizeMultiplier / r.sizeMultiplier; + a.height *= l, a.depth *= l; + } + return a; + } else + throw new ParseError("Got group of unknown type: '" + e.type + "'"); }; -function isNonNullObject(t) { - return !!t && typeof t == "object"; -} -function isSpecial(t) { - var e = Object.prototype.toString.call(t); - return e === "[object RegExp]" || e === "[object Date]" || isReactElement(t); -} -var canUseSymbol = typeof Symbol == "function" && Symbol.for, REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; -function isReactElement(t) { - return t.$$typeof === REACT_ELEMENT_TYPE; -} -function emptyTarget(t) { - return Array.isArray(t) ? [] : {}; -} -function cloneUnlessOtherwiseSpecified(t, e) { - return e.clone !== !1 && e.isMergeableObject(t) ? deepmerge(emptyTarget(t), t, e) : t; -} -function defaultArrayMerge(t, e, r) { - return t.concat(e).map(function(n) { - return cloneUnlessOtherwiseSpecified(n, r); - }); -} -function getMergeFunction(t, e) { - if (!e.customMerge) - return deepmerge; - var r = e.customMerge(t); - return typeof r == "function" ? r : deepmerge; -} -function getEnumerableOwnPropertySymbols(t) { - return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(e) { - return Object.propertyIsEnumerable.call(t, e); - }) : []; -} -function getKeys(t) { - return Object.keys(t).concat(getEnumerableOwnPropertySymbols(t)); +function newDocumentFragment(n) { + return new DocumentFragment(n); } -function propertyIsOnObject(t, e) { - try { - return e in t; - } catch { - return !1; +class MathNode { + constructor(e, t, r) { + this.type = void 0, this.attributes = void 0, this.children = void 0, this.classes = void 0, this.type = e, this.attributes = {}, this.children = t || [], this.classes = r || []; } -} -function propertyIsUnsafe(t, e) { - return propertyIsOnObject(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e)); -} -function mergeObject(t, e, r) { - var n = {}; - return r.isMergeableObject(t) && getKeys(t).forEach(function(f) { - n[f] = cloneUnlessOtherwiseSpecified(t[f], r); - }), getKeys(e).forEach(function(f) { - propertyIsUnsafe(t, f) || (propertyIsOnObject(t, f) && r.isMergeableObject(e[f]) ? n[f] = getMergeFunction(f, r)(t[f], e[f], r) : n[f] = cloneUnlessOtherwiseSpecified(e[f], r)); - }), n; -} -function deepmerge(t, e, r) { - r = r || {}, r.arrayMerge = r.arrayMerge || defaultArrayMerge, r.isMergeableObject = r.isMergeableObject || isMergeableObject, r.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; - var n = Array.isArray(e), f = Array.isArray(t), u = n === f; - return u ? n ? r.arrayMerge(t, e, r) : mergeObject(t, e, r) : cloneUnlessOtherwiseSpecified(e, r); -} -deepmerge.all = function t(e, r) { - if (!Array.isArray(e)) - throw new Error("first argument should be an array"); - return e.reduce(function(n, f) { - return deepmerge(n, f, r); - }, {}); -}; -var deepmerge_1 = deepmerge, cjs = deepmerge_1; -const deepmerge$1 = /* @__PURE__ */ getDefaultExportFromCjs(cjs); -var extendStatics = function(t, e) { - return extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) { - r.__proto__ = n; - } || function(r, n) { - for (var f in n) - Object.prototype.hasOwnProperty.call(n, f) && (r[f] = n[f]); - }, extendStatics(t, e); -}; -function __extends(t, e) { - if (typeof e != "function" && e !== null) - throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); - extendStatics(t, e); - function r() { - this.constructor = t; + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + setAttribute(e, t) { + this.attributes[e] = t; } - t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r()); -} -var __assign = function() { - return __assign = Object.assign || function(e) { - for (var r, n = 1, f = arguments.length; n < f; n++) { - r = arguments[n]; - for (var u in r) - Object.prototype.hasOwnProperty.call(r, u) && (e[u] = r[u]); - } + /** + * Gets an attribute on a MathML node. + */ + getAttribute(e) { + return this.attributes[e]; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + for (var t in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, t) && e.setAttribute(t, this.attributes[t]); + this.classes.length > 0 && (e.className = createClass(this.classes)); + for (var r = 0; r < this.children.length; r++) + e.appendChild(this.children[r].toNode()); return e; - }, __assign.apply(this, arguments); -}; -function __spreadArray(t, e, r) { - if (r || arguments.length === 2) - for (var n = 0, f = e.length, u; n < f; n++) - (u || !(n in e)) && (u || (u = Array.prototype.slice.call(e, 0, n)), u[n] = e[n]); - return t.concat(u || Array.prototype.slice.call(e)); -} -typeof SuppressedError == "function" && SuppressedError; -var ErrorKind; -(function(t) { - t[t.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", t[t.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", t[t.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", t[t.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", t[t.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", t[t.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", t[t.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", t[t.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", t[t.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", t[t.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", t[t.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", t[t.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", t[t.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", t[t.INVALID_TAG = 23] = "INVALID_TAG", t[t.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", t[t.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", t[t.UNCLOSED_TAG = 27] = "UNCLOSED_TAG"; -})(ErrorKind || (ErrorKind = {})); -var TYPE; -(function(t) { - t[t.literal = 0] = "literal", t[t.argument = 1] = "argument", t[t.number = 2] = "number", t[t.date = 3] = "date", t[t.time = 4] = "time", t[t.select = 5] = "select", t[t.plural = 6] = "plural", t[t.pound = 7] = "pound", t[t.tag = 8] = "tag"; -})(TYPE || (TYPE = {})); -var SKELETON_TYPE; -(function(t) { - t[t.number = 0] = "number", t[t.dateTime = 1] = "dateTime"; -})(SKELETON_TYPE || (SKELETON_TYPE = {})); -function isLiteralElement(t) { - return t.type === TYPE.literal; -} -function isArgumentElement(t) { - return t.type === TYPE.argument; -} -function isNumberElement(t) { - return t.type === TYPE.number; -} -function isDateElement(t) { - return t.type === TYPE.date; -} -function isTimeElement(t) { - return t.type === TYPE.time; -} -function isSelectElement(t) { - return t.type === TYPE.select; -} -function isPluralElement(t) { - return t.type === TYPE.plural; -} -function isPoundElement(t) { - return t.type === TYPE.pound; -} -function isTagElement(t) { - return t.type === TYPE.tag; -} -function isNumberSkeleton(t) { - return !!(t && typeof t == "object" && t.type === SKELETON_TYPE.number); -} -function isDateTimeSkeleton(t) { - return !!(t && typeof t == "object" && t.type === SKELETON_TYPE.dateTime); -} -var SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; -function parseDateTimeSkeleton(t) { - var e = {}; - return t.replace(DATE_TIME_REGEX, function(r) { - var n = r.length; - switch (r[0]) { - case "G": - e.era = n === 4 ? "long" : n === 5 ? "narrow" : "short"; - break; - case "y": - e.year = n === 2 ? "2-digit" : "numeric"; - break; - case "Y": - case "u": - case "U": - case "r": - throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead"); - case "q": - case "Q": - throw new RangeError("`q/Q` (quarter) patterns are not supported"); - case "M": - case "L": - e.month = ["numeric", "2-digit", "short", "long", "narrow"][n - 1]; - break; - case "w": - case "W": - throw new RangeError("`w/W` (week) patterns are not supported"); - case "d": - e.day = ["numeric", "2-digit"][n - 1]; - break; - case "D": - case "F": - case "g": - throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead"); - case "E": - e.weekday = n === 4 ? "short" : n === 5 ? "narrow" : "short"; - break; - case "e": - if (n < 4) - throw new RangeError("`e..eee` (weekday) patterns are not supported"); - e.weekday = ["short", "long", "narrow", "short"][n - 4]; - break; - case "c": - if (n < 4) - throw new RangeError("`c..ccc` (weekday) patterns are not supported"); - e.weekday = ["short", "long", "narrow", "short"][n - 4]; - break; - case "a": - e.hour12 = !0; - break; - case "b": - case "B": - throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead"); - case "h": - e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][n - 1]; - break; - case "H": - e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][n - 1]; - break; - case "K": - e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][n - 1]; - break; - case "k": - e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][n - 1]; - break; - case "j": - case "J": - case "C": - throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead"); - case "m": - e.minute = ["numeric", "2-digit"][n - 1]; - break; - case "s": - e.second = ["numeric", "2-digit"][n - 1]; - break; - case "S": - case "A": - throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead"); - case "z": - e.timeZoneName = n < 4 ? "short" : "long"; - break; - case "Z": - case "O": - case "v": - case "V": - case "X": - case "x": - throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead"); - } - return ""; - }), e; -} -var WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i; -function parseNumberSkeletonFromString(t) { - if (t.length === 0) - throw new Error("Number skeleton cannot be empty"); - for (var e = t.split(WHITE_SPACE_REGEX).filter(function(y) { - return y.length > 0; - }), r = [], n = 0, f = e; n < f.length; n++) { - var u = f[n], b = u.split("/"); - if (b.length === 0) - throw new Error("Invalid number skeleton"); - for (var h = b[0], _ = b.slice(1), E = 0, c = _; E < c.length; E++) { - var S = c[E]; - if (S.length === 0) - throw new Error("Invalid number skeleton"); - } - r.push({ stem: h, options: _ }); } - return r; -} -function icuUnitToEcma(t) { - return t.replace(/^(.*?)-/, ""); -} -var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g, INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g, CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/; -function parseSignificantPrecision(t) { - var e = {}; - return t[t.length - 1] === "r" ? e.roundingPriority = "morePrecision" : t[t.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), t.replace(SIGNIFICANT_PRECISION_REGEX, function(r, n, f) { - return typeof f != "string" ? (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length) : f === "+" ? e.minimumSignificantDigits = n.length : n[0] === "#" ? e.maximumSignificantDigits = n.length : (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length + (typeof f == "string" ? f.length : 0)), ""; - }), e; + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + var e = "<" + this.type; + for (var t in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, t) && (e += " " + t + '="', e += utils.escape(this.attributes[t]), e += '"'); + this.classes.length > 0 && (e += ' class ="' + utils.escape(createClass(this.classes)) + '"'), e += ">"; + for (var r = 0; r < this.children.length; r++) + e += this.children[r].toMarkup(); + return e += "", e; + } + /** + * Converts the math node into a string, similar to innerText, but escaped. + */ + toText() { + return this.children.map((e) => e.toText()).join(""); + } } -function parseSign(t) { - switch (t) { - case "sign-auto": - return { - signDisplay: "auto" - }; - case "sign-accounting": - case "()": - return { - currencySign: "accounting" - }; - case "sign-always": - case "+!": - return { - signDisplay: "always" - }; - case "sign-accounting-always": - case "()!": - return { - signDisplay: "always", - currencySign: "accounting" - }; - case "sign-except-zero": - case "+?": - return { - signDisplay: "exceptZero" - }; - case "sign-accounting-except-zero": - case "()?": - return { - signDisplay: "exceptZero", - currencySign: "accounting" - }; - case "sign-never": - case "+_": - return { - signDisplay: "never" - }; +class TextNode { + constructor(e) { + this.text = void 0, this.text = e; + } + /** + * Converts the text node into a DOM text node. + */ + toNode() { + return document.createTextNode(this.text); + } + /** + * Converts the text node into escaped HTML markup + * (representing the text itself). + */ + toMarkup() { + return utils.escape(this.toText()); + } + /** + * Converts the text node into a string + * (representing the text itself). + */ + toText() { + return this.text; } } -function parseConciseScientificAndEngineeringStem(t) { - var e; - if (t[0] === "E" && t[1] === "E" ? (e = { - notation: "engineering" - }, t = t.slice(2)) : t[0] === "E" && (e = { - notation: "scientific" - }, t = t.slice(1)), e) { - var r = t.slice(0, 2); - if (r === "+!" ? (e.signDisplay = "always", t = t.slice(2)) : r === "+?" && (e.signDisplay = "exceptZero", t = t.slice(2)), !CONCISE_INTEGER_WIDTH_REGEX.test(t)) - throw new Error("Malformed concise eng/scientific notation"); - e.minimumIntegerDigits = t.length; +class SpaceNode { + /** + * Create a Space node with width given in CSS ems. + */ + constructor(e) { + this.width = void 0, this.character = void 0, this.width = e, e >= 0.05555 && e <= 0.05556 ? this.character = " " : e >= 0.1666 && e <= 0.1667 ? this.character = " " : e >= 0.2222 && e <= 0.2223 ? this.character = " " : e >= 0.2777 && e <= 0.2778 ? this.character = "  " : e >= -0.05556 && e <= -0.05555 ? this.character = " ⁣" : e >= -0.1667 && e <= -0.1666 ? this.character = " ⁣" : e >= -0.2223 && e <= -0.2222 ? this.character = " ⁣" : e >= -0.2778 && e <= -0.2777 ? this.character = " ⁣" : this.character = null; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + if (this.character) + return document.createTextNode(this.character); + var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + return e.setAttribute("width", makeEm(this.width)), e; + } + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + return this.character ? "" + this.character + "" : ''; + } + /** + * Converts the math node into a string, similar to innerText. + */ + toText() { + return this.character ? this.character : " "; } - return e; } -function parseNotationOptions(t) { - var e = {}, r = parseSign(t); - return r || e; -} -function parseNumberSkeleton(t) { - for (var e = {}, r = 0, n = t; r < n.length; r++) { - var f = n[r]; - switch (f.stem) { - case "percent": - case "%": - e.style = "percent"; - continue; - case "%x100": - e.style = "percent", e.scale = 100; - continue; - case "currency": - e.style = "currency", e.currency = f.options[0]; - continue; - case "group-off": - case ",_": - e.useGrouping = !1; - continue; - case "precision-integer": - case ".": - e.maximumFractionDigits = 0; - continue; - case "measure-unit": - case "unit": - e.style = "unit", e.unit = icuUnitToEcma(f.options[0]); - continue; - case "compact-short": - case "K": - e.notation = "compact", e.compactDisplay = "short"; - continue; - case "compact-long": - case "KK": - e.notation = "compact", e.compactDisplay = "long"; - continue; - case "scientific": - e = __assign(__assign(__assign({}, e), { notation: "scientific" }), f.options.reduce(function(_, E) { - return __assign(__assign({}, _), parseNotationOptions(E)); - }, {})); - continue; - case "engineering": - e = __assign(__assign(__assign({}, e), { notation: "engineering" }), f.options.reduce(function(_, E) { - return __assign(__assign({}, _), parseNotationOptions(E)); - }, {})); - continue; - case "notation-simple": - e.notation = "standard"; - continue; - case "unit-width-narrow": - e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow"; - continue; - case "unit-width-short": - e.currencyDisplay = "code", e.unitDisplay = "short"; - continue; - case "unit-width-full-name": - e.currencyDisplay = "name", e.unitDisplay = "long"; - continue; - case "unit-width-iso-code": - e.currencyDisplay = "symbol"; - continue; - case "scale": - e.scale = parseFloat(f.options[0]); +var mathMLTree = { + MathNode, + TextNode, + SpaceNode, + newDocumentFragment +}, makeText = function(e, t, r) { + return symbols[t][e] && symbols[t][e].replace && e.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(e) && r && (r.fontFamily && r.fontFamily.slice(4, 6) === "tt" || r.font && r.font.slice(4, 6) === "tt")) && (e = symbols[t][e].replace), new mathMLTree.TextNode(e); +}, makeRow = function(e) { + return e.length === 1 ? e[0] : new mathMLTree.MathNode("mrow", e); +}, getVariant = function(e, t) { + if (t.fontFamily === "texttt") + return "monospace"; + if (t.fontFamily === "textsf") + return t.fontShape === "textit" && t.fontWeight === "textbf" ? "sans-serif-bold-italic" : t.fontShape === "textit" ? "sans-serif-italic" : t.fontWeight === "textbf" ? "bold-sans-serif" : "sans-serif"; + if (t.fontShape === "textit" && t.fontWeight === "textbf") + return "bold-italic"; + if (t.fontShape === "textit") + return "italic"; + if (t.fontWeight === "textbf") + return "bold"; + var r = t.font; + if (!r || r === "mathnormal") + return null; + var a = e.mode; + if (r === "mathit") + return "italic"; + if (r === "boldsymbol") + return e.type === "textord" ? "bold" : "bold-italic"; + if (r === "mathbf") + return "bold"; + if (r === "mathbb") + return "double-struck"; + if (r === "mathfrak") + return "fraktur"; + if (r === "mathscr" || r === "mathcal") + return "script"; + if (r === "mathsf") + return "sans-serif"; + if (r === "mathtt") + return "monospace"; + var l = e.text; + if (utils.contains(["\\imath", "\\jmath"], l)) + return null; + symbols[a][l] && symbols[a][l].replace && (l = symbols[a][l].replace); + var d = buildCommon.fontMap[r].fontName; + return getCharacterMetrics(l, d, a) ? buildCommon.fontMap[r].variant : null; +}, buildExpression = function(e, t, r) { + if (e.length === 1) { + var a = buildGroup(e[0], t); + return r && a instanceof MathNode && a.type === "mo" && (a.setAttribute("lspace", "0em"), a.setAttribute("rspace", "0em")), [a]; + } + for (var l = [], d, o = 0; o < e.length; o++) { + var u = buildGroup(e[o], t); + if (u instanceof MathNode && d instanceof MathNode) { + if (u.type === "mtext" && d.type === "mtext" && u.getAttribute("mathvariant") === d.getAttribute("mathvariant")) { + d.children.push(...u.children); continue; - case "integer-width": - if (f.options.length > 1) - throw new RangeError("integer-width stems only accept a single optional option"); - f.options[0].replace(INTEGER_WIDTH_REGEX, function(_, E, c, S, y, w) { - if (E) - e.minimumIntegerDigits = c.length; - else { - if (S && y) - throw new Error("We currently do not support maximum integer digits"); - if (w) - throw new Error("We currently do not support exact integer digits"); - } - return ""; - }); + } else if (u.type === "mn" && d.type === "mn") { + d.children.push(...u.children); continue; + } else if (u.type === "mi" && u.children.length === 1 && d.type === "mn") { + var p = u.children[0]; + if (p instanceof TextNode && p.text === ".") { + d.children.push(...u.children); + continue; + } + } else if (d.type === "mi" && d.children.length === 1) { + var m = d.children[0]; + if (m instanceof TextNode && m.text === "̸" && (u.type === "mo" || u.type === "mi" || u.type === "mn")) { + var y = u.children[0]; + y instanceof TextNode && y.text.length > 0 && (y.text = y.text.slice(0, 1) + "̸" + y.text.slice(1), l.pop()); + } + } } - if (CONCISE_INTEGER_WIDTH_REGEX.test(f.stem)) { - e.minimumIntegerDigits = f.stem.length; - continue; - } - if (FRACTION_PRECISION_REGEX.test(f.stem)) { - if (f.options.length > 1) - throw new RangeError("Fraction-precision stems only accept a single optional option"); - f.stem.replace(FRACTION_PRECISION_REGEX, function(_, E, c, S, y, w) { - return c === "*" ? e.minimumFractionDigits = E.length : S && S[0] === "#" ? e.maximumFractionDigits = S.length : y && w ? (e.minimumFractionDigits = y.length, e.maximumFractionDigits = y.length + w.length) : (e.minimumFractionDigits = E.length, e.maximumFractionDigits = E.length), ""; + l.push(u), d = u; + } + return l; +}, buildExpressionRow = function(e, t, r) { + return makeRow(buildExpression(e, t, r)); +}, buildGroup = function(e, t) { + if (!e) + return new mathMLTree.MathNode("mrow"); + if (_mathmlGroupBuilders[e.type]) { + var r = _mathmlGroupBuilders[e.type](e, t); + return r; + } else + throw new ParseError("Got group of unknown type: '" + e.type + "'"); +}, stretchyCodePoint = { + widehat: "^", + widecheck: "ˇ", + widetilde: "~", + utilde: "~", + overleftarrow: "←", + underleftarrow: "←", + xleftarrow: "←", + overrightarrow: "→", + underrightarrow: "→", + xrightarrow: "→", + underbrace: "⏟", + overbrace: "⏞", + overgroup: "⏠", + undergroup: "⏡", + overleftrightarrow: "↔", + underleftrightarrow: "↔", + xleftrightarrow: "↔", + Overrightarrow: "⇒", + xRightarrow: "⇒", + overleftharpoon: "↼", + xleftharpoonup: "↼", + overrightharpoon: "⇀", + xrightharpoonup: "⇀", + xLeftarrow: "⇐", + xLeftrightarrow: "⇔", + xhookleftarrow: "↩", + xhookrightarrow: "↪", + xmapsto: "↦", + xrightharpoondown: "⇁", + xleftharpoondown: "↽", + xrightleftharpoons: "⇌", + xleftrightharpoons: "⇋", + xtwoheadleftarrow: "↞", + xtwoheadrightarrow: "↠", + xlongequal: "=", + xtofrom: "⇄", + xrightleftarrows: "⇄", + xrightequilibrium: "⇌", + // Not a perfect match. + xleftequilibrium: "⇋", + // None better available. + "\\cdrightarrow": "→", + "\\cdleftarrow": "←", + "\\cdlongequal": "=" +}, mathMLnode = function(e) { + var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[e.replace(/^\\/, "")])]); + return t.setAttribute("stretchy", "true"), t; +}, katexImagesData = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"], + // CD minwwidth2.5pc + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], + // The next three arrows are from the mhchem package. + // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the + // document as \xrightarrow or \xrightleftharpoons. Those have + // min-length = 1.75em, so we set min-length on these next three to match. + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], + xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] +}, groupLength = function(e) { + return e.type === "ordgroup" ? e.body.length : 1; +}, svgSpan = function(e, t) { + function r() { + var o = 4e5, u = e.label.slice(1); + if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], u)) { + var p = e, m = groupLength(p.base), y, w, b; + if (m > 5) + u === "widehat" || u === "widecheck" ? (y = 420, o = 2364, b = 0.42, w = u + "4") : (y = 312, o = 2340, b = 0.34, w = "tilde4"); + else { + var A = [1, 1, 2, 2, 3, 3][m]; + u === "widehat" || u === "widecheck" ? (o = [0, 1062, 2364, 2364, 2364][A], y = [0, 239, 300, 360, 420][A], b = [0, 0.24, 0.3, 0.3, 0.36, 0.42][A], w = u + A) : (o = [0, 600, 1033, 2339, 2340][A], y = [0, 260, 286, 306, 312][A], b = [0, 0.26, 0.286, 0.3, 0.306, 0.34][A], w = "tilde" + A); + } + var f = new PathNode(w), s = new SvgNode([f], { + width: "100%", + height: makeEm(b), + viewBox: "0 0 " + o + " " + y, + preserveAspectRatio: "none" }); - var u = f.options[0]; - u === "w" ? e = __assign(__assign({}, e), { trailingZeroDisplay: "stripIfInteger" }) : u && (e = __assign(__assign({}, e), parseSignificantPrecision(u))); - continue; + return { + span: buildCommon.makeSvgSpan([], [s], t), + minWidth: 0, + height: b + }; + } else { + var h = [], _ = katexImagesData[u], [g, x, c] = _, v = c / 1e3, M = g.length, E, $; + if (M === 1) { + var k = _[3]; + E = ["hide-tail"], $ = [k]; + } else if (M === 2) + E = ["halfarrow-left", "halfarrow-right"], $ = ["xMinYMin", "xMaxYMin"]; + else if (M === 3) + E = ["brace-left", "brace-center", "brace-right"], $ = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + else + throw new Error(`Correct katexImagesData or update code here to support + ` + M + " children."); + for (var L = 0; L < M; L++) { + var z = new PathNode(g[L]), O = new SvgNode([z], { + width: "400em", + height: makeEm(v), + viewBox: "0 0 " + o + " " + c, + preserveAspectRatio: $[L] + " slice" + }), R = buildCommon.makeSvgSpan([E[L]], [O], t); + if (M === 1) + return { + span: R, + minWidth: x, + height: v + }; + R.style.height = makeEm(v), h.push(R); + } + return { + span: buildCommon.makeSpan(["stretchy"], h, t), + minWidth: x, + height: v + }; } - if (SIGNIFICANT_PRECISION_REGEX.test(f.stem)) { - e = __assign(__assign({}, e), parseSignificantPrecision(f.stem)); - continue; + } + var { + span: a, + minWidth: l, + height: d + } = r(); + return a.height = d, a.style.height = makeEm(d), l > 0 && (a.style.minWidth = makeEm(l)), a; +}, encloseSpan = function(e, t, r, a, l) { + var d, o = e.height + e.depth + r + a; + if (/fbox|color|angl/.test(t)) { + if (d = buildCommon.makeSpan(["stretchy", t], [], l), t === "fbox") { + var u = l.color && l.getColor(); + u && (d.style.borderColor = u); } - var b = parseSign(f.stem); - b && (e = __assign(__assign({}, e), b)); - var h = parseConciseScientificAndEngineeringStem(f.stem); - h && (e = __assign(__assign({}, e), h)); + } else { + var p = []; + /^[bx]cancel$/.test(t) && p.push(new LineNode({ + x1: "0", + y1: "0", + x2: "100%", + y2: "100%", + "stroke-width": "0.046em" + })), /^x?cancel$/.test(t) && p.push(new LineNode({ + x1: "0", + y1: "100%", + x2: "100%", + y2: "0", + "stroke-width": "0.046em" + })); + var m = new SvgNode(p, { + width: "100%", + height: makeEm(o) + }); + d = buildCommon.makeSvgSpan([], [m], l); } - return e; + return d.height = o, d.style.height = makeEm(o), d; +}, stretchy = { + encloseSpan, + mathMLnode, + svgSpan +}; +function assertNodeType(n, e) { + if (!n || n.type !== e) + throw new Error("Expected node of type " + e + ", but got " + (n ? "node of type " + n.type : String(n))); + return n; } -var timeData = { - AX: [ - "H" - ], - BQ: [ - "H" - ], - CP: [ - "H" - ], - CZ: [ - "H" - ], - DK: [ - "H" - ], - FI: [ - "H" - ], - ID: [ - "H" - ], - IS: [ - "H" - ], - ML: [ - "H" - ], - NE: [ - "H" - ], - RU: [ - "H" - ], - SE: [ - "H" - ], - SJ: [ - "H" - ], - SK: [ - "H" - ], - AS: [ - "h", - "H" - ], - BT: [ - "h", - "H" - ], - DJ: [ - "h", - "H" - ], - ER: [ - "h", - "H" - ], - GH: [ - "h", - "H" - ], - IN: [ - "h", - "H" - ], - LS: [ - "h", - "H" - ], - PG: [ - "h", - "H" - ], - PW: [ - "h", - "H" - ], - SO: [ - "h", - "H" - ], - TO: [ - "h", - "H" - ], - VU: [ - "h", - "H" - ], - WS: [ - "h", - "H" - ], - "001": [ - "H", - "h" - ], - AL: [ - "h", - "H", - "hB" - ], - TD: [ - "h", - "H", - "hB" - ], - "ca-ES": [ - "H", - "h", - "hB" - ], - CF: [ - "H", - "h", - "hB" - ], - CM: [ - "H", - "h", - "hB" - ], - "fr-CA": [ - "H", - "h", - "hB" - ], - "gl-ES": [ - "H", - "h", - "hB" - ], - "it-CH": [ - "H", - "h", - "hB" - ], - "it-IT": [ - "H", - "h", - "hB" - ], - LU: [ - "H", - "h", - "hB" - ], - NP: [ - "H", - "h", - "hB" - ], - PF: [ - "H", - "h", - "hB" - ], - SC: [ - "H", - "h", - "hB" - ], - SM: [ - "H", - "h", - "hB" - ], - SN: [ - "H", - "h", - "hB" - ], - TF: [ - "H", - "h", - "hB" - ], - VA: [ - "H", - "h", - "hB" - ], - CY: [ - "h", - "H", - "hb", - "hB" - ], - GR: [ - "h", - "H", - "hb", - "hB" - ], - CO: [ - "h", - "H", - "hB", - "hb" - ], - DO: [ - "h", - "H", - "hB", - "hb" - ], - KP: [ - "h", - "H", - "hB", - "hb" - ], - KR: [ - "h", - "H", - "hB", - "hb" - ], - NA: [ - "h", - "H", - "hB", - "hb" - ], - PA: [ - "h", - "H", - "hB", - "hb" - ], - PR: [ - "h", - "H", - "hB", - "hb" - ], - VE: [ - "h", - "H", - "hB", - "hb" - ], - AC: [ - "H", - "h", - "hb", - "hB" - ], - AI: [ - "H", - "h", - "hb", - "hB" - ], - BW: [ - "H", - "h", - "hb", - "hB" - ], - BZ: [ - "H", - "h", - "hb", - "hB" - ], - CC: [ - "H", - "h", - "hb", - "hB" - ], - CK: [ - "H", - "h", - "hb", - "hB" - ], - CX: [ - "H", - "h", - "hb", - "hB" - ], - DG: [ - "H", - "h", - "hb", - "hB" - ], - FK: [ - "H", - "h", - "hb", - "hB" - ], - GB: [ - "H", - "h", - "hb", - "hB" - ], - GG: [ - "H", - "h", - "hb", - "hB" - ], - GI: [ - "H", - "h", - "hb", - "hB" - ], - IE: [ - "H", - "h", - "hb", - "hB" - ], - IM: [ - "H", - "h", - "hb", - "hB" - ], - IO: [ - "H", - "h", - "hb", - "hB" - ], - JE: [ - "H", - "h", - "hb", - "hB" - ], - LT: [ - "H", - "h", - "hb", - "hB" - ], - MK: [ - "H", - "h", - "hb", - "hB" - ], - MN: [ - "H", - "h", - "hb", - "hB" - ], - MS: [ - "H", - "h", - "hb", - "hB" - ], - NF: [ - "H", - "h", - "hb", - "hB" - ], - NG: [ - "H", - "h", - "hb", - "hB" - ], - NR: [ - "H", - "h", - "hb", - "hB" - ], - NU: [ - "H", - "h", - "hb", - "hB" - ], - PN: [ - "H", - "h", - "hb", - "hB" - ], - SH: [ - "H", - "h", - "hb", - "hB" - ], - SX: [ - "H", - "h", - "hb", - "hB" - ], - TA: [ - "H", - "h", - "hb", - "hB" - ], - ZA: [ - "H", - "h", - "hb", - "hB" - ], - "af-ZA": [ - "H", - "h", - "hB", - "hb" - ], - AR: [ - "H", - "h", - "hB", - "hb" - ], - CL: [ - "H", - "h", - "hB", - "hb" - ], - CR: [ - "H", - "h", - "hB", - "hb" - ], - CU: [ - "H", - "h", - "hB", - "hb" - ], - EA: [ - "H", - "h", - "hB", - "hb" - ], - "es-BO": [ - "H", - "h", - "hB", - "hb" - ], - "es-BR": [ - "H", - "h", - "hB", - "hb" - ], - "es-EC": [ - "H", - "h", - "hB", - "hb" - ], - "es-ES": [ - "H", - "h", - "hB", - "hb" - ], - "es-GQ": [ - "H", - "h", - "hB", - "hb" - ], - "es-PE": [ - "H", - "h", - "hB", - "hb" - ], - GT: [ - "H", - "h", - "hB", - "hb" - ], - HN: [ - "H", - "h", - "hB", - "hb" - ], - IC: [ - "H", - "h", - "hB", - "hb" - ], - KG: [ - "H", - "h", - "hB", - "hb" - ], - KM: [ - "H", - "h", - "hB", - "hb" - ], - LK: [ - "H", - "h", - "hB", - "hb" - ], - MA: [ - "H", - "h", - "hB", - "hb" - ], - MX: [ - "H", - "h", - "hB", - "hb" - ], - NI: [ - "H", - "h", - "hB", - "hb" - ], - PY: [ - "H", - "h", - "hB", - "hb" - ], - SV: [ - "H", - "h", - "hB", - "hb" - ], - UY: [ - "H", - "h", - "hB", - "hb" - ], - JP: [ - "H", - "h", - "K" - ], - AD: [ - "H", - "hB" - ], - AM: [ - "H", - "hB" - ], - AO: [ - "H", - "hB" - ], - AT: [ - "H", - "hB" - ], - AW: [ - "H", - "hB" - ], - BE: [ - "H", - "hB" - ], - BF: [ - "H", - "hB" - ], - BJ: [ - "H", - "hB" - ], - BL: [ - "H", - "hB" - ], - BR: [ - "H", - "hB" - ], - CG: [ - "H", - "hB" - ], - CI: [ - "H", - "hB" - ], - CV: [ - "H", - "hB" - ], - DE: [ - "H", - "hB" - ], - EE: [ - "H", - "hB" - ], - FR: [ - "H", - "hB" - ], - GA: [ - "H", - "hB" - ], - GF: [ - "H", - "hB" - ], - GN: [ - "H", - "hB" - ], - GP: [ - "H", - "hB" - ], - GW: [ - "H", - "hB" - ], - HR: [ - "H", - "hB" - ], - IL: [ - "H", - "hB" - ], - IT: [ - "H", - "hB" - ], - KZ: [ - "H", - "hB" - ], - MC: [ - "H", - "hB" - ], - MD: [ - "H", - "hB" - ], - MF: [ - "H", - "hB" - ], - MQ: [ - "H", - "hB" - ], - MZ: [ - "H", - "hB" - ], - NC: [ - "H", - "hB" - ], - NL: [ - "H", - "hB" - ], - PM: [ - "H", - "hB" - ], - PT: [ - "H", - "hB" - ], - RE: [ - "H", - "hB" - ], - RO: [ - "H", - "hB" - ], - SI: [ - "H", - "hB" - ], - SR: [ - "H", - "hB" - ], - ST: [ - "H", - "hB" - ], - TG: [ - "H", - "hB" - ], - TR: [ - "H", - "hB" - ], - WF: [ - "H", - "hB" - ], - YT: [ - "H", - "hB" - ], - BD: [ - "h", - "hB", - "H" - ], - PK: [ - "h", - "hB", - "H" - ], - AZ: [ - "H", - "hB", - "h" - ], - BA: [ - "H", - "hB", - "h" - ], - BG: [ - "H", - "hB", - "h" - ], - CH: [ - "H", - "hB", - "h" - ], - GE: [ - "H", - "hB", - "h" - ], - LI: [ - "H", - "hB", - "h" - ], - ME: [ - "H", - "hB", - "h" - ], - RS: [ - "H", - "hB", - "h" - ], - UA: [ - "H", - "hB", - "h" - ], - UZ: [ - "H", - "hB", - "h" - ], - XK: [ - "H", - "hB", - "h" - ], - AG: [ - "h", - "hb", - "H", - "hB" - ], - AU: [ - "h", - "hb", - "H", - "hB" - ], - BB: [ - "h", - "hb", - "H", - "hB" - ], - BM: [ - "h", - "hb", - "H", - "hB" - ], - BS: [ - "h", - "hb", - "H", - "hB" - ], - CA: [ - "h", - "hb", - "H", - "hB" - ], - DM: [ - "h", - "hb", - "H", - "hB" - ], - "en-001": [ - "h", - "hb", - "H", - "hB" - ], - FJ: [ - "h", - "hb", - "H", - "hB" - ], - FM: [ - "h", - "hb", - "H", - "hB" - ], - GD: [ - "h", - "hb", - "H", - "hB" - ], - GM: [ - "h", - "hb", - "H", - "hB" - ], - GU: [ - "h", - "hb", - "H", - "hB" - ], - GY: [ - "h", - "hb", - "H", - "hB" - ], - JM: [ - "h", - "hb", - "H", - "hB" - ], - KI: [ - "h", - "hb", - "H", - "hB" - ], - KN: [ - "h", - "hb", - "H", - "hB" - ], - KY: [ - "h", - "hb", - "H", - "hB" - ], - LC: [ - "h", - "hb", - "H", - "hB" - ], - LR: [ - "h", - "hb", - "H", - "hB" - ], - MH: [ - "h", - "hb", - "H", - "hB" - ], - MP: [ - "h", - "hb", - "H", - "hB" - ], - MW: [ - "h", - "hb", - "H", - "hB" - ], - NZ: [ - "h", - "hb", - "H", - "hB" - ], - SB: [ - "h", - "hb", - "H", - "hB" - ], - SG: [ - "h", - "hb", - "H", - "hB" - ], - SL: [ - "h", - "hb", - "H", - "hB" - ], - SS: [ - "h", - "hb", - "H", - "hB" - ], - SZ: [ - "h", - "hb", - "H", - "hB" - ], - TC: [ - "h", - "hb", - "H", - "hB" - ], - TT: [ - "h", - "hb", - "H", - "hB" - ], - UM: [ - "h", - "hb", - "H", - "hB" - ], - US: [ - "h", - "hb", - "H", - "hB" - ], - VC: [ - "h", - "hb", - "H", - "hB" - ], - VG: [ - "h", - "hb", - "H", - "hB" - ], - VI: [ - "h", - "hb", - "H", - "hB" - ], - ZM: [ - "h", - "hb", - "H", - "hB" - ], - BO: [ - "H", - "hB", - "h", - "hb" - ], - EC: [ - "H", - "hB", - "h", - "hb" - ], - ES: [ - "H", - "hB", - "h", - "hb" - ], - GQ: [ - "H", - "hB", - "h", - "hb" - ], - PE: [ - "H", - "hB", - "h", - "hb" - ], - AE: [ - "h", - "hB", - "hb", - "H" - ], - "ar-001": [ - "h", - "hB", - "hb", - "H" - ], - BH: [ - "h", - "hB", - "hb", - "H" - ], - DZ: [ - "h", - "hB", - "hb", - "H" - ], - EG: [ - "h", - "hB", - "hb", - "H" - ], - EH: [ - "h", - "hB", - "hb", - "H" - ], - HK: [ - "h", - "hB", - "hb", - "H" - ], - IQ: [ - "h", - "hB", - "hb", - "H" - ], - JO: [ - "h", - "hB", - "hb", - "H" - ], - KW: [ - "h", - "hB", - "hb", - "H" - ], - LB: [ - "h", - "hB", - "hb", - "H" - ], - LY: [ - "h", - "hB", - "hb", - "H" - ], - MO: [ - "h", - "hB", - "hb", - "H" - ], - MR: [ - "h", - "hB", - "hb", - "H" - ], - OM: [ - "h", - "hB", - "hb", - "H" - ], - PH: [ - "h", - "hB", - "hb", - "H" - ], - PS: [ - "h", - "hB", - "hb", - "H" - ], - QA: [ - "h", - "hB", - "hb", - "H" - ], - SA: [ - "h", - "hB", - "hb", - "H" - ], - SD: [ - "h", - "hB", - "hb", - "H" - ], - SY: [ - "h", - "hB", - "hb", - "H" - ], - TN: [ - "h", - "hB", - "hb", - "H" - ], - YE: [ - "h", - "hB", - "hb", - "H" - ], - AF: [ - "H", - "hb", - "hB", - "h" - ], - LA: [ - "H", - "hb", - "hB", - "h" - ], - CN: [ - "H", - "hB", - "hb", - "h" - ], - LV: [ - "H", - "hB", - "hb", - "h" - ], - TL: [ - "H", - "hB", - "hb", - "h" - ], - "zu-ZA": [ - "H", - "hB", - "hb", - "h" - ], - CD: [ - "hB", - "H" - ], - IR: [ - "hB", - "H" - ], - "hi-IN": [ - "hB", - "h", - "H" - ], - "kn-IN": [ - "hB", - "h", - "H" - ], - "ml-IN": [ - "hB", - "h", - "H" - ], - "te-IN": [ - "hB", - "h", - "H" - ], - KH: [ - "hB", - "h", - "H", - "hb" - ], - "ta-IN": [ - "hB", - "h", - "hb", - "H" - ], - BN: [ - "hb", - "hB", - "h", - "H" - ], - MY: [ - "hb", - "hB", - "h", - "H" - ], - ET: [ - "hB", - "hb", - "h", - "H" - ], - "gu-IN": [ - "hB", - "hb", - "h", - "H" +function assertSymbolNodeType(n) { + var e = checkSymbolNodeType(n); + if (!e) + throw new Error("Expected node of symbol group type, but got " + (n ? "node of type " + n.type : String(n))); + return e; +} +function checkSymbolNodeType(n) { + return n && (n.type === "atom" || NON_ATOMS.hasOwnProperty(n.type)) ? n : null; +} +var htmlBuilder$a = (n, e) => { + var t, r, a; + n && n.type === "supsub" ? (r = assertNodeType(n.base, "accent"), t = r.base, n.base = t, a = assertSpan(buildGroup$1(n, e)), n.base = r) : (r = assertNodeType(n, "accent"), t = r.base); + var l = buildGroup$1(t, e.havingCrampedStyle()), d = r.isShifty && utils.isCharacterBox(t), o = 0; + if (d) { + var u = utils.getBaseElem(t), p = buildGroup$1(u, e.havingCrampedStyle()); + o = assertSymbolDomNode(p).skew; + } + var m = r.label === "\\c", y = m ? l.height + l.depth : Math.min(l.height, e.fontMetrics().xHeight), w; + if (r.isStretchy) + w = stretchy.svgSpan(r, e), w = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: l + }, { + type: "elem", + elem: w, + wrapperClasses: ["svg-align"], + wrapperStyle: o > 0 ? { + width: "calc(100% - " + makeEm(2 * o) + ")", + marginLeft: makeEm(2 * o) + } : void 0 + }] + }, e); + else { + var b, A; + r.label === "\\vec" ? (b = buildCommon.staticSvg("vec", e), A = buildCommon.svgData.vec[1]) : (b = buildCommon.makeOrd({ + mode: r.mode, + text: r.label + }, e, "textord"), b = assertSymbolDomNode(b), b.italic = 0, A = b.width, m && (y += b.depth)), w = buildCommon.makeSpan(["accent-body"], [b]); + var f = r.label === "\\textcircled"; + f && (w.classes.push("accent-full"), y = l.height); + var s = o; + f || (s -= A / 2), w.style.left = makeEm(s), r.label === "\\textcircled" && (w.style.top = ".2em"), w = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: l + }, { + type: "kern", + size: -y + }, { + type: "elem", + elem: w + }] + }, e); + } + var h = buildCommon.makeSpan(["mord", "accent"], [w], e); + return a ? (a.children[0] = h, a.height = Math.max(h.height, a.height), a.classes[0] = "mord", a) : h; +}, mathmlBuilder$9 = (n, e) => { + var t = n.isStretchy ? stretchy.mathMLnode(n.label) : new mathMLTree.MathNode("mo", [makeText(n.label, n.mode)]), r = new mathMLTree.MathNode("mover", [buildGroup(n.base, e), t]); + return r.setAttribute("accent", "true"), r; +}, NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((n) => "\\" + n).join("|")); +defineFunction({ + type: "accent", + names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var t = normalizeArgument(e[0]), r = !NON_STRETCHY_ACCENT_REGEX.test(n.funcName), a = !r || n.funcName === "\\widehat" || n.funcName === "\\widetilde" || n.funcName === "\\widecheck"; + return { + type: "accent", + mode: n.parser.mode, + label: n.funcName, + isStretchy: r, + isShifty: a, + base: t + }; + }, + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9 +}); +defineFunction({ + type: "accent", + names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"], + props: { + numArgs: 1, + allowedInText: !0, + allowedInMath: !0, + // unless in strict mode + argTypes: ["primitive"] + }, + handler: (n, e) => { + var t = e[0], r = n.parser.mode; + return r === "math" && (n.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + n.funcName + " works only in text mode"), r = "text"), { + type: "accent", + mode: r, + label: n.funcName, + isStretchy: !1, + isShifty: !0, + base: t + }; + }, + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9 +}); +defineFunction({ + type: "accentUnder", + names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "accentUnder", + mode: t.mode, + label: r, + base: a + }; + }, + htmlBuilder: (n, e) => { + var t = buildGroup$1(n.base, e), r = stretchy.svgSpan(n, e), a = n.label === "\\utilde" ? 0.12 : 0, l = buildCommon.makeVList({ + positionType: "top", + positionData: t.height, + children: [{ + type: "elem", + elem: r, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: a + }, { + type: "elem", + elem: t + }] + }, e); + return buildCommon.makeSpan(["mord", "accentunder"], [l], e); + }, + mathmlBuilder: (n, e) => { + var t = stretchy.mathMLnode(n.label), r = new mathMLTree.MathNode("munder", [buildGroup(n.base, e), t]); + return r.setAttribute("accentunder", "true"), r; + } +}); +var paddedNode = (n) => { + var e = new mathMLTree.MathNode("mpadded", n ? [n] : []); + return e.setAttribute("width", "+0.6em"), e.setAttribute("lspace", "0.3em"), e; +}; +defineFunction({ + type: "xArrow", + names: [ + "\\xleftarrow", + "\\xrightarrow", + "\\xLeftarrow", + "\\xRightarrow", + "\\xleftrightarrow", + "\\xLeftrightarrow", + "\\xhookleftarrow", + "\\xhookrightarrow", + "\\xmapsto", + "\\xrightharpoondown", + "\\xrightharpoonup", + "\\xleftharpoondown", + "\\xleftharpoonup", + "\\xrightleftharpoons", + "\\xleftrightharpoons", + "\\xlongequal", + "\\xtwoheadrightarrow", + "\\xtwoheadleftarrow", + "\\xtofrom", + // The next 3 functions are here to support the mhchem extension. + // Direct use of these functions is discouraged and may break someday. + "\\xrightleftarrows", + "\\xrightequilibrium", + "\\xleftequilibrium", + // The next 3 functions are here only to support the {CD} environment. + "\\\\cdrightarrow", + "\\\\cdleftarrow", + "\\\\cdlongequal" ], - "mr-IN": [ - "hB", - "hb", - "h", - "H" + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n; + return { + type: "xArrow", + mode: r.mode, + label: a, + body: e[0], + below: t[0] + }; + }, + // Flow is unable to correctly infer the type of `group`, even though it's + // unambiguously determined from the passed-in `type` above. + htmlBuilder(n, e) { + var t = e.style, r = e.havingStyle(t.sup()), a = buildCommon.wrapFragment(buildGroup$1(n.body, r, e), e), l = n.label.slice(0, 2) === "\\x" ? "x" : "cd"; + a.classes.push(l + "-arrow-pad"); + var d; + n.below && (r = e.havingStyle(t.sub()), d = buildCommon.wrapFragment(buildGroup$1(n.below, r, e), e), d.classes.push(l + "-arrow-pad")); + var o = stretchy.svgSpan(n, e), u = -e.fontMetrics().axisHeight + 0.5 * o.height, p = -e.fontMetrics().axisHeight - 0.5 * o.height - 0.111; + (a.depth > 0.25 || n.label === "\\xleftequilibrium") && (p -= a.depth); + var m; + if (d) { + var y = -e.fontMetrics().axisHeight + d.height + 0.5 * o.height + 0.111; + m = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: a, + shift: p + }, { + type: "elem", + elem: o, + shift: u + }, { + type: "elem", + elem: d, + shift: y + }] + }, e); + } else + m = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: a, + shift: p + }, { + type: "elem", + elem: o, + shift: u + }] + }, e); + return m.children[0].children[0].children[1].classes.push("svg-align"), buildCommon.makeSpan(["mrel", "x-arrow"], [m], e); + }, + mathmlBuilder(n, e) { + var t = stretchy.mathMLnode(n.label); + t.setAttribute("minsize", n.label.charAt(0) === "x" ? "1.75em" : "3.0em"); + var r; + if (n.body) { + var a = paddedNode(buildGroup(n.body, e)); + if (n.below) { + var l = paddedNode(buildGroup(n.below, e)); + r = new mathMLTree.MathNode("munderover", [t, l, a]); + } else + r = new mathMLTree.MathNode("mover", [t, a]); + } else if (n.below) { + var d = paddedNode(buildGroup(n.below, e)); + r = new mathMLTree.MathNode("munder", [t, d]); + } else + r = paddedNode(), r = new mathMLTree.MathNode("mover", [t, r]); + return r; + } +}); +var makeSpan = buildCommon.makeSpan; +function htmlBuilder$9(n, e) { + var t = buildExpression$1(n.body, e, !0); + return makeSpan([n.mclass], t, e); +} +function mathmlBuilder$8(n, e) { + var t, r = buildExpression(n.body, e); + return n.mclass === "minner" ? t = new mathMLTree.MathNode("mpadded", r) : n.mclass === "mord" ? n.isCharacterBox ? (t = r[0], t.type = "mi") : t = new mathMLTree.MathNode("mi", r) : (n.isCharacterBox ? (t = r[0], t.type = "mo") : t = new mathMLTree.MathNode("mo", r), n.mclass === "mbin" ? (t.attributes.lspace = "0.22em", t.attributes.rspace = "0.22em") : n.mclass === "mpunct" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0.17em") : n.mclass === "mopen" || n.mclass === "mclose" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0em") : n.mclass === "minner" && (t.attributes.lspace = "0.0556em", t.attributes.width = "+0.1111em")), t; +} +defineFunction({ + type: "mclass", + names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], + props: { + numArgs: 1, + primitive: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "mclass", + mode: t.mode, + mclass: "m" + r.slice(5), + // TODO(kevinb): don't prefix with 'm' + body: ordargument(a), + isCharacterBox: utils.isCharacterBox(a) + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8 +}); +var binrelClass = (n) => { + var e = n.type === "ordgroup" && n.body.length ? n.body[0] : n; + return e.type === "atom" && (e.family === "bin" || e.family === "rel") ? "m" + e.family : "mord"; +}; +defineFunction({ + type: "mclass", + names: ["\\@binrel"], + props: { + numArgs: 2 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "mclass", + mode: t.mode, + mclass: binrelClass(e[0]), + body: ordargument(e[1]), + isCharacterBox: utils.isCharacterBox(e[1]) + }; + } +}); +defineFunction({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { + numArgs: 2 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[1], l = e[0], d; + r !== "\\stackrel" ? d = binrelClass(a) : d = "mrel"; + var o = { + type: "op", + mode: a.mode, + limits: !0, + alwaysHandleSupSub: !0, + parentIsSupSub: !1, + symbol: !1, + suppressBaseShift: r !== "\\stackrel", + body: ordargument(a) + }, u = { + type: "supsub", + mode: l.mode, + base: o, + sup: r === "\\underset" ? null : l, + sub: r === "\\underset" ? l : null + }; + return { + type: "mclass", + mode: t.mode, + mclass: d, + body: [u], + isCharacterBox: utils.isCharacterBox(u) + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8 +}); +defineFunction({ + type: "pmb", + names: ["\\pmb"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "pmb", + mode: t.mode, + mclass: binrelClass(e[0]), + body: ordargument(e[0]) + }; + }, + htmlBuilder(n, e) { + var t = buildExpression$1(n.body, e, !0), r = buildCommon.makeSpan([n.mclass], t, e); + return r.style.textShadow = "0.02em 0.01em 0.04px", r; + }, + mathmlBuilder(n, e) { + var t = buildExpression(n.body, e), r = new mathMLTree.MathNode("mstyle", t); + return r.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"), r; + } +}); +var cdArrowFunctionName = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + A: "\\uparrow", + V: "\\downarrow", + "|": "\\Vert", + ".": "no arrow" +}, newCell = () => ({ + type: "styling", + body: [], + mode: "math", + style: "display" +}), isStartOfArrow = (n) => n.type === "textord" && n.text === "@", isLabelEnd = (n, e) => (n.type === "mathord" || n.type === "atom") && n.text === e; +function cdArrow(n, e, t) { + var r = cdArrowFunctionName[n]; + switch (r) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return t.callFunction(r, [e[0]], [e[1]]); + case "\\uparrow": + case "\\downarrow": { + var a = t.callFunction("\\\\cdleft", [e[0]], []), l = { + type: "atom", + text: r, + mode: "math", + family: "rel" + }, d = t.callFunction("\\Big", [l], []), o = t.callFunction("\\\\cdright", [e[1]], []), u = { + type: "ordgroup", + mode: "math", + body: [a, d, o] + }; + return t.callFunction("\\\\cdparent", [u], []); + } + case "\\\\cdlongequal": + return t.callFunction("\\\\cdlongequal", [], []); + case "\\Vert": { + var p = { + type: "textord", + text: "\\Vert", + mode: "math" + }; + return t.callFunction("\\Big", [p], []); + } + default: + return { + type: "textord", + text: " ", + mode: "math" + }; + } +} +function parseCD(n) { + var e = []; + for (n.gullet.beginGroup(), n.gullet.macros.set("\\cr", "\\\\\\relax"), n.gullet.beginGroup(); ; ) { + e.push(n.parseExpression(!1, "\\\\")), n.gullet.endGroup(), n.gullet.beginGroup(); + var t = n.fetch().text; + if (t === "&" || t === "\\\\") + n.consume(); + else if (t === "\\end") { + e[e.length - 1].length === 0 && e.pop(); + break; + } else + throw new ParseError("Expected \\\\ or \\cr or \\end", n.nextToken); + } + for (var r = [], a = [r], l = 0; l < e.length; l++) { + for (var d = e[l], o = newCell(), u = 0; u < d.length; u++) + if (!isStartOfArrow(d[u])) + o.body.push(d[u]); + else { + r.push(o), u += 1; + var p = assertSymbolNodeType(d[u]).text, m = new Array(2); + if (m[0] = { + type: "ordgroup", + mode: "math", + body: [] + }, m[1] = { + type: "ordgroup", + mode: "math", + body: [] + }, !("=|.".indexOf(p) > -1)) if ("<>AV".indexOf(p) > -1) + for (var y = 0; y < 2; y++) { + for (var w = !0, b = u + 1; b < d.length; b++) { + if (isLabelEnd(d[b], p)) { + w = !1, u = b; + break; + } + if (isStartOfArrow(d[b])) + throw new ParseError("Missing a " + p + " character to complete a CD arrow.", d[b]); + m[y].body.push(d[b]); + } + if (w) + throw new ParseError("Missing a " + p + " character to complete a CD arrow.", d[u]); + } + else + throw new ParseError('Expected one of "<>AV=|." after @', d[u]); + var A = cdArrow(p, m, n), f = { + type: "styling", + body: [A], + mode: "math", + style: "display" + // CD is always displaystyle. + }; + r.push(f), o = newCell(); + } + l % 2 === 0 ? r.push(o) : r.shift(), r = [], a.push(r); + } + n.gullet.endGroup(), n.gullet.endGroup(); + var s = new Array(a[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + // CD package sets \enskip between columns. + postgap: 0.25 + // So pre and post each get half an \enskip, i.e. 0.25em. + }); + return { + type: "array", + mode: "math", + body: a, + arraystretch: 1, + addJot: !0, + rowGaps: [null], + cols: s, + colSeparationType: "CD", + hLinesBeforeRow: new Array(a.length + 1).fill([]) + }; +} +defineFunction({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n; + return { + type: "cdlabel", + mode: t.mode, + side: r.slice(4), + label: e[0] + }; + }, + htmlBuilder(n, e) { + var t = e.havingStyle(e.style.sup()), r = buildCommon.wrapFragment(buildGroup$1(n.label, t, e), e); + return r.classes.push("cd-label-" + n.side), r.style.bottom = makeEm(0.8 - r.depth), r.height = 0, r.depth = 0, r; + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mrow", [buildGroup(n.label, e)]); + return t = new mathMLTree.MathNode("mpadded", [t]), t.setAttribute("width", "0"), n.side === "left" && t.setAttribute("lspace", "-1width"), t.setAttribute("voffset", "0.7em"), t = new mathMLTree.MathNode("mstyle", [t]), t.setAttribute("displaystyle", "false"), t.setAttribute("scriptlevel", "1"), t; + } +}); +defineFunction({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "cdlabelparent", + mode: t.mode, + fragment: e[0] + }; + }, + htmlBuilder(n, e) { + var t = buildCommon.wrapFragment(buildGroup$1(n.fragment, e), e); + return t.classes.push("cd-vert-arrow"), t; + }, + mathmlBuilder(n, e) { + return new mathMLTree.MathNode("mrow", [buildGroup(n.fragment, e)]); + } +}); +defineFunction({ + type: "textord", + names: ["\\@char"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + for (var { + parser: t + } = n, r = assertNodeType(e[0], "ordgroup"), a = r.body, l = "", d = 0; d < a.length; d++) { + var o = assertNodeType(a[d], "textord"); + l += o.text; + } + var u = parseInt(l), p; + if (isNaN(u)) + throw new ParseError("\\@char has non-numeric argument " + l); + if (u < 0 || u >= 1114111) + throw new ParseError("\\@char with invalid code point " + l); + return u <= 65535 ? p = String.fromCharCode(u) : (u -= 65536, p = String.fromCharCode((u >> 10) + 55296, (u & 1023) + 56320)), { + type: "textord", + mode: t.mode, + text: p + }; + } +}); +var htmlBuilder$8 = (n, e) => { + var t = buildExpression$1(n.body, e.withColor(n.color), !1); + return buildCommon.makeFragment(t); +}, mathmlBuilder$7 = (n, e) => { + var t = buildExpression(n.body, e.withColor(n.color)), r = new mathMLTree.MathNode("mstyle", t); + return r.setAttribute("mathcolor", n.color), r; +}; +defineFunction({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: !0, + argTypes: ["color", "original"] + }, + handler(n, e) { + var { + parser: t + } = n, r = assertNodeType(e[0], "color-token").color, a = e[1]; + return { + type: "color", + mode: t.mode, + color: r, + body: ordargument(a) + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7 +}); +defineFunction({ + type: "color", + names: ["\\color"], + props: { + numArgs: 1, + allowedInText: !0, + argTypes: ["color"] + }, + handler(n, e) { + var { + parser: t, + breakOnTokenText: r + } = n, a = assertNodeType(e[0], "color-token").color; + t.gullet.macros.set("\\current@color", a); + var l = t.parseExpression(!0, r); + return { + type: "color", + mode: t.mode, + color: a, + body: l + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7 +}); +defineFunction({ + type: "cr", + names: ["\\\\"], + props: { + numArgs: 0, + numOptionalArgs: 0, + allowedInText: !0 + }, + handler(n, e, t) { + var { + parser: r + } = n, a = r.gullet.future().text === "[" ? r.parseSizeGroup(!0) : null, l = !r.settings.displayMode || !r.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode"); + return { + type: "cr", + mode: r.mode, + newLine: l, + size: a && assertNodeType(a, "size").value + }; + }, + // The following builders are called only at the top level, + // not within tabular/array environments. + htmlBuilder(n, e) { + var t = buildCommon.makeSpan(["mspace"], [], e); + return n.newLine && (t.classes.push("newline"), n.size && (t.style.marginTop = makeEm(calculateSize(n.size, e)))), t; + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mspace"); + return n.newLine && (t.setAttribute("linebreak", "newline"), n.size && t.setAttribute("height", makeEm(calculateSize(n.size, e)))), t; + } +}); +var globalMap = { + "\\global": "\\global", + "\\long": "\\\\globallong", + "\\\\globallong": "\\\\globallong", + "\\def": "\\gdef", + "\\gdef": "\\gdef", + "\\edef": "\\xdef", + "\\xdef": "\\xdef", + "\\let": "\\\\globallet", + "\\futurelet": "\\\\globalfuture" +}, checkControlSequence = (n) => { + var e = n.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(e)) + throw new ParseError("Expected a control sequence", n); + return e; +}, getRHS = (n) => { + var e = n.gullet.popToken(); + return e.text === "=" && (e = n.gullet.popToken(), e.text === " " && (e = n.gullet.popToken())), e; +}, letCommand = (n, e, t, r) => { + var a = n.gullet.macros.get(t.text); + a == null && (t.noexpand = !0, a = { + tokens: [t], + numArgs: 0, + // reproduce the same behavior in expansion + unexpandable: !n.gullet.isExpandable(t.text) + }), n.gullet.macros.set(e, a, r); +}; +defineFunction({ + type: "internal", + names: [ + "\\global", + "\\long", + "\\\\globallong" + // can’t be entered directly ], - "pa-IN": [ - "hB", - "hb", - "h", - "H" + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + e.consumeSpaces(); + var r = e.fetch(); + if (globalMap[r.text]) + return (t === "\\global" || t === "\\\\globallong") && (r.text = globalMap[r.text]), assertNodeType(e.parseFunction(), "internal"); + throw new ParseError("Invalid token after macro prefix", r); + } +}); +defineFunction({ + type: "internal", + names: ["\\def", "\\gdef", "\\edef", "\\xdef"], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = e.gullet.popToken(), a = r.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(a)) + throw new ParseError("Expected a control sequence", r); + for (var l = 0, d, o = [[]]; e.gullet.future().text !== "{"; ) + if (r = e.gullet.popToken(), r.text === "#") { + if (e.gullet.future().text === "{") { + d = e.gullet.future(), o[l].push("{"); + break; + } + if (r = e.gullet.popToken(), !/^[1-9]$/.test(r.text)) + throw new ParseError('Invalid argument number "' + r.text + '"'); + if (parseInt(r.text) !== l + 1) + throw new ParseError('Argument number "' + r.text + '" out of order'); + l++, o.push([]); + } else { + if (r.text === "EOF") + throw new ParseError("Expected a macro definition"); + o[l].push(r.text); + } + var { + tokens: u + } = e.gullet.consumeArg(); + return d && u.unshift(d), (t === "\\edef" || t === "\\xdef") && (u = e.gullet.expandTokens(u), u.reverse()), e.gullet.macros.set(a, { + tokens: u, + numArgs: l, + delimiters: o + }, t === globalMap[t]), { + type: "internal", + mode: e.mode + }; + } +}); +defineFunction({ + type: "internal", + names: [ + "\\let", + "\\\\globallet" + // can’t be entered directly ], - TW: [ - "hB", - "hb", - "h", - "H" + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = checkControlSequence(e.gullet.popToken()); + e.gullet.consumeSpaces(); + var a = getRHS(e); + return letCommand(e, r, a, t === "\\\\globallet"), { + type: "internal", + mode: e.mode + }; + } +}); +defineFunction({ + type: "internal", + names: [ + "\\futurelet", + "\\\\globalfuture" + // can’t be entered directly ], - KE: [ - "hB", - "hb", - "H", - "h" + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = checkControlSequence(e.gullet.popToken()), a = e.gullet.popToken(), l = e.gullet.popToken(); + return letCommand(e, r, l, t === "\\\\globalfuture"), e.gullet.pushToken(l), e.gullet.pushToken(a), { + type: "internal", + mode: e.mode + }; + } +}); +var getMetrics = function(e, t, r) { + var a = symbols.math[e] && symbols.math[e].replace, l = getCharacterMetrics(a || e, t, r); + if (!l) + throw new Error("Unsupported symbol " + e + " and font size " + t + "."); + return l; +}, styleWrap = function(e, t, r, a) { + var l = r.havingBaseStyle(t), d = buildCommon.makeSpan(a.concat(l.sizingClasses(r)), [e], r), o = l.sizeMultiplier / r.sizeMultiplier; + return d.height *= o, d.depth *= o, d.maxFontSize = l.sizeMultiplier, d; +}, centerSpan = function(e, t, r) { + var a = t.havingBaseStyle(r), l = (1 - t.sizeMultiplier / a.sizeMultiplier) * t.fontMetrics().axisHeight; + e.classes.push("delimcenter"), e.style.top = makeEm(l), e.height -= l, e.depth += l; +}, makeSmallDelim = function(e, t, r, a, l, d) { + var o = buildCommon.makeSymbol(e, "Main-Regular", l, a), u = styleWrap(o, t, a, d); + return r && centerSpan(u, a, t), u; +}, mathrmSize = function(e, t, r, a) { + return buildCommon.makeSymbol(e, "Size" + t + "-Regular", r, a); +}, makeLargeDelim = function(e, t, r, a, l, d) { + var o = mathrmSize(e, t, l, a), u = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + t], [o], a), Style$1.TEXT, a, d); + return r && centerSpan(u, a, Style$1.TEXT), u; +}, makeGlyphSpan = function(e, t, r) { + var a; + t === "Size1-Regular" ? a = "delim-size1" : a = "delim-size4"; + var l = buildCommon.makeSpan(["delimsizinginner", a], [buildCommon.makeSpan([], [buildCommon.makeSymbol(e, t, r)])]); + return { + type: "elem", + elem: l + }; +}, makeInner = function(e, t, r) { + var a = fontMetricsData["Size4-Regular"][e.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][e.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][e.charCodeAt(0)][4], l = new PathNode("inner", innerPath(e, Math.round(1e3 * t))), d = new SvgNode([l], { + width: makeEm(a), + height: makeEm(t), + // Override CSS rule `.katex svg { width: 100% }` + style: "width:" + makeEm(a), + viewBox: "0 0 " + 1e3 * a + " " + Math.round(1e3 * t), + preserveAspectRatio: "xMinYMin" + }), o = buildCommon.makeSvgSpan([], [d], r); + return o.height = t, o.style.height = makeEm(t), o.style.width = makeEm(a), { + type: "elem", + elem: o + }; +}, lapInEms = 8e-3, lap = { + type: "kern", + size: -1 * lapInEms +}, verts = ["|", "\\lvert", "\\rvert", "\\vert"], doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"], makeStackedDelim = function(e, t, r, a, l, d) { + var o, u, p, m, y = "", w = 0; + o = p = m = e, u = null; + var b = "Size1-Regular"; + e === "\\uparrow" ? p = m = "⏐" : e === "\\Uparrow" ? p = m = "‖" : e === "\\downarrow" ? o = p = "⏐" : e === "\\Downarrow" ? o = p = "‖" : e === "\\updownarrow" ? (o = "\\uparrow", p = "⏐", m = "\\downarrow") : e === "\\Updownarrow" ? (o = "\\Uparrow", p = "‖", m = "\\Downarrow") : utils.contains(verts, e) ? (p = "∣", y = "vert", w = 333) : utils.contains(doubleVerts, e) ? (p = "∥", y = "doublevert", w = 556) : e === "[" || e === "\\lbrack" ? (o = "⎡", p = "⎢", m = "⎣", b = "Size4-Regular", y = "lbrack", w = 667) : e === "]" || e === "\\rbrack" ? (o = "⎤", p = "⎥", m = "⎦", b = "Size4-Regular", y = "rbrack", w = 667) : e === "\\lfloor" || e === "⌊" ? (p = o = "⎢", m = "⎣", b = "Size4-Regular", y = "lfloor", w = 667) : e === "\\lceil" || e === "⌈" ? (o = "⎡", p = m = "⎢", b = "Size4-Regular", y = "lceil", w = 667) : e === "\\rfloor" || e === "⌋" ? (p = o = "⎥", m = "⎦", b = "Size4-Regular", y = "rfloor", w = 667) : e === "\\rceil" || e === "⌉" ? (o = "⎤", p = m = "⎥", b = "Size4-Regular", y = "rceil", w = 667) : e === "(" || e === "\\lparen" ? (o = "⎛", p = "⎜", m = "⎝", b = "Size4-Regular", y = "lparen", w = 875) : e === ")" || e === "\\rparen" ? (o = "⎞", p = "⎟", m = "⎠", b = "Size4-Regular", y = "rparen", w = 875) : e === "\\{" || e === "\\lbrace" ? (o = "⎧", u = "⎨", m = "⎩", p = "⎪", b = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (o = "⎫", u = "⎬", m = "⎭", p = "⎪", b = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (o = "⎧", m = "⎩", p = "⎪", b = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (o = "⎫", m = "⎭", p = "⎪", b = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (o = "⎧", m = "⎭", p = "⎪", b = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (o = "⎫", m = "⎩", p = "⎪", b = "Size4-Regular"); + var A = getMetrics(o, b, l), f = A.height + A.depth, s = getMetrics(p, b, l), h = s.height + s.depth, _ = getMetrics(m, b, l), g = _.height + _.depth, x = 0, c = 1; + if (u !== null) { + var v = getMetrics(u, b, l); + x = v.height + v.depth, c = 2; + } + var M = f + g + x, E = Math.max(0, Math.ceil((t - M) / (c * h))), $ = M + E * c * h, k = a.fontMetrics().axisHeight; + r && (k *= a.sizeMultiplier); + var L = $ / 2 - k, z = []; + if (y.length > 0) { + var O = $ - f - g, R = Math.round($ * 1e3), P = tallDelim(y, Math.round(O * 1e3)), U = new PathNode(y, P), B = (w / 1e3).toFixed(3) + "em", N = (R / 1e3).toFixed(3) + "em", G = new SvgNode([U], { + width: B, + height: N, + viewBox: "0 0 " + w + " " + R + }), H = buildCommon.makeSvgSpan([], [G], a); + H.height = R / 1e3, H.style.width = B, H.style.height = N, z.push({ + type: "elem", + elem: H + }); + } else { + if (z.push(makeGlyphSpan(m, b, l)), z.push(lap), u === null) { + var W = $ - f - g + 2 * lapInEms; + z.push(makeInner(p, W, a)); + } else { + var V = ($ - f - g - x) / 2 + 2 * lapInEms; + z.push(makeInner(p, V, a)), z.push(lap), z.push(makeGlyphSpan(u, b, l)), z.push(lap), z.push(makeInner(p, V, a)); + } + z.push(lap), z.push(makeGlyphSpan(o, b, l)); + } + var re = a.havingBaseStyle(Style$1.TEXT), ie = buildCommon.makeVList({ + positionType: "bottom", + positionData: L, + children: z + }, re); + return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [ie], re), Style$1.TEXT, a, d); +}, vbPad = 80, emPad = 0.08, sqrtSvg = function(e, t, r, a, l) { + var d = sqrtPath(e, a, r), o = new PathNode(e, d), u = new SvgNode([o], { + // Note: 1000:1 ratio of viewBox to document em width. + width: "400em", + height: makeEm(t), + viewBox: "0 0 400000 " + r, + preserveAspectRatio: "xMinYMin slice" + }); + return buildCommon.makeSvgSpan(["hide-tail"], [u], l); +}, makeSqrtImage = function(e, t) { + var r = t.havingBaseSizing(), a = traverseSequence("\\surd", e * r.sizeMultiplier, stackLargeDelimiterSequence, r), l = r.sizeMultiplier, d = Math.max(0, t.minRuleThickness - t.fontMetrics().sqrtRuleThickness), o, u = 0, p = 0, m = 0, y; + return a.type === "small" ? (m = 1e3 + 1e3 * d + vbPad, e < 1 ? l = 1 : e < 1.4 && (l = 0.7), u = (1 + d + emPad) / l, p = (1 + d) / l, o = sqrtSvg("sqrtMain", u, m, d, t), o.style.minWidth = "0.853em", y = 0.833 / l) : a.type === "large" ? (m = (1e3 + vbPad) * sizeToMaxHeight[a.size], p = (sizeToMaxHeight[a.size] + d) / l, u = (sizeToMaxHeight[a.size] + d + emPad) / l, o = sqrtSvg("sqrtSize" + a.size, u, m, d, t), o.style.minWidth = "1.02em", y = 1 / l) : (u = e + d + emPad, p = e + d, m = Math.floor(1e3 * e + d) + vbPad, o = sqrtSvg("sqrtTall", u, m, d, t), o.style.minWidth = "0.742em", y = 1.056), o.height = p, o.style.height = makeEm(u), { + span: o, + advanceWidth: y, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: (t.fontMetrics().sqrtRuleThickness + d) * l + }; +}, stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"], stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"], stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"], sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3], makeSizedDelim = function(e, t, r, a, l) { + if (e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"), utils.contains(stackLargeDelimiters, e) || utils.contains(stackNeverDelimiters, e)) + return makeLargeDelim(e, t, !1, r, a, l); + if (utils.contains(stackAlwaysDelimiters, e)) + return makeStackedDelim(e, sizeToMaxHeight[t], !1, r, a, l); + throw new ParseError("Illegal delimiter: '" + e + "'"); +}, stackNeverDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}], stackAlwaysDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "stack" +}], stackLargeDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}, { + type: "stack" +}], delimTypeToFont = function(e) { + if (e.type === "small") + return "Main-Regular"; + if (e.type === "large") + return "Size" + e.size + "-Regular"; + if (e.type === "stack") + return "Size4-Regular"; + throw new Error("Add support for delim type '" + e.type + "' here."); +}, traverseSequence = function(e, t, r, a) { + for (var l = Math.min(2, 3 - a.style.size), d = l; d < r.length && r[d].type !== "stack"; d++) { + var o = getMetrics(e, delimTypeToFont(r[d]), "math"), u = o.height + o.depth; + if (r[d].type === "small") { + var p = a.havingBaseStyle(r[d].style); + u *= p.sizeMultiplier; + } + if (u > t) + return r[d]; + } + return r[r.length - 1]; +}, makeCustomSizedDelim = function(e, t, r, a, l, d) { + e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"); + var o; + utils.contains(stackNeverDelimiters, e) ? o = stackNeverDelimiterSequence : utils.contains(stackLargeDelimiters, e) ? o = stackLargeDelimiterSequence : o = stackAlwaysDelimiterSequence; + var u = traverseSequence(e, t, o, a); + return u.type === "small" ? makeSmallDelim(e, u.style, r, a, l, d) : u.type === "large" ? makeLargeDelim(e, u.size, r, a, l, d) : makeStackedDelim(e, t, r, a, l, d); +}, makeLeftRightDelim = function(e, t, r, a, l, d) { + var o = a.fontMetrics().axisHeight * a.sizeMultiplier, u = 901, p = 5 / a.fontMetrics().ptPerEm, m = Math.max(t - o, r + o), y = Math.max( + // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + m / 500 * u, + 2 * m - p + ); + return makeCustomSizedDelim(e, y, !0, a, l, d); +}, delimiter = { + sqrtImage: makeSqrtImage, + sizedDelim: makeSizedDelim, + sizeToMaxHeight, + customSizedDelim: makeCustomSizedDelim, + leftRightDelim: makeLeftRightDelim +}, delimiterSizes = { + "\\bigl": { + mclass: "mopen", + size: 1 + }, + "\\Bigl": { + mclass: "mopen", + size: 2 + }, + "\\biggl": { + mclass: "mopen", + size: 3 + }, + "\\Biggl": { + mclass: "mopen", + size: 4 + }, + "\\bigr": { + mclass: "mclose", + size: 1 + }, + "\\Bigr": { + mclass: "mclose", + size: 2 + }, + "\\biggr": { + mclass: "mclose", + size: 3 + }, + "\\Biggr": { + mclass: "mclose", + size: 4 + }, + "\\bigm": { + mclass: "mrel", + size: 1 + }, + "\\Bigm": { + mclass: "mrel", + size: 2 + }, + "\\biggm": { + mclass: "mrel", + size: 3 + }, + "\\Biggm": { + mclass: "mrel", + size: 4 + }, + "\\big": { + mclass: "mord", + size: 1 + }, + "\\Big": { + mclass: "mord", + size: 2 + }, + "\\bigg": { + mclass: "mord", + size: 3 + }, + "\\Bigg": { + mclass: "mord", + size: 4 + } +}, delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; +function checkDelimiter(n, e) { + var t = checkSymbolNodeType(n); + if (t && utils.contains(delimiters, t.text)) + return t; + throw t ? new ParseError("Invalid delimiter '" + t.text + "' after '" + e.funcName + "'", n) : new ParseError("Invalid delimiter type '" + n.type + "'", n); +} +defineFunction({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1, + argTypes: ["primitive"] + }, + handler: (n, e) => { + var t = checkDelimiter(e[0], n); + return { + type: "delimsizing", + mode: n.parser.mode, + size: delimiterSizes[n.funcName].size, + mclass: delimiterSizes[n.funcName].mclass, + delim: t.text + }; + }, + htmlBuilder: (n, e) => n.delim === "." ? buildCommon.makeSpan([n.mclass]) : delimiter.sizedDelim(n.delim, n.size, e, n.mode, [n.mclass]), + mathmlBuilder: (n) => { + var e = []; + n.delim !== "." && e.push(makeText(n.delim, n.mode)); + var t = new mathMLTree.MathNode("mo", e); + n.mclass === "mopen" || n.mclass === "mclose" ? t.setAttribute("fence", "true") : t.setAttribute("fence", "false"), t.setAttribute("stretchy", "true"); + var r = makeEm(delimiter.sizeToMaxHeight[n.size]); + return t.setAttribute("minsize", r), t.setAttribute("maxsize", r), t; + } +}); +function assertParsed(n) { + if (!n.body) + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); +} +defineFunction({ + type: "leftright-right", + names: ["\\right"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = n.parser.gullet.macros.get("\\current@color"); + if (t && typeof t != "string") + throw new ParseError("\\current@color set to non-string in \\right"); + return { + type: "leftright-right", + mode: n.parser.mode, + delim: checkDelimiter(e[0], n).text, + color: t + // undefined if not set via \color + }; + } +}); +defineFunction({ + type: "leftright", + names: ["\\left"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = checkDelimiter(e[0], n), r = n.parser; + ++r.leftrightDepth; + var a = r.parseExpression(!1); + --r.leftrightDepth, r.expect("\\right", !1); + var l = assertNodeType(r.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: r.mode, + body: a, + left: t.text, + right: l.delim, + rightColor: l.color + }; + }, + htmlBuilder: (n, e) => { + assertParsed(n); + for (var t = buildExpression$1(n.body, e, !0, ["mopen", "mclose"]), r = 0, a = 0, l = !1, d = 0; d < t.length; d++) + t[d].isMiddle ? l = !0 : (r = Math.max(t[d].height, r), a = Math.max(t[d].depth, a)); + r *= e.sizeMultiplier, a *= e.sizeMultiplier; + var o; + if (n.left === "." ? o = makeNullDelimiter(e, ["mopen"]) : o = delimiter.leftRightDelim(n.left, r, a, e, n.mode, ["mopen"]), t.unshift(o), l) + for (var u = 1; u < t.length; u++) { + var p = t[u], m = p.isMiddle; + m && (t[u] = delimiter.leftRightDelim(m.delim, r, a, m.options, n.mode, [])); + } + var y; + if (n.right === ".") + y = makeNullDelimiter(e, ["mclose"]); + else { + var w = n.rightColor ? e.withColor(n.rightColor) : e; + y = delimiter.leftRightDelim(n.right, r, a, w, n.mode, ["mclose"]); + } + return t.push(y), buildCommon.makeSpan(["minner"], t, e); + }, + mathmlBuilder: (n, e) => { + assertParsed(n); + var t = buildExpression(n.body, e); + if (n.left !== ".") { + var r = new mathMLTree.MathNode("mo", [makeText(n.left, n.mode)]); + r.setAttribute("fence", "true"), t.unshift(r); + } + if (n.right !== ".") { + var a = new mathMLTree.MathNode("mo", [makeText(n.right, n.mode)]); + a.setAttribute("fence", "true"), n.rightColor && a.setAttribute("mathcolor", n.rightColor), t.push(a); + } + return makeRow(t); + } +}); +defineFunction({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = checkDelimiter(e[0], n); + if (!n.parser.leftrightDepth) + throw new ParseError("\\middle without preceding \\left", t); + return { + type: "middle", + mode: n.parser.mode, + delim: t.text + }; + }, + htmlBuilder: (n, e) => { + var t; + if (n.delim === ".") + t = makeNullDelimiter(e, []); + else { + t = delimiter.sizedDelim(n.delim, 1, e, n.mode, []); + var r = { + delim: n.delim, + options: e + }; + t.isMiddle = r; + } + return t; + }, + mathmlBuilder: (n, e) => { + var t = n.delim === "\\vert" || n.delim === "|" ? makeText("|", "text") : makeText(n.delim, n.mode), r = new mathMLTree.MathNode("mo", [t]); + return r.setAttribute("fence", "true"), r.setAttribute("lspace", "0.05em"), r.setAttribute("rspace", "0.05em"), r; + } +}); +var htmlBuilder$7 = (n, e) => { + var t = buildCommon.wrapFragment(buildGroup$1(n.body, e), e), r = n.label.slice(1), a = e.sizeMultiplier, l, d = 0, o = utils.isCharacterBox(n.body); + if (r === "sout") + l = buildCommon.makeSpan(["stretchy", "sout"]), l.height = e.fontMetrics().defaultRuleThickness / a, d = -0.5 * e.fontMetrics().xHeight; + else if (r === "phase") { + var u = calculateSize({ + number: 0.6, + unit: "pt" + }, e), p = calculateSize({ + number: 0.35, + unit: "ex" + }, e), m = e.havingBaseSizing(); + a = a / m.sizeMultiplier; + var y = t.height + t.depth + u + p; + t.style.paddingLeft = makeEm(y / 2 + u); + var w = Math.floor(1e3 * y * a), b = phasePath(w), A = new SvgNode([new PathNode("phase", b)], { + width: "400em", + height: makeEm(w / 1e3), + viewBox: "0 0 400000 " + w, + preserveAspectRatio: "xMinYMin slice" + }); + l = buildCommon.makeSvgSpan(["hide-tail"], [A], e), l.style.height = makeEm(y), d = t.depth + u + p; + } else { + /cancel/.test(r) ? o || t.classes.push("cancel-pad") : r === "angl" ? t.classes.push("anglpad") : t.classes.push("boxpad"); + var f = 0, s = 0, h = 0; + /box/.test(r) ? (h = Math.max( + e.fontMetrics().fboxrule, + // default + e.minRuleThickness + // User override. + ), f = e.fontMetrics().fboxsep + (r === "colorbox" ? 0 : h), s = f) : r === "angl" ? (h = Math.max(e.fontMetrics().defaultRuleThickness, e.minRuleThickness), f = 4 * h, s = Math.max(0, 0.25 - t.depth)) : (f = o ? 0.2 : 0, s = f), l = stretchy.encloseSpan(t, r, f, s, e), /fbox|boxed|fcolorbox/.test(r) ? (l.style.borderStyle = "solid", l.style.borderWidth = makeEm(h)) : r === "angl" && h !== 0.049 && (l.style.borderTopWidth = makeEm(h), l.style.borderRightWidth = makeEm(h)), d = t.depth + s, n.backgroundColor && (l.style.backgroundColor = n.backgroundColor, n.borderColor && (l.style.borderColor = n.borderColor)); + } + var _; + if (n.backgroundColor) + _ = buildCommon.makeVList({ + positionType: "individualShift", + children: [ + // Put the color background behind inner; + { + type: "elem", + elem: l, + shift: d + }, + { + type: "elem", + elem: t, + shift: 0 + } + ] + }, e); + else { + var g = /cancel|phase/.test(r) ? ["svg-align"] : []; + _ = buildCommon.makeVList({ + positionType: "individualShift", + children: [ + // Write the \cancel stroke on top of inner. + { + type: "elem", + elem: t, + shift: 0 + }, + { + type: "elem", + elem: l, + shift: d, + wrapperClasses: g + } + ] + }, e); + } + return /cancel/.test(r) && (_.height = t.height, _.depth = t.depth), /cancel/.test(r) && !o ? buildCommon.makeSpan(["mord", "cancel-lap"], [_], e) : buildCommon.makeSpan(["mord"], [_], e); +}, mathmlBuilder$6 = (n, e) => { + var t = 0, r = new mathMLTree.MathNode(n.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup(n.body, e)]); + switch (n.label) { + case "\\cancel": + r.setAttribute("notation", "updiagonalstrike"); + break; + case "\\bcancel": + r.setAttribute("notation", "downdiagonalstrike"); + break; + case "\\phase": + r.setAttribute("notation", "phasorangle"); + break; + case "\\sout": + r.setAttribute("notation", "horizontalstrike"); + break; + case "\\fbox": + r.setAttribute("notation", "box"); + break; + case "\\angl": + r.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": + case "\\colorbox": + if (t = e.fontMetrics().fboxsep * e.fontMetrics().ptPerEm, r.setAttribute("width", "+" + 2 * t + "pt"), r.setAttribute("height", "+" + 2 * t + "pt"), r.setAttribute("lspace", t + "pt"), r.setAttribute("voffset", t + "pt"), n.label === "\\fcolorbox") { + var a = Math.max( + e.fontMetrics().fboxrule, + // default + e.minRuleThickness + // user override + ); + r.setAttribute("style", "border: " + a + "em solid " + String(n.borderColor)); + } + break; + case "\\xcancel": + r.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + return n.backgroundColor && r.setAttribute("mathbackground", n.backgroundColor), r; +}; +defineFunction({ + type: "enclose", + names: ["\\colorbox"], + props: { + numArgs: 2, + allowedInText: !0, + argTypes: ["color", "text"] + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n, l = assertNodeType(e[0], "color-token").color, d = e[1]; + return { + type: "enclose", + mode: r.mode, + label: a, + backgroundColor: l, + body: d + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 +}); +defineFunction({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: !0, + argTypes: ["color", "color", "text"] + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n, l = assertNodeType(e[0], "color-token").color, d = assertNodeType(e[1], "color-token").color, o = e[2]; + return { + type: "enclose", + mode: r.mode, + label: a, + backgroundColor: d, + borderColor: l, + body: o + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 +}); +defineFunction({ + type: "enclose", + names: ["\\fbox"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "enclose", + mode: t.mode, + label: "\\fbox", + body: e[0] + }; + } +}); +defineFunction({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "enclose", + mode: t.mode, + label: r, + body: a + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 +}); +defineFunction({ + type: "enclose", + names: ["\\angl"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: !1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "enclose", + mode: t.mode, + label: "\\angl", + body: e[0] + }; + } +}); +var _environments = {}; +function defineEnvironment(n) { + for (var { + type: e, + names: t, + props: r, + handler: a, + htmlBuilder: l, + mathmlBuilder: d + } = n, o = { + type: e, + numArgs: r.numArgs || 0, + allowedInText: !1, + numOptionalArgs: 0, + handler: a + }, u = 0; u < t.length; ++u) + _environments[t[u]] = o; + l && (_htmlGroupBuilders[e] = l), d && (_mathmlGroupBuilders[e] = d); +} +var _macros = {}; +function defineMacro(n, e) { + _macros[n] = e; +} +function getHLines(n) { + var e = []; + n.consumeSpaces(); + var t = n.fetch().text; + for (t === "\\relax" && (n.consume(), n.consumeSpaces(), t = n.fetch().text); t === "\\hline" || t === "\\hdashline"; ) + n.consume(), e.push(t === "\\hdashline"), n.consumeSpaces(), t = n.fetch().text; + return e; +} +var validateAmsEnvironmentContext = (n) => { + var e = n.parser.settings; + if (!e.displayMode) + throw new ParseError("{" + n.envName + "} can be used only in display mode."); +}; +function getAutoTag(n) { + if (n.indexOf("ed") === -1) + return n.indexOf("*") === -1; +} +function parseArray(n, e, t) { + var { + hskipBeforeAndAfter: r, + addJot: a, + cols: l, + arraystretch: d, + colSeparationType: o, + autoTag: u, + singleRow: p, + emptySingleRow: m, + maxNumCols: y, + leqno: w + } = e; + if (n.gullet.beginGroup(), p || n.gullet.macros.set("\\cr", "\\\\\\relax"), !d) { + var b = n.gullet.expandMacroAsText("\\arraystretch"); + if (b == null) + d = 1; + else if (d = parseFloat(b), !d || d < 0) + throw new ParseError("Invalid \\arraystretch: " + b); + } + n.gullet.beginGroup(); + var A = [], f = [A], s = [], h = [], _ = u != null ? [] : void 0; + function g() { + u && n.gullet.macros.set("\\@eqnsw", "1", !0); + } + function x() { + _ && (n.gullet.macros.get("\\df@tag") ? (_.push(n.subparse([new Token("\\df@tag")])), n.gullet.macros.set("\\df@tag", void 0, !0)) : _.push(!!u && n.gullet.macros.get("\\@eqnsw") === "1")); + } + for (g(), h.push(getHLines(n)); ; ) { + var c = n.parseExpression(!1, p ? "\\end" : "\\\\"); + n.gullet.endGroup(), n.gullet.beginGroup(), c = { + type: "ordgroup", + mode: n.mode, + body: c + }, t && (c = { + type: "styling", + mode: n.mode, + style: t, + body: [c] + }), A.push(c); + var v = n.fetch().text; + if (v === "&") { + if (y && A.length === y) { + if (p || o) + throw new ParseError("Too many tab characters: &", n.nextToken); + n.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument."); + } + n.consume(); + } else if (v === "\\end") { + x(), A.length === 1 && c.type === "styling" && c.body[0].body.length === 0 && (f.length > 1 || !m) && f.pop(), h.length < f.length + 1 && h.push([]); + break; + } else if (v === "\\\\") { + n.consume(); + var M = void 0; + n.gullet.future().text !== " " && (M = n.parseSizeGroup(!0)), s.push(M ? M.value : null), x(), h.push(getHLines(n)), A = [], f.push(A), g(); + } else + throw new ParseError("Expected & or \\\\ or \\cr or \\end", n.nextToken); + } + return n.gullet.endGroup(), n.gullet.endGroup(), { + type: "array", + mode: n.mode, + addJot: a, + arraystretch: d, + body: f, + cols: l, + rowGaps: s, + hskipBeforeAndAfter: r, + hLinesBeforeRow: h, + colSeparationType: o, + tags: _, + leqno: w + }; +} +function dCellStyle(n) { + return n.slice(0, 1) === "d" ? "display" : "text"; +} +var htmlBuilder$6 = function(e, t) { + var r, a, l = e.body.length, d = e.hLinesBeforeRow, o = 0, u = new Array(l), p = [], m = Math.max( + // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. + t.fontMetrics().arrayRuleWidth, + t.minRuleThickness + // User override. + ), y = 1 / t.fontMetrics().ptPerEm, w = 5 * y; + if (e.colSeparationType && e.colSeparationType === "small") { + var b = t.havingStyle(Style$1.SCRIPT).sizeMultiplier; + w = 0.2778 * (b / t.sizeMultiplier); + } + var A = e.colSeparationType === "CD" ? calculateSize({ + number: 3, + unit: "ex" + }, t) : 12 * y, f = 3 * y, s = e.arraystretch * A, h = 0.7 * s, _ = 0.3 * s, g = 0; + function x(Ue) { + for (var We = 0; We < Ue.length; ++We) + We > 0 && (g += 0.25), p.push({ + pos: g, + isDashed: Ue[We] + }); + } + for (x(d[0]), r = 0; r < e.body.length; ++r) { + var c = e.body[r], v = h, M = _; + o < c.length && (o = c.length); + var E = new Array(c.length); + for (a = 0; a < c.length; ++a) { + var $ = buildGroup$1(c[a], t); + M < $.depth && (M = $.depth), v < $.height && (v = $.height), E[a] = $; + } + var k = e.rowGaps[r], L = 0; + k && (L = calculateSize(k, t), L > 0 && (L += _, M < L && (M = L), L = 0)), e.addJot && (M += f), E.height = v, E.depth = M, g += v, E.pos = g, g += M + L, u[r] = E, x(d[r + 1]); + } + var z = g / 2 + t.fontMetrics().axisHeight, O = e.cols || [], R = [], P, U, B = []; + if (e.tags && e.tags.some((Ue) => Ue)) + for (r = 0; r < l; ++r) { + var N = u[r], G = N.pos - z, H = e.tags[r], W = void 0; + H === !0 ? W = buildCommon.makeSpan(["eqn-num"], [], t) : H === !1 ? W = buildCommon.makeSpan([], [], t) : W = buildCommon.makeSpan([], buildExpression$1(H, t, !0), t), W.depth = N.depth, W.height = N.height, B.push({ + type: "elem", + elem: W, + shift: G + }); + } + for ( + a = 0, U = 0; + // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + a < o || U < O.length; + ++a, ++U + ) { + for (var V = O[U] || {}, re = !0; V.type === "separator"; ) { + if (re || (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(t.fontMetrics().doubleRuleSep), R.push(P)), V.separator === "|" || V.separator === ":") { + var ie = V.separator === "|" ? "solid" : "dashed", ee = buildCommon.makeSpan(["vertical-separator"], [], t); + ee.style.height = makeEm(g), ee.style.borderRightWidth = makeEm(m), ee.style.borderRightStyle = ie, ee.style.margin = "0 " + makeEm(-m / 2); + var ce = g - z; + ce && (ee.style.verticalAlign = makeEm(-ce)), R.push(ee); + } else + throw new ParseError("Invalid separator type: " + V.separator); + U++, V = O[U] || {}, re = !1; + } + if (!(a >= o)) { + var he = void 0; + (a > 0 || e.hskipBeforeAndAfter) && (he = utils.deflt(V.pregap, w), he !== 0 && (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(he), R.push(P))); + var le = []; + for (r = 0; r < l; ++r) { + var J = u[r], Me = J[a]; + if (Me) { + var se = J.pos - z; + Me.depth = J.depth, Me.height = J.height, le.push({ + type: "elem", + elem: Me, + shift: se + }); + } + } + le = buildCommon.makeVList({ + positionType: "individualShift", + children: le + }, t), le = buildCommon.makeSpan(["col-align-" + (V.align || "c")], [le]), R.push(le), (a < o - 1 || e.hskipBeforeAndAfter) && (he = utils.deflt(V.postgap, w), he !== 0 && (P = buildCommon.makeSpan(["arraycolsep"], []), P.style.width = makeEm(he), R.push(P))); + } + } + if (u = buildCommon.makeSpan(["mtable"], R), p.length > 0) { + for (var Ce = buildCommon.makeLineSpan("hline", t, m), ue = buildCommon.makeLineSpan("hdashline", t, m), ne = [{ + type: "elem", + elem: u, + shift: 0 + }]; p.length > 0; ) { + var _e = p.pop(), Oe = _e.pos - z; + _e.isDashed ? ne.push({ + type: "elem", + elem: ue, + shift: Oe + }) : ne.push({ + type: "elem", + elem: Ce, + shift: Oe + }); + } + u = buildCommon.makeVList({ + positionType: "individualShift", + children: ne + }, t); + } + if (B.length === 0) + return buildCommon.makeSpan(["mord"], [u], t); + var Re = buildCommon.makeVList({ + positionType: "individualShift", + children: B + }, t); + return Re = buildCommon.makeSpan(["tag"], [Re], t), buildCommon.makeFragment([u, Re]); +}, alignMap = { + c: "center ", + l: "left ", + r: "right " +}, mathmlBuilder$5 = function(e, t) { + for (var r = [], a = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]), l = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]), d = 0; d < e.body.length; d++) { + for (var o = e.body[d], u = [], p = 0; p < o.length; p++) + u.push(new mathMLTree.MathNode("mtd", [buildGroup(o[p], t)])); + e.tags && e.tags[d] && (u.unshift(a), u.push(a), e.leqno ? u.unshift(l) : u.push(l)), r.push(new mathMLTree.MathNode("mtr", u)); + } + var m = new mathMLTree.MathNode("mtable", r), y = e.arraystretch === 0.5 ? 0.1 : 0.16 + e.arraystretch - 1 + (e.addJot ? 0.09 : 0); + m.setAttribute("rowspacing", makeEm(y)); + var w = "", b = ""; + if (e.cols && e.cols.length > 0) { + var A = e.cols, f = "", s = !1, h = 0, _ = A.length; + A[0].type === "separator" && (w += "top ", h = 1), A[A.length - 1].type === "separator" && (w += "bottom ", _ -= 1); + for (var g = h; g < _; g++) + A[g].type === "align" ? (b += alignMap[A[g].align], s && (f += "none "), s = !0) : A[g].type === "separator" && s && (f += A[g].separator === "|" ? "solid " : "dashed ", s = !1); + m.setAttribute("columnalign", b.trim()), /[sd]/.test(f) && m.setAttribute("columnlines", f.trim()); + } + if (e.colSeparationType === "align") { + for (var x = e.cols || [], c = "", v = 1; v < x.length; v++) + c += v % 2 ? "0em " : "1em "; + m.setAttribute("columnspacing", c.trim()); + } else e.colSeparationType === "alignat" || e.colSeparationType === "gather" ? m.setAttribute("columnspacing", "0em") : e.colSeparationType === "small" ? m.setAttribute("columnspacing", "0.2778em") : e.colSeparationType === "CD" ? m.setAttribute("columnspacing", "0.5em") : m.setAttribute("columnspacing", "1em"); + var M = "", E = e.hLinesBeforeRow; + w += E[0].length > 0 ? "left " : "", w += E[E.length - 1].length > 0 ? "right " : ""; + for (var $ = 1; $ < E.length - 1; $++) + M += E[$].length === 0 ? "none " : E[$][0] ? "dashed " : "solid "; + return /[sd]/.test(M) && m.setAttribute("rowlines", M.trim()), w !== "" && (m = new mathMLTree.MathNode("menclose", [m]), m.setAttribute("notation", w.trim())), e.arraystretch && e.arraystretch < 1 && (m = new mathMLTree.MathNode("mstyle", [m]), m.setAttribute("scriptlevel", "1")), m; +}, alignedHandler = function(e, t) { + e.envName.indexOf("ed") === -1 && validateAmsEnvironmentContext(e); + var r = [], a = e.envName.indexOf("at") > -1 ? "alignat" : "align", l = e.envName === "split", d = parseArray(e.parser, { + cols: r, + addJot: !0, + autoTag: l ? void 0 : getAutoTag(e.envName), + emptySingleRow: !0, + colSeparationType: a, + maxNumCols: l ? 2 : void 0, + leqno: e.parser.settings.leqno + }, "display"), o, u = 0, p = { + type: "ordgroup", + mode: e.mode, + body: [] + }; + if (t[0] && t[0].type === "ordgroup") { + for (var m = "", y = 0; y < t[0].body.length; y++) { + var w = assertNodeType(t[0].body[y], "textord"); + m += w.text; + } + o = Number(m), u = o * 2; + } + var b = !u; + d.body.forEach(function(h) { + for (var _ = 1; _ < h.length; _ += 2) { + var g = assertNodeType(h[_], "styling"), x = assertNodeType(g.body[0], "ordgroup"); + x.body.unshift(p); + } + if (b) + u < h.length && (u = h.length); + else { + var c = h.length / 2; + if (o < c) + throw new ParseError("Too many math in a row: " + ("expected " + o + ", but got " + c), h[0]); + } + }); + for (var A = 0; A < u; ++A) { + var f = "r", s = 0; + A % 2 === 1 ? f = "l" : A > 0 && b && (s = 1), r[A] = { + type: "align", + align: f, + pregap: s, + postgap: 0 + }; + } + return d.colSeparationType = b ? "align" : "alignat", d; +}; +defineEnvironment({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + handler(n, e) { + var t = checkSymbolNodeType(e[0]), r = t ? [e[0]] : assertNodeType(e[0], "ordgroup").body, a = r.map(function(d) { + var o = assertSymbolNodeType(d), u = o.text; + if ("lcr".indexOf(u) !== -1) + return { + type: "align", + align: u + }; + if (u === "|") + return { + type: "separator", + separator: "|" + }; + if (u === ":") + return { + type: "separator", + separator: ":" + }; + throw new ParseError("Unknown column alignment: " + u, d); + }), l = { + cols: a, + hskipBeforeAndAfter: !0, + // \@preamble in lttab.dtx + maxNumCols: a.length + }; + return parseArray(n.parser, l, dCellStyle(n.envName)); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + matrix: null, + pmatrix: ["(", ")"], + bmatrix: ["[", "]"], + Bmatrix: ["\\{", "\\}"], + vmatrix: ["|", "|"], + Vmatrix: ["\\Vert", "\\Vert"] + }[n.envName.replace("*", "")], t = "c", r = { + hskipBeforeAndAfter: !1, + cols: [{ + type: "align", + align: t + }] + }; + if (n.envName.charAt(n.envName.length - 1) === "*") { + var a = n.parser; + if (a.consumeSpaces(), a.fetch().text === "[") { + if (a.consume(), a.consumeSpaces(), t = a.fetch().text, "lcr".indexOf(t) === -1) + throw new ParseError("Expected l or c or r", a.nextToken); + a.consume(), a.consumeSpaces(), a.expect("]"), a.consume(), r.cols = [{ + type: "align", + align: t + }]; + } + } + var l = parseArray(n.parser, r, dCellStyle(n.envName)), d = Math.max(0, ...l.body.map((o) => o.length)); + return l.cols = new Array(d).fill({ + type: "align", + align: t + }), e ? { + type: "leftright", + mode: n.mode, + body: [l], + left: e[0], + right: e[1], + rightColor: void 0 + // \right uninfluenced by \color in array + } : l; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["smallmatrix"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + arraystretch: 0.5 + }, t = parseArray(n.parser, e, "script"); + return t.colSeparationType = "small", t; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["subarray"], + props: { + numArgs: 1 + }, + handler(n, e) { + var t = checkSymbolNodeType(e[0]), r = t ? [e[0]] : assertNodeType(e[0], "ordgroup").body, a = r.map(function(d) { + var o = assertSymbolNodeType(d), u = o.text; + if ("lc".indexOf(u) !== -1) + return { + type: "align", + align: u + }; + throw new ParseError("Unknown column alignment: " + u, d); + }); + if (a.length > 1) + throw new ParseError("{subarray} can contain only one column"); + var l = { + cols: a, + hskipBeforeAndAfter: !1, + arraystretch: 0.5 + }; + if (l = parseArray(n.parser, l, "script"), l.body.length > 0 && l.body[0].length > 1) + throw new ParseError("{subarray} can contain only one column"); + return l; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["cases", "dcases", "rcases", "drcases"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1 + /* 1em quad */ + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }, t = parseArray(n.parser, e, dCellStyle(n.envName)); + return { + type: "leftright", + mode: n.mode, + body: [t], + left: n.envName.indexOf("r") > -1 ? "." : "\\{", + right: n.envName.indexOf("r") > -1 ? "\\}" : ".", + rightColor: void 0 + }; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["align", "align*", "aligned", "split"], + props: { + numArgs: 0 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["gathered", "gather", "gather*"], + props: { + numArgs: 0 + }, + handler(n) { + utils.contains(["gather", "gather*"], n.envName) && validateAmsEnvironmentContext(n); + var e = { + cols: [{ + type: "align", + align: "c" + }], + addJot: !0, + colSeparationType: "gather", + autoTag: getAutoTag(n.envName), + emptySingleRow: !0, + leqno: n.parser.settings.leqno + }; + return parseArray(n.parser, e, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["alignat", "alignat*", "alignedat"], + props: { + numArgs: 1 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["equation", "equation*"], + props: { + numArgs: 0 + }, + handler(n) { + validateAmsEnvironmentContext(n); + var e = { + autoTag: getAutoTag(n.envName), + emptySingleRow: !0, + singleRow: !0, + maxNumCols: 1, + leqno: n.parser.settings.leqno + }; + return parseArray(n.parser, e, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineEnvironment({ + type: "array", + names: ["CD"], + props: { + numArgs: 0 + }, + handler(n) { + return validateAmsEnvironmentContext(n), parseCD(n.parser); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 +}); +defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}"); +defineMacro("\\notag", "\\nonumber"); +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\hline", "\\hdashline"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !0 + }, + handler(n, e) { + throw new ParseError(n.funcName + " valid only within array environment"); + } +}); +var environments = _environments; +defineFunction({ + type: "environment", + names: ["\\begin", "\\end"], + props: { + numArgs: 1, + argTypes: ["text"] + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + if (a.type !== "ordgroup") + throw new ParseError("Invalid environment name", a); + for (var l = "", d = 0; d < a.body.length; ++d) + l += assertNodeType(a.body[d], "textord").text; + if (r === "\\begin") { + if (!environments.hasOwnProperty(l)) + throw new ParseError("No such environment: " + l, a); + var o = environments[l], { + args: u, + optArgs: p + } = t.parseArguments("\\begin{" + l + "}", o), m = { + mode: t.mode, + envName: l, + parser: t + }, y = o.handler(m, u, p); + t.expect("\\end", !1); + var w = t.nextToken, b = assertNodeType(t.parseFunction(), "environment"); + if (b.name !== l) + throw new ParseError("Mismatch: \\begin{" + l + "} matched by \\end{" + b.name + "}", w); + return y; + } + return { + type: "environment", + mode: t.mode, + name: l, + nameGroup: a + }; + } +}); +var htmlBuilder$5 = (n, e) => { + var t = n.font, r = e.withFont(t); + return buildGroup$1(n.body, r); +}, mathmlBuilder$4 = (n, e) => { + var t = n.font, r = e.withFont(t); + return buildGroup(n.body, r); +}, fontAliases = { + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol" +}; +defineFunction({ + type: "font", + names: [ + // styles, except \boldsymbol defined below + "\\mathrm", + "\\mathit", + "\\mathbf", + "\\mathnormal", + // families + "\\mathbb", + "\\mathcal", + "\\mathfrak", + "\\mathscr", + "\\mathsf", + "\\mathtt", + // aliases, except \bm defined below + "\\Bbb", + "\\bold", + "\\frak" ], - MM: [ - "hB", - "hb", - "H", - "h" + props: { + numArgs: 1, + allowedInArgument: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = normalizeArgument(e[0]), l = r; + return l in fontAliases && (l = fontAliases[l]), { + type: "font", + mode: t.mode, + font: l.slice(1), + body: a + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4 +}); +defineFunction({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0], a = utils.isCharacterBox(r); + return { + type: "mclass", + mode: t.mode, + mclass: binrelClass(r), + body: [{ + type: "font", + mode: t.mode, + font: "boldsymbol", + body: r + }], + isCharacterBox: a + }; + } +}); +defineFunction({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r, + breakOnTokenText: a + } = n, { + mode: l + } = t, d = t.parseExpression(!0, a), o = "math" + r.slice(1); + return { + type: "font", + mode: l, + font: o, + body: { + type: "ordgroup", + mode: t.mode, + body: d + } + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4 +}); +var adjustStyle = (n, e) => { + var t = e; + return n === "display" ? t = t.id >= Style$1.SCRIPT.id ? t.text() : Style$1.DISPLAY : n === "text" && t.size === Style$1.DISPLAY.size ? t = Style$1.TEXT : n === "script" ? t = Style$1.SCRIPT : n === "scriptscript" && (t = Style$1.SCRIPTSCRIPT), t; +}, htmlBuilder$4 = (n, e) => { + var t = adjustStyle(n.size, e.style), r = t.fracNum(), a = t.fracDen(), l; + l = e.havingStyle(r); + var d = buildGroup$1(n.numer, l, e); + if (n.continued) { + var o = 8.5 / e.fontMetrics().ptPerEm, u = 3.5 / e.fontMetrics().ptPerEm; + d.height = d.height < o ? o : d.height, d.depth = d.depth < u ? u : d.depth; + } + l = e.havingStyle(a); + var p = buildGroup$1(n.denom, l, e), m, y, w; + n.hasBarLine ? (n.barSize ? (y = calculateSize(n.barSize, e), m = buildCommon.makeLineSpan("frac-line", e, y)) : m = buildCommon.makeLineSpan("frac-line", e), y = m.height, w = m.height) : (m = null, y = 0, w = e.fontMetrics().defaultRuleThickness); + var b, A, f; + t.size === Style$1.DISPLAY.size || n.size === "display" ? (b = e.fontMetrics().num1, y > 0 ? A = 3 * w : A = 7 * w, f = e.fontMetrics().denom1) : (y > 0 ? (b = e.fontMetrics().num2, A = w) : (b = e.fontMetrics().num3, A = 3 * w), f = e.fontMetrics().denom2); + var s; + if (m) { + var _ = e.fontMetrics().axisHeight; + b - d.depth - (_ + 0.5 * y) < A && (b += A - (b - d.depth - (_ + 0.5 * y))), _ - 0.5 * y - (p.height - f) < A && (f += A - (_ - 0.5 * y - (p.height - f))); + var g = -(_ - 0.5 * y); + s = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: p, + shift: f + }, { + type: "elem", + elem: m, + shift: g + }, { + type: "elem", + elem: d, + shift: -b + }] + }, e); + } else { + var h = b - d.depth - (p.height - f); + h < A && (b += 0.5 * (A - h), f += 0.5 * (A - h)), s = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: p, + shift: f + }, { + type: "elem", + elem: d, + shift: -b + }] + }, e); + } + l = e.havingStyle(t), s.height *= l.sizeMultiplier / e.sizeMultiplier, s.depth *= l.sizeMultiplier / e.sizeMultiplier; + var x; + t.size === Style$1.DISPLAY.size ? x = e.fontMetrics().delim1 : t.size === Style$1.SCRIPTSCRIPT.size ? x = e.havingStyle(Style$1.SCRIPT).fontMetrics().delim2 : x = e.fontMetrics().delim2; + var c, v; + return n.leftDelim == null ? c = makeNullDelimiter(e, ["mopen"]) : c = delimiter.customSizedDelim(n.leftDelim, x, !0, e.havingStyle(t), n.mode, ["mopen"]), n.continued ? v = buildCommon.makeSpan([]) : n.rightDelim == null ? v = makeNullDelimiter(e, ["mclose"]) : v = delimiter.customSizedDelim(n.rightDelim, x, !0, e.havingStyle(t), n.mode, ["mclose"]), buildCommon.makeSpan(["mord"].concat(l.sizingClasses(e)), [c, buildCommon.makeSpan(["mfrac"], [s]), v], e); +}, mathmlBuilder$3 = (n, e) => { + var t = new mathMLTree.MathNode("mfrac", [buildGroup(n.numer, e), buildGroup(n.denom, e)]); + if (!n.hasBarLine) + t.setAttribute("linethickness", "0px"); + else if (n.barSize) { + var r = calculateSize(n.barSize, e); + t.setAttribute("linethickness", makeEm(r)); + } + var a = adjustStyle(n.size, e.style); + if (a.size !== e.style.size) { + t = new mathMLTree.MathNode("mstyle", [t]); + var l = a.size === Style$1.DISPLAY.size ? "true" : "false"; + t.setAttribute("displaystyle", l), t.setAttribute("scriptlevel", "0"); + } + if (n.leftDelim != null || n.rightDelim != null) { + var d = []; + if (n.leftDelim != null) { + var o = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(n.leftDelim.replace("\\", ""))]); + o.setAttribute("fence", "true"), d.push(o); + } + if (d.push(t), n.rightDelim != null) { + var u = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(n.rightDelim.replace("\\", ""))]); + u.setAttribute("fence", "true"), d.push(u); + } + return makeRow(d); + } + return t; +}; +defineFunction({ + type: "genfrac", + names: [ + "\\dfrac", + "\\frac", + "\\tfrac", + "\\dbinom", + "\\binom", + "\\tbinom", + "\\\\atopfrac", + // can’t be entered directly + "\\\\bracefrac", + "\\\\brackfrac" + // ditto ], - TZ: [ - "hB", - "hb", - "H", - "h" + props: { + numArgs: 2, + allowedInArgument: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], l = e[1], d, o = null, u = null, p = "auto"; + switch (r) { + case "\\dfrac": + case "\\frac": + case "\\tfrac": + d = !0; + break; + case "\\\\atopfrac": + d = !1; + break; + case "\\dbinom": + case "\\binom": + case "\\tbinom": + d = !1, o = "(", u = ")"; + break; + case "\\\\bracefrac": + d = !1, o = "\\{", u = "\\}"; + break; + case "\\\\brackfrac": + d = !1, o = "[", u = "]"; + break; + default: + throw new Error("Unrecognized genfrac command"); + } + switch (r) { + case "\\dfrac": + case "\\dbinom": + p = "display"; + break; + case "\\tfrac": + case "\\tbinom": + p = "text"; + break; + } + return { + type: "genfrac", + mode: t.mode, + continued: !1, + numer: a, + denom: l, + hasBarLine: d, + leftDelim: o, + rightDelim: u, + size: p, + barSize: null + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 +}); +defineFunction({ + type: "genfrac", + names: ["\\cfrac"], + props: { + numArgs: 2 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], l = e[1]; + return { + type: "genfrac", + mode: t.mode, + continued: !0, + numer: a, + denom: l, + hasBarLine: !0, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null + }; + } +}); +defineFunction({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { + numArgs: 0, + infix: !0 + }, + handler(n) { + var { + parser: e, + funcName: t, + token: r + } = n, a; + switch (t) { + case "\\over": + a = "\\frac"; + break; + case "\\choose": + a = "\\binom"; + break; + case "\\atop": + a = "\\\\atopfrac"; + break; + case "\\brace": + a = "\\\\bracefrac"; + break; + case "\\brack": + a = "\\\\brackfrac"; + break; + default: + throw new Error("Unrecognized infix genfrac command"); + } + return { + type: "infix", + mode: e.mode, + replaceWith: a, + token: r + }; + } +}); +var stylArray = ["display", "text", "script", "scriptscript"], delimFromValue = function(e) { + var t = null; + return e.length > 0 && (t = e, t = t === "." ? null : t), t; +}; +defineFunction({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + allowedInArgument: !0, + argTypes: ["math", "math", "size", "text", "math", "math"] + }, + handler(n, e) { + var { + parser: t + } = n, r = e[4], a = e[5], l = normalizeArgument(e[0]), d = l.type === "atom" && l.family === "open" ? delimFromValue(l.text) : null, o = normalizeArgument(e[1]), u = o.type === "atom" && o.family === "close" ? delimFromValue(o.text) : null, p = assertNodeType(e[2], "size"), m, y = null; + p.isBlank ? m = !0 : (y = p.value, m = y.number > 0); + var w = "auto", b = e[3]; + if (b.type === "ordgroup") { + if (b.body.length > 0) { + var A = assertNodeType(b.body[0], "textord"); + w = stylArray[Number(A.text)]; + } + } else + b = assertNodeType(b, "textord"), w = stylArray[Number(b.text)]; + return { + type: "genfrac", + mode: t.mode, + numer: r, + denom: a, + continued: !1, + hasBarLine: m, + barSize: y, + leftDelim: d, + rightDelim: u, + size: w + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 +}); +defineFunction({ + type: "infix", + names: ["\\above"], + props: { + numArgs: 1, + argTypes: ["size"], + infix: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r, + token: a + } = n; + return { + type: "infix", + mode: t.mode, + replaceWith: "\\\\abovefrac", + size: assertNodeType(e[0], "size").value, + token: a + }; + } +}); +defineFunction({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { + numArgs: 3, + argTypes: ["math", "size", "math"] + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], l = assert(assertNodeType(e[1], "infix").size), d = e[2], o = l.number > 0; + return { + type: "genfrac", + mode: t.mode, + numer: a, + denom: d, + continued: !1, + hasBarLine: o, + barSize: l, + leftDelim: null, + rightDelim: null, + size: "auto" + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 +}); +var htmlBuilder$3 = (n, e) => { + var t = e.style, r, a; + n.type === "supsub" ? (r = n.sup ? buildGroup$1(n.sup, e.havingStyle(t.sup()), e) : buildGroup$1(n.sub, e.havingStyle(t.sub()), e), a = assertNodeType(n.base, "horizBrace")) : a = assertNodeType(n, "horizBrace"); + var l = buildGroup$1(a.base, e.havingBaseStyle(Style$1.DISPLAY)), d = stretchy.svgSpan(a, e), o; + if (a.isOver ? (o = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: l + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: d + }] + }, e), o.children[0].children[0].children[1].classes.push("svg-align")) : (o = buildCommon.makeVList({ + positionType: "bottom", + positionData: l.depth + 0.1 + d.height, + children: [{ + type: "elem", + elem: d + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: l + }] + }, e), o.children[0].children[0].children[0].classes.push("svg-align")), r) { + var u = buildCommon.makeSpan(["mord", a.isOver ? "mover" : "munder"], [o], e); + a.isOver ? o = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: u + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: r + }] + }, e) : o = buildCommon.makeVList({ + positionType: "bottom", + positionData: u.depth + 0.2 + r.height + r.depth, + children: [{ + type: "elem", + elem: r + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: u + }] + }, e); + } + return buildCommon.makeSpan(["mord", a.isOver ? "mover" : "munder"], [o], e); +}, mathmlBuilder$2 = (n, e) => { + var t = stretchy.mathMLnode(n.label); + return new mathMLTree.MathNode(n.isOver ? "mover" : "munder", [buildGroup(n.base, e), t]); +}; +defineFunction({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n; + return { + type: "horizBrace", + mode: t.mode, + label: r, + isOver: /^\\over/.test(r), + base: e[0] + }; + }, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$2 +}); +defineFunction({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[1], a = assertNodeType(e[0], "url").url; + return t.settings.isTrusted({ + command: "\\href", + url: a + }) ? { + type: "href", + mode: t.mode, + href: a, + body: ordargument(r) + } : t.formatUnsupportedCmd("\\href"); + }, + htmlBuilder: (n, e) => { + var t = buildExpression$1(n.body, e, !1); + return buildCommon.makeAnchor(n.href, [], t, e); + }, + mathmlBuilder: (n, e) => { + var t = buildExpressionRow(n.body, e); + return t instanceof MathNode || (t = new MathNode("mrow", [t])), t.setAttribute("href", n.href), t; + } +}); +defineFunction({ + type: "href", + names: ["\\url"], + props: { + numArgs: 1, + argTypes: ["url"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = assertNodeType(e[0], "url").url; + if (!t.settings.isTrusted({ + command: "\\url", + url: r + })) + return t.formatUnsupportedCmd("\\url"); + for (var a = [], l = 0; l < r.length; l++) { + var d = r[l]; + d === "~" && (d = "\\textasciitilde"), a.push({ + type: "textord", + mode: "text", + text: d + }); + } + var o = { + type: "text", + mode: t.mode, + font: "\\texttt", + body: a + }; + return { + type: "href", + mode: t.mode, + href: r, + body: ordargument(o) + }; + } +}); +defineFunction({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: !0, + primitive: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "hbox", + mode: t.mode, + body: ordargument(e[0]) + }; + }, + htmlBuilder(n, e) { + var t = buildExpression$1(n.body, e, !1); + return buildCommon.makeFragment(t); + }, + mathmlBuilder(n, e) { + return new mathMLTree.MathNode("mrow", buildExpression(n.body, e)); + } +}); +defineFunction({ + type: "html", + names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], + props: { + numArgs: 2, + argTypes: ["raw", "original"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r, + token: a + } = n, l = assertNodeType(e[0], "raw").string, d = e[1]; + t.settings.strict && t.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); + var o, u = {}; + switch (r) { + case "\\htmlClass": + u.class = l, o = { + command: "\\htmlClass", + class: l + }; + break; + case "\\htmlId": + u.id = l, o = { + command: "\\htmlId", + id: l + }; + break; + case "\\htmlStyle": + u.style = l, o = { + command: "\\htmlStyle", + style: l + }; + break; + case "\\htmlData": { + for (var p = l.split(","), m = 0; m < p.length; m++) { + var y = p[m].split("="); + if (y.length !== 2) + throw new ParseError("Error parsing key-value for \\htmlData"); + u["data-" + y[0].trim()] = y[1].trim(); + } + o = { + command: "\\htmlData", + attributes: u + }; + break; + } + default: + throw new Error("Unrecognized html command"); + } + return t.settings.isTrusted(o) ? { + type: "html", + mode: t.mode, + attributes: u, + body: ordargument(d) + } : t.formatUnsupportedCmd(r); + }, + htmlBuilder: (n, e) => { + var t = buildExpression$1(n.body, e, !1), r = ["enclosing"]; + n.attributes.class && r.push(...n.attributes.class.trim().split(/\s+/)); + var a = buildCommon.makeSpan(r, t, e); + for (var l in n.attributes) + l !== "class" && n.attributes.hasOwnProperty(l) && a.setAttribute(l, n.attributes[l]); + return a; + }, + mathmlBuilder: (n, e) => buildExpressionRow(n.body, e) +}); +defineFunction({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { + numArgs: 2, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n; + return { + type: "htmlmathml", + mode: t.mode, + html: ordargument(e[0]), + mathml: ordargument(e[1]) + }; + }, + htmlBuilder: (n, e) => { + var t = buildExpression$1(n.html, e, !1); + return buildCommon.makeFragment(t); + }, + mathmlBuilder: (n, e) => buildExpressionRow(n.mathml, e) +}); +var sizeData = function(e) { + if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e)) + return { + number: +e, + unit: "bp" + }; + var t = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e); + if (!t) + throw new ParseError("Invalid size: '" + e + "' in \\includegraphics"); + var r = { + number: +(t[1] + t[2]), + // sign + magnitude, cast to number + unit: t[3] + }; + if (!validUnit(r)) + throw new ParseError("Invalid unit: '" + r.unit + "' in \\includegraphics."); + return r; +}; +defineFunction({ + type: "includegraphics", + names: ["\\includegraphics"], + props: { + numArgs: 1, + numOptionalArgs: 1, + argTypes: ["raw", "url"], + allowedInText: !1 + }, + handler: (n, e, t) => { + var { + parser: r + } = n, a = { + number: 0, + unit: "em" + }, l = { + number: 0.9, + unit: "em" + }, d = { + number: 0, + unit: "em" + }, o = ""; + if (t[0]) + for (var u = assertNodeType(t[0], "raw").string, p = u.split(","), m = 0; m < p.length; m++) { + var y = p[m].split("="); + if (y.length === 2) { + var w = y[1].trim(); + switch (y[0].trim()) { + case "alt": + o = w; + break; + case "width": + a = sizeData(w); + break; + case "height": + l = sizeData(w); + break; + case "totalheight": + d = sizeData(w); + break; + default: + throw new ParseError("Invalid key: '" + y[0] + "' in \\includegraphics."); + } + } + } + var b = assertNodeType(e[0], "url").url; + return o === "" && (o = b, o = o.replace(/^.*[\\/]/, ""), o = o.substring(0, o.lastIndexOf("."))), r.settings.isTrusted({ + command: "\\includegraphics", + url: b + }) ? { + type: "includegraphics", + mode: r.mode, + alt: o, + width: a, + height: l, + totalheight: d, + src: b + } : r.formatUnsupportedCmd("\\includegraphics"); + }, + htmlBuilder: (n, e) => { + var t = calculateSize(n.height, e), r = 0; + n.totalheight.number > 0 && (r = calculateSize(n.totalheight, e) - t); + var a = 0; + n.width.number > 0 && (a = calculateSize(n.width, e)); + var l = { + height: makeEm(t + r) + }; + a > 0 && (l.width = makeEm(a)), r > 0 && (l.verticalAlign = makeEm(-r)); + var d = new Img(n.src, n.alt, l); + return d.height = t, d.depth = r, d; + }, + mathmlBuilder: (n, e) => { + var t = new mathMLTree.MathNode("mglyph", []); + t.setAttribute("alt", n.alt); + var r = calculateSize(n.height, e), a = 0; + if (n.totalheight.number > 0 && (a = calculateSize(n.totalheight, e) - r, t.setAttribute("valign", makeEm(-a))), t.setAttribute("height", makeEm(r + a)), n.width.number > 0) { + var l = calculateSize(n.width, e); + t.setAttribute("width", makeEm(l)); + } + return t.setAttribute("src", n.src), t; + } +}); +defineFunction({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + primitive: !0, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = assertNodeType(e[0], "size"); + if (t.settings.strict) { + var l = r[1] === "m", d = a.value.unit === "mu"; + l ? (d || t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " supports only mu units, " + ("not " + a.value.unit + " units")), t.mode !== "math" && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " works only in math mode")) : d && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " doesn't support mu units"); + } + return { + type: "kern", + mode: t.mode, + dimension: a.value + }; + }, + htmlBuilder(n, e) { + return buildCommon.makeGlue(n.dimension, e); + }, + mathmlBuilder(n, e) { + var t = calculateSize(n.dimension, e); + return new mathMLTree.SpaceNode(t); + } +}); +defineFunction({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "lap", + mode: t.mode, + alignment: r.slice(5), + body: a + }; + }, + htmlBuilder: (n, e) => { + var t; + n.alignment === "clap" ? (t = buildCommon.makeSpan([], [buildGroup$1(n.body, e)]), t = buildCommon.makeSpan(["inner"], [t], e)) : t = buildCommon.makeSpan(["inner"], [buildGroup$1(n.body, e)]); + var r = buildCommon.makeSpan(["fix"], []), a = buildCommon.makeSpan([n.alignment], [t, r], e), l = buildCommon.makeSpan(["strut"]); + return l.style.height = makeEm(a.height + a.depth), a.depth && (l.style.verticalAlign = makeEm(-a.depth)), a.children.unshift(l), a = buildCommon.makeSpan(["thinbox"], [a], e), buildCommon.makeSpan(["mord", "vbox"], [a], e); + }, + mathmlBuilder: (n, e) => { + var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]); + if (n.alignment !== "rlap") { + var r = n.alignment === "llap" ? "-1" : "-0.5"; + t.setAttribute("lspace", r + "width"); + } + return t.setAttribute("width", "0px"), t; + } +}); +defineFunction({ + type: "styling", + names: ["\\(", "$"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !1 + }, + handler(n, e) { + var { + funcName: t, + parser: r + } = n, a = r.mode; + r.switchMode("math"); + var l = t === "\\(" ? "\\)" : "$", d = r.parseExpression(!1, l); + return r.expect(l), r.switchMode(a), { + type: "styling", + mode: r.mode, + style: "text", + body: d + }; + } +}); +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\)", "\\]"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !1 + }, + handler(n, e) { + throw new ParseError("Mismatched " + n.funcName); + } +}); +var chooseMathStyle = (n, e) => { + switch (e.style.size) { + case Style$1.DISPLAY.size: + return n.display; + case Style$1.TEXT.size: + return n.text; + case Style$1.SCRIPT.size: + return n.script; + case Style$1.SCRIPTSCRIPT.size: + return n.scriptscript; + default: + return n.text; + } +}; +defineFunction({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4, + primitive: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n; + return { + type: "mathchoice", + mode: t.mode, + display: ordargument(e[0]), + text: ordargument(e[1]), + script: ordargument(e[2]), + scriptscript: ordargument(e[3]) + }; + }, + htmlBuilder: (n, e) => { + var t = chooseMathStyle(n, e), r = buildExpression$1(t, e, !1); + return buildCommon.makeFragment(r); + }, + mathmlBuilder: (n, e) => { + var t = chooseMathStyle(n, e); + return buildExpressionRow(t, e); + } +}); +var assembleSupSub = (n, e, t, r, a, l, d) => { + n = buildCommon.makeSpan([], [n]); + var o = t && utils.isCharacterBox(t), u, p; + if (e) { + var m = buildGroup$1(e, r.havingStyle(a.sup()), r); + p = { + elem: m, + kern: Math.max(r.fontMetrics().bigOpSpacing1, r.fontMetrics().bigOpSpacing3 - m.depth) + }; + } + if (t) { + var y = buildGroup$1(t, r.havingStyle(a.sub()), r); + u = { + elem: y, + kern: Math.max(r.fontMetrics().bigOpSpacing2, r.fontMetrics().bigOpSpacing4 - y.height) + }; + } + var w; + if (p && u) { + var b = r.fontMetrics().bigOpSpacing5 + u.elem.height + u.elem.depth + u.kern + n.depth + d; + w = buildCommon.makeVList({ + positionType: "bottom", + positionData: b, + children: [{ + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: u.elem, + marginLeft: makeEm(-l) + }, { + type: "kern", + size: u.kern + }, { + type: "elem", + elem: n + }, { + type: "kern", + size: p.kern + }, { + type: "elem", + elem: p.elem, + marginLeft: makeEm(l) + }, { + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }] + }, r); + } else if (u) { + var A = n.height - d; + w = buildCommon.makeVList({ + positionType: "top", + positionData: A, + children: [{ + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: u.elem, + marginLeft: makeEm(-l) + }, { + type: "kern", + size: u.kern + }, { + type: "elem", + elem: n + }] + }, r); + } else if (p) { + var f = n.depth + d; + w = buildCommon.makeVList({ + positionType: "bottom", + positionData: f, + children: [{ + type: "elem", + elem: n + }, { + type: "kern", + size: p.kern + }, { + type: "elem", + elem: p.elem, + marginLeft: makeEm(l) + }, { + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }] + }, r); + } else + return n; + var s = [w]; + if (u && l !== 0 && !o) { + var h = buildCommon.makeSpan(["mspace"], [], r); + h.style.marginRight = makeEm(l), s.unshift(h); + } + return buildCommon.makeSpan(["mop", "op-limits"], s, r); +}, noSuccessor = ["\\smallint"], htmlBuilder$2 = (n, e) => { + var t, r, a = !1, l; + n.type === "supsub" ? (t = n.sup, r = n.sub, l = assertNodeType(n.base, "op"), a = !0) : l = assertNodeType(n, "op"); + var d = e.style, o = !1; + d.size === Style$1.DISPLAY.size && l.symbol && !utils.contains(noSuccessor, l.name) && (o = !0); + var u; + if (l.symbol) { + var p = o ? "Size2-Regular" : "Size1-Regular", m = ""; + if ((l.name === "\\oiint" || l.name === "\\oiiint") && (m = l.name.slice(1), l.name = m === "oiint" ? "\\iint" : "\\iiint"), u = buildCommon.makeSymbol(l.name, p, "math", e, ["mop", "op-symbol", o ? "large-op" : "small-op"]), m.length > 0) { + var y = u.italic, w = buildCommon.staticSvg(m + "Size" + (o ? "2" : "1"), e); + u = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: u, + shift: 0 + }, { + type: "elem", + elem: w, + shift: o ? 0.08 : 0 + }] + }, e), l.name = "\\" + m, u.classes.unshift("mop"), u.italic = y; + } + } else if (l.body) { + var b = buildExpression$1(l.body, e, !0); + b.length === 1 && b[0] instanceof SymbolNode ? (u = b[0], u.classes[0] = "mop") : u = buildCommon.makeSpan(["mop"], b, e); + } else { + for (var A = [], f = 1; f < l.name.length; f++) + A.push(buildCommon.mathsym(l.name[f], l.mode, e)); + u = buildCommon.makeSpan(["mop"], A, e); + } + var s = 0, h = 0; + return (u instanceof SymbolNode || l.name === "\\oiint" || l.name === "\\oiiint") && !l.suppressBaseShift && (s = (u.height - u.depth) / 2 - e.fontMetrics().axisHeight, h = u.italic), a ? assembleSupSub(u, t, r, e, d, h, s) : (s && (u.style.position = "relative", u.style.top = makeEm(s)), u); +}, mathmlBuilder$1 = (n, e) => { + var t; + if (n.symbol) + t = new MathNode("mo", [makeText(n.name, n.mode)]), utils.contains(noSuccessor, n.name) && t.setAttribute("largeop", "false"); + else if (n.body) + t = new MathNode("mo", buildExpression(n.body, e)); + else { + t = new MathNode("mi", [new TextNode(n.name.slice(1))]); + var r = new MathNode("mo", [makeText("⁡", "text")]); + n.parentIsSupSub ? t = new MathNode("mrow", [t, r]) : t = newDocumentFragment([t, r]); + } + return t; +}, singleCharBigOps = { + "∏": "\\prod", + "∐": "\\coprod", + "∑": "\\sum", + "⋀": "\\bigwedge", + "⋁": "\\bigvee", + "⋂": "\\bigcap", + "⋃": "\\bigcup", + "⨀": "\\bigodot", + "⨁": "\\bigoplus", + "⨂": "\\bigotimes", + "⨄": "\\biguplus", + "⨆": "\\bigsqcup" +}; +defineFunction({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"], + props: { + numArgs: 0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = r; + return a.length === 1 && (a = singleCharBigOps[a]), { + type: "op", + mode: t.mode, + limits: !0, + parentIsSupSub: !1, + symbol: !0, + name: a + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 +}); +defineFunction({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "op", + mode: t.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !1, + body: ordargument(r) + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 +}); +var singleCharIntegrals = { + "∫": "\\int", + "∬": "\\iint", + "∭": "\\iiint", + "∮": "\\oint", + "∯": "\\oiint", + "∰": "\\oiiint" +}; +defineFunction({ + type: "op", + names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + return { + type: "op", + mode: e.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !1, + name: t + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 +}); +defineFunction({ + type: "op", + names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + return { + type: "op", + mode: e.mode, + limits: !0, + parentIsSupSub: !1, + symbol: !1, + name: t + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 +}); +defineFunction({ + type: "op", + names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = t; + return r.length === 1 && (r = singleCharIntegrals[r]), { + type: "op", + mode: e.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !0, + name: r + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 +}); +var htmlBuilder$1 = (n, e) => { + var t, r, a = !1, l; + n.type === "supsub" ? (t = n.sup, r = n.sub, l = assertNodeType(n.base, "operatorname"), a = !0) : l = assertNodeType(n, "operatorname"); + var d; + if (l.body.length > 0) { + for (var o = l.body.map((y) => { + var w = y.text; + return typeof w == "string" ? { + type: "textord", + mode: y.mode, + text: w + } : y; + }), u = buildExpression$1(o, e.withFont("mathrm"), !0), p = 0; p < u.length; p++) { + var m = u[p]; + m instanceof SymbolNode && (m.text = m.text.replace(/\u2212/, "-").replace(/\u2217/, "*")); + } + d = buildCommon.makeSpan(["mop"], u, e); + } else + d = buildCommon.makeSpan(["mop"], [], e); + return a ? assembleSupSub(d, t, r, e, e.style, 0, 0) : d; +}, mathmlBuilder = (n, e) => { + for (var t = buildExpression(n.body, e.withFont("mathrm")), r = !0, a = 0; a < t.length; a++) { + var l = t[a]; + if (!(l instanceof mathMLTree.SpaceNode)) if (l instanceof mathMLTree.MathNode) + switch (l.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + case "mo": { + var d = l.children[0]; + l.children.length === 1 && d instanceof mathMLTree.TextNode ? d.text = d.text.replace(/\u2212/, "-").replace(/\u2217/, "*") : r = !1; + break; + } + default: + r = !1; + } + else + r = !1; + } + if (r) { + var o = t.map((m) => m.toText()).join(""); + t = [new mathMLTree.TextNode(o)]; + } + var u = new mathMLTree.MathNode("mi", t); + u.setAttribute("mathvariant", "normal"); + var p = new mathMLTree.MathNode("mo", [makeText("⁡", "text")]); + return n.parentIsSupSub ? new mathMLTree.MathNode("mrow", [u, p]) : mathMLTree.newDocumentFragment([u, p]); +}; +defineFunction({ + type: "operatorname", + names: ["\\operatorname@", "\\operatornamewithlimits"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "operatorname", + mode: t.mode, + body: ordargument(a), + alwaysHandleSupSub: r === "\\operatornamewithlimits", + limits: !1, + parentIsSupSub: !1 + }; + }, + htmlBuilder: htmlBuilder$1, + mathmlBuilder +}); +defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@"); +defineFunctionBuilders({ + type: "ordgroup", + htmlBuilder(n, e) { + return n.semisimple ? buildCommon.makeFragment(buildExpression$1(n.body, e, !1)) : buildCommon.makeSpan(["mord"], buildExpression$1(n.body, e, !0), e); + }, + mathmlBuilder(n, e) { + return buildExpressionRow(n.body, e, !0); + } +}); +defineFunction({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t + } = n, r = e[0]; + return { + type: "overline", + mode: t.mode, + body: r + }; + }, + htmlBuilder(n, e) { + var t = buildGroup$1(n.body, e.havingCrampedStyle()), r = buildCommon.makeLineSpan("overline-line", e), a = e.fontMetrics().defaultRuleThickness, l = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }, { + type: "kern", + size: 3 * a + }, { + type: "elem", + elem: r + }, { + type: "kern", + size: a + }] + }, e); + return buildCommon.makeSpan(["mord", "overline"], [l], e); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]); + t.setAttribute("stretchy", "true"); + var r = new mathMLTree.MathNode("mover", [buildGroup(n.body, e), t]); + return r.setAttribute("accent", "true"), r; + } +}); +defineFunction({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "phantom", + mode: t.mode, + body: ordargument(r) + }; + }, + htmlBuilder: (n, e) => { + var t = buildExpression$1(n.body, e.withPhantom(), !1); + return buildCommon.makeFragment(t); + }, + mathmlBuilder: (n, e) => { + var t = buildExpression(n.body, e); + return new mathMLTree.MathNode("mphantom", t); + } +}); +defineFunction({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "hphantom", + mode: t.mode, + body: r + }; + }, + htmlBuilder: (n, e) => { + var t = buildCommon.makeSpan([], [buildGroup$1(n.body, e.withPhantom())]); + if (t.height = 0, t.depth = 0, t.children) + for (var r = 0; r < t.children.length; r++) + t.children[r].height = 0, t.children[r].depth = 0; + return t = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }] + }, e), buildCommon.makeSpan(["mord"], [t], e); + }, + mathmlBuilder: (n, e) => { + var t = buildExpression(ordargument(n.body), e), r = new mathMLTree.MathNode("mphantom", t), a = new mathMLTree.MathNode("mpadded", [r]); + return a.setAttribute("height", "0px"), a.setAttribute("depth", "0px"), a; + } +}); +defineFunction({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "vphantom", + mode: t.mode, + body: r + }; + }, + htmlBuilder: (n, e) => { + var t = buildCommon.makeSpan(["inner"], [buildGroup$1(n.body, e.withPhantom())]), r = buildCommon.makeSpan(["fix"], []); + return buildCommon.makeSpan(["mord", "rlap"], [t, r], e); + }, + mathmlBuilder: (n, e) => { + var t = buildExpression(ordargument(n.body), e), r = new mathMLTree.MathNode("mphantom", t), a = new mathMLTree.MathNode("mpadded", [r]); + return a.setAttribute("width", "0px"), a; + } +}); +defineFunction({ + type: "raisebox", + names: ["\\raisebox"], + props: { + numArgs: 2, + argTypes: ["size", "hbox"], + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n, r = assertNodeType(e[0], "size").value, a = e[1]; + return { + type: "raisebox", + mode: t.mode, + dy: r, + body: a + }; + }, + htmlBuilder(n, e) { + var t = buildGroup$1(n.body, e), r = calculateSize(n.dy, e); + return buildCommon.makeVList({ + positionType: "shift", + positionData: -r, + children: [{ + type: "elem", + elem: t + }] + }, e); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]), r = n.dy.number + n.dy.unit; + return t.setAttribute("voffset", r), t; + } +}); +defineFunction({ + type: "internal", + names: ["\\relax"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n) { + var { + parser: e + } = n; + return { + type: "internal", + mode: e.mode + }; + } +}); +defineFunction({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + argTypes: ["size", "size", "size"] + }, + handler(n, e, t) { + var { + parser: r + } = n, a = t[0], l = assertNodeType(e[0], "size"), d = assertNodeType(e[1], "size"); + return { + type: "rule", + mode: r.mode, + shift: a && assertNodeType(a, "size").value, + width: l.value, + height: d.value + }; + }, + htmlBuilder(n, e) { + var t = buildCommon.makeSpan(["mord", "rule"], [], e), r = calculateSize(n.width, e), a = calculateSize(n.height, e), l = n.shift ? calculateSize(n.shift, e) : 0; + return t.style.borderRightWidth = makeEm(r), t.style.borderTopWidth = makeEm(a), t.style.bottom = makeEm(l), t.width = r, t.height = a + l, t.depth = -l, t.maxFontSize = a * 1.125 * e.sizeMultiplier, t; + }, + mathmlBuilder(n, e) { + var t = calculateSize(n.width, e), r = calculateSize(n.height, e), a = n.shift ? calculateSize(n.shift, e) : 0, l = e.color && e.getColor() || "black", d = new mathMLTree.MathNode("mspace"); + d.setAttribute("mathbackground", l), d.setAttribute("width", makeEm(t)), d.setAttribute("height", makeEm(r)); + var o = new mathMLTree.MathNode("mpadded", [d]); + return a >= 0 ? o.setAttribute("height", makeEm(a)) : (o.setAttribute("height", makeEm(a)), o.setAttribute("depth", makeEm(-a))), o.setAttribute("voffset", makeEm(a)), o; + } +}); +function sizingGroup(n, e, t) { + for (var r = buildExpression$1(n, e, !1), a = e.sizeMultiplier / t.sizeMultiplier, l = 0; l < r.length; l++) { + var d = r[l].classes.indexOf("sizing"); + d < 0 ? Array.prototype.push.apply(r[l].classes, e.sizingClasses(t)) : r[l].classes[d + 1] === "reset-size" + e.size && (r[l].classes[d + 1] = "reset-size" + t.size), r[l].height *= a, r[l].depth *= a; + } + return buildCommon.makeFragment(r); +} +var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], htmlBuilder = (n, e) => { + var t = e.havingSize(n.size); + return sizingGroup(n.body, t, e); +}; +defineFunction({ + type: "sizing", + names: sizeFuncs, + props: { + numArgs: 0, + allowedInText: !0 + }, + handler: (n, e) => { + var { + breakOnTokenText: t, + funcName: r, + parser: a + } = n, l = a.parseExpression(!1, t); + return { + type: "sizing", + mode: a.mode, + // Figure out what size to use based on the list of functions above + size: sizeFuncs.indexOf(r) + 1, + body: l + }; + }, + htmlBuilder, + mathmlBuilder: (n, e) => { + var t = e.havingSize(n.size), r = buildExpression(n.body, t), a = new mathMLTree.MathNode("mstyle", r); + return a.setAttribute("mathsize", makeEm(t.sizeMultiplier)), a; + } +}); +defineFunction({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: !0 + }, + handler: (n, e, t) => { + var { + parser: r + } = n, a = !1, l = !1, d = t[0] && assertNodeType(t[0], "ordgroup"); + if (d) + for (var o = "", u = 0; u < d.body.length; ++u) { + var p = d.body[u]; + if (o = p.text, o === "t") + a = !0; + else if (o === "b") + l = !0; + else { + a = !1, l = !1; + break; + } + } + else + a = !0, l = !0; + var m = e[0]; + return { + type: "smash", + mode: r.mode, + body: m, + smashHeight: a, + smashDepth: l + }; + }, + htmlBuilder: (n, e) => { + var t = buildCommon.makeSpan([], [buildGroup$1(n.body, e)]); + if (!n.smashHeight && !n.smashDepth) + return t; + if (n.smashHeight && (t.height = 0, t.children)) + for (var r = 0; r < t.children.length; r++) + t.children[r].height = 0; + if (n.smashDepth && (t.depth = 0, t.children)) + for (var a = 0; a < t.children.length; a++) + t.children[a].depth = 0; + var l = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }] + }, e); + return buildCommon.makeSpan(["mord"], [l], e); + }, + mathmlBuilder: (n, e) => { + var t = new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)]); + return n.smashHeight && t.setAttribute("height", "0px"), n.smashDepth && t.setAttribute("depth", "0px"), t; + } +}); +defineFunction({ + type: "sqrt", + names: ["\\sqrt"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(n, e, t) { + var { + parser: r + } = n, a = t[0], l = e[0]; + return { + type: "sqrt", + mode: r.mode, + body: l, + index: a + }; + }, + htmlBuilder(n, e) { + var t = buildGroup$1(n.body, e.havingCrampedStyle()); + t.height === 0 && (t.height = e.fontMetrics().xHeight), t = buildCommon.wrapFragment(t, e); + var r = e.fontMetrics(), a = r.defaultRuleThickness, l = a; + e.style.id < Style$1.TEXT.id && (l = e.fontMetrics().xHeight); + var d = a + l / 4, o = t.height + t.depth + d + a, { + span: u, + ruleWidth: p, + advanceWidth: m + } = delimiter.sqrtImage(o, e), y = u.height - p; + y > t.height + t.depth + d && (d = (d + y - t.height - t.depth) / 2); + var w = u.height - t.height - d - p; + t.style.paddingLeft = makeEm(m); + var b = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: -(t.height + w) + }, { + type: "elem", + elem: u + }, { + type: "kern", + size: p + }] + }, e); + if (n.index) { + var A = e.havingStyle(Style$1.SCRIPTSCRIPT), f = buildGroup$1(n.index, A, e), s = 0.6 * (b.height - b.depth), h = buildCommon.makeVList({ + positionType: "shift", + positionData: -s, + children: [{ + type: "elem", + elem: f + }] + }, e), _ = buildCommon.makeSpan(["root"], [h]); + return buildCommon.makeSpan(["mord", "sqrt"], [_, b], e); + } else + return buildCommon.makeSpan(["mord", "sqrt"], [b], e); + }, + mathmlBuilder(n, e) { + var { + body: t, + index: r + } = n; + return r ? new mathMLTree.MathNode("mroot", [buildGroup(t, e), buildGroup(r, e)]) : new mathMLTree.MathNode("msqrt", [buildGroup(t, e)]); + } +}); +var styleMap = { + display: Style$1.DISPLAY, + text: Style$1.TEXT, + script: Style$1.SCRIPT, + scriptscript: Style$1.SCRIPTSCRIPT +}; +defineFunction({ + type: "styling", + names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n, e) { + var { + breakOnTokenText: t, + funcName: r, + parser: a + } = n, l = a.parseExpression(!0, t), d = r.slice(1, r.length - 5); + return { + type: "styling", + mode: a.mode, + // Figure out what style to use by pulling out the style from + // the function name + style: d, + body: l + }; + }, + htmlBuilder(n, e) { + var t = styleMap[n.style], r = e.havingStyle(t).withFont(""); + return sizingGroup(n.body, r, e); + }, + mathmlBuilder(n, e) { + var t = styleMap[n.style], r = e.havingStyle(t), a = buildExpression(n.body, r), l = new mathMLTree.MathNode("mstyle", a), d = { + display: ["0", "true"], + text: ["0", "false"], + script: ["1", "false"], + scriptscript: ["2", "false"] + }, o = d[n.style]; + return l.setAttribute("scriptlevel", o[0]), l.setAttribute("displaystyle", o[1]), l; + } +}); +var htmlBuilderDelegate = function(e, t) { + var r = e.base; + if (r) + if (r.type === "op") { + var a = r.limits && (t.style.size === Style$1.DISPLAY.size || r.alwaysHandleSupSub); + return a ? htmlBuilder$2 : null; + } else if (r.type === "operatorname") { + var l = r.alwaysHandleSupSub && (t.style.size === Style$1.DISPLAY.size || r.limits); + return l ? htmlBuilder$1 : null; + } else { + if (r.type === "accent") + return utils.isCharacterBox(r.base) ? htmlBuilder$a : null; + if (r.type === "horizBrace") { + var d = !e.sub; + return d === r.isOver ? htmlBuilder$3 : null; + } else + return null; + } + else return null; +}; +defineFunctionBuilders({ + type: "supsub", + htmlBuilder(n, e) { + var t = htmlBuilderDelegate(n, e); + if (t) + return t(n, e); + var { + base: r, + sup: a, + sub: l + } = n, d = buildGroup$1(r, e), o, u, p = e.fontMetrics(), m = 0, y = 0, w = r && utils.isCharacterBox(r); + if (a) { + var b = e.havingStyle(e.style.sup()); + o = buildGroup$1(a, b, e), w || (m = d.height - b.fontMetrics().supDrop * b.sizeMultiplier / e.sizeMultiplier); + } + if (l) { + var A = e.havingStyle(e.style.sub()); + u = buildGroup$1(l, A, e), w || (y = d.depth + A.fontMetrics().subDrop * A.sizeMultiplier / e.sizeMultiplier); + } + var f; + e.style === Style$1.DISPLAY ? f = p.sup1 : e.style.cramped ? f = p.sup3 : f = p.sup2; + var s = e.sizeMultiplier, h = makeEm(0.5 / p.ptPerEm / s), _ = null; + if (u) { + var g = n.base && n.base.type === "op" && n.base.name && (n.base.name === "\\oiint" || n.base.name === "\\oiiint"); + (d instanceof SymbolNode || g) && (_ = makeEm(-d.italic)); + } + var x; + if (o && u) { + m = Math.max(m, f, o.depth + 0.25 * p.xHeight), y = Math.max(y, p.sub2); + var c = p.defaultRuleThickness, v = 4 * c; + if (m - o.depth - (u.height - y) < v) { + y = v - (m - o.depth) + u.height; + var M = 0.8 * p.xHeight - (m - o.depth); + M > 0 && (m += M, y -= M); + } + var E = [{ + type: "elem", + elem: u, + shift: y, + marginRight: h, + marginLeft: _ + }, { + type: "elem", + elem: o, + shift: -m, + marginRight: h + }]; + x = buildCommon.makeVList({ + positionType: "individualShift", + children: E + }, e); + } else if (u) { + y = Math.max(y, p.sub1, u.height - 0.8 * p.xHeight); + var $ = [{ + type: "elem", + elem: u, + marginLeft: _, + marginRight: h + }]; + x = buildCommon.makeVList({ + positionType: "shift", + positionData: y, + children: $ + }, e); + } else if (o) + m = Math.max(m, f, o.depth + 0.25 * p.xHeight), x = buildCommon.makeVList({ + positionType: "shift", + positionData: -m, + children: [{ + type: "elem", + elem: o, + marginRight: h + }] + }, e); + else + throw new Error("supsub must have either sup or sub."); + var k = getTypeOfDomTree(d, "right") || "mord"; + return buildCommon.makeSpan([k], [d, buildCommon.makeSpan(["msupsub"], [x])], e); + }, + mathmlBuilder(n, e) { + var t = !1, r, a; + n.base && n.base.type === "horizBrace" && (a = !!n.sup, a === n.base.isOver && (t = !0, r = n.base.isOver)), n.base && (n.base.type === "op" || n.base.type === "operatorname") && (n.base.parentIsSupSub = !0); + var l = [buildGroup(n.base, e)]; + n.sub && l.push(buildGroup(n.sub, e)), n.sup && l.push(buildGroup(n.sup, e)); + var d; + if (t) + d = r ? "mover" : "munder"; + else if (n.sub) + if (n.sup) { + var p = n.base; + p && p.type === "op" && p.limits && e.style === Style$1.DISPLAY || p && p.type === "operatorname" && p.alwaysHandleSupSub && (e.style === Style$1.DISPLAY || p.limits) ? d = "munderover" : d = "msubsup"; + } else { + var u = n.base; + u && u.type === "op" && u.limits && (e.style === Style$1.DISPLAY || u.alwaysHandleSupSub) || u && u.type === "operatorname" && u.alwaysHandleSupSub && (u.limits || e.style === Style$1.DISPLAY) ? d = "munder" : d = "msub"; + } + else { + var o = n.base; + o && o.type === "op" && o.limits && (e.style === Style$1.DISPLAY || o.alwaysHandleSupSub) || o && o.type === "operatorname" && o.alwaysHandleSupSub && (o.limits || e.style === Style$1.DISPLAY) ? d = "mover" : d = "msup"; + } + return new mathMLTree.MathNode(d, l); + } +}); +defineFunctionBuilders({ + type: "atom", + htmlBuilder(n, e) { + return buildCommon.mathsym(n.text, n.mode, e, ["m" + n.family]); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mo", [makeText(n.text, n.mode)]); + if (n.family === "bin") { + var r = getVariant(n, e); + r === "bold-italic" && t.setAttribute("mathvariant", r); + } else n.family === "punct" ? t.setAttribute("separator", "true") : (n.family === "open" || n.family === "close") && t.setAttribute("stretchy", "false"); + return t; + } +}); +var defaultVariant = { + mi: "italic", + mn: "normal", + mtext: "normal" +}; +defineFunctionBuilders({ + type: "mathord", + htmlBuilder(n, e) { + return buildCommon.makeOrd(n, e, "mathord"); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mi", [makeText(n.text, n.mode, e)]), r = getVariant(n, e) || "italic"; + return r !== defaultVariant[t.type] && t.setAttribute("mathvariant", r), t; + } +}); +defineFunctionBuilders({ + type: "textord", + htmlBuilder(n, e) { + return buildCommon.makeOrd(n, e, "textord"); + }, + mathmlBuilder(n, e) { + var t = makeText(n.text, n.mode, e), r = getVariant(n, e) || "normal", a; + return n.mode === "text" ? a = new mathMLTree.MathNode("mtext", [t]) : /[0-9]/.test(n.text) ? a = new mathMLTree.MathNode("mn", [t]) : n.text === "\\prime" ? a = new mathMLTree.MathNode("mo", [t]) : a = new mathMLTree.MathNode("mi", [t]), r !== defaultVariant[a.type] && a.setAttribute("mathvariant", r), a; + } +}); +var cssSpace = { + "\\nobreak": "nobreak", + "\\allowbreak": "allowbreak" +}, regularSpace = { + " ": {}, + "\\ ": {}, + "~": { + className: "nobreak" + }, + "\\space": {}, + "\\nobreakspace": { + className: "nobreak" + } +}; +defineFunctionBuilders({ + type: "spacing", + htmlBuilder(n, e) { + if (regularSpace.hasOwnProperty(n.text)) { + var t = regularSpace[n.text].className || ""; + if (n.mode === "text") { + var r = buildCommon.makeOrd(n, e, "textord"); + return r.classes.push(t), r; + } else + return buildCommon.makeSpan(["mspace", t], [buildCommon.mathsym(n.text, n.mode, e)], e); + } else { + if (cssSpace.hasOwnProperty(n.text)) + return buildCommon.makeSpan(["mspace", cssSpace[n.text]], [], e); + throw new ParseError('Unknown type of space "' + n.text + '"'); + } + }, + mathmlBuilder(n, e) { + var t; + if (regularSpace.hasOwnProperty(n.text)) + t = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode(" ")]); + else { + if (cssSpace.hasOwnProperty(n.text)) + return new mathMLTree.MathNode("mspace"); + throw new ParseError('Unknown type of space "' + n.text + '"'); + } + return t; + } +}); +var pad = () => { + var n = new mathMLTree.MathNode("mtd", []); + return n.setAttribute("width", "50%"), n; +}; +defineFunctionBuilders({ + type: "tag", + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(n.body, e)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(n.tag, e)])])]); + return t.setAttribute("width", "100%"), t; + } +}); +var textFontFamilies = { + "\\text": void 0, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm" +}, textFontWeights = { + "\\textbf": "textbf", + "\\textmd": "textmd" +}, textFontShapes = { + "\\textit": "textit", + "\\textup": "textup" +}, optionsWithFont = (n, e) => { + var t = n.font; + if (t) { + if (textFontFamilies[t]) + return e.withTextFontFamily(textFontFamilies[t]); + if (textFontWeights[t]) + return e.withTextFontWeight(textFontWeights[t]); + if (t === "\\emph") + return e.fontShape === "textit" ? e.withTextFontShape("textup") : e.withTextFontShape("textit"); + } else return e; + return e.withTextFontShape(textFontShapes[t]); +}; +defineFunction({ + type: "text", + names: [ + // Font families + "\\text", + "\\textrm", + "\\textsf", + "\\texttt", + "\\textnormal", + // Font weights + "\\textbf", + "\\textmd", + // Font Shapes + "\\textit", + "\\textup", + "\\emph" ], - UG: [ - "hB", - "hb", - "H", - "h" - ] + props: { + numArgs: 1, + argTypes: ["text"], + allowedInArgument: !0, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "text", + mode: t.mode, + body: ordargument(a), + font: r + }; + }, + htmlBuilder(n, e) { + var t = optionsWithFont(n, e), r = buildExpression$1(n.body, t, !0); + return buildCommon.makeSpan(["mord", "text"], r, t); + }, + mathmlBuilder(n, e) { + var t = optionsWithFont(n, e); + return buildExpressionRow(n.body, t); + } +}); +defineFunction({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "underline", + mode: t.mode, + body: e[0] + }; + }, + htmlBuilder(n, e) { + var t = buildGroup$1(n.body, e), r = buildCommon.makeLineSpan("underline-line", e), a = e.fontMetrics().defaultRuleThickness, l = buildCommon.makeVList({ + positionType: "top", + positionData: t.height, + children: [{ + type: "kern", + size: a + }, { + type: "elem", + elem: r + }, { + type: "kern", + size: 3 * a + }, { + type: "elem", + elem: t + }] + }, e); + return buildCommon.makeSpan(["mord", "underline"], [l], e); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("‾")]); + t.setAttribute("stretchy", "true"); + var r = new mathMLTree.MathNode("munder", [buildGroup(n.body, e), t]); + return r.setAttribute("accentunder", "true"), r; + } +}); +defineFunction({ + type: "vcenter", + names: ["\\vcenter"], + props: { + numArgs: 1, + argTypes: ["original"], + // In LaTeX, \vcenter can act only on a box. + allowedInText: !1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "vcenter", + mode: t.mode, + body: e[0] + }; + }, + htmlBuilder(n, e) { + var t = buildGroup$1(n.body, e), r = e.fontMetrics().axisHeight, a = 0.5 * (t.height - r - (t.depth + r)); + return buildCommon.makeVList({ + positionType: "shift", + positionData: a, + children: [{ + type: "elem", + elem: t + }] + }, e); + }, + mathmlBuilder(n, e) { + return new mathMLTree.MathNode("mpadded", [buildGroup(n.body, e)], ["vcenter"]); + } +}); +defineFunction({ + type: "verb", + names: ["\\verb"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n, e, t) { + throw new ParseError("\\verb ended by end of line instead of matching delimiter"); + }, + htmlBuilder(n, e) { + for (var t = makeVerb(n), r = [], a = e.havingStyle(e.style.text()), l = 0; l < t.length; l++) { + var d = t[l]; + d === "~" && (d = "\\textasciitilde"), r.push(buildCommon.makeSymbol(d, "Typewriter-Regular", n.mode, a, ["mord", "texttt"])); + } + return buildCommon.makeSpan(["mord", "text"].concat(a.sizingClasses(e)), buildCommon.tryCombineChars(r), a); + }, + mathmlBuilder(n, e) { + var t = new mathMLTree.TextNode(makeVerb(n)), r = new mathMLTree.MathNode("mtext", [t]); + return r.setAttribute("mathvariant", "monospace"), r; + } +}); +var makeVerb = (n) => n.body.replace(/ /g, n.star ? "␣" : " "), functions = _functions; +defineMacro("\\noexpand", function(n) { + var e = n.popToken(); + return n.isExpandable(e.text) && (e.noexpand = !0, e.treatAsRelax = !0), { + tokens: [e], + numArgs: 0 + }; +}); +defineMacro("\\expandafter", function(n) { + var e = n.popToken(); + return n.expandOnce(!0), { + tokens: [e], + numArgs: 0 + }; +}); +defineMacro("\\@firstoftwo", function(n) { + var e = n.consumeArgs(2); + return { + tokens: e[0], + numArgs: 0 + }; +}); +defineMacro("\\@secondoftwo", function(n) { + var e = n.consumeArgs(2); + return { + tokens: e[1], + numArgs: 0 + }; +}); +defineMacro("\\@ifnextchar", function(n) { + var e = n.consumeArgs(3); + n.consumeSpaces(); + var t = n.future(); + return e[0].length === 1 && e[0][0].text === t.text ? { + tokens: e[1], + numArgs: 0 + } : { + tokens: e[2], + numArgs: 0 + }; +}); +defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); +defineMacro("\\TextOrMath", function(n) { + var e = n.consumeArgs(2); + return n.mode === "text" ? { + tokens: e[0], + numArgs: 0 + } : { + tokens: e[1], + numArgs: 0 + }; +}); +var digitToNumber = { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + a: 10, + A: 10, + b: 11, + B: 11, + c: 12, + C: 12, + d: 13, + D: 13, + e: 14, + E: 14, + f: 15, + F: 15 +}; +defineMacro("\\char", function(n) { + var e = n.popToken(), t, r = ""; + if (e.text === "'") + t = 8, e = n.popToken(); + else if (e.text === '"') + t = 16, e = n.popToken(); + else if (e.text === "`") + if (e = n.popToken(), e.text[0] === "\\") + r = e.text.charCodeAt(1); + else { + if (e.text === "EOF") + throw new ParseError("\\char` missing argument"); + r = e.text.charCodeAt(0); + } + else + t = 10; + if (t) { + if (r = digitToNumber[e.text], r == null || r >= t) + throw new ParseError("Invalid base-" + t + " digit " + e.text); + for (var a; (a = digitToNumber[n.future().text]) != null && a < t; ) + r *= t, r += a, n.popToken(); + } + return "\\@char{" + r + "}"; +}); +var newcommand = (n, e, t) => { + var r = n.consumeArg().tokens; + if (r.length !== 1) + throw new ParseError("\\newcommand's first argument must be a macro name"); + var a = r[0].text, l = n.isDefined(a); + if (l && !e) + throw new ParseError("\\newcommand{" + a + "} attempting to redefine " + (a + "; use \\renewcommand")); + if (!l && !t) + throw new ParseError("\\renewcommand{" + a + "} when command " + a + " does not yet exist; use \\newcommand"); + var d = 0; + if (r = n.consumeArg().tokens, r.length === 1 && r[0].text === "[") { + for (var o = "", u = n.expandNextToken(); u.text !== "]" && u.text !== "EOF"; ) + o += u.text, u = n.expandNextToken(); + if (!o.match(/^\s*[0-9]+\s*$/)) + throw new ParseError("Invalid number of arguments: " + o); + d = parseInt(o), r = n.consumeArg().tokens; + } + return n.macros.set(a, { + tokens: r, + numArgs: d + }), ""; +}; +defineMacro("\\newcommand", (n) => newcommand(n, !1, !0)); +defineMacro("\\renewcommand", (n) => newcommand(n, !0, !1)); +defineMacro("\\providecommand", (n) => newcommand(n, !0, !0)); +defineMacro("\\message", (n) => { + var e = n.consumeArgs(1)[0]; + return console.log(e.reverse().map((t) => t.text).join("")), ""; +}); +defineMacro("\\errmessage", (n) => { + var e = n.consumeArgs(1)[0]; + return console.error(e.reverse().map((t) => t.text).join("")), ""; +}); +defineMacro("\\show", (n) => { + var e = n.popToken(), t = e.text; + return console.log(e, n.macros.get(t), functions[t], symbols.math[t], symbols.text[t]), ""; +}); +defineMacro("\\bgroup", "{"); +defineMacro("\\egroup", "}"); +defineMacro("~", "\\nobreakspace"); +defineMacro("\\lq", "`"); +defineMacro("\\rq", "'"); +defineMacro("\\aa", "\\r a"); +defineMacro("\\AA", "\\r A"); +defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); +defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); +defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); +defineMacro("ℬ", "\\mathscr{B}"); +defineMacro("ℰ", "\\mathscr{E}"); +defineMacro("ℱ", "\\mathscr{F}"); +defineMacro("ℋ", "\\mathscr{H}"); +defineMacro("ℐ", "\\mathscr{I}"); +defineMacro("ℒ", "\\mathscr{L}"); +defineMacro("ℳ", "\\mathscr{M}"); +defineMacro("ℛ", "\\mathscr{R}"); +defineMacro("ℭ", "\\mathfrak{C}"); +defineMacro("ℌ", "\\mathfrak{H}"); +defineMacro("ℨ", "\\mathfrak{Z}"); +defineMacro("\\Bbbk", "\\Bbb{k}"); +defineMacro("·", "\\cdotp"); +defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); +defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); +defineMacro("\\mathstrut", "\\vphantom{(}"); +defineMacro("\\underbar", "\\underline{\\text{#1}}"); +defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); +defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); +defineMacro("\\ne", "\\neq"); +defineMacro("≠", "\\neq"); +defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"); +defineMacro("∉", "\\notin"); +defineMacro("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"); +defineMacro("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"); +defineMacro("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"); +defineMacro("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"); +defineMacro("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"); +defineMacro("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"); +defineMacro("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"); +defineMacro("⟂", "\\perp"); +defineMacro("‼", "\\mathclose{!\\mkern-0.8mu!}"); +defineMacro("∌", "\\notni"); +defineMacro("⌜", "\\ulcorner"); +defineMacro("⌝", "\\urcorner"); +defineMacro("⌞", "\\llcorner"); +defineMacro("⌟", "\\lrcorner"); +defineMacro("©", "\\copyright"); +defineMacro("®", "\\textregistered"); +defineMacro("️", "\\textregistered"); +defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'); +defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'); +defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'); +defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'); +defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); +defineMacro("⋮", "\\vdots"); +defineMacro("\\varGamma", "\\mathit{\\Gamma}"); +defineMacro("\\varDelta", "\\mathit{\\Delta}"); +defineMacro("\\varTheta", "\\mathit{\\Theta}"); +defineMacro("\\varLambda", "\\mathit{\\Lambda}"); +defineMacro("\\varXi", "\\mathit{\\Xi}"); +defineMacro("\\varPi", "\\mathit{\\Pi}"); +defineMacro("\\varSigma", "\\mathit{\\Sigma}"); +defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); +defineMacro("\\varPhi", "\\mathit{\\Phi}"); +defineMacro("\\varPsi", "\\mathit{\\Psi}"); +defineMacro("\\varOmega", "\\mathit{\\Omega}"); +defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); +defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"); +defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); +defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); +defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); +defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); +var dotsByToken = { + ",": "\\dotsc", + "\\not": "\\dotsb", + // \keybin@ checks for the following: + "+": "\\dotsb", + "=": "\\dotsb", + "<": "\\dotsb", + ">": "\\dotsb", + "-": "\\dotsb", + "*": "\\dotsb", + ":": "\\dotsb", + // Symbols whose definition starts with \DOTSB: + "\\DOTSB": "\\dotsb", + "\\coprod": "\\dotsb", + "\\bigvee": "\\dotsb", + "\\bigwedge": "\\dotsb", + "\\biguplus": "\\dotsb", + "\\bigcap": "\\dotsb", + "\\bigcup": "\\dotsb", + "\\prod": "\\dotsb", + "\\sum": "\\dotsb", + "\\bigotimes": "\\dotsb", + "\\bigoplus": "\\dotsb", + "\\bigodot": "\\dotsb", + "\\bigsqcup": "\\dotsb", + "\\And": "\\dotsb", + "\\longrightarrow": "\\dotsb", + "\\Longrightarrow": "\\dotsb", + "\\longleftarrow": "\\dotsb", + "\\Longleftarrow": "\\dotsb", + "\\longleftrightarrow": "\\dotsb", + "\\Longleftrightarrow": "\\dotsb", + "\\mapsto": "\\dotsb", + "\\longmapsto": "\\dotsb", + "\\hookrightarrow": "\\dotsb", + "\\doteq": "\\dotsb", + // Symbols whose definition starts with \mathbin: + "\\mathbin": "\\dotsb", + // Symbols whose definition starts with \mathrel: + "\\mathrel": "\\dotsb", + "\\relbar": "\\dotsb", + "\\Relbar": "\\dotsb", + "\\xrightarrow": "\\dotsb", + "\\xleftarrow": "\\dotsb", + // Symbols whose definition starts with \DOTSI: + "\\DOTSI": "\\dotsi", + "\\int": "\\dotsi", + "\\oint": "\\dotsi", + "\\iint": "\\dotsi", + "\\iiint": "\\dotsi", + "\\iiiint": "\\dotsi", + "\\idotsint": "\\dotsi", + // Symbols whose definition starts with \DOTSX: + "\\DOTSX": "\\dotsx" +}; +defineMacro("\\dots", function(n) { + var e = "\\dotso", t = n.expandAfterFuture().text; + return t in dotsByToken ? e = dotsByToken[t] : (t.slice(0, 4) === "\\not" || t in symbols.math && utils.contains(["bin", "rel"], symbols.math[t].group)) && (e = "\\dotsb"), e; +}); +var spaceAfterDots = { + // \rightdelim@ checks for the following: + ")": !0, + "]": !0, + "\\rbrack": !0, + "\\}": !0, + "\\rbrace": !0, + "\\rangle": !0, + "\\rceil": !0, + "\\rfloor": !0, + "\\rgroup": !0, + "\\rmoustache": !0, + "\\right": !0, + "\\bigr": !0, + "\\biggr": !0, + "\\Bigr": !0, + "\\Biggr": !0, + // \extra@ also tests for the following: + $: !0, + // \extrap@ checks for the following: + ";": !0, + ".": !0, + ",": !0 +}; +defineMacro("\\dotso", function(n) { + var e = n.future().text; + return e in spaceAfterDots ? "\\ldots\\," : "\\ldots"; +}); +defineMacro("\\dotsc", function(n) { + var e = n.future().text; + return e in spaceAfterDots && e !== "," ? "\\ldots\\," : "\\ldots"; +}); +defineMacro("\\cdots", function(n) { + var e = n.future().text; + return e in spaceAfterDots ? "\\@cdots\\," : "\\@cdots"; +}); +defineMacro("\\dotsb", "\\cdots"); +defineMacro("\\dotsm", "\\cdots"); +defineMacro("\\dotsi", "\\!\\cdots"); +defineMacro("\\dotsx", "\\ldots\\,"); +defineMacro("\\DOTSI", "\\relax"); +defineMacro("\\DOTSB", "\\relax"); +defineMacro("\\DOTSX", "\\relax"); +defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); +defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); +defineMacro("\\thinspace", "\\,"); +defineMacro("\\>", "\\mskip{4mu}"); +defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); +defineMacro("\\medspace", "\\:"); +defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); +defineMacro("\\thickspace", "\\;"); +defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); +defineMacro("\\negthinspace", "\\!"); +defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); +defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); +defineMacro("\\enspace", "\\kern.5em "); +defineMacro("\\enskip", "\\hskip.5em\\relax"); +defineMacro("\\quad", "\\hskip1em\\relax"); +defineMacro("\\qquad", "\\hskip2em\\relax"); +defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); +defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); +defineMacro("\\tag@literal", (n) => { + if (n.macros.get("\\df@tag")) + throw new ParseError("Multiple \\tag"); + return "\\gdef\\df@tag{\\text{#1}}"; +}); +defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); +defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); +defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); +defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"); +defineMacro("\\newline", "\\\\\\relax"); +defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}"); +var latexRaiseA = makeEm(fontMetricsData["Main-Regular"][84][1] - 0.7 * fontMetricsData["Main-Regular"][65][1]); +defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); +defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); +defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); +defineMacro("\\@hspace", "\\hskip #1\\relax"); +defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); +defineMacro("\\ordinarycolon", ":"); +defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); +defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'); +defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'); +defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'); +defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'); +defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'); +defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'); +defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'); +defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'); +defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'); +defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'); +defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'); +defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'); +defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'); +defineMacro("∷", "\\dblcolon"); +defineMacro("∹", "\\eqcolon"); +defineMacro("≔", "\\coloneqq"); +defineMacro("≕", "\\eqqcolon"); +defineMacro("⩴", "\\Coloneqq"); +defineMacro("\\ratio", "\\vcentcolon"); +defineMacro("\\coloncolon", "\\dblcolon"); +defineMacro("\\colonequals", "\\coloneqq"); +defineMacro("\\coloncolonequals", "\\Coloneqq"); +defineMacro("\\equalscolon", "\\eqqcolon"); +defineMacro("\\equalscoloncolon", "\\Eqqcolon"); +defineMacro("\\colonminus", "\\coloneq"); +defineMacro("\\coloncolonminus", "\\Coloneq"); +defineMacro("\\minuscolon", "\\eqcolon"); +defineMacro("\\minuscoloncolon", "\\Eqcolon"); +defineMacro("\\coloncolonapprox", "\\Colonapprox"); +defineMacro("\\coloncolonsim", "\\Colonsim"); +defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"); +defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); +defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); +defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); +defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); +defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); +defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); +defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); +defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); +defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}"); +defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}"); +defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}"); +defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}"); +defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{≰}"); +defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}"); +defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}"); +defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}"); +defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}"); +defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}"); +defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}"); +defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}"); +defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}"); +defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); +defineMacro("\\imath", "\\html@mathml{\\@imath}{ı}"); +defineMacro("\\jmath", "\\html@mathml{\\@jmath}{ȷ}"); +defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"); +defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"); +defineMacro("⟦", "\\llbracket"); +defineMacro("⟧", "\\rrbracket"); +defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"); +defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"); +defineMacro("⦃", "\\lBrace"); +defineMacro("⦄", "\\rBrace"); +defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"); +defineMacro("⦵", "\\minuso"); +defineMacro("\\darr", "\\downarrow"); +defineMacro("\\dArr", "\\Downarrow"); +defineMacro("\\Darr", "\\Downarrow"); +defineMacro("\\lang", "\\langle"); +defineMacro("\\rang", "\\rangle"); +defineMacro("\\uarr", "\\uparrow"); +defineMacro("\\uArr", "\\Uparrow"); +defineMacro("\\Uarr", "\\Uparrow"); +defineMacro("\\N", "\\mathbb{N}"); +defineMacro("\\R", "\\mathbb{R}"); +defineMacro("\\Z", "\\mathbb{Z}"); +defineMacro("\\alef", "\\aleph"); +defineMacro("\\alefsym", "\\aleph"); +defineMacro("\\Alpha", "\\mathrm{A}"); +defineMacro("\\Beta", "\\mathrm{B}"); +defineMacro("\\bull", "\\bullet"); +defineMacro("\\Chi", "\\mathrm{X}"); +defineMacro("\\clubs", "\\clubsuit"); +defineMacro("\\cnums", "\\mathbb{C}"); +defineMacro("\\Complex", "\\mathbb{C}"); +defineMacro("\\Dagger", "\\ddagger"); +defineMacro("\\diamonds", "\\diamondsuit"); +defineMacro("\\empty", "\\emptyset"); +defineMacro("\\Epsilon", "\\mathrm{E}"); +defineMacro("\\Eta", "\\mathrm{H}"); +defineMacro("\\exist", "\\exists"); +defineMacro("\\harr", "\\leftrightarrow"); +defineMacro("\\hArr", "\\Leftrightarrow"); +defineMacro("\\Harr", "\\Leftrightarrow"); +defineMacro("\\hearts", "\\heartsuit"); +defineMacro("\\image", "\\Im"); +defineMacro("\\infin", "\\infty"); +defineMacro("\\Iota", "\\mathrm{I}"); +defineMacro("\\isin", "\\in"); +defineMacro("\\Kappa", "\\mathrm{K}"); +defineMacro("\\larr", "\\leftarrow"); +defineMacro("\\lArr", "\\Leftarrow"); +defineMacro("\\Larr", "\\Leftarrow"); +defineMacro("\\lrarr", "\\leftrightarrow"); +defineMacro("\\lrArr", "\\Leftrightarrow"); +defineMacro("\\Lrarr", "\\Leftrightarrow"); +defineMacro("\\Mu", "\\mathrm{M}"); +defineMacro("\\natnums", "\\mathbb{N}"); +defineMacro("\\Nu", "\\mathrm{N}"); +defineMacro("\\Omicron", "\\mathrm{O}"); +defineMacro("\\plusmn", "\\pm"); +defineMacro("\\rarr", "\\rightarrow"); +defineMacro("\\rArr", "\\Rightarrow"); +defineMacro("\\Rarr", "\\Rightarrow"); +defineMacro("\\real", "\\Re"); +defineMacro("\\reals", "\\mathbb{R}"); +defineMacro("\\Reals", "\\mathbb{R}"); +defineMacro("\\Rho", "\\mathrm{P}"); +defineMacro("\\sdot", "\\cdot"); +defineMacro("\\sect", "\\S"); +defineMacro("\\spades", "\\spadesuit"); +defineMacro("\\sub", "\\subset"); +defineMacro("\\sube", "\\subseteq"); +defineMacro("\\supe", "\\supseteq"); +defineMacro("\\Tau", "\\mathrm{T}"); +defineMacro("\\thetasym", "\\vartheta"); +defineMacro("\\weierp", "\\wp"); +defineMacro("\\Zeta", "\\mathrm{Z}"); +defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); +defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); +defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); +defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); +defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); +defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); +defineMacro("\\Bra", "\\left\\langle#1\\right|"); +defineMacro("\\Ket", "\\left|#1\\right\\rangle"); +var braketHelper = (n) => (e) => { + var t = e.consumeArg().tokens, r = e.consumeArg().tokens, a = e.consumeArg().tokens, l = e.consumeArg().tokens, d = e.macros.get("|"), o = e.macros.get("\\|"); + e.macros.beginGroup(); + var u = (y) => (w) => { + n && (w.macros.set("|", d), a.length && w.macros.set("\\|", o)); + var b = y; + if (!y && a.length) { + var A = w.future(); + A.text === "|" && (w.popToken(), b = !0); + } + return { + tokens: b ? a : r, + numArgs: 0 + }; + }; + e.macros.set("|", u(!1)), a.length && e.macros.set("\\|", u(!0)); + var p = e.consumeArg().tokens, m = e.expandTokens([ + ...l, + ...p, + ...t + // reversed + ]); + return e.macros.endGroup(), { + tokens: m.reverse(), + numArgs: 0 + }; +}; +defineMacro("\\bra@ket", braketHelper(!1)); +defineMacro("\\bra@set", braketHelper(!0)); +defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"); +defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"); +defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); +defineMacro("\\angln", "{\\angl n}"); +defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); +defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); +defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); +defineMacro("\\red", "\\textcolor{##df0030}{#1}"); +defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); +defineMacro("\\gray", "\\textcolor{gray}{#1}"); +defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); +defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); +defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); +defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); +defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); +defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); +defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); +defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); +defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); +defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); +defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); +defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); +defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); +defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); +defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); +defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); +defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); +defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); +defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); +defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); +defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); +defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); +defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); +defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); +defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); +defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); +defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); +defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); +defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); +defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); +defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); +defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); +defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); +defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); +defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); +defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); +defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); +defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); +defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); +defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); +defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); +defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); +defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); +defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); +defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); +defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); +defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); +defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); +defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); +defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); +typeof document < "u" && document.compatMode !== "CSS1Compat" && typeof console < "u" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."); +function _getDefaults() { + return { + async: !1, + breaks: !1, + extensions: null, + gfm: !0, + hooks: null, + pedantic: !1, + renderer: null, + silent: !1, + tokenizer: null, + walkTokens: null + }; +} +let _defaults = _getDefaults(); +function changeDefaults(n) { + _defaults = n; +} +const escapeTest = /[&<>"']/, escapeReplace = new RegExp(escapeTest.source, "g"), escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g"), escapeReplacements = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}, getEscapeReplacement = (n) => escapeReplacements[n]; +function escape$1(n, e) { + if (e) { + if (escapeTest.test(n)) + return n.replace(escapeReplace, getEscapeReplacement); + } else if (escapeTestNoEncode.test(n)) + return n.replace(escapeReplaceNoEncode, getEscapeReplacement); + return n; +} +const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; +function unescape(n) { + return n.replace(unescapeTest, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : "")); +} +const caret = /(^|[^\[])\^/g; +function edit(n, e) { + let t = typeof n == "string" ? n : n.source; + e = e || ""; + const r = { + replace: (a, l) => { + let d = typeof l == "string" ? l : l.source; + return d = d.replace(caret, "$1"), t = t.replace(a, d), r; + }, + getRegex: () => new RegExp(t, e) + }; + return r; +} +function cleanUrl(n) { + try { + n = encodeURI(n).replace(/%25/g, "%"); + } catch { + return null; + } + return n; +} +const noopTest = { exec: () => null }; +function splitCells(n, e) { + const t = n.replace(/\|/g, (l, d, o) => { + let u = !1, p = d; + for (; --p >= 0 && o[p] === "\\"; ) + u = !u; + return u ? "|" : " |"; + }), r = t.split(/ \|/); + let a = 0; + if (r[0].trim() || r.shift(), r.length > 0 && !r[r.length - 1].trim() && r.pop(), e) + if (r.length > e) + r.splice(e); + else + for (; r.length < e; ) + r.push(""); + for (; a < r.length; a++) + r[a] = r[a].trim().replace(/\\\|/g, "|"); + return r; +} +function rtrim(n, e, t) { + const r = n.length; + if (r === 0) + return ""; + let a = 0; + for (; a < r; ) { + const l = n.charAt(r - a - 1); + if (l === e && !t) + a++; + else if (l !== e && t) + a++; + else + break; + } + return n.slice(0, r - a); +} +function findClosingBracket(n, e) { + if (n.indexOf(e[1]) === -1) + return -1; + let t = 0; + for (let r = 0; r < n.length; r++) + if (n[r] === "\\") + r++; + else if (n[r] === e[0]) + t++; + else if (n[r] === e[1] && (t--, t < 0)) + return r; + return -1; +} +function outputLink(n, e, t, r) { + const a = e.href, l = e.title ? escape$1(e.title) : null, d = n[1].replace(/\\([\[\]])/g, "$1"); + if (n[0].charAt(0) !== "!") { + r.state.inLink = !0; + const o = { + type: "link", + raw: t, + href: a, + title: l, + text: d, + tokens: r.inlineTokens(d) + }; + return r.state.inLink = !1, o; + } + return { + type: "image", + raw: t, + href: a, + title: l, + text: escape$1(d) + }; +} +function indentCodeCompensation(n, e) { + const t = n.match(/^(\s+)(?:```)/); + if (t === null) + return e; + const r = t[1]; + return e.split(` +`).map((a) => { + const l = a.match(/^\s+/); + if (l === null) + return a; + const [d] = l; + return d.length >= r.length ? a.slice(r.length) : a; + }).join(` +`); +} +class _Tokenizer { + // set by the lexer + constructor(e) { + kt(this, "options"); + kt(this, "rules"); + // set by the lexer + kt(this, "lexer"); + this.options = e || _defaults; + } + space(e) { + const t = this.rules.block.newline.exec(e); + if (t && t[0].length > 0) + return { + type: "space", + raw: t[0] + }; + } + code(e) { + const t = this.rules.block.code.exec(e); + if (t) { + const r = t[0].replace(/^ {1,4}/gm, ""); + return { + type: "code", + raw: t[0], + codeBlockStyle: "indented", + text: this.options.pedantic ? r : rtrim(r, ` +`) + }; + } + } + fences(e) { + const t = this.rules.block.fences.exec(e); + if (t) { + const r = t[0], a = indentCodeCompensation(r, t[3] || ""); + return { + type: "code", + raw: r, + lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], + text: a + }; + } + } + heading(e) { + const t = this.rules.block.heading.exec(e); + if (t) { + let r = t[2].trim(); + if (/#$/.test(r)) { + const a = rtrim(r, "#"); + (this.options.pedantic || !a || / $/.test(a)) && (r = a.trim()); + } + return { + type: "heading", + raw: t[0], + depth: t[1].length, + text: r, + tokens: this.lexer.inline(r) + }; + } + } + hr(e) { + const t = this.rules.block.hr.exec(e); + if (t) + return { + type: "hr", + raw: t[0] + }; + } + blockquote(e) { + const t = this.rules.block.blockquote.exec(e); + if (t) { + let r = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, ` + $1`); + r = rtrim(r.replace(/^ *>[ \t]?/gm, ""), ` +`); + const a = this.lexer.state.top; + this.lexer.state.top = !0; + const l = this.lexer.blockTokens(r); + return this.lexer.state.top = a, { + type: "blockquote", + raw: t[0], + tokens: l, + text: r + }; + } + } + list(e) { + let t = this.rules.block.list.exec(e); + if (t) { + let r = t[1].trim(); + const a = r.length > 1, l = { + type: "list", + raw: "", + ordered: a, + start: a ? +r.slice(0, -1) : "", + loose: !1, + items: [] + }; + r = a ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = a ? r : "[*+-]"); + const d = new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`); + let o = "", u = "", p = !1; + for (; e; ) { + let m = !1; + if (!(t = d.exec(e)) || this.rules.block.hr.test(e)) + break; + o = t[0], e = e.substring(o.length); + let y = t[2].split(` +`, 1)[0].replace(/^\t+/, (h) => " ".repeat(3 * h.length)), w = e.split(` +`, 1)[0], b = 0; + this.options.pedantic ? (b = 2, u = y.trimStart()) : (b = t[2].search(/[^ ]/), b = b > 4 ? 1 : b, u = y.slice(b), b += t[1].length); + let A = !1; + if (!y && /^ *$/.test(w) && (o += w + ` +`, e = e.substring(w.length + 1), m = !0), !m) { + const h = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), _ = new RegExp(`^ {0,${Math.min(3, b - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), g = new RegExp(`^ {0,${Math.min(3, b - 1)}}(?:\`\`\`|~~~)`), x = new RegExp(`^ {0,${Math.min(3, b - 1)}}#`); + for (; e; ) { + const c = e.split(` +`, 1)[0]; + if (w = c, this.options.pedantic && (w = w.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), g.test(w) || x.test(w) || h.test(w) || _.test(e)) + break; + if (w.search(/[^ ]/) >= b || !w.trim()) + u += ` +` + w.slice(b); + else { + if (A || y.search(/[^ ]/) >= 4 || g.test(y) || x.test(y) || _.test(y)) + break; + u += ` +` + w; + } + !A && !w.trim() && (A = !0), o += c + ` +`, e = e.substring(c.length + 1), y = w.slice(b); + } + } + l.loose || (p ? l.loose = !0 : /\n *\n *$/.test(o) && (p = !0)); + let f = null, s; + this.options.gfm && (f = /^\[[ xX]\] /.exec(u), f && (s = f[0] !== "[ ] ", u = u.replace(/^\[[ xX]\] +/, ""))), l.items.push({ + type: "list_item", + raw: o, + task: !!f, + checked: s, + loose: !1, + text: u, + tokens: [] + }), l.raw += o; + } + l.items[l.items.length - 1].raw = o.trimEnd(), l.items[l.items.length - 1].text = u.trimEnd(), l.raw = l.raw.trimEnd(); + for (let m = 0; m < l.items.length; m++) + if (this.lexer.state.top = !1, l.items[m].tokens = this.lexer.blockTokens(l.items[m].text, []), !l.loose) { + const y = l.items[m].tokens.filter((b) => b.type === "space"), w = y.length > 0 && y.some((b) => /\n.*\n/.test(b.raw)); + l.loose = w; + } + if (l.loose) + for (let m = 0; m < l.items.length; m++) + l.items[m].loose = !0; + return l; + } + } + html(e) { + const t = this.rules.block.html.exec(e); + if (t) + return { + type: "html", + block: !0, + raw: t[0], + pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", + text: t[0] + }; + } + def(e) { + const t = this.rules.block.def.exec(e); + if (t) { + const r = t[1].toLowerCase().replace(/\s+/g, " "), a = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3]; + return { + type: "def", + tag: r, + raw: t[0], + href: a, + title: l + }; + } + } + table(e) { + const t = this.rules.block.table.exec(e); + if (!t || !/[:|]/.test(t[2])) + return; + const r = splitCells(t[1]), a = t[2].replace(/^\||\| *$/g, "").split("|"), l = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(` +`) : [], d = { + type: "table", + raw: t[0], + header: [], + align: [], + rows: [] + }; + if (r.length === a.length) { + for (const o of a) + /^ *-+: *$/.test(o) ? d.align.push("right") : /^ *:-+: *$/.test(o) ? d.align.push("center") : /^ *:-+ *$/.test(o) ? d.align.push("left") : d.align.push(null); + for (const o of r) + d.header.push({ + text: o, + tokens: this.lexer.inline(o) + }); + for (const o of l) + d.rows.push(splitCells(o, d.header.length).map((u) => ({ + text: u, + tokens: this.lexer.inline(u) + }))); + return d; + } + } + lheading(e) { + const t = this.rules.block.lheading.exec(e); + if (t) + return { + type: "heading", + raw: t[0], + depth: t[2].charAt(0) === "=" ? 1 : 2, + text: t[1], + tokens: this.lexer.inline(t[1]) + }; + } + paragraph(e) { + const t = this.rules.block.paragraph.exec(e); + if (t) { + const r = t[1].charAt(t[1].length - 1) === ` +` ? t[1].slice(0, -1) : t[1]; + return { + type: "paragraph", + raw: t[0], + text: r, + tokens: this.lexer.inline(r) + }; + } + } + text(e) { + const t = this.rules.block.text.exec(e); + if (t) + return { + type: "text", + raw: t[0], + text: t[0], + tokens: this.lexer.inline(t[0]) + }; + } + escape(e) { + const t = this.rules.inline.escape.exec(e); + if (t) + return { + type: "escape", + raw: t[0], + text: escape$1(t[1]) + }; + } + tag(e) { + const t = this.rules.inline.tag.exec(e); + if (t) + return !this.lexer.state.inLink && /^/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), { + type: "html", + raw: t[0], + inLink: this.lexer.state.inLink, + inRawBlock: this.lexer.state.inRawBlock, + block: !1, + text: t[0] + }; + } + link(e) { + const t = this.rules.inline.link.exec(e); + if (t) { + const r = t[2].trim(); + if (!this.options.pedantic && /^$/.test(r)) + return; + const d = rtrim(r.slice(0, -1), "\\"); + if ((r.length - d.length) % 2 === 0) + return; + } else { + const d = findClosingBracket(t[2], "()"); + if (d > -1) { + const u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + d; + t[2] = t[2].substring(0, d), t[0] = t[0].substring(0, u).trim(), t[3] = ""; + } + } + let a = t[2], l = ""; + if (this.options.pedantic) { + const d = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a); + d && (a = d[1], l = d[3]); + } else + l = t[3] ? t[3].slice(1, -1) : ""; + return a = a.trim(), /^$/.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), outputLink(t, { + href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), + title: l && l.replace(this.rules.inline.anyPunctuation, "$1") + }, t[0], this.lexer); + } + } + reflink(e, t) { + let r; + if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) { + const a = (r[2] || r[1]).replace(/\s+/g, " "), l = t[a.toLowerCase()]; + if (!l) { + const d = r[0].charAt(0); + return { + type: "text", + raw: d, + text: d + }; + } + return outputLink(r, l, r[0], this.lexer); + } + } + emStrong(e, t, r = "") { + let a = this.rules.inline.emStrongLDelim.exec(e); + if (!a || a[3] && r.match(/[\p{L}\p{N}]/u)) + return; + if (!(a[1] || a[2] || "") || !r || this.rules.inline.punctuation.exec(r)) { + const d = [...a[0]].length - 1; + let o, u, p = d, m = 0; + const y = a[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; + for (y.lastIndex = 0, t = t.slice(-1 * e.length + d); (a = y.exec(t)) != null; ) { + if (o = a[1] || a[2] || a[3] || a[4] || a[5] || a[6], !o) + continue; + if (u = [...o].length, a[3] || a[4]) { + p += u; + continue; + } else if ((a[5] || a[6]) && d % 3 && !((d + u) % 3)) { + m += u; + continue; + } + if (p -= u, p > 0) + continue; + u = Math.min(u, u + p + m); + const w = [...a[0]][0].length, b = e.slice(0, d + a.index + w + u); + if (Math.min(d, u) % 2) { + const f = b.slice(1, -1); + return { + type: "em", + raw: b, + text: f, + tokens: this.lexer.inlineTokens(f) + }; + } + const A = b.slice(2, -2); + return { + type: "strong", + raw: b, + text: A, + tokens: this.lexer.inlineTokens(A) + }; + } + } + } + codespan(e) { + const t = this.rules.inline.code.exec(e); + if (t) { + let r = t[2].replace(/\n/g, " "); + const a = /[^ ]/.test(r), l = /^ /.test(r) && / $/.test(r); + return a && l && (r = r.substring(1, r.length - 1)), r = escape$1(r, !0), { + type: "codespan", + raw: t[0], + text: r + }; + } + } + br(e) { + const t = this.rules.inline.br.exec(e); + if (t) + return { + type: "br", + raw: t[0] + }; + } + del(e) { + const t = this.rules.inline.del.exec(e); + if (t) + return { + type: "del", + raw: t[0], + text: t[2], + tokens: this.lexer.inlineTokens(t[2]) + }; + } + autolink(e) { + const t = this.rules.inline.autolink.exec(e); + if (t) { + let r, a; + return t[2] === "@" ? (r = escape$1(t[1]), a = "mailto:" + r) : (r = escape$1(t[1]), a = r), { + type: "link", + raw: t[0], + text: r, + href: a, + tokens: [ + { + type: "text", + raw: r, + text: r + } + ] + }; + } + } + url(e) { + var r; + let t; + if (t = this.rules.inline.url.exec(e)) { + let a, l; + if (t[2] === "@") + a = escape$1(t[0]), l = "mailto:" + a; + else { + let d; + do + d = t[0], t[0] = ((r = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : r[0]) ?? ""; + while (d !== t[0]); + a = escape$1(t[0]), t[1] === "www." ? l = "http://" + t[0] : l = t[0]; + } + return { + type: "link", + raw: t[0], + text: a, + href: l, + tokens: [ + { + type: "text", + raw: a, + text: a + } + ] + }; + } + } + inlineText(e) { + const t = this.rules.inline.text.exec(e); + if (t) { + let r; + return this.lexer.state.inRawBlock ? r = t[0] : r = escape$1(t[0]), { + type: "text", + raw: t[0], + text: r + }; + } + } +} +const newline = /^(?: *(?:\n|$))+/, blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, bullet = /(?:[*+-]|\d{1,9}[.)])/, lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, blockText = /^[^\n]+/, _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/, def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex(), _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", _comment = /|$))/, html$2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(), blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex(), blockNormal = { + blockquote, + code: blockCode, + def, + fences, + heading, + hr, + html: html$2, + lheading, + list, + newline, + paragraph, + table: noopTest, + text: blockText +}, gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(), blockGfm = { + ...blockNormal, + table: gfmTable, + paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex() +}, blockPedantic = { + ...blockNormal, + html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, + heading: /^(#{1,6})(.*)(?:\n+|$)/, + fences: noopTest, + // fences not supported + lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, + paragraph: edit(_paragraph).replace("hr", hr).replace("heading", ` *#{1,6} *[^ +]`).replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() +}, escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, br = /^( {2,}|\\)\n(?!\s*$)/, inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g, emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex(), emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex(), anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex(), autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex(), tag = edit("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex(), nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex(), reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex(), inlineNormal = { + _backpedal: noopTest, + // only used for GFM url + anyPunctuation, + autolink, + blockSkip, + br, + code: inlineCode, + del: noopTest, + emStrongLDelim, + emStrongRDelimAst, + emStrongRDelimUnd, + escape, + link, + nolink, + punctuation, + reflink, + reflinkSearch, + tag, + text: inlineText, + url: noopTest +}, inlinePedantic = { + ...inlineNormal, + link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(), + reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex() +}, inlineGfm = { + ...inlineNormal, + escape: edit(escape).replace("])", "~|])").getRegex(), + url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), + _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, + del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, + text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ u + " ".repeat(p.length)); + let r, a, l, d; + for (; e; ) + if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) { + if (r = this.tokenizer.space(e)) { + e = e.substring(r.raw.length), r.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += ` +` : t.push(r); + continue; + } + if (r = this.tokenizer.code(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r); + continue; + } + if (r = this.tokenizer.fences(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.heading(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.hr(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.blockquote(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.list(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.html(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.def(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += ` +` + r.raw, a.text += ` +` + r.raw, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { + href: r.href, + title: r.title + }); + continue; + } + if (r = this.tokenizer.table(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.lheading(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (l = e, this.options.extensions && this.options.extensions.startBlock) { + let o = 1 / 0; + const u = e.slice(1); + let p; + this.options.extensions.startBlock.forEach((m) => { + p = m.call({ lexer: this }, u), typeof p == "number" && p >= 0 && (o = Math.min(o, p)); + }), o < 1 / 0 && o >= 0 && (l = e.substring(0, o + 1)); + } + if (this.state.top && (r = this.tokenizer.paragraph(l))) { + a = t[t.length - 1], d && a.type === "paragraph" ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r), d = l.length !== e.length, e = e.substring(r.raw.length); + continue; + } + if (r = this.tokenizer.text(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && a.type === "text" ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r); + continue; + } + if (e) { + const o = "Infinite loop on byte: " + e.charCodeAt(0); + if (this.options.silent) { + console.error(o); + break; + } else + throw new Error(o); + } + } + return this.state.top = !0, t; + } + inline(e, t = []) { + return this.inlineQueue.push({ src: e, tokens: t }), t; + } + /** + * Lexing/Compiling + */ + inlineTokens(e, t = []) { + let r, a, l, d = e, o, u, p; + if (this.tokens.links) { + const m = Object.keys(this.tokens.links); + if (m.length > 0) + for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(d)) != null; ) + m.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (d = d.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + d.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)); + } + for (; (o = this.tokenizer.rules.inline.blockSkip.exec(d)) != null; ) + d = d.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + d.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(d)) != null; ) + d = d.slice(0, o.index) + "++" + d.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); + for (; e; ) + if (u || (p = ""), u = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((m) => (r = m.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) { + if (r = this.tokenizer.escape(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.tag(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (r = this.tokenizer.link(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.reflink(e, this.tokens.links)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (r = this.tokenizer.emStrong(e, d, p)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.codespan(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.br(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.del(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.autolink(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (!this.state.inLink && (r = this.tokenizer.url(e))) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (l = e, this.options.extensions && this.options.extensions.startInline) { + let m = 1 / 0; + const y = e.slice(1); + let w; + this.options.extensions.startInline.forEach((b) => { + w = b.call({ lexer: this }, y), typeof w == "number" && w >= 0 && (m = Math.min(m, w)); + }), m < 1 / 0 && m >= 0 && (l = e.substring(0, m + 1)); + } + if (r = this.tokenizer.inlineText(l)) { + e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (p = r.raw.slice(-1)), u = !0, a = t[t.length - 1], a && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (e) { + const m = "Infinite loop on byte: " + e.charCodeAt(0); + if (this.options.silent) { + console.error(m); + break; + } else + throw new Error(m); + } + } + return t; + } +} +class _Renderer { + constructor(e) { + kt(this, "options"); + this.options = e || _defaults; + } + code(e, t, r) { + var l; + const a = (l = (t || "").match(/^\S*/)) == null ? void 0 : l[0]; + return e = e.replace(/\n$/, "") + ` +`, a ? '
' + (r ? e : escape$1(e, !0)) + `
+` : "
" + (r ? e : escape$1(e, !0)) + `
+`; + } + blockquote(e) { + return `
+${e}
+`; + } + html(e, t) { + return e; + } + heading(e, t, r) { + return `${e} +`; + } + hr() { + return `
+`; + } + list(e, t, r) { + const a = t ? "ol" : "ul", l = t && r !== 1 ? ' start="' + r + '"' : ""; + return "<" + a + l + `> +` + e + " +`; + } + listitem(e, t, r) { + return `
  • ${e}
  • +`; + } + checkbox(e) { + return "'; + } + paragraph(e) { + return `

    ${e}

    +`; + } + table(e, t) { + return t && (t = `${t}`), ` + +` + e + ` +` + t + `
    +`; + } + tablerow(e) { + return ` +${e} +`; + } + tablecell(e, t) { + const r = t.header ? "th" : "td"; + return (t.align ? `<${r} align="${t.align}">` : `<${r}>`) + e + ` +`; + } + /** + * span level renderer + */ + strong(e) { + return `${e}`; + } + em(e) { + return `${e}`; + } + codespan(e) { + return `${e}`; + } + br() { + return "
    "; + } + del(e) { + return `${e}`; + } + link(e, t, r) { + const a = cleanUrl(e); + if (a === null) + return r; + e = a; + let l = '", l; + } + image(e, t, r) { + const a = cleanUrl(e); + if (a === null) + return r; + e = a; + let l = `${r} 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = s + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = s + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({ + type: "text", + text: s + " " + }) : f += s + " "; + } + f += this.parse(w.tokens, p), m += this.renderer.listitem(f, A, !!b); + } + r += this.renderer.list(m, o, u); + continue; + } + case "html": { + const d = l; + r += this.renderer.html(d.text, d.block); + continue; + } + case "paragraph": { + const d = l; + r += this.renderer.paragraph(this.parseInline(d.tokens)); + continue; + } + case "text": { + let d = l, o = d.tokens ? this.parseInline(d.tokens) : d.text; + for (; a + 1 < e.length && e[a + 1].type === "text"; ) + d = e[++a], o += ` +` + (d.tokens ? this.parseInline(d.tokens) : d.text); + r += t ? this.renderer.paragraph(o) : o; + continue; + } + default: { + const d = 'Token with "' + l.type + '" type was not found.'; + if (this.options.silent) + return console.error(d), ""; + throw new Error(d); + } + } + } + return r; + } + /** + * Parse Inline Tokens + */ + parseInline(e, t) { + t = t || this.renderer; + let r = ""; + for (let a = 0; a < e.length; a++) { + const l = e[a]; + if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) { + const d = this.options.extensions.renderers[l.type].call({ parser: this }, l); + if (d !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) { + r += d || ""; + continue; + } + } + switch (l.type) { + case "escape": { + const d = l; + r += t.text(d.text); + break; + } + case "html": { + const d = l; + r += t.html(d.text); + break; + } + case "link": { + const d = l; + r += t.link(d.href, d.title, this.parseInline(d.tokens, t)); + break; + } + case "image": { + const d = l; + r += t.image(d.href, d.title, d.text); + break; + } + case "strong": { + const d = l; + r += t.strong(this.parseInline(d.tokens, t)); + break; + } + case "em": { + const d = l; + r += t.em(this.parseInline(d.tokens, t)); + break; + } + case "codespan": { + const d = l; + r += t.codespan(d.text); + break; + } + case "br": { + r += t.br(); + break; + } + case "del": { + const d = l; + r += t.del(this.parseInline(d.tokens, t)); + break; + } + case "text": { + const d = l; + r += t.text(d.text); + break; + } + default: { + const d = 'Token with "' + l.type + '" type was not found.'; + if (this.options.silent) + return console.error(d), ""; + throw new Error(d); + } + } + } + return r; + } +} +class _Hooks { + constructor(e) { + kt(this, "options"); + this.options = e || _defaults; + } + /** + * Process markdown before marked + */ + preprocess(e) { + return e; + } + /** + * Process HTML after marked is finished + */ + postprocess(e) { + return e; + } + /** + * Process all tokens before walk tokens + */ + processAllTokens(e) { + return e; + } +} +kt(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([ + "preprocess", + "postprocess", + "processAllTokens" +])); +var fr, hi, yn; +class Marked { + constructor(...e) { + ui(this, fr); + kt(this, "defaults", _getDefaults()); + kt(this, "options", this.setOptions); + kt(this, "parse", Zr(this, fr, hi).call(this, _Lexer.lex, _Parser.parse)); + kt(this, "parseInline", Zr(this, fr, hi).call(this, _Lexer.lexInline, _Parser.parseInline)); + kt(this, "Parser", _Parser); + kt(this, "Renderer", _Renderer); + kt(this, "TextRenderer", _TextRenderer); + kt(this, "Lexer", _Lexer); + kt(this, "Tokenizer", _Tokenizer); + kt(this, "Hooks", _Hooks); + this.use(...e); + } + /** + * Run callback for every token + */ + walkTokens(e, t) { + var a, l; + let r = []; + for (const d of e) + switch (r = r.concat(t.call(this, d)), d.type) { + case "table": { + const o = d; + for (const u of o.header) + r = r.concat(this.walkTokens(u.tokens, t)); + for (const u of o.rows) + for (const p of u) + r = r.concat(this.walkTokens(p.tokens, t)); + break; + } + case "list": { + const o = d; + r = r.concat(this.walkTokens(o.items, t)); + break; + } + default: { + const o = d; + (l = (a = this.defaults.extensions) == null ? void 0 : a.childTokens) != null && l[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((u) => { + const p = o[u].flat(1 / 0); + r = r.concat(this.walkTokens(p, t)); + }) : o.tokens && (r = r.concat(this.walkTokens(o.tokens, t))); + } + } + return r; + } + use(...e) { + const t = this.defaults.extensions || { renderers: {}, childTokens: {} }; + return e.forEach((r) => { + const a = { ...r }; + if (a.async = this.defaults.async || a.async || !1, r.extensions && (r.extensions.forEach((l) => { + if (!l.name) + throw new Error("extension name required"); + if ("renderer" in l) { + const d = t.renderers[l.name]; + d ? t.renderers[l.name] = function(...o) { + let u = l.renderer.apply(this, o); + return u === !1 && (u = d.apply(this, o)), u; + } : t.renderers[l.name] = l.renderer; + } + if ("tokenizer" in l) { + if (!l.level || l.level !== "block" && l.level !== "inline") + throw new Error("extension level must be 'block' or 'inline'"); + const d = t[l.level]; + d ? d.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start])); + } + "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens); + }), a.extensions = t), r.renderer) { + const l = this.defaults.renderer || new _Renderer(this.defaults); + for (const d in r.renderer) { + if (!(d in l)) + throw new Error(`renderer '${d}' does not exist`); + if (d === "options") + continue; + const o = d, u = r.renderer[o], p = l[o]; + l[o] = (...m) => { + let y = u.apply(l, m); + return y === !1 && (y = p.apply(l, m)), y || ""; + }; + } + a.renderer = l; + } + if (r.tokenizer) { + const l = this.defaults.tokenizer || new _Tokenizer(this.defaults); + for (const d in r.tokenizer) { + if (!(d in l)) + throw new Error(`tokenizer '${d}' does not exist`); + if (["options", "rules", "lexer"].includes(d)) + continue; + const o = d, u = r.tokenizer[o], p = l[o]; + l[o] = (...m) => { + let y = u.apply(l, m); + return y === !1 && (y = p.apply(l, m)), y; + }; + } + a.tokenizer = l; + } + if (r.hooks) { + const l = this.defaults.hooks || new _Hooks(); + for (const d in r.hooks) { + if (!(d in l)) + throw new Error(`hook '${d}' does not exist`); + if (d === "options") + continue; + const o = d, u = r.hooks[o], p = l[o]; + _Hooks.passThroughHooks.has(d) ? l[o] = (m) => { + if (this.defaults.async) + return Promise.resolve(u.call(l, m)).then((w) => p.call(l, w)); + const y = u.call(l, m); + return p.call(l, y); + } : l[o] = (...m) => { + let y = u.apply(l, m); + return y === !1 && (y = p.apply(l, m)), y; + }; + } + a.hooks = l; + } + if (r.walkTokens) { + const l = this.defaults.walkTokens, d = r.walkTokens; + a.walkTokens = function(o) { + let u = []; + return u.push(d.call(this, o)), l && (u = u.concat(l.call(this, o))), u; + }; + } + this.defaults = { ...this.defaults, ...a }; + }), this; + } + setOptions(e) { + return this.defaults = { ...this.defaults, ...e }, this; + } + lexer(e, t) { + return _Lexer.lex(e, t ?? this.defaults); + } + parser(e, t) { + return _Parser.parse(e, t ?? this.defaults); + } +} +fr = new WeakSet(), hi = function(e, t) { + return (r, a) => { + const l = { ...a }, d = { ...this.defaults, ...l }; + this.defaults.async === !0 && l.async === !1 && (d.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), d.async = !0); + const o = Zr(this, fr, yn).call(this, !!d.silent, !!d.async); + if (typeof r > "u" || r === null) + return o(new Error("marked(): input parameter is undefined or null")); + if (typeof r != "string") + return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(r) + ", string expected")); + if (d.hooks && (d.hooks.options = d), d.async) + return Promise.resolve(d.hooks ? d.hooks.preprocess(r) : r).then((u) => e(u, d)).then((u) => d.hooks ? d.hooks.processAllTokens(u) : u).then((u) => d.walkTokens ? Promise.all(this.walkTokens(u, d.walkTokens)).then(() => u) : u).then((u) => t(u, d)).then((u) => d.hooks ? d.hooks.postprocess(u) : u).catch(o); + try { + d.hooks && (r = d.hooks.preprocess(r)); + let u = e(r, d); + d.hooks && (u = d.hooks.processAllTokens(u)), d.walkTokens && this.walkTokens(u, d.walkTokens); + let p = t(u, d); + return d.hooks && (p = d.hooks.postprocess(p)), p; + } catch (u) { + return o(u); + } + }; +}, yn = function(e, t) { + return (r) => { + if (r.message += ` +Please report this to https://github.com/markedjs/marked.`, e) { + const a = "

    An error occurred:

    " + escape$1(r.message + "", !0) + "
    "; + return t ? Promise.resolve(a) : a; + } + if (t) + return Promise.reject(r); + throw r; + }; +}; +const markedInstance = new Marked(); +function marked(n, e) { + return markedInstance.parse(n, e); +} +marked.options = marked.setOptions = function(n) { + return markedInstance.setOptions(n), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked; +}; +marked.getDefaults = _getDefaults; +marked.defaults = _defaults; +marked.use = function(...n) { + return markedInstance.use(...n), marked.defaults = markedInstance.defaults, changeDefaults(marked.defaults), marked; +}; +marked.walkTokens = function(n, e) { + return markedInstance.walkTokens(n, e); +}; +marked.parseInline = markedInstance.parseInline; +marked.Parser = _Parser; +marked.parser = _Parser.parse; +marked.Renderer = _Renderer; +marked.TextRenderer = _TextRenderer; +marked.Lexer = _Lexer; +marked.lexer = _Lexer.lex; +marked.Tokenizer = _Tokenizer; +marked.Hooks = _Hooks; +marked.parse = marked; +marked.options; +marked.setOptions; +marked.use; +marked.walkTokens; +marked.parseInline; +_Parser.parse; +_Lexer.lex; +const regex = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g, own = Object.hasOwnProperty; +class BananaSlug { + /** + * Create a new slug class. + */ + constructor() { + this.occurrences, this.reset(); + } + /** + * Generate a unique slug. + * + * Tracks previously generated slugs: repeated calls with the same value + * will result in different slugs. + * Use the `slug` function to get same slugs. + * + * @param {string} value + * String of text to slugify + * @param {boolean} [maintainCase=false] + * Keep the current case, otherwise make all lowercase + * @return {string} + * A unique slug string + */ + slug(e, t) { + const r = this; + let a = slug(e, t === !0); + const l = a; + for (; own.call(r.occurrences, a); ) + r.occurrences[l]++, a = l + "-" + r.occurrences[l]; + return r.occurrences[a] = 0, a; + } + /** + * Reset - Forget all previous slugs + * + * @return void + */ + reset() { + this.occurrences = /* @__PURE__ */ Object.create(null); + } +} +function slug(n, e) { + return typeof n != "string" ? "" : (e || (n = n.toLowerCase()), n.replace(regex, "").replace(/ /g, "-")); +} +new BananaSlug(); +var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function getDefaultExportFromCjs(n) { + return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; +} +var prism = { exports: {} }; +(function(n) { + var e = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {}; + /** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */ + var t = function(r) { + var a = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, l = 0, d = {}, o = { + /** + * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the + * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load + * additional languages or plugins yourself. + * + * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. + * + * You obviously have to change this value before the automatic highlighting started. To do this, you can add an + * empty Prism object into the global scope before loading the Prism script like this: + * + * ```js + * window.Prism = window.Prism || {}; + * Prism.manual = true; + * // add a new